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.202 -r1.203 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 28 Apr 2010 12:14:57 -0000 1.202 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 30 Apr 2010 07:53:05 -0000 1.203 @@ -1930,6 +1930,7 @@ delete {{package_id admin}} save-tags login popular-tags login + create-child {{item_id create}} create-new {{parent_id create}} create-or-use {{parent_id create}} } -set default_permission {{package_id write}} @@ -1941,8 +1942,6 @@ download none } Class Form -array set require_permission { - create-new {{parent_id create}} - create-or-use {{parent_id create}} list {{package_id read}} } Class CrFolder -array set require_permission { @@ -1989,8 +1988,9 @@ delete swa save-tags login popular-tags login - create-new {{parent_id create}} - create-or-use {{parent_id create}} + create-child {{item_id create}} + create-new {{parent_id create}} + create-or-use {{parent_id create}} } Class Object -array set require_permission { @@ -2001,8 +2001,6 @@ } Class Form -array set require_permission { view {{package_id read}} - create-new {{parent_id create}} - create-or-use {{parent_id create}} list {{package_id read}} } } @@ -2042,8 +2040,9 @@ delete swa save-tags login popular-tags login - create-new {{parent_id create}} - create-or-use {{parent_id create}} + create-child {{item_id create}} + create-new {{parent_id create}} + create-or-use {{parent_id create}} } Class Object -array set require_permission { @@ -2053,8 +2052,6 @@ download {{package_id read}} } Class Form -array set require_permission { - create-new {{parent_id create}} - create-or-use {{parent_id create}} list {{item_id read}} } # Class FormPage -array set require_permission { @@ -2107,8 +2104,9 @@ delete swa save-tags login popular-tags login - create-new {{item_id write}} - create-or-use {{item_id write}} + create-child {{item_id create}} + create-new {{parent_id create}} + create-or-use {{parent_id create}} } Class Object -array set require_permission { @@ -2127,8 +2125,6 @@ view admin edit admin list admin - create-new {{item_id write}} - create-or-use {{item_id write}} } } 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.255 -r1.256 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 29 Apr 2010 12:31:33 -0000 1.255 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 30 Apr 2010 07:53:06 -0000 1.256 @@ -1906,7 +1906,11 @@ return $f } - Page instproc create-new {{-view_method edit} {-name ""} {-nls_language ""}} { + Page instproc create-child {{-view_method edit} {-name ""} {-nls_language ""}} { + my create-new -parent_id [my item_id] -view_method $view_method -name $name -nls_language $nls_language + } + + Page instproc create-new {-parent_id {-view_method edit} {-name ""} {-nls_language ""}} { my instvar package_id set original_package_id $package_id @@ -1924,9 +1928,9 @@ return [$original_package_id error_msg \ "Page '[my name]' invalid provided package instance=$package_instance
$errorMsg
"] } - if {![my exists parent_id]} {my parent_id [$package_id folder_id]} } + # # collect some default values from query parameters # @@ -1939,7 +1943,21 @@ # To create form_pages in different places than the form, provide # fp_parent_id and fp_package_id. - set fp_parent_id [my query_parameter "parent_id" [my parent_id]] + # + # The following construct is more complex than necessary to + # provide more backward compatibility. Child objects should be + # always created via the create create-child method. The passed + # parent_id has priority over the other measures to obtain it. + # + if {![info exists parent_id]} { + if {![my exists parent_id]} {my parent_id [$package_id folder_id]} + set fp_parent_id [my query_parameter "parent_id" [my parent_id]] + if {[my parent_id] ne $fp_parent_id} { + my log "consider using the create-child method instead of passing a parent_id via query parameter" + } + } else { + set fp_parent_id $parent_id + } set fp_package_id [my query_parameter "package_id" [my package_id]] set f [my create_form_page_instance \