add readonly to textarea as changes not saved

This commit is contained in:
Jean-Christian Denis 2021-11-04 23:18:43 +01:00
parent 403f09a4f5
commit 312d12789e
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -1,16 +1,15 @@
<?php <?php
/** /**
* @brief tweakStores, a plugin for Dotclear 2 * @brief tweakStores, a plugin for Dotclear 2
* *
* @package Dotclear * @package Dotclear
* @subpackage Plugin * @subpackage Plugin
* *
* @author Jean-Christian Denis and Contributors * @author Jean-Christian Denis and Contributors
* *
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class tweakStores class tweakStores
{ {
public static $notice = []; public static $notice = [];
@ -21,7 +20,7 @@ class tweakStores
{ {
$label = empty($module['label']) ? $id : $module['label']; $label = empty($module['label']) ? $id : $module['label'];
$name = __(empty($module['name']) ? $label : $module['name']); $name = __(empty($module['name']) ? $label : $module['name']);
$oname = empty($module['name']) ? $label : $module['name']; $oname = empty($module['name']) ? $label : $module['name'];
return array_merge( return array_merge(
# Default values # Default values
@ -71,6 +70,7 @@ class tweakStores
public static function parseFilePattern($id, $module, $file_pattern) public static function parseFilePattern($id, $module, $file_pattern)
{ {
$module = self::sanitizeModule($id, $module); $module = self::sanitizeModule($id, $module);
return text::tidyURL(str_replace( return text::tidyURL(str_replace(
[ [
'%type%', '%type%',
@ -94,7 +94,7 @@ class tweakStores
return false; return false;
} }
$module = self::sanitizeModule($id, $module); $module = self::sanitizeModule($id, $module);
$rsp = new xmlTag('module'); $rsp = new xmlTag('module');
self::$notice = []; self::$notice = [];
self::$failed = []; self::$failed = [];
@ -120,7 +120,6 @@ class tweakStores
# author # author
if (empty($module['author'])) { if (empty($module['author'])) {
self::$failed[] = 'no module author set in _define.php'; self::$failed[] = 'no module author set in _define.php';
} }
$rsp->author($module['author']); $rsp->author($module['author']);
@ -150,6 +149,7 @@ class tweakStores
} }
if ($req[0] == 'core') { if ($req[0] == 'core') {
$module['dc_min'] = $req[1]; $module['dc_min'] = $req[1];
break; break;
} }
} }
@ -195,12 +195,15 @@ class tweakStores
if (!empty(self::$failed)) { if (!empty(self::$failed)) {
return false; return false;
} }
try { try {
files::putContent($module['root'] . '/dcstore.xml', str_replace('><', ">\n<", $content)); files::putContent($module['root'] . '/dcstore.xml', str_replace('><', ">\n<", $content));
} catch(Exception $e) { } catch (Exception $e) {
self::$failed[] = $e->getMessage(); self::$failed[] = $e->getMessage();
return false; return false;
} }
return true; return true;
} }
} }