clean up posts list

master
Jean-Christian Paul 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 =
'<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.'), $this->rs_count)
). '</caption><tr>' .
'<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>';
). '</caption><tr>' . implode($cols) . '</tr>%s</table>%s</div>';
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 = '<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)
@ -217,19 +223,17 @@ class adminPeriodicalList extends adminGenericList
$attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png');
}
$res =
'<tr class="line">' .
'<td class="minimal">' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, 0) . '</td>' .
'<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>' .
'<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>' .
'<td class="nowrap">' . $cat_title . '</td>' .
'<td class="nowrap">' . $this->rs->user_id . '</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>';
$cols = [
'check' => '<td class="minimal">' . form::checkbox(['periodical_entries[]'], $this->rs->post_id, ['checked' => $checked]) . '</td>',
'title' => '<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>',
'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>',
'category' => '<td class="nowrap">' . $cat_title . '</td>',
'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>',
'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>',
'create' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_creadt, $this->rs->core->auth->getInfo('user_tz')) . '</td>'
];
return $res;
return '<tr class="line">' . implode($cols) . '</tr>';;
}
}

View File

@ -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 '
<html><head><title>' . __('Periodical') . '</title>' .
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,
'<form action="' . $p_url . '" method="post" id="form-entries">' .
'%s' .
@ -416,7 +416,7 @@ if ($_REQUEST['part'] == 'period') {
# Display
echo
'<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'])) .
'</head>' .
'<body>' .