use new Html form for tools configuration

This commit is contained in:
Jean-Christian 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(__('Options')))->fields([
(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'),
]),
]),

View file

@ -258,7 +258,7 @@ class Manage extends dcNsProcess
echo '
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
<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">' .
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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