use new Html form for tools configuration

master
Jean-Christian Paul Denis 2023-03-18 23:00:40 +01:00
parent 8c0ee39e2a
commit 7eb55bc394
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
12 changed files with 350 additions and 202 deletions

View File

@ -106,7 +106,7 @@ class Config extends dcNsProcess
(new Fieldset())->class('fieldset')->legend(new Legend(__('List of disabled actions')))->fields($items), (new Fieldset())->class('fieldset')->legend(new Legend(__('List of disabled actions')))->fields($items),
(new Fieldset())->class('fieldset')->legend(new Legend(__('Options')))->fields([ (new Fieldset())->class('fieldset')->legend(new Legend(__('Options')))->fields([
(new Para())->items([ (new Para())->items([
(new Checkbox('nodetails', dcCore::app()->blog->settings->get(Core::id())->get('nodetails')))->value('1'), (new Checkbox('nodetails', (bool) dcCore::app()->blog->settings->get(Core::id())->get('nodetails')))->value('1'),
(new Label(__('Hide details of rendered actions')))->class('classic')->for('nodetails'), (new Label(__('Hide details of rendered actions')))->class('classic')->for('nodetails'),
]), ]),
]), ]),

View File

@ -258,7 +258,7 @@ class Manage extends dcNsProcess
echo ' echo '
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3> <h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p> <p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
<p class="info">' . html::escapeHTML(self::$action->description()) . '</p> <h4>' . html::escapeHTML(self::$action->description()) . '</h4>
<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' . <form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' .
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . ' (empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' . <p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .

View File

@ -16,6 +16,17 @@ namespace Dotclear\Plugin\improve\Module;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Label,
Legend,
Note,
Para,
Select,
Textarea
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
@ -25,7 +36,7 @@ use form;
use html; use html;
/* php */ /* php */
use Dotclear\Exception; use Exception;
/** /**
* Improve action module php header * Improve action module php header
@ -112,32 +123,43 @@ class cssheader extends Action
$this->redirect($url); $this->redirect($url);
} }
return ' return (new Div())->items([
<p class="warning">' . __('This feature is experimental and not tested yet.') . '</p> (new Note())->text(__('This feature is experimental and not tested yet.'))->class('form-note'),
(new Fieldset())->class('fieldset')->legend((new Legend(__('Adjustments'))))->fields([
<p><label for="bloc_action">' . __('Action:') . '</label>' . // bloc_action
form::combo('bloc_action', $this->action_bloc, $this->getSetting('bloc_action')) . ' (new Para())->items([
</p> (new Label(__('Action:')))->for('bloc_action'),
(new Select('bloc_action'))->default($this->getSetting('bloc_action'))->items($this->action_bloc),
<p><label class="classic" for="exclude_locales">' . ]),
form::checkbox('exclude_locales', 1, $this->getSetting('exclude_locales')) . ' ' . // exclude_locales
__('Do not add bloc to files from "locales" and "libs" folder') . (new Para())->items([
'</label></p> (new Checkbox('exclude_locales', !empty($this->getSetting('exclude_locales'))))->value(1),
(new Label(__('Do not add bloc to files from "locales" and "libs" folder'), Label::OUTSIDE_LABEL_AFTER))->for('exclude_locales')->class('classic'),
<p><label class="classic" for="exclude_templates">' . ]),
form::checkbox('exclude_templates', 1, $this->getSetting('exclude_templates')) . ' ' . // exclude_templates
__('Do not add bloc to files from "tpl" and "default-templates" folder') . (new Para())->items([
'</label></p> (new Checkbox('exclude_templates', !empty($this->getSetting('exclude_templates'))))->value(1),
(new Label(__('Do not add bloc to files from "tpl" and "default-templates" folder'), Label::OUTSIDE_LABEL_AFTER))->for('exclude_templates')->class('classic'),
<p>' . __('Bloc content:') . '</p> ]),
<p class="area">' . ]),
form::textarea('bloc_content', 50, 10, html::escapeHTML($this->bloc_content)) . ' (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
</p><p class="form-note">' . // bloc_content
sprintf( (new Para())->items([
(new Label(__('Bloc content:')))->for('bloc_content'),
(new Textarea('bloc_content', html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
]),
(new Note())->text(sprintf(
__('You can use wildcards %s'), __('You can use wildcards %s'),
'%year%, %module_id%, %module_name%, %module_author%, %module_type%, %user_cn%, %user_name%, %user_email%, %user_url%' '%year%, %module_id%, %module_name%, %module_author%, %module_type%, %user_cn%, %user_name%, %user_email%, %user_url%'
) . '<br />' . __('Do not put structural elements to the begining of lines.') . '</p>' . ))->class('form-note'),
'<div class="fieldset box"><h4>' . __('Exemple') . '</h4><pre class="code">' . self::$exemple . '</pre></div>'; (new Note())->text(__('Do not put structural elements to the begining of lines.'))->class('form-note'),
// exemple
(new Para())->items([
(new Label(__('Exemple:')))->for('content_exemple'),
(new Textarea('content_exemple', html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->extra('readonly="true"'),
]),
]),
])->render();
} }
public function openModule(): ?bool public function openModule(): ?bool

View File

@ -16,9 +16,17 @@ namespace Dotclear\Plugin\improve\Module;
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
use Dotclear\Helper\Html\Form\{
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Para
};
/* clearbricks */ /* clearbricks */
use form;
use files; use files;
use text; use text;
use xmlTag; use xmlTag;
@ -64,19 +72,19 @@ class dcstore extends Action
$this->redirect($url); $this->redirect($url);
} }
return return (new Div())->items([
'<p class="info">' . __('File will be overwritten if it exists') . '</p>' . (new Note())->text(__('File will be overwritten if it exists'))->class('form-note'),
'<p><label class="classic" for="dcstore_pattern">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
__('Predictable URL to zip file on the external repository') . '<br />' . // phpexe_path
form::field('dcstore_pattern', 160, 255, $this->pattern) . '</label>' . (new Para())->items([
'</p>' . (new Label(__('Predictable URL to zip file on the external repository:')))->for('dcstore_pattern'),
'<p class="form-note">' . (new Input('dcstore_pattern'))->size(65)->maxlenght(255)->value($this->pattern),
sprintf(__('You can use wildcards %s'), '%author%, %type%, %id%, %version%.') . ]),
'<br /> ' . (new Note())->text(sprintf(__('You can use wildcards %s'), '%author%, %type%, %id%, %version%.'))->class('form-note'),
__('For exemple on github https://github.com/MyGitName/%id%/releases/download/v%version%/%type%-%id%.zip') . (new Note())->text(__('For exemple on github https://github.com/MyGitName/%id%/releases/download/v%version%/%type%-%id%.zip'))->class('form-note'),
'<br />' . (new Note())->text(__('Note on github, you must create a release and join to it the module zip file.'))->class('form-note'),
__('Note on github, you must create a release and join to it the module zip file.') . ' ]),
</p>'; ])->render();
} }
public function openModule(): ?bool public function openModule(): ?bool

View File

@ -14,11 +14,21 @@ declare(strict_types=1);
namespace Dotclear\Plugin\improve\Module; namespace Dotclear\Plugin\improve\Module;
/* dotclear */
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Label,
Legend,
Note,
Para
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
/* clearbricks */ /* clearbricks */
use form;
/** /**
* Improve action module end of file * Improve action module end of file
@ -51,13 +61,16 @@ class endoffile extends Action
$this->redirect($url); $this->redirect($url);
} }
return return (new Div())->items([
'<p><label class="classic" for="endoffile_psr2">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
form::checkbox('endoffile_psr2', 255, $this->getSetting('psr2')) . // endoffile_psr2
__('Add a blank line to the end of file') . (new Para())->items([
'</label></p><p class="form-note">' . (new Checkbox('endoffile_psr2', !empty($this->getSetting('psr2'))))->value(1),
__('PSR2 must have a blank line, whereas PSR12 must not.') . (new Label(__('Add a blank line to the end of file'), Label::OUTSIDE_LABEL_AFTER))->for('endoffile_psr2')->class('classic'),
'</p>'; ]),
(new Note())->text(__('PSR2 must have a blank line, whereas PSR12 must not.'))->class('form-note'),
]),
])->render();
} }
public function readFile(&$content): ?bool public function readFile(&$content): ?bool

View File

@ -16,12 +16,21 @@ namespace Dotclear\Plugin\improve\Module;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Para
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
/* clearbricks */ /* clearbricks */
use form;
/** /**
* Improve action module Github shields.io * Improve action module Github shields.io
@ -89,16 +98,23 @@ class gitshields extends Action
$this->redirect($url); $this->redirect($url);
} }
return ' return (new Div())->items([
<p><label for="username">' . __('Your Github user name :') . '</label>' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
form::field('username', 60, 100, $this->username) . ' // username
</p><p class="form-note">' . __('Used in your Github URL: http://github.com/username/module_id.') . '<br />' . (new Para())->items([
__('If you have badges not created by this tool in the README.md file you should remove them manually.') . '</p> (new Label(__('Your Github user name:')))->for('username'),
(new Input('username'))->size(65)->maxlenght(255)->value($this->username),
<p><label for="dotaddict">' . ]),
form::checkbox('dotaddict', 1, $this->dotaddict) . ' ' . (new Note())->text(__('Used in your Github URL: http://github.com/username/module_id.'))->class('form-note'),
__('Include Dotaddict badge') . '</label> (new Note())->text(__('If you have badges not created by this tool in the README.md file you should remove them manually.'))->class('form-note'),
</p><p class="form-note">' . __('If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.') . '</p>'; // dotaddict
(new Para())->items([
(new Checkbox('dotaddict', $this->dotaddict))->value(1),
(new Label(__('Include Dotaddict badge'), Label::OUTSIDE_LABEL_AFTER))->for('dotaddict')->class('classic'),
]),
(new Note())->text(__('If your plugin or theme is on Dotaddict, you can add a badge to link to its details in Dotaddict.'))->class('form-note'),
]),
])->render();
} }
public function openModule(): ?bool public function openModule(): ?bool

View File

@ -14,11 +14,21 @@ declare(strict_types=1);
namespace Dotclear\Plugin\improve\Module; namespace Dotclear\Plugin\improve\Module;
/* dotclear */
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Label,
Legend,
Para,
Select
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
/* clearbricks */ /* clearbricks */
use form;
use files; use files;
/* php */ /* php */
@ -86,14 +96,20 @@ class licensefile extends Action
$this->redirect($url); $this->redirect($url);
} }
return ' return (new Div())->items([
<p class="field"><label for="action_version">' . __('License version:') . '</label>' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Adjustments'))))->fields([
form::combo('action_version', $this->action_version, $this->getSetting('action_version')) . ' // action_version
</p> (new Para())->items([
(new Label(__('License version:')))->for('action_version'),
<p class="field"><label for="action_full">' . __('Action on file:') . '</label>' . (new Select('action_version'))->default($this->getSetting('action_version'))->items($this->action_version),
form::combo('action_full', $this->action_full, $this->getSetting('action_full')) . ]),
'</p>'; // action_full
(new Para())->items([
(new Label(__('Action on file:')))->for('action_full'),
(new Select('action_full'))->default($this->getSetting('action_full'))->items($this->action_full),
]),
]),
])->render();
} }
public function openModule(): ?bool public function openModule(): ?bool

View File

@ -14,12 +14,22 @@ declare(strict_types=1);
namespace Dotclear\Plugin\improve\Module; namespace Dotclear\Plugin\improve\Module;
/* dotclear */
use Dotclear\Helper\Html\Form\{
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Para
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
use Dotclear\Plugin\improve\Core; use Dotclear\Plugin\improve\Core;
/* clearbricks */ /* clearbricks */
use form;
/** /**
* Improve action module new line * Improve action module new line
@ -60,13 +70,16 @@ class newline extends Action
$ext = []; $ext = [];
} }
return return (new Div())->items([
'<p><label class="classic" for="newline_extensions">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
__('List of files extension to work on:') . '<br />' . // newline_extensions
form::field('newline_extensions', 65, 255, implode(',', $ext)) . (new Para())->items([
'</label></p><p class="form-note">' . (new Label(__('List of files extension to work on:')))->for('newline_extensions'),
__('Use comma separated list of extensions without dot, recommand "php,js,xml,txt,md".') . (new Input('newline_extensions'))->size(65)->maxlenght(255)->value(implode(',', $ext)),
'</p>'; ]),
(new Note())->text(__('Use comma separated list of extensions without dot, recommand "php,js,xml,txt,md".'))->class('form-note'),
]),
])->render();
} }
public function readFile(string &$content): ?bool public function readFile(string &$content): ?bool

View File

@ -21,10 +21,19 @@ use Dotclear\Plugin\improve\Core;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use dcPage; use dcPage;
use Dotclear\Helper\Html\Form\{
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Para,
Textarea
};
/* clearbricks */ /* clearbricks */
use html; use html;
use form;
use path; use path;
/* php */ /* php */
@ -99,22 +108,23 @@ class phpcsfixer extends Action
} }
$content = (string) file_get_contents(__DIR__ . '/phpcsfixer/phpcsfixer.rules.php'); $content = (string) file_get_contents(__DIR__ . '/phpcsfixer/phpcsfixer.rules.php');
return return (new Div())->items([
'<p><label class="classic" for="phpexe_path">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Root'))))->fields([
__('Root directory of PHP executable:') . '<br />' . // phpexe_path
form::field('phpexe_path', 160, 255, $this->phpexe_path) . '</label>' . (new Para())->items([
'</p>' . (new Label(__('Root directory of PHP executable:')))->for('phpexe_path'),
'<p class="form-note">' . (new Input('phpexe_path'))->size(65)->maxlenght(255)->value($this->phpexe_path),
__('If this module does not work you can try to put here directory to php executable (without executable file name).') . ]),
' C:\path_to\php</p>' . (new Note())->text(__('If this module does not work you can try to put here directory to php executable (without executable file name).'))->class('form-note'),
]),
'<p><label for="file_content">' . __('PHP CS Fixer configuration file:') . '</strong></label></p>' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Bootstrap'))))->fields([
'<p>' . form::textarea('file_content', 120, 60, [ // file_content
'default' => html::escapeHTML($content), (new Para())->items([
'class' => 'maximal', (new Label(__('PHP CS Fixer configuration file:')))->for('file_content'),
'extra_html' => 'readonly="true"', (new Textarea('file_content', html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->extra('readonly="true"'),
]) . '</p>' . ]),
( ]),
])->render() . (
!self::$user_ui_colorsyntax ? '' : !self::$user_ui_colorsyntax ? '' :
dcPage::jsModuleLoad(Core::id() . '/inc/module/phpcsfixer/phpcsfixer.improve.js') . dcPage::jsModuleLoad(Core::id() . '/inc/module/phpcsfixer/phpcsfixer.improve.js') .
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme) dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)

View File

@ -16,12 +16,22 @@ namespace Dotclear\Plugin\improve\Module;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Label,
Legend,
Note,
Para,
Select,
Textarea
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
/* clearbricks */ /* clearbricks */
use form;
use html; use html;
/* php */ /* php */
@ -112,30 +122,42 @@ class phpheader extends Action
$this->redirect($url); $this->redirect($url);
} }
return ' return (new Div())->items([
<p><label for="bloc_action">' . __('Action:') . '</label>' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Adjustments'))))->fields([
form::combo('bloc_action', $this->action_bloc, $this->getSetting('bloc_action')) . ' // bloc_action
</p> (new Para())->items([
(new Label(__('Action:')))->for('bloc_action'),
<p><label class="classic" for="remove_old">' . (new Select('bloc_action'))->default($this->getSetting('bloc_action'))->items($this->action_bloc),
form::checkbox('remove_old', 1, $this->getSetting('remove_old')) . ' ' . ]),
__('Remove old style bloc header (using #)') . // remove_old
'</label></p> (new Para())->items([
(new Checkbox('remove_old', !empty($this->getSetting('remove_old'))))->value(1),
<p><label class="classic" for="exclude_locales">' . (new Label(__('Remove old style bloc header (using #)'), Label::OUTSIDE_LABEL_AFTER))->for('remove_old')->class('classic'),
form::checkbox('exclude_locales', 1, $this->getSetting('exclude_locales')) . ' ' . ]),
__('Do not add bloc to files from "locales" and "libs" folder') . // exclude_locales
'</label></p> (new Para())->items([
(new Checkbox('exclude_locales', !empty($this->getSetting('exclude_locales'))))->value(1),
<p>' . __('Bloc content:') . '</p> (new Label(__('Do not add bloc to files from "locales" and "libs" folder'), Label::OUTSIDE_LABEL_AFTER))->for('exclude_locales')->class('classic'),
<p class="area">' . ]),
form::textarea('bloc_content', 50, 10, html::escapeHTML($this->bloc_content)) . ' ]),
</p><p class="form-note">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
sprintf( // bloc_content
(new Para())->items([
(new Label(__('Bloc content:')))->for('bloc_content'),
(new Textarea('bloc_content', html::escapeHTML($this->bloc_content)))->cols(120)->rows(10),
]),
(new Note())->text(sprintf(
__('You can use wildcards %s'), __('You can use wildcards %s'),
'%year%, %module_id%, %module_name%, %module_author%, %module_type%, %user_cn%, %user_name%, %user_email%, %user_url%' '%year%, %module_id%, %module_name%, %module_author%, %module_type%, %user_cn%, %user_name%, %user_email%, %user_url%'
) . '<br />' . __('Do not put structural elements to the begining of lines.') . '</p>' . ))->class('form-note'),
'<div class="fieldset box"><h4>' . __('Exemple') . '</h4><pre class="code">' . self::$exemple . '</pre></div>'; (new Note())->text(__('Do not put structural elements to the begining of lines.'))->class('form-note'),
// exemple
(new Para())->items([
(new Label(__('Exemple:')))->for('content_exemple'),
(new Textarea('content_exemple', html::escapeHTML(self::$exemple)))->cols(120)->rows(10)->extra('readonly="true"'),
]),
]),
])->render();
} }
public function openModule(): ?bool public function openModule(): ?bool

View File

@ -21,10 +21,21 @@ use Dotclear\Plugin\improve\Core;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use dcPage; use dcPage;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Number,
Para,
Textarea
};
/* clearbricks */ /* clearbricks */
use html; use html;
use form;
use path; use path;
/* php */ /* php */
@ -103,37 +114,46 @@ class phpstan extends Action
} }
$content = (string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.conf'); $content = (string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.conf');
return return (new Div())->items([
'<p class="info">' . __('You must enable improve details to view analyse results !') . '</p>' . (new Note())->text(__('You must enable improve details to view analyse results !'))->class('form-note'),
'<p><label class="classic" for="phpexe_path">' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Root'))))->fields([
__('Root directory of PHP executable:') . '<br />' . // phpexe_path
form::field('phpexe_path', 160, 255, $this->phpexe_path) . '</label>' . (new Para())->items([
'</p>' . (new Label(__('Root directory of PHP executable:')))->for('phpexe_path'),
'<p class="form-note">' . (new Input('phpexe_path'))->size(65)->maxlenght(255)->value($this->phpexe_path),
__('If this module does not work you can try to put here directory to php executable (without executable file name).') . ]),
' C:\path_to\php</p>' . (new Note())->text(__('If this module does not work you can try to put here directory to php executable (without executable file name).'))->class('form-note'),
'<p><label class="classic" for="run_level">' . __('Level:') . ' </label>' . ]),
form::number('run_level', ['min' => 0, 'max' => 9, 'default' => $this->run_level]) . '</p>' . (new Fieldset())->class('fieldset')->legend((new Legend(__('Adjustments'))))->fields([
'<p><label class="classic" for="ignored_vars">' . // run_level
__('List of ignored variables:') . '<br />' . (new Para())->items([
form::field('ignored_vars', 160, 255, $this->ignored_vars) . '</label>' . (new Label(__('Level:')))->for('run_level')->class('classic'),
'</p>' . (new Number('run_level'))->min(0)->max(50)->value($this->run_level),
'<p class="form-note">' . sprintf( ]),
__('If you have errors like "%s", you can add this var here. Use ; as separator and do not put $ ahead.'), // ignored_vars
'Variable $var might not be defined' (new Para())->items([
) . ' ' . __('For exemple: var;_othervar;avar') . '<br />' . __('Some variables like core, _menu, are already set in ignored list.') . '</p>' . (new Label(__('List of ignored variables:')))->for('ignored_vars'),
'<p><label class="classic" for="split_report">' . (new Input('ignored_vars'))->size(65)->maxlenght(255)->value($this->ignored_vars),
form::checkbox('split_report', 1, $this->getSetting('split_report')) . ]),
__('Split report by file rather than all in the end.') . '</label></p>' . (new Note())->text(
'<p class="form-note">' . __('Enable this can cause timeout.') . '</p>' . sprintf(__('If you have errors like "%s", you can add this var here. Use ; as separator and do not put $ ahead.'), 'Variable $var might not be defined') .
' ' . __('For exemple: var;_othervar;avar') . '<br />' . __('Some variables like core, _menu, are already set in ignored list.')
'<p><label for="file_content">' . __('PHPStan configuration file:') . '</strong></label></p>' . )->class('form-note'),
'<p>' . form::textarea('file_content', 120, 14, [ // split_report
'default' => html::escapeHTML($content), (new Para())->items([
'class' => 'maximal', (new Checkbox('split_report', !empty($this->getSetting('split_report'))))->value(1),
'extra_html' => 'readonly="true"', (new Label(__('Split report by file rather than all in the end.'), Label::OUTSIDE_LABEL_AFTER))->for('split_report')->class('classic'),
]) . '</p>' . ]),
( (new Note())->text(__('Enable this can cause timeout.'))->class('form-note'),
]),
(new Fieldset())->class('fieldset')->legend((new Legend(__('Bootstrap'))))->fields([
// file_content
(new Para())->items([
(new Label(__('PHPStan configuration file:')))->for('file_content'),
(new Textarea('file_content', html::escapeHTML($content)))->class('maximal')->cols(120)->rows(14)->extra('readonly="true"'),
]),
]),
])->render() . (
!self::$user_ui_colorsyntax ? '' : !self::$user_ui_colorsyntax ? '' :
dcPage::jsModuleLoad(Core::id() . '/inc/module/phpstan/phpstan.improve.js') . dcPage::jsModuleLoad(Core::id() . '/inc/module/phpstan/phpstan.improve.js') .
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme) dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)

View File

@ -16,19 +16,28 @@ namespace Dotclear\Plugin\improve\Module;
/* dotclear */ /* dotclear */
use dcCore; use dcCore;
use Dotclear\Helper\Html\Form\{
Checkbox,
Div,
Fieldset,
Input,
Label,
Legend,
Note,
Para
};
/* improve */ /* improve */
use Dotclear\Plugin\improve\Action; use Dotclear\Plugin\improve\Action;
/* clearbricks */ /* clearbricks */
use form;
use path; use path;
use files; use files;
/** /**
* Improve action module zip * Improve action module zip
*/ */
class zip extends action class zip extends Action
{ {
/** @var array List of excluded file pattern */ /** @var array List of excluded file pattern */
public static $exclude = [ public static $exclude = [
@ -106,53 +115,52 @@ class zip extends action
$this->redirect($url); $this->redirect($url);
} }
return ' return (new Div())->items([
<div class="fieldset"> (new Fieldset())->class('fieldset')->legend((new Legend(__('Root'))))->fields([
<h4>' . __('Root') . '</h4> // pack_repository
(new Para())->items([
<p><label for="pack_repository">' . __('Path to repository:') . ' ' . (new Label(__('Path to repository:')))->for('pack_repository'),
form::field('pack_repository', 65, 255, $this->getSetting('pack_repository'), 'maximal') . (new Input('pack_repository'))->size(65)->maxlenght(255)->value($this->getSetting('pack_repository')),
'</label></p>' . ]),
'<p class="form-note">' . sprintf( (new Note())->text(sprintf(
__('Preconization: %s'), __('Preconization: %s'),
dcCore::app()->blog->public_path ? dcCore::app()->blog->public_path ?
path::real(dcCore::app()->blog->public_path) : __("Blog's public directory") path::real(dcCore::app()->blog->public_path) : __("Blog's public directory")
) . '</p> ))->class('form-note'),
</div> ]),
(new Fieldset())->class('fieldset')->legend((new Legend(__('Files'))))->fields([
<div class="fieldset"> // pack_filename
<h4>' . __('Files') . '</h4> (new Para())->items([
(new Label(__('Name of exported package:')))->for('pack_filename'),
<p><label for="pack_filename">' . __('Name of exported package:') . ' ' . (new Input('pack_filename'))->size(65)->maxlenght(255)->value($this->getSetting('pack_filename')),
form::field('pack_filename', 65, 255, $this->pack_filename, 'maximal') . ]),
'</label></p> (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%'))->class('form-note'),
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%') . '</p> // secondpack_filename
(new Para())->items([
<p><label for="secondpack_filename">' . __('Name of second exported package:') . ' ' . (new Label(__('Name of second exported package:')))->for('secondpack_filename'),
form::field('secondpack_filename', 65, 255, $this->getSetting('secondpack_filename'), 'maximal') . (new Input('secondpack_filename'))->size(65)->maxlenght(255)->value($this->getSetting('secondpack_filename')),
'</label></p> ]),
<p class="form-note">' . sprintf(__('Preconization: %s'), '%type%-%id%-%version%') . '</p> (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%-%version%'))->class('form-note'),
// pack_overwrite
<p><label class="classic" for="pack_overwrite">' . (new Para())->items([
form::checkbox('pack_overwrite', 1, !empty($this->getSetting('pack_overwrite'))) . ' ' . (new Checkbox('pack_overwrite', !empty($this->getSetting('pack_overwrite'))))->value(1),
__('Overwrite existing package') . '</label></p> (new Label(__('Overwrite existing languages'), Label::OUTSIDE_LABEL_AFTER))->for('pack_overwrite')->class('classic'),
]),
</div> ]),
(new Fieldset())->class('fieldset')->legend((new Legend(__('Contents'))))->fields([
<div class="fieldset"> // pack_excludefiles
<h4>' . __('Content') . '</h4> (new Para())->items([
(new Label(__('Extra files to exclude from package:')))->for('pack_excludefiles'),
<p><label for="pack_excludefiles">' . __('Extra files to exclude from package:') . ' ' . (new Input('pack_excludefiles'))->size(65)->maxlenght(255)->value($this->getSetting('pack_excludefiles')),
form::field('pack_excludefiles', 65, 255, $this->pack_excludefiles, 'maximal') . ]),
'</label></p> (new Note())->text(sprintf(__('By default all these files are always removed from packages : %s'), implode(', ', self::$exclude)))->class('form-note'),
<p class="form-note">' . sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz') . '<br />' . // pack_nocomment
sprintf(__('By default all these files are always removed from packages : %s'), implode(', ', self::$exclude)) . '</p> (new Para())->items([
(new Checkbox('pack_nocomment', !empty($this->getSetting('pack_nocomment'))))->value(1),
<p><label class="classic" for="pack_nocomment">' . (new Label(__('Remove comments from files'), Label::OUTSIDE_LABEL_AFTER))->for('pack_nocomment')->class('classic'),
form::checkbox('pack_nocomment', 1, $this->getSetting('pack_nocomment')) . ' ' . ]),
__('Remove comments from files') . '</label></p> ]),
])->render();
</div>';
} }
public function closeModule(): ?bool public function closeModule(): ?bool