%3 ::xowiki::includelet::activity-graph ::xowiki::includelet::activity-graph render ::xowiki::includelet::graph ::xowiki::includelet::graph graphHTML ::xowiki::includelet::activity-graph->::xowiki::includelet::graph ::xowiki::includelet::collab-graph ::xowiki::includelet::collab-graph render ::xowiki::includelet::collab-graph->::xowiki::includelet::graph ::xowiki::Includelet ::xowiki::Includelet → 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 category_clause get_current_folder get_page_order include_head_entries initialize js_name resolve_page_name screen_name tableWidget ::xowiki::includelet::graph->::xowiki::Includelet ::xo::Context ::xo::Context ::xowiki::Includelet->::xo::Context

Class ::xowiki::includelet::activity-graph

::xowiki::includelet::activity-graph[i] create ... \
           [ -parameter_declaration (default " {-max_edges 70} {-cutoff 0.1} {-max_activities:integer 100} {-show_anonymous "message"} ") ]

Include an activity graph
Defined in packages/xowiki/tcl/includelet-procs.tcl

Class Relations

  • class: ::xowiki::IncludeletClass[i]
  • superclass: ::xowiki::includelet::graph[i]
::xowiki::IncludeletClass create ::xowiki::includelet::activity-graph \
     -superclass ::xowiki::includelet::graph

Methods (to be applied on instances)

  • parameter_declaration (setter)

  • render (scripted)

    :get_parameters
    
    if {$show_anonymous ne "all" && [::xo::cc user_id] eq "0"} {
      return "You must login to see the [namespace tail [self class]]"
    }
    
    set tmp_table_name XOWIKI_TMP_ACTIVITY
    #:msg "tmp exists [::xo::db::require exists_table $tmp_table_name]"
    set tt [::xo::db::temp_table new  -name $tmp_table_name  -query [::xo::dc select  -vars "i.item_id, revision_id, creation_user"  -from "cr_revisions cr, cr_items i, acs_objects o"  -where "cr.item_id = i.item_id  and i.parent_id = [ns_dbquotevalue [::$package_id folder_id]]  and o.object_id = revision_id"  -orderby "revision_id desc"  -limit $max_activities]  -vars "item_id, revision_id, creation_user"]
    
    set total 0
    ::xo::dc foreach get_activities "
      select count(revision_id) as count, item_id, creation_user
      from $tmp_table_name
      where creation_user is not null
      group by item_id, creation_user
       " {
      lappend i($item_id$creation_user $count
      incr total $count
      set count_var user_count($creation_user)
      if {![info exists $count_var]} {set $count_var 0}
      incr $count_var $count
      set user($creation_user"[::xo::get_user_name $creation_user] ([set $count_var])"
    }
    $tt destroy
    
    if {[array size i] == 0} {
      append result "<p>No activities found</p>"
    } elseif {[array size user] == 1} {
      set user_id [lindex [array names user] 0]
      append result "<p>Last $total activities were done by user "  "<a href='[ns_quotehtml collab?$user_id]'>[ns_quotehtml [::xo::get_user_name $user_id]]</a>."
    } else {
      append result "<p>Collaborations in last $total activities by [array size user] Users in this wiki</p>"
    
      foreach x [array names i] {
        foreach {u1 c1} $i($x) {
          foreach {u2 c2} $i($x) {
            if {$u1 < $u2} {
              set var collab($u1,$u2)
              if {![info exists $var]} {set $var 0}
              incr $var $c1
              incr $var $c2
            }
          }
        }
      }
    
      set max 0
      foreach x [array names collab] {
        if {$collab($x) > $max} {set max $collab($x)}
      }
    
      set edges [list]
      foreach x [array names collab] {
        lappend edges [list $x $collab($x) [expr {$collab($x)*5.0/$max}]]
      }
    
      append result [:graphHTML  -nodes [array get user] -edges $edges  -max_edges $max_edges -cutoff $cutoff  -base collab -attrib user_id]
    }
    
    return $result