From d2cc8819149ef845a6ddea582daf1ee537993679 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 24 Oct 2021 09:33:15 +0200 Subject: [PATCH] clean up posts list --- inc/lib.index.pager.php | 64 ++++++++++++++++++++++------------------- index.php | 8 +++--- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/inc/lib.index.pager.php b/inc/lib.index.pager.php index 4cecb8d..4706e14 100644 --- a/inc/lib.index.pager.php +++ b/inc/lib.index.pager.php @@ -127,39 +127,45 @@ class adminPeriodicalList extends adminGenericList } } + $cols = [ + 'title' => '' . __('Title') . '', + 'date' => '' . __('Date') . '', + 'category' => '' . __('Category') . '', + 'author' => '' . __('Author') . '', + 'status' => '' . __('Status') . '', + 'create' => '' . __('Create date') . '' + ]; + $html_block = - '' . implode($cols) . '%s
' . ($filter->show() ? + '
' . - '' . - '' . - '' . - '' . - '' . - '' . - '%s
' . ($filter->show() ? sprintf(__('List of %s entries matching the filter.'), $this->rs_count) : sprintf(__('List of %s entries.'), $this->rs_count) - ). '
' . __('Title') . '' . __('Date') . '' . __('Category') . '' . __('Author') . '' . __('Status') . '' . __('Create date') . '
'; + ). '
%s'; if ($enclose_block) { $html_block = sprintf($enclose_block, $html_block); } - $echo .= $pager->getLinks(); - $blocks = explode('%s', $html_block); - $echo .= $blocks[0]; + echo $pager->getLinks() . $blocks[0]; while ($this->rs->fetch()) { - $echo .= $this->postLine(isset($periodical_entries[$this->rs->post_id])); + echo $this->postLine(isset($periodical_entries[$this->rs->post_id])); } - $echo .= $blocks[1]; + $img = '%1$s %1$s'; - $echo .= $pager->getLinks(); + echo $blocks[1] . '

' . __('Legend: ') . + sprintf($img, __('Published'), 'check-on.png') . ' - ' . + sprintf($img, __('Unpublished'), 'check-off.png') . ' - ' . + sprintf($img, __('Scheduled'), 'scheduled.png') . ' - ' . + sprintf($img, __('Pending'), 'check-wrn.png') . ' - ' . + sprintf($img, __('Protected'), 'locker.png') . ' - ' . + sprintf($img, __('Selected'), 'selected.png') . ' - ' . + sprintf($img, __('Attachments'), 'attach.png') . + '

' . $blocks[2] . $pager->getLinks(); } - - return $echo; } private function postLine($checked) @@ -217,19 +223,17 @@ class adminPeriodicalList extends adminGenericList $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png'); } - $res = - '' . - '' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, 0) . '' . - '' . - html::escapeHTML($this->rs->post_title) . '' . - '' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '' . - '' . $cat_title . '' . - '' . $this->rs->user_id . '' . - '' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '' . - '' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_creadt, $this->rs->core->auth->getInfo('user_tz')) . '' . - ''; + $cols = [ + 'check' => '' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, ['checked' => $checked]) . '', + 'title' => '' . html::escapeHTML($this->rs->post_title) . '', + 'date' => '' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '', + 'category' => '' . $cat_title . '', + 'author' => '' . $this->rs->user_id . '', + 'status' => '' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '', + 'create' => '' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_creadt, $this->rs->core->auth->getInfo('user_tz')) . '' + ]; - return $res; + return '' . implode($cols) . '';; } } \ No newline at end of file diff --git a/index.php b/index.php index 5ac06e3..aec75d1 100644 --- a/index.php +++ b/index.php @@ -222,14 +222,14 @@ if ($_REQUEST['part'] == 'period') { } $starting_script = - dcPage::jsLoad('index.php?pf=periodical/js/checkbox.js') . + dcPage::jsLoad(dcPage::getPF('periodical/js/checkbox.js')) . $post_filter->js($core->adminurl->get('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '&').'#posts'); } # Display echo ' ' . __('Periodical') . '' . - dcPage::jsLoad('index.php?pf=periodical/js/dates.js') . + dcPage::jsLoad(dcPage::getPF('periodical/js/dates.js')) . $starting_script . dcPage::jsDatePicker() . dcPage::jsPageTabs() . @@ -317,7 +317,7 @@ if ($_REQUEST['part'] == 'period') { ); # Posts list - echo $post_list->postDisplay($post_filter, $base_url, + $post_list->postDisplay($post_filter, $base_url, '
' . '%s' . @@ -416,7 +416,7 @@ if ($_REQUEST['part'] == 'period') { # Display echo '' . __('Periodical') . '' . - dcPage::jsLoad('index.php?pf=periodical/js/checkbox.js') . + dcPage::jsLoad(dcPage::getPF('periodical/js/checkbox.js')) . $p_filter->js($core->adminurl->get('admin.plugin.periodical', ['part' => 'periods'])) . '' . '' .