"
+ } elseif {[string match left-col* $arg] \
+ || [string match right-col* $arg] \
+ || $arg eq "sidebar"} {
+ return "$ch
"
} elseif {$arg eq "box"} {
- return "
"
+ return "$ch
"
} elseif {$arg eq ""} {
- return "
"
+ return "$ch
"
+ } else {
+ return $ch
}
}
- Page instproc anchor arg {
+ Page instproc anchor {ch arg} {
set label $arg
set link $arg
regexp {^(.*)[|](.*)$} $arg _ link label
if {[string match "http*//*" $link]} {
- return "
$label"
+ return "$ch
$label"
}
my instvar parent_id
@@ -584,7 +644,7 @@
-type $link_type -title $lang:$stripped_name -lang $lang \
-stripped_name $stripped_name -label $label \
-folder_id $parent_id -package_id [$parent_id set package_id]
- return [[self]::link render]
+ return $ch[[self]::link render]
}
Page instproc references {} {
@@ -607,14 +667,16 @@
set source [ad_enhanced_text_to_html $source]
}
set content ""
+ set l " "; #use one byte trailer for regexps for escaped content
foreach l0 [split [lindex $source 0] \n] {
append l $l0
if {[string first \{\{ $l] > -1 && [string first \}\} $l] == -1} continue
- set l [my regsub-eval $RE(include) $l {my include "\1"}]
- set l [my regsub-eval $RE(anchor) $l {my anchor "\1"}]
- set l [my regsub-eval $RE(div) $l {my div "\2"}]
- append content $l \n
- set l ""
+ 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"}]
+ regsub -all $RE(clean) $l {\1} l
+ append content [string range $l 1 end] \n
+ set l " "
}
return $content
}
@@ -716,10 +778,12 @@
[self class] instvar RE
set content ""
foreach l [split $source \n] {
- set l [my regsub-eval $RE(include) $l {my include "\1"}]
- set l [my regsub-eval $RE(anchor) $l {my anchor "\1"}]
- set l [my regsub-eval $RE(div) $l {my div "\2"}]
- append content $l \n
+ set l " $l"
+ 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"}]
+ regsub -all $RE(clean) $l {\1} l
+ append content [string range $l 1 end] \n
}
return $content
}
Index: openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 25 Apr 2006 23:05:36 -0000 1.7
+++ openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 30 Apr 2006 23:53:34 -0000 1.8
@@ -52,8 +52,7 @@
set folder_id [$page set parent_id]
set pid [db_string get_pid "select package_id from cr_folders where folder_id = $folder_id"]
if {$pid > 0} {
- set package_id [$folder_id set package_id]
- return [::xowiki::Page pretty_link -package_id $package_id [$page set title]]
+ return [::xowiki::Page pretty_link -package_id $pid [$page set title]]
} else {
# cannot determine package_id; one page from the directory should be viewed to update
# package id for the content folder...
Index: openacs-4/packages/xowiki/www/view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/view.adp,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/xowiki/www/view.adp 24 Apr 2006 08:24:05 -0000 1.14
+++ openacs-4/packages/xowiki/www/view.adp 30 Apr 2006 23:53:35 -0000 1.15
@@ -1,12 +1,13 @@
@page_title;noquote@
@context;noquote@
- @header_stuff;noquote@
-
-
-
-
+ @header_stuff;noquote@
+
+
+
+
Index: openacs-4/packages/xowiki/www/portlets/categories.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xowiki/www/portlets/categories.tcl 18 Apr 2006 00:06:14 -0000 1.10
+++ openacs-4/packages/xowiki/www/portlets/categories.tcl 30 Apr 2006 23:53:35 -0000 1.11
@@ -5,9 +5,9 @@
# valid parameters from the adp include are
# tree_name: match pattern, if specified displays only the trees
# with matching names
-# no_tree_name: if specified, only tree names are not displayed
+# 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
+# tree_style: boolean, default: true, display based on mktree
# skin: name of adp-file to render content
# get the folder id from the including page
@@ -16,8 +16,10 @@
set open_item_id [expr {[info exists open_page] ?
[CrItem lookup -title $open_page -parent_id $folder_id] : 0}]
+if {![info exists name]} {set name "Categories"}
if {![info exists tree_style]} {set tree_style 1}
if {![info exists plain_include]} {set plain_include 0}
+if {![info exists count]} {set count 0}
set content ""
foreach tree [category_tree::get_mapped_trees $package_id] {
@@ -29,7 +31,6 @@
set categories [list]
set pos 0
set cattree(0) [::xowiki::CatTree new -volatile -orderby pos -name $my_tree_name]
- set lastlevel 0
foreach category_info [category_tree::get_tree $tree_id] {
foreach {category_id category_label deprecated_p level} $category_info {break}
set c [::xowiki::Category new -orderby pos -category_id $category_id \
@@ -40,16 +41,24 @@
set category($category_id) $c
lappend categories $category_id
}
-
- db_foreach get_pages \
- "select i.item_id, r.title, i.content_type, p.page_title, category_id \
- from category_object_map c, cr_items i, cr_revisions r, xowiki_page p \
- where c.object_id = i.item_id and i.parent_id = $folder_id \
+
+ 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 = i.live_revision \
- and p.page_id = r.revision_id \
- " {
-
+ and r.revision_id = ci.live_revision \
+ and p.page_id = r.revision_id"
+ if {$count} {
+ db_foreach get_counts \
+ "select count(*),category_id from $sql group by category_id" {
+ $category($category_id) set count $count
+ $category($category_id) href [ad_conn url]?category_id=$category_id
+ $category($category_id) open_tree
+ }
+ append content [$cattree(0) render -tree_style $tree_style]
+ } else {
+ db_foreach get_pages \
+ "select ci.item_id, r.title, ci.content_type, p.page_title, category_id from $sql" {
if {$page_title eq ""} {set page_title $title}
set itemobj [Object new]
set prefix ""
@@ -61,7 +70,8 @@
-orderby title \
-open_item [expr {$item_id == $open_item_id}]
}
- append content [$cattree(0) render -tree_style $tree_style]
+ append content [$cattree(0) render -tree_style $tree_style]
+ }
}
if {[info exists skin]} {
Index: openacs-4/packages/xowiki/www/portlets/last-visited.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/last-visited.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/xowiki/www/portlets/last-visited.tcl 18 Apr 2006 00:06:14 -0000 1.2
+++ openacs-4/packages/xowiki/www/portlets/last-visited.tcl 30 Apr 2006 23:53:35 -0000 1.3
@@ -7,13 +7,13 @@
::xowiki::Page requireCSS "/resources/acs-templating/lists.css"
-if {![info exists max_entries]} {set max_entries 20}
-if {![info exists user_id]} {set user_id [ad_conn user_id]}
-if {![info exists package_id]} {set package_id [ad_conn package_id]}
-
# get the folder id from the including page
set folder_id [$__including_page set parent_id]
+if {![info exists max_entries]} {set max_entries 20}
+if {![info exists user_id]} {set user_id [ad_conn user_id]}
+if {![info exists package_id]} {set package_id [$folder_id set package_id]}
+
TableWidget t1 -volatile \
-columns {
AnchorField title -label [_ xowiki.page_title]
Index: openacs-4/packages/xowiki/www/portlets/most-popular.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/most-popular.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/portlets/most-popular.tcl 13 Apr 2006 19:19:37 -0000 1.1
+++ openacs-4/packages/xowiki/www/portlets/most-popular.tcl 30 Apr 2006 23:53:35 -0000 1.2
@@ -7,12 +7,12 @@
::xowiki::Page requireCSS "/resources/acs-templating/lists.css"
-if {![info exists max_entries]} {set max_entries 20}
-if {![info exists package_id]} {set package_id [ad_conn package_id]}
-
# get the folder id from the including page
set folder_id [$__including_page set parent_id]
+if {![info exists max_entries]} {set max_entries 20}
+if {![info exists package_id]} {set package_id [$folder_id set package_id]}
+
TableWidget t1 -volatile \
-columns {
AnchorField title -label [_ xowiki.page_title]
Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog-mini-calendar.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.adp 30 Apr 2006 23:53:35 -0000 1.1
@@ -0,0 +1,49 @@
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ @days_of_week.day_short@ |
+
+
+
+
+
+
+
+
+
+
+ @days.count@ @days.day_number@ |
+
+ @days.day_number@ |
+
+
+
+
+
+
+
+
+
+ |
+
+
Index: openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog-mini-calendar.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 30 Apr 2006 23:53:35 -0000 1.1
@@ -0,0 +1,143 @@
+::xowiki::Page requireCSS "/resources/calendar/calendar.css"
+set folder_id [$__including_page set parent_id]
+set including_item_id [$__including_page set item_id]
+
+if {![exists_and_not_null base_url]} {
+ set base_url [ad_conn url]
+}
+
+set date [ns_queryget date]
+if {![exists_and_not_null date]} {
+ set date [dt_sysdate]
+}
+
+if {[exists_and_not_null page_num]} {
+ set page_num_formvar [export_form_vars page_num]
+ set page_num "&page_num=$page_num"
+} else {
+ set page_num_formvar ""
+ set page_num ""
+}
+
+set url_stub_period_days ""
+
+array set message_key_array {
+ list #acs-datetime.List#
+ day #acs-datetime.Day#
+ week #acs-datetime.Week#
+ month #acs-datetime.Month#
+}
+
+# Get the current month, day, and the first day of the month
+if {[catch {
+ dt_get_info $date
+} errmsg]} {
+ set date [dt_sysdate]
+ dt_get_info $date
+}
+
+set now [clock scan $date]
+set date_list [dt_ansi_to_list $date]
+set year [dt_trim_leading_zeros [lindex $date_list 0]]
+set month [dt_trim_leading_zeros [lindex $date_list 1]]
+set day [dt_trim_leading_zeros [lindex $date_list 2]]
+
+set months_list [dt_month_names]
+set curr_month_idx [expr {[dt_trim_leading_zeros [clock format $now -format "%m"]]-1}]
+
+set curr_month [lindex $months_list $curr_month_idx ]
+set prev_month [clock format [clock scan "1 month ago" -base $now] -format "%Y-%m-%d"]
+set next_month [clock format [clock scan "1 month" -base $now] -format "%Y-%m-%d"]
+set prev_month_url "$base_url?date=[ad_urlencode $prev_month]${page_num}${url_stub_period_days}"
+set next_month_url "$base_url?date=[ad_urlencode $next_month]${page_num}${url_stub_period_days}"
+
+set first_day_of_week [lc_get firstdayofweek]
+set week_days [lc_get abday]
+multirow create days_of_week day_short
+for {set i 0} {$i < 7} {incr i} {
+ multirow append days_of_week [lindex $week_days [expr {($i + $first_day_of_week) % 7}]]
+}
+
+db_foreach entries_this_month "select count(ci.item_id), date_trunc('day',p.publish_date) as d \
+ from xowiki_pagei p, cr_items ci \
+ where ci.parent_id = $folder_id \
+ and ci.item_id = p.item_id and ci.live_revision = p.page_id \
+ and ci.content_type not in ('::xowiki::PageTemplate') \
+ and ci.item_id != $including_item_id \
+ and date_trunc('month', p.publish_date) = '$year-$month-01' \
+ group by d" {
+ set entries([lindex $d 0]) $count
+ }
+
+multirow create days day_number beginning_of_week_p end_of_week_p today_p active_p url count class
+
+set day_of_week 1
+
+# Calculate number of active days
+set active_days_before_month [expr {[dt_first_day_of_month $year $month] -1}]
+set active_days_before_month [expr {($active_days_before_month + 7 - $first_day_of_week) % 7}]
+
+set calendar_starts_with_julian_date [expr {$first_julian_date_of_month - $active_days_before_month}]
+set day_number [expr {$days_in_last_month - $active_days_before_month + 1}]
+
+for {set julian_date $calendar_starts_with_julian_date} {$julian_date <= $last_julian_date + 7} {incr julian_date} {
+
+ if {$julian_date > $last_julian_date_in_month && $end_of_week_p eq "t" } {
+ break
+ }
+ set today_p f
+ set active_p t
+
+ if {$julian_date < $first_julian_date_of_month} {
+ set active_p f
+ } elseif {$julian_date > $last_julian_date_in_month} {
+ set active_p f
+ }
+ set ansi_date [dt_julian_to_ansi $julian_date]
+
+ if {$julian_date == $first_julian_date_of_month} {
+ set day_number 1
+ } elseif {$julian_date == $last_julian_date_in_month +1} {
+ set day_number 1
+ }
+
+ if {$julian_date == $julian_date_today} {
+ set today_p t
+ }
+
+ if { $day_of_week == 0} {
+ set beginning_of_week_p t
+ } else {
+ set beginning_of_week_p f
+ }
+
+ if { $day_of_week == 7 } {
+ set day_of_week 0
+ set end_of_week_p t
+ } else {
+ set end_of_week_p f
+ }
+
+ # ns_log notice "--D julian_date = $julian_date [dt_julian_to_ansi $julian_date] //$ansi_date"
+ set count [expr {[info exists entries($ansi_date)] ? "($entries($ansi_date))" : ""}]
+ if {$today_p} {
+ set class today
+ } elseif {$active_p} {
+ set class active
+ } else {
+ set class inactive
+ }
+ multirow append days $day_number $beginning_of_week_p $end_of_week_p $today_p $active_p \
+ "[export_vars -base $base_url {{date $ansi_date}}]${url_stub_period_days}" $count $class
+ incr day_number
+ incr day_of_week
+}
+
+
+set today_url "$base_url?date=[ad_urlencode [dt_sysdate]]${page_num}${url_stub_period_days}"
+if {[dt_sysdate] eq $date} {
+ set today_p t
+} else {
+ set today_p f
+}
+
Index: openacs-4/packages/xowiki/www/portlets/weblog.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/weblog.adp 30 Apr 2006 23:53:35 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+
+ @filter_msg@
+
+ @content;noquote@
+
+
+
+
+
+
+
+
Index: openacs-4/packages/xowiki/www/portlets/weblog.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/weblog.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/portlets/weblog.tcl 30 Apr 2006 23:53:35 -0000 1.1
@@ -0,0 +1,119 @@
+# $Id: weblog.tcl,v 1.1 2006/04/30 23:53:35 gustafn Exp $
+# display items
+# -gustaf neumann
+#
+# valid parameters from the include are
+# page_size: show given number of new entries per page
+
+::xowiki::Page requireCSS "/resources/xowiki/weblog.css"
+
+# get the folder id from the including page
+set folder_id [$__including_page set parent_id]
+
+if {![info exists package_id]} {set package_id [$folder_id set package_id]}
+if {![info exists page_size]} {set page_size 10}
+
+set filter_msg ""
+set page_number [ns_queryget page_number 1]
+set page_size [ns_queryget page_size $page_size]
+set date [ns_queryget date]
+set category_id [ns_queryget category_id]
+
+$__including_page set render_adp 0 ;# no double substitutions
+
+# set up filters
+if {$date ne ""} {
+ set date_clause "and date_trunc('day',p.publish_date) = '$date'"
+ set filter_msg "Filtered by date $date"
+} else {
+ set date_clause ""
+}
+if {$category_id ne ""} {
+ set cat_clause "and c.object_id = ci.item_id and c.category_id = $category_id"
+ set extra_from_clause ",category_object_map c"
+ set filter_msg "Filtered by category [::category::get_name $category_id]"
+} else {
+ set cat_clause ""
+ set extra_from_clause ""
+}
+
+# define item container
+set items [::xo::OrderedComposite new -proc render {} {
+ set content ""
+ foreach c [my children] {append content [$c render]}
+ return $content
+}]
+uplevel #0 $items volatile
+
+
+Class ::xowiki::WeblogEntry -instproc render {} {
+ append content "" \
+ "
" \
+ "
Created by [my set creator], " \
+ "[my set pretty_date]
" \
+ [my set description] \n \
+ "
"
+}
+
+set query \
+ [list -folder_id $folder_id \
+ -select_attributes [list p.publish_date] \
+ -order_clause "order by p.publish_date desc" \
+ -page_number $page_number -page_size $page_size \
+ -extra_from_clause $extra_from_clause \
+ -extra_where_clause "and ci.item_id != [$__including_page set item_id] $date_clause \
+ and ci.content_type not in ('::xowiki::PageTemplate') $cat_clause" \
+ ]
+
+set nr_items [db_string count [eval ::xowiki::Page select_query $query -count true]]
+
+db_foreach instance_select [eval ::xowiki::Page select_query $query] {
+ set p [::Generic::CrItem instantiate -item_id 0 -revision_id $page_id]
+
+ regexp {^([^.]+)[.][0-9]+(.*)$} $publish_date _ publish_date tz
+ set pretty_date [util::age_pretty -timestamp_ansi $publish_date \
+ -sysdate_ansi [clock_to_ansi [clock seconds]] \
+ -mode_3_fmt "%d %b %Y, at %X"]
+
+ #$p proc destroy {} {my log "--Render temporal object destroyed"; next}
+ $p set pretty_date $pretty_date
+
+ #ns_log notice "--Render object=$p, $page_id $title $page_title"
+ if {[catch {$p set description [$p render]} errorMsg]} {
+ ns_log notice "--Render Error ($errorMsg) $page_id $title $page_title"
+ continue
+ }
+ #ns_log notice "--Render DONE $page_id $title $page_title"
+ $items add $p
+}
+
+::xowiki::Page instmixin add ::xowiki::WeblogEntry
+set content [$items render]
+::xowiki::Page instmixin delete ::xowiki::WeblogEntry
+
+proc ::xo::update_query_variable {old_query var value} {
+ set query [list [list $var $value]]
+ foreach pair [split $old_query &] {
+ foreach {key value} [split $pair =] break
+ if {$key eq $var} continue
+ lappend query [list [ns_urldecode $key] [ns_urldecode $value]]
+ }
+ return $query
+}
+
+if {$filter_msg eq ""} {
+ set filter_msg "Showing [llength [$items children]] of $nr_items Postings"
+}
+
+set next_p [expr {$nr_items > $page_number*$page_size}]
+set prev_p [expr {$page_number > 1}]
+
+if {$next_p} {
+ set query [::xo::update_query_variable [ns_conn query] page_number [expr {$page_number+1}]]
+ set next_page [export_vars -base [ad_conn url] $query]
+}
+if {$prev_p} {
+ set query [::xo::update_query_variable [ns_conn query] page_number [expr {$page_number-1}]]
+ set prev_page [export_vars -base [ad_conn url] $query]
+}
+set link [ad_conn url]
\ No newline at end of file
Index: openacs-4/packages/xowiki/www/resources/bracket.gif
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/bracket.gif,v
diff -u
Binary files differ
Index: openacs-4/packages/xowiki/www/resources/cattree.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/cattree.css,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/xowiki/www/resources/cattree.css 18 Apr 2006 00:06:15 -0000 1.1
+++ openacs-4/packages/xowiki/www/resources/cattree.css 30 Apr 2006 23:53:35 -0000 1.2
@@ -1,9 +1,9 @@
/* Put this inside a @media qualifier so Netscape 4 ignores it */
@media screen {
/* Turn off list bullets */
- ul.mktree li { list-style: none; }
+ ul.mktree li { list-style: none}
/* Control how "spaced out" the tree is */
- ul.mktree, ul.mktree ul , ul.mktree li { margin-left:1px; }
+ ul.mktree, ul.mktree ul , ul.mktree li { margin-left:0px; padding-left: 7px;}
/* Provide space for our own "bullet" inside the LI */
ul.mktree li .bullet { padding-left: 15px; }
/* Show "bullets" in the links, depending on the class of the LI that the link's in */
Index: openacs-4/packages/xowiki/www/resources/weblog.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/weblog.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/resources/weblog.css 30 Apr 2006 23:53:35 -0000 1.1
@@ -0,0 +1,26 @@
+.filter {
+ float: right;
+ font-size: 85%;
+ color: #9a9a9b;
+}
+.post p.auth {
+ padding: 0 0 0 12px;
+ font-size: 85%;
+ margin-left: 10px;
+ font-weight: bold;
+ color: #9a9a9b;
+ background: url(/resources/xowiki/bracket.gif) no-repeat;
+}
+
+.post h2 {
+ font: normal 140%/1.3em Arial, Verdana, Helvetica, sans-serif;
+}
+
+.post h2 a {
+ text-decoration: none;
+ border: none;
+}
+
+.post {
+ font-size: 90%;
+}
\ No newline at end of file