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.239.2.55 -r1.239.2.56 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 28 Sep 2020 21:04:04 -0000 1.239.2.55 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 7 Oct 2020 10:09:42 -0000 1.239.2.56 @@ -4533,7 +4533,7 @@ -uc $uc \ -view_field $view_field \ -buttons $buttons \ - -package_relative_url [expr {[llength $bulk_actions] > 0}] \ + -include_object_id_attribute [expr {[llength $bulk_actions] > 0}] \ -form_item_ids $form_item_ids \ -with_form_link $with_form_link \ -csv $csv \ 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.332.2.65 -r1.332.2.66 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 31 Aug 2020 14:35:24 -0000 1.332.2.65 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 7 Oct 2020 10:09:42 -0000 1.332.2.66 @@ -101,6 +101,73 @@ return $name } + Package ad_instproc get_ids_for_bulk_actions {-parent_id page_references} { + + The page_reference is either an item_id, a fully qualified URL + path or the name exactly as stored in the content repository + ("name" attribute in the database, requires parent_id to be + provided as well) + + @param parent_id optional, only needed in lagacy cases, + when page_reference is provided as page name + @param page_references item_ids, paths or names to be resolved as item_ids + @return list of valid item_ids + + } { + set item_ids {} + foreach page_ref $page_references { + # + # First check whether we got a valid item_id, then check for a + # URL path. If both are failing, resort to the legacy methods + # (which will be dropped eventually). + # + if {[string is integer -strict $page_ref]} { + if {[content::item::get -item_id $page_ref]} { + set item_id $page_ref + } + } elseif {[string index $page_ref 0] eq "/"} { + # + # $page_ref looks like a URL path + # + set ref [:item_info_from_url $page_ref] + set item_id [dict get $ref item_id] + ns_log notice "get_ids_for_bulk_actions: URL '$page_ref' item_ref <$ref> -> $item_id" + } else { + # + # Try $page_ref as item_ref + # + set parent_id_arg [expr {[info exists parent_id] ? [list -parent_id $parent_id] : {}}] + set p [:get_page_from_item_ref {*}$parent_id_arg $page_ref] + if {$p ne ""} { + set item_id [$p item_id] + } + ns_log notice "get_ids_for_bulk_actions: tried to resolve item_ref <$page_ref> -> $item_id" + } + + if {![info exists item_id] || $item_id == 0} { + # + # Try to resolve either via a passed in parent_id or via root folder + # + set parent_ids [expr {[info exists parent_id] ? $parent_id : ${:folder_id}}] + foreach parent_id $parent_ids { + set item_id [::xo::db::CrClass lookup -name $page_ref -parent_id $parent_id] + if {$item_id != 0} { + break + } + } + } + + if {$item_id != 0} { + #:log "clipboard-add adds $page_ref // $item_id" + lappend item_ids $item_id + } else { + ns_log warning "get_ids_for_bulk_actions: clipboard entry <$page_ref> could not be resolved" + } + } + return $item_ids + } + + Package instproc normalize_name {{-with_prefix:boolean false} string} { # # Normalize the name (in a narrow sense) which refers to a @@ -2612,7 +2679,7 @@ Package ad_instproc www-delete {-item_id -name -parent_id} { - This web-callabel "delete" method does not require an instantiated object, + This web-callable "delete" method does not require an instantiated object, while the class-specific delete methods in xowiki-procs need these. If a (broken) object can't be instantiated, it cannot be deleted. Therefore, we need this package level delete method. Index: openacs-4/packages/xowiki/tcl/table-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/table-widget-procs.tcl,v diff -u -r1.1.2.8 -r1.1.2.9 --- openacs-4/packages/xowiki/tcl/table-widget-procs.tcl 24 Aug 2020 23:51:52 -0000 1.1.2.8 +++ openacs-4/packages/xowiki/tcl/table-widget-procs.tcl 7 Oct 2020 10:09:42 -0000 1.1.2.9 @@ -147,7 +147,7 @@ {-uc {tcl false h "" vars "" sql ""}} {-view_field _name} {-buttons ""} - {-package_relative_url:boolean false} + {-include_object_id_attribute:boolean false} {-form_item_ids ""} {-with_form_link:boolean false} {-csv:boolean false} @@ -190,11 +190,8 @@ :add set __c [:last_child] - if {$package_relative_url} { - # xowiki/www/admin/export expects a path to the object - # relative to the package url - set url [[$p package_id] folder_path -parent_id [$p parent_id]][$p name] - $__c set ID $url + if {$include_object_id_attribute} { + $__c set ID [$p item_id] } if {"publish_status" in $buttons || "slim_publish_status" in $buttons} { $__c set _publish_status " " 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.542.2.89 -r1.542.2.90 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 28 Sep 2020 18:24:29 -0000 1.542.2.89 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 7 Oct 2020 10:09:42 -0000 1.542.2.90 @@ -1754,7 +1754,7 @@ } # - # context handling + # Resolve context handling. # Page instproc set_resolve_context {-package_id:required -parent_id:required -item_id} { # @@ -2320,7 +2320,11 @@ return [list name $name lang $lang normalized_name $normalized_name anchor $anchor query $query] } + # + # Forwarder to the Package instance object + # Page instforward item_ref {%my package_id} %proc + Page instforward get_ids_for_bulk_actions {%my package_id} %proc Page ad_instproc pretty_link { {-anchor ""} @@ -3902,7 +3906,7 @@ foreach {_ _ v} [regexp -inline -all [template::adp_variable_regexp] $content] { lappend result $v "" } - + return $result } 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.368.2.77 -r1.368.2.78 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 29 Sep 2020 05:37:43 -0000 1.368.2.77 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 7 Oct 2020 10:09:42 -0000 1.368.2.78 @@ -40,69 +40,6 @@ ${:package_id} returnredirect [:query_parameter "return_url" [:pretty_link]] } - - Page ad_instproc get_ids_for_bulk_actions {-parent_id page_references} { - - The page_reference is either an item_id, a fully qualified URL - path or the name exactly as stored in the content repository - ("name" attribute in the database) - - @param parent_id optional - @param page_references item_ids, paths or names to be resolved as item_ids - @return list of item_ids - - } { - set item_ids {} - foreach page_ref $page_references { - # - # First check whether we got a valid item_id, then check for a - # URL path. If both are failing, resort to the legacy methods - # (which will be dropped eventually). - # - if {[string is integer -strict $page_ref]} { - if {[content::item::get -item_id $page_ref]} { - set item_id $page_ref - } - } elseif {[string index $page_ref 0] eq "/"} { - # - # $page_ref looks like a URL path - # - set ref [${:package_id} item_info_from_url $page_ref] - set item_id [dict get $ref item_id] - ns_log notice "www-clipboard-add item_ref <$ref> -> item_id" - } else { - set p [${:package_id} get_page_from_item_ref $page_ref] - if {$p ne ""} { - set item_id [$p item_id] - } - } - if {![info exists item_id] || $item_id == 0} { - # - # Try to resolve either via a passed in parent_id or via direct - # child or via sibling. - # - set parent_ids [expr {[info exists parent_id] - ? $parent_id - : [list ${:item_id} ${:parent_id}]}] - foreach parent_id $parent_ids { - set item_id [::xo::db::CrClass lookup -name $page_ref -parent_id $parent_id] - if {$item_id != 0} { - break - } - } - } - - if {$item_id ne 0} { - #:log "clipboard-add adds $page_ref // $item_id" - lappend item_ids $item_id - } else { - ns_log warning "get_ids_for_bulk_actions: clipboard entry <$page_ref> could not be resolved" - } - } - return $item_ids - } - - # # Externally callable method: clipboard-add # Index: openacs-4/packages/xowiki/www/admin/bulk-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/bulk-delete.tcl,v diff -u -r1.5.2.2 -r1.5.2.3 --- openacs-4/packages/xowiki/www/admin/bulk-delete.tcl 20 Dec 2019 15:43:54 -0000 1.5.2.2 +++ openacs-4/packages/xowiki/www/admin/bulk-delete.tcl 7 Oct 2020 10:09:42 -0000 1.5.2.3 @@ -10,9 +10,9 @@ {-objects ""} } -foreach o $objects { - ns_log notice "DELETE $o" - ::$package_id www-delete -name $o +foreach item_id [$package_id get_ids_for_bulk_actions $objects] { + ns_log notice "DELETE $item_id" + ::$package_id www-delete -item_id $item_id } ad_returnredirect "./list" 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.24.2.3 -r1.24.2.4 --- openacs-4/packages/xowiki/www/admin/export.tcl 7 Feb 2020 08:44:05 -0000 1.24.2.3 +++ openacs-4/packages/xowiki/www/admin/export.tcl 7 Oct 2020 10:09:42 -0000 1.24.2.4 @@ -18,17 +18,13 @@ # if {$objects eq ""} { set sql [$object_type instance_select_query -folder_id $folder_id -with_subtypes true] - xo::dc foreach instance_select $sql { set items($item_id) 1 } + xo::dc foreach instance_select $sql { + set items($item_id) 1 + } } else { - foreach o $objects { - ::$package_id get_lang_and_name -default_lang [::xo::cc lang] -path $o lang stripped_name - set parent_id [::$package_id get_parent_and_name -lang $lang \ - -path $stripped_name -parent_id $folder_id \ - parent local_name] - #ns_log notice "lookup of $o in $folder_id returns [::xo::db::CrClass lookup -name $o -parent_id $parent_id]" - if {[set item_id [::xo::db::CrClass lookup -name $local_name -parent_id $parent_id]] != 0} { - set items($item_id) 1 - } + ns_log notice "OBJECTS <$objects>" + foreach item_id [$package_id get_ids_for_bulk_actions $objects] { + set items($item_id) 1 } } 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.28.2.5 -r1.28.2.6 --- openacs-4/packages/xowiki/www/admin/import.tcl 1 Jul 2020 19:31:58 -0000 1.28.2.5 +++ openacs-4/packages/xowiki/www/admin/import.tcl 7 Oct 2020 10:09:42 -0000 1.28.2.6 @@ -1,5 +1,6 @@ ::xowiki::Package initialize -ad_doc { - import objects in xotcl format + + Import objects in XOTcl serializer format @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) @creation-date Aug 11, 2006 Fisheye: Tag 1.46.2.11 refers to a dead (removed) revision in file `openacs-4/packages/xowiki/www/admin/test.tcl'. Fisheye: No comparison available. Pass `N' to diff?