Index: openacs-4/packages/xowiki/tcl/import-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/import-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/xowiki/tcl/import-procs.tcl 19 Nov 2009 22:57:19 -0000 1.11 +++ openacs-4/packages/xowiki/tcl/import-procs.tcl 1 Jun 2010 13:22:12 -0000 1.12 @@ -11,7 +11,7 @@ Class Importer -parameter { {added 0} {replaced 0} {updated 0} - {package_id} {folder_id} {user_id} + {package_id} {parent_id} {user_id} } Importer instproc init {} { my set log "" @@ -176,7 +176,7 @@ if {[info exists item_ids($old_parent_id)]} { $o set parent_id $id_map($old_parent_id) } else { - $o set parent_id [my folder_id] + $o set parent_id [my parent_id] } # Everything is mapped, we can now do the import. Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -r1.144 -r1.145 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 18 May 2010 08:10:47 -0000 1.144 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 1 Jun 2010 13:22:12 -0000 1.145 @@ -533,7 +533,8 @@ rss-button instproc render {} { my get_parameters - set href [export_vars -base [$package_id package_url] {{rss $span} name_filter title entries_of}] + set parent_ids [[my set __including_page] parent_id] + set href [export_vars -base [$package_id package_url] {{rss $span} parent_ids name_filter title entries_of}] regsub -all & $href "&" href ::xo::Page requireLink -rel alternate -type application/rss+xml -title RSS -href $href return "RSS" @@ -1858,7 +1859,14 @@ set page_order_att "page_order," } - set parent_id [expr {$folder_mode ? [$__including_page item_id] : [$package_id folder_id]}] + if {$folder_mode} { + # TODO just needed for michael aram? + set parent_id [$__including_page item_id] + } else { + #set parent_id [$package_id folder_id] + set parent_id [$__including_page parent_id] + } + set sql [::xo::db::sql select \ -vars "page_id, $page_order_att name, title" \ -from "xowiki_page_live_revision p" \ @@ -2464,7 +2472,14 @@ foreach {locale locale_clause} \ [::xowiki::Includelet locale_clause -revisions p -items p $package_id $locale] break - set parent_id [expr {$folder_mode ? [$__including_page item_id] : [$package_id folder_id]}] + if {$folder_mode} { + # TODO just needed for michael aram? + set parent_id [$__including_page item_id] + } else { + #set parent_id [$package_id folder_id] + set parent_id [$__including_page parent_id] + } + set pages [::xowiki::Page instantiate_objects -sql \ "select page_id, page_order, name, title, item_id \ from xowiki_page_live_revision p \ Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.213 -r1.214 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 31 May 2010 09:37:52 -0000 1.213 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 1 Jun 2010 13:22:12 -0000 1.214 @@ -1501,6 +1501,7 @@ set r [RSS new -destroy_on_cleanup \ -package_id [my id] \ + -parent_ids [my query_parameter parent_ids ""] \ -name_filter $name_filter \ -entries_of $entries_of \ -title $title \ @@ -1693,15 +1694,15 @@ # Package import # - Package ad_instproc import {-user_id -folder_id {-replace 0} -objects {-create_user_ids 0}} { + Package ad_instproc import {-user_id {-parent_id 0} {-replace 0} -objects {-create_user_ids 0}} { import the specified pages into the xowiki instance } { - if {![info exists folder_id]} {set folder_id [my folder_id]} - if {![info exists user_id]} {set user_id [::xo::cc user_id]} - if {![info exists objects]} {set objects [::xowiki::Page allinstances]} + if {$parent_id == 0} {set parent_id [my folder_id]} + if {![info exists user_id]} {set user_id [::xo::cc user_id]} + if {![info exists objects]} {set objects [::xowiki::Page allinstances]} set msg "processing objects: $objects
" - set importer [Importer new -package_id [my id] -folder_id $folder_id -user_id $user_id] + set importer [Importer new -package_id [my id] -parent_id $parent_id -user_id $user_id] $importer import_all -replace $replace -objects $objects -create_user_ids $create_user_ids append msg [$importer report] } @@ -1773,7 +1774,7 @@ # for pages using this template set classes [concat $object_type [$object_type info heritage]] if {[lsearch $classes "::xowiki::PageTemplate"] > -1} { - set count [::xowiki::PageTemplate count_usages -item_id $item_id] + set count [::xowiki::PageTemplate count_usages -item_id $item_id -publish_status all] if {$count > 0} { return [$id error_msg \ [_ xowiki.error-delete_entries_first [list count $count]]] Index: openacs-4/packages/xowiki/tcl/syndicate-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/syndicate-procs.tcl,v diff -u -r1.35 -r1.36 --- openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 2 May 2010 12:50:19 -0000 1.35 +++ openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 1 Jun 2010 13:22:12 -0000 1.36 @@ -21,6 +21,7 @@ Class create RSS -superclass XMLSyndication -parameter { maxentries + {parent_ids ""} {name_filter ""} {entries_of ""} {days ""} @@ -109,13 +110,15 @@ [::xo::db::sql since_interval_condition p.publish_date "$days days"] } if {$entries_of ne ""} { - set form_items [list] - set folder_id [$package_id folder_id] - foreach t [split $entries_of |] { - set form_item_id [::xo::db::CrClass lookup -name $t -parent_id $folder_id] - if {$form_item_id == 0} {error "Cannot lookup page $t"} - lappend form_items $form_item_id + if {[regexp {^[0-9 ]+$} $entries_of]} { + # form item_ids were provided as a filter + set form_items $entries_of + } else { + set form_items [::xowiki::Weblog instantiate_forms \ + -forms $entries_of \ + -package_id $package_id] } + if {[llength $form_items] == 0} { # In case, we have no form_items to select on, let the query fail # without causing a SQL error. @@ -130,8 +133,13 @@ RSS instproc render {} { my instvar package_id max_entries name_filter title days description siteurl base_table - set folder_ids [::$package_id folder_id] + if {[my parent_ids] ne ""} { + set folder_ids [my parent_ids] + } else { + set folder_ids [::$package_id folder_id] + } + my set link $siteurl[lindex [site_node::get_url_from_object_id -object_id $package_id] 0] set base_table xowiki_pagex Index: openacs-4/packages/xowiki/tcl/weblog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/weblog-procs.tcl,v diff -u -r1.48 -r1.49 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 30 Apr 2010 11:53:09 -0000 1.48 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 1 Jun 2010 13:22:12 -0000 1.49 @@ -5,6 +5,7 @@ Class create ::xowiki::Weblog -parameter { package_id + {parent_id 0} {page_size 20} {page_number ""} date @@ -45,6 +46,7 @@ lappend form_item_ids [$page item_id] } } + #my msg "instantiate: parent_id=$parent_id-forms=$forms -> $form_item_ids" return $form_item_ids } @@ -112,18 +114,25 @@ if {$entries_of ne ""} { if {[string match "::*" $entries_of]} { - # xotcl classes were provided as a filter + # class names were provided as a filter set class_clause \ " and ci.content_type in ('[join [split $entries_of { }] ',']')" } else { - # we use a form as a filter - my instvar form_items - set form_items [::xowiki::Weblog instantiate_forms \ + my instvar form_ids + if {[regexp {^[0-9 ]+$} $entries_of]} { + # form item_ids were provided as a filter + set form_ids $entries_of + } else { + # form names provided as a filter + set form_ids [::xowiki::Weblog instantiate_forms \ -forms $entries_of \ -package_id $package_id] - append extra_where_clause " and bt.page_template in ('[join $form_items ',']') and bt.page_instance_id = bt.revision_id " + } + + append extra_where_clause " and bt.page_template in ('[join $form_ids ',']') and bt.page_instance_id = bt.revision_id " set base_type ::xowiki::FormPage set base_table xowiki_form_pagei + append attributes ,bt.page_template,bt.state set class_clause "" } } @@ -146,8 +155,13 @@ foreach i [split [my exclude_item_ids] ,] {lappend ::xowiki_page_item_id_rendered $i} $items set weblog_obj [self] + set query_parent_id [my parent_id] + if {$query_parent_id == 0} { + set query_parent_id $folder_id + } + set sql \ - [list -folder_id $folder_id \ + [list -parent_id $query_parent_id \ -select_attributes $attributes \ -orderby "publish_date desc" \ -base_table $base_table \ @@ -168,13 +182,13 @@ set nr_items [db_string [my qn count] [eval $base_type instance_select_query $sql -count true]] #my msg count=$nr_items - #my msg sql=$sql + #my ds [eval $base_type instance_select_query $sql] set s [$base_type instantiate_objects -sql [eval $base_type instance_select_query $sql]] foreach c [$s children] { $c instvar revision_id publish_date title name item_id creator creation_user \ parent_id description body instance_attributes - + set time [::xo::db::tcl_date $publish_date tz] set pretty_date [util::age_pretty -timestamp_ansi $time \ -sysdate_ansi [clock_to_ansi [clock seconds]] \ Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.397 -r1.398 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 29 May 2010 10:53:42 -0000 1.397 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 1 Jun 2010 13:22:12 -0000 1.398 @@ -922,6 +922,20 @@ } } + Page instproc get_folder {-folder_form_ids:required} { + set page [self] + while {1} { + if {[$page istype ::xowiki::FormPage]} { + # folder_form_ids is a list of form_ids + if {[lsearch $folder_form_ids [$page page_template]] > -1} { + break + } + } + set page [::xo::db::CrClass get_instance_from_db -item_id [$page parent_id]] + } + return $page + } + # Page instproc init {} { # my log "--W " # ::xo::show_stack @@ -1375,6 +1389,7 @@ if {[catch {set l [my create_link $arg]} errorMsg]} { return "
$errorMsg
\ - [my include [list form-usages -all true -form_item_id [my item_id]]] \ + [my include [list form-usages -publish_status all -parent_id * -form_item_id [my item_id]]] \
$package_id error_msg $error_msg } else { Index: openacs-4/packages/xowiki/www/admin/import.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/import.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/xowiki/www/admin/import.adp 5 Oct 2008 01:50:44 -0000 1.5 +++ openacs-4/packages/xowiki/www/admin/import.adp 1 Jun 2010 13:22:12 -0000 1.6 @@ -7,5 +7,5 @@ @msg;noquote@ -