Class ::xowiki::includelet::collab-graph (public)
::xowiki::IncludeletClass ::xowiki::includelet::collab-graph
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Include a collaboration graph
- Testcases:
- No testcase defined.
Source code: namespace eval ::xowiki::includelet {} ::nsf::object::alloc ::xowiki::IncludeletClass ::xowiki::includelet::collab-graph {set :__default_metaclass ::xotcl::Class set :__default_superclass ::xotcl::Object set :aggregating false set :cacheable false set :localized true set :personalized true} ::xowiki::includelet::collab-graph instproc render {} { :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 } ::xowiki::includelet::collab-graph instparametercmd parameter_declaration ::nsf::relation::set ::xowiki::includelet::collab-graph superclass ::xowiki::includelet::graph ::nx::slotObj -container slot ::xowiki::includelet::collab-graph ::xowiki::includelet::collab-graph::slot eval {set :__parameter { {parameter_declaration { {-max_edges 70} {-cutoff 0.1} {-show_anonymous "message"} -user_id }} }} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::collab-graph::slot::parameter_declaration {set :accessor public set :configurable true set :convert false set :default { {-max_edges 70} {-cutoff 0.1} {-show_anonymous "message"} -user_id } set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::collab-graph set :incremental 0 set :manager ::xowiki::includelet::collab-graph::slot::parameter_declaration set :methodname parameter_declaration set :multiplicity 1..1 set :name parameter_declaration set :parameterSpec {-parameter_declaration:substdefault { {-max_edges 70} {-cutoff 0.1} {-show_anonymous "message"} -user_id }} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init}XQL Not present: Generic, PostgreSQL, Oracle