xowiki::Package instproc www-edit-new (public)

 <instance of xowiki::Package[i]> www-edit-new

Defined in packages/xowiki/tcl/package-procs.tcl

This web-callable method can be used to create new pages in the current package. The behavior can be influenced by the query parameters "object_type", "autoname", "parent_id" and "source_item_id". Finally, it calls "www-edit" for the freshly created page.

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_form_with_form_instance create_form_with_form_instance (test xowiki) xowiki::Package instproc www-edit-new xowiki::Package instproc www-edit-new test_create_form_with_form_instance->xowiki::Package instproc www-edit-new ad_return_complaint ad_return_complaint (public) xowiki::Package instproc www-edit-new->ad_return_complaint ad_script_abort ad_script_abort (public) xowiki::Package instproc www-edit-new->ad_script_abort

Testcases:
create_form_with_form_instance
Source code:
set object_type [:query_parameter object_type:class "::xowiki::Page"]
set autoname [:get_parameter autoname:boolean 0]
set parent_id [${:id} query_parameter parent_id:cr_item_of_package,arg=${:id}]
if {$parent_id eq ""} {
  set parent_id [${:id} form_parameter folder_id:int32 ${:folder_id}]
  if {![::xo::db::CrClass id_belongs_to_package -item_id $parent_id -package_id ${:id}]} {
    ad_return_complaint 1 "invalid parent_id"
    ad_script_abort
  }
}
set page [$object_type new -volatile -parent_id $parent_id -package_id ${:id}]
# :ds "parent_id of $page = [$page parent_id], cl=[$page info class] parent_id=$parent_id\n[$page serialize]"
if {$object_type eq "::xowiki::PageInstance"} {
  #
  # If we create a PageInstance via the ad_form based
  # PageInstanceForm, we have to provide the page_template here to
  # be able to validate the name, where "build_name" needs
  # access to the ::xowiki::PageTemplate of the
  # ::xowiki::PageInstance.
  #
  $page set page_template [:form_parameter page_template:int32]
}

set source_item_id [${:id} query_parameter source_item_id:int32 ""]
if {$source_item_id ne ""} {
  if {![string is integer -strict $source_item_id]} {
    ad_return_complaint 1 "invalid source_item_id"
    ad_script_abort
  }
  set source [$object_type get_instance_from_db -item_id $source_item_id]
  $page copy_content_vars -from_object $source
  set name "[::xowiki::autoname new -parent_id $source_item_id -name [$source name]]"
  # :get_lang_and_name -name $name lang name
  $page set name $name
  #:msg nls=[$page nls_language],source-nls=[$source nls_language],page=$page,name=$name
} else {
  $page set name ""
}

return [$page www-edit -new true -autoname $autoname]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: