code review

This commit is contained in:
Jean-Christian Paul Denis 2023-04-07 23:51:19 +02:00
parent f0debe050f
commit aeb9bb3353
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 44 additions and 35 deletions

View File

@ -29,7 +29,6 @@ use Dotclear\Helper\Html\Form\{
Para,
Select
};
use Dotclear\Helper\Html\Html;
use Exception;
class Config extends dcNsProcess

View File

@ -64,7 +64,7 @@ class Install extends dcNsProcess
);
while ($record->fetch()) {
if (preg_match('/^translater_(.*?)$/', $record->f('setting_id'), $match)) {
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcNamespace::NS_TABLE_NAME);
$cur->setField('setting_id', $match[1]);
$cur->setField('setting_ns', My::id());
$cur->update(

View File

@ -321,16 +321,18 @@ class Manage extends dcNsProcess
<div class="two-cols">
<p class="col checkboxes-helpers"></p>' .
(new Para())->class('col right')->items(array_merge([
(new Text('', __('Selected languages action:'))),
(new Select('action'))->items([
__('Backup languages') => 'module_create_backups',
__('Delete languages') => 'module_delete_codes',
__('Export languages') => 'module_export_pack',
]),
(new Submit('do-action'))->value(__('ok')),
dcCore::app()->formNonce(false),
], dcCore::app()->adminurl?->hiddenFormFields(
(new Para())->class('col right')->items(array_merge(
[
(new Text('', __('Selected languages action:'))),
(new Select('action'))->items([
__('Backup languages') => 'module_create_backups',
__('Delete languages') => 'module_delete_codes',
__('Export languages') => 'module_export_pack',
]),
(new Submit('do-action'))->value(__('ok')),
dcCore::app()->formNonce(false),
],
dcCore::app()->adminurl?->hiddenFormFields(
My::id(),
['type' => $current->module->type, 'module' => $current->module->id]
)
@ -389,15 +391,17 @@ class Manage extends dcNsProcess
<div class="two-cols">
<p class="col checkboxes-helpers"></p>' .
(new Para())->class('col right')->items(array_merge([
(new Text('', __('Selected backups action:'))),
(new Select('action'))->items([
__('Restore backups') => 'module_restore_backup',
__('Delete backups') => 'module_delete_backup',
]),
(new Submit('do-action'))->value(__('ok')),
dcCore::app()->formNonce(false),
], dcCore::app()->adminurl?->hiddenFormFields(
(new Para())->class('col right')->items(array_merge(
[
(new Text('', __('Selected backups action:'))),
(new Select('action'))->items([
__('Restore backups') => 'module_restore_backup',
__('Delete backups') => 'module_delete_backup',
]),
(new Submit('do-action'))->value(__('ok')),
dcCore::app()->formNonce(false),
],
dcCore::app()->adminurl?->hiddenFormFields(
My::id(),
['type' => $current->module->type, 'module' => $current->module->id]
)
@ -427,11 +431,13 @@ class Manage extends dcNsProcess
(new Note())->class('form-note')->text(__('optionnal')),
])->render();
}
echo
(new Para())->items(array_merge([
(new Submit(['save']))->value(__('Create')),
dcCore::app()->formNonce(false),
], dcCore::app()->adminurl?->hiddenFormFields(
echo
(new Para())->items(array_merge(
[
(new Submit(['save']))->value(__('Create')),
dcCore::app()->formNonce(false),
],
dcCore::app()->adminurl?->hiddenFormFields(
My::id(),
['type' => $current->module->type, 'module' => $current->module->id, 'action' => 'module_add_code']
)
@ -447,10 +453,12 @@ class Manage extends dcNsProcess
(new File('packfile')),
]),
(new Para())->items(array_merge([
(new Submit(['save']))->value(__('Import')),
dcCore::app()->formNonce(false),
], dcCore::app()->adminurl?->hiddenFormFields(
(new Para())->items(array_merge(
[
(new Submit(['save']))->value(__('Import')),
dcCore::app()->formNonce(false),
],
dcCore::app()->adminurl?->hiddenFormFields(
My::id(),
['type' => $current->module->type, 'module' => $current->module->id, 'action' => 'module_import_pack']
)
@ -590,11 +598,13 @@ class Manage extends dcNsProcess
(new Select('multigroup'))->items(My::l10nGroupsCombo()),
])->render() .
'</div>' .
(new Para())->class('col right')->items(array_merge([
(new Submit('do-action'))->value(__('Save') . ' (s)')->accesskey('s'),
dcCore::app()->formNonce(false),
(new Hidden(['code'], $current->lang->code)),
], dcCore::app()->adminurl?->hiddenFormFields(
(new Para())->class('col right')->items(array_merge(
[
(new Submit('do-action'))->value(__('Save') . ' (s)')->accesskey('s'),
dcCore::app()->formNonce(false),
(new Hidden(['code'], $current->lang->code)),
],
dcCore::app()->adminurl?->hiddenFormFields(
My::id(),
['type' => $current->module?->type, 'module' => $current->module?->id, 'lang' => $current->lang->code, 'action' => 'module_update_code']
)