add user pref on filters options

This commit is contained in:
Jean-Christian Denis 2021-09-29 01:01:25 +02:00
parent aadfd3bddb
commit fbda59abe3
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
4 changed files with 51 additions and 18 deletions

View file

@ -1,9 +1,10 @@
0.8.1 - dev 0.8.1 - dev
- [ ] update public templates - [ ] update public templates
- [ ] fix javascript - [ ] fix javascript
- add user pref on sort filters (dc 2.20)
0.9 - 2021.09.11 0.9 - 2021.09.11
- add user pref on cinecturlink list - add user pref on table columns
- fix typo in admin menu - fix typo in admin menu
0.8 - 2021.09.09 0.8 - 2021.09.09

View file

@ -2,7 +2,7 @@
[![Release version](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) [![Release version](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
[![Release date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) [![Release date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
[![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/pacKman/issues) [![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues)
[![Dotclear version](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) [![Dotclear version](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
[![License](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE)

View file

@ -32,6 +32,11 @@ $core->addBehavior(
'adminColumnsLists', 'adminColumnsLists',
['cinecturlink2AdminBehaviors', 'adminColumnsLists'] ['cinecturlink2AdminBehaviors', 'adminColumnsLists']
); );
$core->addBehavior(
'adminSortsLists',
['cinecturlink2AdminBehaviors', 'adminSortsLists']
);
$core->addBehavior( $core->addBehavior(
'adminDashboardFavorites', 'adminDashboardFavorites',
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites'] ['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
@ -42,17 +47,37 @@ class cinecturlink2AdminBehaviors
public static function adminColumnsLists($core, $cols) public static function adminColumnsLists($core, $cols)
{ {
$cols['c2link'] = [ $cols['c2link'] = [
__('Cinecturlink'), [ __('Cinecturlink'),
[
'date' => [true, __('Date')], 'date' => [true, __('Date')],
'cat' => [true, __('Category')], 'cat' => [true, __('Category')],
'author' => [true, __('Author')], 'author' => [true, __('Author')],
'desc' => [false, _('Category')], 'desc' => [false, __('Description')],
'link' => [true, _('Liens')], 'link' => [true, __('Liens')],
'note' => [true, __('Rating')], 'note' => [true, __('Rating')],
] ]
]; ];
} }
public static function adminSortsLists($core, $sorts)
{
$sorts['c2link'] = [
__('Cinecturlink'),
[
__('Date') => 'link_upddt',
__('Title') => 'link_title',
__('Category') => 'cat_id',
__('Author') => 'link_author',
__('Description') => 'link_desc',
__('Link') => 'link_url',
__('Rating') => 'link_note'
],
'link_upddt',
'desc',
null
];
}
public static function adminDashboardFavorites($core, $favs) public static function adminDashboardFavorites($core, $favs)
{ {
$favs->register('cinecturlink2', [ $favs->register('cinecturlink2', [

View file

@ -139,8 +139,11 @@ if ($part == 'links') {
$sortby_combo = [ $sortby_combo = [
__('Date') => 'link_upddt', __('Date') => 'link_upddt',
__('Title') => 'link_title', __('Title') => 'link_title',
__('Category') => 'cat_title', __('Category') => 'cat_id',
__('Rating') => 'link_note', __('Author') => 'link_author',
__('Description') => 'link_desc',
__('Liens') => 'link_url',
__('Rating') => 'link_note'
]; ];
$order_combo = [ $order_combo = [
__('Descending') => 'desc', __('Descending') => 'desc',
@ -154,9 +157,13 @@ if ($part == 'links') {
$show_filters = false; $show_filters = false;
$page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1; $page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1;
$nb_per_page = $core->auth->user_prefs->interface->nb_posts_per_page ?: 30;
$default_sortby = 'link_upddt'; $core->auth->user_prefs->addWorkspace('interface');
$default_order = 'desc'; $sorts_user = @$core->auth->user_prefs->interface->sorts;
$default_sortby = $sorts_user['c2link'][0] ?? 'link_upddt';
$default_order = $sorts_user['c2link'][1] ?? 'desc';
$nb_per_page = !empty($sorts_user['c2link'][2]) ? $sorts_user['c2link'][2] : 30;
$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : $default_sortby; $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : $default_sortby;
$order = !empty($_GET['order']) ? $_GET['order'] : $default_order; $order = !empty($_GET['order']) ? $_GET['order'] : $default_order;
@ -562,12 +569,12 @@ if ($part == "links") {
form::combo('order', $order_combo, $order) . '</p>' . form::combo('order', $order_combo, $order) . '</p>' .
'</div><div class="cell">' . '</div><div class="cell">' .
'<p><span class="label ib">' . __('Show') . '</span> <label for="nb" class="classic">'. '<p><span class="label ib">' . __('Show') . '</span> <label for="nb" class="classic">'.
form::field('nb', 3, 3, $nb_per_page) . ' ' . form::field('nb', 0, 999, $nb_per_page) . ' ' .
__('entries per page') . '</label></p>' . __('entries per page') . '</label></p>' .
form::hidden('p', 'cinecturlink2') . form::hidden('p', 'cinecturlink2') .
form::hidden('part', 'links') . form::hidden('part', 'links') .
//form::hidden('filters-options-id', 'c2links') . form::hidden('filters-options-id', 'c2link') .
//'<p class="hidden-if-no-js"><a href="#" id="filter-options-save">' . __('Save current options') . '</a></p>' . '<p class="hidden-if-no-js"><a href="#" id="filter-options-save">' . __('Save current options') . '</a></p>' .
'</div>' . '</div>' .
'</div>' . '</div>' .