Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v
diff -u -r1.302 -r1.303
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 24 Dec 2011 09:58:36 -0000 1.302
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 7 Mar 2012 08:11:32 -0000 1.303
@@ -835,6 +835,7 @@
$rootNode insertBeforeFromScript {
::html::input -type hidden -name __object_name -value [my name]
::html::input -type hidden -name __form_action -value save-form-data
+ ::html::input -type hidden -name __current_revision_id -value [my revision_id]
# insert automatic form fields on top
foreach att $field_names {
@@ -1001,6 +1002,7 @@
#my show_fields $form_fields
foreach {validation_errors category_ids} \
[my get_form_data -field_names $query_field_names $form_fields] break
+
if {$validation_errors == 0} {
#
# we have no validation errors, so we can save the content
@@ -1730,6 +1732,15 @@
}
}
+ Page instproc mutual_overwrite_occurred {} {
+ util_user_message -html \
+ -message "User [::xo::get_user_name [my set modifying_user]] has modifyed this page \
+ while you were editing it.\
+ Open modified page in new window or press OK again to save this page."
+ # return 1 to flag validation error, 0 to ignore this fact
+ return 1
+ }
+
Page ad_instproc get_form_data {-field_names form_fields} {
Get the values from the form and store it in the form fields and
@@ -1883,6 +1894,10 @@
}
#my msg "validation returns $validation_errors errors"
+ if {$validation_errors == 0 && [::xo::cc form_parameter __current_revision_id ""] != [my revision_id]} {
+ set validation_errors [my mutual_overwrite_occurred]
+ }
+
if {$validation_errors == 0} {
#
# Postprocess based on form fields based on form-fields methods.