Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.43 -r1.44 --- openacs-4/packages/xowiki/xowiki.info 30 Jan 2007 11:36:06 -0000 1.43 +++ openacs-4/packages/xowiki/xowiki.info 19 Feb 2007 10:01:28 -0000 1.44 @@ -8,41 +8,108 @@ f xowiki - + Gustaf Neumann A more generic xotcl-based wikis example with object types and subtypes based on the content repository (with category support) - 2007-01-30 - 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). 0.26 provides Weblog support. 0.27: alignment with xotcl-core 0.38 (use cr_item.name instead of cr_revisions.title), change page_title to title (potential incompatibility) to rely more strictly to the CR data model (most files are effected). 0.28: tag and improved weblog support. 0.30: symbolic oo interface, nicer links, permission management. 0.31: per package search. 0.32: new class ::xowiki::File for [[file:readme.pdf]] and [[image:picture.jpg]] 0.33: direct inclusion of xowiki pages via {{en:mypage}}, simpler default pages (see xowiki/www/default-pages). 0.34: notifications; 0.36: prototypes, direct includes, context handling; 0.37: initial reqression testing (118 tests); -0.38: production_mode, virtual presence, google-sitemap. -0.39: version diff, provide image properties in xowiki-pages, specify how links can be generated; -0.41: book-style (toc and book portlet, based on yui treeview), use language prefix to avoid clashes, ltree (for ordering) -0.44: dotlrn portlet support + 2007-02-19 + <pre> +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 OpenACS (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 different kind of word relationships (like synonyms, +etc.). XoWiki supports pages in multiple languages and is localized +(currently only for English and German). Currently, rich-text 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-based 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.27: alignment with xotcl-core + +0.28 (use cr_item.name instead of cr_revisions.title), change +page_title to title (potential incompatibility) to rely more strictly +to the CR data model (most files are effected). + +0.29: tag and improved weblog support. + +0.30: +symbolic OO interface, nicer links, permission management. + +0.31: per +package search. + +0.32: new class ::xowiki::File for [[file:readme.pdf]] and +[[image:picture.jpg]] + +0.33: direct inclusion of XoWiki pages via {{en:mypage}}, simpler +default pages (see xowiki/www/default-pages). + +0.34: notifications; + +0.36: prototypes, direct includes, context handling; + +0.37: initial regression testing (118 tests); + +0.38: production_mode, virtual presence, google-sitemap. + +0.39: version diff, provide image properties in XoWiki-pages, specify +how links can be generated; + +0.42: book-style (toc and book portlet, based on YUI treeview), use +language prefix to avoid clashes, ltree (for ordering); + +0.43: support for views package + +0.44: DotLRN portlet support + +0.45: auto-naming of pages + +0.46: support for announcement style configuration +</pre> BSD-Style 0 - + - + - + + + @@ -51,12 +118,12 @@ - + - Index: openacs-4/packages/xowiki/tcl/notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/notification-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/tcl/notification-procs.tcl 30 Dec 2006 01:55:17 -0000 1.4 +++ openacs-4/packages/xowiki/tcl/notification-procs.tcl 19 Feb 2007 10:01:28 -0000 1.5 @@ -85,7 +85,7 @@ if {[$page set publish_status] eq "production"} { # don't do notification for pages under construction - ns_log notice "--n xowiki::notification NO NOTIFCATION XXX" + ns_log notice "--n xowiki::notification NO NOTIFCATION due to production state" return } 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.37 -r1.38 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 18 Feb 2007 02:58:12 -0000 1.37 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 19 Feb 2007 10:01:28 -0000 1.38 @@ -153,8 +153,15 @@ #my proc destroy {} {my log "--P "; next} } - Package instproc get_parameter {attribute {default ""}} { + Package ad_instproc get_parameter {attribute {default ""}} { + resolves configurable parameters according to the following precedence: + (1) values specifically set per page {{set-parameter ...}} + (2) query parameter + (3) per instance parameters from the folder object (computable) + (4) standard OpenACS package parameter + } { set value [::xo::cc get_parameter $attribute] + if {$value eq ""} {set value [my query_parameter $attribute]} if {$value eq ""} {set value [::[my folder_id] get_payload $attribute]} if {$value eq ""} {set value [next]} return $value @@ -257,6 +264,12 @@ } } } + if {[string match //* $object]} { + # we have a reference to another instance, we cant resolve this from this package. + # Report back not found + return "" + } + #my log "--o object is '$object'" if {$object eq ""} { # we have no object, but as well no method callable on the package @@ -476,9 +489,9 @@ reindex all items of this package } { my instvar folder_id - set pages [db_list get_pages "select page_id from xowiki_page, cr_revisions r, cr_items i \ - where page_id = r.revision_id and i.item_id = r.item_id and i.parent_id = $folder_id \ - and i.live_revision = page_id"] + set pages [db_list get_pages "select page_id from xowiki_page, cr_revisions r, cr_items ci \ + where page_id = r.revision_id and ci.item_id = r.item_id and ci.parent_id = $folder_id \ + and ci.live_revision = page_id"] #my log "--reindex returns <$pages>" foreach page_id $pages { #search::queue -object_id $page_id -event DELETE @@ -611,6 +624,8 @@ Package ad_instproc rss { -maxentries + -name_filter + -title -days } { Report content of xowiki folder in rss 2.0 format. The @@ -624,29 +639,44 @@ } { set package_id [my id] set folder_id [::$package_id folder_id] + set extra_where_clause "" if {![info exists days] && [regexp {[^0-9]*([0-9]+)d} [my query_parameter rss] _ days]} { # setting the variable days } - + if {![info exists namefilter]} { + set name_filter [my get_parameter name_filter ""] + } + if {$name_filter ne ""} { + append extra_where_clause "and ci.name ~ E'$name_filter' " + } + if {![info exists title]} { + set title [my get_parameter title ""] + if {$title eq ""} { + set title [::$folder_id set title] + } + } + my log "--rss: title=$title" + set limit_clause [expr {[info exists maxentries] ? " limit $maxentries" : ""}] set timerange_clause [expr {[info exists days] ? " and p.last_modified > (now() + interval '$days days ago')" : ""}] set xmlMap { & & < < > > \" " ' ' } set content [my rss_head \ - -channel_title [string map $xmlMap [::$folder_id set title ]] \ + -channel_title [string map $xmlMap $title] \ -description [string map $xmlMap [::$folder_id set description]] \ -link [ad_url][site_node::get_url_from_object_id -object_id $package_id] \ ] db_foreach get_pages \ "select s.body, p.name, p.creator, p.title, p.page_id,\ p.object_type as content_type, p.last_modified, p.description \ - from xowiki_pagex p, syndication s, cr_items i \ - where i.parent_id = $folder_id and i.live_revision = s.object_id \ + from xowiki_pagex p, syndication s, cr_items ci \ + where ci.parent_id = $folder_id and ci.live_revision = s.object_id \ + and ci.publish_status <> 'production' $extra_where_clause \ and s.object_id = p.page_id $timerange_clause \ order by p.last_modified desc $limit_clause \ " { @@ -709,9 +739,9 @@ db_foreach get_pages \ "select s.body, p.name, p.creator, p.title, p.page_id,\ p.object_type as content_type, p.last_modified, p.description \ - from xowiki_pagex p, syndication s, cr_items i \ - where i.parent_id = $folder_id and i.live_revision = s.object_id \ - and s.object_id = p.page_id $timerange_clause \ + from xowiki_pagex p, syndication s, cr_items ci \ + where ci.parent_id = $folder_id and ci.live_revision = s.object_id \ + and s.object_id = p.page_id $timerange_clause \ order by p.last_modified desc $limit_clause \ " { #my log "--found $name" @@ -782,7 +812,7 @@ Package instproc edit-new {} { my instvar folder_id id set object_type [my query_parameter object_type "::xowiki::Page"] - set autoname [my query_parameter autoname 0] + set autoname [my get_parameter autoname 0] set page [$object_type new -volatile -parent_id $folder_id -package_id $id] return [$page edit -new true -autoname $autoname] } 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.6 -r1.7 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 15 Jan 2007 11:41:59 -0000 1.6 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 19 Feb 2007 10:01:28 -0000 1.7 @@ -12,14 +12,17 @@ ptag category_id filter_msg + {name_filter ""} + {entry_label "Postings"} {exclude_item_ids 0} {summary false} {entry_renderer ::xowiki::Weblog::Entry} } ::xowiki::Weblog instproc init {} { my instvar filter_msg package_id nr_items next_page_link prev_page_link - my instvar date category_id tag ptag page_number page_size summary items + my instvar date category_id tag ptag page_number page_size summary items + my instvar name_filter entry_label my log "--W starting" set folder_id [::$package_id set folder_id] @@ -63,6 +66,9 @@ append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :ptag " set query_parm "&ptag=[ad_urlencode $ptag]" } + if {$name_filter ne ""} { + append extra_where_clause "and ci.name ~ E'$name_filter' " + } # create an item container, which delegates rendering to its chidlren set items [::xo::OrderedComposite new -proc render {} { @@ -116,6 +122,8 @@ } } $p set pretty_date $pretty_date + $p set publish_date $publish_date + my log "--W setting $p set publish_date $publish_date" #$p proc destroy {} {my log "--Render temporal object destroyed"; next} #ns_log notice "--W Render object $p DONE $page_id $name $title " @@ -131,9 +139,9 @@ set range [expr {$nr > 1 ? "$from - $to" : $from}] if {$filter_msg ne ""} { - append filter_msg ", $range of $nr_items Postings (all, $flink)" + append filter_msg ", $range of $nr_items $entry_label (all, $flink)" } else { - append filter_msg "Showing $range of $nr_items Postings ($flink)" + append filter_msg "Showing $range of $nr_items $entry_label ($flink)" } set next_p [expr {$nr_items > $page_number*$page_size}] 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.29 -r1.30 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 17 Feb 2007 19:41:08 -0000 1.29 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 19 Feb 2007 10:01:28 -0000 1.30 @@ -50,12 +50,16 @@ {autoname 0} } + WikiForm instproc show_page_order {} { + my instvar data + return [expr {[::xo::db::has_ltree] && [[$data package_id] get_parameter display_page_order 1]}] + } WikiForm instproc mkFields {} { my instvar data autoname set __fields "" set field_list [my field_list] - if {[::xo::db::has_ltree]} {set field_list [linsert $field_list 2 page_order]} + if {[my show_page_order]} {set field_list [linsert $field_list 2 page_order]} if {$autoname} { my f.name {name:text(hidden),optional} } @@ -257,6 +261,7 @@ WikiForm instproc new_data {} { my instvar data my data_from_form -new 1 + $data set __autoname_prefix [string range [$data set nls_language] 0 1]: set item_id [next] $data set creation_user [ad_conn user_id] my update_references Index: openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/Attic/xowiki-portlet-procs.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 27 Jan 2007 17:29:57 -0000 1.23 +++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 19 Feb 2007 10:01:28 -0000 1.24 @@ -102,9 +102,12 @@ # use "span" to specify parameters to the rss call my initialize -parameter { {-span "10d"} + {-name_filter} + {-title} } my get_parameters - return "RSS" + set href [export_vars -base [$package_id package_url] {{rss $span} name_filter title}] + return "RSS" } ############################################################################# @@ -653,7 +656,7 @@ } set parent_node [expr {[info exists node($parent)] ? $node($parent) : "root"}] set refvar [expr {[my set ajax] ? "ref" : "href"}] - my log "$jsobj = {label: \"$label\", id: \"$id\", $refvar: \"$href\", c: $node_cnt};" + #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" \ @@ -662,7 +665,7 @@ } set navigation(count) $node_cnt - my log "--COUNT=$node_cnt" + #my log "--COUNT=$node_cnt" return $js } 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.74 -r1.75 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 17 Feb 2007 23:01:36 -0000 1.74 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 19 Feb 2007 10:01:28 -0000 1.75 @@ -301,7 +301,10 @@ } Page instproc include_portlet {arg} { - my instvar package_id + # 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] + # do we have a wellformed list? if {[catch {set page_name [lindex $arg 0]} errMsg]} { #my log "--S arg='$arg'" @@ -321,6 +324,15 @@ } else { # we include a wiki page, tailorable set page [$package_id resolve_page $page_name __m] + if {[regexp {^/(/[^?]*)[?]?(.*)$} $page_name _ url query]} { + # here we handle cross package xowiki includes + ::xowiki::Package initialize -parameter {{-m view}} -url $url \ + -actual_query $query + if {$package_id != 0} { + set page [$package_id resolve_page [$package_id set object] __m] + } + #my log "--resolve --> $page" + } catch {$page set __decoration portlet} } 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.37 -r1.38 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 17 Feb 2007 16:28:55 -0000 1.37 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 19 Feb 2007 10:01:28 -0000 1.38 @@ -72,12 +72,13 @@ if {[$package_id get_parameter "with_notifications" 1]} { if {[::xo::cc user_id] != 0} { ;# notifications require login + set notifications_return_url [expr {[info exists return_url] ? $return_url : [ad_return_url]}] set notification_type [notification::type::get_type_id \ -short_name xowiki_notif] set notification_text "Subscribe the XoWiki instance" set notification_subscribe_link \ [export_vars -base /notifications/request-new \ - {return_url + {{return_url $notifications_return_url} {pretty_name $notification_text} {type_id $notification_type} {object_id $package_id}}] @@ -99,7 +100,7 @@ if {[info exists notification_image]} { set notification_text "Subscribe category $category_name in tree $tree_name" set cat_notif_link [export_vars -base /notifications/request-new \ - {return_url \ + {{return_url $notifications_return_url} \ {pretty_name $notification_text} \ {type_id $notification_type} \ {object_id $category_id}}] @@ -172,11 +173,12 @@ if {$master} { set context [list $title] - set object_type [my info class] + set autoname [$package_id get_parameter autoname 0] + set object_type [$package_id get_parameter object_type [my info class]] set rev_link [$package_id make_link [self] revisions] set edit_link [$package_id make_link [self] edit return_url] set delete_link [$package_id make_link [self] delete return_url] - set new_link [$package_id make_link $package_id edit-new object_type return_url] + set new_link [$package_id make_link $package_id edit-new object_type return_url autoname] set admin_link [$package_id make_link -privilege admin -url admin/ $package_id {} {}] set index_link [$package_id make_link -privilege public -url "" $package_id {} {}] set save_tag_link [$package_id make_link [self] save-tags] 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/announcements.page 19 Feb 2007 10:01:28 -0000 1.1 @@ -0,0 +1,118 @@ +# -*- tcl-*- +# $Id: announcements.page,v 1.1 2007/02/19 10:01:28 gustafn Exp $ +::xowiki::Object new -title "Announcements" -text { + # + # A sample Announcements object. + # + my initialize -parameter { + {-page_size:integer 10} + {-page_number:integer 1} + {-summary:boolean 0} + {-name_filter {:(0|1|2|3|4|5|6|7|8|9)}} + {-date ""} + {-tag ""} + {-ptag ""} + } + + # The name filter is not the most efficient way of selecting + # autonamed entries. However, most times the number of announcements items + # is not overwhelming, so we can live with that for the time being. + # TODO: more efficient selection of autonamed entries + + # + # The following definition is the default rendering per + # announcements entry. This is executed in the context of every displayed page. + # + Class create EntryRenderer -instproc render {} { + my instvar package_id name title creator creation_user pretty_date description publish_date + [my set __parent] instvar weblog_obj + + set link [::$package_id pretty_link $name] + set more [expr {[$weblog_obj summary] ? + " \[#xowiki.weblog-more#\]" : ""}] + append more "

" + set day [lc_time_fmt [my set publish_date] "%x"] + + append content "
" \ + "

$title

" \ + " ($day)
" \ + $description $more \n\ + "
" + } + + # + # The following definition is the renderer for the full weblog. + # This is executed in the context of the whole weblog object + # + Class create AnnouncementsRenderer -instproc render {} { + my instvar filter_msg link name prev_page_link next_page_link name_filter title + + set filter "" + set prev "" + set next "" + + if {[info exists filter_msg]} { + set filter "
$filter_msg
" + } + if {[info exists prev_page_link]} { + set prev "\ + Previous Page" + } + if {[info exists next_page_link]} { + set next "\ + Next Page" + } + set page [my set __page] + set rss [$page include_portlet \ + "rss-button -name_filter {$name_filter} -title {[$page title]}"] + #set rss [list [self] [lsort [my info vars]]] + return "
$filter [next] $prev $next
$rss
" + } + + my proc content {} { + my get_parameters + set page [my info parent] + + if {[$page exists __including_page]} { + set i [$page set __including_page] + set exclude_item_ids [$i item_id] + $i set render_adp 0 ;# no double substitutions + #my log "--W including page $i" + } else { + #my log "--W NO including page" + set exclude_item_ids [$page item_id] + } + + # on the announcements page, an edit-new should not create an object + ::xo::cc set_parameter object_type ::xowiki::Page + ::xo::cc set_parameter autoname 1 + + # use the above defined custom renderers + set renderer [self]::AnnouncementsRenderer + set entry_renderer [self]::EntryRenderer + + set w [::xowiki::Weblog new -destroy_on_cleanup \ + -package_id $package_id \ + -page_size $page_size \ + -page_number $page_number \ + -summary $summary \ + -date $date \ + -category_id [ns_queryget category_id] \ + -tag $tag \ + -ptag $ptag \ + -name_filter $name_filter \ + -entry_label "Announcements" \ + -exclude_item_ids $exclude_item_ids \ + -entry_renderer $entry_renderer \ + ] + $w set __page $page + $w mixin add $renderer + return [$w render] + } + +} + + + 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.3 -r1.4 --- openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 17 Feb 2007 23:01:36 -0000 1.3 +++ openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 19 Feb 2007 10:01:28 -0000 1.4 @@ -76,6 +76,9 @@ set exclude_item_ids [$page item_id] } + # on the weblog-portlet page, an edit-new should not create an object + ::xo::cc set_parameter object_type ::xowiki::Page + # the default renderer #set renderer ::xowiki::Weblog::WeblogRenderer #set entry_renderer ::xowiki::Weblog::EntryRenderer