- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::includelet::categories-recent
::xowiki::includelet::categories-recent create ... \Display recent entries by categories.
[ -parameter_declaration (default " {-max_entries:integer 10} {-tree_name ""} {-locale ""} {-pretty_age "off"} ") ] \
[ -title (default "#xowiki.recently_changed_pages_by_categories#") ]
Defined in /var/www/openacs.org/packages/xowiki/tcl/includelet-procs.tcl
Class Relations
::xowiki::IncludeletClass create ::xowiki::includelet::categories-recent \ -superclass ::xowiki::IncludeletMethods (to be applied on instances)
include_head_entries (scripted)
::xowiki::Tree include_head_entries -renderer ${:style}initialize (scripted)
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 }parameter_declaration (setter)
render (scripted)
: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}]title (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables