From 37849984a0a8270245270c87c687f12494e7c664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Chili=C5=84ski?= Date: Thu, 6 Sep 2018 21:02:36 +0200 Subject: [PATCH] enhancement: introduced persistent filter support (LMS+ #620) - more validation --- img/lms-ui-persistent-filter.js | 3 +++ lib/SmartyPlugins/function.persistent_filter.php | 3 ++- lib/locale/pl/strings.php | 1 + modules/eventlist.php | 2 -- modules/rtqueueview.php | 2 -- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/img/lms-ui-persistent-filter.js b/img/lms-ui-persistent-filter.js index b3c8007291..7e175aa3b7 100644 --- a/img/lms-ui-persistent-filter.js +++ b/img/lms-ui-persistent-filter.js @@ -86,6 +86,9 @@ $(function() { $('.lms-ui-filter-apply-button').click(function () { var form = $(this).closest('form.lms-ui-persistent-filter'); var name = $(this).siblings('.lms-ui-filter-selection').val(); + if (!name.length || name == -1) { + return false; + } form.find('[name="name"]').val(name); form.attr('action', form.attr('action').replace('&api=1', '')); form.submit(); diff --git a/lib/SmartyPlugins/function.persistent_filter.php b/lib/SmartyPlugins/function.persistent_filter.php index fa8660d8a2..f92d33b5c5 100644 --- a/lib/SmartyPlugins/function.persistent_filter.php +++ b/lib/SmartyPlugins/function.persistent_filter.php @@ -50,7 +50,8 @@ function smarty_function_persistent_filter($params, $template) { ' . $filters . ' - + diff --git a/lib/locale/pl/strings.php b/lib/locale/pl/strings.php index ba83a68ec7..b2a70afe12 100644 --- a/lib/locale/pl/strings.php +++ b/lib/locale/pl/strings.php @@ -4050,5 +4050,6 @@ $_LANG['Delete'] = 'Usuń'; $_LANG['- none -'] = '- żaden - '; $_LANG['- new -'] = '- nowy -'; +$_LANG['Enter filter name (at least 5 characters)'] = 'Podaj nazwę filtru (co najmniej 5 znaków)'; ?> diff --git a/modules/eventlist.php b/modules/eventlist.php index 52e1970a5f..75577cfc6b 100644 --- a/modules/eventlist.php +++ b/modules/eventlist.php @@ -24,8 +24,6 @@ * $Id$ */ -$filter = $SESSION->getFilter(); - if (isset($filter['edate']) && !empty($filter['edate'])) list ($filter['year'], $filter['month'], $filter['day']) = explode('/', $filter['edate']); diff --git a/modules/rtqueueview.php b/modules/rtqueueview.php index fe1161ce39..23738b509d 100644 --- a/modules/rtqueueview.php +++ b/modules/rtqueueview.php @@ -26,8 +26,6 @@ $LMS->CleanupTicketLastView(); -$filter = $SESSION->getFilter(); - // queue id's if (isset($_GET['id']) && $_GET['id'] != 'all') { if (is_array($_GET['id']))