%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::collab-graph

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

Include a collaboration graph
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl

Class Relations

  • class: ::xowiki::IncludeletClass[i]
  • superclass: ::xowiki::includelet::graph[i]
::xowiki::IncludeletClass create ::xowiki::includelet::collab-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]]"
    }
    if {![info exists user_id]} {set user_id [::xo::cc user_id]}
    
    set folder_id [::$package_id folder_id]
    ::xo::dc foreach get_collaborators {
      select count(revision_id), item_id, creation_user
      from cr_revisions r, acs_objects o
      where item_id in
      (select distinct i.item_id from
       acs_objects o, acs_objects o2, cr_revisions cr, cr_items i
       where o.object_id = i.item_id and o2.object_id = cr.revision_id
       and o2.creation_user = :user_id and i.item_id = cr.item_id
       and i.parent_id = :folder_id order by item_id
       )
      and o.object_id = revision_id
      and creation_user is not null
      group by item_id, creation_user} {
    
      lappend i($item_id$creation_user $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])"
      if {![info exists activities($creation_user)]} {set activities($creation_user) 0}
      incr activities($creation_user$count
    }
    
    set result "<p>Collaboration Graph for <b>[::xo::get_user_name $user_id]</b> in this wiki"
    if {[array size i] < 1} {
      append result "</p><p>No collaborations found</p>"
    } else {
    
      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 50
      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 "($activities($user_id) contributions)</p>\n"
      append result [:graphHTML  -nodes [array get user] -edges $edges  -max_edges $max_edges -cutoff $cutoff  -base collab -attrib user_id]
    }
    
    return $result