Class ::xowiki::includelet::activity-graph (public)
::xowiki::IncludeletClass ::xowiki::includelet::activity-graph
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Include an activity graph
- Testcases:
- No testcase defined.
Source code: namespace eval ::xowiki::includelet {} ::nsf::object::alloc ::xowiki::IncludeletClass ::xowiki::includelet::activity-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::activity-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]]" } 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 } ::xowiki::includelet::activity-graph instparametercmd parameter_declaration ::nsf::relation::set ::xowiki::includelet::activity-graph superclass ::xowiki::includelet::graph ::nx::slotObj -container slot ::xowiki::includelet::activity-graph ::xowiki::includelet::activity-graph::slot eval {set :__parameter { {parameter_declaration { {-max_edges 70} {-cutoff 0.1} {-max_activities:integer 100} {-show_anonymous "message"} }} }} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::activity-graph::slot::parameter_declaration {set :accessor public set :configurable true set :convert false set :default { {-max_edges 70} {-cutoff 0.1} {-max_activities:integer 100} {-show_anonymous "message"} } set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::activity-graph set :incremental 0 set :manager ::xowiki::includelet::activity-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} {-max_activities:integer 100} {-show_anonymous "message"} }} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init}XQL Not present: Generic, PostgreSQL, Oracle