Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.25 -r1.26 --- openacs-4/packages/xowiki/xowiki.info 10 Aug 2006 08:32:06 -0000 1.25 +++ openacs-4/packages/xowiki/xowiki.info 17 Aug 2006 01:44:25 -0000 1.26 @@ -8,36 +8,37 @@ 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-08-10 + 2006-08-16 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 +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 BSD-Style 0 - + - + + Index: openacs-4/packages/xowiki/lib/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/lib/view.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/lib/view.tcl 9 Aug 2006 00:37:52 -0000 1.3 +++ openacs-4/packages/xowiki/lib/view.tcl 17 Aug 2006 01:44:25 -0000 1.4 @@ -1,28 +1,21 @@ +set parameter [subst { + {-m view} + {-return_url "[ns_conn url]"} + {-template_file "view-links"} + {-folder_id 0} +}] if {[info exists url]} { # new style, the url is sufficient - regexp {^(/[^/]+)/?(.*)$} $url _ instance path - array set node_info [site_node::get -url $instance] - ns_log notice "--package_id = $node_info(package_id) instance=$instance path=$path" - set package_id $node_info(package_id) - set Package [::xowiki::Package create ::$package_id -folder_id 0 -use_ns_conn false] - $Package set_url -url $url + ::xowiki::Package initialize -parameter $parameter -url $url } else { # old style, use item_id - set m view - set page [::xowiki::Package instantiate_page_from_id -item_id $item_id] - $page instvar package_id - set Package ::$package_id + set page [::xowiki::Package instantiate_page_from_id \ + -item_id $item_id -parameter $parameter] + ::xo::cc export_vars } -::xowiki::Package process_query \ - -defaults [list m view \ - edit_return_url [ns_conn url] \ - template_file "view-links" \ - folder_id 0 \ - package_id $package_id] -set html [$Package invoke -method $m] - +set html [::$package_id invoke -method $m] set fn [get_server_root]/packages/xowiki/www/resources/xowiki.css set F [open $fn]; set css [read $F]; close $F set css "" 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.8 -r1.9 --- openacs-4/packages/xowiki/tcl/category-procs.tcl 7 Jun 2006 17:08:24 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/category-procs.tcl 17 Aug 2006 01:44:26 -0000 1.9 @@ -16,8 +16,8 @@ if {![my isobject $items]} { ::xo::OrderedComposite create $items if {[info exists orderby]} { - set direction [expr {$increasing ? "increasing" : "decreasing"}] - $items orderby -order $direction $orderby + set direction [expr {$increasing ? "increasing" : "decreasing"}] + $items orderby -order $direction $orderby } } $items add $itemobj @@ -49,7 +49,7 @@ # Class Category -superclass ::xo::OrderedComposite -parameter { - level label pos category_id {open_requests 0} count {href ""} + package_id level label pos category_id {open_requests 0} count {href ""} } #Category instproc destroy {} {my log --; next} Category instproc open_tree {} { @@ -69,9 +69,9 @@ set content "" if {[my isobject [self]::items]} { foreach i [[self]::items children] { - $i instvar name title prefix suffix - set entry "$prefix$title$suffix" - append cat_content [my render_item -highlight [$i exists open_item] $entry] + $i instvar name title prefix suffix + set entry "$prefix$title$suffix" + append cat_content [my render_item -highlight [$i exists open_item] $entry] } foreach c [my children] {append cat_content [$c render] \n} append content [my render_category -open [expr {[my set open_requests]>0}] $cat_content] @@ -116,8 +116,7 @@ Category::section_style instproc render_category {{-open:boolean false} cat_content} { set section [expr {[my level] + 2}] return "[my label]\n

\ -

$cat_content
\n" +
$cat_content
\n" } - } Index: openacs-4/packages/xowiki/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/chat-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 9 Apr 2006 17:46:37 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 17 Aug 2006 01:44:26 -0000 1.9 @@ -17,16 +17,16 @@ set timelong [clock format [$child time]] set timeshort [clock format [$child time] -format {[%H:%M:%S]}] if {$user_id > 0} { - acs_user::get -user_id $user_id -array user - set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] - set url "/shared/community-member?user%5fid=$user_id" - set creator "$name" + acs_user::get -user_id $user_id -array user + set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] + set url "/shared/community-member?user%5fid=$user_id" + set creator "$name" } else { - set creator "Nobody" + set creator "Nobody" } append result "$timeshort\ - [my encode $creator]\ - [my encode $msg]\n" + [my encode $creator]\ + [my encode $msg]\n" } return $result } @@ -44,35 +44,36 @@ if {![info exists mode]} { set mode polling if {[info command ::thread::mutex] ne "" && - ![catch {ns_conn contentsentlength}]} { - # we seem to have libthread installed, and the patch for obtaining the tcl-stream - # from a connection thread, so we can use the background delivery thread; - # scripted streaming should work everywhere - set mode scripted-streaming - if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} { - # for firefox, we could use the nice mode without the spinning load indicator - set mode streaming - } + ![catch {ns_conn contentsentlength}]} { + # we seem to have libthread installed, and the patch for obtaining the tcl-stream + # from a connection thread, so we can use the background delivery thread; + # scripted streaming should work everywhere + set mode scripted-streaming + if {[regexp (firefox) [string tolower [ns_set get [ns_conn headers] User-Agent]]]} { + # for firefox, we could use the nice mode without the spinning load indicator + # currently, streaming mode seems broken with current firefox... + #set mode streaming + } } my log "--mode $mode" } switch $mode { polling { - ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" - set jspath packages/xowiki/www/ajax/chat.js - set login_url ${path}ajax/chat?m=login&$context - set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)" - set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)" + ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" + set jspath packages/xowiki/www/ajax/chat.js + set login_url ${path}ajax/chat?m=login&$context + set get_update "chatSendCmd(\"$path/ajax/chat?m=get_new&$context\",chatReceiver)" + set get_all "chatSendCmd(\"$path/ajax/chat?m=get_all&$context\",chatReceiver)" } streaming { - set jspath packages/xowiki/www/ajax/streaming-chat.js - set subscribe_url ${path}ajax/chat?m=subscribe&$context + set jspath packages/xowiki/www/ajax/streaming-chat.js + set subscribe_url ${path}ajax/chat?m=subscribe&$context } scripted-streaming { - append context &mode=scripted - set jspath packages/xowiki/www/ajax/scripted-streaming-chat.js - set subscribe_url ${path}ajax/chat?m=subscribe&$context + append context &mode=scripted + set jspath packages/xowiki/www/ajax/scripted-streaming-chat.js + set subscribe_url ${path}ajax/chat?m=subscribe&$context } } set send_url ${path}ajax/chat?m=add_msg&$context&msg= @@ -82,6 +83,8 @@ } set file [open [acs_root_dir]/$jspath]; set js [read $file]; close $file + my log "--CHAT mode=$mode" + switch $mode { polling {return "\ " + "" } return $result } @@ -176,7 +178,7 @@ @return sql query } { my instvar object_type_key - if {![info exists folder_id]} {my instvar folder_id} + #if {![info exists folder_id]} {my instvar folder_id} set attributes [list ci.item_id ci.name p.page_id] foreach a $select_attributes { @@ -199,16 +201,16 @@ } 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" + ci.live_revision = p.page_id $where_clause $extra_where_clause $order_clause $pagination" } Page proc rss_head { - -channel_title - -link - -description - {-language en-us} - } { + -channel_title + -link + -description + {-language en-us} + } { # return " \n\ - $creator \n\ - $title \n\ - $link \n\ - "" $guid \n\ - $description \n\ - $pubdate \n\ - \n + $creator \n\ + $title \n\ + $link \n\ + "" $guid \n\ + $description \n\ + $pubdate \n\ + \n } Page proc rss_tail {} { @@ -240,7 +242,7 @@ Page ad_proc rss { -maxentries -days - -package_id + -package_id:required } { Report content of xowiki folder in rss 2.0 format. The reporting order is descending by date. The title of the feed @@ -249,54 +251,50 @@ @param maxentries maximum number of entries retrieved @param days report entries changed in speficied last days - @param package_id to determine the xowiki instance (default from ad_conn) + @param package_id to determine the xowiki instance } { - if {![info exists package_id]} {set package_id [ad_conn package_id]} - # get the folder id from the including page - set folder_id [::xowiki::Page require_folder -name xowiki] - + set folder_id [::$package_id folder_id] + 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')" : ""}] + " 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 ]] \ - -description [string map $xmlMap [::$folder_id set description]] \ - -link [ad_url][site_node::get_url_from_object_id -object_id $package_id] \ - ] + -channel_title [string map $xmlMap [::$folder_id set 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 \ - and s.object_id = p.page_id $timerange_clause \ - order by p.last_modified desc $limit_clause \ - " { - - if {[string match "::*" $name]} continue - if {$content_type eq "::xowiki::PageTemplate::"} continue + "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 \ + order by p.last_modified desc $limit_clause \ + " { + + if {[string match "::*" $name]} continue + if {$content_type eq "::xowiki::PageTemplate::"} continue - set description [string trim $description] - if {$description eq ""} {set description $body} - regexp {^([^.]+)[.][0-9]+(.*)$} $last_modified _ time tz - - if {$title eq ""} {set title $name} - #append title " ($content_type)" - set time "[clock format [clock scan $time] -format {%a, %d %b %Y %T}] ${tz}00" - append content [my rss_item \ - -creator [string map $xmlMap $creator] \ - -title [string map $xmlMap $title] \ - -link [::xowiki::Page pretty_link \ - -package_id $package_id \ - -absolute true $name] \ - -guid [ad_url]/$page_id \ - -description [string map $xmlMap $description] \ - -pubdate $time \ - ] - } + set description [string trim $description] + if {$description eq ""} {set description $body} + regexp {^([^.]+)[.][0-9]+(.*)$} $last_modified _ time tz + + if {$title eq ""} {set title $name} + #append title " ($content_type)" + set time "[clock format [clock scan $time] -format {%a, %d %b %Y %T}] ${tz}00" + append content [my rss_item \ + -creator [string map $xmlMap $creator] \ + -title [string map $xmlMap $title] \ + -link [::$package_id pretty_link -absolute true $name] \ + -guid [ad_url]/$page_id \ + -description [string map $xmlMap $description] \ + -pubdate $time \ + ] + } append content [my rss_tail] #set t text/plain @@ -306,7 +304,7 @@ Page proc import {-user_id -package_id -folder_id {-replace 0} -objects} { set object_type [self] - if {![info exists folder_id]} {set folder_id [$object_type require_folder -name xowiki]} + if {![info exists folder_id]} {set folder_id [$object_type require_folder -name xowiki]} if {![info exists package_id]} {set package_id [ad_conn package_id]} if {![info exists user_id]} {set user_id [ad_conn user_id]} if {![info exists objects]} {set objects [$object_type allinstances]} @@ -322,104 +320,69 @@ if {[$o istype ::xowiki::PageInstance]} continue set item [CrItem lookup -name [$o set name] -parent_id $folder_id] if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item - set item 0 - incr replaced + ::Generic::CrItem delete -item_id $item + set item 0 + incr replaced } if {$item == 0} { - $o save_new - incr added + $o save_new + incr added } } foreach o $objects { if {[$o istype ::xowiki::PageInstance]} { - db_transaction { - set item [CrItem lookup -name [$o set name] -parent_id $folder_id] - if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item - set item 0 - incr replaced - } - if {$item == 0} { ;# the item does not exist -> update reference and save - set old_template_id [$o set page_template] - set template [CrItem lookup \ - -name [$old_template_id set name] \ - -parent_id $folder_id] - $o set page_template $template - $o save_new - incr added - } - } + db_transaction { + set item [CrItem lookup -name [$o set name] -parent_id $folder_id] + if {$item != 0 && $replace} { ;# we delete the original + ::Generic::CrItem delete -item_id $item + set item 0 + incr replaced + } + if {$item == 0} { ;# the item does not exist -> update reference and save + set old_template_id [$o set page_template] + set template [CrItem lookup \ + -name [$old_template_id set name] \ + -parent_id $folder_id] + $o set page_template $template + $o save_new + incr added + } + } } $o destroy } append msg "$added objects inserted, $replaced objects replaced

" } # - # URL and naming management + # conditional links, could go into package as well... # - Page proc pretty_link {{-absolute:boolean false} -lang -package_id name} { - my instvar folder_id - #my log "--u name=<$name>" - - if {![info exists package_id]} {set package_id [$folder_id set package_id]} - if {![my isobject ::$package_id]} { - my log "--u we create package ::xowiki::Package create ::$package_id -folder_id $folder_id" - ::xowiki::Package create ::$package_id -folder_id $folder_id - } - set url [::$package_id package_url] - - if {![info exists lang]} { - if {![regexp {^(..):(.*)$} $name _ lang name]} { - regexp {^(file|image):(.*)$} $name _ lang name - } - } - if {![info exists lang] && ![regexp {^(:|(file|image))} $name]} { - set lang [string range [lang::conn::locale] 0 1] - } - set host [expr {$absolute ? [ad_url] : ""}] - if {[info exists lang]} { - return $host${url}$lang/[ad_urlencode $name] - } else { - return $host${url}[ad_urlencode $name] - } - } - - Page proc normalize_name {-package_id string} { - set string [string trim $string] - # if subst_blank_in_name is turned on, turn spaces into _ - if {[$package_id get_parameter subst_blank_in_name 1] != 0} { - regsub -all { } $string "_" string - } - return $string - } - + Page instproc make_link {-privilege -url object method args} { my instvar package_id if {[info exists privilege]} { set granted [expr {$privilege eq "public" ? 1 : - [permission::permission_p -object_id $package_id -privilege $privilege] }] + [permission::permission_p -object_id $package_id -privilege $privilege] }] } else { # determine privilege from policy set granted [$package_id permission_p $object $method] - my log "--p $package_id permission_p $object $method ==> $granted" + #my log "--p $package_id permission_p $object $method ==> $granted" } if {$granted} { if {[$object istype ::xowiki::Package]} { - set base [$package_id package_url] - if {[info exists url]} { - return [uplevel export_vars -base [list $base$url] [list $args]] - } else { - lappend args [list $method 1] - return [uplevel export_vars -base [list $base] [list $args]] - } + set base [$package_id package_url] + if {[info exists url]} { + return [uplevel export_vars -base [list $base$url] [list $args]] + } else { + lappend args [list $method 1] + return [uplevel export_vars -base [list $base] [list $args]] + } } elseif {[$object istype ::xowiki::Page]} { - set base [$package_id url] - lappend args [list m $method] - return [uplevel export_vars -base [list $base] [list $args]] + set base [$package_id url] + lappend args [list m $method] + return [uplevel export_vars -base [list $base] [list $args]] } } return "" @@ -431,29 +394,29 @@ Page proc save_tags {-package_id:required -item_id:required -user_id:required tags} { db_dml delete_tags \ - "delete from xowiki_tags where item_id = $item_id and user_id = $user_id" + "delete from xowiki_tags where item_id = $item_id and user_id = $user_id" foreach tag $tags { db_dml insert_tag \ - "insert into xowiki_tags (item_id,package_id, user_id, tag, time) \ - values ($item_id, $package_id, $user_id, :tag, current_timestamp)" + "insert into xowiki_tags (item_id,package_id, user_id, tag, time) \ + values ($item_id, $package_id, $user_id, :tag, current_timestamp)" } } Page proc get_tags {-package_id:required -item_id -user_id} { if {[info exists item_id]} { if {[info exists user_id]} { - # tags for item and user - set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and item_id=$item_id and package_id=$package_id"] + # tags for item and user + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and item_id=$item_id and package_id=$package_id"] } else { - # all tags for this item - set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where item_id=$item_id and package_id=$package_id"] + # all tags for this item + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where item_id=$item_id and package_id=$package_id"] } } else { if {[info exists user_id]} { - # all tags for this user - set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and package_id=$package_id"] + # all tags for this user + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where user_id=$user_id and package_id=$package_id"] } else { - # all tags for the package - set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where package_id=$package_id"] + # all tags for the package + set tags [db_list get_tags "SELECT distinct tag from xowiki_tags where package_id=$package_id"] } } join $tags " " @@ -476,6 +439,18 @@ return 0 } +# Page instproc init {} { +# my log "--W " +# ::xo::show_stack +# next +# } + +# Page instproc destroy {} { +# my log "--W " +# ::xo::show_stack +# next +# } + Page instproc initialize_loaded_object {} { my instvar title creator if {[info exists title] && $title eq ""} {set title [my set name]} @@ -485,61 +460,78 @@ Page instproc regsub-eval {re string cmd} { subst [regsub -all $re [string map {\" \\\" \[ \\[ \] \\] \$ \\$ \\ \\\\} $string] \ - "\[$cmd\]"] + "\[$cmd\]"] } Page instproc include {ch arg} { [self class] instvar recursion_depth if {[regexp {^adp (.*)$} $arg _ adp]} { if {[catch {lindex $adp 0} errMsg]} { - # there is something syntactically wrong - return "${ch}Error in '{{$arg}}' in [my set name]
\n\ - Syntax: adp <name of adp-file> {<argument list>}
\n - Invalid argument list: '$adp'; must be attribute value pairs (even number of elements)" + # there is something syntactically wrong + return "${ch}Error in '{{$arg}}' in [my set name]
\n\ + Syntax: adp <name of adp-file> {<argument list>}
\n + Invalid argument list: '$adp'; 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 "${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)" + 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] set including_page_level [template::adp_level] if {[catch {set page [template::adp_include $adp_fn $adp_args]} errorMsg]} { - # in case of error, reset the adp_level to the previous value - set ::template::parse_level $including_page_level - return "${ch}Error during evaluation of '{{$arg}}' in [my set name]
\n\ - adp_include returned error message: $errorMsg
\n" + # in case of error, reset the adp_level to the previous value + set ::template::parse_level $including_page_level + return "${ch}Error during evaluation of '{{$arg}}' in [my set name]
\n\ + adp_include returned error message: $errorMsg
\n" } return $ch$page } else { + # we have a direct (adp-less include) my instvar package_id set page_name [lindex $arg 0] - set page [$package_id resolve_request -path $page_name] + if {[my isclass ::xowiki::portlet::$page_name]} { + # direct call, without page, not tailorable + set page [::xowiki::portlet::$page_name new \ + -package_id $package_id \ + -name $page_name \ + -actual_query [::xo::cc actual_query]] + } else { + # we include a page, tailorable + set page [$package_id resolve_page $page_name __m] + catch {$page set __decoration portlet} + } if {$page ne ""} { - $page volatile - $page set __including_page [self] - set skin portlet - foreach {att value} [lrange $arg 1 end] { - switch -- $att { - -skin {set skin $value} - } - } - if {$skin ne "plain"} {$page mixin add ::xowiki::Page::skin=$skin} - return $ch[$page render] + $page destroy_on_cleanup + $page set __including_page [self] + $page set __caller_parameters [lrange $arg 1 end] + #$page set __decoration portlet + foreach {att value} [$page set __caller_parameters] { + switch -- $att { + -decoration {$page set __decoration $value} + -title {$page set title $value} + } + } + if {[$page exists __decoration] && [$page set __decoration] ne "plain"} { + $page mixin add ::xowiki::portlet::decoration=[$page set __decoration] + } + return $ch[$page render] + } else { + return "${ch} $page_name unknown
\n" } } } Page instproc div {ch arg} { if {$arg eq "content"} { return "$ch

" } elseif {[string match left-col* $arg] \ - || [string match right-col* $arg] \ - || $arg eq "sidebar"} { + || [string match right-col* $arg] \ + || $arg eq "sidebar"} { return "$ch
" } elseif {$arg eq "box"} { return "$ch
" @@ -568,23 +560,23 @@ } else { # do we have a typed link? if {![regexp {^([^:][^:][^:]+):((..):)?(.+)$} $link _ link_type _ lang stripped_name]} { - # must be an untyped link; defaults, in case the second regexp does not match either - set lang "" - set link_type link - set stripped_name $link - regexp {^(..):(.+)$} $link _ lang stripped_name + # must be an untyped link; defaults, in case the second regexp does not match either + set lang "" + set link_type link + set stripped_name $link + regexp {^(..):(.+)$} $link _ lang stripped_name } } - set normalized_name [Page normalize_name -package_id $package_id $stripped_name] + set normalized_name [::$package_id normalize_name $stripped_name] if {$lang eq ""} {set lang [my lang]} if {$name eq ""} {set name $lang:$normalized_name} if {$label eq $arg} {set label $stripped_name} Link create [self]::link \ -page [self] \ - -type $link_type -name $name -lang $lang \ - -stripped_name $normalized_name -label $label \ - -folder_id $parent_id -package_id $package_id + -type $link_type -name $name -lang $lang \ + -stripped_name $normalized_name -label $label \ + -folder_id $parent_id -package_id $package_id return $ch[[self]::link render] } @@ -593,10 +585,10 @@ my instvar item_id set refs [list] db_foreach references "SELECT page,ci.name,link_type,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" { - lappend refs "$name" - } + 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" { + lappend refs "$name" + } join $refs ", " } @@ -635,7 +627,7 @@ [my info class] instvar $__v } set __ignorelist [list __v __ignorelist __varlist __template_variables__ \ - text item_id content] + text item_id content] set __varlist [list] set __template_variables__ "
    \n" foreach __v [lsort [info vars]] { @@ -660,6 +652,10 @@ #my log "--" set content [my substitute_markup [my set text]] } + Page instproc set_content {text} { + my text [list [string map [list >> "\n
    >>" << "<<\n"] \ + [string trim $text " \n"]] text/html] + } Page instproc get_rich_text_spec {field_name default} { set spec "" @@ -669,9 +665,9 @@ set name [expr {[my exists name] ? [my set name] : $page_name}] #ns_log notice "--w T.name = '[my set name]' var=$page_name, $var_name $field_name []" if {[string match $page_name $name] && - [string match $var_name $field_name]} { - set spec $widget_spec - break + [string match $var_name $field_name]} { + set spec $widget_spec + break } } if {$spec eq ""} {return $default} @@ -680,12 +676,12 @@ Page instproc update_references {page_id references} { db_dml delete_references \ - "delete from xowiki_references where page = $page_id" + "delete from xowiki_references where page = $page_id" foreach ref $references { foreach {r link_type} $ref break db_dml insert_reference \ - "insert into xowiki_references (reference, link_type, page) \ - values ($r,:link_type,$page_id)" + "insert into xowiki_references (reference, link_type, page) \ + values ($r,:link_type,$page_id)" } } @@ -697,7 +693,9 @@ regexp {^(..):(.*)$} $name _ lang name set references [list] set unresolved_references 0 + #my log "--W setting unresolved_references to 0 [info exists unresolved_references]" set content [my get_content] + #my log "--W after content [info exists unresolved_references] [my exists unresolved_references] ?? [info vars]" if {$update_references || $unresolved_references > 0} { my update_references $item_id [lsort -unique $references] } @@ -717,12 +715,12 @@ if {$user_id > 0} { # only record information for authenticated users db_dml update_last_visisted \ - "update xowiki_last_visited set time = current_timestamp, count = count + 1 \ - where page_id = $item_id and user_id = $user_id" + "update xowiki_last_visited set time = current_timestamp, count = count + 1 \ + where page_id = $item_id and user_id = $user_id" if {[db_resultrows] < 1} { - db_dml insert_last_visisted \ - "insert into xowiki_last_visited (page_id, package_id, user_id, count, time) \ - values ($item_id, $package_id, $user_id, 1, current_timestamp)" + db_dml insert_last_visisted \ + "insert into xowiki_last_visited (page_id, package_id, user_id, count, time) \ + values ($item_id, $package_id, $user_id, 1, current_timestamp)" } } } @@ -746,6 +744,9 @@ #my log "-- my class=[my info class]" return [my substitute_markup [my set text]] } + PlainPage instproc set_content {text} { + my text $text + } PlainPage instproc substitute_markup {source} { [self class] instvar RE @@ -771,11 +772,11 @@ File instproc full_file_name {} { if {![my exists full_file_name]} { if {[my exists item_id]} { - my instvar text mime_type package_id item_id revision_id - set storage_area_key [db_string get_storage_key \ - "select storage_area_key from cr_items where item_id=$item_id"] - my set full_file_name [cr_fs_path $storage_area_key]/$text - #my log "--F setting FILE=[my set full_file_name]" + my instvar text mime_type package_id item_id revision_id + set storage_area_key [db_string get_storage_key \ + "select storage_area_key from cr_items where item_id=$item_id"] + my set full_file_name [cr_fs_path $storage_area_key]/$text + #my log "--F setting FILE=[my set full_file_name]" } } return [my set full_file_name] @@ -787,32 +788,32 @@ set page_link [my make_link -privilege public [self] download ""] #my log "--F page_link=$page_link ---- " set t [TableWidget new -volatile \ - -columns { - AnchorField name -label [_ xowiki.name] - Field mime_type -label [_ xowiki.page_type] - Field last_modified -label "Last Modified" - Field mod_user -label "By User" - Field size -label "Size" - }] + -columns { + AnchorField name -label [_ xowiki.name] + Field mime_type -label [_ xowiki.page_type] + Field last_modified -label "Last Modified" + Field mod_user -label "By User" + Field size -label "Size" + }] regsub {[.][0-9]+([^0-9])} [my set last_modified] {\1} last_modified regexp {^([^:]+):(.*)$} $name _ link_type stripped_name set label $stripped_name $t add \ - -name $stripped_name \ - -mime_type $mime_type \ - -name.href $page_link \ - -last_modified $last_modified \ - -mod_user [::xo::get_user_name $creation_user] \ - -size [file size [my full_file_name]] + -name $stripped_name \ + -mime_type $mime_type \ + -name.href $page_link \ + -last_modified $last_modified \ + -mod_user [::xo::get_user_name $creation_user] \ + -size [file size [my full_file_name]] if {$link_type eq "image"} { set l [Link new -volatile \ -page [self] \ - -type $link_type -name $name -lang "" \ - -stripped_name $stripped_name -label $label \ - -folder_id $parent_id -package_id $package_id] + -type $link_type -name $name -lang "" \ + -stripped_name $stripped_name -label $label \ + -folder_id $parent_id -package_id $package_id] set image "
    [$l render]
    " } else { set image "" @@ -838,9 +839,9 @@ foreach {template_name var_name} [split $s ,] break #ns_log notice "--w T.title = '[$template set name]' var=$name" if {[string match $template_name [$template set name]] && - [string match $var_name $name]} { - set spec $widget - #ns_log notice "--w using $widget for $name" + [string match $var_name $name]} { + set spec $widget + #ns_log notice "--w using $widget for $name" } } #ns_log notice "--w returning spec $spec" @@ -854,7 +855,7 @@ uplevel #0 [list $page_template volatile] #return [my substitute_markup [my adp_subst [$page_template set text]]] if {[my set instance_attributes] eq ""} { - return [my adp_subst [$page_template set text]] + return [my adp_subst [lindex [$page_template set text] 0]] } set T [my adp_subst [$page_template set text]] #my log T=$T @@ -868,10 +869,10 @@ foreach var [array names __ia] { #my log "-- set $var [list $__ia($var)]" if {[string match "richtext*" [my get_field_type $var $page_template text]]} { - # ignore the text/html info from htmlarea - my set $var [lindex $__ia($var) 0] + # ignore the text/html info from htmlarea + my set $var [lindex $__ia($var) 0] } else { - my set $var $__ia($var) + my set $var $__ia($var) } } next @@ -881,13 +882,8 @@ # Methods of ::xowiki::Object # - #Object instproc save_new {} { - #my set text [::Serializer deepSerialize [self]] - #next - #} - Object instproc get_content {} { - if {[[self]::payload info procs content] ne ""} { + if {[[self]::payload info methods content] ne ""} { return [my substitute_markup [[self]::payload content]] } else { return "
    [string map {> > < <} [my set text]]
    " @@ -901,9 +897,11 @@ Object instproc set_payload {cmd} { set payload [self]::payload if {[my isobject $payload]} {$payload destroy} - ::xotcl::Object create $payload -requireNamespace - if {[catch {$payload eval $cmd} error ]} { - ns_log error "XoWiki folder object: content lead to error: $error" + ::xo::Context create $payload -requireNamespace \ + -actual_query [::xo::cc actual_query] + $payload set package_id [my set package_id] + if {[catch {$payload contains $cmd} error ]} { + ns_log error "content $cmd lead to error: $error" } } Object instproc get_payload {var {default ""}} { 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.14 -r1.15 --- openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 9 Aug 2006 00:37:52 -0000 1.14 +++ openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 17 Aug 2006 01:44:26 -0000 1.15 @@ -15,16 +15,16 @@ } { ns_log notice "--sc datasource called with revision_id = $revision_id" - set page [::xowiki::Package instantiate_page_from_id -revision_id $revision_id] + set page [::xowiki::Package instantiate_page_from_id -revision_id $revision_id -user_id 0] $page volatile $page absolute_links 1 - ns_log notice "--sc setting absolute link for page = $page" + ns_log notice "--sc setting absolute links for page = $page [$page set name]" set html [$page render] set text [ad_html_text_convert -from text/html -to text/plain -- $html] #set text [ad_text_to_html $html]; #this could be used for entity encoded html text in rss entries - ::xowiki::notification::do_notifications -page $page -html $html -text $text + #::xowiki::notification::do_notifications -page $page -html $html -text $text #ns_log notice "--sc INDEXING $revision_id -> $text" #$page set unresolved_references 0 @@ -35,24 +35,24 @@ foreach tag {h1 h2 h3 h4 h5 b strong} { foreach {match words} [regexp -all -inline "<$tag>(\[^<\]+)" $html] { foreach w [split $words] { - if {$w eq ""} continue - set word($w) 1 + if {$w eq ""} continue + set word($w) 1 } } } ns_log notice "--sc keywords $revision_id -> [array names word]" return [list object_id $revision_id title [$page title] \ - content $text keywords [array names word] \ - storage_type text mime text/html \ - syndication [list \ - link [::xowiki::Page pretty_link -absolute 1 [$page set name]] \ - description $text \ - author [$page set creator] \ - category "" \ - guid "$item_id" \ - pubDate [$page set last_modified]] \ - ] + content $text keywords [array names word] \ + storage_type text mime text/html \ + syndication [list \ + link [::[$page package_id] pretty_link -absolute 1 [$page set name]] \ + description $text \ + author [$page set creator] \ + category "" \ + guid "$item_id" \ + pubDate [$page set last_modified]] \ + ] } ad_proc -private ::xowiki::url { revision_id} { @@ -70,35 +70,35 @@ acs_sc::impl::new_from_spec -spec { name "::xowiki::Page" aliases { - datasource ::xowiki::datasource - url ::xowiki::url + datasource ::xowiki::datasource + url ::xowiki::url } contract_name FtsContentProvider owner xowiki } acs_sc::impl::new_from_spec -spec { name "::xowiki::PlainPage" aliases { - datasource ::xowiki::datasource - url ::xowiki::url + datasource ::xowiki::datasource + url ::xowiki::url } contract_name FtsContentProvider owner xowiki } acs_sc::impl::new_from_spec -spec { name "::xowiki::PageInstance" aliases { - datasource ::xowiki::datasource - url ::xowiki::url + datasource ::xowiki::datasource + url ::xowiki::url } contract_name FtsContentProvider owner xowiki } acs_sc::impl::new_from_spec -spec { name "::xowiki::File" aliases { - datasource ::xowiki::datasource - url ::xowiki::url + datasource ::xowiki::datasource + url ::xowiki::url } contract_name FtsContentProvider owner xowiki 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.9 -r1.10 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 10 Aug 2006 12:36:48 -0000 1.9 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 17 Aug 2006 01:44:26 -0000 1.10 @@ -55,80 +55,89 @@ set tags "" set no_tags 1 if {[$package_id get_parameter "use_tags" 1] && - ![my exists_query_parameter no_tags]} { + ![my exists_query_parameter no_tags]} { # only activate tags when the user is logged in - set no_tags [expr {[ad_conn user_id] == 0}] + set no_tags [expr {[::xo::cc user_id] == 0}] set tags "" if {!$no_tags} { - ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" - set entries [list] - set tags [lsort [::xowiki::Page get_tags -user_id [ad_conn user_id] \ - -item_id $item_id -package_id $package_id]] - set href [$package_id package_url]weblog?summary=1 - foreach tag $tags {lappend entries "$tag"} - set tags_with_links [join $entries {, }] + ::xowiki::Page requireJS "/resources/xowiki/get-http-object.js" + set entries [list] + set tags [lsort [::xowiki::Page get_tags -user_id [::xo::cc user_id] \ + -item_id $item_id -package_id $package_id]] + set href [$package_id package_url]weblog?summary=1 + foreach tag $tags {lappend entries "$tag"} + set tags_with_links [join $entries {, }] } } my log "--after tags" - set return_url [$package_id url] ;# for the time being - - if {[$package_id get_parameter "use_notifications" 1]} { - set notification_type [notification::type::get_type_id -short_name xowiki_notif] - set notification_subscribe_link [export_vars -base /notifications/request-new \ - {return_url - {pretty_name "Subscribe the xowiki instance"} \ - {type_id $notification_type} - {object_id $package_id}}] - set notification_image "" + #set return_url [$package_id url] ;# for the time being + if {[my exists_query_parameter return_url]} { + set return_url [my query_parameter return_url] } + + + if {[$package_id get_parameter "use_notifications" 1]} { + 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 + {pretty_name $notification_text} + {type_id $notification_type} + {object_id $package_id}}] + set notification_image "$notification_text" + } my log "--after notifications [info exists notification_image]" if {[$package_id get_parameter "show_per_object_categories" 1]} { set entries [list] set href [$package_id package_url]weblog?summary=1 foreach cat_id [category::get_mapped_categories $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 {[info exists notification_image]} { - set cat_notif_link [export_vars -base /notifications/request-new \ - {return_url \ - {pretty_name "Category $category_name in tree $tree_name"} \ - {type_id $notification_type} \ - {object_id $category_id}}] - append entry "$notification_image" - } - lappend entries $entry + 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 {[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 \ + {pretty_name $notification_text} \ + {type_id $notification_type} \ + {object_id $category_id}}] + append entry " " \ + "" + } + lappend entries $entry } set per_object_categories_with_links [join $entries {, }] } my log "--after tags" if {[$package_id get_parameter "use_gc"] && - ![my exists_query_parameter no_gc]} { - set gc_link [general_comments_create_link -object_name $title $item_id $return_url] - set gc_comments [general_comments_get_comments $item_id $return_url] + ![my exists_query_parameter no_gc]} { + set gc_return_url [$package_id url] + set gc_link [general_comments_create_link -object_name $title $item_id $gc_return_url] + set gc_comments [general_comments_get_comments $item_id $gc_return_url] } else { set gc_link "" set gc_comments "" } my log "--after gc title=$title" - set header_stuff [::xowiki::Page header_stuff] set master [my query_parameter "master" 1] - if {[my exists_query_parameter "edit_return_url"]} { - set return_url [my query_parameter "edit_return_url"] - } + #if {[my exists_query_parameter "edit_return_url"]} { + # set return_url [my query_parameter "edit_return_url"] + #} if {$master} { set context [list $title] set object_type [my info class] set rev_link [my make_link [self] revisions] set edit_link [my make_link [self] edit return_url] - set delete_link [my make_link [self] delete] - set new_link [my make_link $package_id edit-new object_type] + set delete_link [my make_link [self] delete return_url] + set new_link [my make_link $package_id edit-new object_type return_url] set admin_link [my make_link -privilege admin -url admin/ $package_id {} {}] set index_link [my make_link -privilege public -url "" $package_id {} {}] set save_tag_link [my make_link [self] save-tags] @@ -139,29 +148,29 @@ set page [self] if {$template ne ""} { - set __including_page $page - set __adp_stub [acs_root_dir]/packages/xowiki/www/view-default - set template_code [template::adp_compile -string $template] - if {[catch {set content [template::adp_eval template_code]} errmsg]} { - set content "Error in Page $name: $errmsg
    $content" - } else { - ns_return 200 text/html $content - } + set __including_page $page + set __adp_stub [acs_root_dir]/packages/xowiki/www/view-default + set template_code [template::adp_compile -string $template] + if {[catch {set content [template::adp_eval template_code]} errmsg]} { + ns_return 200 text/html "Error in Page $name: $errmsg
    $template" + } else { + ns_return 200 text/html $content + } } else { - # use adp file - set template_file [my query_parameter "template_file" \ - [$folder_id get_payload template_file view-default]] - if {![regexp {^[./]} $template_file]} { - set template_file /packages/xowiki/www/$template_file - } - $package_id return_page -adp $template_file -variables { - references name title item_id page context header_stuff return_url - content references lang_links package_id - rev_link edit_link delete_link new_link admin_link index_link - tags no_tags tags_with_links save_tag_link popular_tags_link - per_object_categories_with_links - gc_link gc_comments notification_subscribe_link notification_image - } + # use adp file + set template_file [my query_parameter "template_file" \ + [::$package_id get_parameter template_file view-default]] + if {![regexp {^[./]} $template_file]} { + set template_file /packages/xowiki/www/$template_file + } + $package_id return_page -adp $template_file -variables { + references name title item_id page context header_stuff return_url + content references lang_links package_id + rev_link edit_link delete_link new_link admin_link index_link + tags no_tags tags_with_links save_tag_link popular_tags_link + per_object_categories_with_links + gc_link gc_comments notification_subscribe_link notification_image + } } } else { ns_return 200 text/html $content @@ -172,19 +181,11 @@ my instvar package_id item_id revision_id $package_id instvar folder_id ;# this is the root folder - #-query { - # item_id:integer,optional - # name:optional - # last_page_id:integer,optional - # folder_id:integer,optional - # {object_type:optional ::xowiki::Page} - # page_template:integer,optional - # return_url:optional - #} - # set some default values if they are provided foreach key {name title last_page_id} { - if {[$package_id exists_query_parameter $key]} {my set $key [$package_id query_parameter $key]} + if {[$package_id exists_query_parameter $key]} { + my set $key [$package_id query_parameter $key] + } } set object_type [my info class] @@ -205,30 +206,33 @@ set fs_folder_id "" if {[info commands dotlrn_fs::get_community_shared_folder] ne ""} { set fs_folder_id [dotlrn_fs::get_community_shared_folder \ - -community_id [dotlrn_community::get_community_id]] + -community_id [dotlrn_community::get_community_id]] } - # the following line is like [$package_id url], but works as well with renames of the object + # the following line is like [$package_id url], but works as well with renamed objects set myurl [expr {$new ? [$package_id url] : - [Page pretty_link -package_id $package_id [my form_parameter name]]}] + [$package_id pretty_link [my form_parameter name]]}] + + set myurl [$package_id pretty_link [my form_parameter name]] + if {[my exists_query_parameter "return_url"]} { set submit_link [my query_parameter "return_url" $myurl] set return_url $submit_link } else { set submit_link $myurl } - my log "--u sumit_link=$submit_link qp=[my query_parameter return_url]" + #my log "--u sumit_link=$submit_link qp=[my query_parameter return_url]" # we have to do template mangling here; ad_form_template writes form variables into the # actual parselevel, so we have to be in our own level in order to access an pass these variable ::template::parse_level lappend parse_level [info level] set action_vars [expr {$new ? "{edit-new 1} object_type return_url" : "{m edit} return_url"}] [$object_type getFormClass -data [self]] create ::xowiki::f1 -volatile \ - -action [export_vars -base [$package_id url] $action_vars] \ - -data [self] \ - -folderspec [expr {$fs_folder_id ne "" ?"folder_id $fs_folder_id":""}] \ - -submit_link $submit_link + -action [export_vars -base [$package_id url] $action_vars] \ + -data [self] \ + -folderspec [expr {$fs_folder_id ne "" ?"folder_id $fs_folder_id":""}] \ + -submit_link $submit_link if {[info exists return_url]} { ::xowiki::f1 generate -export [list [list return_url $return_url]] @@ -247,9 +251,9 @@ set index_link [my make_link -privilege public -url "" $package_id {} {}] set html [$package_id return_page -adp /packages/xowiki/www/edit \ - -form f1 \ - -variables {item_id edit_form_page_title context formTemplate - view_link back_link rev_link index_link}] + -form f1 \ + -variables {item_id edit_form_page_title context formTemplate + view_link back_link rev_link index_link}] template::util::lpop parse_level my log "--e html length [string length $html]" return $html @@ -259,9 +263,9 @@ my instvar text mime_type package_id item_id revision_id $package_id set mime_type $mime_type set use_bg_delivery [expr {![catch {ns_conn contentsentlength}] && - [info command ::throttle] ne ""}] + [info command ::throttle] ne ""}] $package_id set delivery \ - [expr {$use_bg_delivery ? "ns_returnfile" : "ad_returnfile_background"}] + [expr {$use_bg_delivery ? "ad_returnfile_background" : "ns_returnfile"}] #my log "--F FILE=[my full_file_name]" return [my full_file_name] } @@ -284,7 +288,7 @@ set page_id [my query_parameter "page_id"] ns_cache flush xotcl_object_cache ::$item_id ad_returnredirect [my query_parameter "return_url" \ - [export_vars -base [$package_id url] {{m revisions}}]] + [export_vars -base [$package_id url] {{m revisions}}]] } @@ -295,30 +299,18 @@ ns_cache flush xotcl_object_cache ::$item_id ns_cache flush xotcl_object_cache ::$revision_id ad_returnredirect [my query_parameter "return_url" \ - [export_vars -base [$package_id url] {{m revisions}}]] + [export_vars -base [$package_id url] {{m revisions}}]] } Page instproc delete {} { my instvar package_id item_id name parent_id - my log "--D trying to delete $item_id" - ::Generic::CrItem delete -item_id $item_id - ns_cache flush xotcl_object_cache ::$item_id - # we should probably flush as well cached revisions - if {$name eq "::$parent_id"} { - my log "--D deleting folder object ::$parent_id" - ns_cache flush xotcl_object_cache ::$parent_id - ns_cache flush xotcl_object_type_cache item_id-of-$parent_id - ::$parent_id destroy - } - set key link-*-$name-$parent_id - foreach n [ns_cache names xowiki_cache $key] {ns_cache flush xowiki_cache $n} - ad_returnredirect [my query_parameter "return_url" [$package_id package_url]] + $package_id delete -name $name -item_id $item_id } Page instproc save-tags {} { my instvar package_id item_id - ::xowiki::Page save_tags -user_id [ad_conn user_id] -item_id $item_id \ - -package_id $package_id [my form_parameter tags] + ::xowiki::Page save_tags -user_id [::xo::cc user_id] -item_id $item_id \ + -package_id $package_id [my form_parameter tags] ad_returnredirect [my query_parameter "return_url" [$package_id url]] } @@ -328,16 +320,11 @@ set href [$package_id package_url]weblog?summary=1 set entries [list] db_foreach get_popular_tags \ - "select count(*) as nr,tag from xowiki_tags \ + "select count(*) as nr,tag from xowiki_tags \ where item_id=$item_id group by tag order by nr limit $limit" { - lappend entries "$tag ($nr)" - } + lappend entries "$tag ($nr)" + } ns_return 200 text/html "[_ xowiki.popular_tags_label]: [join $entries {, }]" } - Class Page::skin=portlet -instproc render {} { - return "\ -
    [next]
    " - } } Index: openacs-4/packages/xowiki/www/error-template.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/error-template.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/error-template.adp 17 Aug 2006 01:44:26 -0000 1.1 @@ -0,0 +1,12 @@ + + @title;noquote@ + @context;noquote@ + +

     

    +

    Error:

    +

    +

    +@error_msg;noquote@ +

     

    +
    +

    Index: openacs-4/packages/xowiki/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/index.vuh,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/index.vuh 6 Aug 2006 19:57:09 -0000 1.3 +++ openacs-4/packages/xowiki/www/index.vuh 17 Aug 2006 01:44:26 -0000 1.4 @@ -1,21 +1,24 @@ -ad_page_contract { +# -*- tcl -*- +::xowiki::Package initialize -ad_doc { + This is the resolver for this package. It turns a request into an object and executes the object with the computed method @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) @creation-date July, 2006 @cvs-id $Id$ +} -parameter { + {-m view} + {-folder_id:integer 0} } -::xowiki::Package process_query \ - -defaults [list m view \ - folder_id 0 \ - package_id [ad_conn package_id]] -set Package [::xowiki::Package create ::$package_id -folder_id $folder_id] -$Package log "--starting... [ns_conn url] [ns_conn query] form vars = [ns_set array [ns_getform]]" -set text [$Package invoke -method $m] -$Package log "--delivery [$Package set delivery] 200 [$Package set mime_type] [string length $text] bytes" -[$Package set delivery] 200 [$Package set mime_type] $text -$Package log "--done [$Package set object]" +::$package_id log "--starting... [ns_conn url] [ns_conn query] form vars = [ns_set array [ns_getform]]" +set text [::$package_id invoke -method $m] +if {[string length $text] > 1} { + #::$package_id log "--delivery [::$package_id set delivery] 200 [::$package_id set mime_type] \ + [string length $text] bytes" + [::$package_id set delivery] 200 [::$package_id set mime_type] $text +} +::$package_id log "--i ::$package_id DONE" ad_script_abort Index: openacs-4/packages/xowiki/www/admin/delete-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/delete-type.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/xowiki/www/admin/delete-type.tcl 9 Aug 2006 10:37:16 -0000 1.6 +++ openacs-4/packages/xowiki/www/admin/delete-type.tcl 17 Aug 2006 01:44:26 -0000 1.7 @@ -1,23 +1,24 @@ -ad_page_contract { +::xowiki::Package initialize -ad_doc { This deletes a type with all subtypes and instances - - @author Your Name (you@example.com) + + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date Aug 11, 2006 @cvs-id $Id$ - - @param object_type the class name of an instance of CrClass -} -query { - object_type - {query "."} + + @param object_type + @param query +} -parameter { + {-object_type ::xowiki::Page} + {-return_url "."} } -set p [::xowiki::Package create ::[ad_conn package_id]] - -db_foreach retrieve_instances [$object_type instance_select_query -folder_id [$p set folder_id]] { +set sql [$object_type instance_select_query -folder_id [::$package_id folder_id]] +db_foreach retrieve_instances $sql permission::require_write_permission -object_id $item_id $object_type delete -item_id $item_id } # drop type requires that all pages of all xowiki instances are deleted #foreach type [$object_type object_types -subtypes_first true] {$type drop_object_type} -ad_returnredirect $query +ad_returnredirect $return_url Index: openacs-4/packages/xowiki/www/admin/export.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/export.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/admin/export.tcl 7 Aug 2006 20:58:41 -0000 1.2 +++ openacs-4/packages/xowiki/www/admin/export.tcl 17 Aug 2006 01:44:26 -0000 1.3 @@ -1,12 +1,24 @@ -set object_type ::xowiki::Page -set folder_id [$object_type require_folder -name xowiki] +::xowiki::Package initialize -ad_doc { + export the objects of the specified type + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date Aug 11, 2006 + @cvs-id $Id$ + + @param object_type +} -parameter { + {-object_type ::xowiki::Page} +} + +set sql [$object_type instance_select_query \ + -folder_id [::$package_id folder_id] \ + -with_subtypes true] + set content "" -db_foreach instance_select \ - [$object_type instance_select_query -folder_id $folder_id -with_subtypes true] { - ::Generic::CrItem instantiate -item_id $item_id - $item_id volatile - append content [::Serializer deepSerialize $item_id] \n - } +db_foreach instance_select $sql { + ::Generic::CrItem instantiate -item_id $item_id + $item_id volatile + append content [::Serializer deepSerialize $item_id] \n +} ns_return 200 text/plain $content \ No newline at end of file Index: openacs-4/packages/xowiki/www/admin/import.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/import.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/admin/import.tcl 7 Aug 2006 20:58:41 -0000 1.5 +++ openacs-4/packages/xowiki/www/admin/import.tcl 17 Aug 2006 01:44:26 -0000 1.6 @@ -1,3 +1,12 @@ +::xowiki::Package initialize -ad_doc { + import objects in xotcl format + + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date Aug 11, 2006 + @cvs-id $Id$ + +} + set msg "" ad_form \ -name upload_form \ @@ -12,19 +21,19 @@ -on_submit { # check file name if {$upload_file eq ""} { - template::form::set_error upload_form upload_file \ - [_ acs-templating.HTMLArea_SpecifyUploadFilename] - break + template::form::set_error upload_form upload_file \ + [_ acs-templating.HTMLArea_SpecifyUploadFilename] + break } set upload_tmpfile [template::util::file::get_property tmp_filename $upload_file] set f [open $upload_tmpfile]; set content [read $f]; close $f foreach o [::xowiki::Page allinstances] { $o destroy } if {[catch {eval $content} error]} { - set msg "Error: $error" + set msg "Error: $error" } else { - set msg [::xowiki::Page import] + set msg [::xowiki::Page import] } } Index: openacs-4/packages/xowiki/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/index.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/xowiki/www/admin/index.tcl 10 Aug 2006 08:32:06 -0000 1.12 +++ openacs-4/packages/xowiki/www/admin/index.tcl 17 Aug 2006 01:44:26 -0000 1.13 @@ -1,28 +1,27 @@ -ad_page_contract { +::xowiki::Package initialize -ad_doc { + This is the admin page for the package. It displays all of the types of wiki pages provides links to delete them @author Gustaf Neumann neumann@wu-wien.ac.at @cvs-id $Id$ -} -query { - object_type:optional + +} -parameter { + {-object_type ::xowiki::Page} } -set package_id [ad_conn package_id] -set Package [::xowiki::Package create ::$package_id] - set context [list] -set supertype ::xowiki::Page -set title "Administer all kind of [$supertype set pretty_plural]" +set title "Administer all kind of [$object_type set pretty_plural]" -set object_type_key [$supertype set object_type_key] -set object_types [$supertype object_types] +set object_type_key [$object_type set object_type_key] +set object_types [$object_type object_types] set return_url [ns_conn url] TableWidget t1 -volatile \ -actions [subst { Action new -label "all pages" -url list - Action new -label parameters -url [export_vars -base /shared/parameters {package_id return_url}] + Action new -label parameters -url \ + [export_vars -base /shared/parameters {package_id return_url}] Action new -label export -url export Action new -label import -url import Action new -label permissions -url [export_vars -base permissions {package_id}] @@ -32,31 +31,31 @@ AnchorField instances -label Instances -html {align center} ImageField_AddIcon edit -label "Add" -html {align center} ImageField_DeleteIcon delete -label "Delete All" \ - -html {align center onClick "return(confirm('Delete really all?'));"} + -html {align center onClick "return(confirm('Delete really all?'));"} } -set base [$Package package_url] +set base [::$package_id package_url] db_foreach type_select \ "select object_type from acs_object_types where tree_sortkey between :object_type_key and tree_right(:object_type_key) " { set return_url [export_vars -base ${base}admin {object_type}] t1 add \ - -object_type $object_type \ - -instances [db_list count [$object_type instance_select_query \ - -folder_id [$Package set folder_id] \ - -count 1 -with_subtypes false]] \ - -instances.href [export_vars -base ./list {object_type}] \ - -edit.href [export_vars -base $base {{edit-new 1} object_type return_url}] \ - -delete.href [export_vars -base delete-type {object_type}] \ - -edit.title [_ xotcl-core.add [list type [$object_type pretty_name]]] \ - -delete.title "Delete all [$object_type pretty_plural] of this instance" + -object_type $object_type \ + -instances [db_list count [$object_type instance_select_query \ + -folder_id [::$package_id set folder_id] \ + -count 1 -with_subtypes false]] \ + -instances.href [export_vars -base ./list {object_type}] \ + -edit.href [export_vars -base $base {{edit-new 1} object_type return_url}] \ + -delete.href [export_vars -base delete-type {object_type}] \ + -edit.title [_ xotcl-core.add [list type [$object_type pretty_name]]] \ + -delete.title "Delete all [$object_type pretty_plural] of this instance" } set t1 [t1 asHTML] # set up categories set category_map_url [export_vars -base \ - [site_node::get_package_url -package_key categories]cadmin/object-map \ - { { object_id $package_id } }] \ No newline at end of file + [site_node::get_package_url -package_key categories]cadmin/object-map \ + { { object_id $package_id } }] \ No newline at end of file Index: openacs-4/packages/xowiki/www/admin/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/list.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/admin/list.tcl 9 Aug 2006 15:42:06 -0000 1.3 +++ openacs-4/packages/xowiki/www/admin/list.tcl 17 Aug 2006 01:44:26 -0000 1.4 @@ -1,4 +1,4 @@ -ad_page_contract { +::xowiki::Package initialize -ad_doc { This is the admin page for the package. It displays all entries provides links to create, edit and delete these @@ -7,15 +7,11 @@ @cvs-id $Id$ @param object_type show objects of this class and its subclasses -} -query { - object_type:optional - {orderby:optional "last_modified,desc"} +} -parameter { + {-object_type:optional} + {-orderby:optional "last_modified,desc"} } -set package_id [ad_conn package_id] -set Package [::xowiki::Package create ::$package_id] -$Package instvar folder_id - set context [list index] # if object_type is specified, only list entries of this type; @@ -33,20 +29,21 @@ set title "Index of [$object_type set pretty_plural]" set with_subtypes false } -#ns_log notice "-- folder_id = $folder_id" +set return_url [expr {$per_type ? [export_vars -base [::$package_id url] object_type] : + [::$package_id url]}] # set up categories set category_map_url [export_vars -base \ - [site_node::get_package_url -package_key categories]cadmin/one-object \ - { { object_id $package_id } }] + [site_node::get_package_url -package_key categories]cadmin/one-object \ + { { object_id $package_id } }] set actions "" foreach type $object_types { append actions [subst { Action new \ - -label "[_ xotcl-core.add [list type [$type pretty_name]]]" \ - -url [export_vars -base [$Package package_url] {{edit-new 1} {object_type $type}}] \ - -tooltip "[_ xotcl-core.add_long [list type [$type pretty_name]]]" + -label "[_ xotcl-core.add [list type [$type pretty_name]]]" \ + -url [export_vars -base [::$package_id package_url] {{edit-new 1} {object_type $type} return_url}] \ + -tooltip "[_ xotcl-core.add_long [list type [$type pretty_name]]]" }] } @@ -70,24 +67,23 @@ # -page_number 1 db_foreach instance_select \ [$object_type instance_select_query \ - -folder_id $folder_id \ - -with_subtypes $with_subtypes \ - -select_attributes [list content_length creation_user \ - "to_char(last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified"] \ - -order_clause $order_clause \ - ] { - set page_link [::xowiki::Page pretty_link $name] - set return_url [expr {$per_type ? [export_vars -base [$Package url] object_type] : - [$Package url]}] - t1 add \ - -name $name \ - -object_type $object_type \ - -name.href $page_link \ - -last_modified $last_modified \ - -size $content_length \ - -edit.href [export_vars -base $page_link {{m edit} return_url}] \ - -mod_user [::xo::get_user_name $creation_user] \ - -delete.href [export_vars -base $page_link {{m delete} return_url}] - } + -folder_id [::$package_id folder_id] \ + -with_subtypes $with_subtypes \ + -select_attributes [list content_length creation_user \ + "to_char(last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified"] \ + -order_clause $order_clause \ + ] { + set page_link [::$package_id pretty_link $name] + t1 add \ + -name $name \ + -object_type $object_type \ + -name.href $page_link \ + -last_modified $last_modified \ + -size [expr {$content_length ne "" ? $content_length : 0}] \ + -edit.href [export_vars -base $page_link {{m edit} return_url}] \ + -mod_user [::xo::get_user_name $creation_user] \ + -delete.href [export_vars -base [$package_id package_url] {{delete 1} item_id name return_url}] + } + set t1 [t1 asHTML] Index: openacs-4/packages/xowiki/www/admin/samples/ajax-chat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/samples/ajax-chat.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/admin/samples/ajax-chat.tcl 3 May 2006 12:03:23 -0000 1.3 +++ openacs-4/packages/xowiki/www/admin/samples/ajax-chat.tcl 17 Aug 2006 01:44:26 -0000 1.4 @@ -4,9 +4,9 @@ -set lang en \ -set description {} \ -set text { - proc content {} { - ::xowiki::Chat login -chat_id 22 - } + proc content {} { + ::xowiki::Chat login -chat_id 22 + } } \ -set nls_language en_US \ -set mime_type {text/html} \ Index: openacs-4/packages/xowiki/www/ajax/streaming-chat.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/ajax/Attic/streaming-chat.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/ajax/streaming-chat.js 9 Apr 2006 00:07:10 -0000 1.3 +++ openacs-4/packages/xowiki/www/ajax/streaming-chat.js 17 Aug 2006 01:44:26 -0000 1.4 @@ -61,7 +61,7 @@ function chatSendMsg() { var msg = document.getElementById('chatMsg').value; - if (msg == '') { + if (msg == '') { return; } //alert(send_url + encodeURIComponent(msg)); Index: openacs-4/packages/xowiki/www/portlets/categories-recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories-recent.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/xowiki/www/portlets/categories-recent.tcl 19 Jun 2006 00:40:04 -0000 1.6 +++ openacs-4/packages/xowiki/www/portlets/categories-recent.tcl 17 Aug 2006 01:44:26 -0000 1.7 @@ -8,12 +8,11 @@ # skin: name of adp-file to render content ::xowiki::Page proc __render_html { - -folder_id + -package_id -max_entries -tree_name } { set cattree [::xowiki::CatTree new -volatile -name "categories-recent"] - set package_id [$folder_id set package_id] foreach tree [category_tree::get_mapped_trees $package_id] { foreach {tree_id my_tree_name ...} $tree {break} @@ -30,7 +29,7 @@ "select c.category_id, i.name, r.title, \ to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as publish_date \ from category_object_map_tree c, cr_items i, cr_revisions r, xowiki_page p \ - where c.object_id = i.item_id and i.parent_id = $folder_id \ + where c.object_id = i.item_id and i.parent_id = [$package_id folder_id] \ and r.revision_id = i.live_revision \ and p.page_id = r.revision_id $tree_select_clause \ order by r.publish_date desc limit $max_entries @@ -42,6 +41,7 @@ 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]\ -level 1] $cattree add $categories($category_id) @@ -54,7 +54,7 @@ set content [::xowiki::Page __render_html \ -max_entries [expr {[info exists max_entries] ? $max_entries : 10}] \ -tree_name [expr {[info exists tree_name] ? $tree_name : ""}] \ - -folder_id [$__including_page set parent_id] \ + -package_id [$__including_page set package_id] \ ] if {![info exists name]} {set name "Recently Changed Pages by Categories"} set link "" 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.16 -r1.17 --- openacs-4/packages/xowiki/www/portlets/categories.tcl 10 Aug 2006 01:14:41 -0000 1.16 +++ openacs-4/packages/xowiki/www/portlets/categories.tcl 17 Aug 2006 01:44:26 -0000 1.17 @@ -11,18 +11,18 @@ # skin: name of adp-file to render content ::xowiki::Page proc __render_html { - -folder_id + -package_id {-tree_name ""} -tree_style -no_tree_name:boolean -count:boolean {-summary 0} {-open_page ""} + {-category_ids ""} {-except_category_ids ""} } { - + set folder_id [$package_id folder_id] # get the folder id from the including page - set package_id [$folder_id set package_id] set open_item_id [expr {$open_page ne "" ? [CrItem lookup -name $open_page -parent_id $folder_id] : 0}] @@ -37,17 +37,17 @@ set pos 0 set cattree(0) [::xowiki::CatTree new -volatile -orderby pos -name $my_tree_name] 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 \ + 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($category_id) $c - lappend categories $category_id + set category($cid) $c + lappend categories $cid #set itemobj [Object new -set name en:index -set title MyTitle -set prefix "" -set suffix ""] #$cattree(0) add_to_category -category $c -itemobj $itemobj -orderby title - } + } 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 \ @@ -57,11 +57,18 @@ and p.page_id = r.revision_id" if {$except_category_ids ne ""} { - append sql catogory_filter \ + 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)" + } + } if {$count} { db_foreach get_counts \ @@ -95,16 +102,19 @@ set link "" if {![info exists name]} {set name "Categories"} set summary [ns_queryget summary 0] +foreach _ {category_ids except_category_ids} { + if {![info exists $_]} {set $_ [ns_queryget $_ ""]} +} set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ + -package_id [$__including_page set package_id] \ -tree_name [expr {[info exists tree_name] ? $tree_name : ""}] \ -tree_style [expr {[info exists tree_style] ? $tree_style : 1}] \ -no_tree_name [info exists no_tree_name] \ -count [info exists count] \ -summary $summary \ -open_page [expr {[info exists open_page] ? $open_page : ""}] \ - -except_category_ids [expr {[info exists except_category_ids] ? - $except_category_ids : ""}] \ + -category_ids $category_ids \ + -except_category_ids $except_category_ids \ ] if {![info exists skin]} {set skin portlet-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.5 -r1.6 --- openacs-4/packages/xowiki/www/portlets/last-visited.tcl 19 Jun 2006 00:40:04 -0000 1.5 +++ openacs-4/packages/xowiki/www/portlets/last-visited.tcl 17 Aug 2006 01:44:26 -0000 1.6 @@ -11,40 +11,40 @@ ::xowiki::Page proc __render_html { -folder_id + -package_id -user_id -max_entries } { - set package_id [$folder_id set package_id] - TableWidget t1 -volatile \ -columns { - AnchorField title -label [_ xowiki.page_title] + AnchorField title -label [_ xowiki.page_title] } db_foreach get_pages \ "select r.title,i.name, to_char(x.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 = $user_id and x.package_id = $package_id + 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 = $user_id and x.package_id = $package_id order by x.time desc limit $max_entries " { - if {$title eq ""} {set title $name} + if {$title eq ""} {set title $name} - t1 add \ - -title $title \ - -title.href [::xowiki::Page pretty_link $name] + t1 add \ + -title $title \ + -title.href [::$package_id pretty_link $name] } return [t1 asHTML] } set link "" if {![info exists name]} {set name "Last Visited Pages"} set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ - -max_entries [expr {[info exists max_entries] ? $max_entries : 20}] \ - -user_id [expr {[info exists user_id] ? $user_id : \ - [ad_conn isconnected] ? [ad_conn user_id] : 0}] \ - ] + -folder_id [$__including_page set parent_id] \ + -package_id [$__including_page set package_id] \ + -max_entries [expr {[info exists max_entries] ? $max_entries : 20}] \ + -user_id [expr {[info exists user_id] ? $user_id : \ + [ad_conn isconnected] ? [ad_conn user_id] : 0}] \ + ] if {![info exists skin]} {set skin portlet-skin} if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} 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.4 -r1.5 --- openacs-4/packages/xowiki/www/portlets/most-popular.tcl 19 Jun 2006 00:40:04 -0000 1.4 +++ openacs-4/packages/xowiki/www/portlets/most-popular.tcl 17 Aug 2006 01:44:26 -0000 1.5 @@ -10,37 +10,38 @@ ::xowiki::Page proc __render_html { -folder_id + -package_id -max_entries -} { - set package_id [$folder_id set package_id] +} { TableWidget t1 -volatile \ -columns { - AnchorField title -label [_ xowiki.page_title] - Field count -label Count -html { align right } + AnchorField title -label [_ xowiki.page_title] + Field count -label Count -html { align right } } db_foreach get_pages \ "select sum(x.count), 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 group by x.page_id, r.title, i.name \ - order by sum desc limit $max_entries " \ + 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 group by x.page_id, r.title, i.name \ + order by sum desc limit $max_entries " \ { if {$title eq ""} {set title $name} t1 add \ - -title $title \ - -title.href [::xowiki::Page pretty_link $name] \ - -count $sum + -title $title \ + -title.href [::$package_id pretty_link $name] \ + -count $sum } return [t1 asHTML] } set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ - -max_entries [expr {[info exists max_entries] ? $max_entries : 10}] \ - ] + -folder_id [$__including_page set parent_id] \ + -package_id [$__including_page set package_id] \ + -max_entries [expr {[info exists max_entries] ? $max_entries : 10}] \ + ] if {![info exists name]} {set name "Most Popular Pages"} set link "" Index: openacs-4/packages/xowiki/www/portlets/recent.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/recent.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/portlets/recent.tcl 19 Jun 2006 00:40:04 -0000 1.5 +++ openacs-4/packages/xowiki/www/portlets/recent.tcl 17 Aug 2006 01:44:26 -0000 1.6 @@ -10,39 +10,43 @@ ::xowiki::Page proc __render_html { -folder_id + -package_id -max_entries } { TableWidget t1 -volatile \ -columns { - Field date -label "Modification Date" - AnchorField title -label [_ xowiki.page_title] + Field date -label "Modification Date" + AnchorField title -label [_ xowiki.page_title] } db_foreach get_pages \ "select i.name, r.title, \ - to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as publish_date \ - from cr_items i, cr_revisions r, xowiki_page p \ - where i.parent_id = $folder_id \ - and r.revision_id = i.live_revision \ - and p.page_id = r.revision_id \ - order by r.publish_date desc limit $max_entries\ + to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as publish_date \ + from cr_items i, cr_revisions r, xowiki_page p \ + where i.parent_id = $folder_id \ + and r.revision_id = i.live_revision \ + and p.page_id = r.revision_id \ + order by r.publish_date desc limit $max_entries\ " { - if {$title eq ""} {set title $name} - - t1 add \ - -title $title \ - -title.href [::xowiki::Page pretty_link $name] \ - -date $publish_date + if {$title eq ""} {set title $name} + + t1 add \ + -title $title \ + -title.href [::$package_id pretty_link $name] \ + -date $publish_date } return [t1 asHTML] } +ns_log notice "--I folder=[$__including_page set parent_id]" + set link "" set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ - -max_entries [expr {[info exists max_entries] ? $max_entries : 20}] \ - ] + -folder_id [$__including_page set parent_id] \ + -package_id [$__including_page set package_id] \ + -max_entries [expr {[info exists max_entries] ? $max_entries : 20}] \ + ] if {![info exists skin]} {set skin portlet-skin} if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} Index: openacs-4/packages/xowiki/www/portlets/tags.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/tags.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/portlets/tags.tcl 19 Jun 2006 00:40:04 -0000 1.1 +++ openacs-4/packages/xowiki/www/portlets/tags.tcl 17 Aug 2006 01:44:26 -0000 1.2 @@ -21,12 +21,12 @@ set label [_ xowiki.popular_tags_label] set tag_type ptag set sql "select count(*) as nr,tag from xowiki_tags where \ - package_id=$package_id group by tag order by tag limit $limit" + package_id=$package_id group by tag order by 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=$user_id and package_id=$package_id group by tag order by tag" + user_id=$user_id and package_id=$package_id group by tag order by tag" } set content "

    $label

    " set entries [list] @@ -44,12 +44,12 @@ if {![info exists limit]} {set limit 20} set summary [ns_queryget summary 0] set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ - -user_id [ad_conn user_id] \ - -summary $summary \ - -limit $limit \ - -popular [info exists popular] \ - ] + -folder_id [$__including_page set parent_id] \ + -user_id [ad_conn user_id] \ + -summary $summary \ + -limit $limit \ + -popular [info exists popular] \ + ] if {![info exists skin]} {set skin portlet-skin} if {![string match /* $skin]} {set skin [file dir $__adp_stub]/$skin} 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 -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 19 Jun 2006 00:40:04 -0000 1.2 +++ openacs-4/packages/xowiki/www/portlets/weblog-mini-calendar.tcl 17 Aug 2006 01:44:26 -0000 1.3 @@ -59,15 +59,15 @@ } 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 \ + 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 - } + 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 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 -r1.7 -r1.8 --- openacs-4/packages/xowiki/www/portlets/weblog.tcl 10 Aug 2006 01:14:41 -0000 1.7 +++ openacs-4/packages/xowiki/www/portlets/weblog.tcl 17 Aug 2006 01:44:26 -0000 1.8 @@ -9,7 +9,7 @@ Class ::xowiki::WeblogEntry -instproc render {} { append content "
    " \ - "

    [my set title]

    " \ + "

    [my title]

    " \ "

    Created by [my set creator], " \ "last modfified by [::xo::get_user_name [my set creation_user]] " \ "[my set pretty_date]

    " \ @@ -55,7 +55,7 @@ #append extra_from_clause ",category_object_map c " foreach cid [split $category_id ,] { append extra_where_clause "and exists (select * from category_object_map \ - where object_id = ci.item_id and category_id = $cid)" + where object_id = ci.item_id and category_id = $cid)" lappend cnames [::category::get_name $cid] } append extra_from_clause "" @@ -66,7 +66,7 @@ set my_filter_msg "Filtered by your tag $tag" append extra_from_clause ",xowiki_tags tags " append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :tag and \ - tags.user_id = [ad_conn user_id]" + tags.user_id = [ad_conn user_id]" set query_parm "&tag=[ad_urlencode $tag]" } if {$ptag ne ""} { @@ -88,13 +88,13 @@ set query \ [list -folder_id $folder_id \ - -select_attributes [list p.publish_date p.title] \ - -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] \ - and ci.name != '::$folder_id' $date_clause \ - and ci.content_type not in ('::xowiki::PageTemplate') $extra_where_clause" ] + -select_attributes [list p.publish_date p.title] \ + -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] \ + and ci.name != '::$folder_id' $date_clause \ + and ci.content_type not in ('::xowiki::PageTemplate') $extra_where_clause" ] set my_nr_items [db_string count [eval ::xowiki::Page select_query $query -count true]] @@ -104,8 +104,8 @@ 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"] + -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 @@ -124,7 +124,7 @@ if {$my_filter_msg eq ""} { append my_filter_msg "Showing [llength [$items children]] of $my_nr_items Postings " \ - "($flink)" + "($flink)" } else { append my_filter_msg " (all, $flink)" } @@ -150,17 +150,17 @@ set page_number [ns_queryget page_number 1] set summary [ns_queryget summary 0] set content [::xowiki::Page __render_html \ - -folder_id [$__including_page set parent_id] \ - -including_page $__including_page \ - -page_size $page_size \ - -page_number $page_number \ - -summary $summary \ - -date [ns_queryget date] \ - -category_id [ns_queryget category_id] \ - -tag [ns_queryget tag] \ - -ptag [ns_queryget ptag] \ - -filter_msg filter_msg \ - -nr_items nr_items] + -folder_id [$__including_page set parent_id] \ + -including_page $__including_page \ + -page_size $page_size \ + -page_number $page_number \ + -summary $summary \ + -date [ns_queryget date] \ + -category_id [ns_queryget category_id] \ + -tag [ns_queryget tag] \ + -ptag [ns_queryget ptag] \ + -filter_msg filter_msg \ + -nr_items nr_items] set next_p [expr {$nr_items > $page_number*$page_size}] set prev_p [expr {$page_number > 1}] Index: openacs-4/packages/xowiki/www/portlets/wiki.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/wiki.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/xowiki/www/portlets/wiki.tcl 26 Jul 2006 22:56:46 -0000 1.7 +++ openacs-4/packages/xowiki/www/portlets/wiki.tcl 17 Aug 2006 01:44:26 -0000 1.8 @@ -13,7 +13,7 @@ if {[::xowiki::Page incr recursion_count]<3} { set content [$page render] - set link [::xowiki::Page pretty_link $name] + set link [::[$page package_id] pretty_link $name] } else { set content "Recursion Limit exceeded, items are nested to deep!" } Index: openacs-4/packages/xowiki/www/prototypes/CGI.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/CGI.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/CGI.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,11 @@ +# -*- tcl-*- +# $Id: CGI.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "CGI" -text { + proc content {} { + return "Hello \[\[Wiki\]\]-World. It is now [clock format [clock seconds]]." + } + +} + + + Index: openacs-4/packages/xowiki/www/prototypes/CGI2.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/CGI2.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/CGI2.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,22 @@ +# -*- tcl-*- +# $Id: CGI2.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "CGI2" -text { + # + # The classes and objects here are all local to the object, + # as long a no absolulte addresses are used (no leading colons) + # + Class CGI + CGI instproc content {} { + set somevar 100 + return "Hello \[\[Wiki\]\]-World. It is now \ + [clock format [clock seconds]]. Somevar=$somevar" + } + + # mixin the Class CGI into the payload object of the ::xowiki::Object + # since the object renderer queries the method content, it picks up the + # above behavior + my mixin add CGI +} + + + Index: openacs-4/packages/xowiki/www/prototypes/CGI3.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/CGI3.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/CGI3.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,40 @@ +# -*- tcl-*- +# $Id: CGI3.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "CGI3" -text { + # + # The parameter declaration sets the context for the + # evaluation. It combines the provided values from an + # includelet with the values provided via the url with + # the specified default values. + # + my initialize -parameter { + {-object_type ::xowiki::Page} + {-text "Hello World"} + {-x:integer} + {-z:integer 100} + } + + # + # The classes and objects here are all local to the object, + # as long a no absolulte addresses are used (no leading colons) + # + + Class CGI + CGI instproc content {} { + my get_parameters + + set vars [info vars] + set somevar 100 + return "Hello \[\[Wiki\]\]-World. It is now \ + [clock format [clock seconds]]. Somevar=$somevar, vars=$vars, + package_id=$package_id, z=3. $text" + } + + # mixin the Class CGI into the payload object of the ::xowiki::Object + # since the object renderer queries the method content, it picks up the + # above behavior + my mixin add CGI +} + + + Index: openacs-4/packages/xowiki/www/prototypes/ajax-chat.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/ajax-chat.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/ajax-chat.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,13 @@ +# -*- tcl-*- +# $Id: ajax-chat.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "Ajax Chat" -text { + + proc content {} { + #::xowiki::Chat login -chat_id 22 -mode polling + ::xowiki::Chat login -chat_id 22 + } + +} + + + Index: openacs-4/packages/xowiki/www/prototypes/categories-portlet.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/categories-portlet.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/categories-portlet.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,111 @@ +# -*- tcl-*- +# $Id: categories-portlet.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "Categories" -text { + + # display the category tree with associated pages + # -gustaf neumann + # + # 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, 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 + + my initialize -parameter { + {-tree_name ""} + {-tree_style:boolean 1} + {-no_tree_name:boolean 0} + {-count:boolean 0} + {-summary:boolean 0} + {-open_page ""} + {-category_ids ""} + {-except_category_ids ""} + } + + #if {![info exists name]} {set name "Categories"} + + my proc content {} { + my get_parameters + set folder_id [$package_id folder_id] + + set open_item_id [expr {$open_page ne "" ? + [CrItem lookup -name $open_page -parent_id $folder_id] : 0}] + + set content "" + foreach tree [category_tree::get_mapped_trees $package_id] { + 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] + foreach category_info [category_tree::get_tree $tree_id] { + 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 itemobj [Object new -set name en:index -set title MyTitle -set prefix "" -set suffix ""] + #$cattree(0) add_to_category -category $c -itemobj $itemobj -orderby title + } + + 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" + + 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)" + } + } + + if {$count} { + db_foreach 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 { + db_foreach get_pages \ + "select ci.item_id, ci.name, ci.content_type, r.title, category_id from $sql" { + if {$title eq ""} {set title $name} + set itemobj [Object new] + set prefix "" + set suffix "" + foreach var {name title prefix suffix} {$itemobj set $var [set $var]} + $cattree(0) add_to_category \ + -category $category($category_id) \ + -itemobj $itemobj \ + -orderby title \ + -open_item [expr {$item_id == $open_item_id}] + } + append content [$cattree(0) render -tree_style $tree_style] + } + } + return $content + } + +} + + + Index: openacs-4/packages/xowiki/www/prototypes/index.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/index.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/index.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,27 @@ +::xowiki::Page new -title "Index Page" -text { + +

    +This is the default start page of XoWiki. You can edit this page and save it to provide a personalized look of the XoWiki instance. You can as well provide a different index page through configuration. +You can also view the contents of the Wiki in a weblog style. +For more details, consult the [[http://media.wu-wien.ac.at/download/xowiki-doc/|XoWiki documentation]]. +

    +

    +A user can define notifications +for the whole XoWiki instance (by clicking on the notifications button +in the menu bar or for categories (by clicking on the letter symbol +next to the category entries at the bottom of the page) +

    +>>left-col<< +{{recent -max_entries 25}} +>><< +>>right-col<< +{{last-visited -title "Last Visited" -max_entries 10 }} +
    +{{most-popular -title "Most Popular" -max_entries 10 }} +>><< + +} + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,100 @@ +# -*- tcl-*- +# $Id: weblog-portlet.page,v 1.1 2006/08/17 01:44:27 gustafn Exp $ +::xowiki::Object new -title "Weblog" -text { + # + # A sample Weblog object. + # + my initialize -parameter { + {-page_size:integer 10} + {-page_number:integer 1} + {-summary:boolean 0} + {-date ""} + {-tag ""} + {-ptag ""} + } + + # + # The following definition is the default rendering per + # weblog 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 + append content "
    " \ + "

    $title

    " \ + "

    Created by $creator, " \ + "last modfified by [::xo::get_user_name $creation_user] " \ + "$pretty_date

    " \ + $description \n\ + "
    " + } + + # + # The following definition is the renderer for the full weblog. + # This is executed in the context of the whole weblog object + # + Class create WeblogRenderer -instproc render {} { + my instvar filter_msg link name prev_page_link next_page_link + + 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" + } + return "
    $filter [next] $prev $next
    " + } + + 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] + } + + # the default renderer + #set renderer ::xowiki::Weblog::WeblogRenderer + #set entry_renderer ::xowiki::Weblog::EntryRenderer + + # the above custom renderers + set renderer [self]::WeblogRenderer + set entry_renderer [self]::EntryRenderer + + set w [::xowiki::Weblog new -volatile \ + -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 \ + -exclude_item_ids $exclude_item_ids \ + -entry_renderer $entry_renderer \ + ] + + $w mixin add $renderer + return [$w render] + } + +} + + + Index: openacs-4/packages/xowiki/www/prototypes/weblog.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/weblog.page,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/www/prototypes/weblog.page 17 Aug 2006 01:44:27 -0000 1.1 @@ -0,0 +1,16 @@ +::xowiki::Page new -title "Index Page" -text { + +>>content<< +{{weblog-portlet}} +>><< +>>sidebar<< +{{adp portlets/weblog-mini-calendar}} +{{adp portlets/tags {skin plain-include}}} +{{adp portlets/tags {skin plain-include popular 1 limit 30}}} +{{categories-portlet -count 1 -skin plain}} +>><< + +} + + + Index: openacs-4/packages/xowiki/www/xinha/file-selector.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/xinha/file-selector.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/xinha/file-selector.tcl 1 Jul 2006 01:27:25 -0000 1.4 +++ openacs-4/packages/xowiki/www/xinha/file-selector.tcl 17 Aug 2006 01:44:27 -0000 1.5 @@ -3,7 +3,7 @@ @author Gustaf Neumann neumann@wu-wien.ac.at @creation-date 13.10.2005 @cvs-id $Id$ -} { +} { {fs_package_id:integer,notnull,optional} {folder_id:integer,optional} {orderby:optional} @@ -16,7 +16,7 @@ if {[info exists folder_id]} { # get package_id from folder_id foreach {fs_package_id root_folder_id} \ - [fs::get_folder_package_and_root $folder_id] break + [fs::get_folder_package_and_root $folder_id] break } else { # get package_id from package name set key file-storage @@ -74,78 +74,78 @@ set parent_folder_id [fs::get_parent -item_id $folder_id] set up_name [fs::get_object_name -object_id $parent_folder_id] set up_url [export_vars -base file-selector \ - {fs_package_id {folder_id $parent_folder_id} - selector_type file_types}] + {fs_package_id {folder_id $parent_folder_id} + selector_type file_types}] } # if user has write permission, create image upload form, if {[permission::permission_p -party_id $user_id -object_id $folder_id \ - -privilege "write"]} { + -privilege "write"]} { set write_p 1 ad_form \ -name upload_form \ -mode edit \ -export {fs_package_id folder_id orderby selector_type file_types} \ -html { enctype multipart/form-data } \ -form { - {upload_file:file(file) {html {size 30}} } - {ok_btn:text(submit) {label "[_ acs-templating.HTMLArea_SelectUploadBtn]"} - } + {upload_file:file(file) {html {size 30}} } + {ok_btn:text(submit) {label "[_ acs-templating.HTMLArea_SelectUploadBtn]"} + } } \ -on_submit { - # check file name - if {$upload_file eq ""} { - template::form::set_error upload_form upload_file \ - [_ acs-templating.HTMLArea_SpecifyUploadFilename] - break - } + # check file name + if {$upload_file eq ""} { + template::form::set_error upload_form upload_file \ + [_ acs-templating.HTMLArea_SpecifyUploadFilename] + break + } - # check quota - set maximum_folder_size [ad_parameter "MaximumFolderSize"] - - if { $maximum_folder_size ne "" } { - set max [ad_parameter "MaximumFolderSize"] - if { $folder_size+[file size ${upload_file.tmpfile}] > $max } { - template::form::set_error upload_form upload_file \ - [_ file-storage.out_of_space] - break - } - } - - set file_name [template::util::file::get_property filename $upload_file] - set upload_tmpfile [template::util::file::get_property tmp_filename $upload_file] - set mime_type [template::util::file::get_property mime_type $upload_file] - - if {$selector_type eq "image" && ![string match "image/*" $mime_type]} { - template::form::set_error upload_form upload_file \ - [_ acs-templating.HTMLArea_SelectImageUploadNoImage] - break - } - - set existing_file_id [fs::get_item_id -name $file_name -folder_id $folder_id] - - if {$existing_file_id ne ""} { - # write new revision - fs::add_file \ - -name $file_name \ - -item_id $existing_file_id \ - -parent_id $folder_id \ - -tmp_filename $upload_tmpfile \ - -creation_user $user_id \ - -creation_ip [ad_conn peeraddr] \ - -package_id $fs_package_id - } else { - # write file - fs::add_file \ - -name $file_name \ - -parent_id $folder_id \ - -tmp_filename $upload_tmpfile \ - -creation_user $user_id \ - -creation_ip [ad_conn peeraddr] \ - -package_id $fs_package_id - } - + # check quota + set maximum_folder_size [ad_parameter "MaximumFolderSize"] + + if { $maximum_folder_size ne "" } { + set max [ad_parameter "MaximumFolderSize"] + if { $folder_size+[file size ${upload_file.tmpfile}] > $max } { + template::form::set_error upload_form upload_file \ + [_ file-storage.out_of_space] + break + } + } + + set file_name [template::util::file::get_property filename $upload_file] + set upload_tmpfile [template::util::file::get_property tmp_filename $upload_file] + set mime_type [template::util::file::get_property mime_type $upload_file] + + if {$selector_type eq "image" && ![string match "image/*" $mime_type]} { + template::form::set_error upload_form upload_file \ + [_ acs-templating.HTMLArea_SelectImageUploadNoImage] + break + } + + set existing_file_id [fs::get_item_id -name $file_name -folder_id $folder_id] + + if {$existing_file_id ne ""} { + # write new revision + fs::add_file \ + -name $file_name \ + -item_id $existing_file_id \ + -parent_id $folder_id \ + -tmp_filename $upload_tmpfile \ + -creation_user $user_id \ + -creation_ip [ad_conn peeraddr] \ + -package_id $fs_package_id + } else { + # write file + fs::add_file \ + -name $file_name \ + -parent_id $folder_id \ + -tmp_filename $upload_tmpfile \ + -creation_user $user_id \ + -creation_ip [ad_conn peeraddr] \ + -package_id $fs_package_id + } + } } else { set write_p 0 @@ -173,78 +173,78 @@ -filters {folder_id {} file_types {} selector_type {} fs_package_id {}} \ -elements { name { - label "[_ file-storage.Name]" - display_template { - - + - - - - - #file-storage.@contents.type@# - onclick="selectImage('@contents.object_id@','@contents.file_url@','@contents.type@');return false;">@contents.name@ - } - orderby_desc {name desc} - orderby_asc {name asc} - html {nowrap ""} + + #file-storage.@contents.type@# + onclick="selectImage('@contents.object_id@','@contents.file_url@','@contents.type@');return false;">@contents.name@ + } + orderby_desc {name desc} + orderby_asc {name asc} + html {nowrap ""} } content_size_pretty { - label "[_ file-storage.Size]" - orderby_desc {content_size desc} - orderby_asc {content_size asc} + label "[_ file-storage.Size]" + orderby_desc {content_size desc} + orderby_asc {content_size asc} } type { - label "[_ file-storage.Type]" - orderby_desc {type desc} - orderby_asc {type asc} + label "[_ file-storage.Type]" + orderby_desc {type desc} + orderby_asc {type asc} } last_modified_pretty { - label "[_ file-storage.Last_Modified]" - orderby_desc {last_modified_ansi desc} - orderby_asc {last_modified_ansi asc} - html {nowrap ""} + label "[_ file-storage.Last_Modified]" + orderby_desc {last_modified_ansi desc} + orderby_asc {last_modified_ansi asc} + html {nowrap ""} } } set order_by_clause [expr {[exists_and_not_null orderby] ? - [template::list::orderby_clause -orderby -name contents] : - " order by fs_objects.sort_key, fs_objects.name asc"}] + [template::list::orderby_clause -orderby -name contents] : + " order by fs_objects.sort_key, fs_objects.name asc"}] if {$selector_type eq "image"} { set file_types "image/%" } set filter_clause [expr {$file_types eq "*" ? "" : - "and (type like '$file_types' or type = 'folder')" }] + "and (type like '$file_types' or type = 'folder')" }] set fs_sql "select object_id, name, live_revision, type, title, - to_char(last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - content_size, url, sort_key, file_upload_name, - case - when :folder_path is null - then fs_objects.name - else :folder_path || '/' || name - end as file_url, - case - when last_modified >= (now() - cast('99999' as interval)) - then 1 - else 0 - end as new_p - from fs_objects - where parent_id = :folder_id - and exists (select 1 - from acs_object_party_privilege_map m - where m.object_id = fs_objects.object_id - and m.party_id = :user_id - and m.privilege = 'read') - $filter_clause - $order_by_clause" + to_char(last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, + content_size, url, sort_key, file_upload_name, + case + when :folder_path is null + then fs_objects.name + else :folder_path || '/' || name + end as file_url, + case + when last_modified >= (now() - cast('99999' as interval)) + then 1 + else 0 + end as new_p + from fs_objects + where parent_id = :folder_id + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = fs_objects.object_id + and m.party_id = :user_id + and m.privilege = 'read') + $filter_clause + $order_by_clause" db_multirow -extend { icon last_modified_pretty content_size_pretty @@ -263,7 +263,7 @@ if {$title eq ""} {set title $name} set file_upload_name [fs::remove_special_file_system_characters \ - -string $file_upload_name] + -string $file_upload_name] if { $content_size ne "" } { incr content_size_total $content_size @@ -276,8 +276,8 @@ set folder_p 1 set icon /resources/file-storage/folder.gif set file_url [export_vars -base file-selector \ - {fs_package_id {folder_id $object_id} - selector_type file_types}] + {fs_package_id {folder_id $object_id} + selector_type file_types}] } url { set folder_p 1 Index: openacs-4/packages/xowiki/www/xinha/insert-ilink.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/xinha/insert-ilink.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/xinha/insert-ilink.tcl 30 Dec 2005 00:09:58 -0000 1.3 +++ openacs-4/packages/xowiki/www/xinha/insert-ilink.tcl 17 Aug 2006 01:44:27 -0000 1.4 @@ -11,7 +11,7 @@ set selector_type "file" set file_selector_link [export_vars -base file-selector \ - {fs_package_id folder_id selector_type file_types}] + {fs_package_id folder_id selector_type file_types}] set fs_found 1 #set user_id [ad_verify_and_get_user_id] Index: openacs-4/packages/xowiki/www/xinha/insert-image.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/xinha/insert-image.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/xinha/insert-image.tcl 30 Dec 2005 00:09:58 -0000 1.3 +++ openacs-4/packages/xowiki/www/xinha/insert-image.tcl 17 Aug 2006 01:44:27 -0000 1.4 @@ -10,5 +10,5 @@ set selector_type "image" set file_selector_link [export_vars -base file-selector \ - {fs_package_id folder_id selector_type}] + {fs_package_id folder_id selector_type}] set fs_found 1