Index: openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl 5 Jul 2018 15:14:01 -0000 1.11
+++ openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl 3 Sep 2024 15:37:54 -0000 1.12
@@ -5,7 +5,7 @@
@cvs-id $Id$
} -query {
request_key
- {all:optional 1}
+ {all:boolean,optional,notnull 1}
{orderby:token,optional "last_modified,desc"}
} -properties {
title:onevalue
@@ -17,13 +17,13 @@
set context [list "Last Requests"]
set hide_patterns [parameter::get -parameter hide-requests -default {*.css}]
-if {[string is integer $request_key]} {
- set person [person::get_person_info -person_id $request_key]
- set user_string "[dict get $person first_names] [dict get $person last_name]"
- set tmp_url [acs_community_member_url -user_id $request_key]
- append user_string " ($request_key)"
+if {[nsf::is integer $request_key]} {
+ set user_info [xo::request_monitor_user_info $request_key]
+ set user_string [dict get $user_info label]
+ set tmp_url [dict get $user_info url]
+ append user_string " ($request_key)"
} else {
- set user_string $request_key
+ set user_string $request_key
}
append title $user_string
@@ -51,34 +51,40 @@
AnchorField url -label "URL"
Field pa -label "Peer Address"
} \
- -no_data "no requests for this user recorded"
+ -no_data "no requests for this user recorded"
+lassign [split $orderby ,] att order
+t1 orderby \
+ -order [ad_decode $order desc decreasing asc increasing increasing] \
+ -type [ad_decode $att diff integer dictionary] \
+ $att
+
set all [expr {!$all}]
set requests [throttle users last_requests $request_key]
#set last_timestamp [lindex $requests end 0]
set last_timestamp [clock seconds]
set hidden 0
-foreach element [lsort -index 0 -decreasing $requests] {
+foreach element $requests {
lassign $element timestamp url pa
if {!$all} {
set exclude 0
foreach pattern $hide_patterns {
if {[string match $pattern $url]} {
- set exclude 1
- incr hidden
- break
+ set exclude 1
+ incr hidden
+ break
}
}
if {$exclude} continue
}
set diff [expr {$last_timestamp-$timestamp}]
- set url_label [string_truncate_middle -len 70 $url]
+ set url_label [ad_string_truncate_middle -len 70 $url]
t1 add -time [clock format $timestamp] \
- -timediff $diff \
- -url $url_label \
- -url.href "[ad_url]$url" \
- -pa $pa
+ -timediff $diff \
+ -url $url_label \
+ -url.href "[ad_url]$url" \
+ -pa $pa
}
set user_string "$hidden requests hidden."