add user pref for list options
This commit is contained in:
parent
e5a2aa41da
commit
2f30a63038
3 changed files with 96 additions and 54 deletions
|
@ -1,6 +1,7 @@
|
||||||
0.8.1 - dev
|
0.8.1 - dev
|
||||||
- [ ] update public templates
|
- [ ] update public templates
|
||||||
- [ ] fix javascript
|
- [ ] fix javascript
|
||||||
|
- [x] add user pref for list options
|
||||||
|
|
||||||
0.8 - 2021.09.09
|
0.8 - 2021.09.09
|
||||||
- fix compatibility Dotclear v2.19
|
- fix compatibility Dotclear v2.19
|
||||||
|
|
20
_admin.php
20
_admin.php
|
@ -22,12 +22,16 @@ $_menu['Plugins']->addItem(
|
||||||
$core->adminurl->get('admin.plugin.cinecturlink2'),
|
$core->adminurl->get('admin.plugin.cinecturlink2'),
|
||||||
dcPage::getPF('cinecturlink2/icon.png'),
|
dcPage::getPF('cinecturlink2/icon.png'),
|
||||||
preg_match(
|
preg_match(
|
||||||
'/' . preg_quote($core->adminurl->get('admin.plugin.dcAdvancedCleaner')) . '(&.*)?$/',
|
'/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/',
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
),
|
),
|
||||||
$core->auth->check('contentadmin', $core->blog->id)
|
$core->auth->check('contentadmin', $core->blog->id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$core->addBehavior(
|
||||||
|
'adminColumnsLists',
|
||||||
|
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
|
||||||
|
);
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'adminDashboardFavorites',
|
'adminDashboardFavorites',
|
||||||
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
|
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
|
||||||
|
@ -35,6 +39,20 @@ $core->addBehavior(
|
||||||
|
|
||||||
class cinecturlink2AdminBehaviors
|
class cinecturlink2AdminBehaviors
|
||||||
{
|
{
|
||||||
|
public static function adminColumnsLists($core, $cols)
|
||||||
|
{
|
||||||
|
$cols['c2link'] = [
|
||||||
|
__('Cinecturlink'), [
|
||||||
|
'date' => [true, __('Date')],
|
||||||
|
'cat' => [true, __('Category')],
|
||||||
|
'author' => [true, __('Author')],
|
||||||
|
'desc' => [false, _('Category')],
|
||||||
|
'link' => [true, _('Liens')],
|
||||||
|
'note' => [true, __('Rating')],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public static function adminDashboardFavorites($core, $favs)
|
public static function adminDashboardFavorites($core, $favs)
|
||||||
{
|
{
|
||||||
$favs->register('cinecturlink2', [
|
$favs->register('cinecturlink2', [
|
||||||
|
|
|
@ -34,6 +34,20 @@ class adminlistCinecturlink2
|
||||||
$this->html_next = __('next »');
|
$this->html_next = __('next »');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function userColumns($type, $cols)
|
||||||
|
{
|
||||||
|
$cols_user = @$this->core->auth->user_prefs->interface->cols;
|
||||||
|
if (is_array($cols_user) || $cols_user instanceof ArrayObject) {
|
||||||
|
if (isset($cols_user[$type])) {
|
||||||
|
foreach ($cols_user[$type] as $cn => $cd) {
|
||||||
|
if (!$cd && isset($cols[$cn])) {
|
||||||
|
unset($cols[$cn]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function display($page, $nb_per_page, $enclose_block = '', $filter = false, $redir = '')
|
public function display($page, $nb_per_page, $enclose_block = '', $filter = false, $redir = '')
|
||||||
{
|
{
|
||||||
$this->redir = $redir;
|
$this->redir = $redir;
|
||||||
|
@ -52,6 +66,18 @@ class adminlistCinecturlink2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cols = [
|
||||||
|
'title' => '<th colspan="2" class="first">' . __('Title') . '</th>',
|
||||||
|
'author' => '<th scope="col">' . __('Author') . '</th>',
|
||||||
|
'desc' => '<th scope="col">' . __('Description') . '</th>',
|
||||||
|
'link' => '<th scope="col">' . __('Links') . '</th>',
|
||||||
|
'cat' => '<th scope="col">' . __('Category') . '</th>',
|
||||||
|
'note' => '<th scope="col">' . __('Rating') . '</th>',
|
||||||
|
'date' => '<th scope="col">' . __('Date') . '</th>'
|
||||||
|
];
|
||||||
|
$cols = new ArrayObject($cols);
|
||||||
|
$this->userColumns('c2link', $cols);
|
||||||
|
|
||||||
$html_block =
|
$html_block =
|
||||||
'<div class="table-outer">' .
|
'<div class="table-outer">' .
|
||||||
'<table>' .
|
'<table>' .
|
||||||
|
@ -60,15 +86,7 @@ class adminlistCinecturlink2
|
||||||
sprintf(__('List of links (%s)'), $this->rs_count)
|
sprintf(__('List of links (%s)'), $this->rs_count)
|
||||||
). '</caption>' .
|
). '</caption>' .
|
||||||
'<thead>' .
|
'<thead>' .
|
||||||
'<tr>' .
|
'<tr>' . implode(iterator_to_array($cols)) . '</tr>' .
|
||||||
'<th colspan="2" class="first">' . __('Title') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Author') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Description') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Links') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Category') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Rating') . '</th>' .
|
|
||||||
'<th scope="col">' . __('Date') . '</th>' .
|
|
||||||
'</tr>' .
|
|
||||||
'</thead>' .
|
'</thead>' .
|
||||||
'<tbody>%s</tbody>' .
|
'<tbody>%s</tbody>' .
|
||||||
'</table>' .
|
'</table>' .
|
||||||
|
@ -91,49 +109,54 @@ class adminlistCinecturlink2
|
||||||
|
|
||||||
private function linkLine($checked)
|
private function linkLine($checked)
|
||||||
{
|
{
|
||||||
return
|
$cols = [
|
||||||
'<tr class="line">' .
|
'check' => '<td class="nowrap minimal">' .
|
||||||
'<td class="nowrap">' .
|
|
||||||
form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) .
|
form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap" scope="row">' .
|
'title' => '<td class="nowrap" scope="row">' .
|
||||||
'<a href="' . $this->core->adminurl->get(
|
'<a href="' . $this->core->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
['part' => 'link', 'linkid' => $this->rs->link_id, 'redir' => $this->redir]
|
['part' => 'link', 'linkid' => $this->rs->link_id, 'redir' => $this->redir]
|
||||||
) . '" title="' . __('Edit') . '">' .
|
) . '" title="' . __('Edit') . '">' .
|
||||||
html::escapeHTML($this->rs->link_title) . '</a>' .
|
html::escapeHTML($this->rs->link_title) . '</a>' .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap">' .
|
'author' => '<td class="nowrap">' .
|
||||||
html::escapeHTML($this->rs->link_author) .
|
html::escapeHTML($this->rs->link_author) .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="maximal">' .
|
'desc' => '<td class="maximal">' .
|
||||||
html::escapeHTML($this->rs->link_desc) .
|
html::escapeHTML($this->rs->link_desc) .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap">' .
|
'link' => '<td class="nowrap">' .
|
||||||
'<a href="' . $this->rs->link_url . '" title="' .
|
'<a href="' . $this->rs->link_url . '" title="' .
|
||||||
html::escapeHTML($this->rs->link_url) .
|
html::escapeHTML($this->rs->link_url) .
|
||||||
'">' . __('URL') . '</a> ' .
|
'">' . __('URL') . '</a> ' .
|
||||||
'<a href="' . $this->rs->link_img . '" title="' .
|
'<a href="' . $this->rs->link_img . '" title="' .
|
||||||
html::escapeHTML($this->rs->link_img) .
|
html::escapeHTML($this->rs->link_img) .
|
||||||
'">' . __('image') . '</a> ' .
|
'">' . __('image') . '</a> ' .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap">' .
|
'cat' => '<td class="nowrap minimal">' .
|
||||||
'<a href="' . $this->core->adminurl->get(
|
'<a href="' . $this->core->adminurl->get(
|
||||||
'admin.plugin.cinecturlink2',
|
'admin.plugin.cinecturlink2',
|
||||||
['part' => 'cat', 'catid' => $this->rs->cat_id, 'redir' => $this->redir]
|
['part' => 'cat', 'catid' => $this->rs->cat_id, 'redir' => $this->redir]
|
||||||
) . '" title="' . __('Edit') . '">' .
|
) . '" title="' . __('Edit') . '">' .
|
||||||
html::escapeHTML($this->rs->cat_title) . '</a>' .
|
html::escapeHTML($this->rs->cat_title) . '</a>' .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap count">' .
|
'note' => '</td>' .
|
||||||
|
'<td class="nowrap count minimal">' .
|
||||||
html::escapeHTML($this->rs->link_note) . '/20' .
|
html::escapeHTML($this->rs->link_note) . '/20' .
|
||||||
'</td>' .
|
'</td>',
|
||||||
'<td class="nowrap count">' .
|
'date' => '<td class="nowrap count minimal">' .
|
||||||
dt::dt2str(
|
dt::dt2str(
|
||||||
$this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format,
|
$this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format,
|
||||||
$this->rs->link_upddt,
|
$this->rs->link_upddt,
|
||||||
$this->core->auth->getInfo('user_tz')
|
$this->core->auth->getInfo('user_tz')
|
||||||
) .
|
) .
|
||||||
'</td>' .
|
'</td>'
|
||||||
'</tr>' . "\n";
|
];
|
||||||
|
|
||||||
|
$cols = new ArrayObject($cols);
|
||||||
|
$this->userColumns('c2link', $cols);
|
||||||
|
|
||||||
|
return '<tr class="line">' . implode(iterator_to_array($cols)) . '</tr>' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue