Class ::xowiki::includelet::most-popular (public)
::xowiki::IncludeletClass ::xowiki::includelet::most-popular
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Display most popular pages of this wiki instance.
- Testcases:
- No testcase defined.
Source code: namespace eval ::xowiki::includelet {} ::nsf::object::alloc ::xowiki::IncludeletClass ::xowiki::includelet::most-popular {set :__default_metaclass ::xotcl::Class set :__default_superclass ::xotcl::Object set :aggregating false set :cacheable false set :localized true set :personalized true} ::xowiki::includelet::most-popular instproc render {} { :get_parameters ::xo::Page requireCSS "/resources/acs-templating/lists.css" if {[info exists interval]} { # # If we have and interval, we cannot get report the number of visits # for that interval, since we have only the aggregated values in # the database. # append :title " in last $interval" [:tableWidget] create t1 -volatile -columns { AnchorField create title -label [::xowiki::Page::slot::title set pretty_name] Field create users -label [_ xowiki.includelet-visitors] -html { align right } } set since_condition [::xo::dc since_interval_condition time $interval] xo::dc foreach get_pages [::xo::dc select -vars "count(x.user_id) as nr_different_users, r.title, i.name, i.parent_id" -from "xowiki_last_visited x, cr_items i, cr_revisions r" -where "x.package_id = :package_id and x.page_id = i.item_id and i.publish_status <> 'production' and i.live_revision = r.revision_id and $since_condition" -groupby "x.page_id, r.title, i.name, i.parent_id" -orderby "nr_different_users desc" -limit $max_entries ] { t1 add -title $title -title.href [::$package_id pretty_link -parent_id $parent_id $name] -users $nr_different_users } } else { [:tableWidget] create t1 -volatile -columns { AnchorField create title -label [::xowiki::Page::slot::title set pretty_name] Field create count -label [_ xowiki.includelets-visits] -html { align right } Field create users -label [_ xowiki.includelet-visitors] -html { align right } } xo::dc foreach get_pages [::xo::dc select -vars "sum(x.count) as sum, count(x.user_id) as nr_different_users, r.title,i.name, i.parent_id" -from "xowiki_last_visited x, cr_items i, cr_revisions r" -where "x.package_id = :package_id and x.page_id = i.item_id and i.publish_status <> 'production' and i.live_revision = r.revision_id" -groupby "x.page_id, r.title, i.name, i.parent_id" -orderby "sum desc" -limit $max_entries] { t1 add -title $title -title.href [::$package_id pretty_link -parent_id $parent_id $name] -users $nr_different_users -count $sum } } return [t1 asHTML] } ::xowiki::includelet::most-popular instparametercmd parameter_declaration ::xowiki::includelet::most-popular instparametercmd title ::nsf::relation::set ::xowiki::includelet::most-popular superclass ::xowiki::Includelet ::nx::slotObj -container slot ::xowiki::includelet::most-popular ::xowiki::includelet::most-popular::slot eval {set :__parameter { {title "#xowiki.most_popular_pages#"} {parameter_declaration { {-max_entries:integer "10"} {-interval} }} }} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::most-popular::slot::title {set :accessor public set :configurable true set :convert false set :default #xowiki.most_popular_pages# set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::most-popular set :incremental 0 set :manager ::xowiki::includelet::most-popular::slot::title set :methodname title set :multiplicity 1..1 set :name title set :parameterSpec {-title:substdefault #xowiki.most_popular_pages#} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::most-popular::slot::parameter_declaration {set :accessor public set :configurable true set :convert false set :default { {-max_entries:integer "10"} {-interval} } set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::most-popular set :incremental 0 set :manager ::xowiki::includelet::most-popular::slot::parameter_declaration set :methodname parameter_declaration set :multiplicity 1..1 set :name parameter_declaration set :parameterSpec {-parameter_declaration:substdefault { {-max_entries:integer "10"} {-interval} }} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init}XQL Not present: Generic, PostgreSQL, Oracle