Class ::xowiki::includelet::most-popular

::xowiki::includelet::most-popular[i] create ... \
           [ -parameter_declaration (default " {-max_entries:integer "10"} {-interval} ") ] \
           [ -title (default "#xowiki.most_popular_pages#") ]

Display most popular pages of this wiki instance.
Documented Parameters:
max_entries
show given number of entries
interval
specified optionally the time interval since when pages are listed
Defined in packages/xowiki/tcl/includelet-procs.tcl

Class Relations

  • class: ::xowiki::IncludeletClass[i]
  • superclass: ::xowiki::Includelet[i]
::xowiki::IncludeletClass create ::xowiki::includelet::most-popular \
     -superclass ::xowiki::Includelet

Methods (to be applied on instances)

  • parameter_declaration (setter)

  • render (scripted)

    :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]
  • title (setter)