xowiki::Page instproc www-edit (public)
<instance of xowiki::Page> www-edit [ -new on|off ] \ [ -autoname on|off ] [ -validation_errors validation_errors ]
Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-www-procs.tcl
This web-callable method renders a page in "edit" mode (i.e. provide input fields). This is the old-style edit based on the old-style xowiki-form-procs. FormPages should be used when possible for better user experience.
- Switches:
- -new (optional, boolean, defaults to
"false"
)- is this an edit-new operation?
- -autoname (optional, boolean, defaults to
"false"
)- value to be passed to getFormClass
- -validation_errors (optional)
- ignored in this class, but used for compatibility with FormPage.www-edit
- Testcases:
- xowiki_test_cases, create_form_with_form_instance, create_form_with_numeric, form_validate
Source code: # # We have to keep the instvar for "item_id" for the time being. # :instvar item_id #:log "--edit new=$new autoname=$autoname, validation_errors=$validation_errors, parent=${:parent_id}" :edit_set_default_values set fs_folder_id [:edit_set_file_selector_folder] if {[::${:package_id} exists_query_parameter "return_url"]} { set submit_link [:query_parameter return_url:localurl] set return_url $submit_link } else { # # Before we used "." as default submit link (resulting in a # "ad_returnredirect ."). However, this does not seem to work # in case we have folders in use.... # #set submit_link "." set submit_link [:pretty_link] } #:log "--u submit_link=$submit_link qp=[:query_parameter return_url]" set object_type [:info class] # We have to do template mangling here; ad_form_template writes # form variables into the actual parse-level, so we have to be in # our own level in order to access and pass these. # lappend ::template::parse_level [info level] set action_vars [expr {$new ? "{edit-new 1} object_type return_url" : "{m edit} return_url"}] #:log "--formclass=[$object_type getFormClass -data [self]] object_type=$object_type" # # Determine the package_id of some mounted xowiki instance to find # the directory + URL, from where the scripts called from Xinha # can be used. # if {[::${:package_id} info class] eq "::xowiki::Package"} { # # The actual instance is a plain xowiki instance, we can use it. # set folder_spec [list script_dir [::${:package_id} package_url]] } else { # # The actual instance is not a plain xowiki instance, so, we try # to find one, where the current user has at least read # permissions. This act is required for sub-packages, which # might not have the script dir. # set first_instance_id [::xowiki::Package first_instance -party_id [::xo::cc user_id] -privilege read] if {$first_instance_id ne ""} { ::xowiki::Package require $first_instance_id set folder_spec [list script_dir [::$first_instance_id package_url]] } } if {$fs_folder_id ne ""} { lappend folder_spec folder_id $fs_folder_id } [$object_type getFormClass -data [self]] create ::xowiki::f1 -volatile -action [export_vars -base [::${:package_id} url] $action_vars] -data [self] -folderspec $folder_spec -submit_link $submit_link -autoname $autoname #:log "form created" # # The variable "item_id" is hard-wired in the old-style "generate" # method. # if {[info exists return_url]} { ::xowiki::f1 generate -export [list [list return_url $return_url]] } else { ::xowiki::f1 generate } #:log "form rendered" ::xowiki::f1 instvar edit_form_page_title context formTemplate if {[info exists item_id]} { set rev_link [::${:package_id} make_link [self] revisions] set view_link [::${:package_id} make_link [self] view] } if {[info exists last_page_id]} { set back_link [::${:package_id} url] } set index_link [::${:package_id} make_link -privilege public ${:package_id}] ::xo::Page set_property doc title "[::${:package_id} instance_name] - $edit_form_page_title" array set property_doc [::xo::Page get_property doc] set edit_tmpl [::${:package_id} get_adp_template "edit"] set html [::${:package_id} return_page -adp $edit_tmpl -form f1 -variables { item_id {parent_id ${:parent_id}} edit_form_page_title context formTemplate view_link back_link rev_link index_link property_doc }] template::util::lpop ::template::parse_level #:log "--edit html length [string length $html]" return $htmlXQL Not present: Generic, PostgreSQL, Oracle