Saltar al contenido principal
Inicio del contenido principal
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Class[i] ::xowiki::WikiForm

Class Hierarchy of ::xowiki::WikiForm

  • ::xotcl::Object[i]
    Meta-class:
    ::xotcl::Class[i]
    Methods for instances:
    __api_make_doc, __api_make_forward_doc, __nextC, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, checkC, classC, cleanupC, configureC, contains, copy, db_1rowC, debug, defaultmethod, destroyC, destroy_on_cleanup, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearchC, forwardC, hasclass, incrC, infoC, init, instvarC, invarC, isclassC, ismetaclassC, ismixinC, isobjectC, istypeC, lappendC, log, method, mixinC, mixinguardC, move, msg, noinitC, parametercmdC, procC, procsearchC, qn, requireNamespaceC, self, serialize, setC, substC, traceC, unsetC, uplevelC, upvarC, volatileC, vwaitC
    Methods to be applied on the class (in addition to the methods provided by the meta-class):
    __exitHandler, getExitHandler, setExitHandler, unsetExitHandler
    • ::Generic::Form[i]
      Meta-class:
      ::xotcl::Class[i]
      Parameter for instances:
      action (default "[::xo::cc url]"), add_page_title, data, edit_page_title, fields, folder_id (default "-100"), html (default ""), name (default "[namespace tail [self]]"), submit_link (default "."), validate (default ""), with_categories (default "false")
      Methods for instances:
      after_submit, edit_data, edit_request, form_vars, generate, init, new_data, new_request, on_submit, on_validation_error, request, set_form_data
      Methods to be applied on the class:
      Methods provided by the meta-class
      • ::xowiki::WikiForm[i]
        Meta-class:
        ::xotcl::Class[i]
        Parameter for instances:
        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,editor=xinha"), 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}} {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; might only contain upper and lower case letters, underscore, digits and dots}} "), with_categories (default "true")
        Methods for instances:
        after_submit, data_from_form, edit_data, edit_request, mkFields, new_data, new_request, tidy, update_references
        Methods to be applied on the class:
        Methods provided by the meta-class
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:
  • name
  • item_id
Defined in packages/xowiki/tcl/xowiki-form-procs.tcl

Class Relations

  • superclass: ::Generic::Form[i]
  • subclass: ::blocks::BlockWikiForm[i], ::learning_content::ContentForm[i], ::xowiki::FileForm[i], ::xowiki::PageInstanceEditForm[i], ::xowiki::PageInstanceForm[i], ::xowiki::PageTemplateForm[i], ::xowiki::PlainWikiForm[i]
::xotcl::Class create ::xowiki::WikiForm \
     -superclass ::Generic::Form \
     -parameter {{autoname 0} {f.creator "="} {f.description "="} {f.item_id {item_id:key}} \
       {f.name "="} {f.nls_language "="} {f.page_order "="} {f.text "= richtext,editor=xinha"} \
       {f.title "="} {field_list \
       {item_id name page_order title creator text description nls_language}} {folderspec ""} \
       {submit_link "view"} {validate {
          {name {\[::xowiki::validate_name\]} \
       {Another item with this name exists  already in this folder}}
          {page_order {\[::xowiki::validate_form_field page_order\]} \
       {Page Order invalid;  might only contain upper and lower case letters, underscore, digits and \
       dots}}
        }} {with_categories true}}

Methods

  • instproc after_submit

    ::xowiki::WikiForm instproc after_submit item_id {
        set link [my submit_link]
        if {$link eq "."} {
          my instvar data
          # we can determine submit link only after nls_langauge 
          # is returned from the user
          my submit_link [[$data package_id] pretty_link [$data name]]
        }
        next
      }
  • instproc data_from_form

    ::xowiki::WikiForm instproc data_from_form {{-new 0}} {
        my instvar data
        if {[$data exists_form_parameter text.format]} {
          $data set mime_type [$data form_parameter text.format]
        }
        if {$new && [[$data set package_id] get_parameter production_mode 0]} {
          $data set publish_status production
        }
        upvar #[template::adp_level] page_order page_order
        if {[info exists page_order] && $page_order ne ""} {
          set page_order [string trim $page_order " ."]
        }
        my tidy
      }
  • instproc edit_data

    ::xowiki::WikiForm instproc edit_data {} {
        my data_from_form -new 0
        set item_id [next]
        my update_references
        return $item_id
      }
  • instproc edit_request

    ::xowiki::WikiForm instproc edit_request args {
        my instvar data
        if {[$data set creator] eq ""} {
          $data set creator [::xo::get_user_name [::xo::cc user_id]]
        }
        next
      }
  • instproc mkFields

    ::xowiki::WikiForm instproc mkFields {} {
        my instvar data autoname
        set __fields ""
        set field_list [my field_list]
    
        set show_page_order [[$data package_id] show_page_order]
        if {!$show_page_order} { my f.page_order "= hidden" } 
        if {$autoname}         { my 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 {[my exists f.$__field] ? [my set f.$__field] : "="}]
          set __wspec [lindex $__spec 0]
          #my 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 ""} {
            #my msg "we got richtext spec for $__field = '$s'"
    	set __spec $s
    	set __wspec [lindex $__spec 0]
    	# old style folder spec substituion. ugly.
            if {[my folderspec] ne ""} {
              # append the folder spec to its options
              set __newspec [list $__wspec]
              foreach __e [lrange $__spec 1 end] {
                foreach {__name __value} $__e break
                if {$__name eq "options"} {eval lappend __value [my folderspec]}
                lappend __newspec [list $__name $__value]
              }
              #my msg "--F rewritten spec is '$__newspec'"
              set __spec $__newspec
            }
          } elseif {[lindex $__wspec 0] eq "="} {
    	# 
    	# get the information from the attribute definitions & given specs
    	#
    
            set f [$data create_raw_form_field  -name $__field  -slot [$data find_slot $__field]  -spec [lindex $__spec 1]  ]
    
            if {[$f istype ::xowiki::formfield::richtext] &&
                [my 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} [my 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]
          }
    
          #my msg "--F field <$__field> = $__spec"
          append __fields [list $__spec] \n
        }
    
        # setting form fields for later use in validator
        # $data show_fields $form_fields
        my set form_fields $form_fields
    
        my set fields $__fields
    
      }
  • instproc new_data

    ::xowiki::WikiForm instproc new_data {} {
        my instvar data
        my 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]
        my update_references
        return $item_id
      }
  • instproc new_request

    ::xowiki::WikiForm instproc new_request {} {
        my instvar data
        #
        # get the defaults from the slots and set it in the data.
        # This should not be necessary with xotocl 1.6.*
        #
        foreach f [my field_list] {
          set s [$data find_slot $f] 
          if {$s ne "" && [$s exists default] && [$s default] ne ""} {
            #my 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 ""} {
          $data set nls_language [::xo::cc locale]
        }
        next
      }
  • instproc tidy

    ::xowiki::WikiForm instproc tidy {} {
        upvar #[template::adp_level] text text
        if {[info exists text]} {
          foreach {text format} [my var text] break
          my var text [list [list [::xowiki::tidy clean $text] $format]]
        }
      }
  • instproc update_references

    ::xowiki::WikiForm instproc update_references {} {
        my instvar data folder_id
        if {![my 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
        }
        # 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-proove.
        #
        # In case "ns_cache names xowiki_cache *pattern*" is not working on your installation;
        #    upgrade ns_cache from cvs or use
        #    foreach entry [lsearch -inline -all [ns_cache names xowiki_cache] link-*-$folder_id] 
        foreach entry [ns_cache names xowiki_cache link-*-$folder_id] {
          array set tmp [ns_cache get xowiki_cache $entry]
          if {$tmp(item_id) == [$data set item_id]} {
            ::xo::clusterwide ns_cache flush xowiki_cache $entry
          }
        }
        if {![$data istype ::xowiki::Object] &&
            ![$data istype ::xowiki::PageTemplate] } {
          if {[$data istype ::xowiki::PageInstance]} {
            if {[$data set instance_attributes] ne ""} {
              # fieldless page instances are not notified. problem?
              # my log "--i instance_attributes = <[$data set instance_attributes]>"
              ::xowiki::notification::do_notifications -page $data
            }
          } else {
            ::xowiki::notification::do_notifications -page $data
          }
        }
    
        #my log "v=[ad_acs_version] 5.2] compare: [apm_version_names_compare [ad_acs_version] 5.2]"
        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]
        }
      }

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]
Mi calendario