Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.14 -r1.15 --- openacs-4/packages/xowiki/xowiki.info 24 Apr 2006 08:24:04 -0000 1.14 +++ openacs-4/packages/xowiki/xowiki.info 30 Apr 2006 23:53:34 -0000 1.15 @@ -8,24 +8,24 @@ f xowiki - + Gustaf Neumann A more generic xotcl-based wikis example with object types and subtypes based on the content repository (with category support) - 2006-04-23 + 2006-05-01 XoWiki is a wiki implementation for OpenACS in xotcl. Instead of trying to implement the full set of wiki markup commands of systems like MediaWiki, XoWiki is based on a rich text editor and focuses more on integration with oacs (e.g categories, general comments, adp-includes). XoWiki combines aspects of wikis (ease of page-creation) with aspects of a content management system (revisions, re-usable items, multiple languages). Furthermore, XoWiki allows to define different types of links such -one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking. 0.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). +one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German). Currently, richtext and plaintext type entries are supported. Included support for adp-substitution in wiki pages and a file-selector. 0.13 supports page templates and uses the new generic form interface. Use of the oo layer for the content repository, reduced number of database interactions.0.18 supports text/enhanced, nice page names, import/export. Support for search (::xowiki::Page and ::xowiki::PlainPage); 0.20 support ::xowiki::Object, directory object, rss generation into syndication table, improved admin pages; 0.21: ajax-ased chat added, new attributes creator and page_title for all xowiki::Pages; 0.22 improved permission checking. 0.24 provides link-types, more includeletes (most-recently viewed, most frequently accessed pages). 0.26 provides Weblog support. 0 - + Index: openacs-4/packages/xowiki/tcl/category-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/category-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xowiki/tcl/category-procs.tcl 24 Apr 2006 08:24:04 -0000 1.5 +++ openacs-4/packages/xowiki/tcl/category-procs.tcl 30 Apr 2006 23:53:34 -0000 1.6 @@ -16,17 +16,17 @@ if {![my isobject $items]} { ::xo::OrderedComposite create $items if {[info exists orderby]} { - set direction [expr {$increasing?"increasing":"decreasing"}] + set direction [expr {$increasing ? "increasing" : "decreasing"}] $items orderby -order $direction $orderby } } $items add $itemobj if {$open_item} { - $category openTree + $category open_tree $itemobj set open_item 1 } } - CatTree instproc openTree {} {;} + CatTree instproc open_tree {} {;} CatTree instproc render {{-tree_style:boolean false}} { if {$tree_style} { @@ -49,12 +49,12 @@ # Class Category -superclass ::xo::OrderedComposite -parameter { - level label pos category_id {open_requests 0} + level label pos category_id {open_requests 0} count {href ""} } #Category instproc destroy {} {my log --; next} - Category instproc openTree {} { + Category instproc open_tree {} { my set open_requests 1 - if {[my exists __parent]} {[my set __parent] openTree} + if {[my exists __parent]} {[my set __parent] open_tree} } Category instproc render {} { @@ -67,6 +67,11 @@ } foreach c [my children] {append cat_content [$c render] \n} append content [my render_category -open [expr {[my set open_requests]>0}] $cat_content] + } elseif {[my open_requests]>0} { + set cat_content "" + foreach c [my children] {append cat_content [$c render] \n} + append content [my render_category -open true $cat_content] + } return $content } @@ -84,7 +89,8 @@ } Category instproc render_category {{-open:boolean false} cat_content} { set open_state [expr {[my set open_requests]>0?"class='liOpen'" : "class='liClosed'"}] - return "
  • [my label]\n
      $cat_content
    \n" + set c [expr {[my exists count] ? "([my count])" : ""}] + return "
  • [my label] $c\n
      $cat_content
    \n" } # Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 24 Apr 2006 08:24:04 -0000 1.1 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 30 Apr 2006 23:53:34 -0000 1.2 @@ -27,7 +27,7 @@ {text:richtext(richtext),nospell,optional {label #xowiki.content#} {options {editor xinha plugins { - GetHtml CharacterMap ContextMenu FullScreen + GetHtml CharacterMap ContextMenu FullScreen InsertAnchor ListType TableOperations EditTag LangMarks Abbreviation OacsFs } height 350px}} {html {rows 15 cols 50 style {width: 100%}}}} 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.30 -r1.31 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 24 Apr 2006 08:24:04 -0000 1.30 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 30 Apr 2006 23:53:34 -0000 1.31 @@ -306,7 +306,7 @@ order by p.last_modified desc $limit_clause \ " { - if {[string match ::* $title]} continue + if {[string match "::*" $title]} continue if {$content_type eq "::xowiki::PageTemplate::"} continue set description [string trim $description] @@ -329,7 +329,7 @@ } append content [my rss_tail] - set t text/plain + #set t text/plain set t text/xml ns_return 200 $t $content } @@ -475,6 +475,60 @@ append msg "$added objects inserted, $replaced objects replaced

    " } + Page ad_proc select_query { + {-select_attributes ""} + {-order_clause ""} + {-where_clause ""} + {-count:boolean false} + {-folder_id} + {-page_size 20} + {-page_number ""} + {-syndication:boolean false} + {-extra_where_clause ""} + {-extra_from_clause ""} + } { + returns the SQL-query to select the xowiki pages of the specified folder + @select_attributes attributes for the sql query to be retrieved, in addion + to ci.item_id acs_objects.object_type, which are always returned + @param order_clause clause for ordering the solution set + @param where_clause clause for restricting the answer set + @param count return the query for counting the solutions + @param folder_id parent_id + @return sql query + } { + my instvar object_type_key + if {![info exists folder_id]} {my instvar folder_id} + + set attributes [list ci.item_id p.page_id] + foreach a $select_attributes { + if {$a eq "title"} {set a p.title} + lappend attributes $a + } + if {$count} { + set attribute_selection "count(*)" + set order_clause "" ;# no need to order when we count + set page_number "" ;# no pagination when count is used + } else { + set attribute_selection [join $attributes ,] + } + + if {$where_clause ne ""} {set where_clause "and $where_clause "} +# if {$syndication} { +# append where_clause "and syndication.object_id = p.page_id" +# set extra_tables ", syndication " +# } else { +# set extra_tables "" +# } + if {$page_number ne ""} { + set pagination "offset [expr {$page_size*($page_number-1)}] limit $page_size" + } else { + set pagination "" + } + return "select $attribute_selection from xowiki_pagei p, cr_items ci $extra_from_clause \ + where ci.parent_id = $folder_id and ci.item_id = p.item_id and \ + ci.live_revision = p.page_id $where_clause $extra_where_clause $order_clause $pagination" + } + # # data definitions # @@ -490,18 +544,20 @@ } Page set recursion_count 0 Page array set RE { - include {{{(.+)}}[ \n\r]*} - anchor {\\\[\\\[([^\]]+)\\\]\\\]} - div { *(
    *)?>>([^&]*)<<} + include {([^\\]){{(.+)}}[ \n\r]*} + anchor {([^\\])\\\[\\\[([^\]]+)\\\]\\\]} + div {()([^\\])>>([^&]*)<<} + clean {[\\](\{\{|>>|\[\[)} } PlainPage parameter { {render_adp 0} } PlainPage array set RE { - include {{{(.+)}}[ \n\r]} - anchor {\\\[\\\[([^\]]+)\\\]\\\]} - div {()>>([^<]*)<<} + include {([^\\]){{(.+)}}[ \n\r]} + anchor {([^\\])\\\[\\\[([^\]]+)\\\]\\\]} + div {()([^\\])>>([^<]*)<<} + clean {[\\](\{\{|>>|\[\[)} } PageTemplate parameter { @@ -517,50 +573,54 @@ "\[$cmd\]"] } - Page instproc include arg { + Page instproc include {ch arg} { [self class] instvar recursion_depth if {[regexp {^adp (.*)$} $arg _ adp]} { - if {[catch {lindex $adp 0}]} { + if {[catch {lindex $adp 0} errMsg]} { # there is something syntactically wrong - return $arg + return "${ch}Error in '{{$arg}}' in [my set title]
    \n\ + Syntax: adp <name of adp-file> {<argument list>}
    \n + Invalid argument list: '$adp_args'; must be attribute value pairs (even number of elements)" } set adp [string map {  " "} $adp] set adp_fn [lindex $adp 0] if {![string match "/*" $adp_fn]} {set adp_fn /packages/xowiki/www/$adp_fn} set adp_args [lindex $adp 1] if {[llength $adp_args] % 2 == 1} { - return "Error in '{{$arg}}'
    \n\ + return "${ch}Error in '{{$arg}}'
    \n\ Syntax: adp <name of adp-file> {<argument list>}
    \n Invalid argument list: '$adp_args'; must be attribute value pairs (even number of elements)" } lappend adp_args __including_page [self] if {[catch {set page [template::adp_include $adp_fn $adp_args]} errorMsg]} { - return "Error during evaluation of '{{$arg}}'
    \n\ + error "${ch}Error during evaluation of '{{$arg}}' in [my set title]
    \n\ adp_include returned error message: $errorMsg
    \n" } - return $page + + return $ch$page } } - Page instproc div arg { + Page instproc div {ch arg} { if {$arg eq "content"} { - return "

    " - } elseif {[lsearch [list \ - left-col left-col25 left-col30 \ - right-col right-col25 right-col30 right-col70] \ - $arg] > -1} { - return "
    " + return "$ch
    " + } 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 @@ + + + + + + + + +
    + + + + + + +
    + #calendar.prev_month# + @curr_month@ @year@ + #calendar.next_month# +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    @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 @@ +
    +@name@ +
    +
    +
    + +
    @filter_msg@
    +
    + @content;noquote@ + + previous page + + + next page

    + +

    +
    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 "
    " \ + "

    [my set page_title]

    " \ + "

    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