+
+ {'User'|translate}
+
+
+
-
-{if max_page != 1}
+
-{/if}
+
+
+ {'No results'|translate}
+
+
@@ -937,30 +440,105 @@ $(document).ready(function () {
display: flex;
flex-direction: row;
- align-items: center;
-
- height: 100px;
+ margin-top: 38px;
width: 100%;
}
-.select-user span {
+div:has(> .activity-header) {
+ margin-bottom: 38px;
+}
+
+.activity-select span {
font-size: 15px;
font-weight: bold;
-
- margin-right: 20px;
}
-.acivity-time {
- margin: 0 25px;
+.user-selecter, .action-selecter {
+ width: 230px;
+ margin-top: 10px;
}
-.user-selecter {
- width: 150px;
+.actions-filters{
+ margin-left: 25%;
}
+.user_activity_end_options{
+ margin-left: auto;
+ display: flex;
+}
+
+.activity-noresult{
+ opacity: 0.3;
+ text-align: center;
+ font-weight: bold;
+ font-size: 32px;
+ display: none;
+}
+
+.activity-more-filters{
+ margin-left: 14px;
+ padding: 4px 16px 4px 16px;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+}
+
+.activity-more-filters.extend-padding{
+ padding-bottom: 10px;
+}
+
+.activity-more-filters, .activity-more-filters-content{
+ background-color: #F3F3F3;
+}
+
+.activity-more-filters-content{
+ display: flex;
+ position: relative;
+ flex-direction: row;
+ font-weight: normal;
+ padding : 23px 0px 22px 24px;
+ width: auto;
+}
+
+.activity-period-info{
+ margin-bottom : 30px;
+ font-weight: bold;
+}
+
+.additional-filters-section{
+ margin-left: 5%;
+}
+
+.additional-filters-info{
+ margin-bottom : 18px;
+ font-weight: bold;
+}
+
+.additional-filters{
+ display: flex;
+}
+
+.activity-filter-container span::before{
+ margin-right: 6px;
+}
+
+.activity-filter-container .icon-cancel{
+ margin-left: 5px;
+}
+
+.activity-date-selecter{
+ display: block;
+ height: 25.5px;
+ width: 130px;
+ margin-top: 10px;
+ font-size: 12px;
+ font-weight: bold;
+}
/* Selectize */
-.selectize-control.single.user-selecter {
+.selectize-control.single.user-selecter, .selectize-control.single.action-selecter {
height: 30px;
}
diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css
index 260bf8497..6041109d7 100644
--- a/admin/themes/default/theme.css
+++ b/admin/themes/default/theme.css
@@ -7253,17 +7253,16 @@ color:#FF7B00;
/* Activity Tab in user manager */
-.select-user {
- background: #fafafa;
+.activity-select {
height: 50%;
+ text-align: left;
+ margin-right: 20px;
+}
- display: flex;
- align-items: center;
-
- padding: 0 20px;
-
- box-shadow: 0px 2px 4px #00000024;
- border-radius: 5px;
+.activity-filter-container{
+ border-radius: 20px;
+ padding: 4px 10px;
+ margin-right: 6px;
}
.start-date,
@@ -7275,11 +7274,6 @@ color:#FF7B00;
white-space: nowrap;
}
-.acivity-time-text {
- font-size: 13px;
- font-weight: bold;
-}
-
.line {
background: #fafafa;
box-shadow: 0px 2px 4px #00000024;
@@ -7311,7 +7305,6 @@ color:#FF7B00;
}
.download_csv {
- margin-left: auto;
height: 25px;
width: 30px;
background: #dddddd;
diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css
index 000eac0de..ea0521ae5 100644
--- a/admin/themes/roma/theme.css
+++ b/admin/themes/roma/theme.css
@@ -1915,23 +1915,28 @@ background:#6C2D2D!important;
/* Activity Tab in user manager */
-.select-user {
- background: #555555;
- height: 50%;
-
- display: flex;
- align-items: center;
-
- padding: 0 20px;
-
- box-shadow: 0px 2px 4px #00000024;
- border-radius: 5px;
+.activity-more-filters, .activity-more-filters-content {
+ background-color: #343434 !important;
}
-.select-user-title {
+.selectize-control.user-selecter.single .selectize-input, .selectize-control.action-selecter.single .selectize-input {
+ border-color: #555555 !important;
+}
+
+.activity-select-title {
color: #bbbbbb;
}
+.activity-date-selecter {
+ background-color: #555555;
+ color: #D5D5D5;
+}
+
+.activity-filter-container{
+ background-color: #555555;
+ color: #D5D5D5;
+}
+
.start-date,
.end-date {
padding: 5px 10px;
@@ -1941,12 +1946,6 @@ background:#6C2D2D!important;
color: #bbbbbb;
}
-.acivity-time-text {
- font-size: 13px;
- font-weight: bold;
- color: #bbbbbb;
-}
-
/* Strange why this is different from light mode */
.compactView .user-container-initials-wrapper > span {
height: 40px !important;
@@ -1988,7 +1987,6 @@ background:#6C2D2D!important;
}
.download_csv {
- margin-left: auto;
height: 25px;
width: 30px;
background: #555555;
diff --git a/admin/user_activity.php b/admin/user_activity.php
index dd31df050..f62d34014 100644
--- a/admin/user_activity.php
+++ b/admin/user_activity.php
@@ -142,6 +142,105 @@ SELECT COUNT(*)
list($nb_users) = pwg_db_fetch_row(pwg_query($query));
$template->assign('nb_users', $nb_users);
+$query = '
+SELECT
+ occured_on
+ FROM '.ACTIVITY_TABLE.'
+ WHERE object != \'system\'
+ ;';
+
+$result = query2array($query);
+
+$dates = array();
+
+foreach($result as $time){
+ list($date, $hour) = explode(' ', $time['occured_on']);
+ $dates[] = date_format(date_create($date),"Y-m-d");
+}
+
+$dates = array_unique($dates);
+$list_dates['allDates'] = implode(',',$dates);
+$list_dates['min'] = $dates[0];
+$list_dates['max'] = end($dates);
+
+$template->assign('ACTIVITY_DATES', $list_dates);
+
+$additional_filt_type = false;
+$additional_filt_name = null;
+$additional_filt_value = null;
+
+if(isset($_GET['photo']))
+{
+ $query = '
+ SELECT
+ name
+ FROM '.IMAGES_TABLE.'
+ WHERE id = '.$_GET['photo'].';';
+
+ $additional_filt_type = 'photo';
+ $additional_filt_name = query2array($query)[0]['name'];
+ $additional_filt_value = $_GET['photo'];
+}
+else if (isset($_GET['album']))
+{
+ $query = '
+ SELECT
+ name
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id = '.$_GET['album'].';';
+
+ $additional_filt_type = 'album';
+ $additional_filt_name = query2array($query)[0]['name'];
+ $additional_filt_value = $_GET['album'];
+}
+else if (isset($_GET['group']))
+{
+ $query = '
+ SELECT
+ name
+ FROM '.GROUPS_TABLE.'
+ WHERE id = '.$_GET['group'].';';
+
+ $additional_filt_type = 'group';
+ $additional_filt_name = query2array($query)[0]['name'];
+ $additional_filt_value = $_GET['group'];
+}
+
+$template->assign('ADDITIONAL_FILT', array(
+ 'type' => $additional_filt_type,
+ 'name' => $additional_filt_name,
+ 'value' => $additional_filt_value
+));
+
+$query = '
+SELECT
+ object,
+ action,
+ count(*) AS counter
+ FROM '.ACTIVITY_TABLE.'
+ WHERE object != \'system\'';
+
+ if ($additional_filt_type)
+ {
+ $query .= '
+ AND object = "'.$additional_filt_type.'"';
+ }
+
+ $query .= '
+ GROUP BY
+ action,
+ object
+ ORDER BY object ASC
+ ;';
+
+
+$actions = query2array($query);
+foreach($actions as &$action){
+ $action['value'] = $action['object'].'/'.$action['action'];
+}
+
+$template->assign('ACTIONS', $actions);
+
$template->assign_var_from_handle('ADMIN_CONTENT', 'user_activity');
?>
\ No newline at end of file
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 21336b389..5a1cccd93 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -811,7 +811,7 @@ $conf['dashboard_activity_nb_weeks'] = 4;
// 'all' = do not filter, display all
// 'admins_only' = only display connections of admin users
// 'none' = don't even display connections of admin users
-$conf['activity_display_connections'] = 'admins_only';
+$conf['activity_display_connections'] = 'all';
// On album mover page, number of seconds before auto openning album when
// dragging an album. In milliseconds. 3 seconds by default.
diff --git a/include/ws_functions/pwg.php b/include/ws_functions/pwg.php
index c1886b189..bbb041180 100644
--- a/include/ws_functions/pwg.php
+++ b/include/ws_functions/pwg.php
@@ -459,12 +459,77 @@ function ws_getActivityList($param, &$service)
$output_lines = array();
$current_key = '';
- $page_size = 100000; //We will fetch X lines in database =/= lines displayed due to line concatenation
- $page_offset = $param['page']*$page_size;
+ $page_size = 100; //We will fetch X lines in database =/= lines displayed due to line concatenation
+ //$page_offset = $param['page']*$page_size;
+ $page_offset = $param['offset'];
$user_ids = array();
- $query = '
+ $line_id = 0;
+
+
+
+ if (!empty($param['date_min'])) {
+ $min = date_format(date_create($param['date_min']), "Y-m-d H:i:s");
+ $max = date_format(date_create($param['date_max']), "Y-m-d 23:59:59");
+ }
+
+ if (!empty($param['date_max'])) {
+ $max = date_format(date_create($param['date_max']), "Y-m-d 23:59:59");
+ }
+
+ if (isset($param['uid'])) {
+ $query = '
+ SELECT
+ count(*)
+ FROM '.ACTIVITY_TABLE.'
+ WHERE object != \'system\'
+ AND performed_by = '.$param['uid'];
+ } else {
+ $query = '
+ SELECT
+ count(*)
+ FROM '.ACTIVITY_TABLE.'
+ WHERE object != \'system\'';
+ }
+
+ if (isset($param['action']))
+ {
+ $query .= '
+ AND action = "'.$param['action'].'"';
+ }
+
+ if (isset($param['object']))
+ {
+ $query .= '
+ AND object = "'.$param['object'].'"';
+ }
+
+ if (!empty($param['date_min']))
+ {
+ $query .= '
+ AND occured_on >= "'.$min.'"';
+ }
+
+ if (!empty($param['date_max']))
+ {
+ $query .= '
+ AND occured_on <= "'.$max.'"';
+ }
+
+ if (!empty($param['id']))
+ {
+ $query .= '
+ AND object_id = '.$param['id'];
+ }
+
+ $query .= ';';
+
+ $max_line = (pwg_db_fetch_row(pwg_query($query))[0]);
+
+ while(sizeof($output_lines) < $page_size and !($page_offset >= $max_line))
+ {
+ $query = '
SELECT
activity_id,
performed_by,
@@ -479,11 +544,43 @@ SELECT
FROM '.ACTIVITY_TABLE.'
WHERE object != \'system\'';
- if (isset($param['uid']))
+ if (isset($param['uid']))
+ {
+ $query.= '
+ AND performed_by = '.$param['uid'];
+ }
+
+ if (isset($param['action']))
+ {
+ $query .= '
+ AND action = "'.$param['action'].'"';
+ }
+
+ if (isset($param['object']))
+ {
+ $query .= '
+ AND object = "'.$param['object'].'"';
+ }
+
+ if (!empty($param['date_min']))
{
- $query.= '
- AND performed_by = '.$param['uid'];
+ $query .= '
+ AND occured_on >= "'.$min.'"';
}
+
+ if (!empty($param['date_max']))
+ {
+ $query .= '
+ AND occured_on <= "'.$max.'"';
+ }
+
+ if (!empty($param['id']))
+ {
+ $id = pwg_db_real_escape_string(stripslashes($param['id']));
+ $query .= '
+ AND object_id = '.$id;
+ }
+
elseif ('none' == $conf['activity_display_connections'])
{
$query.= '
@@ -496,67 +593,77 @@ SELECT
AND NOT (action IN (\'login\', \'logout\') AND object_id NOT IN ('.implode(',', get_admins()).'))';
}
- $query.= '
+ $query.= '
ORDER BY activity_id DESC
- LIMIT '.$page_size.' OFFSET '.$page_offset.'
+ LIMIT '.($page_size * 5).' OFFSET '.$page_offset.'
;';
- $line_id = 0;
- $result = pwg_query($query);
- while ($row = pwg_db_fetch_assoc($result))
- {
- $row['details'] = str_replace('`groups`', 'groups', $row['details']);
- $row['details'] = str_replace('`rank`', 'rank', $row['details']);
- $details = @unserialize($row['details']);
+ $result = pwg_query($query);
- if (isset($row['user_agent']))
+ while ($row = pwg_db_fetch_assoc($result))
{
- $details['agent'] = $row['user_agent'];
- }
-
- if (isset($details['method']))
- {
- $detailsType = 'method';
- }
- if (isset($details['script']))
- {
- $detailsType = 'script';
- }
-
- $line_key = $row['session_idx'].'~'.$row['object'].'~'.$row['action'].'~'; // idx~photo~add
-
- if ($line_key === $current_key)
- {
- // I increment the counter of the previous line
- $output_lines[count($output_lines)-1]['counter']++;
- $output_lines[count($output_lines)-1]['object_id'][] = $row['object_id'];
- }
- else
- {
- list($date, $hour) = explode(' ', $row['occured_on']);
- // New line
- $output_lines[] = array(
- 'id' => $line_id,
- 'object' => $row['object'],
- 'object_id' => array($row['object_id']),
- 'action' => $row['action'],
- 'ip_address' => $row['ip_address'],
- 'date' => format_date($date),
- 'hour' => $hour,
- 'user_id' => $row['performed_by'],
- 'detailsType' => $detailsType,
- 'details' => $details,
- 'counter' => 1,
- );
-
- $user_ids[ $row['performed_by'] ] = 1;
- if ('user' == $row['object'])
+ if (sizeof($output_lines) < $page_size)
{
- $user_ids[ $row['object_id'] ] = 1;
- }
+ $page_offset++;
- $current_key = $line_key;
- $line_id++;
+ $row['details'] = str_replace('`groups`', 'groups', $row['details']);
+ $row['details'] = str_replace('`rank`', 'rank', $row['details']);
+ $details = @unserialize($row['details']);
+
+ if (isset($row['user_agent']))
+ {
+ $details['agent'] = $row['user_agent'];
+ }
+
+ if (isset($details['method']))
+ {
+ $detailsType = 'method';
+ }
+ if (isset($details['script']))
+ {
+ $detailsType = 'script';
+ }
+
+ $line_key = $row['session_idx'].'~'.$row['object'].'~'.$row['action'].'~'; // idx~photo~add
+
+ if ($line_key === $current_key)
+ {
+ // I increment the counter of the previous line
+ $output_lines[count($output_lines)-1]['counter']++;
+ $output_lines[count($output_lines)-1]['object_id'][] = $row['object_id'];
+ }
+ else
+ {
+ list($date, $hour) = explode(' ', $row['occured_on']);
+ // New line
+ $output_lines[] = array(
+ 'id' => $line_id,
+ 'object' => $row['object'],
+ 'object_id' => array($row['object_id']),
+ 'action' => $row['action'],
+ 'ip_address' => $row['ip_address'],
+ 'date' => format_date($date),
+ 'hour' => $hour,
+ 'user_id' => $row['performed_by'],
+ 'detailsType' => $detailsType,
+ 'details' => $details,
+ 'counter' => 1,
+ );
+
+ $user_ids[ $row['performed_by'] ] = 1;
+ if ('user' == $row['object'])
+ {
+ $user_ids[ $row['object_id'] ] = 1;
+ }
+
+ $current_key = $line_key;
+ $line_id++;
+ }
+ }
+ else
+ {
+ break;
+ }
}
}
@@ -596,27 +703,11 @@ SELECT
}
}
- if (isset($param['uid'])) {
- $query = '
- SELECT
- count(*)
- FROM '.ACTIVITY_TABLE.'
- WHERE performed_by = '.$param['uid'].'
- ;';
- } else {
- $query = '
- SELECT
- count(*)
- FROM '.ACTIVITY_TABLE.'
- ;';
- }
-
- $result = (pwg_db_fetch_row(pwg_query($query))[0])/$page_size;
-
return array(
'result_lines' => $output_lines,
- 'max_page' => floor($result),
- 'params' => $param,
+ 'page_offset' => $page_offset,
+ 'end_page' => ($page_offset >= $max_line),
+ 'params' => $param
);
}
From 80ab463808aa2c8b13833c7266267f1bf1590733 Mon Sep 17 00:00:00 2001
From: Martin R <167065719+Martin-Raby@users.noreply.github.com>
Date: Fri, 8 Aug 2025 15:47:56 +0200
Subject: [PATCH 010/149] Issue #2364 redesign user comment manager (PR #2400)
*Ability to reject or validate one by one
*Filter by : status : validated, user, user status, begin date, end date
*refreshed design to match current piwigo design
*[TODO] search input does not work,
*[TODO] user name duplicate in user filter (use user id instead of user name to filter)
*[TODO] filter by image is missing
*[TODO] confirmation when a comment is validated or deleted is missing
---
admin/comments.php | 48 ++-
admin/themes/default/template/comments.tpl | 365 +++++++++++++++++++--
admin/themes/default/theme.css | 288 +++++++++++++++-
admin/themes/roma/theme.css | 58 ++++
4 files changed, 723 insertions(+), 36 deletions(-)
diff --git a/admin/comments.php b/admin/comments.php
index 2cd6b313b..cb2f4a7d2 100644
--- a/admin/comments.php
+++ b/admin/comments.php
@@ -108,6 +108,7 @@ $tabsheet->assign();
$nb_total = 0;
$nb_pending = 0;
+$nb_validated = 0;
$query = '
SELECT
@@ -127,6 +128,8 @@ while ($row = pwg_db_fetch_assoc($result))
}
}
+$nb_validated = $nb_total - $nb_pending;
+
if (!isset($_GET['filter']) and $nb_pending > 0)
{
$page['filter'] = 'pending';
@@ -136,16 +139,50 @@ else
$page['filter'] = 'all';
}
-if (isset($_GET['filter']) and 'pending' == $_GET['filter'])
+if (isset($_GET['filter']) and ('pending' == $_GET['filter'] or 'validated' == $_GET['filter']))
{
$page['filter'] = $_GET['filter'];
}
+if (isset($_GET['status']))
+{
+ $displayed_status = $_GET['status'];
+}
+else
+{
+ $displayed_status = 'all';
+}
+
+if (isset($_GET['author']))
+{
+ $author = $_GET['author'];
+}
+else
+{
+ $author = 'all';
+}
+
+// by default, no filter by date is active
+$start = $end = "";
+
+if (isset($_GET['start_date'])){
+ $start = $_GET['start_date'];
+}
+
+if (isset($_GET['end_date'])){
+ $end = $_GET['end_date'];
+}
+
$template->assign(
array(
'nb_total' => $nb_total,
'nb_pending' => $nb_pending,
+ 'nb_validated' => $nb_validated,
'filter' => $page['filter'],
+ 'displayed_status' => $displayed_status,
+ 'displayed_author' => $author,
+ 'START' => $start,
+ 'END' => $end,
)
);
@@ -155,6 +192,10 @@ if ('pending' == $page['filter'])
{
$where_clauses[] = 'validated=\'false\'';
}
+if ('validated' == $page['filter'])
+{
+ $where_clauses[] = 'validated=\'true\'';
+}
$query = '
SELECT
@@ -163,6 +204,7 @@ SELECT
c.date,
c.author,
'.$conf['user_fields']['username'].' AS username,
+ ui.status,
c.content,
i.path,
i.representative_ext,
@@ -173,6 +215,8 @@ SELECT
ON i.id = c.image_id
LEFT JOIN '.USERS_TABLE.' AS u
ON u.'.$conf['user_fields']['id'].' = c.author_id
+ LEFT JOIN '.USER_INFOS_TABLE.' AS ui
+ ON ui.user_id = c.author_id
WHERE '.implode(' AND ', $where_clauses).'
ORDER BY c.date DESC
LIMIT '.$page['start'].', '.$conf['comments_page_nb_comments'].'
@@ -202,10 +246,12 @@ while ($row = pwg_db_fetch_assoc($result))
'ID' => $row['id'],
'TN_SRC' => $thumb,
'AUTHOR' => trigger_change('render_comment_author', $author_name),
+ 'AUTHOR_STATUS' => $row['status'],
'DATE' => format_date($row['date'], array('day_name','day','month','year','time')),
'CONTENT' => trigger_change('render_comment_content',$row['content']),
'IS_PENDING' => ('false' == $row['validated']),
'IP' => $row['anonymous_id'],
+ 'NUMERICAL_DATE' => $row['date'],
)
);
diff --git a/admin/themes/default/template/comments.tpl b/admin/themes/default/template/comments.tpl
index 9fda8f142..8ff26389b 100644
--- a/admin/themes/default/template/comments.tpl
+++ b/admin/themes/default/template/comments.tpl
@@ -1,9 +1,12 @@
+{combine_script id='jquery.ui.slider' require='jquery.ui' load='header' path='themes/default/js/ui/minified/jquery.ui.slider.min.js'}
+{combine_css path="themes/default/js/ui/theme/jquery.ui.slider.css"}
+
{footer_script}
jQuery(document).ready(function(){
$("h1").append(""+{$nb_total}+"");
function highlighComments() {
- jQuery(".checkComment").each(function() {
+ jQuery(".comment").each(function() {
var parent = jQuery(this).parent('tr');
if (jQuery(this).children("input[type=checkbox]").is(':checked')) {
jQuery(parent).addClass('selectedComment');
@@ -14,6 +17,103 @@ jQuery(document).ready(function(){
});
}
+ if ("{$filter}" == "pending"){
+ $("#seeWaiting").prop('checked', true);
+ }
+ if ("{$filter}" == "validated"){
+ $("#seeValidated").prop('checked', true);
+ }
+
+ $("#seeAll").on("change", function(){
+ if ($("#seeAll").prop('checked') == true){
+ window.location.replace("{$F_ACTION}&filter=all&status={$displayed_status}&author={$displayed_author}&start_date={$START}&end_date={$END}");
+ }
+ });
+
+ $("#seeWaiting").on("change", function(){
+ if ($("#seeWaiting").prop('checked') == true){
+ window.location.replace("{$F_ACTION}&filter=pending&status={$displayed_status}&author={$displayed_author}&start_date={$START}&end_date={$END}");
+ }
+ });
+
+ $("#seeValidated").on("change", function(){
+ if ($("#seeValidated").prop('checked') == true){
+ window.location.replace("{$F_ACTION}&filter=validated&status={$displayed_status}&author={$displayed_author}&start_date={$START}&end_date={$END}");
+ }
+ });
+
+ $("#status_filter").on("change", function(){
+ let location = "{$F_ACTION}&filter={$filter}&status=" + $("#status_filter").find(":selected").val().toString() + "&author={$displayed_author}&start_date={$START}&end_date={$END}";
+ window.location.replace(location);
+ });
+
+ $("#status_filter").val("{$displayed_status}");
+
+ $("#author_filter").on("change", function(){
+ let location = "{$F_ACTION}&filter={$filter}&status={$displayed_status}&author=" + $("#author_filter").find(":selected").val().toString() + "&start_date={$START}&end_date={$END}";
+ window.location.replace(location);
+ });
+
+ $("#author_filter").val("{$displayed_author}");
+
+ $("#start_unset").on("click", function(){
+ $("#start_date").val("");
+ let location = "{$F_ACTION}&filter={$filter}&status={$displayed_status}&author={$displayed_author}&start_date=&end_date={$END}";
+ window.location.replace(location);
+ });
+
+ $("#start_date").on("focus", function(){
+ $(this).data('previous', $(this).val());
+ });
+
+ $("#start_date").val("{$START}".replaceAll("_", "-"));
+
+ $("#start_date").on("change", function(){
+ if ($("#end_date").val() != "")
+ {
+ var previous = $(this).data('previous');
+ var current = new Date($(this).val());
+ var max = new Date($("#end_date").val());
+ if (current > max){
+ $(this).val(previous);
+ $(this).data('previous', $(this).val());
+ return
+ }
+ }
+ $(this).data('previous', $(this).val());
+ let location = "{$F_ACTION}&filter={$filter}&status={$displayed_status}&author={$displayed_author}&start_date=" + $(this).val().replaceAll("-", "_") + "&end_date={$END}";
+ window.location.replace(location);
+ });
+
+ $("#end_unset").on("click", function(){
+ $("#end_date").val("");
+ let location = "{$F_ACTION}&filter={$filter}&status={$displayed_status}&author={$displayed_author}&start_date={$START}&end_date=";
+ window.location.replace(location);
+ });
+
+ $("#end_date").on("focus", function(){
+ $(this).data('previous', $(this).val());
+ });
+
+ $("#end_date").val("{$END}".replaceAll("_", "-"));
+
+ $("#end_date").on("change", function(){
+ if ($("#start_date").val() != "")
+ {
+ var previous = $(this).data('previous');
+ var current = new Date($(this).val());
+ var min = new Date($("#start_date").val());
+ if (current < min){
+ $(this).val(previous);
+ $(this).data('previous', $(this).val());
+ return
+ }
+ }
+ $(this).data('previous', $(this).val());
+ let location = "{$F_ACTION}&filter={$filter}&status={$displayed_status}&author={$displayed_author}&start_date={$START}&end_date=" + $(this).val().replaceAll("-", "_");
+ window.location.replace(location);
+ });
+
jQuery(".checkComment").click(function(event) {
var checkbox = jQuery(this).children("input[type=checkbox]");
if (event.target.type !== 'checkbox') {
@@ -23,62 +123,271 @@ jQuery(document).ready(function(){
});
jQuery("#commentSelectAll").click(function () {
- jQuery(".checkComment input[type=checkbox]").prop('checked', true);
+ $(".comment-select-checkbox").prop('checked', true);
+ $(".comment-select-checkbox").trigger("change");
highlighComments();
return false;
});
jQuery("#commentSelectNone").click(function () {
- jQuery(".checkComment input[type=checkbox]").prop('checked', false);
+ $(".comment-select-checkbox").prop('checked', false);
+ $(".comment-select-checkbox").trigger("change");
highlighComments();
return false;
});
jQuery("#commentSelectInvert").click(function () {
- jQuery(".checkComment input[type=checkbox]").each(function() {
+ $(".comment-select-checkbox").each(function() {
jQuery(this).prop('checked', !$(this).prop('checked'));
});
+ $(".comment-select-checkbox").trigger("change");
highlighComments();
return false;
});
+ $(".comment-select-checkbox").on("change", function(event) {
+ if ($(this).prop("checked")){
+ $(this).removeClass("icon-circle-empty")
+ $(this).addClass("icon-ok-circled")
+ }
+ else {
+ $(this).removeClass("icon-ok-circled")
+ $(this).addClass("icon-circle-empty")
+ }
+ });
+
+ $("#toggleSelectionMode").on("click", function() {
+ if ($(".comment-select-checkbox").css("visibility") == "visible") {
+ $(".comment-buttons-container").css("visibility", "visible");
+ $(".comment-select-checkbox").css("visibility", "hidden");
+ $(".comment-selection-content").hide();
+ $(".comment-container").css("margin-inline-end", "0em")
+ $("#advanced-filter-menu").css("margin-inline", "23px 10px")
+
+ $(".comment-select-checkbox").prop('checked', false);
+ $(".comment-select-checkbox").trigger("change");
+ highlighComments();
+ }
+ else {
+ $(".comment-select-checkbox").css("visibility", "visible");
+ $(".comment-buttons-container").css("visibility", "hidden");
+ $(".comment-selection-content").css("display", "flex")
+ $(".comment-container").css("margin-inline-end", "5em")
+ $("#advanced-filter-menu").css("margin-inline", "23px 270px")
+ }
+ })
+
+ $(".advanced-filter-btn").on("click", function() {
+ if ($("#advanced-filter-menu").css("display") == "none") {
+ $("#advanced-filter-menu").css("display", "flex")
+ $("#advanced-filter-menu").css("margin-bottom", "1em")
+ $(".commentFilter").css("margin-bottom", "0.2em")
+ $(".commentFilter .advanced-filter-btn").css("height", "100%")
+ $(".commentFilter .advanced-filter-btn").css("height", "100%")
+ }
+ else {
+ $("#advanced-filter-menu").css("display", "none")
+ $("#advanced-filter-menu").css("margin-bottom", "0.2em")
+ $(".commentFilter").css("margin-bottom", "1em")
+ $(".commentFilter .advanced-filter-btn").css("height", "20px")
+ }
+ })
+
+ if ("{$displayed_status}" != "all" || "{$displayed_author}" != "all" || "{$START}" != "" || "{$END}" != ""){
+ $(".advanced-filter-btn").trigger( "click" );
+ }
+
+ $(".delete-comment, #commentDeleteSelected").on("click", function() {
+ jQuery(this).parent().parent().children("input[type=checkbox]").prop('checked', true);
+ $("#pendingComments").trigger("submit")
+ })
+
+ $(".approve-comment, #commentValidateSelected").on("click", function() {
+ jQuery(this).parent().parent().children("input[type=checkbox]").prop('checked', true);
+ $("#pendingComments").trigger("submit")
+ })
+
+ $("#commentValidateSelected, #commentDeleteSelected").on("click", function() {
+ $("#pendingComments").trigger("submit")
+ })
+
});
{/footer_script}
+
+
-
{if !empty($comments) }
-
+
+