%3 ::xowiki::Form ::xowiki::Form → add_dom_attribute_value → disable_input_fields → dom_disable_input_fields → requireFormCSS demarshall footer get_form_constraints is_form marshall render_content update ::xowiki::PageTemplate ::xowiki::PageTemplate → count_usages count_usages update www-delete ::xowiki::Form->::xowiki::PageTemplate ::xowiki::Page ::xowiki::Page → container_already_rendered → find_slot → get_tags → import → quoted_html_content → save_tags __debug_known_field_names add_computed_instance_attributes adp_subst anchor anchor_parent_id build_instance_attribute_map build_name can_be_linked can_contain can_link can_save category_export category_import changed_redirect_url check_adp_include_path check_unresolved_references condition=is_folder_page condition=match condition=regexp content_header_append content_header_get copy_content_vars create_form_field create_form_fields create_form_fields_from_form_constraints create_form_page_instance create_link create_raw_form_field css_class_name default_instance_attributes demarshall detail_link div edit_set_default_values edit_set_file_selector_folder error_during_render error_in_includelet evaluate_form_field_condition exists_form_parameter exists_query_parameter field_names find_slot footer form_field_exists form_field_flush_cache form_field_index form_parameter get_anchor_and_query get_content get_description get_folder get_form_data get_html_from_content get_ids_for_bulk_actions get_instance_attributes get_nls_language_from_lang get_parent_object get_property_from_link_page get_query_parameter_return_url get_rich_text_spec get_target_from_link_page htmlFooter include include_content initialize_loaded_object instantiate_includelet is_folder_page is_form is_link_page is_new_entry is_unprefixed item_ref lang lookup_cached_form_field lookup_form_field map_categories map_party marshall mutual_overwrite_occurred new_link normalize_internal_link_name notification_detail_link notification_notify notification_render notification_subject physical_item_id physical_package_id physical_parent_id pretty_link pretty_name query_parameter record_last_visited references references_update regsub_eval rename render render_content render_icon render_includelet reset_resolve_context resolve_included_page_name return_redirect_without_params reverse_map_party reverse_map_party_attribute save save_data save_new search_render self_link_ids serialize_relocatable set_content set_resolve_context show_fields stats_record_count stats_record_detail substitute_markup translate unescape unset_temporary_instance_variables update update_publish_status validate=form_constraints validate=form_input_fields validate=name validate=page_order www-autosave-attribute www-bulk-delete www-clipboard-add www-clipboard-clear www-clipboard-content www-clipboard-copy www-clipboard-export www-create-new www-create-or-use www-csv-dump www-delete www-delete-revision www-diff www-duplicate www-edit www-list www-make-live-revision www-popular-tags www-revisions www-save-attributes www-save-tags www-toggle-publish-status www-validate-attribute www-view ::xowiki::PageTemplate->::xowiki::Page ::xo::db::CrItem ::xo::db::CrItem ::xowiki::Page->::xo::db::CrItem

Class ::xowiki::Form

::xowiki::Form[i] create ...

Class Relations

  • class: ::xo::db::CrClass[i]
  • superclass: ::xowiki::PageTemplate[i]
::xo::db::CrClass create ::xowiki::Form \
     -superclass ::xowiki::PageTemplate

Methods (to be applied on the object)

  • add_dom_attribute_value (scripted)

    if {[$dom_node hasAttribute $attr]} {
      set old_value [$dom_node getAttribute $attr]
      if {$value ni $old_value} {
        append value " " $old_value
      } else {
        set value $old_value
      }
    }
    $dom_node setAttribute $attr $value
  • disable_input_fields (scripted)

    dom parse -simple -html $form doc
    $doc documentElement root
    if {$root ne ""} {
      :dom_disable_input_fields -with_submit $with_submit $root
      set form [lindex [$root selectNodes //form] 0]
      set marginForm [::xowiki::CSS class "margin-form"]
      if {$marginForm ne ""} {
        Form add_dom_attribute_value $form class $marginForm
      }
      return [$root asHTML]
    } else {
      ns_log notice "Form $form is apparently empty"
    }
  • dom_disable_input_fields (scripted)

    set fields [$root selectNodes "//button | //input | //optgroup | //option | //select | //textarea "]
    set disabled [list]
    foreach field $fields {
      set type ""
      if {[$field hasAttribute type]} {set type [$field getAttribute type]}
      if {$type eq "submit" && !$with_submit} continue
      # Disabled fields are not transmitted from the form;
      # some applications expect hidden fields to be transmitted
      # to identify the context, so don't disable it...
      if {$type eq "hidden"} continue
      $field setAttribute disabled "disabled"
      if {[$field hasAttribute name]} {
        lappend disabled [$field getAttribute name]
      }
    }
    
    #set fa [$root selectNodes {//input[@name='__form_action']}]
    #if {$fa ne ""} {
    #  $fa setAttribute value "view-form-data"
    #}
    return $disabled
  • requireFormCSS (scripted)

    #:msg requireFormCSS
    set css ${:extraCSS}
    if {$css ne ""} {
      ::xo::Page requireCSS $css
    }

Methods (to be applied on instances)

  • demarshall (scripted)

    # Some older versions do not have anon_instances and no slots
    if {![info exists :anon_instances]} {
      set :anon_instances "t"
    }
    next
  • footer (scripted)

    return [:include [list form-menu -form_item_id ${:item_id}]]
  • form (setter)

  • form_constraints (setter)

  • get_form_constraints (scripted)

    # We define it as a method to ease overloading.
    return [:form_constraints]
  • is_form (scripted)

    return 1
  • marshall (scripted)

    #set form_fields [:create_form_fields_from_form_constraints [:get_form_constraints]]
    #:log "--ff=$form_fields"
    # :build_instance_attribute_map $form_fields
    next
  • mime_type (setter)

  • render_content (scripted)

    ::xowiki::Form requireFormCSS
    
    #
    # We assume that the richtext is stored as 2-element list with
    # mime-type.
    #
    #:log "-- text='${:text}'"
    if {[lindex ${:text} 0] ne ""} {
      set :do_substitutions 0
      set html ""set mime ""
      lassign ${:text} html mime
      set content [:substitute_markup $html]
    } elseif {[lindex ${:form} 0] ne ""} {
      #
      # The method "disable_input_fields" consists essentially of
      #
      #     dom parse -simple $form doc
      #     ...
      #     return [$root asHTML]
      #
      #  Unfortunately, this causes that some tags unknown to tdom
      #  (like <adp:icon>) are converted to escaped tags (&lt; ...).
      #  This can be regarded as a bug. To avoid this problem, we
      #  substitute here the adp_tags in advance. This needs more
      #  investigation in other cases.... The potential harm in this
      #  cases here is very little, but probably, there are other
      #  cases as well where this might harm.
      #
      set content [[self class] disable_input_fields [template::adp_parse_tags [lindex ${:form} 0]]]
    } else {
      set content ""
    }
    return $content
  • update (scripted)

    ::xo::dc transaction {
      next
      :instvar object_id form form_constraints
      ::xo::dc dml update_xowiki_form {update xowiki_form
        set form = :form,form_constraints = :form_constraints where xowiki_form_id = :object_id
      }
    }
  • xowiki_form_id (setter)