- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::includelet::presence
::xowiki::includelet::presence create ... \Show users actively in the wiki.
[ -__decoration (default "rightbox") ] \
[ -parameter_declaration (default " {-interval "10 minutes"} {-max_users:integer 40} {-show_anonymous "summary"} {-page} ") ]
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Class Relations
::xowiki::IncludeletClass create ::xowiki::includelet::presence \ -superclass ::xowiki::IncludeletMethods (to be applied on instances)
__decoration (setter)
parameter_declaration (setter)
render (scripted)
:get_parameters set summary 0 if {[::xo::cc user_id] == 0} { switch -- $show_anonymous { nothing {return ""} all {set summary 0} default {set summary 1} } } if {[info exists page] && $page eq "this"} { set extra_where_clause "and page_id = [${:__including_page} item_id] " set what " on page [${:__including_page} title]" } else { set extra_where_clause "" set what " in community [::$package_id instance_name]" } if {!$summary} { set select_users "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time from xowiki_last_visited " } # allow for caching prepared value. set since [::xo::dc interval $interval] set since_condition "time > TO_TIMESTAMP(:since,'YYYY-MM-DD HH24:MI:SS')" set where_clause "package_id=:package_id and $since_condition $extra_where_clause" set when "<br>in last [ns_quotehtml $interval]" set output "" if {$summary} { set count [::xo::dc get_value presence_count_users "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"] } else { set values [::xo::dc list_of_lists get_users [::xo::dc select -vars "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time" -from xowiki_last_visited -where $where_clause -groupby user_id -orderby "max_time desc" -limit $max_users ]] set count [llength $values] if {$count == $max_users} { # we have to check, whether there were more users... set count [::xo::dc get_value presence_count_users "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"] } foreach value $values { lassign $value user_id time set seen($user_id) $time regexp {^([^.]+)[.]} $time _ time set pretty_time [util::age_pretty -timestamp_ansi $time -sysdate_ansi [lc_clock_to_ansi [clock seconds]] -mode_3_fmt "%d %b %Y, at %X"] set name [::xo::get_user_name $user_id] append output [subst {<tr><td class='user'>[ns_quotehtml $name]</td> <td class='timestamp'> - [ns_quotehtml $pretty_time]</td></tr> }] } if {$output ne ""} {set output "<table>$output</table>\n"} } set users [expr {$count == 0 ? "No registered users" : $count == 1 ? "1 registered user" : "$count registered users"}] return "<div class='title'>[ns_quotehtml $users$what]$when</div>$output"
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables