xowiki::Page instproc www-save-attributes (public)
<instance of xowiki::Page> www-save-attributes
Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-www-procs.tcl
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.
- Testcases:
- No testcase defined.
Source code: set field_names [:field_names] set form_fields [list] set query_field_names [list] set validation_errors 0 foreach field_name $field_names { if {[::xo::cc exists_form_parameter $field_name]} { lappend form_fields [:create_form_field $field_name] lappend query_field_names $field_name } } #:show_fields $form_fields lassign [:get_form_data -field_names $query_field_names $form_fields] validation_errors category_ids if {$validation_errors == 0} { # # We have no validation errors, so we can save the content. # set update_without_revision [::${:package_id} query_parameter replace:boolean 0] foreach form_field $form_fields { # # Fix richtext content in accordance with oacs conventions. # if {[$form_field istype ::xowiki::formfield::richtext]} { $form_field value [list [$form_field value] text/html] } } if {$update_without_revision} { # field-wise update without revision set update_instance_attributes 0 foreach form_field $form_fields { set s [$form_field slot] if {$s eq ""} { # # Empty slot means that we have an instance_attribute; we # save all in one statement below. # set update_instance_attributes 1 } else { error "Not implemented yet" :update_attribute_from_slot $s [$form_field value] } } if {$update_instance_attributes} { set s [:find_slot instance_attributes] :update_attribute_from_slot $s [:instance_attributes] } } else { # # Perform standard update (with revision). # :save_data -use_given_publish_date [expr {"_publish_date" in $field_names}] [::xo::cc form_parameter __object_name:signed,convert ""] $category_ids } ${:package_id} returnredirect [:query_parameter return_url:localurl [:pretty_link]] return } else { # TODO: handle errors in a user friendly way ns_log warning "www-save-attributes: we have $validation_errors validation_errors" } ${:package_id} returnredirect [:query_parameter return_url:localurl [:pretty_link]]XQL Not present: Generic, PostgreSQL, Oracle