Index: openacs-4/packages/xowiki/www/portlets/categories-recent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories-recent.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/portlets/categories-recent.adp 11 Feb 2006 00:57:44 -0000 1.1.2.1 @@ -0,0 +1,6 @@ +
+@name@ +
+
+@content;noquote@ +
Index: openacs-4/packages/xowiki/www/portlets/categories-recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories-recent.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/portlets/categories-recent.tcl 11 Feb 2006 00:57:44 -0000 1.1.2.1 @@ -0,0 +1,67 @@ +# $Id: categories-recent.tcl,v 1.1.2.1 2006/02/11 00:57:44 gustafn Exp $ +# display recent entries by categories +# -gustaf neumann +# +# valid parameters from the include are +# tree_name: match pattern, if specified displays only the trees with matching names +# max_entries: show given number of new entries + +if {![info exists max_entries]} {set max_entries 10} + +# get the folder id from the including page +set folder_id [$__including_page set parent_id] +set package_id [$folder_id set package_id] +set ::url_prefix [site_node::get_url_from_object_id -object_id $package_id] + + +Class CatTree -volatile -superclass ::xo::OrderedComposite +CatTree instproc add_to_category {-category_id -itemobj} { + set catobj [self]::$category_id + if {![my isobject $catobj]} {::xo::OrderedComposite create $catobj; my add $catobj} + $catobj add $itemobj +} +CatTree instproc render {} { + set content "" + foreach c [my children] { + set cat_content "" + foreach i [$c children] { + $i instvar title page_title publish_date + append cat_content "$publish_date $page_title
\n" + } + append content "

[category::get_name [namespace tail $c]]

" \ + $cat_content "
\n" + } + return $content +} +set cattree [CatTree new -volatile] + +## provide also a three level display with tree names? + +foreach tree [category_tree::get_mapped_trees $package_id] { + foreach {tree_id my_tree_name ...} $tree {break} + if {[info exists tree_name] && ![string match $tree_name $my_tree_name]} continue + lappend trees $tree_id +} +if {[info exists trees]} { + set tree_select_clause "and c.tree_id in ([join $trees ,])" +} else { + set tree_select_clause "" +} + +db_foreach get_pages \ + "select c.category_id, r.title, p.page_title, \ + to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as publish_date \ + from category_object_map_tree c, cr_items i, cr_revisions r, xowiki_page p \ + where c.object_id = i.item_id and i.parent_id = $folder_id \ + and r.revision_id = i.live_revision \ + and p.page_id = r.revision_id $tree_select_clause \ + order by r.publish_date desc limit $max_entries + " { + if {$page_title eq ""} {set page_title $title} + set itemobj [Object new] + foreach var {title page_title publish_date} {$itemobj set $var [set $var]} + $cattree add_to_category -category_id $category_id -itemobj $itemobj + } + +set content [$cattree render] +set link "" Index: openacs-4/packages/xowiki/www/portlets/recent.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/recent.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/portlets/recent.adp 11 Feb 2006 00:57:44 -0000 1.1.2.1 @@ -0,0 +1,6 @@ +
+@name@ +
+
+@content;noquote@ +
Index: openacs-4/packages/xowiki/www/portlets/recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/recent.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/portlets/recent.tcl 11 Feb 2006 00:57:44 -0000 1.1.2.1 @@ -0,0 +1,40 @@ +# $Id: recent.tcl,v 1.1.2.1 2006/02/11 00:57:44 gustafn Exp $ +# display recent entries +# -gustaf neumann +# +# valid parameters from the include are +# max_entries: show given number of new entries + +if {![info exists max_entries]} {set max_entries 20} + +# get the folder id from the including page +set folder_id [$__including_page set parent_id] +set package_id [$folder_id set package_id] +set ::url_prefix [site_node::get_url_from_object_id -object_id $package_id] + +TableWidget t1 -volatile \ + -columns { + Field date -label "Modification Date" + AnchorField title -label [_ xowiki.page_title] + } + +set content "" +db_foreach get_pages \ + "select r.title, p.page_title, \ + to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as publish_date \ + from cr_items i, cr_revisions r, xowiki_page p \ + where i.parent_id = $folder_id \ + and r.revision_id = i.live_revision \ + and p.page_id = r.revision_id \ + order by r.publish_date desc limit $max_entries + " { + if {$page_title eq ""} {set page_title $title} + + t1 add \ + -title $page_title \ + -title.href "$page_title" \ + -date $publish_date + } + +set content [t1 asHTML] +set link ""