- Publicity: Public Only All
xowiki-www-procs.tcl
XoWiki - www procs. These procs are the methods called on xowiki pages via the web interface.
- Location:
- packages/xowiki/tcl/xowiki-www-procs.tcl
- Created:
- 2006-04-10
- Author:
- Gustaf Neumann
- CVS Identification:
$Id: xowiki-www-procs.tcl,v 1.368.2.160 2024/08/27 13:16:39 gustafn Exp $
Procedures in this file
- xowiki::File instproc www-download (public)
- xowiki::FormPage instproc combine_data_and_form_field_default (public)
- xowiki::FormPage instproc extra_html_fields (public)
- xowiki::FormPage instproc load_values_into_form_fields (public)
- xowiki::FormPage instproc render_thumbnails (public)
- xowiki::FormPage instproc set_form_data (public)
- xowiki::FormPage instproc www-edit (public)
- xowiki::FormPage instproc www-file-upload (public)
- xowiki::FormPage instproc www-toggle-modebutton (public)
- xowiki::Page instproc get_form_data (public)
- xowiki::Page instproc www-autosave-attribute (public)
- xowiki::Page instproc www-bulk-delete (public)
- xowiki::Page instproc www-clipboard-add (public)
- xowiki::Page instproc www-clipboard-clear (public)
- xowiki::Page instproc www-clipboard-content (public)
- xowiki::Page instproc www-clipboard-copy (public)
- xowiki::Page instproc www-clipboard-export (public)
- xowiki::Page instproc www-create-new (public)
- xowiki::Page instproc www-create-or-use (public)
- xowiki::Page instproc www-csv-dump (public)
- xowiki::Page instproc www-delete (public)
- xowiki::Page instproc www-delete-revision (public)
- xowiki::Page instproc www-diff (public)
- xowiki::Page instproc www-duplicate (public)
- xowiki::Page instproc www-edit (public)
- xowiki::Page instproc www-list (public)
- xowiki::Page instproc www-make-live-revision (public)
- xowiki::Page instproc www-popular-tags (public)
- xowiki::Page instproc www-revisions (public)
- xowiki::Page instproc www-save-attributes (public)
- xowiki::Page instproc www-save-tags (public)
- xowiki::Page instproc www-toggle-publish-status (public)
- xowiki::Page instproc www-validate-attribute (public)
- xowiki::Page instproc www-view (public)
- xowiki::PageInstance instproc www-use-template (public)
- xowiki::PageTemplate instproc www-delete (public)
Detailed information
xowiki::File instproc www-download (public)
<instance of xowiki::File> www-download
This web-callable method downloads the file content of the current File object. The following query parameter can be used to influence the behavior
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xowiki_test_cases
xowiki::FormPage instproc combine_data_and_form_field_default (public)
<instance of xowiki::FormPage> 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 - is this a new entry?
form_field - object id of the form field
data_value - the data from the instance attributes.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_form_with_form_instance
xowiki::FormPage instproc extra_html_fields (public)
<instance of xowiki::FormPage> 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}]
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items
xowiki::FormPage instproc load_values_into_form_fields (public)
<instance of xowiki::FormPage> 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
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_form_with_form_instance, create_form_with_numeric
xowiki::FormPage instproc render_thumbnails (public)
<instance of xowiki::FormPage> 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 - dict containing the "file_object" and "file_name"
- Returns:
- HTML content
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::FormPage instproc set_form_data (public)
<instance of xowiki::FormPage> 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
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_form_with_form_instance
xowiki::FormPage instproc www-edit (public)
<instance of xowiki::FormPage> 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
(defaults to"0"
) (optional)- -view
(boolean) (defaults to"true"
) (optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_workflow_with_instance
xowiki::FormPage instproc www-file-upload (public)
<instance of xowiki::FormPage> 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)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::FormPage instproc www-toggle-modebutton (public)
<instance of xowiki::FormPage> 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"
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc get_form_data (public)
<instance of xowiki::Page> get_form_data \ [ -field_names field_names ] form_fields
Get the values from the form and store it in the form fields and finally as instance attributes. If the field names are not specified, all form parameters are used.
- Switches:
- -field_names
(optional)- Parameters:
- form_fields
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_form_with_form_instance
xowiki::Page instproc www-autosave-attribute (public)
<instance of xowiki::Page> www-autosave-attribute
The web-callable method which is a simplified version of save-attributes, but which does NOT perform input validation, which might be a problem in case of partial input.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-bulk-delete (public)
<instance of xowiki::Page> www-bulk-delete
This web-callable method performs a bulk delete based on the object names provided by the form-variable "objects" and refresh then the caller page. This method is e.g. called by the folder-procs. By passing the "instantiate_p" one can decide whether each item should be instantiated (useful when the delete logic from the whole item ancestry is required), or if we will rely on the cheaper deletion at the package level. The default is false.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-clipboard-add (public)
<instance of xowiki::Page> www-clipboard-add
This web-callable method adds elements to the clipboard based on the names provided by the form variable "objects". The objects are resolved below the current object, which is treated as containing folder. After adding elements to the clipboard, redirect either to the return_url of the calling page.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-clipboard-clear (public)
<instance of xowiki::Page> www-clipboard-clear
This web-callable method clears the clibpboard contents. Finally redirect either to the return_url of the calling page.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-clipboard-content (public)
<instance of xowiki::Page> www-clipboard-content
This web-callable method displays the content of the clipboard. Finally redirect either to the return_url of the calling page.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-clipboard-copy (public)
<instance of xowiki::Page> www-clipboard-copy
This web-callable method copies the content of the clipboard to the current folder. After copying the elements from the clipboard, redirect either to the return_url of the calling page.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-clipboard-export (public)
<instance of xowiki::Page> www-clipboard-export
This web-callable method exports the content of the clipboard in form of an xowiki dump. Then clear the clipboard and stop the script.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-create-new (public)
<instance of xowiki::Page> www-create-new \ [ -parent_id parent_id ] [ -view_method view_method ] \ [ -name name ] [ -nls_language nls_language ] \ [ -publish_status publish_status ]
This web-callable method creates a new page, typically an instance of a form page. The method accesses several form variables such as "__form_redirect", "__text_to_html", "last_page_id", "name", "nls_language", "package_id", "package_instance", "page_order", "parent_id", "publish_status", "source_item_id", "title" The call redirects either to the "__form_redirect" or to the created page.
- Switches:
- -parent_id
(defaults to"0"
) (optional)- -view_method
(defaults to"edit"
) (optional)- -name
(optional)- -nls_language
(optional)- -publish_status
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items, create_composite_test_item, xowiki_test_cases, create_form_with_form_instance, create_form_with_numeric, form_validate, create_folder_and_configure
xowiki::Page instproc www-create-or-use (public)
<instance of xowiki::Page> www-create-or-use \ [ -parent_id parent_id ] [ -view_method view_method ] \ [ -name name ] [ -nls_language nls_language ]
This web-callable method calls www-create-new, unless overloaded from some other package, as done e.g. by xowf.
- Switches:
- -parent_id
(defaults to"0"
) (optional)- -view_method
(defaults to"edit"
) (optional)- -name
(optional)- -nls_language
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_test_items
xowiki::Page instproc www-csv-dump (public)
<instance of xowiki::Page> www-csv-dump
This web-callable method produces a CSV dump based on the includelet "form-usages".
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-delete (public)
<instance of xowiki::Page> www-delete [ -return_url return_url ]
This web-callable method deletes a page via the delete method of the package.
- Switches:
- -return_url
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xowiki_test_cases
xowiki::Page instproc www-delete-revision (public)
<instance of xowiki::Page> www-delete-revision
This web-callable method deletes a single revision of a Page, which is actually performed by the "delete_revision" method of the package, which is responsible for caching. Since we instantiate the Page based on the "revision_id" query parameter, it is sufficient to delete here just based on the current instance variable of the revision_id.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-diff (public)
<instance of xowiki::Page> www-diff
This web-callable method produces a "diff" of two pages based on the current page and the revision_id provided as query parameter by "compare_revision_id". We can choose here between the more fancy "::util::html_diff" and a plain text diff. The latter is used, when the query variable "plain_text_diff" is provided, or when the fancy diff raises an exception.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-duplicate (public)
<instance of xowiki::Page> www-duplicate
This web-callable method duplicated the current object. It uses the same mechanisms as the clipboard-copy operation. After adding elements to the clipboard, redirect either to the return_url of the calling page (as handled by www-clipboard-copy)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-edit (public)
<instance of xowiki::Page> www-edit [ -new on|off ] \ [ -autoname on|off ] [ -validation_errors validation_errors ]
This web-callable method renders a page in "edit" mode (i.e. provide input fields). This is the old-style edit based on the old-style xowiki-form-procs. FormPages should be used when possible for better user experience.
- Switches:
- -new
(boolean) (defaults to"false"
) (optional)- is this an edit-new operation?
- -autoname
(boolean) (defaults to"false"
) (optional)- value to be passed to getFormClass
- -validation_errors
(optional)- ignored in this class, but used for compatibility with FormPage.www-edit
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xowiki_test_cases, create_form_with_form_instance, create_form_with_numeric, form_validate
xowiki::Page instproc www-list (public)
<instance of xowiki::Page> www-list
This web-callable method provides a listing of pages. When the query parameter "children" is used, it returns the children of this item via the "child-resources" includelet. Otherwise, when this method is called on any kind of Form, it returns the form instances via the "form-usages" includelet. Otherwise, when this method is called on any kind of folder pages, it returns the elements of this folder via the "child-resources" includelet. If the above fails, it redirects to the starting page.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-make-live-revision (public)
<instance of xowiki::Page> www-make-live-revision
This web-callable method makes the revision specified by parameter "revision_id" the live revision, or when this is not available, the parameter "local_return_url".
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-popular-tags (public)
<instance of xowiki::Page> www-popular-tags
AJAX called function, returns an HTML snippet with the popular tags.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-revisions (public)
<instance of xowiki::Page> www-revisions
This web-callable method lists the revisions based. The rendering is actually performed in the cr-procs, but can overloaded per package.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xowiki_test_cases
xowiki::Page instproc www-save-attributes (public)
<instance of xowiki::Page> www-save-attributes
The web-callable method save-attributes is typically callable over the REST interface. It allows one to save attributes of a page without adding a new revision.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-save-tags (public)
<instance of xowiki::Page> www-save-tags
This web-callable method saves tags (provided via form parameter "new_tags").
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-toggle-publish-status (public)
<instance of xowiki::Page> www-toggle-publish-status \ [ -return_url return_url ]
This web-callable method toggles from "production" to "ready", and from "ready" or "archived" to "production". The return_url can be passed in for cases, where some proc calls internally this function, since update_publish_status might have to initialize some related objects, which might modify the return_url as well (e.g., workflows with specialized return_url handling).
- Switches:
- -return_url
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-validate-attribute (public)
<instance of xowiki::Page> www-validate-attribute
This web-callable method can be used to validate form attributes, typically called via AJAX.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
xowiki::Page instproc www-view (public)
<instance of xowiki::Page> www-view [ content ]
This web-callable method is called when viewing wiki content. The method "view" is used primarily as web API call, when the xowiki page is viewed. It is not intended for e.g. embedded wiki pages (use includes), since it contains full framing, etc. In most cases, the argument "content" is not provided, and it is computed via the "render" method of the current object. It is as well possible to reuse the rendering logic of the method for other pages, where some HTML content is already computed, but it should be viewed exactly as in the page viewing cases.
- Parameters:
- content (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xowiki_test_cases
xowiki::PageInstance instproc www-use-template (public)
<instance of xowiki::PageInstance> 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):
- Testcases:
- No testcase defined.
xowiki::PageTemplate instproc www-delete (public)
<instance of xowiki::PageTemplate> www-delete \ [ -return_url return_url ]
This web-callable method deletes a page via the delete method of the package. This method checks first, if there exists still instances of this page (depending on it).
- Switches:
- -return_url
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.