Index: openacs-4/packages/xotcl-core/xotcl-core.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/xotcl-core.info,v diff -u -r1.106.2.22 -r1.106.2.23 --- openacs-4/packages/xotcl-core/xotcl-core.info 27 Jul 2020 17:47:03 -0000 1.106.2.22 +++ openacs-4/packages/xotcl-core/xotcl-core.info 26 Aug 2020 18:34:59 -0000 1.106.2.23 @@ -10,7 +10,7 @@ t xotcl - + Gustaf Neumann XOTcl library functionality (e.g. thread handling, online documentation, Generic Form and List Classes) 2017-08-06 @@ -42,7 +42,7 @@ BSD-Style 2 - + Index: openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl,v diff -u -r1.41.2.30 -r1.41.2.31 --- openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 13 Aug 2020 18:16:34 -0000 1.41.2.30 +++ openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 26 Aug 2020 18:34:59 -0000 1.41.2.31 @@ -660,6 +660,34 @@ ::xo::Package instforward exists_form_parameter {%set :context} %proc ::xo::Package instforward returnredirect {%set :context} %proc + ::xo::Package instproc instantiate_forms { + -forms:required + {-default_lang ""} + {-parent_id ""} + } { + set form_item_ids [list] + foreach item_ref [split $forms |] { + # + # The following regexp should include the majority of valid + # items refs. + # + if {![regexp {^[[:alnum:]:./_-]+$} $item_ref]} { + error "invalid form specification '$item_ref'" + } + #:log "trying to get $item_ref // parent_id $parent_id" + set page [:get_page_from_item_ref \ + -use_prototype_pages true \ + -use_package_path true \ + -parent_id $parent_id \ + $item_ref] + #:log "weblog form $item_ref => $page" + if {$page ne ""} { + lappend form_item_ids [$page item_id] + } + } + #:log "instantiate: parent_id=$parent_id-forms=$forms -> $form_item_ids" + return $form_item_ids + } ::xo::Package instproc get_parameter {attribute {default ""}} { set package_id ${:id} set parameter_obj [::xo::parameter get_parameter_object \ Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.180.2.44 -r1.180.2.45 --- openacs-4/packages/xowiki/xowiki.info 26 Aug 2020 11:16:11 -0000 1.180.2.44 +++ openacs-4/packages/xowiki/xowiki.info 26 Aug 2020 18:34:59 -0000 1.180.2.45 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2017-08-06 @@ -55,8 +55,8 @@ BSD-Style 2 - - + + Index: openacs-4/packages/xowiki/tcl/folder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/folder-procs.tcl,v diff -u -r1.55.2.41 -r1.55.2.42 --- openacs-4/packages/xowiki/tcl/folder-procs.tcl 26 Aug 2020 11:16:11 -0000 1.55.2.41 +++ openacs-4/packages/xowiki/tcl/folder-procs.tcl 26 Aug 2020 18:34:59 -0000 1.55.2.42 @@ -252,10 +252,9 @@ set return_url [::xo::cc url] set nls_language [$page get_nls_language_from_lang $lang] - set :folder_form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form \ - -package_id $package_id] - set :link_form_id [::xowiki::Weblog instantiate_forms -forms en:link.form \ - -package_id $package_id] + set :folder_form_id [::$package_id instantiate_forms -forms en:folder.form] + set :link_form_id [::$package_id instantiate_forms -forms en:link.form] + #:msg folder_form=${:folder_form_id} set :current_folder [$page get_folder -folder_form_ids ${:folder_form_id}] @@ -322,12 +321,12 @@ # easy. "make_link" just checks for the existence of the # variable, so no add "parent_id" to the "bind_vars". # - + if {[${:current_folder_id} is_package_root_folder]} { set opt_parent_id "" set folder_link [::$package_id package_url] set bind_vars {} - #:msg "use instance name as title to [::$package_id instance_name]" + #:msg "use instance name as title to [::$package_id instance_name]" ${:current_folder} title [::$package_id instance_name] } else { set parent_id ${:current_folder_id} @@ -366,7 +365,7 @@ #:msg top_folder_of_tree=$top_folder_of_tree } } - + if {$top_folder_of_tree eq $root_folder || [$top_folder_of_tree parent_id] eq "-100" } { Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.284.2.112 -r1.284.2.113 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 20 Aug 2020 14:14:11 -0000 1.284.2.112 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 26 Aug 2020 18:34:59 -0000 1.284.2.113 @@ -4507,11 +4507,10 @@ if {![info exists :form]} { return } next set form_name [:form] - set :package_id [${:object} package_id] - set form_objs [::xowiki::Weblog instantiate_forms \ + set form_objs [::${:package_id} instantiate_forms \ -parent_id [${:object} parent_id] \ -default_lang [${:object} lang] \ - -forms $form_name -package_id ${:package_id}] + -forms $form_name] :log "form_page $form_name resolved into '$form_objs'" if {$form_objs eq ""} { @@ -4569,7 +4568,7 @@ if {![info exists :form_object_item_ids]} { error "No forms specified for form_field '${:name}'" } - set :package_id [[lindex ${:form_object_item_ids} 0] package_id] + #set :package_id [[lindex ${:form_object_item_ids} 0] package_id] next } @@ -5002,18 +5001,18 @@ # for now, we allow just FormPages as child_pages # if {![info exists :form]} { return } - set :form_objs [::xowiki::Weblog instantiate_forms \ + set :package_id [${:object} package_id] + set :form_objs [::${:package_id} instantiate_forms \ -parent_id [${:object} parent_id] \ -default_lang [${:object} lang] \ - -forms [:form] \ - -package_id [${:object} package_id]] + -forms [:form]] } child_pages instproc pretty_value {v} { if {[info exists :form_objs]} { set count 0 foreach form ${:form_objs} { incr count [$form count_usages \ - -package_id [${:object} package_id] \ + -package_id ${:package_id} \ -parent_id [${:object} item_id] \ -publish_status ${:publish_status}] } 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.42.2.5 -r1.42.2.6 --- openacs-4/packages/xowiki/tcl/import-procs.tcl 11 Aug 2020 11:51:49 -0000 1.42.2.5 +++ openacs-4/packages/xowiki/tcl/import-procs.tcl 26 Aug 2020 18:34:59 -0000 1.42.2.6 @@ -439,8 +439,7 @@ # if the folder exists already, we have nothing to do } else { # we create a new folder ... - set folder_form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form \ - -package_id $package_id] + set folder_form_id [::$package_id instantiate_forms -forms en:folder.form] set folder_object [FormPage new -destroy_on_cleanup \ -title $file_name \ -name $file_name \ @@ -471,8 +470,8 @@ } else { # create a new photo entry :log "new Photo $file_name" - set photoFormObj [::xowiki::Weblog instantiate_forms \ - -parent_id $parent_id -forms en:photo.form -package_id $package_id] + set photoFormObj [::$package_id instantiate_forms \ + -parent_id $parent_id -forms en:photo.form] set photo_object [$photoFormObj create_form_page_instance \ -name en:$file_name \ -nls_language en_US \ 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.50 -r1.239.2.51 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 21 Aug 2020 11:02:20 -0000 1.239.2.50 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 26 Aug 2020 18:35:00 -0000 1.239.2.51 @@ -4020,12 +4020,13 @@ form-menu instproc render {} { :get_parameters + set package_id [${:__including_page} package_id] #:msg form-menu-[info exists form_item_id] buttons=$buttons + if {![info exists form_item_id]} { - set form_item_id [::xowiki::Weblog instantiate_forms \ + set form_item_id [::$package_id instantiate_forms \ -forms $form \ - -parent_id [${:__including_page} parent_id] \ - -package_id [${:__including_page} package_id]] + -parent_id [${:__including_page} parent_id]] if {$form_item_id eq ""} { # we could throw an error as well... :msg "could not locate form '$form' for parent_id [${:__including_page} parent_id]" @@ -4037,7 +4038,6 @@ set parent_id [${:__including_page} item_id] } } else { - #set parent_id [::$package_id folder_id] set parent_id [${:__including_page} parent_id] } if {![info exists button_objs]} { @@ -4096,8 +4096,8 @@ :get_parameters set o ${:__including_page} if {![info exists parent_id]} {set parent_id [$o parent_id]} - set form_item_ids [::xowiki::Weblog instantiate_forms \ - -forms $form -package_id $package_id \ + set form_item_ids [::$package_id instantiate_forms \ + -forms $form \ -parent_id $parent_id] if {[llength $form_item_ids] != 1} { return "no such form $form
\n" @@ -4315,10 +4315,9 @@ # Start for search for form in the directory of the including # form. The provided package_id and parent_id refers to the # form instances, not to the forms. - set form_item_ids [::xowiki::Weblog instantiate_forms \ + set form_item_ids [::$package_id instantiate_forms \ -parent_id $parent_id \ - -default_lang [$o lang] \ - -forms $form -package_id [$o package_id]] + -default_lang [$o lang]] if {$form_item_ids eq ""} { return -code error "could not load form '$form' (default-language [$o lang])" } @@ -4331,10 +4330,10 @@ set inherit_form_ids {} if {$inherit_from_forms ne ""} { foreach inherit_form $inherit_from_forms { - set inherit_form_id [::xowiki::Weblog instantiate_forms \ + set inherit_form_id [::$package_id instantiate_forms \ -parent_id [$o parent_id] \ -default_lang [$o lang] \ - -forms $inherit_form -package_id [$o package_id]] + -forms $inherit_form] if {$inherit_form_id ne ""} { if {[::$inherit_form_id istype ::xowiki::FormPage]} { set p [::$inherit_form_id property form_constraints] @@ -4725,7 +4724,7 @@ {-form "en:photo.form"} {-glob ""} {-width ""} {-height ""} } { - set form_item_ids [::xowiki::Weblog instantiate_forms -parent_id $parent_id -forms $form -package_id $package_id] + set form_item_ids [::$package_id instantiate_forms -parent_id $parent_id -forms $form] if {$form_item_ids eq ""} {error "could not find en:photo.form"} set form_item_id [lindex $form_item_ids 0] @@ -4925,7 +4924,7 @@ # argument list with util_memoize inability to provide a key for # caching. # - set form_item_ids [::xowiki::Weblog instantiate_forms -forms $form -package_id $package_id] + set form_item_ids [::$package_id instantiate_forms -forms $form] set form_fields [::xowiki::FormPage get_table_form_fields \ -base_item [lindex $form_item_ids 0] -field_names _name \ -form_constraints ""] 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.63 -r1.332.2.64 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 20 Aug 2020 17:03:39 -0000 1.332.2.63 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 26 Aug 2020 18:35:00 -0000 1.332.2.64 @@ -951,10 +951,9 @@ Package instproc make_form_link {-form {-parent_id ""} {-query ""} -title -name -nls_language -return_url} { # use the same instantiate_forms as everywhere; TODO: will go to a different namespace - set form_id [lindex [::xowiki::Weblog instantiate_forms \ + set form_id [lindex [::${:id} instantiate_forms \ -parent_id $parent_id \ - -forms $form \ - -package_id ${:id}] 0] + -forms $form] 0] #:log "instantiate_forms -parent_id $parent_id -forms $form => $form_id " if {$form_id ne ""} { if {$parent_id eq ""} {unset parent_id} @@ -2182,7 +2181,7 @@ error "trying to create an xowiki root folder for non-xowiki package ${:id}" } else { ::xowiki::Package require_site_wide_pages - set form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id ${:id}] + set form_id [::${:id} instantiate_forms -forms en:folder.form] set f [FormPage new -destroy_on_cleanup \ -name $name \ -text "" \ 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.51.2.9 -r1.51.2.10 --- openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 11 Aug 2020 20:12:25 -0000 1.51.2.9 +++ openacs-4/packages/xowiki/tcl/syndicate-procs.tcl 26 Aug 2020 18:35:00 -0000 1.51.2.10 @@ -113,9 +113,7 @@ # 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}] + set form_items [::${:package_id} instantiate_forms -forms ${:entries_of}] } if {[llength $form_items] == 0} { 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.75.2.16 -r1.75.2.17 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 14 Feb 2020 11:04:45 -0000 1.75.2.16 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 26 Aug 2020 18:35:00 -0000 1.75.2.17 @@ -32,29 +32,12 @@ {-parent_id ""} -forms:required -package_id:required - } { - set form_item_ids [list] - foreach t [split $forms |] { - # - # The following regexp should include the majority of valid - # items refs. - # - if {![regexp {^[[:alnum:]:./_-]+$} $t]} { - error "invalid form specification '$t'" - } - #:log "trying to get $t // parent_id $parent_id" - set page [::$package_id get_page_from_item_ref \ - -use_prototype_pages true \ - -use_package_path true \ - -parent_id $parent_id \ - $t] - #:log "weblog form $t => $page" - if {$page ne ""} { - lappend form_item_ids [$page item_id] - } - } - #:log "instantiate: parent_id=$parent_id-forms=$forms -> $form_item_ids" - return $form_item_ids + } { + return [::$package_id instantiate_forms \ + -forms $forms \ + -default_lang $default_lang \ + -parent_id $parent_id \ + -package_id ${:id}] } ::xowiki::Weblog instproc init {} { @@ -149,9 +132,8 @@ 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}] + set :form_ids [::${:package_id} instantiate_forms \ + -forms ${:entries_of}] } if {${:form_ids} ne ""} { append extra_where_clause " and bt.page_template in ('[join ${:form_ids} ',']') and bt.page_instance_id = bt.revision_id " 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.80 -r1.542.2.81 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 11 Aug 2020 20:12:25 -0000 1.542.2.80 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 26 Aug 2020 18:35:00 -0000 1.542.2.81 @@ -4501,7 +4501,7 @@ # Get all children of the current folder on the first level and # append it to the list_of_folders. # - set folder_form [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id] + set folder_form [::$package_id instantiate_forms -forms en:folder.form] set child_folders [xo::dc list -prepare integer,integer get_child_folders { select item_id from xowiki_form_instance_item_index where parent_id = :folder_id Index: openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl,v diff -u -r1.3.2.2 -r1.3.2.3 --- openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl 1 Jul 2020 19:31:58 -0000 1.3.2.2 +++ openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl 26 Aug 2020 18:35:00 -0000 1.3.2.3 @@ -27,7 +27,7 @@ error "not implemented" } } - + nx::Class create ::xowiki::UploadFile -superclass ::xowiki::Upload { # # Class for storing files as xowiki::File instances. @@ -70,7 +70,7 @@ # set package_id [${:parent_object} package_id] set parent_id [${:parent_object} item_id] - + set photo_object [::$package_id get_page_from_name -name en:${:file_name} -parent_id $parent_id] if {$photo_object ne ""} { # @@ -83,14 +83,14 @@ $f content-type ${:content_type} $f set tmpfile ${:tmpfile} $f convert_to_internal - $photo_object save + $photo_object save } else { # # Create a new page instance of photo.form. # ns_log notice "new Photo ${:file_name}" - set photoFormObj [::xowiki::Weblog instantiate_forms \ - -parent_id $parent_id -forms en:photo.form -package_id $package_id] + set photoFormObj [::$package_id instantiate_forms \ + -parent_id $parent_id -forms en:photo.form] set photo_object [$photoFormObj create_form_page_instance \ -name en:${:file_name} \ -nls_language en_US \ @@ -107,7 +107,7 @@ $f set tmpfile ${:tmpfile} $f convert_to_internal } - + return {status_code 201 message created} } } Index: openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl,v diff -u -r1.57.2.15 -r1.57.2.16 --- openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 4 Aug 2020 16:58:52 -0000 1.57.2.15 +++ openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 26 Aug 2020 18:35:00 -0000 1.57.2.16 @@ -65,7 +65,7 @@ # foreach t $_ { # lassign $t a b c; dict incr stats "a $a"; dict incr stats "b $b"; dict incr stats "c $c" # } - # set stats + # set stats } { # In case, the seed is specified, set the seed to this value to # achieve e.g. a stable bat random order for a user. @@ -532,7 +532,7 @@ }] } xo::xotcl_object_type_cache flush -partition_key $item_id $item_id - set form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id] + set form_id [::$package_id instantiate_forms -forms en:folder.form] if {[::xo::dc 0or1row check { select 1 from cr_items where content_type = '::xowiki::FormPage' and item_id = :item_id Index: openacs-4/packages/xowiki/tcl/test/test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/test-procs.tcl,v diff -u -r1.15.2.13 -r1.15.2.14 --- openacs-4/packages/xowiki/tcl/test/test-procs.tcl 13 Aug 2020 10:04:58 -0000 1.15.2.13 +++ openacs-4/packages/xowiki/tcl/test/test-procs.tcl 26 Aug 2020 18:35:00 -0000 1.15.2.14 @@ -82,11 +82,16 @@ set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] if {$item_id == 0} { - set form_id [::xowiki::Weblog instantiate_forms -forms en:folder.form -package_id $package_id] + set form_id [::$package_id instantiate_forms -forms en:folder.form] set f [::$form_id create_form_page_instance \ -name $name \ -nls_language en_US \ - -default_variables [list title "Folder $name" parent_id $parent_id package_id $package_id]] + -default_variables [list \ + title "Folder $name" \ + parent_id $parent_id \ + package_id $package_id \ + description {{{child-resources}}}]] + $f publish_status ready $f save_new set item_id [$f item_id] } @@ -98,12 +103,16 @@ set item_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id] if {$item_id == 0} { - set form_id [::xowiki::Weblog instantiate_forms -forms en:link.form -package_id $package_id] + set form_id [::$package_id instantiate_forms -forms en:link.form] set f [::$form_id create_form_page_instance \ -name $name \ -nls_language en_US \ -instance_attributes [list link $target_ref] \ - -default_variables [list title "Link $name -> $target_ref" parent_id $parent_id package_id $package_id]] + -default_variables [list \ + title "Link $name -> $target_ref" \ + parent_id $parent_id \ + package_id $package_id]] + $f publish_status ready $f save_new set item_id [$f item_id] } @@ -130,12 +139,14 @@ ::xo::write_file $import_file [::base64::decode $file_content] $f set import_file $import_file } + $f publish_status ready $f save_new set item_id [$f item_id] $f destroy_on_cleanup } ns_log notice "Page $name => $item_id" aa_log " $name => $item_id" + return $item_id } Index: openacs-4/packages/xowiki/tcl/test/xowiki-link-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/test/xowiki-link-test-procs.tcl,v diff -u -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/xowiki/tcl/test/xowiki-link-test-procs.tcl 7 Feb 2020 08:44:05 -0000 1.1.2.5 +++ openacs-4/packages/xowiki/tcl/test/xowiki-link-test-procs.tcl 26 Aug 2020 18:35:00 -0000 1.1.2.6 @@ -41,8 +41,8 @@ # locale at the end of this run, since we have no # transaction. # - #set defined_locale [lang::system::locale] - #lang::system::set_locale en_US + set defined_locale [lang::system::locale] + lang::system::set_locale en_US set locale [lang::system::locale] set lang [string range $locale 0 1] @@ -78,6 +78,8 @@ # (a) the rendered link contains the page included in the linked folder and # (b) that the page link points to the target instance (no resolve_local provided) # + aa_log "check content of /$linked_xowiki_instance_name/$linked_folder_name" + ns_log notice "search for link with title en:p1: link_content $link_content" acs::test::dom_html root $link_content { set node [$root selectNodes //td\[@class='list'\]/a\[@title='en:p1'\]] aa_true "one page found" {[llength $node] == 1} @@ -123,7 +125,7 @@ # # reset system locale to saved value # - #lang::system::set_locale $defined_locale + lang::system::set_locale $defined_locale } }