%3 ::xowiki::File ::xowiki::File www-download ::xowiki::Page ::xowiki::Page → find_slot anchor create_form_fields_from_form_constraints create_link find_slot get_form_data include is_folder_page pretty_link render resolve_included_page_name save_new substitute_markup 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::File->::xowiki::Page ::xowiki::PageTemplate ::xowiki::PageTemplate www-delete ::xowiki::PageTemplate->::xowiki::Page ::xowiki::PageInstance ::xowiki::PageInstance get_from_template www-use-template ::xowiki::PageInstance->::xowiki::Page ::xowiki::PlainPage ::xowiki::PlainPage ::xowiki::PlainPage->::xowiki::Page ::xo::db::CrItem ::xo::db::CrItem ::xowiki::Page->::xo::db::CrItem ::xowiki::FormPage ::xowiki::FormPage → compute_filter_clauses → fetch_object → filter_expression → get_all_children combine_data_and_form_field_default extra_html_fields get_property is_folder_page load_values_into_form_fields property render_thumbnails set_form_data set_live_revision set_property update_attribute_from_slot update_item_index www-edit www-file-upload www-toggle-modebutton ::xowiki::FormPage->::xowiki::PageInstance

Class ::xowiki::PageInstance

::xowiki::PageInstance[i] create ...

Class Relations

  • class: ::xo::db::CrClass[i]
  • superclass: ::xowiki::Page[i]
  • subclass: ::xowiki::FormPage[i]
::xo::db::CrClass create ::xowiki::PageInstance \
     -superclass ::xowiki::Page

Methods (to be applied on instances)

  • get_from_template (scripted, public)

     <instance of xowiki::PageInstance[i]> get_from_template var \
        [ default ]

    Get a property from the parent object (template). The parent object might by either an ::xowiki::Form or an ::xowiki::FormPage

    Parameters:
    var
    default (optional)
    Returns:
    either the property value or a default value

    Partial Call Graph (max 5 caller/called nodes):
    %3 test_create_form_with_form_instance create_form_with_form_instance (test xowiki) xowiki::PageInstance instproc get_from_template xowiki::PageInstance instproc get_from_template test_create_form_with_form_instance->xowiki::PageInstance instproc get_from_template

    Testcases:
    create_form_with_form_instance
    set form_obj [:get_template_object]
    
    #:msg "get $var from template form_obj=$form_obj [$form_obj info class]"
    
    # The resulting page should be either a Form (PageTemplate) or
    # a FormPage (PageInstance)
    #
    #:msg "parent of self ${:name} is [$form_obj name] type [$form_obj info class]"
    #
    # If it is as well a PageInstance, we find the information in the
    # properties of this page. Note that we cannot distinguish here between
    # intrinsic (starting with _) and extension variables, since get_from
    # template does not know about the logic with "_" (just "property" does).
    #
    if {[$form_obj istype ::xowiki::PageInstance]} {
      #:msg "returning property $var from parent formpage $form_obj => '[$form_obj property $var $default]'"
      return [$form_obj property $var $default]
    }
    
    #
    # .... otherwise, it should be an instance variable ....
    #
    if {[$form_obj exists $var]} {
      #:msg "returning parent instvar [$form_obj set $var]"
      return [$form_obj set $var]
    }
    #
    # .... or, we try to resolve it against a local property.
    #
    # This case is currently needed in the workflow case, where
    # e.g. anon_instances is tried to be fetched from the first form,
    # which might not contain it, if e.g. the first form is a plain
    # wiki page.
    #
    #:msg "resolve local property $var=>[:exists_property $var]"
    if {[:istype ::xowiki::FormPage] && [:exists_property $var]} {
      #:msg "returning local property [:property $var]"
      return [:property $var]
    }
    #
    # if everything fails, return the default.
    #
    #:msg "returning the default <$default>, parent is of type [$form_obj info class]"
    return $default
  • www-use-template (scripted, public)

     <instance of xowiki::PageInstance[i]> www-use-template

    This web-callable method can be used to change the "template" of a PageInstance. The caller provides the "form" as query parameter which should be used in future for handling the instance parameters of the PageInstance. This method can be as well be used for changing the associated workflow of a workflow instance.

    Partial Call Graph (max 5 caller/called nodes):
    %3 ad_return_url ad_return_url (public) xowiki::PageInstance instproc www-use-template xowiki::PageInstance instproc www-use-template xowiki::PageInstance instproc www-use-template->ad_return_url

    Testcases:
    No testcase defined.
    set formName [:query_parameter "form" ""]
    if {$formName eq ""} {
      error "no form specified"
    }
    ::${:package_id} get_lang_and_name -default_lang [::xo::cc lang] -path $formName lang stripped_url
    set d [::${:package_id} item_ref -default_lang $lang -parent_id [::${:package_id} folder_id] $formName]
    set item_id [dict get $d item_id]
    if {$item_id == 0} {
      error "cannot lookup page $formName"
    }
    ::xo::db::CrClass get_instance_from_db -item_id $item_id
    if {![nsf::is object ::$item_id]
        || "::xowiki::PageTemplate" ni [::$item_id info precedence]} {
      error "OK $formName is not suited to be used as template. Should be a Form!"
    }
    if {${:page_template} == $item_id} {
      :msg "old page_template $item_id is already the same as the new one"
    } else {
      set msg "change template_id ${:page_template} to $item_id"
      :page_template $item_id
      :save
      #:msg "ok $msg"
    }
    ::${:package_id} returnredirect [ad_return_url]