Class ::xowiki::includelet::categories-recent (public)
::xowiki::IncludeletClass ::xowiki::includelet::categories-recent
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Display recent entries by categories.
- Testcases:
- No testcase defined.
Source code: namespace eval ::xowiki::includelet {} ::nsf::object::alloc ::xowiki::IncludeletClass ::xowiki::includelet::categories-recent {set :__default_metaclass ::xotcl::Class set :__default_superclass ::xotcl::Object set :aggregating true set :cacheable false set :localized true set :personalized false} ::xowiki::includelet::categories-recent instproc render {} { :get_parameters if {![info exists :id]} {set :id [::xowiki::Includelet html_id [self]]} set cattree [::xowiki::Tree new -volatile -id [:id]] lassign [::xowiki::Includelet locale_clause -revisions r -items ci $package_id $locale] locale locale_clause set tree_ids [::xowiki::Category get_mapped_trees -object_id $package_id -locale $locale -names $tree_name -output tree_id] if {$tree_ids ne ""} { set tree_select_clause "and c.tree_id in ([ns_dbquotelist $tree_ids])" } else { set tree_select_clause "" } set sql [::xo::dc select -vars "c.category_id, ci.name, ci.parent_id, r.title, r.publish_date, to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as formatted_date" -from "category_object_map_tree c, cr_items ci, cr_revisions r, xowiki_page p" -where "c.object_id = ci.item_id and ci.parent_id = [ns_dbquotevalue [::$package_id folder_id]] and r.revision_id = ci.live_revision and p.page_id = r.revision_id $tree_select_clause $locale_clause and ci.publish_status <> 'production'" -orderby "publish_date desc" -limit $max_entries] ::xo::dc foreach get_pages $sql { if {$title eq ""} {set title $name} set itemobj [Object new] set prefix "" set suffix "" switch -- $pretty_age { 1 {set suffix " ([::xowiki::utility pretty_age -timestamp [clock scan $formatted_date] -locale [:locale]])"} 2 {set suffix "([::xowiki::utility pretty_age -timestamp [clock scan $formatted_date] -locale [:locale] -levels 2])"} default {set prefix "$formatted_date "} } if {$prefix ne ""} {set prefix "<span class='date'>$prefix</span>";$itemobj set encoded(prefix) 1} if {$suffix ne ""} {set suffix "<span class='date'>$suffix</span>";$itemobj set encoded(suffix) 1} $itemobj mset [list name $name title $title prefix $prefix suffix $suffix href [::$package_id pretty_link -parent_id $parent_id $name] ] if {![info exists categories($category_id)]} { set categories($category_id) [::xowiki::TreeNode new -label [category::get_name $category_id $locale] -level 1] $cattree add $categories($category_id) } $cattree add_item -category $categories($category_id) -itemobj $itemobj } return [$cattree render -style ${:style}] } ::xowiki::includelet::categories-recent instproc initialize {} { set :style sections # When pretty age is activated, this includedlet is not suited for # caching (it could make sense e.g. when the age granularity is 1 # minute or more). This measure here (turning off caching # completely) is a little bit too much, but it is safe. :get_parameters if {[[:info class] cacheable] && $pretty_age ne "off"} { [:info class] cacheable false } } ::xowiki::includelet::categories-recent instproc include_head_entries {} { ::xowiki::Tree include_head_entries -renderer ${:style} } ::xowiki::includelet::categories-recent instparametercmd title ::xowiki::includelet::categories-recent instparametercmd parameter_declaration ::nsf::relation::set ::xowiki::includelet::categories-recent superclass ::xowiki::Includelet ::nx::slotObj -container slot ::xowiki::includelet::categories-recent ::xowiki::includelet::categories-recent::slot eval {set :__parameter { {title "#xowiki.recently_changed_pages_by_categories#"} {parameter_declaration { {-max_entries:integer 10} {-tree_name ""} {-locale ""} {-pretty_age "off"} }} }} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::categories-recent::slot::parameter_declaration {set :accessor public set :configurable true set :convert false set :default { {-max_entries:integer 10} {-tree_name ""} {-locale ""} {-pretty_age "off"} } set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::categories-recent set :incremental 0 set :manager ::xowiki::includelet::categories-recent::slot::parameter_declaration set :methodname parameter_declaration set :multiplicity 1..1 set :name parameter_declaration set :parameterSpec {-parameter_declaration:substdefault { {-max_entries:integer 10} {-tree_name ""} {-locale ""} {-pretty_age "off"} }} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init} ::nsf::object::alloc ::xotcl::Attribute ::xowiki::includelet::categories-recent::slot::title {set :accessor public set :configurable true set :convert false set :default #xowiki.recently_changed_pages_by_categories# set :defaultmethods {} set :disposition alias set :domain ::xowiki::includelet::categories-recent set :incremental 0 set :manager ::xowiki::includelet::categories-recent::slot::title set :methodname title set :multiplicity 1..1 set :name title set :parameterSpec {-title:substdefault #xowiki.recently_changed_pages_by_categories#} set :per-object false set :position 0 set :required false set :substdefault 0b111 set :trace none : init}XQL Not present: Generic, PostgreSQL, Oracle