Index: openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl,v diff -u -r1.16 -r1.16.2.1 --- openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl 29 Jun 2018 17:27:19 -0000 1.16 +++ openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl 25 Jan 2020 14:17:59 -0000 1.16.2.1 @@ -19,7 +19,7 @@ # get value from package parameters set peer_groups [parameter::get -parameter peer-groups \ - -default {*wlan* *dsl* *.com *.net *.org}] + -default {*wlan* *dsl* *.com *.net *.org}] set admin [acs_user::site_wide_admin_p] #set admin 0 @@ -38,24 +38,24 @@ -columns [subst { AnchorField name -label "User" -orderby name Field online_time -label "Last Activity" -html { align right } \ - -orderby online_time + -orderby online_time Field vpm -label "Views per min" -html { align center } -orderby vpm if {$admin} { - Field activity -label "Activity" -html { align right } -orderby activity - AnchorField hits -label "Hits" -orderby hits - Field switches -label "Switches" -html { align center } -orderby switches - Field peer_address -label "Peer" -orderby peer_address + Field activity -label "Activity" -html { align right } -orderby activity + AnchorField hits -label "Hits" -orderby hits + Field switches -label "Switches" -html { align center } -orderby switches + Field peer_address -label "Peer" -orderby peer_address } }] \ - -no_data "no registered users online" + -no_data "no registered users online" foreach cat $peer_groups {set peer_cat_count($cat) 0} set peer_cat_count(others) 0 # this proc is used only for caching purposes proc my_hostname pa { - if {[catch {set peer [ns_hostbyaddr $pa]}]} { return $pa } + if {[catch {set peer [ns_hostbyaddr $pa]}]} { return $pa } return "$peer ($pa)" #return "$peer" } @@ -72,20 +72,20 @@ # it was an IP address set user_label $user_id set user_url "" - } + } set timestamp [lindex $smooth 2] set last_request_minutes [expr {[clock seconds]/60 - $timestamp}] - + set peer $pa if {$admin} { catch {set peer [util_memoize [string tolower \ - [list ::template::my_hostname $pa]]]} + [list ::template::my_hostname $pa]]]} set match 0 foreach cat $peer_groups { if {[string match "$cat *" $peer]} { - incr peer_cat_count($cat) - set match 1 - break + incr peer_cat_count($cat) + set match 1 + break } } if {!$match} { @@ -97,21 +97,21 @@ set detail_url "last-requests?request_key=$user_id" lappend users [list $user_label \ - $user_url \ - $last_request_minutes "$last_request_minutes minutes ago" \ - [format %.2f [lindex $smooth 0]] \ - $hits $loadparam $detail_url \ - $switches \ - $peer \ - $user_id \ - [throttle views_per_minute $user_id] \ - ] + $user_url \ + $last_request_minutes "$last_request_minutes minutes ago" \ + [format %.2f [lindex $smooth 0]] \ + $hits $loadparam $detail_url \ + $switches \ + $peer \ + $user_id \ + [throttle views_per_minute $user_id] \ + ] } switch -glob $orderby { *,desc {set order -decreasing} *,asc {set order -increasing} -} +} switch -glob $orderby { name,* {set index 0; set type -dictionary} online_time,* {set index 3; set type -dictionary} @@ -137,20 +137,20 @@ foreach e [lsort $type $order -index $index $users] { if {$admin} { - t1 add -name [lindex $e 0] \ - -name.href [lindex $e 1] \ - -online_time [lindex $e 3] \ - -activity [lindex $e 4] \ - -hits [lindex $e 6] \ - -hits.href [lindex $e 7] \ - -switches [lindex $e 8] \ - -vpm [format %.2f [lindex $e 11]] \ - -peer_address [lindex $e 9] + t1 add -name [lindex $e 0] \ + -name.href [lindex $e 1] \ + -online_time [lindex $e 3] \ + -activity [lindex $e 4] \ + -hits [lindex $e 6] \ + -hits.href [lindex $e 7] \ + -switches [lindex $e 8] \ + -vpm [format %.2f [lindex $e 11]] \ + -peer_address [lindex $e 9] } else { - t1 add -name [lindex $e 0] \ - -name.href [lindex $e 1] \ - -online_time [lindex $e 3] \ - -vpm [format %.2f [lindex $e 11]] + t1 add -name [lindex $e 0] \ + -name.href [lindex $e 1] \ + -online_time [lindex $e 3] \ + -vpm [format %.2f [lindex $e 11]] } }