code review

This commit is contained in:
Jean-Christian 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, Para,
Select Select
}; };
use Dotclear\Helper\Html\Html;
use Exception; use Exception;
class Config extends dcNsProcess class Config extends dcNsProcess

View file

@ -64,7 +64,7 @@ class Install extends dcNsProcess
); );
while ($record->fetch()) { while ($record->fetch()) {
if (preg_match('/^translater_(.*?)$/', $record->f('setting_id'), $match)) { 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_id', $match[1]);
$cur->setField('setting_ns', My::id()); $cur->setField('setting_ns', My::id());
$cur->update( $cur->update(

View file

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