From 1ada02c1b6b4bdf427455279c3c47488fd3da94a Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Wed, 6 Oct 2021 16:42:10 +0200 Subject: [PATCH] related to #1465 better indent, new translation line + add guest as filter --- admin/history.php | 1 + admin/themes/default/js/history.js | 14 +- admin/themes/default/template/history.tpl | 10 +- admin/themes/default/theme.css | 8 + admin/themes/roma/theme.css | 7 +- include/ws_functions/pwg.php | 230 +++++++++++----------- language/en_UK/common.lang.php | 1 + language/fr_FR/common.lang.php | 2 +- 8 files changed, 148 insertions(+), 125 deletions(-) diff --git a/admin/history.php b/admin/history.php index 8ef03601b..9a4238fc8 100644 --- a/admin/history.php +++ b/admin/history.php @@ -607,6 +607,7 @@ $template->assign( $template->assign('display_thumbnails', $display_thumbnails); $template->assign('display_thumbnail_selected', $form['display_thumbnail']); +$template->assign('guest_id', $conf['guest_id']); // +-----------------------------------------------------------------------+ // | html code display | diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index fc8a45e3c..f25935937 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -113,6 +113,18 @@ function fillSummaryResult(summary) { $(".summary-users .summary-data").html(summary.USERS); $(".summary-guests .summary-data").html(summary.GUESTS); + (summary.GUESTS.split(" ")[0] != "0") ? $(".summary-guests .summary-data").addClass("icon-plus-circled").on("click", function () { + if (current_param.user == "-1") { + current_param.user = guest_id; + addUserFilter(str_guest); + fillHistoryResult(current_param); + } + }).hover(function () { + $(this).css({ + cursor : "pointer" + }) + }) : console.log(); + var id_of = []; var user_dot_title = ""; @@ -378,7 +390,7 @@ function addIpFilter(ip) { newFilter.removeClass("hide"); newFilter.find(".filter-title").html(ip); - newFilter.find(".filter-icon").addClass("icon-code"); + newFilter.find(".filter-icon").html("IP ").addClass("bold"); newFilter.find(".remove-filter").on("click", function () { $(this).parent().remove(); diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index b49e757f0..6c30bf791 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -42,6 +42,8 @@ const str_recent_cats = "{'Recent albums'|translate}"; const str_recent_pics = "{'Recent photos'|translate}"; const str_memories = "{'Memories'|translate}"; const unit_MB = "{"%s MB"|@translate}"; +const str_guest = '{'guest'|@translate}'; +const guest_id = {$guest_id}; {/footer_script} {combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} @@ -58,7 +60,7 @@ const unit_MB = "{"%s MB"|@translate}";
- +
@@ -142,6 +143,7 @@ const unit_MB = "{"%s MB"|@translate}";
+
@@ -364,7 +366,7 @@ jQuery(document).ready( function() { .filter-title, .remove-filter, .filter-icon { color: #777; background: #fff; - padding: 10px 0; + padding: 5px 0; } .filter-title { diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index 6c9b520ce..bc6f76108 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -5607,4 +5607,12 @@ color:#FF7B00; .hasDatepicker, .elem-type-select { background: white !important; +} + +.selectable-filter label { + margin-bottom: 5px; +} + +.selectable-filter .elem-type-select { + margin-top: 5px !important; } \ No newline at end of file diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css index 2a4a2ce04..f428b4685 100644 --- a/admin/themes/roma/theme.css +++ b/admin/themes/roma/theme.css @@ -1674,7 +1674,7 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important; } .history-filter { - background: transparent; + background: #333 !important; color: #a1a1a1; box-shadow: 0px 2px 4px #00000024; } @@ -1685,6 +1685,7 @@ li.plupload_delete a:hover {background: url("images/cancelhover.svg")!important; } .hasDatepicker, .elem-type-select { - background: #444 !important; - border-color: #c1c1c1 !important; + background: #252525 !important; + border-color: transparent !important; + color: #777; } \ No newline at end of file diff --git a/include/ws_functions/pwg.php b/include/ws_functions/pwg.php index 4c117b957..78f8b6fb5 100644 --- a/include/ws_functions/pwg.php +++ b/include/ws_functions/pwg.php @@ -585,135 +585,135 @@ SELECT function ws_history_search($param, &$service) { -include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); -include_once(PHPWG_ROOT_PATH.'admin/include/functions_history.inc.php'); + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); + include_once(PHPWG_ROOT_PATH.'admin/include/functions_history.inc.php'); -global $conf; + global $conf; -if (isset($_GET['start']) and is_numeric($_GET['start'])) -{ - $page['start'] = $_GET['start']; -} -else -{ - $page['start'] = 0; -} + if (isset($_GET['start']) and is_numeric($_GET['start'])) + { + $page['start'] = $_GET['start']; + } + else + { + $page['start'] = 0; + } -$types = array_merge(array('none'), get_enums(HISTORY_TABLE, 'image_type')); + $types = array_merge(array('none'), get_enums(HISTORY_TABLE, 'image_type')); -$display_thumbnails = array('no_display_thumbnail' => l10n('No display'), - 'display_thumbnail_classic' => l10n('Classic display'), - 'display_thumbnail_hoverbox' => l10n('Hoverbox display') - ); - -// +-----------------------------------------------------------------------+ -// | Build search criteria and redirect to results | -// +-----------------------------------------------------------------------+ - -$page['errors'] = array(); -$search = array(); - -// date start -if (!empty($param['start'])) -{ - check_input_parameter('start', $param, false, '/^\d{4}-\d{2}-\d{2}$/'); - $search['fields']['date-after'] = $param['start']; -} - -// date end -if (!empty($param['end'])) -{ - check_input_parameter('end', $param, false, '/^\d{4}-\d{2}-\d{2}$/'); - $search['fields']['date-before'] = $param['end']; -} - -// types -if (empty($param['types'])) -{ - $search['fields']['types'] = $types; -} -else -{ - check_input_parameter('types', $param, true, '/^('.implode('|', $types).')$/'); - $search['fields']['types'] = $param['types']; -} - -// user -$search['fields']['user'] = intval($param['user']); - -// image -if (!empty($param['image_id'])) -{ - $search['fields']['image_id'] = intval($param['image_id']); -} - -// filename -if (!empty($param['filename'])) -{ - $search['fields']['filename'] = str_replace( - '*', - '%', - pwg_db_real_escape_string($param['filename']) + $display_thumbnails = array('no_display_thumbnail' => l10n('No display'), + 'display_thumbnail_classic' => l10n('Classic display'), + 'display_thumbnail_hoverbox' => l10n('Hoverbox display') ); -} -// ip -if (!empty($param['ip'])) -{ - $search['fields']['ip'] = str_replace( - '*', - '%', - pwg_db_real_escape_string($param['ip']) - ); -} + // +-----------------------------------------------------------------------+ + // | Build search criteria and redirect to results | + // +-----------------------------------------------------------------------+ -// thumbnails -check_input_parameter('display_thumbnail', $param, false, '/^('.implode('|', array_keys($display_thumbnails)).')$/'); + $page['errors'] = array(); + $search = array(); -$search['fields']['display_thumbnail'] = $param['display_thumbnail']; -// Display choise are also save to one cookie -if (!empty($param['display_thumbnail']) - and isset($display_thumbnails[$param['display_thumbnail']])) -{ - $cookie_val = $param['display_thumbnail']; -} -else -{ - $cookie_val = null; -} + // date start + if (!empty($param['start'])) + { + check_input_parameter('start', $param, false, '/^\d{4}-\d{2}-\d{2}$/'); + $search['fields']['date-after'] = $param['start']; + } -pwg_set_cookie_var('display_thumbnail', $cookie_val, strtotime('+1 month') ); + // date end + if (!empty($param['end'])) + { + check_input_parameter('end', $param, false, '/^\d{4}-\d{2}-\d{2}$/'); + $search['fields']['date-before'] = $param['end']; + } -// TODO manage inconsistency of having $_POST['image_id'] and -// $_POST['filename'] simultaneously + // types + if (empty($param['types'])) + { + $search['fields']['types'] = $types; + } + else + { + check_input_parameter('types', $param, true, '/^('.implode('|', $types).')$/'); + $search['fields']['types'] = $param['types']; + } -// store seach in database -if (!empty($search)) -{ - // register search rules in database, then they will be available on - // thumbnails page and picture page. - $query =' -INSERT INTO '.SEARCH_TABLE.' -(rules) -VALUES -(\''.pwg_db_real_escape_string(serialize($search)).'\') -;'; + // user + $search['fields']['user'] = intval($param['user']); - pwg_query($query); + // image + if (!empty($param['image_id'])) + { + $search['fields']['image_id'] = intval($param['image_id']); + } - $search_id = pwg_db_insert_id(SEARCH_TABLE); + // filename + if (!empty($param['filename'])) + { + $search['fields']['filename'] = str_replace( + '*', + '%', + pwg_db_real_escape_string($param['filename']) + ); + } - // Remove redirect for ajax // - // redirect( - // PHPWG_ROOT_PATH.'admin.php?page=history&search_id='.$search_id - // ); -} -else -{ - $page['errors'][] = l10n('Empty query. No criteria has been entered.'); -} + // ip + if (!empty($param['ip'])) + { + $search['fields']['ip'] = str_replace( + '*', + '%', + pwg_db_real_escape_string($param['ip']) + ); + } -// what are the lines to display in reality ? + // thumbnails + check_input_parameter('display_thumbnail', $param, false, '/^('.implode('|', array_keys($display_thumbnails)).')$/'); + + $search['fields']['display_thumbnail'] = $param['display_thumbnail']; + // Display choise are also save to one cookie + if (!empty($param['display_thumbnail']) + and isset($display_thumbnails[$param['display_thumbnail']])) + { + $cookie_val = $param['display_thumbnail']; + } + else + { + $cookie_val = null; + } + + pwg_set_cookie_var('display_thumbnail', $cookie_val, strtotime('+1 month') ); + + // TODO manage inconsistency of having $_POST['image_id'] and + // $_POST['filename'] simultaneously + + // store seach in database + if (!empty($search)) + { + // register search rules in database, then they will be available on + // thumbnails page and picture page. + $query =' + INSERT INTO '.SEARCH_TABLE.' + (rules) + VALUES + (\''.pwg_db_real_escape_string(serialize($search)).'\') + ;'; + + pwg_query($query); + + $search_id = pwg_db_insert_id(SEARCH_TABLE); + + // Remove redirect for ajax // + // redirect( + // PHPWG_ROOT_PATH.'admin.php?page=history&search_id='.$search_id + // ); + } + else + { + $page['errors'][] = l10n('Empty query. No criteria has been entered.'); + } + + // what are the lines to display in reality ? $query = ' SELECT rules FROM '.SEARCH_TABLE.' @@ -1011,8 +1011,6 @@ SELECT unset($name_of_tag); - sleep(3); - return array( 'lines' => $result, 'params' => $param, diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php index 35a45cf72..1c7d68757 100644 --- a/language/en_UK/common.lang.php +++ b/language/en_UK/common.lang.php @@ -417,4 +417,5 @@ $lang['generate random password'] = 'generate random password'; $lang['Related albums'] = 'Related albums'; $lang['Album name, 1 → 5 → 10 → 100'] = 'Album name, 1 → 5 → 10 → 100'; $lang['Album name, 100 → 10 → 5 → 1'] = 'Album name, 100 → 10 → 5 → 1'; +$lang['Start-Date'] = 'Start date'; ?> diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php index c5eba80c4..f4f4c7eaa 100644 --- a/language/fr_FR/common.lang.php +++ b/language/fr_FR/common.lang.php @@ -417,4 +417,4 @@ $lang['Related albums'] = 'Albums liés'; $lang['Password: ********** (no copy by email)'] = 'Mot de passe : ********** (pas de copie par email)'; $lang['Album name, 1 → 5 → 10 → 100'] = 'Nom d\'album, 1 → 5 → 10 → 100'; $lang['Album name, 100 → 10 → 5 → 1'] = 'Nom d\'album, 100 → 10 → 5 → 1'; - +$lang['Start-Date'] = 'Date de début';