- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::WikiForm
::xowiki::WikiForm create ... \Form Class for XoWiki Pages. You can manipulate the form elements shown by editing the field_list. The following elements are mandatory in field_list and should never be left out:
[ -autoname (default "0") ] \
[ -f.creator (default "=") ] \
[ -f.description (default "=") ] \
[ -f.item_id (default "item_id:key") ] \
[ -f.name (default "=") ] \
[ -f.nls_language (default "=") ] \
[ -f.page_order (default "=") ] \
[ -f.text (default "= richtext,extraPlugins=xowikiimage") ] \
[ -f.title (default "=") ] \
[ -field_list (default "item_id name page_order title creator text description nls_language") ] \
[ -folderspec (default "") ] \
[ -submit_link (default "view") ] \
[ -validate (default " {name {\[::xowiki::validate_name\]} {Another item with this name exists already in this folder} } {name {[string length \$name] < 4000} {The name is too long. Please enter a value of at most 4000 characters long} } {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; might only contain upper and lowercase letters, underscore, digits and dots}} ") ] \
[ -with_categories (default "true") ]
- name
- item_id
Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-form-procs.tcl
Class Relations
- class: ::xotcl::Class
- superclass: ::Generic::Form
- subclass: ::xowiki::PlainWikiForm, ::xowiki::PageInstanceEditForm, ::xowiki::PageTemplateForm, ::xowiki::PageInstanceForm, ::xowiki::FileForm
::xotcl::Class create ::xowiki::WikiForm \ -superclass ::Generic::FormMethods (to be applied on instances)
after_submit (scripted)
#:log "--form after submit" set link [:submit_link] if {$link eq "."} { # we can determine submit link only after nls_language # is returned from the user :submit_link [${:data} pretty_link] } nextautoname (setter)
data_from_form (scripted)
if {[${:data} exists_form_parameter text.format:graph]} { ${:data} set mime_type [${:data} form_parameter text.format] } if {$new && [[${:data} set package_id] get_parameter production_mode:boolean 0]} { ${:data} set publish_status production } :tidyedit_data (scripted)
#:log "--form edit_data " :data_from_form -new 0 set item_id [next] :update_references return $item_idedit_request (scripted)
if {[${:data} set creator] eq ""} { ${:data} set creator [::xo::get_user_name [::xo::cc user_id]] } nextf.creator (setter)
f.description (setter)
f.item_id (setter)
f.name (setter)
f.nls_language (setter)
f.page_order (setter)
f.text (setter)
f.title (setter)
field_list (setter)
folderspec (setter)
mkFields (scripted)
set __fields "" set field_list [:field_list] set show_page_order [[${:data} package_id] show_page_order] if {!$show_page_order} { :f.page_order "= hidden" } if {${:autoname}} { :f.name "= hidden,optional"} set form_fields [list] foreach __field $field_list { # if there is no field spec, use the default from the slot definitions set __spec [expr {[info exists :f.$__field] ? [set :f.$__field] : "="}] set __wspec [lindex $__spec 0] #:msg "$__field: wspec=$__wspec, spec=$__spec" # check first if we have widget_specs. # TODO: this part is likely to be removed in the future. if { [${:data} istype ::xowiki::PlainPage] && $__field eq "text" || [${:data} istype ::xowiki::File] && $__field eq "text" } { set s "" } else { set s [${:data} get_rich_text_spec $__field ""] } if {$s ne ""} { #:msg "we got richtext spec for $__field = '$s'" set __spec $s set __wspec [lindex $__spec 0] # # Old style folder spec substitution. Ugly. # if {[:folderspec] ne ""} { # append the folder spec to its options set __newspec [list $__wspec] foreach __e [lrange $__spec 1 end] { lassign $__e __name __value if {$__name eq "options"} {lappend __value {*}[:folderspec]} lappend __newspec [list $__name $__value] } #:msg "--F rewritten spec is '$__newspec'" set __spec $__newspec } } elseif {[lindex $__wspec 0] eq "="} { # # Get the information from the attribute definitions and given # specs. # set f [${:data} create_raw_form_field -name $__field -slot [${:data} find_slot $__field] -spec [lindex $__spec 1] ] #:log SPEC=[lindex $__spec 1] if {[$f istype ::xowiki::formfield::richtext] && [:folderspec] ne ""} { # Insert the folder_id and the script_dir into the spec for # the oacsfs plugin to access the correct filestore instance # and to find the script directory foreach {key value} [:folderspec] { $f $key $value } # We have to reinitialize for exporting these values asWidgetSpec $f initialize } set __spec ${__field}:[$f asWidgetSpec] set __wspec [lindex $__spec 0] lappend form_fields $f } if {[string first "richtext" $__wspec] > -1} { # ad_form does a subst, therefore, escape esp. the JavaScript stuff set __spec [string map {\[ \\[ \] \\] \$ \\$ \\ \\\\} $__spec] } #:msg "--F field <$__field> = $__spec" append __fields [list $__spec] \n } # setting form fields for later use in validator # ${:data} show_fields $form_fields set :form_fields $form_fields set :fields $__fieldsnew_data (scripted)
:data_from_form -new 1 ${:data} set __autoname_prefix [string range [${:data} set nls_language] 0 1]: set item_id [next] ${:data} set creation_user [::xo::cc user_id] :update_references return $item_idnew_request (scripted)
# # Get the defaults from the slots and set it in the data. # This should not be necessary with xotocl 1.6.* # foreach f [:field_list] { set s [${:data} find_slot $f] if {$s ne "" && [$s exists default] && [$s default] ne ""} { #:msg "new_request $f default = '[$s default]'" ${:data} set $f [$s default] } } # # set the following defaults manually # ${:data} set creator [::xo::get_user_name [::xo::cc user_id]] if {[${:data} name] eq ""} { set nls_language [[${:data} package_id] default_locale] ${:data} set nls_language $nls_language } nexton_submit (scripted)
#:log "--form on_submit $args <[${:data} info vars]> " :var page_order [${:data} set page_order] nextsubmit_link (setter)
tidy (scripted)
upvar #[template::adp_level] text text if {[info exists text]} { lassign [:var text] text format if {[info exists format]} { :var text [list [list [::xowiki::tidy clean $text] $format]] } }update_references (scripted)
if {![:istype PageInstanceForm]} { ### danger: update references does an ad_eval, which breaks the [template::adp_level] ### ad_form! don't do it in pageinstanceforms. ${:data} render_adp false ${:data} render -update_references all } # Delete the link cache entries for this entry. # The logic could be made more intelligent to delete entries is more rare cases, like # in case the file was renamed, but this is more bullet-proof. # # xowiki::LinkCache flush ${:folder_id} [${:data} set item_id] # if {![${:data} istype ::xowiki::Object] && ![${:data} istype ::xowiki::PageTemplate] } { if {[${:data} istype ::xowiki::PageInstance]} { if {[${:data} set instance_attributes] ne ""} { # # Field-less page instances are not notified. Problem? # # :log "--i instance_attributes = <[${:data} set instance_attributes]>" ::xowiki::notification::do_notifications -page ${:data} } } else { ::xowiki::notification::do_notifications -page ${:data} } } if {[apm_version_names_compare [ad_acs_version] 5.3.0d4] == 1} { application_data_link::update_links_from -object_id [${:data} set item_id] -text [${:data} set text] }validate (setter)
with_categories (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables