fixed #1784 added button in user edit popin to go on te history page with the user as filter

This commit is contained in:
Matthieu Leproux
2022-11-09 15:45:48 +01:00
parent 453de4a3d1
commit 9a4f9272b2
8 changed files with 37 additions and 2 deletions

View File

@@ -102,9 +102,24 @@ else
$form_param['ip'] = isset($_GET['filter_ip']) ? $_GET['filter_ip'] : @$form['ip'];
$form_param['image_id'] = isset($_GET['filter_image_id']) ? $_GET['filter_image_id'] : @$form['image_id'];
$form_param['user_id'] = isset($_GET['filter_user_id']) ? $_GET['filter_user_id'] : "-1";
if ($form_param['user_id'] != "-1") {
$query = '
SELECT
username
FROM '.USERS_TABLE.'
WHERE id = '.$form_param['user_id'].'
;';
list($form_param['user_name']) = pwg_db_fetch_row(pwg_query($query));
$form_param['user_id'] = empty(pwg_db_fetch_row(pwg_query($query))) ? "-1" : $form_param['user_id'];
}
$template->assign(
array(
'USER_ID' => $form_param['user_id'],
'USER_NAME' => @$form_param['user_name'],
'IMAGE_ID' => $form_param['image_id'],
'FILENAME' => @$form['filename'],
'IP' => $form_param['ip'],

View File

@@ -9,6 +9,9 @@ $(document).ready(() => {
if (current_param.image_id != "") {
addImageFilter(current_param.image_id);
}
if (current_param.user_id != "-1") {
addUserFilter(filter_user_name);
}
$(".elem-type-select").on("change", function (e) {
console.log($(".elem-type-select option:selected").attr("value"));

View File

@@ -1002,6 +1002,7 @@ function fill_user_edit_summary(user_to_edit, pop_in, isGuest) {
pop_in.find('.user-property-register').tipTip({content:`${registered_str}<br />${user_to_edit.registration_date_since}`});
pop_in.find('.user-property-last-visit').html(get_formatted_date(user_to_edit.last_visit));
pop_in.find('.user-property-last-visit').tipTip({content: `${last_visit_str}<br />${user_to_edit.last_visit_since}`});
pop_in.find('.user-property-history a').attr('href', history_base_url + user_to_edit.id);
}
function fill_user_edit_properties(user_to_edit, pop_in) {

View File

@@ -11,6 +11,8 @@ var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
var filter_user_name = "{$USER_NAME}";
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
@@ -24,10 +26,10 @@ var current_param = {
2: "high",
3: "other"
},
user_id: "-1",
user_id: {$USER_ID},
image_id: {if isset($IMAGE_ID)}"{$IMAGE_ID}"{else}""{/if},
filename: "",
ip:{if isset($IP)}"{$IP}"{else}""{/if},
ip: {if isset($IP)}"{$IP}"{else}""{/if},
display_thumbnail: "display_thumbnail_classic",
pageNumber: 0 {* fetch lines from line 0 to line 100*}
}

View File

@@ -34,6 +34,7 @@ const hide_str = '{'Hide'|@translate}';
const show_str = '{'Show'|@translate}';
const user_added_str = '{'User %s added'|@translate}';
const str_popin_update_btn = '{'Update'|@translate}';
const history_base_url = "{$U_HISTORY}";
const view_selector = '{$view_selector}';
@@ -637,6 +638,11 @@ $(document).ready(function() {
<div class="user-property-permissions">
<p class="user-property-button"> <span class="icon-lock user-edit-icon"> </span><a href="#" >{'Permissions'|@translate}</a></p>
</div>
<div class="user-stats">
<div class="user-property-history">
<p class="user-property-button"> <span class="icon-signal user-edit-icon"> </span><a href="" >{'Visit history'|@translate}</a></p>
</div>
</div>
</div>
<div class="user-property-register-visit">
<span class="user-property-register"><!-- Registered date XX/XX/XXXX --></span>
@@ -817,6 +823,11 @@ $(document).ready(function() {
<div class="user-property-permissions">
<p class="user-property-button"><span class="icon-lock user-edit-icon"></span><a href="admin.php?page=user_perm&user_id={$guest_id}">{'Permissions'|@translate}</a></p>
</div>
<div class="user-stats">
<div class="user-property-history">
<p class="user-property-button"> <span class="icon-signal user-edit-icon"> </span><a href="" >{'Visit history'|@translate}</a></p>
</div>
</div>
</div>
</div>
<div class="properties-container">

View File

@@ -102,6 +102,7 @@ SELECT
$template->assign(
array(
'U_HISTORY' => get_root_url().'admin.php?page=history&filter_user_id=',
'PWG_TOKEN' => get_pwg_token(),
'NB_IMAGE_PAGE' => $default_user['nb_image_page'],
'RECENT_PERIOD' => $default_user['recent_period'],

View File

@@ -1324,4 +1324,5 @@ $lang['The best is to have them made automatically on a regular basis.'] = 'The
$lang['If anything bad happens during the update, you would be able to restore a backup.'] = 'If anything bad happens during the update, you would be able to restore a backup.';
$lang['Apply to root albums'] = 'Apply to root albums';
$lang['Album name must not be empty'] = 'Album name must not be empty';
$lang['Visit history'] = 'Visit history';
// Leave this line empty

View File

@@ -1324,4 +1324,5 @@ $lang['The best is to have them made automatically on a regular basis.'] = 'Le m
$lang['If anything bad happens during the update, you would be able to restore a backup.'] = 'Si quelque chose arrive pendant la mise à jour, il sera possible de restaurer la sauvegarde';
$lang['Apply to root albums'] = 'Appliquer aux albums racine';
$lang['Album name must not be empty'] = 'Le nom de l\'album ne doit pas être vide';
$lang['Visit history'] = 'Historique des visites';
// Leave this line empty