- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::formfield::form_page
::xowiki::formfield::form_page create ... \
[ -entry_label (default "_title") ] \
[ -form form ] \
[ -orderby (default "title") ] \
[ -parent_id (default "*") ] \
[ -unless unless ] \
[ -where where ]
Class Relations
::xotcl::Class create ::xowiki::formfield::form_page \ -superclass ::xowiki::formfield::abstract_pageMethods (to be applied on instances)
compute_options (scripted)
#:msg "${:name} compute_options [info exists :form]" if {![info exists :form]} { return } set filters [::xowiki::FormPage compute_filter_clauses {*}[expr {[info exists :unless] ? [list -unless ${:unless}] : ""}] {*}[expr {[info exists :where] ? [list -where ${:where}] : ""}] ] set from_package_ids {} set package_path [::${:package_id} package_path] if {[llength $package_path] > 0} { foreach p $package_path { lappend from_package_ids [$p id] } } lappend from_package_ids ${:package_id} if {${:parent_id} eq "."} { set :parent_id [${:object} parent_id] } set items [::xowiki::FormPage get_form_entries -base_item_ids ${:form_object_item_ids} -form_fields [list] -publish_status ready -h_where [dict get $filters wc] -h_unless [dict get $filters uc] -parent_id ${:parent_id} -package_id ${:package_id} -orderby title -from_package_ids $from_package_ids] #ns_log notice "get_form_entries -> [$items children]" set :options [list] foreach i [$items children] { # # Compute the item_ref of the page. The item_ref has the # advantage over an href that it is easier relocatable via clipboard. # set package_id [$i package_id] set folder_path [$package_id folder_path -parent_id [$i parent_id]] set item_ref $folder_path[$i name] #ns_log notice "instance_select name [$i name] pl [$i pretty_link] PATH <$folder_path>" lappend :options [list [$i property ${:entry_label}] $item_ref] }convert_to_internal (scripted)
# # The "value" consists of multiple lines, where every line is a # separate item_ref as returned by "compute_options". Add these as # extra references to the associated object each time the page is # updated. # if {${:value} ne ""} { set references {} #:log "---- form_page.convert_to_internal <${:value}>" set package_id [${:object} package_id] set parent_id [${:object} parent_id] ::xo::db::CrClass get_instance_from_db -item_id $parent_id set parent_id [$parent_id parent_id] foreach name [split ${:value} \n] { set item_info [::$package_id item_ref -normalize_name false -use_package_path 1 -default_lang [${:object} lang] -parent_id $parent_id $name] set item_id [dict get $item_info item_id] #:log "---- $name -> item_id $item_id" if {$item_id ne 0} { lappend references [list $item_id wf_form] } } if {[llength $references] > 0} { #:msg "updating references refs=$references" # # In case, there are already __extra_references, append it. # ${:object} lappend __extra_references {*}$references } }entry_label (setter)
form (setter)
initialize (scripted)
if {![info exists :form]} { return } next set form_name [:form] set form_objs [::${:package_id} instantiate_forms -parent_id [${:object} parent_id] -default_lang [${:object} lang] -forms $form_name] #:log "form_page $form_name resolved into '$form_objs'" if {$form_objs eq ""} { error "Cannot lookup Form '$form_name'" } set :form_object_item_ids [lmap form_obj $form_objs {$form_obj item_id}]orderby (setter)
parent_id (setter)
pretty_value (scripted)
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] nextunless (setter)
where (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables