Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.50.2.20 -r1.50.2.21 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 23 Mar 2015 11:34:42 -0000 1.50.2.20 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 23 Mar 2015 19:41:44 -0000 1.50.2.21 @@ -1079,6 +1079,7 @@ my instvar item_id ::xo::dc dml update_rename \ "update cr_items set name = :new_name where item_id = :item_id" + my update_item_index } CrItem instproc revisions {} { Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/xowf/xowf.info 11 Jan 2015 21:02:03 -0000 1.1.2.4 +++ openacs-4/packages/xowf/xowf.info 23 Mar 2015 19:41:44 -0000 1.1.2.5 @@ -9,14 +9,14 @@ f t - + Gustaf Neumann XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms - 2014-09-02 + 2015-03-23 WU Vienna 2 - + @@ -27,7 +27,7 @@ - + Index: openacs-4/packages/xowf/tcl/xowf-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-procs.tcl,v diff -u -r1.1.2.13 -r1.1.2.14 --- openacs-4/packages/xowf/tcl/xowf-procs.tcl 4 Mar 2015 04:35:54 -0000 1.1.2.13 +++ openacs-4/packages/xowf/tcl/xowf-procs.tcl 23 Mar 2015 19:41:45 -0000 1.1.2.14 @@ -1215,6 +1215,14 @@ return $r } + WorkflowPage instproc hstore_attributes {} { + # + # We do not want to save the workflow definition in every workflow + # instance. + # + return [dict remove [my instance_attributes] workflow_definition] + } + WorkflowPage instproc save_in_hstore {} { # # Experimental code for storing instance attributes in hstore. To @@ -1230,7 +1238,7 @@ # ... and set the parameter "use_hstore" to 1. Then the following condition will be true. # if {[::xo::dc has_hstore] && [[my package_id] get_parameter use_hstore 0]} { - set hkey [::xowf::dict_as_hkey [dict remove [my instance_attributes] workflow_definition]] + set hkey [::xowiki::hstore::dict_as_hkey [my hstore_attributes]] set revision_id [my revision_id] xo::dc dml update_hstore "update xowiki_page_instance \ set hkey = '$hkey' \ @@ -1799,28 +1807,6 @@ } - ad_proc ::xowf::double_quote {value} { - @return double_quoted value as appropriate for hstore - } { - if {[regexp {[ ,\"\\=>\n\']} $value]} { - set value \"[string map [list \" \\\" \\ \\\\ ' ''] $value]\" - } - return $value - } - - ad_proc ::xowf::dict_as_hkey {dict} { - @return dict value in form of a hstore key. - } { - set keys {} - foreach {key value} $dict { - set v [xowf::double_quote $value] - if {$v eq ""} continue - lappend keys [::xowf::double_quote $key]=>$v - } - return [join $keys ,] - } - - ::xo::library source_dependent # Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.148.2.27 -r1.148.2.28 --- openacs-4/packages/xowiki/xowiki.info 23 Mar 2015 11:54:42 -0000 1.148.2.27 +++ openacs-4/packages/xowiki/xowiki.info 23 Mar 2015 19:41:44 -0000 1.148.2.28 @@ -10,10 +10,10 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types - 2015-02-11 + 2015-03-23 WU Vienna <pre> XoWiki is a Wiki implementation for OpenACS in XOTcl. Instead of @@ -55,7 +55,7 @@ BSD-Style 2 - + @@ -126,7 +126,8 @@ - + + Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.472.2.39 -r1.472.2.40 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 23 Mar 2015 11:54:42 -0000 1.472.2.39 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 23 Mar 2015 19:41:44 -0000 1.472.2.40 @@ -1280,7 +1280,7 @@ set rows [xo::dc dml update_xowiki_form_instance_item_index { update xowiki_form_instance_item_index - set item_id = :item_id, name = :name, package_id = :package_id, + set name = :name, package_id = :package_id, parent_id = :parent_id, publish_status = :publish_status, page_template = :page_template, assignee = :assignee, state = :state @@ -1305,6 +1305,45 @@ } } + ad_proc update_item_index { + -item_id:required + -package_id + -parent_id + -publish_status + -page_template + -instance_attributes + -assignee + -state + -hstore_attributes + } { + + Helper function to update single or multiple fields of the + xowiki_form_instance_item_index. Call this function only when + updating fields of the xowiki_form_instance_item_index in cases + where the standard API based on save and save_use canot be used. + + } { + foreach var { + package_id parent_id + publish_status page_template + instance_attributes assignee state + } { + if {[info exists $var]} { + xo::dc dml update_xowiki_form_instance_item_index_$var [subst { + update xowiki_form_instance_item_index + set $var = :$var + where item_id = :item_id + }] + } + } + if {[info exists hstore_attributes]} { + set hkey [::xowiki::hstore::dict_as_hkey $hstore_attributes] + xo::dc dml update_hstore "update xowiki_form_instance_item_index \ + set hkey = '$hkey' \ + where item_id = :item_id" + } + } + # # helper for nls and lang #