Class ::xowiki::FormPage

::xowiki::FormPage[i] create ...

Defined in

Class Relations

  • class: ::xo::db::CrClass[i]
  • superclass: ::xowiki::PageInstance[i]

Methods (to be applied on the object)

  • compute_filter_clauses (scripted, public)

     xowiki::FormPage[i] compute_filter_clauses [ -unless unless ] \
        [ -where where ]

    Compute from "-unless" or "-where" specs the "tcl", "sql" and optional "hstore" query fragments.

    Switches:
    -unless (optional)
    -where (optional)
    Returns:
    dict containing "init_vars", "uc" (unless clauses) and "wc" (where clauses)

    Testcases:
    create_composite_test_item
  • fetch_object (scripted, public)

     xowiki::FormPage[i] fetch_object -item_id item_id  \
        [ -revision_id revision_id ] -object object  \
        [ -initialize on|off ]

    Load a content item into the specified object. If revision_id is provided, the specified revision is returned, otherwise the live revision of the item_id. If the object does not exist, we create it.

    Switches:
    -item_id (required)
    -revision_id (optional, defaults to "0")
    -object (required)
    -initialize (optional, boolean, defaults to "true")
    Returns:
    cr item object

    Testcases:
    xowiki_test_cases, link_tests, path_resolve
  • filter_expression (scripted)

     xowiki::FormPage[i] filter_expression

    Testcases:
    xowiki_test_cases, xowiki
  • get_all_children (scripted)

     xowiki::FormPage[i] get_all_children

    Testcases:
    includelet_childresources, xowiki

Methods (to be applied on instances)

  • combine_data_and_form_field_default (scripted, public)

     <instance of xowiki::FormPage[i]> combine_data_and_form_field_default \
        is_new form_field data_value

    Combine the value of the form field (e.g. determined by the default) with the value in the instance attributes. This function decides, whether it should honor the data value or the form field value for e.g. rendering forms.

    Parameters:
    is_new (required)
    is this a new entry?
    form_field (required)
    object id of the form field
    data_value (required)
    the data from the instance attributes.

    Testcases:
    create_form_with_form_instance
  • extra_html_fields (scripted, public)

     <instance of xowiki::FormPage[i]> extra_html_fields

    Should be overloaded to provide extra content to some forms. This method can be used to add additional (e.g. hidden) HTML input fields to form pages. Example: ::html::input -type hidden -name __object_name -value [::security::parameter::signed ${:name}]

    Testcases:
    create_test_items
  • get_property (scripted, public)

     <instance of xowiki::FormPage[i]> get_property [ -source source ] \
        -name name  [ -default default ]

    Retrieves a FormPage property

    Switches:
    -source (optional)
    page name to be resolved and used instead this FormPage to fetch the property
    -name (required)
    -default (optional)

    Testcases:
    create_test_items
  • is_folder_page (scripted, public)

     <instance of xowiki::FormPage[i]> is_folder_page \
        [ -include_folder_links include_folder_links ]

    Check, if FormPage is a folder. A FormPage is a folder when its page template is the folder.form or if this is a link pointing to a folder.

    Switches:
    -include_folder_links (optional, defaults to "true")
    return true, if the current page is a link to a folder.
    Returns:
    boolean

    Testcases:
    xowiki_test_cases
  • load_values_into_form_fields (scripted, public)

     <instance of xowiki::FormPage[i]> load_values_into_form_fields \
        form_fields

    Load either the instance variables or the instance attributes into the provided form-fields. The function sets the values based on the default values and the values for the current object.

    Parameters:
    form_fields (required)

    Testcases:
    create_form_with_form_instance, create_form_with_numeric
  • property (scripted, public)

     <instance of xowiki::FormPage[i]> property name [ default ]

    Retrieve a FormPage property.

    Parameters:
    name (required)
    property name. Names starting with _ refer to object's members, rather than instance attributes.
    default (optional)
    fallback value when property is not set.

    Testcases:
    xowiki_test_cases
  • render_thumbnails (scripted, public)

     <instance of xowiki::FormPage[i]> render_thumbnails upload_info

    Renderer of the thumbnail file(s). This method is a stub to be refined (e.g. in xowf).

    Parameters:
    upload_info (required)
    dict containing the "file_object" and "file_name"
    Returns:
    HTML content

    Testcases:
    No testcase defined.
  • set_form_data (scripted, public)

     <instance of xowiki::FormPage[i]> set_form_data form_fields

    Store the instance attributes or default values into the form via set_form_value. This function iterates over the provided form-fields and checks, if these are known fields in the current form. These known field names are defined via the method "field_names" that extracts these names from a form. If one wants to load all values from an FormPage into the provided form-fields, use method "load_values_into_form_fields" instead.

    Parameters:
    form_fields (required)

    Testcases:
    create_form_with_form_instance
  • set_live_revision (scripted, public)

     <instance of xowiki::FormPage[i]> set_live_revision \
        -revision_id revision_id  [ -publish_status publish_status ]
    Switches:
    -revision_id (required)
    -publish_status (optional, defaults to "ready")
    one of 'live', 'ready' or 'production'

    Testcases:
    create_folder_with_page, create_workflow_with_instance
  • set_property (scripted, public)

     <instance of xowiki::FormPage[i]> set_property [ -new new ] name \
        value

    Stores a value as FormPage property

    Switches:
    -new (optional, defaults to "0")
    boolean flag telling if the property is new. Setting a value on a non-existing property without specifying this flag will result in an error.
    Parameters:
    name (required)
    property name. Names starting with _ indicate an object variable rather than a property stored in instance_attributes
    value (required)
    property value
    Returns:
    value (eventually converted to a has-notation message key)

    Testcases:
    create_form_with_form_instance
  • update_attribute_from_slot (scripted, public)

     <instance of xowiki::FormPage[i]> update_attribute_from_slot \
        [ -revision_id revision_id ] slot value

    Tailored version of update_attribute_from_slot to keep insert_xowiki_form_instance_item_index in sync after single attribute updates.

    Switches:
    -revision_id (optional)
    Parameters:
    slot (required, object)
    value (required)

    Testcases:
    slot_interactions
  • update_item_index (scripted, public)

     <instance of xowiki::FormPage[i]> update_item_index

    Tailored version of CrItem.update_item_index to keep insert_xowiki_form_instance_item_index in sync after updates.

    Testcases:
    link_tests
  • www-edit (scripted, public)

     <instance of xowiki::FormPage[i]> www-edit \
        [ -validation_errors validation_errors ] \
        [ -disable_input_fields disable_input_fields ] [ -view on|off ]

    This web-callable method renders a form page in "edit" mode (i.e. provide input fields). The following query parameters can be used to influene the results "return_url", "title", "detail_link", "text", and "description".

    Switches:
    -validation_errors (optional)
    -disable_input_fields (optional, defaults to "0")
    -view (optional, boolean, defaults to "true")

    Testcases:
    create_workflow_with_instance
  • www-file-upload (scripted, public)

     <instance of xowiki::FormPage[i]> www-file-upload

    This web-callable method can be used for uploading files using the current object as parent object for the new content. This method is typically called via drop-zone in a POST request, where the FormPage is a folder (which is treated as parent object)

    Testcases:
    No testcase defined.
  • www-toggle-modebutton (scripted, public)

     <instance of xowiki::FormPage[i]> www-toggle-modebutton

    AJAX called function, called via POST. The function toggles the state of a button in the backend. The client provides the name of the button as form field named "button". If none is provided, the button is named as default "admin"

    Testcases:
    No testcase defined.