clean up posts list

This commit is contained in:
Jean-Christian Denis 2021-10-24 09:33:15 +02:00
parent f8b7dda7c2
commit d2cc881914
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 38 additions and 34 deletions

View file

@ -127,39 +127,45 @@ class adminPeriodicalList extends adminGenericList
} }
} }
$cols = [
'title' => '<th colspan="2" class="first">' . __('Title') . '</th>',
'date' => '<th scope="col">' . __('Date') . '</th>',
'category' => '<th scope="col">' . __('Category') . '</th>',
'author' => '<th scope="col">' . __('Author') . '</th>',
'status' => '<th scope="col">' . __('Status') . '</th>',
'create' => '<th scope="col" class="nowrap">' . __('Create date') . '</th>'
];
$html_block = $html_block =
'<table class="clear"><caption>' . ($filter->show() ? '<div class="table-outer"><table><caption>' . ($filter->show() ?
sprintf(__('List of %s entries matching the filter.'), $this->rs_count) : sprintf(__('List of %s entries matching the filter.'), $this->rs_count) :
sprintf(__('List of %s entries.'), $this->rs_count) sprintf(__('List of %s entries.'), $this->rs_count)
). '</caption><tr>' . ). '</caption><tr>' . implode($cols) . '</tr>%s</table>%s</div>';
'<th colspan="2">' . __('Title') . '</th>' .
'<th class="nowrap">' . __('Date') . '</th>' .
'<th class="nowrap">' . __('Category') . '</th>' .
'<th class="nowrap">' . __('Author') . '</th>' .
'<th class="nowrap">' . __('Status') . '</th>' .
'<th class="nowrap">' . __('Create date') . '</th>' .
'</tr>%s</table>';
if ($enclose_block) { if ($enclose_block) {
$html_block = sprintf($enclose_block, $html_block); $html_block = sprintf($enclose_block, $html_block);
} }
$echo .= $pager->getLinks();
$blocks = explode('%s', $html_block); $blocks = explode('%s', $html_block);
$echo .= $blocks[0]; echo $pager->getLinks() . $blocks[0];
while ($this->rs->fetch()) { 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 = '<img alt="%1$s" title="%1$s" src="images/%2$s" /> %1$s';
$echo .= $pager->getLinks(); echo $blocks[1] . '<p class="info">' . __('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') .
'</p>' . $blocks[2] . $pager->getLinks();
} }
return $echo;
} }
private function postLine($checked) private function postLine($checked)
@ -217,19 +223,17 @@ class adminPeriodicalList extends adminGenericList
$attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png'); $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png');
} }
$res = $cols = [
'<tr class="line">' . 'check' => '<td class="minimal">' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, ['checked' => $checked]) . '</td>',
'<td class="minimal">' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, 0) . '</td>' . 'title' => '<td class="maximal"><a href="' . $this->rs->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' .
'<td class="maximal"><a href="' . $this->rs->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '" ' . 'title="' . html::escapeHTML($this->rs->getURL()) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>',
'title="' . html::escapeHTML($this->rs->getURL()) . '">' . 'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>',
html::escapeHTML($this->rs->post_title) . '</a></td>' . 'category' => '<td class="nowrap">' . $cat_title . '</td>',
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>' . 'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>',
'<td class="nowrap">' . $cat_title . '</td>' . 'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>',
'<td class="nowrap">' . $this->rs->user_id . '</td>' . 'create' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_creadt, $this->rs->core->auth->getInfo('user_tz')) . '</td>'
'<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>' . ];
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_creadt, $this->rs->core->auth->getInfo('user_tz')) . '</td>' .
'</tr>';
return $res; return '<tr class="line">' . implode($cols) . '</tr>';;
} }
} }

View file

@ -222,14 +222,14 @@ if ($_REQUEST['part'] == 'period') {
} }
$starting_script = $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'); $post_filter->js($core->adminurl->get('admin.plugin.periodical', ['part' => 'period', 'period_id' => $period_id], '&').'#posts');
} }
# Display # Display
echo ' echo '
<html><head><title>' . __('Periodical') . '</title>' . <html><head><title>' . __('Periodical') . '</title>' .
dcPage::jsLoad('index.php?pf=periodical/js/dates.js') . dcPage::jsLoad(dcPage::getPF('periodical/js/dates.js')) .
$starting_script . $starting_script .
dcPage::jsDatePicker() . dcPage::jsDatePicker() .
dcPage::jsPageTabs() . dcPage::jsPageTabs() .
@ -317,7 +317,7 @@ if ($_REQUEST['part'] == 'period') {
); );
# Posts list # Posts list
echo $post_list->postDisplay($post_filter, $base_url, $post_list->postDisplay($post_filter, $base_url,
'<form action="' . $p_url . '" method="post" id="form-entries">' . '<form action="' . $p_url . '" method="post" id="form-entries">' .
'%s' . '%s' .
@ -416,7 +416,7 @@ if ($_REQUEST['part'] == 'period') {
# Display # Display
echo echo
'<html><head><title>' . __('Periodical') . '</title>' . '<html><head><title>' . __('Periodical') . '</title>' .
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'])) . $p_filter->js($core->adminurl->get('admin.plugin.periodical', ['part' => 'periods'])) .
'</head>' . '</head>' .
'<body>' . '<body>' .