Index: openacs-4/packages/s5/s5.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/s5/s5.info,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/s5/s5.info 4 Sep 2007 11:41:20 -0000 1.2
+++ openacs-4/packages/s5/s5.info 13 Nov 2007 11:36:12 -0000 1.3
@@ -8,14 +8,14 @@
f
s5
-
+
Gustaf Neumann
2007-09-04
Gustaf Neumann
0
-
-
+
+
Index: openacs-4/packages/s5/tcl/s5-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/s5/tcl/s5-procs.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/s5/tcl/s5-procs.tcl 24 Sep 2007 12:06:32 -0000 1.3
+++ openacs-4/packages/s5/tcl/s5-procs.tcl 13 Nov 2007 11:36:12 -0000 1.4
@@ -135,7 +135,7 @@
set output [my slideshow_header \
-title [$page set title] \
-creator [$page set creator] \
- -footer [$page include_portlet "footer -decoration none"] \
+ -footer [$page include "footer -decoration none"] \
-s5dir "/resources/s5/$style/ui/default"]
if {$cnames ne ""} {
@@ -173,7 +173,7 @@
set menu [list]
foreach b $menu_buttons {
- set html [$p include_portlet $b]
+ set html [$p include $b]
if {$html ne ""} {lappend menu $html}
}
set menu "[join $menu { }]
"
Index: openacs-4/packages/xotcl-core/tcl/06-param-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/06-param-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/xotcl-core/tcl/06-param-procs.tcl 7 Nov 2007 09:04:09 -0000 1.5
+++ openacs-4/packages/xotcl-core/tcl/06-param-procs.tcl 13 Nov 2007 11:36:12 -0000 1.6
@@ -214,7 +214,6 @@
if {[$sc exists package_key]} {
set package_key [$sc package_key]
set success 1
- #my log "--p new package_key=$package_key"
}
}
if {!$success} break
Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.69 -r1.70
--- openacs-4/packages/xowiki/xowiki.info 2 Nov 2007 11:20:28 -0000 1.69
+++ openacs-4/packages/xowiki/xowiki.info 13 Nov 2007 11:36:11 -0000 1.70
@@ -8,7 +8,7 @@
f
xowiki
-
+
Gustaf Neumann
A more generic xotcl-based wikis example with object types
and subtypes based on the content repository (with category support)
@@ -54,12 +54,12 @@
BSD-Style
0
-
+
-
+
@@ -78,7 +78,7 @@
-
+
Index: openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 20 Sep 2007 12:12:10 -0000 1.12
+++ openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 13 Nov 2007 11:36:11 -0000 1.13
@@ -88,7 +88,7 @@
}
ADP_Generator instproc content_part {} {
- return "@top_portlets;noquote@\n@content;noquote@"
+ return "@top_includelets;noquote@\n@content;noquote@"
}
Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 13 Nov 2007 11:36:11 -0000 1.1
@@ -0,0 +1,2608 @@
+ad_library {
+ XoWiki - define various kind of includelets
+
+ @creation-date 2006-10-10
+ @author Gustaf Neumann
+ @cvs-id $Id: includelet-procs.tcl,v 1.1 2007/11/13 11:36:11 gustafn Exp $
+}
+namespace eval ::xowiki::includelet {
+ #
+ # Define a meta-class for creating Includelet classes.
+ # We use a meta-class for making it easier to define properties
+ # on classes of includelets, which can be used without instantiating
+ # it. One can for example use the query from the page fragment
+ # cache the caching properties of the class.
+ #
+ Class create ::xowiki::IncludeletClass \
+ -superclass ::xotcl::Class \
+ -parameter {
+ {localized true}
+ {personalized true}
+ {cacheable false}
+ {aggregating false}
+ }
+
+ # The general superclass for includelets
+
+ Class create ::xowiki::Includelet \
+ -superclass ::xo::Context \
+ -parameter {
+ {name ""}
+ {title ""}
+ {__decoration "portlet"}
+ {parameter_declaration {}}
+ {id}
+ }
+
+ ::xowiki::Includelet proc describe_includelets {includelet_classes} {
+ my log "--plc=$includelet_classes "
+ foreach cl $includelet_classes {
+ set result ""
+ append result "{{[namespace tail $cl]"
+ foreach p [$cl info parameter] {
+ if {[llength $p] != 2} continue
+ foreach {name value} $p break
+ if {$name eq "parameter_declaration"} {
+ foreach pp $value {
+ #append result ""
+ switch [llength $pp] {
+ 1 {append result " $pp"}
+ 2 {
+ set v [lindex $pp 1]
+ if {$v eq ""} {set v {""}}
+ append result " [lindex $pp 0] $v"
+ }
+ }
+ #append result "\n"
+ }
+ }
+ }
+ append result "}}\n"
+ my set html([namespace tail $cl]) $result
+ my describe_includelets [$cl info subclass]
+ }
+ }
+ ::xowiki::Includelet proc available_includelets {} {
+ if {[my array exists html]} {my array unset html}
+ my describe_includelets [::xowiki::Includelet info subclass]
+ set result ""
+ foreach d [lsort [my array names html]] {
+ append result "- " [my set html($d)] "
" \n
+ }
+ append result "
"
+ return $result
+ }
+
+ ::xowiki::Includelet instproc initialize {} {
+ # This method is called at a time after init and before render.
+ # It can be used to alter specified parameter from the user,
+ # or to influence the rendering of a decoration (e.g. title etc.)
+ }
+
+ ::xowiki::Includelet instproc js_name {} {
+ return [string map [list : _ # _] [self]]
+ }
+
+ ::xowiki::Includelet instproc self_id {} {
+ return [string map [list : _ # _] [self]]
+ }
+ ::xowiki::Includelet proc html_id {name} {
+ # Construct a valid HTML id or name.
+ # For details, see http://www.w3.org/TR/html4/types.html
+ #
+ # For XOTcl object names, strip first the colons
+ set name [string trimleft $name :]
+
+ # make sure, the ID starts with characters
+ if {![regexp {^[A-Za-z]} $name]} {
+ set name id_$name
+ }
+
+ # replace unwanted characters
+ regsub -all {[^A-Za-z0-9_:.-]} $name _ name
+ return $name
+ }
+
+ ::xowiki::Includelet proc detail_link {
+ {-absolute:boolean false}
+ -package_id
+ -name
+ -instance_attributes
+ } {
+ array set __ia $instance_attributes
+ if {[info exists __ia(detail_link)] && $__ia(detail_link) ne ""} {
+ set link $__ia(detail_link)
+ } else {
+ set link [::$package_id pretty_link $name]
+ }
+ return $link
+ }
+
+ ::xowiki::Includelet instproc screen_name {user_id} {
+ acs_user::get -user_id $user_id -array user
+ return [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
+ }
+
+ ::xowiki::Includelet proc incr_page_order {p} {
+ regexp {^(.*[.]?)([^.])$} $p _ prefix suffix
+ if {[string is integer -strict $suffix]} {
+ incr suffix
+ } elseif {[string is lower -strict $suffix]} {
+ regexp {^(.*)(.)$} $suffix _ before last
+ if {$last eq "z"} {
+ set last "aa"
+ } else {
+ set last [format %c [expr {[scan $last %c] + 1}]]
+ }
+ set suffix $before$last
+ } elseif {[string is upper -strict $suffix]} {
+ regexp {^(.*)(.)$} $suffix _ before last
+ if {$last eq "Z"} {
+ set last "AA"
+ } else {
+ set last [format %c [expr {[scan $last %c] + 1}]]
+ }
+ set suffix $before$last
+ }
+ return $prefix$suffix
+ }
+
+ ::xowiki::Includelet proc locale_clause {
+ -revisions
+ -items
+ package_id
+ locale
+ } {
+ set default_locale [$package_id default_locale]
+ set system_locale ""
+
+ set with_system_locale [regexp {(.*)[+]system} $locale _ locale]
+ if {$locale eq "default"} {
+ set locale $default_locale
+ set include_system_locale 0
+ }
+ #my msg "--L with_system_locale=$with_system_locale, locale=$locale, default_locale=$default_locale"
+
+ set locale_clause ""
+ if {$locale ne ""} {
+ set locale_clause " and $revisions.nls_language = '$locale'"
+ if {$with_system_locale} {
+ set system_locale [lang::system::locale -package_id $package_id]
+ #my msg "system_locale=$system_locale, default_locale=$default_locale"
+ if {$system_locale ne $default_locale} {
+ set locale_clause " and ($revisions.nls_language = '$locale'
+ or $revisions.nls_language = '$system_locale' and not exists
+ (select 1 from cr_items i where i.name = '[string range $locale 0 1]:' ||
+ substring($items.name,4) and i.parent_id = $items.parent_id))"
+ }
+ }
+ }
+
+ #my msg "--locale $locale, def=$default_locale sys=$system_locale, cl=$locale_clause locale_clause=$locale_clause"
+ return [list $locale $locale_clause]
+ }
+
+ ::xowiki::Includelet instproc category_clause {category_spec {item_ref p.item_id}} {
+ # the category_spec has the syntax "a,b,c|d,e", where the values are category_ids
+ # pipe symbols are or-operations, commas are and-operations;
+ # no parenthesis are permitted
+ set extra_where_clause ""
+ set or_names [list]
+ set ors [list]
+ foreach cid_or [split $category_spec |] {
+ set ands [list]
+ set and_names [list]
+ foreach cid_and [split $cid_or ,] {
+ lappend and_names [::category::get_name $cid_and]
+ lappend ands "exists (select 1 from category_object_map \
+ where object_id = p.item_id and category_id = $cid_and)"
+ }
+ lappend or_names "[join $and_names { and }]"
+ lappend ors "([join $ands { and }])"
+ }
+ set cnames "[join $or_names { or }]"
+ set extra_where_clause "and ([join $ors { or }])"
+ #my log "--cnames $category_spec -> $cnames"
+ return [list $cnames $extra_where_clause]
+ }
+
+ ::xowiki::Includelet instproc resolve_page_name {page_name} {
+ return [[my set __including_page] resolve_included_page_name $page_name]
+ }
+
+ ::xowiki::Includelet instproc get_page_order {-source -ordered_pages -pages} {
+ my instvar page_order pages ordered_pages
+ #
+ # first check, if we can load the page_order from the page
+ # denoted by source
+ #
+ if {[info exists source]} {
+ set p [my resolve_page_name $source]
+ if {$p ne ""} {
+ array set ia [$p set instance_attributes]
+ if {[info exists ia(pages)]} {
+ set pages $ia(pages)
+ } elseif {[info exists ia(ordered_pages)]} {
+ set ordered_pages $ia(ordered_pages)
+ }
+ }
+ }
+
+ # compute a list of ordered_pages from pages, if necessary
+ if {[info exists ordered_pages]} {
+ foreach {order page} $ordered_pages {set page_order($page) $order}
+ } else {
+ set i 0
+ foreach page $pages {set page_order($page) [incr i]}
+ }
+ }
+
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ ::xowiki::IncludeletClass create available-includelets \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "The following includelets can be used in a page"}
+ }
+
+ available-includelets instproc render {} {
+ my get_parameters
+ return [::xowiki::Includelet available_includelets]
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ # Page Fragment Cache
+ #
+ # The following mixin-class implements page fragment caching in the
+ # xowiki-cache. Caching can be turned on for every
+ # ::xowiki::IncludeletClass instance.
+ #
+ # Fragment caching depends in the class variables
+ # - cacheable (the mixin is only registered, when cacheable is set to true)
+ # - aggregating (requires flusing when items are added/edited/deleted)
+ # - localized (dependency on locale)
+ # - personalized (dependency on userid)
+ #
+ Class create ::xowiki::includelet::page_fragment_cache -instproc render {} {
+ set c [my info class]
+ #
+ # Construct a key based on the class parameters and the
+ # actual parameters
+ #
+ set key "PF-[my package_id]-"
+ append key [expr {[$c aggregating] ? "agg" : "ind"}]
+ append key "-$c [my set __caller_parameters]"
+ if {[$c localized]} {append key -[my locale]}
+ if {[$c personalized]} {append key -[::xo::cc user_id]}
+ return [ns_cache eval xowiki_cache $key next]
+ }
+}
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ # dotlrn style includelet decoration for includelets
+ #
+ Class create ::xowiki::includelet::decoration=portlet -instproc render {} {
+ my instvar package_id name title
+ set class [namespace tail [my info class]]
+ set id [expr {[my exists id] ? "id='[my id]'" : ""}]
+ set html [next]
+ set link [expr {[string match "*:*" $name] ?
+ "$title" :
+ $title}]
+ return [subst [[self class] set template]]
+ } -set template [expr {[apm_version_names_compare [ad_acs_version] 5.3.0] == 1 ?
+ {
+ } : {}
+ }]
+ Class create ::xowiki::includelet::decoration=plain -instproc render {} {
+ set class [namespace tail [my info class]]
+ set id [expr {[my exists id] ? "id='[my id]'" : ""}]
+ return "[next]
"
+ }
+
+ Class create ::xowiki::includelet::decoration=rightbox -instproc render {} {
+ set class [namespace tail [my info class]]
+ set id [expr {[my exists id] ? "id='[my id]'" : ""}]
+ return ""
+ }
+}
+
+namespace eval ::xowiki::includelet {
+
+ ::xowiki::IncludeletClass create get \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-variable}
+ {-form_variable}
+ {-source ""}
+ }}
+ } -instproc render {} {
+ my get_parameters
+ if {![info exists variable] && ![info exists form_variable]} {
+ return "either -variable or -form_variable must be specified"
+ }
+ set page [my resolve_page_name $source]
+
+ if {[info exists variable] && [$page exists $variable]} {
+ return [$page set $variable]
+ }
+ if {[info exists form_variable] && [$page exists instance_attributes]} {
+ array set __ia [$page set instance_attributes]
+ if {[info exists __ia($form_variable)]} {
+ return $__ia($form_variable)
+ }
+ }
+ if {[info exists variable]} {
+ return "no such variable $variable defined in page [$page set name]"
+ }
+ return "no such form_variable $form_variable defined in page [$page set name]"
+ }
+
+ ::xowiki::IncludeletClass create creation-date \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-source ""}
+ {-format "%m-%d-%Y"}
+ }}
+ } -instproc render {} {
+ my get_parameters
+ set page [my resolve_page_name $source]
+ set time [$page set creation_date]
+ regexp {^([^.]+)[.]} $time _ time
+ return [clock format [clock scan $time] -format $format]
+ }
+
+ #############################################################################
+ # rss button
+ #
+ ::xowiki::IncludeletClass create rss-button \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration plain}
+ {parameter_declaration {
+ {-span "10d"}
+ {-name_filter}
+ {-entries_of}
+ {-title}
+ }}
+ }
+
+ rss-button instproc render {} {
+ my get_parameters
+ set href [export_vars -base [$package_id package_url] {{rss $span} name_filter title entries_of}]
+ return ""
+ }
+
+ #############################################################################
+ # set-parameter "includelet"
+ #
+ ::xowiki::IncludeletClass create set-parameter \
+ -superclass ::xowiki::Includelet \
+ -parameter {{__decoration none}}
+
+ set-parameter instproc render {} {
+ my get_parameters
+ set pl [my set __caller_parameters]
+ if {[llength $pl] % 2 == 1} {
+ error "no even number of parameters '$pl'"
+ }
+ foreach {att value} $pl {
+ ::xo::cc set_parameter $att $value
+ }
+ return ""
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ # valid parameters for he categories includelet are
+ # tree_name: match pattern, if specified displays only the trees
+ # with matching names
+ # no_tree_name: if specified, tree names are not displayed
+ # open_page: name (e.g. en:iMacs) of the page to be opened initially
+ # tree_style: boolean, default: true, display based on mktree
+
+ ::xowiki::IncludeletClass create categories \
+ -superclass ::xowiki::Includelet \
+ -cacheable true -personalized false -aggregating true \
+ -parameter {
+ {title "Categories"}
+ {parameter_declaration {
+ {-tree_name ""}
+ {-tree_style:boolean 1}
+ {-no_tree_name:boolean 0}
+ {-count:boolean 0}
+ {-summary:boolean 0}
+ {-locale ""}
+ {-open_page ""}
+ {-order_items_by "title,asc"}
+ {-category_ids ""}
+ {-except_category_ids ""}
+ }}
+ }
+
+
+ categories instproc render {} {
+ my get_parameters
+
+ set content ""
+ set folder_id [$package_id folder_id]
+ set open_item_id [expr {$open_page ne "" ?
+ [::xo::db::CrClass lookup -name $open_page -parent_id $folder_id] : 0}]
+
+ foreach {locale locale_clause} \
+ [::xowiki::Includelet locale_clause -revisions r -items ci $package_id $locale] break
+
+ set have_locale [expr {[lsearch [info args category_tree::get_mapped_trees] locale] > -1}]
+ set trees [expr {$have_locale ?
+ [category_tree::get_mapped_trees $package_id $locale] :
+ [category_tree::get_mapped_trees $package_id]}]
+ foreach tree $trees {
+ foreach {tree_id my_tree_name ...} $tree {break}
+ if {$tree_name ne "" && ![string match $tree_name $my_tree_name]} continue
+ if {!$no_tree_name} {
+ append content "$my_tree_name
"
+ }
+ set categories [list]
+ set pos 0
+ set cattree(0) [::xowiki::CatTree new -volatile -orderby pos -name $my_tree_name]
+ set category_infos [expr {$have_locale ?
+ [category_tree::get_tree $tree_id $locale] :
+ [category_tree::get_tree $tree_id]}]
+
+ foreach category_info $category_infos {
+ foreach {cid category_label deprecated_p level} $category_info {break}
+
+ set c [::xowiki::Category new -orderby pos -category_id $cid -package_id $package_id \
+ -level $level -label $category_label -pos [incr pos]]
+ set cattree($level) $c
+ set plevel [expr {$level -1}]
+ $cattree($plevel) add $c
+ set category($cid) $c
+ lappend categories $cid
+ }
+
+ set sql "category_object_map c, cr_items ci, cr_revisions r, xowiki_page p \
+ where c.object_id = ci.item_id and ci.parent_id = $folder_id \
+ and ci.content_type not in ('::xowiki::PageTemplate') \
+ and category_id in ([join $categories ,]) \
+ and r.revision_id = ci.live_revision \
+ and p.page_id = r.revision_id \
+ and ci.publish_status <> 'production'"
+
+ if {$except_category_ids ne ""} {
+ append sql \
+ " and not exists (select * from category_object_map c2 \
+ where ci.item_id = c2.object_id \
+ and c2.category_id in ($except_category_ids))"
+ }
+ #ns_log notice "--c category_ids=$category_ids"
+ if {$category_ids ne ""} {
+ foreach cid [split $category_ids ,] {
+ append sql " and exists (select * from category_object_map \
+ where object_id = ci.item_id and category_id = $cid)"
+ }
+ }
+ append sql $locale_clause
+
+ if {$count} {
+ db_foreach [my qn get_counts] \
+ "select count(*) as nr,category_id from $sql group by category_id" {
+ $category($category_id) set count $nr
+ set s [expr {$summary ? "&summary=$summary" : ""}]
+ $category($category_id) href [ad_conn url]?category_id=$category_id$s
+ $category($category_id) open_tree
+ }
+ append content [$cattree(0) render -tree_style $tree_style]
+ } else {
+ foreach {orderby direction} [split $order_items_by ,] break ;# e.g. "title,asc"
+ set increasing [expr {$direction ne "desc"}]
+
+ #
+ # If we have ltree, we query the order_column from the database,
+ # otherwise we don't retrieve it, but set the Tcl variable page_order empty.
+ #
+ if {[::xo::db::has_ltree]} {
+ set order_column ", p.page_order"
+ } else {
+ set order_column ""
+ set page_order ""
+ }
+
+ db_foreach [my qn get_pages] \
+ "select ci.item_id, ci.name, ci.content_type, r.title, category_id $order_column from $sql" {
+ if {$title eq ""} {set title $name}
+ set itemobj [Object new]
+ set prefix ""
+ set suffix ""
+ foreach var {name title prefix suffix page_order} {$itemobj set $var [set $var]}
+
+ $cattree(0) add_to_category \
+ -category $category($category_id) \
+ -itemobj $itemobj \
+ -orderby $orderby \
+ -increasing $increasing \
+ -open_item [expr {$item_id == $open_item_id}]
+ }
+ append content [$cattree(0) render -tree_style $tree_style]
+ }
+ }
+ return $content
+ }
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # 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
+
+ ::xowiki::IncludeletClass create categories-recent \
+ -superclass ::xowiki::Includelet \
+ -cacheable true -personalized false -aggregating true \
+ -parameter {
+ {title "Recently Changed Pages by Categories"}
+ {parameter_declaration {
+ {-max_entries:integer 10}
+ {-tree_name ""}
+ {-locale ""}
+ }}
+ }
+
+ categories-recent instproc render {} {
+ my get_parameters
+
+ set cattree [::xowiki::CatTree new -volatile -name "categories-recent"]
+
+ foreach {locale locale_clause} \
+ [::xowiki::Includelet locale_clause -revisions r -items ci $package_id $locale] break
+
+ set have_locale [expr {[lsearch [info args category_tree::get_mapped_trees] locale] > -1}]
+ set trees [expr {$have_locale ?
+ [category_tree::get_mapped_trees $package_id $locale] :
+ [category_tree::get_mapped_trees $package_id]}]
+
+ foreach tree $trees {
+ foreach {tree_id my_tree_name ...} $tree {break}
+ if {$tree_name ne "" && ![string match $tree_name $my_tree_name]} continue
+ lappend tree_ids $tree_id
+ }
+ if {[info exists tree_ids]} {
+ set tree_select_clause "and c.tree_id in ([join $tree_ids ,])"
+ } else {
+ set tree_select_clause ""
+ }
+ set sql [::xo::db::sql select \
+ -vars "c.category_id, ci.name, 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 = [$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]
+ db_foreach [my qn get_pages] $sql {
+ if {$title eq ""} {set title $name}
+ set itemobj [Object new]
+ set prefix "$formatted_date "
+ set suffix ""
+ foreach var {name title prefix suffix} {$itemobj set $var [set $var]}
+ if {![info exists categories($category_id)]} {
+ set categories($category_id) [::xowiki::Category new \
+ -package_id $package_id \
+ -label [category::get_name $category_id $locale]\
+ -level 1]
+ $cattree add $categories($category_id)
+ }
+ $cattree add_to_category -category $categories($category_id) -itemobj $itemobj
+ }
+ return [$cattree render]
+ }
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # display recent entries
+ #
+
+ ::xowiki::IncludeletClass create recent \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Recently Changed Pages"}
+ {parameter_declaration {
+ {-max_entries:integer 10}
+ {-allow_edit:boolean false}
+ {-allow_delete:boolean false}
+ }}
+ }
+
+ recent instproc render {} {
+ my get_parameters
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+ TableWidget t1 -volatile \
+ -set allow_edit $allow_edit \
+ -set allow_delete $allow_delete \
+ -columns {
+ Field date -label "Modification Date"
+ if {[[my info parent] set allow_edit]} {
+ ImageField_EditIcon edit -label "" -html {style "padding-right: 2px;"}
+ }
+ AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
+ if {[[my info parent] set allow_delete]} {
+ ImageField_DeleteIcon delete -label ""
+ }
+ }
+
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "i.name, r.title, p.page_id, r.publish_date, \
+ to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as formatted_date" \
+ -from "cr_items i, cr_revisions r, xowiki_page p" \
+ -where "i.parent_id = [$package_id folder_id] \
+ and r.revision_id = i.live_revision \
+ and p.page_id = r.revision_id \
+ and i.publish_status <> 'production'" \
+ -orderby "publish_date desc" \
+ -limit $max_entries ] {
+
+ t1 add \
+ -title $title \
+ -title.href [$package_id pretty_link $name] \
+ -date $formatted_date
+
+ if {$allow_edit} {
+ #set page_link [$package_id pretty_link $name]
+ #set edit_link [$package_id make_link $page_link edit return_url]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
+ $p destroy_on_cleanup
+ set page_link [$package_id pretty_link $name]
+ set edit_link [$package_id make_link -link $page_link $p edit return_url]
+ my log "page_link=$page_link, edit=$edit_link"
+ [t1 last_child] set edit.href $edit_link
+ }
+ if {$allow_delete} {
+ if {![info exists p]} {
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
+ $p destroy_on_cleanup
+ }
+ set page_link [$package_id pretty_link $name]
+ set delete_link [$package_id make_link -link $page_link $p delete return_url]
+ [t1 last_child] set delete.href $delete_link
+ }
+ }
+ return [t1 asHTML]
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # display last visited entries
+ #
+
+ ::xowiki::IncludeletClass create last-visited \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Last Visited Pages"}
+ {parameter_declaration {
+ {-max_entries:integer 20}
+ }}
+ }
+
+ last-visited instproc render {} {
+ my get_parameters
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+
+ TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
+ }
+
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "r.title,i.name, to_char(time,'YYYY-MM-DD HH24:MI:SS') as visited_date" \
+ -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" \
+ -where "x.page_id = i.item_id and i.live_revision = p.page_id \
+ and r.revision_id = p.page_id and x.user_id = [::xo::cc user_id] \
+ and x.package_id = $package_id and i.publish_status <> 'production'" \
+ -orderby "visited_date desc" \
+ -limit $max_entries] \
+ {
+ t1 add \
+ -title $title \
+ -title.href [$package_id pretty_link $name]
+ }
+ return [t1 asHTML]
+ }
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # list the most popular pages
+ #
+
+ ::xowiki::IncludeletClass create most-popular \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Most Popular Pages"}
+ {parameter_declaration {
+ {-max_entries:integer "10"}
+ {-interval}
+ }}
+ }
+
+ most-popular instproc render {} {
+ my 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.
+ #
+ my append title " in last $interval"
+
+ TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
+ Field users -label Visitors -html { align right }
+ }
+ set since_condition "and [::xo::db::sql since_interval_condition time $interval]"
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "count(x.user_id) as nr_different_users, x.page_id, r.title,i.name" \
+ -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" \
+ -where "x.page_id = i.item_id and i.live_revision = p.page_id and r.revision_id = p.page_id \
+ and x.package_id = $package_id and i.publish_status <> 'production' \
+ $since_condition" \
+ -groupby "x.page_id, r.title, i.name" \
+ -orderby "nr_different_users desc" \
+ -limit $max_entries ] {
+ t1 add \
+ -title $title \
+ -title.href [$package_id pretty_link $name] \
+ -users $nr_different_users
+ }
+ } else {
+
+ TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
+ Field count -label Visits -html { align right }
+ Field users -label Visitors -html { align right }
+ }
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "sum(x.count) as sum, count(x.user_id) as nr_different_users, x.page_id, r.title,i.name" \
+ -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" \
+ -where "x.page_id = i.item_id and i.live_revision = p.page_id and r.revision_id = p.page_id \
+ and x.package_id = $package_id and i.publish_status <> 'production'" \
+ -groupby "x.page_id, r.title, i.name" \
+ -orderby "sum desc" \
+ -limit $max_entries] {
+ t1 add \
+ -title $title \
+ -title.href [$package_id pretty_link $name] \
+ -users $nr_different_users \
+ -count $sum
+ }
+ }
+ return [t1 asHTML]
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # list the most frequent visitors
+ #
+
+ ::xowiki::IncludeletClass create rss-client \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "RSS client"}
+ {parameter_declaration {
+ {-url:required}
+ {-max_entries:integer "15"}
+ }}
+ }
+
+ rss-client instproc initialize {} {
+ my instvar feed
+ my get_parameters
+ my set feed [::xowiki::RSS-client new -url $url -destroy_on_cleanup]
+ my title [ [$feed channel] title]
+ }
+
+ rss-client instproc render {} {
+ my instvar feed
+ my get_parameters
+ set channel [$feed channel]
+ #set html "[$channel title]
"
+ set html "\n"
+ set i 0
+ foreach item [ $feed items ] {
+ #my msg "[$item title]"
+ append html "- [$item title]
[$item description] #xowiki.weblog-more#\n"
+ if {[incr i] >= $max_entries} break
+ }
+ append html "
\n"
+ return $html
+ }
+
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # list the most frequent visitors
+ #
+
+ ::xowiki::IncludeletClass create most-frequent-visitors \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Most Frequent Visitors"}
+ {parameter_declaration {
+ {-max_entries:integer "15"}
+ }}
+ }
+
+ most-frequent-visitors instproc render {} {
+ my get_parameters
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+
+ TableWidget t1 -volatile \
+ -columns {
+ Field user -label Visitors -html { align right }
+ Field count -label Visits -html { align right }
+ }
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "sum(count) as sum, user_id" \
+ -from "xowiki_last_visited" \
+ -where "package_id = $package_id" \
+ -groupby "user_id" \
+ -orderby "sum desc" \
+ -limit $max_entries] {
+ t1 add \
+ -user [::xo::get_user_name $user_id] \
+ -count $sum
+ }
+ return [t1 asHTML]
+ }
+
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # Display unread items
+ #
+ # Currently moderately useful
+ #
+ # TODO: display of unread *revisions* should be included optionally, one has to
+ # consider what to do with auto-created stuff (put it into 'production' state?)
+ #
+
+ ::xowiki::IncludeletClass create unread-items \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Unread Items"}
+ {parameter_declaration {
+ {-max_entries:integer 20}
+ }}
+ }
+
+ unread-items instproc render {} {
+ my get_parameters
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+
+ TableWidget t1 -volatile \
+ -columns {
+ AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
+ }
+
+ set or_clause "or i.item_id in (select x.page_id from xowiki_last_visited x, acs_objects o \
+ where x.time < o.last_modified and x.page_id = o.object_id and x.package_id = $package_id)
+"
+
+ db_foreach [my qn get_pages] \
+ [::xo::db::sql select \
+ -vars "a.title, i.name" \
+ -from "xowiki_page p, cr_items i, acs_objects a " \
+ -where "(i.item_id not in (select x.page_id from xowiki_last_visited x
+ where x.user_id = [::xo::cc user_id] and x.package_id = $package_id)
+ $or_clause
+ )
+ and i.live_revision = p.page_id
+ and i.parent_id = [$package_id folder_id]
+ and i.publish_status <> 'production'
+ and a.object_id = i.item_id" \
+ -orderby "a.creation_date desc" \
+ -limit $max_entries] \
+ {
+ t1 add \
+ -title $title \
+ -title.href [$package_id pretty_link $name]
+ }
+ return [t1 asHTML]
+ }
+}
+
+
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ #
+ # Show the tags
+ #
+
+ ::xowiki::IncludeletClass create tags \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {title "Tags"}
+ {parameter_declaration {
+ {-limit:integer 20}
+ {-summary:boolean 0}
+ {-popular:boolean 0}
+ {-page}
+ }}
+ }
+
+ tags instproc render {} {
+ my get_parameters
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+
+ if {$popular} {
+ set label [_ xowiki.popular_tags_label]
+ set tag_type ptag
+ set sql [::xo::db::sql select \
+ -vars "count(*) as nr,tag" \
+ -from xowiki_tags \
+ -where "package_id=$package_id" \
+ -groupby tag \
+ -orderby tag \
+ -limit $limit]
+ } else {
+ set label [_ xowiki.your_tags_label]
+ set tag_type tag
+ set sql "select count(*) as nr,tag from xowiki_tags where \
+ user_id=[::xo::cc user_id] and package_id=$package_id group by tag order by tag"
+ }
+ set entries [list]
+
+ if {![info exists page]} {set page [$package_id get_parameter weblog_page]}
+ set base_url [$package_id pretty_link $page]
+
+ db_foreach [my qn get_counts] $sql {
+ set s [expr {$summary ? "&summary=$summary" : ""}]
+ set href $base_url?$tag_type=[ad_urlencode $tag]$s
+ lappend entries "$tag ($nr)"
+ }
+ return [expr {[llength $entries] > 0 ?
+ "$label
[join $entries {, }]
\n" :
+ ""}]
+ }
+
+ ::xowiki::IncludeletClass create my-tags \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-summary 1}
+ }}
+ id
+ }
+
+ my-tags instproc render {} {
+ my get_parameters
+ my instvar __including_page tags
+ ::xo::Page requireJS "/resources/xowiki/get-http-object.js"
+
+ set p_link [$package_id pretty_link [$__including_page name]]
+ set return_url "[::xo::cc url]?[::xo::cc actual_query]"
+ set weblog_page [$package_id get_parameter weblog_page weblog]
+ set save_tag_link [$package_id make_link -link $p_link $__including_page \
+ save-tags return_url]
+ set popular_tags_link [$package_id make_link -link $p_link $__including_page \
+ popular-tags return_url weblog_page]
+
+ set tags [lsort [::xowiki::Page get_tags -user_id [::xo::cc user_id] \
+ -item_id [$__including_page item_id] -package_id $package_id]]
+ set href [$package_id package_url]$weblog_page?summary=$summary
+
+ set entries [list]
+ foreach tag $tags {lappend entries "$tag"}
+ set tags_with_links [join [lsort $entries] {, }]
+
+ if {![my exists id]} {my set id [::xowiki::Includelet html_id [self]]}
+ set content [subst -nobackslashes {
+ #xowiki.your_tags_label#: $tags_with_links
+ (#xowiki.edit_link#,
+ #xowiki.popular_tags_link#)
+
+
+
+
+ }]
+ return $content
+ }
+
+
+ ::xowiki::IncludeletClass create my-categories \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-summary 1}
+ }}
+ }
+
+ my-categories instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set content ""
+
+ set weblog_page [$package_id get_parameter weblog_page weblog]
+ set entries [list]
+ set href [$package_id package_url]$weblog_page?summary=$summary
+ set notification_type ""
+ if {[$package_id get_parameter "with_notifications" 1] &&
+ [::xo::cc user_id] != 0} { ;# notifications require login
+ set notification_type [notification::type::get_type_id -short_name xowiki_notif]
+ }
+ if {[$package_id exists_query_parameter return_url]} {
+ set return_url [$package_id query_parameter return_url]
+ }
+ foreach cat_id [category::get_mapped_categories [$__including_page set item_id]] {
+ foreach {category_id category_name tree_id tree_name} [category::get_data $cat_id] break
+ #my log "--cat $cat_id $category_id $category_name $tree_id $tree_name"
+ set entry "$category_name ($tree_name)"
+ if {$notification_type ne ""} {
+ set notification_text "Subscribe category $category_name in tree $tree_name"
+ set notifications_return_url [expr {[info exists return_url] ? $return_url : [ad_return_url]}]
+ set notification_image \
+ ""
+
+ set cat_notif_link [export_vars -base /notifications/request-new \
+ {{return_url $notifications_return_url} \
+ {pretty_name $notification_text} \
+ {type_id $notification_type} \
+ {object_id $category_id}}]
+ append entry " " \
+ ""
+
+ }
+ lappend entries $entry
+ }
+ if {[llength $entries]>0} {
+ set content "Categories: [join $entries {, }]"
+ }
+ return $content
+ }
+
+ ::xowiki::IncludeletClass create my-general-comments \
+ -superclass ::xowiki::Includelet \
+ -parameter {{__decoration none}}
+
+ my-general-comments instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set item_id [$__including_page item_id]
+ set gc_return_url [$package_id url]
+ set gc_link [general_comments_create_link \
+ -object_name [$__including_page title] \
+ $item_id $gc_return_url]
+ set gc_comments [general_comments_get_comments $item_id $gc_return_url]
+ if {$gc_comments ne ""} {
+ return "#general-comments.Comments#
$gc_link
"
+ } else {
+ return "#general-comments.lt_No_comments_available#
$gc_link
"
+ }
+ }
+
+ ::xowiki::IncludeletClass create digg \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-description ""}
+ {-url}
+ }}
+ }
+
+ digg instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set digg_link [export_vars -base "http://digg.com/submit" {
+ {phase 2}
+ {url $url}
+ {title "[string range [$__including_page title] 0 74]"}
+ {body_text "[string range $description 0 349]"}
+ }]
+ return ""
+ }
+
+ ::xowiki::IncludeletClass create delicious \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-description ""}
+ {-tags ""}
+ {-url}
+ }}
+ }
+
+ delicious instproc render {} {
+ my get_parameters
+ my instvar __including_page
+
+ # the following opens a window, where a user can edit the posted info.
+ # however, it seems not possible to add tags this way automatically.
+ # Alternatively, one could use the api as descibed below; this allows
+ # tags, but no editing...
+ # http://farm.tucows.com/blog/_archives/2005/3/24/462869.html#adding
+
+ set delicious_link [export_vars -base "http://del.icio.us/post" {
+ {v 4}
+ {url $url}
+ {title "[string range [$__including_page title] 0 79]"}
+ {notes "[string range $description 0 199]"}
+ tags
+ }]
+ return "del.icio.us"
+ }
+
+
+ ::xowiki::IncludeletClass create my-yahoo-publisher \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-publisher ""}
+ {-rssurl}
+ }}
+ }
+
+ my-yahoo-publisher instproc render {} {
+ my get_parameters
+ my instvar __including_page
+
+ set publisher [ad_urlencode $publisher]
+ set feedname [ad_urlencode [[$package_id folder_id] title]]
+ set rssurl [ad_urlencode $rssurl]
+ set my_yahoo_link "http://us.rd.yahoo.com/my/atm/$publisher/$feedname/*http://add.my.yahoo.com/rss?url=$rssurl"
+
+ return ""
+ }
+
+ ::xowiki::IncludeletClass create my-references \
+ -superclass ::xowiki::Includelet \
+ -parameter {{__decoration none}}
+
+ my-references instproc render {} {
+ my get_parameters
+ my instvar __including_page
+
+ set item_id [$__including_page item_id]
+ set refs [list]
+ db_foreach [my qn get_references] "SELECT page,ci.name,f.package_id \
+ from xowiki_references,cr_items ci,cr_folders f \
+ where reference=$item_id and ci.item_id = page and ci.parent_id = f.folder_id" {
+ ::xowiki::Package require $package_id
+ lappend refs "$name"
+ }
+ set references [join $refs ", "]
+
+ array set lang {found "" undefined ""}
+ foreach i [$__including_page array names lang_links] {
+ set lang($i) [join [$__including_page set lang_links($i)] ", "]
+ }
+ append references " " $lang(found)
+ set result ""
+ if {$references ne " "} {
+ append result "#xowiki.references_label# $references"
+ }
+ if {$lang(undefined) ne ""} {
+ append result "#xowiki.create_this_page_in_language# $lang(undefined)"
+ }
+ return $result
+ }
+
+}
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ # presence
+ #
+ ::xowiki::IncludeletClass create presence \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration rightbox}
+ {parameter_declaration {
+ {-interval "10 minutes"}
+ {-max_users:integer 40}
+ {-show_anonymous "summary"}
+ {-page}
+ }}
+ }
+
+ # TODO make display style -decoration
+
+ presence instproc render {} {
+ my get_parameters
+
+ set summary 0
+ if {[::xo::cc user_id] == 0} {
+ switch -- $show_anonymous {
+ nothing {return ""}
+ all {set summary 0}
+ default {set summary 1}
+ }
+ }
+
+ if {[info exists page] && $page eq "this"} {
+ my instvar __including_page
+ set extra_where_clause "and page_id = [$__including_page item_id] "
+ set what " on page [$__including_page title]"
+ } else {
+ set extra_where_clause ""
+ set what " in community [$package_id instance_name]"
+ }
+
+ if {!$summary} {
+ set select_users "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time from xowiki_last_visited "
+ }
+ set since_condition [::xo::db::sql since_interval_condition time $interval]
+ set where_clause "package_id=$package_id and $since_condition $extra_where_clause"
+ set when "
in last $interval"
+
+ set output ""
+
+ if {$summary} {
+ set count [db_string [my qn presence_count_users] \
+ "select count(distinct user_id) from xowiki_last_visited WHERE $where_clause"]
+ } else {
+ set values [db_list_of_lists [my qn get_users] \
+ [::xo::db::sql select \
+ -vars "user_id, to_char(max(time),'YYYY-MM-DD HH24:MI:SS') as max_time" \
+ -from xowiki_last_visited \
+ -where $where_clause \
+ -groupby user_id \
+ -orderby "max_time desc" \
+ -limit $max_users ]]
+ set count [llength $values]
+ if {$count == $max_users} {
+ # we have to check, whether there were more users...
+ set count [db_string [my qn presence_count_users] "$select_count $where_clause"]
+ }
+ foreach value $values {
+ foreach {user_id time} $value break
+ set seen($user_id) $time
+
+ regexp {^([^.]+)[.]} $time _ time
+ set pretty_time [util::age_pretty -timestamp_ansi $time \
+ -sysdate_ansi [clock_to_ansi [clock seconds]] \
+ -mode_3_fmt "%d %b %Y, at %X"]
+ set name [::xo::get_user_name $user_id]
+
+ append output "$name | $pretty_time |
\n"
+ }
+ if {$output ne ""} {set output "\n"}
+ }
+ set users [expr {$count == 0 ? "No registered users" :
+ $count == 1 ? "1 registered user" :
+ "$count registered users"}]
+ return "$users$what$when
$output"
+ }
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ # includelets based on order
+ #
+ ::xowiki::IncludeletClass create toc \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration plain}
+ {parameter_declaration {
+ {-style ""}
+ {-open_page ""}
+ {-book_mode false}
+ {-ajax true}
+ {-expand_all false}
+ {-remove_levels 0}
+ {-category_id}
+ {-locale ""}
+ {-source ""}
+ }}
+ id
+ }
+
+#"select page_id, page_order, name, title, \
+# (select count(*)-1 from xowiki_page_live_revision where page_order <@ p.page_order) as count \
+# from xowiki_page_live_revision p where not page_order is NULL order by page_order asc"
+
+ toc instproc count {} {return [my set navigation(count)]}
+ toc instproc current {} {return [my set navigation(current)]}
+ toc instproc position {} {return [my set navigation(position)]}
+ toc instproc page_name {p} {return [my set page_name($p)]}
+
+ toc proc anchor {name} {
+ # try to strip the language prefix from the name
+ regexp {^.*:([^:]+)$} $name _ name
+ # anchor is used between single quotes
+ regsub -all ' $name {\'} anchor
+ return $anchor
+ }
+
+ toc instproc get_nodes {open_page package_id expand_all remove_levels locale source} {
+ my instvar navigation page_name book_mode
+ array set navigation {parent "" position 0 current ""}
+
+ set js ""
+ set node() root
+ set node_cnt 0
+
+ set extra_where_clause ""
+ if {[my exists category_id]} {
+ foreach {cnames extra_where_clause} [my category_clause [my set category_id]] break
+ }
+ foreach {locale locale_clause} \
+ [::xowiki::Includelet locale_clause -revisions p -items p $package_id $locale] break
+ #my msg locale_clause=$locale_clause
+
+ if {$source ne ""} {
+ my get_page_order -source $source
+ set page_names ('[join [my array names page_order] ',']')
+ set page_order_clause "and name in $page_names"
+ set page_order_att ""
+ } else {
+ set page_order_clause "and not page_order is NULL"
+ set page_order_att "page_order,"
+ }
+
+ set sql [::xo::db::sql select \
+ -vars "page_id, $page_order_att name, title" \
+ -from "xowiki_page_live_revision p" \
+ -where "parent_id=[$package_id folder_id] \
+ $page_order_clause \
+ $extra_where_clause $locale_clause"]
+ set pages [::xowiki::Page instantiate_objects -sql $sql]
+
+ if {$source ne ""} {
+ # add the page_order to the objects
+ foreach p [$pages children] {
+ $p set page_order [my set page_order([$p set name])]
+ }
+ }
+
+ $pages mixin add ::xo::OrderedComposite::IndexCompare
+ $pages orderby page_order
+
+ my set jsobjs ""
+ #my log "--book read [llength [$pages children]] pages"
+
+ foreach o [$pages children] {
+ $o instvar page_order title page_id name title
+
+ #my log "o: $page_order"
+ set displayed_page_order $page_order
+ for {set i 0} {$i < $remove_levels} {incr i} {
+ regsub {^[^.]+[.]} $displayed_page_order "" displayed_page_order
+ }
+ set label "$displayed_page_order $title"
+ set id tmpNode[incr node_cnt]
+ set node($page_order) $id
+ set jsobj [my js_name].objs\[$node_cnt\]
+
+ set page_name($node_cnt) $name
+ if {![regexp {^(.*)[.]([^.]+)} $page_order _ parent]} {set parent ""}
+
+ if {$book_mode} {
+ set href [$package_id url]#[toc anchor $name]
+ } else {
+ set href [$package_id pretty_link $name]
+ }
+
+ if {$expand_all} {
+ set expand "true"
+ } else {
+ set expand [expr {$open_page eq $name} ? "true" : "false"]
+ if {$expand} {
+ set navigation(parent) $parent
+ set navigation(position) $node_cnt
+ set navigation(current) $page_order
+ for {set p $parent} {$p ne ""} {} {
+ if {![info exists node($p)]} break
+ append js "$node($p).expand();\n"
+ if {![regexp {^(.*)[.]([^.]+)} $p _ p]} {set p ""}
+ }
+ }
+ }
+ set parent_node [expr {[info exists node($parent)] ? $node($parent) : "root"}]
+ set refvar [expr {[my set ajax] ? "ref" : "href"}]
+ regsub -all {\"} $label {\"} label
+ #my log "$jsobj = {label: \"$label\", id: \"$id\", $refvar: \"$href\", c: $node_cnt};"
+ append js \
+ "$jsobj = {label: \"$label\", id: \"$id\", $refvar: \"$href\", c: $node_cnt};" \
+ "var $node($page_order) = new YAHOO.widget.TextNode($jsobj, $parent_node, $expand);\n" \
+ ""
+ my lappend jsobjs $jsobj
+
+ }
+ set navigation(count) $node_cnt
+ #my log "--COUNT=$node_cnt"
+ return $js
+ }
+
+ toc instproc ajax_tree {js_tree_cmds} {
+ return "
+
+
"
+ }
+
+ toc instproc tree {js_tree_cmds} {
+ return "
+
+
"
+ }
+
+
+ toc instproc render {} {
+ my get_parameters
+
+ switch -- $style {
+ "menu" {set s "menu/"}
+ "folders" {set s "folders/"}
+ "default" {set s ""}
+ }
+ ::xo::Page requireCSS "/resources/ajaxhelper/yui/treeview/assets/${s}tree.css"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/event/event.js"
+ if {$ajax} {
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/dom/dom.js" ;# ANIM
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/connection/connection.js"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/animation/animation.js" ;# ANIM
+ }
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/treeview/treeview.js"
+
+ my set book_mode $book_mode
+ if {!$book_mode} {
+ ###### my set book_mode [[my set __including_page] exists __is_book_page]
+ } elseif $ajax {
+ #my log "--warn: cannot use bookmode with ajax, resetting ajax"
+ set ajax 0
+ }
+ my set ajax $ajax
+ if {![my exists id]} {my set id [::xowiki::Includelet html_id [self]]}
+ if {[info exists category_id]} {my set category_id $category_id}
+
+ set js_tree_cmds [my get_nodes $open_page $package_id $expand_all \
+ $remove_levels $locale $source]
+ return [expr {$ajax ? [my ajax_tree $js_tree_cmds ] : [my tree $js_tree_cmds ]}]
+ }
+
+ #############################################################################
+ # Selection
+ #
+ # TODO: base book (and toc) on selection
+ ::xowiki::IncludeletClass create selection \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration plain}
+ {parameter_declaration {
+ {-edit_links:boolean true}
+ {-pages ""}
+ {-ordered_pages ""}
+ {-source}
+ {-menu_buttons edit}
+ }}
+ }
+
+ selection instproc render {} {
+ my instvar page_order
+ my get_parameters
+ my set package_id $package_id
+ my set edit_links $edit_links
+
+ if {[info exists source]} {
+ my get_page_order -source $source
+ } else {
+ my get_page_order -pages $pags -ordered_pages $ordered_pages
+ }
+
+ # should check for quotes in names
+ set page_names ('[join [array names page_order] ',']')
+ set pages [::xowiki::Page instantiate_objects -sql \
+ "select page_id, name, title, item_id \
+ from xowiki_page_live_revision p \
+ where parent_id = [$package_id folder_id] \
+ and name in $page_names \
+ [::xowiki::Page container_already_rendered item_id]" ]
+ foreach p [$pages children] {
+ $p set page_order $page_order([$p set name])
+ }
+
+ $pages mixin add ::xo::OrderedComposite::IndexCompare
+ $pages orderby page_order
+ return [my render_children $pages $menu_buttons]
+ }
+
+ selection instproc render_children {pages menu_buttons} {
+ my instvar package_id edit_links
+ foreach o [$pages children] {
+ $o instvar page_order title page_id name title
+ set level [expr {[regsub {[.]} $page_order . page_order] + 1}]
+ set edit_markup ""
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
+ $p destroy_on_cleanup
+ $p set unresolved_references 0
+
+ switch [$p info class] {
+ ::xowiki::Form {
+ set content [$p render]
+ }
+ default {
+ set content [$p get_content]
+ set content [string map [list "\{\{" "\\\{\{"] $content]
+ }
+ }
+
+ set menu [list]
+ foreach b $menu_buttons {
+ if {[info command ::xowiki::includelet::$b] eq ""} {
+ set b $b-item-button
+ }
+ set html [$p include [list $b -book_mode true]]
+ if {$html ne ""} {lappend menu $html}
+ }
+ append output "" \
+ "" [join $menu " "] "
" \
+ "$page_order $title" \
+ $content
+ }
+ return $output
+ }
+
+ ::xowiki::IncludeletClass create composite-form \
+ -superclass ::xowiki::includelet::selection \
+ -parameter {
+ {parameter_declaration {
+ {-edit_links:boolean false}
+ {-pages ""}
+ {-ordered_pages}
+ }}
+ }
+
+ composite-form instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set inner_html [next]
+ #my log "innerhtml=$inner_html"
+ regsub -nocase -all " doc
+ $doc documentElement root
+
+ set fields [$root selectNodes "//div\[@class = 'wiki-menu'\]"]
+ foreach field $fields {$field delete}
+
+ set inner_html [$root asHTML]
+ set id ID[$__including_page item_id]
+ set base [$package_id pretty_link [$__including_page name]]
+ #set id ID$item_id
+ #$root setAttribute id $id
+ set as_att_value [string map [list & "&" < "<" > ">" \" """ ' "'"] $inner_html]
+
+ set save_form [subst {
+
+ Create Form from Content
+
+
+ Form Name:
+
+
+ }]
+
+ return $inner_html$save_form
+ }
+
+ #############################################################################
+ # book style
+ #
+ ::xowiki::IncludeletClass create book \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration plain}
+ {parameter_declaration {
+ {-category_id}
+ {-menu_buttons edit}
+ {-locale ""}
+ }}
+ }
+
+ book instproc render {} {
+ my get_parameters
+
+ my instvar __including_page
+ lappend ::xowiki_page_item_id_rendered [$__including_page item_id]
+ $__including_page set __is_book_page 1
+
+ set extra_where_clause ""
+ set cnames ""
+ if {[info exists category_id]} {
+ foreach {cnames extra_where_clause} [my category_clause $category_id] break
+ }
+
+ foreach {locale locale_clause} \
+ [::xowiki::Includelet locale_clause -revisions p -items p $package_id $locale] break
+
+ set pages [::xowiki::Page instantiate_objects -sql \
+ "select page_id, page_order, name, title, item_id \
+ from xowiki_page_live_revision p \
+ where parent_id = [$package_id folder_id] \
+ and not page_order is NULL $extra_where_clause \
+ $locale_clause \
+ [::xowiki::Page container_already_rendered item_id]" ]
+ $pages mixin add ::xo::OrderedComposite::IndexCompare
+ $pages orderby page_order
+
+ set output ""
+ if {$cnames ne ""} {
+ append output "Filtered by categories: $cnames
"
+ }
+ set return_url [::xo::cc url]
+
+ foreach o [$pages children] {
+ $o instvar page_order title page_id name title
+ set level [expr {[regsub -all {[.]} $page_order . page_order] + 1}]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
+ $p destroy_on_cleanup
+
+ $p set unresolved_references 0
+ #$p set render_adp 0
+ switch [$p info class] {
+ ::xowiki::Form {
+ set content [$p render]
+ }
+ default {
+ set content [$p get_content]
+ set content [string map [list "\{\{" "\\\{\{"] $content]
+ }
+ }
+ set menu [list]
+ foreach b $menu_buttons {
+ if {[info command ::xowiki::includelet::$b] eq ""} {
+ set b $b-item-button
+ }
+ set html [$p include [list $b -book_mode true]]
+ if {$html ne ""} {lappend menu $html}
+ }
+ set menu [join $menu " "]
+ if {$menu ne ""} {
+ # not allowed in h*: style='float: right; position: relative; top: -32px
+ set menu "
$menu"
+ }
+
+ append output \
+ "
" $menu \
+ "$page_order $title" \
+ $content
+ }
+ return $output
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ ::xowiki::IncludeletClass create item-button \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ }
+
+ item-button instproc render_button {
+ -page
+ -package_id
+ -method
+ -src
+ -alt
+ -title
+ -return_url
+ -page_order
+ -object_type
+ -source_item_id
+ } {
+ set html ""
+ if {![info exists return_url]} {set return_url $p_link}
+ if {![info exists alt]} {set alt $method}
+ if {![info exists src]} {set src [my set src]}
+ if {[$page istype ::xowiki::Package]} {
+ set link [$package_id make_link $package_id edit-new object_type \
+ return_url page_order source_item_id]
+ } else {
+ set p_link [$package_id pretty_link [$page name]]
+ set link [$package_id make_link -link $p_link $page $method \
+ return_url page_order source_item_id]
+ }
+
+ if {$link ne ""} {
+ set html "
"
+ }
+ return $html
+ }
+
+ ::xowiki::IncludeletClass create edit-item-button -superclass ::xowiki::includelet::item-button \
+ -parameter {
+ {parameter_declaration {
+ {-page_id}
+ {-title "#xowiki.edit#"}
+ {-alt "edit"}
+ {-book_mode false}
+ }}
+ }
+
+ edit-item-button instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set page [expr {[info exists page_id] ? $page_id : $__including_page}]
+ if {[$page istype ::xowiki::FormPage]} {
+ set template [$page page_template]
+ set title "$title [$template title] [$page name]"
+ }
+ set return_url [::xo::cc url]
+ if {$book_mode} {
+ append return_url #[toc anchor [$page name]]
+ }
+ return [my render_button \
+ -page $page -method edit -package_id $package_id \
+ -title $title -alt $alt -return_url $return_url \
+ -src /resources/acs-subsite/Edit16.gif]
+ }
+
+ ::xowiki::IncludeletClass create delete-item-button -superclass ::xowiki::includelet::item-button \
+ -parameter {
+ {__decoration none}
+ {src /resources/acs-subsite/Delete16.gif}
+ {parameter_declaration {
+ {-page_id}
+ {-title "#xowiki.delete#"}
+ {-alt "delete"}
+ {-book_mode false}
+ }}
+ }
+
+ delete-item-button instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set page [expr {[info exists page_id] ? $page_id : $__including_page}]
+ return [my render_button \
+ -page $page -method delete -package_id $package_id \
+ -title $title -alt $alt \
+ -return_url [::xo::cc url]]
+ }
+
+ ::xowiki::IncludeletClass create create-item-button -superclass ::xowiki::includelet::item-button \
+ -parameter {
+ {__decoration none}
+ {src /resources/acs-subsite/Add16.gif}
+ {parameter_declaration {
+ {-page_id}
+ {-alt "new"}
+ {-book_mode false}
+ }}
+ }
+
+ create-item-button instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set page [expr {[info exists page_id] ? $page_id : $__including_page}]
+ set page_order [::xowiki::Includelet incr_page_order [$page page_order]]
+ if {[$page istype ::xowiki::FormPage]} {
+ set template [$page page_template]
+ return [my render_button \
+ -page $template -method create-new -package_id $package_id \
+ -title [_ xowiki.create_new_entry_of_type [list type [$template title]]] \
+ -alt $alt -page_order $page_order \
+ -return_url [::xo::cc url]]
+ } else {
+ set object_type [$__including_page info class]
+ return [my render_button \
+ -page $package_id -method edit_new -package_id $package_id \
+ -title [_ xowiki.create_new_entry_of_type [list type $object_type]] \
+ -alt $alt -page_order $page_order \
+ -return_url [::xo::cc url] \
+ -object_type $object_type]
+ }
+ }
+
+ ::xowiki::IncludeletClass create copy-item-button -superclass ::xowiki::includelet::item-button \
+ -parameter {
+ {__decoration none}
+ {src /resources/acs-subsite/Copy16.gif}
+ {parameter_declaration {
+ {-page_id}
+ {-alt "copy"}
+ {-book_mode false}
+ }}
+ }
+
+ copy-item-button instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set page [expr {[info exists page_id] ? $page_id : $__including_page}]
+
+ if {[$page istype ::xowiki::FormPage]} {
+ set template [$page page_template]
+ return [my render_button \
+ -page $template -method create-new -package_id $package_id \
+ -title [_ xowiki.copy_entry [list type [$template title]]] \
+ -alt $alt -source_item_id [$page item_id] \
+ -return_url [::xo::cc url]]
+ } else {
+ set object_type [$__including_page info class]
+ return [my render_button \
+ -page $package_id -method edit_new -package_id $package_id \
+ -title [_ xowiki.copy_entry [list type $object_type]] \
+ -alt $alt -source_item_id [$page item_id] \
+ -return_url [::xo::cc url] \
+ -object_type $object_type]
+ }
+ }
+
+
+}
+
+
+namespace eval ::xowiki::includelet {
+
+ ::xowiki::IncludeletClass create graph \
+ -superclass ::xowiki::Includelet \
+ -parameter {{__decoration plain}}
+
+ graph instproc graphHTML {-edges -nodes -max_edges -cutoff -base {-attrib node_id}} {
+
+ ::xo::Page requireJS "/resources/ajaxhelper/prototype/prototype.js"
+ set user_agent [string tolower [ns_set get [ns_conn headers] User-Agent]]
+ if {[string match "*msie *" $user_agent]} {
+ # canvas support for MSIE
+ ::xo::Page requireJS "/resources/xowiki/excanvas.js"
+ }
+ ::xo::Page requireJS "/resources/xowiki/collab-graph.js"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/event/event.js"
+
+ set nodesHTML ""
+ array set n $nodes
+
+ foreach {node label} $nodes {
+ set link "
$label"
+ append nodesHTML "
$link
\n"
+ }
+
+ set edgesHTML ""; set c 0
+ foreach p [lsort -index 1 -decreasing -integer $edges] {
+ foreach {edge weight width} $p break
+ foreach {a b} [split $edge ,] break
+ #my log "--G $a -> $b check $c > $max_edges, $weight < $cutoff"
+ if {[incr c]>$max_edges} break
+ if {$weight < $cutoff} continue
+ append edgesHTML "g.addEdge(\$('$a'), \$('$b'), $weight, 0, $width);\n"
+ }
+ # [lsort -index 1 -decreasing -integer $edges]
[set cutoff] - [set c]
+
+ return [subst -novariables {
+
+
+[set nodesHTML]
+
+
+}]
+ }
+}
+
+namespace eval ::xowiki::includelet {
+ ::xowiki::IncludeletClass create collab-graph \
+ -superclass ::xowiki::includelet::graph \
+ -parameter {
+ {parameter_declaration {
+ {-max_edges 70}
+ {-cutoff 0.1}
+ {-show_anonymous "message"}
+ -user_id
+ }}
+ }
+
+ collab-graph instproc render {} {
+ my get_parameters
+
+ if {$show_anonymous ne "all" && [::xo::cc user_id] eq 0} {
+ return "You must login to see the [namespace tail [self class]]"
+ }
+ if {![info exists user_id]} {set user_id [::xo::cc user_id]}
+
+ set folder_id [$package_id folder_id]
+ db_foreach [my qn get_collaborators] {
+ select count(revision_id), item_id, creation_user
+ from cr_revisions r, acs_objects o
+ where item_id in
+ (select distinct i.item_id from
+ acs_objects o, acs_objects o2, cr_revisions cr, cr_items i
+ where o.object_id = i.item_id and o2.object_id = cr.revision_id
+ and o2.creation_user = :user_id and i.item_id = cr.item_id
+ and i.parent_id = :folder_id order by item_id
+ )
+ and o.object_id = revision_id
+ and creation_user is not null
+ group by item_id, creation_user} {
+
+ lappend i($item_id) $creation_user $count
+ set count_var user_count($creation_user)
+ if {![info exists $count_var]} {set $count_var 0}
+ incr $count_var $count
+ set user($creation_user) "[::xo::get_user_name $creation_user] ([set $count_var])"
+ if {![info exists activities($creation_user)]} {set activities($creation_user) 0}
+ incr activities($creation_user) $count
+ }
+
+ set result "
Collaboration Graph for [::xo::get_user_name $user_id] in this wiki"
+ if {[array size i] < 1} {
+ append result "
No collaborations found
"
+ } else {
+
+ foreach x [array names i] {
+ foreach {u1 c1} $i($x) {
+ foreach {u2 c2} $i($x) {
+ if {$u1 < $u2} {
+ set var collab($u1,$u2)
+ if {![info exists $var]} {set $var 0}
+ incr $var $c1
+ incr $var $c2
+ }
+ }
+ }
+ }
+
+ set max 50
+ foreach x [array names collab] {
+ if {$collab($x) > $max} {set max $collab($x)}
+ }
+
+ set edges [list]
+ foreach x [array names collab] {
+ lappend edges [list $x $collab($x) [expr {$collab($x)*5.0/$max}]]
+ }
+
+ append result "($activities($user_id) contributions)\n"
+ append result [my graphHTML \
+ -nodes [array get user] -edges $edges \
+ -max_edges $max_edges -cutoff $cutoff \
+ -base collab -attrib user_id]
+ }
+
+ return $result
+ }
+
+
+ ::xowiki::IncludeletClass create activity-graph \
+ -superclass ::xowiki::includelet::graph \
+ -parameter {
+ {parameter_declaration {
+ {-max_edges 70}
+ {-cutoff 0.1}
+ {-max_activities:integer 100}
+ {-show_anonymous "message"}
+ }}
+ }
+
+ activity-graph instproc render {} {
+ my get_parameters
+
+ if {$show_anonymous ne "all" && [::xo::cc user_id] eq 0} {
+ return "You must login to see the [namespace tail [self class]]"
+ }
+
+ set folder_id [$package_id folder_id]
+
+ # there must be a better way to handle temporaray tables safely....
+ catch {db_dml [my qn drop_temp_table] {drop table XOWIKI_TEMP_TABLE}}
+
+ set sql "create global temporary table XOWIKI_TEMP_TABLE on commit preserve rows as "
+ set subquery [::xo::db::sql select \
+ -vars "i.item_id, revision_id, creation_user" \
+ -from "cr_revisions cr, cr_items i, acs_objects o" \
+ -where "cr.item_id = i.item_id and i.parent_id = $folder_id \
+ and o.object_id = revision_id" \
+ -orderby "revision_id desc" \
+ -limit $max_activities]
+
+ # this is currently a rather ugly hack to get the suff quicky working in oracle.
+ # TODO: cleanup, different methods for oracle and postgres for handling temporary tables
+ if {[catch {db_dml [my qn get_n_most_recent_contributions] $sql$subquery}]} {
+ db_dml . "insert into XOWIKI_TEMP_TABLE (item_id,revision_id,creation_user) ($subquery)"
+ }
+
+ set total 0
+ db_foreach [my qn get_activities] {
+ select count(revision_id),item_id, creation_user
+ from XOWIKI_TEMP_TABLE
+ where creation_user is not null
+ group by item_id, creation_user
+ } {
+ lappend i($item_id) $creation_user $count
+ incr total $count
+ set count_var user_count($creation_user)
+ if {![info exists $count_var]} {set $count_var 0}
+ incr $count_var $count
+ set user($creation_user) "[::xo::get_user_name $creation_user] ([set $count_var])"
+ }
+
+ if {[catch {db_dml [my qn drop_temp_table] {drop table XOWIKI_TEMP_TABLE}} ]} {
+ db_dml [my qn trunc_temp_table] {truncate table XOWIKI_TEMP_TABLE }
+ }
+
+ if {[array size i] == 0} {
+ append result "
No activities found
"
+ } elseif {[array size user] == 1} {
+ set user_id [lindex [array names user] 0]
+ append result "
Last $total activities were done by user " \
+ "[::xo::get_user_name $user_id]."
+ } else {
+ append result "
Collaborations in last $total activities by [array size user] Users in this wiki
"
+
+ foreach x [array names i] {
+ foreach {u1 c1} $i($x) {
+ foreach {u2 c2} $i($x) {
+ if {$u1 < $u2} {
+ set var collab($u1,$u2)
+ if {![info exists $var]} {set $var 0}
+ incr $var $c1
+ incr $var $c2
+ }
+ }
+ }
+ }
+
+ set max 0
+ foreach x [array names collab] {
+ if {$collab($x) > $max} {set max $collab($x)}
+ }
+
+ set edges [list]
+ foreach x [array names collab] {
+ lappend edges [list $x $collab($x) [expr {$collab($x)*5.0/$max}]]
+ }
+
+ append result [my graphHTML \
+ -nodes [array get user] -edges $edges \
+ -max_edges $max_edges -cutoff $cutoff \
+ -base collab -attrib user_id]
+ }
+
+ return $result
+ }
+
+ ::xowiki::IncludeletClass create timeline \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {parameter_declaration {
+ -user_id
+ {-data timeline-data}
+ {-interval1 DAY}
+ {-interval2 MONTH}
+ }}
+ }
+
+ timeline instproc render {} {
+ my get_parameters
+
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js"
+ ::xo::Page requireJS "/resources/ajaxhelper/yui/event/event.js"
+ ::xo::Page requireJS "/resources/xowiki/timeline/api/timeline-api.js"
+
+ set stamp [clock format [clock seconds] -format "%b %d %Y %X %Z" -gmt true]
+ if {[info exists user_id]} {append data "?user_id=$user_id"}
+
+ return [subst -nocommands -nobackslashes {
+
+
+
+ }]
+ }
+
+ ::xowiki::IncludeletClass create user-timeline \
+ -superclass timeline \
+ -parameter {
+ {parameter_declaration {
+ -user_id
+ {-data timeline-data}
+ {-interval1 DAY}
+ {-interval2 MONTH}
+ }}
+ }
+
+ user-timeline instproc render {} {
+ my get_parameters
+ if {![info exists user_id]} {set user_id [::xo::cc user_id]]}
+ ::xo::cc set_parameter user_id $user_id
+ next
+ }
+
+}
+
+
+namespace eval ::xowiki::includelet {
+ #############################################################################
+ ::xowiki::IncludeletClass create form-menu \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-form_item_id:integer,required}
+ }}
+ }
+
+ form-menu instproc render {} {
+ my get_parameters
+ # todo return_url
+ my instvar __including_page
+ set base [$package_id pretty_link [$__including_page name]]
+ set new_link [$package_id make_link -link $base $__including_page create-new return_url]
+ set answer_link [$package_id make_link -link $base $__including_page list return_url]
+ set template [::xo::db::CrClass get_instance_from_db -item_id $form_item_id]
+ set count [$template count_usages]
+ set links [list]
+ foreach l [list new_link answer_link] {
+ if {[set $l] ne ""} {
+ set label #xowiki.form-menu-$l#
+ if {$l eq "answer_link"} {append label " ($count) "}
+ lappend links "
$label"
+ }
+ }
+ return "
\n"
+ }
+
+ #############################################################################
+ ::xowiki::IncludeletClass create form-entry-menu \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ }}
+ }
+
+ form-entry-menu instproc render {} {
+ my get_parameters
+ my instvar __including_page
+ set form [$__including_page page_template]
+ set base [$package_id pretty_link [$form name]]
+ return "
\n"
+ }
+
+ #############################################################################
+ ::xowiki::IncludeletClass create form-usages \
+ -superclass ::xowiki::Includelet \
+ -parameter {
+ {__decoration none}
+ {parameter_declaration {
+ {-form_item_id:integer}
+ {-form}
+ {-orderby "_last_modified,desc"}
+ {-all:boolean false}
+ {-field_names}
+ {-csv false}
+ }}
+ }
+
+ form-usages instproc render {} {
+ my get_parameters
+ my instvar __including_page
+
+ ::xo::Page requireCSS "/resources/acs-templating/lists.css"
+ set return_url [::xo::cc url]?[::xo::cc actual_query]
+
+ if {![info exists form_item_id]} {
+ set form_item_id [::xo::db::CrClass lookup -name $form -parent_id $folder_id]
+ if {$form_item_id == 0} {error "Cannot lookup page $form"}
+ }
+
+ set form_item [::xowiki::Form get_instance_from_db -item_id $form_item_id]
+ $form_item destroy_on_cleanup
+
+ if {![info exists field_names]} {
+ set fn [::xowiki::PageInstance get_short_spec_from_form_constraints \
+ -name @table \
+ -form_constraints [$form_item form_constraints]]
+ set field_names [split $fn ,]
+ }
+ if {$field_names eq ""} {
+ set field_names {_name _last_modified _creation_user}
+ }
+
+ set sql_atts [list instance_attributes ci.name]
+ foreach att [::xowiki::FormPage array names db_slot] {set __att($att) 1}
+ set common_atts [list last_modified creation_user]
+ foreach att $common_atts {
+ lappend sql_atts p.$att
+ set __att($att) 1
+ }
+ #my msg __att=[array names __att],
+ #my msg sql_atts=$sql_atts
+ #my msg field_names=$field_names
+
+ set form_constraints [$form_item form_constraints]
+ # set cr_field_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \
+ # -name @cr_fields \
+ # -form_constraints $form_constraints]
+ # if some fields are hidden in the form, there might still be values (creation_user, etc)
+ # maybe filter hidden? ignore for the time being.
+ set cr_field_spec ""
+ #
+ set field_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \
+ -name @fields \
+ -form_constraints $form_constraints]
+
+ foreach spec_name $field_names {
+ set short_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \
+ -name $spec_name \
+ -form_constraints $form_constraints]
+
+ switch -glob -- $spec_name {
+ __* {error not_allowed}
+ _* {
+ set varname [string range $spec_name 1 end]
+ if {![info exists __att($varname)]} {
+ error "unknown attribute $spec_name"
+ }
+ set f [$form_item create_form_field \
+ -name $spec_name \
+ -slot [$form_item find_slot $varname] \
+ -spec $cr_field_spec,$short_spec]
+ if {$spec_name eq "_text"} {
+ lappend sql_atts "bt.content as text"
+ } elseif {$spec_name ne "_name"} {
+ lappend sql_atts p.$varname
+ }
+ }
+ default {
+ set f [$form_item create_form_field \
+ -name $spec_name \
+ -slot "" \
+ -spec $field_spec,$short_spec]
+ }
+ }
+ lappend form_fields $f
+ set __ff($spec_name) $f
+ }
+ #my msg ff=[array names __ff]
+ #$form_item show_fields $form_fields
+
+ if {[info exists __ff(_creation_user)]} {$__ff(_creation_user) label "By User"}
+
+ set cols ""
+ append cols {ImageField_EditIcon edit -label "" -html {style "padding: 2px;"}} \n
+ foreach fn $field_names {
+ append cols [list AnchorField $fn \
+ -label [$__ff($fn) label] \
+ -richtext [$__ff($fn) istype ::xowiki::FormField::richtext] \
+ -orderby $fn] \n
+ }
+ append cols [list ImageField_DeleteIcon delete -label "" ] \n
+
+ TableWidget t1 -volatile -columns $cols
+
+ #
+ # Sorting is done for the time being in tcl. This has the advantage
+ # that page_orders can be sorted with the special mixin and that
+ # instance attributes can be used for sorting as well.
+ #
+ foreach {att order} [split $orderby ,] break
+ if {$att eq "_page_order"} {
+ t1 mixin add ::xo::OrderedComposite::IndexCompare
+ }
+ t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att
+
+ #
+ # build SQL query and iterate over the results
+ # maybe this could be slightly faster by using instantiate_objects
+ #
+ set publish_status_clause [expr {$all ? "" : " and ci.publish_status <> 'production' "}]
+ set items [::xowiki::FormPage get_instances_from_db \
+ -select_attributes $sql_atts \
+ -from_clause ", xowiki_form_pagei p" \
+ -with_subtypes false \
+ -where_clause " p.page_template = $form_item_id \
+ and p.xowiki_form_page_id = bt.revision_id \
+ $publish_status_clause" \
+ -folder_id [$package_id folder_id]]
+ $items destroy_on_cleanup
+
+ foreach p [$items children] {
+ $p set package_id $package_id
+
+ array set __ia [$p set instance_attributes]
+ set page_link [$package_id pretty_link [$p name]]
+
+ t1 add \
+ -delete delete \
+ -delete.href [$package_id make_link -link $page_link $p delete return_url] \
+ -edit edit \
+ -edit.href [$package_id make_link -link $page_link $p edit return_url]
+
+ set __c [t1 last_child]
+ $__c set _name.href $page_link
+
+ # set always last_modified for default sorting
+ $__c set _last_modified [$p set last_modified]
+
+ foreach __fn $field_names {
+ switch -glob -- $__fn {
+ __* {error not_allowed}
+ _* {set __value [$p set [string range $__fn 1 end]]}
+ default {
+ if {[info exists __ia($__fn)]} {
+ set __value $__ia($__fn)
+ } else {
+ # the field was added after the current entry was created
+ set __value ""
+ }
+ }
+ }
+ $__c set $__fn [$__ff($__fn) pretty_value $__value]
+ }
+ }
+
+ if {$csv} {
+ return [t1 write_csv]
+ }
+
+ set base [$package_id pretty_link [$__including_page name]]
+ set label [$__including_page name]
+ append html [_ xowiki.entries_using_form [list form "
$label"]]
+ append html [t1 asHTML]
+ append html "
csv"
+ return $html
+ }
+}
+
\ No newline at end of file
Index: openacs-4/packages/xowiki/tcl/link-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v
diff -u -r1.36 -r1.37
--- openacs-4/packages/xowiki/tcl/link-procs.tcl 28 Sep 2007 20:34:06 -0000 1.36
+++ openacs-4/packages/xowiki/tcl/link-procs.tcl 13 Nov 2007 11:36:11 -0000 1.37
@@ -257,7 +257,7 @@
#set link [$package_id pretty_link -absolute true -siteurl http://localhost:8003 $name]/download.swf
foreach {width height bgcolor version} {320 240 #999999 7} break
foreach a {width height bgcolor version} {if {[my exists $a]} {set $a [my set $a]}}
- set id [::xowiki::Portlet self_id]
+ set id [::xowiki::Includelet self_id]
set addParams ""
foreach a {quality wmode align salign play loop menu scale} {
if {[my exists $a]} {append addParams "so.addParam('$a', '[my set $a]');\n"}
Index: openacs-4/packages/xowiki/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v
diff -u -r1.93 -r1.94
--- openacs-4/packages/xowiki/tcl/package-procs.tcl 11 Oct 2007 07:46:18 -0000 1.93
+++ openacs-4/packages/xowiki/tcl/package-procs.tcl 13 Nov 2007 11:36:11 -0000 1.94
@@ -272,10 +272,10 @@
set index_link [my make_link -privilege public -link "" $id {} {}]
set link [my query_parameter "return_url" ""]
if {$link ne ""} {set back_link $link}
- set top_portlets ""; set content $error_msg
+ set top_includelets ""; set content $error_msg
$id return_page -adp $template_file -variables {
context title index_link back_link header_stuff error_msg
- top_portlets content
+ top_includelets content
}
}
Index: openacs-4/packages/xowiki/tcl/syndicate-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/syndicate-procs.tcl,v
diff -u -r1.25 -r1.26
--- openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 10 Nov 2007 13:38:08 -0000 1.25
+++ openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 13 Nov 2007 11:36:11 -0000 1.26
@@ -167,7 +167,7 @@
if {$description eq ""} {set description $body}
if {$title eq ""} {set title $name}
set time [::xo::db::tcl_date $last_modified tz]
- set link [::xowiki::Portlet detail_link \
+ set link [::xowiki::Includelet detail_link \
-package_id $package_id -name $name \
-absolute true \
-instance_attributes $instance_attributes]
Index: openacs-4/packages/xowiki/tcl/weblog-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/weblog-procs.tcl,v
diff -u -r1.26 -r1.27
--- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 16 Oct 2007 19:04:57 -0000 1.26
+++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 13 Nov 2007 11:36:11 -0000 1.27
@@ -95,7 +95,7 @@
if {$locale ne ""} {
#set locale "default+system"
foreach {locale locale_clause} \
- [::xowiki::Portlet locale_clause -revisions bt -items ci $package_id $locale] break
+ [::xowiki::Includelet locale_clause -revisions bt -items ci $package_id $locale] break
#my msg "--L locale_clause=$locale_clause"
append extra_where_clause $locale_clause
}
Index: openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl,v
diff -u -r1.34 -r1.35
--- openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 4 Sep 2007 11:31:20 -0000 1.34
+++ openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 13 Nov 2007 11:36:11 -0000 1.35
@@ -351,8 +351,32 @@
}
::xowiki::update_views
}
+
+ set v 0.77
+ if {[apm_version_names_compare $from_version_name $v] == -1 &&
+ [apm_version_names_compare $to_version_name $v] > -1} {
+ ns_log notice "-- upgrading to $v"
+ # load for all xowiki package instances the weblog-portlet prototype page
+ foreach package_id [::xowiki::Package instances] {
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import_prototype_page announcements
+ $package_id import_prototype_page news
+ $package_id import_prototype_page weblog-portlet
+ }
+ copy_parameter top_portlet top_includelet
+ }
}
+ proc copy_parameter {from to} {
+ set parameter_obj [::xo::parameter get_parameter_object \
+ -parameter_name $from -package_key xowiki]
+ if {$parameter_obj eq ""} {error "no such parameter $from"}
+ foreach package_id [::xowiki::Package instances] {
+ set value [$parameter_obj get -package_id $package_id]
+ parameter::set_value -package_id $package_id -parameter $to -value $value
+ }
+ }
+
ad_proc fix_all_package_ids {} {
earlier versions of openacs did not have the package_id set correctly
in acs_objects; this proc updates the package_ids of all items
Fisheye: Tag 1.112 refers to a dead (removed) revision in file `openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v
diff -u -r1.182 -r1.183
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 12 Nov 2007 08:39:27 -0000 1.182
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 13 Nov 2007 11:36:11 -0000 1.183
@@ -497,7 +497,7 @@
return $page
}
- Page instproc instantiate_portlet_object {arg} {
+ Page instproc instantiate_includelet {arg} {
# we want to use package_id as proc-local variable, since the
# cross package reference might alter it locally
set package_id [my package_id]
@@ -508,10 +508,10 @@
return [my error_in_includelet $arg [_ xowiki.error-includelet-dash_syntax_invalid]]
}
- # the include is either a portlet class, or a wiki page
- if {[my isclass ::xowiki::portlet::$page_name]} {
+ # the include is either a includelet class, or a wiki page
+ if {[my isclass ::xowiki::includelet::$page_name]} {
# direct call, without page, not tailorable
- set page [::xowiki::portlet::$page_name new \
+ set page [::xowiki::includelet::$page_name new \
-package_id $package_id \
-name $page_name \
-locale [::xo::cc locale] \
@@ -536,14 +536,14 @@
$page destroy_on_cleanup
my set __last_includelet $page
$page set __including_page [self]
- if {[$page istype ::xowiki::Portlet]} {
+ if {[$page istype ::xowiki::Includelet]} {
$page initialize
}
}
return $page
}
- Page instproc render_portlet_object {page} {
+ Page instproc render_includelet {page} {
#$page set __decoration portlet
foreach {att value} [$page set __caller_parameters] {
switch -- $att {
@@ -552,34 +552,39 @@
}
}
if {[$page exists __decoration] && [$page set __decoration] ne "none"} {
- $page mixin add ::xowiki::portlet::decoration=[$page set __decoration]
+ $page mixin add ::xowiki::includelet::decoration=[$page set __decoration]
}
set c [$page info class]
if {[$c exists cacheable] && [$c cacheable]} {
- $page mixin add ::xowiki::portlet::page_fragment_cache
+ $page mixin add ::xowiki::includelet::page_fragment_cache
}
if {[catch {set html [$page render]} errorMsg]} {
set page_name [$page name]
set html [my error_during_render [_ xowiki.error-includelet-error_during_render]]
}
- #my log "--include portlet returns $html"
+ #my log "--include includelet returns $html"
return $html
}
- Page ad_instproc include_portlet {arg} {
+ Page instproc include_portlet {arg} {
+ my log "+++ method [self proc] of [self class] is deprecated"
+ return [my include $arg]
+ }
+
+ Page ad_instproc include {arg} {
Include the html of the includelet. The method generates
an includelet object (might be an other xowiki page) and
renders it and returns either html or an error message.
} {
- set page [my instantiate_portlet_object $arg]
+ set page [my instantiate_includelet $arg]
if {$page eq ""} {
return [my error_during_render [_ xowiki.error-includelet-unknown]]
}
- return [my render_portlet_object $page]
+ return [my render_includelet $page]
}
- Page instproc include {ch arg ch2} {
+ Page instproc include_content {ch arg ch2} {
# make recursion depth a global variable to ease the deletion etc.
if {[catch {incr ::xowiki_inclusion_depth}]} {
set ::xowiki_inclusion_depth 1
@@ -618,8 +623,8 @@
# Some browsers change {{cmd -flag "..."}} into {{cmd -flag "..."}}
# We have to change this back
regsub -all {([^\\])"} $arg "\\1\"" arg
- set html [my include_portlet $arg]
- #my log "--include portlet returns $html"
+ set html [my include $arg]
+ #my log "--include includelet returns $html"
incr ::xowiki_inclusion_depth -1
return $ch$html$ch2
}
@@ -755,7 +760,7 @@
if {[string first \{\{ $l] > -1 && [string first \}\} $l] == -1} continue
set l [my regsub_eval $RE(anchor) $l {my anchor "\1" "\2"}]
set l [my regsub_eval $RE(div) $l {my div "\2" "\3"}]
- set l [my regsub_eval $RE(include) $l {my include "\\\1" "\2" "\3"}]
+ set l [my regsub_eval $RE(include) $l {my include_content "\\\1" "\2" "\3"}]
regsub -all $RE(clean) $l {\1} l
regsub -all $RE(clean2) $l { \1} l
append content [string range $l 1 end] \n
@@ -1258,7 +1263,7 @@
# Methods of ::xowiki::Form
#
Form instproc footer {} {
- return [my include_portlet [list form-menu -form_item_id [my item_id]]]
+ return [my include [list form-menu -form_item_id [my item_id]]]
}
Form proc disable_input_fields {form} {
@@ -1288,7 +1293,7 @@
}
Form instproc list {} {
- my view [my include_portlet [list form-usages -form_item_id [my item_id]]]
+ my view [my include [list form-usages -form_item_id [my item_id]]]
}
@@ -1330,7 +1335,7 @@
if {[my exists __no_form_page_footer]} {
next
} else {
- return [my include_portlet [list form-entry-menu]]
+ return [my include [list form-entry-menu]]
}
}
Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v
diff -u -r1.107 -r1.108
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 2 Nov 2007 11:20:28 -0000 1.107
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 13 Nov 2007 11:36:11 -0000 1.108
@@ -31,7 +31,7 @@
![my exists_query_parameter no_tags] &&
[::xo::cc user_id] != 0
} {
- set tag_content "[my include_portlet my-tags]
"
+ set tag_content "[my include my-tags]
"
set tag_includelet [my set __last_includelet]
set tags [$tag_includelet set tags]
} else {
@@ -41,35 +41,35 @@
if {[$package_id get_parameter "with_digg" 0] && [info exists url]} {
append footer "
" \
- [my include_portlet [list digg -description $description -url $url]] "
\n"
+ [my include [list digg -description $description -url $url]] "
\n"
}
if {[$package_id get_parameter "with_delicious" 0] && [info exists url]} {
append footer "" \
- [my include_portlet [list delicious -description $description -url $url -tags $tags]] \
+ [my include [list delicious -description $description -url $url -tags $tags]] \
"
\n"
}
if {[$package_id get_parameter "with_yahoo_publisher" 0] && [info exists package_url]} {
append footer "" \
- [my include_portlet [list my-yahoo-publisher \
+ [my include [list my-yahoo-publisher \
-publisher [::xo::get_user_name [::xo::cc user_id]] \
-rssurl "$package_url?rss"]] \
"
\n"
}
- append footer [my include_portlet my-references]
+ append footer [my include my-references]
if {[$package_id get_parameter "show_per_object_categories" 1]} {
- append footer [my include_portlet my-categories]
+ append footer [my include my-categories]
set categories_includelet [my set __last_includelet]
}
append footer $tag_content
if {[$package_id get_parameter "with_general_comments" 0] &&
![my exists_query_parameter no_gc]} {
- append footer [my include_portlet my-general-comments]
+ append footer [my include my-general-comments]
}
return "$footer
\n"
@@ -99,10 +99,10 @@
#my log "--after render"
set footer [my htmlFooter -content $content]
- set top_portlets ""
- set vp [string trim [$package_id get_parameter "top_portlet" ""]]
+ set top_includelets ""
+ set vp [string trim [$package_id get_parameter "top_includelet" ""]]
if {$vp ne ""} {
- set top_portlets [my include_portlet $vp]
+ set top_includelets [my include $vp]
}
if {[$package_id get_parameter "with_user_tracking" 1]} {
@@ -210,7 +210,7 @@
content footer package_id
rev_link edit_link delete_link new_link admin_link index_link
notification_subscribe_link notification_image
- top_portlets page
+ top_includelets page
views_data
}
}
@@ -359,7 +359,7 @@
set default ""
}
set f [FormField new -name $name \
- -id [::xowiki::Portlet html_id F.[my name].$name] \
+ -id [::xowiki::Includelet html_id F.[my name].$name] \
-locale [my nls_language] \
-label $label \
-type [expr {[$slot exists datatype] ? [$slot set datatype] : "text"}] \
@@ -1074,7 +1074,7 @@
append error_msg \
[_ xowiki.error-delete_entries_first [list count $count]] \
\
- [my include_portlet [list form-usages -all true -form_item_id [my item_id]]] \
+ [my include [list form-usages -all true -form_item_id [my item_id]]] \
$package_id error_msg $error_msg
} else {
Index: openacs-4/packages/xowiki/www/oacs-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/oacs-view.adp,v
diff -u -r1.42 -r1.43
--- openacs-4/packages/xowiki/www/oacs-view.adp 14 Sep 2007 09:32:25 -0000 1.42
+++ openacs-4/packages/xowiki/www/oacs-view.adp 13 Nov 2007 11:36:12 -0000 1.43
@@ -79,7 +79,7 @@
portlet="categories -open_page @name@ -decoration plain">
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
Index: openacs-4/packages/xowiki/www/oacs-view2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/oacs-view2.adp,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/xowiki/www/oacs-view2.adp 14 Sep 2007 09:32:25 -0000 1.21
+++ openacs-4/packages/xowiki/www/oacs-view2.adp 13 Nov 2007 11:36:12 -0000 1.22
@@ -86,7 +86,7 @@
#sidebar {min-width: 220px ! important; top: 0px; overflow: visible;}
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
Index: openacs-4/packages/xowiki/www/oacs-view3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/oacs-view3.adp,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/xowiki/www/oacs-view3.adp 14 Sep 2007 09:32:25 -0000 1.16
+++ openacs-4/packages/xowiki/www/oacs-view3.adp 13 Nov 2007 11:36:12 -0000 1.17
@@ -111,7 +111,7 @@
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
Index: openacs-4/packages/xowiki/www/view-book.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-book.adp,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xowiki/www/view-book.adp 17 Mar 2007 23:13:21 -0000 1.10
+++ openacs-4/packages/xowiki/www/view-book.adp 13 Nov 2007 11:36:12 -0000 1.11
@@ -36,7 +36,7 @@
@toc;noquote@
-@top_portlets;noquote@
+
@top_includelets;noquote@
@@ -85,7 +85,7 @@
&="per_object_categories_with_links"
&="digg_link" &="delicious_link" &="my_yahoo_link"
&="gc_link" &="gc_comments" &="notification_subscribe_link" &="notification_image"
- &="top_portlets" &="page">
+ &="top_includelets" &="page">
Index: openacs-4/packages/xowiki/www/view-book.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-book.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/xowiki/www/view-book.tcl 28 Sep 2007 20:34:07 -0000 1.6
+++ openacs-4/packages/xowiki/www/view-book.tcl 13 Nov 2007 11:36:12 -0000 1.7
@@ -1,5 +1,5 @@
set title [[$package_id folder_id] title]
-set toc [$page include_portlet [list toc -open_page $name -decoration plain -remove_levels 1]]
+set toc [$page include [list toc -open_page $name -decoration plain -remove_levels 1]]
set i [$page set __last_includelet]
#my log "--last includelet = $i, class=[$i info class] [$page exists __is_book_page]"
Index: openacs-4/packages/xowiki/www/view-default.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-default.adp,v
diff -u -r1.38 -r1.39
--- openacs-4/packages/xowiki/www/view-default.adp 14 Sep 2007 09:32:25 -0000 1.38
+++ openacs-4/packages/xowiki/www/view-default.adp 13 Nov 2007 11:36:12 -0000 1.39
@@ -63,7 +63,7 @@
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
@footer;noquote@
Index: openacs-4/packages/xowiki/www/view-links.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-links.adp,v
diff -u -r1.28 -r1.29
--- openacs-4/packages/xowiki/www/view-links.adp 14 Sep 2007 09:32:25 -0000 1.28
+++ openacs-4/packages/xowiki/www/view-links.adp 13 Nov 2007 11:36:12 -0000 1.29
@@ -16,7 +16,7 @@
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
Index: openacs-4/packages/xowiki/www/view-plain.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view-plain.adp,v
diff -u -r1.24 -r1.25
--- openacs-4/packages/xowiki/www/view-plain.adp 14 Sep 2007 09:32:25 -0000 1.24
+++ openacs-4/packages/xowiki/www/view-plain.adp 13 Nov 2007 11:36:12 -0000 1.25
@@ -3,7 +3,7 @@
-@top_portlets;noquote@
+@top_includelets;noquote@
@content;noquote@
Index: openacs-4/packages/xowiki/www/portlets/include.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/include.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/xowiki/www/portlets/include.tcl 28 Sep 2007 20:34:07 -0000 1.4
+++ openacs-4/packages/xowiki/www/portlets/include.tcl 13 Nov 2007 11:36:12 -0000 1.5
@@ -1,4 +1,4 @@
#ns_log notice "--including_page= $__including_page, portlet=$portlet"
-set content [$__including_page include_portlet $portlet]
+set content [$__including_page include $portlet]
set header_stuff [::xo::Page header_stuff]
template::set_file [file dir $__adp_stub]/plain-include
Index: openacs-4/packages/xowiki/www/prototypes/announcements.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/announcements.page,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/xowiki/www/prototypes/announcements.page 14 Sep 2007 20:48:52 -0000 1.4
+++ openacs-4/packages/xowiki/www/prototypes/announcements.page 13 Nov 2007 11:36:45 -0000 1.5
@@ -66,8 +66,7 @@
alt='Next Page' style='float: left; top: 0px;'>"
}
set page [my set __page]
- set rss [$page include_portlet \
- "rss-button -title {[$page title]} -entries_of [my entries_of]"]
+ set rss [$page include "rss-button -title {[$page title]} -entries_of [my entries_of]"]
#set rss [list [self] [lsort [my info vars]]]
return " $filter [next] $prev $next
$rss
"
}
Index: openacs-4/packages/xowiki/www/prototypes/news.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/news.page,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/prototypes/news.page 28 Jul 2007 18:04:52 -0000 1.1
+++ openacs-4/packages/xowiki/www/prototypes/news.page 13 Nov 2007 11:36:45 -0000 1.2
@@ -66,7 +66,7 @@
alt='Next Page' style='float: left; top: 0px;'>"
}
set page [my set __page]
- set rss [$page include_portlet \
+ set rss [$page include \
"rss-button -title {[$page title]} -entries_of [my entries_of]"]
#set rss [list [self] [lsort [my info vars]]]
return " $filter [next] $prev $next
$rss
"
Index: openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/weblog-portlet.page,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 3 Sep 2007 21:07:53 -0000 1.10
+++ openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 13 Nov 2007 11:36:45 -0000 1.11
@@ -30,7 +30,7 @@
} else {
set instance_attributes ""
}
- set link [::xowiki::Portlet detail_link -package_id $package_id -name $name \
+ set link [::xowiki::Includelet detail_link -package_id $package_id -name $name \
-instance_attributes $instance_attributes]
set show_more [expr {[$weblog_obj summary] && [my exists text] && [my text] ne ""}]
set more [expr {$show_more ?