xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xowiki::IncludeletClass[i] ::xowiki::includelet::presence

Class Hierarchy of ::xowiki::includelet::presence

  • ::xotcl::Object[i]
    Meta-class:
    ::xotcl::Class[i]
    Methods for instances:
    __api_make_doc, __api_make_forward_doc, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, check, classC, cleanupC, configureC, containsC, copyC, db_0or1rowC, db_1rowC, debug, defaultmethodC, destroyC, destroy_on_cleanup, ds, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearch, forward, hasclass, incrC, infoC, init, instvarC, invarC, isclass, ismetaclass, ismixin, isobject, istype, lappendC, log, method, mixinC, mixinguardC, moveC, msg, noinitC, objectparameter, parametercmdC, proc, procsearch, qn, requireNamespaceC, residualargsC, self, serialize, setC, set_instance_vars_defaults, show-object, substC, traceC, unknown, unsetC, uplevelC, upvarC, volatileC, vwait
    Methods to be applied on the class (in addition to the methods provided by the meta-class):
    getExitHandler, setExitHandler, unsetExitHandler
    • ::xo::Context[i]
      Meta-class:
      ::xotcl::Class[i]
      Parameter for instances:
      actual_query (default " "), locale, package_id (default "0"), parameter_declaration (default "")
      Methods for instances:
      exists_query_parameter, export_vars, get_all_query_parameter, get_parameters, initialize, original_url_and_query, process_query_parameter, query_parameter
      Methods to be applied on the class:
      Methods provided by the meta-class
      • ::xowiki::Includelet[i]
        Meta-class:
        ::xotcl::Class[i]
        Parameter for instances:
        __decoration (default "portlet"), id, name (default ""), parameter_declaration (default ""), title (default "")
        Methods for instances:
        category_clause, get_page_order, include_head_entries, initialize, js_name, resolve_page_name, screen_name
        Methods to be applied on the class (in addition to the methods provided by the meta-class):
        available_includelets, describe_includelets, glob_clause, html_encode, html_id, html_to_text, js_encode, js_name, listing, locale_clause, parent_id_clause, publish_status_clause, require_YUI_CSS, require_YUI_JS
        • ::xowiki::includelet::presence[i]
          Meta-class:
          ::xowiki::IncludeletClass[i]
          Parameter for instances:
          __decoration (default "rightbox"), parameter_declaration (default " {-interval "10 minutes"} {-max_users:integer 40} {-show_anonymous "summary"} {-page} ")
          Methods for instances:
          render
          Methods to be applied on the class:
          Methods provided by the meta-class

Class Relations

  • superclass: ::xowiki::Includelet[i]
::xowiki::IncludeletClass create ::xowiki::includelet::presence \
     -superclass ::xowiki::Includelet \
     -parameter {{__decoration rightbox} {parameter_declaration {
          {-interval "10 minutes"}
          {-max_users:integer 40}
          {-show_anonymous "summary"}
          {-page}
        }}}

Methods

  • instproc render

    ::60142 instproc render {} {
        my 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"} {
          my instvar __including_page
          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 "
        }
        set since_condition [::xo::db::sql since_interval_condition time $interval]
        set where_clause "package_id=$package_id and $since_condition $extra_where_clause"
        set when "<br>in last $interval"
    
        set output ""
    
        if {$summary} {
          set count [::xo::db_string presence_count_users  "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"]
        } else {
          set values [::xo::db_list_of_lists get_users  [::xo::db::sql 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::db_string presence_count_users  "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"]
          }
          foreach value  $values {
            foreach {user_id time} $value break
            set seen($user_id) $time
            
            regexp {^([^.]+)[.]} $time _ time
            set pretty_time [util::age_pretty -timestamp_ansi $time  -sysdate_ansi [clock_to_ansi [clock seconds]]  -mode_3_fmt "%d %b %Y, at %X"]
            set name [::xo::get_user_name $user_id]
    
            append output "<TR><TD class='user'>$name</TD><TD class='timestamp'>$pretty_time</TD></TR>\n"
          }
          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'>$users$what$when</div>$output"
      }
    

Variables

::xowiki::includelet::presence set __default_metaclass ::xotcl::Class
::xowiki::includelet::presence set __default_superclass ::xotcl::Object
::xowiki::includelet::presence set aggregating false
::xowiki::includelet::presence set cacheable false
::xowiki::includelet::presence set localized true
::xowiki::includelet::presence set personalized true

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]