From 5334bfa884ecd0db9ec982818e408457868b8d36 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 26 Mar 2023 21:37:00 +0200 Subject: [PATCH] use 2.26 Html Helpers --- src/BackendList.php | 18 +++++++++--------- src/Manage.php | 43 ++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/BackendList.php b/src/BackendList.php index 6597062..ea89719 100644 --- a/src/BackendList.php +++ b/src/BackendList.php @@ -17,9 +17,9 @@ namespace Dotclear\Plugin\dcLog; use ArrayObject; use adminGenericListV2; use dcPager; +use Dotclear\Helper\Html\Html; +use Dotclear\Helper\Html\Form\Checkbox; use dt; -use form; -use html; class BackendList extends adminGenericListV2 { @@ -77,28 +77,28 @@ class BackendList extends adminGenericListV2 { $cols = [ 'check' => '' . - form::checkbox(['entries[]'], $this->rs->log_id, ['checked' => $checked]) . + (new Checkbox(['entries[]'], $checked))->value($this->rs->log_id)->render() . '', 'date' => '' . - html::escapeHTML(dt::dt2str( + Html::escapeHTML(dt::dt2str( __('%Y-%m-%d %H:%M'), $this->rs->log_dt )) . '', 'msg' => '' . - nl2br(html::escapeHTML($this->rs->log_msg)) . + nl2br(Html::escapeHTML($this->rs->log_msg)) . '', 'blog' => '' . - html::escapeHTML($this->rs->blog_id) . + Html::escapeHTML($this->rs->blog_id) . '', 'table' => '' . - html::escapeHTML($this->rs->log_table) . + Html::escapeHTML($this->rs->log_table) . '', 'user' => '' . - html::escapeHTML($this->rs->getUserCN()) . + Html::escapeHTML($this->rs->getUserCN()) . '', 'ip' => '' . - html::escapeHTML($this->rs->log_ip) . + Html::escapeHTML($this->rs->log_ip) . '', ]; $cols = new ArrayObject($cols); diff --git a/src/Manage.php b/src/Manage.php index db8a69e..f3c36ac 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -17,8 +17,15 @@ namespace Dotclear\Plugin\dcLog; use dcCore; use dcNsProcess; use dcPage; +use Dotclear\Helper\Html\Form\{ + Div, + Form, + Hidden, + Para, + Submit, + Text +}; use Exception; -use form; /** * Manage logs list @@ -89,31 +96,29 @@ class Manage extends dcNsProcess if ($current->logs !== null && $current->list != null) { if ($current->logs->isEmpty() && !$current->filter->show()) { - echo '

' . __('There are no logs') . '

'; + echo (new Text('p', __('There are no logs')))->render(); } else { $current->filter->display( 'admin.plugin.' . My::id(), - form::hidden('p', My::id()) + (new Hidden(['p'], My::id()))->render() ); $current->list->display( (int) $current->filter->__get('page'), (int) $current->filter->__get('nb'), - '
' . - - '%s' . - - '
' . - '

' . - - '

' . - ' ' . - '' . - '

' . - - dcCore::app()->adminurl?->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) . - dcCore::app()->formNonce() . - '
' . - '
', + (new Form('form-entries'))->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->method('post')->fields([ + (new Text('', '%s')), + (new Div())->class('two-cols')->items([ + (new Para())->class('col checkboxes-helpers'), + (new Para())->class('col right')->separator(' ')->items([ + (new Submit(['selected_logs']))->class('delete')->value(__('Delete selected logs')), + (new Submit(['all_logs']))->class('delete')->value(__('Delete all logs')), + ]), + (new Text('', + dcCore::app()->adminurl?->getHiddenFormFields('admin.plugin.' . My::id(), $current->filter->values()) . + dcCore::app()->formNonce() + )), + ]), + ])->render(), $current->filter->show() ); }