Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.148.2.5 -r1.148.2.6
--- openacs-4/packages/xowiki/xowiki.info 25 Sep 2013 10:22:57 -0000 1.148.2.5
+++ openacs-4/packages/xowiki/xowiki.info 7 Nov 2013 11:52:25 -0000 1.148.2.6
@@ -10,7 +10,7 @@
t
xowiki
-
+
Gustaf Neumann
A xotcl-based enterprise wiki system with multiple object types
2013-09-08
@@ -55,8 +55,8 @@
BSD-Style
2
-
-
+
+
Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v
diff -u -r1.191.2.5 -r1.191.2.6
--- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 6 Oct 2013 12:53:10 -0000 1.191.2.5
+++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 7 Nov 2013 11:52:26 -0000 1.191.2.6
@@ -491,9 +491,9 @@
return [$page set $variable]
}
if {[info exists form_variable] && [$page exists instance_attributes]} {
- array set __ia [$page set instance_attributes]
- if {[info exists __ia($form_variable)]} {
- return $__ia($form_variable)
+ set __ia [$page set instance_attributes]
+ if {[dict exists $__ia $form_variable]} {
+ return [dict get $__ia $form_variable]
}
}
if {[info exists variable]} {
@@ -3570,9 +3570,10 @@
set varname [string range $property 1 end]
if {[$i exists $varname]} {set value [$i set $varname]}
} else {
- array set __ia [$i set instance_attributes]
- set varname __ia($property)
- if {[info exists $varname]} {set value [set $varname]}
+ set instance_attributes [$i set instance_attributes]
+ if {[dict exists $instance_attributes $property]} {
+ set value [dict get $instance_attributes $property]
+ }
}
if {[info exists __count($value)]} {incr __count($value)} else {set __count($value) 1}
incr sum 1
@@ -3926,8 +3927,8 @@
foreach p [$items children] {
$p set package_id $package_id
- array set __ia $init_vars
- array set __ia [$p instance_attributes]
+ set __ia [dict merge $init_vars [$p instance_attributes]]
+
if {[expr $uc(tcl)]} continue
#if {![expr $wc(tcl)]} continue ;# already handled in get_form_entries
Index: openacs-4/packages/xowiki/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v
diff -u -r1.279.2.4 -r1.279.2.5
--- openacs-4/packages/xowiki/tcl/package-procs.tcl 14 Oct 2013 18:39:22 -0000 1.279.2.4
+++ openacs-4/packages/xowiki/tcl/package-procs.tcl 7 Nov 2013 11:52:26 -0000 1.279.2.5
@@ -479,11 +479,10 @@
#my msg pp=$pp,page=$page-att=$attribute
if {$page ne "" && [$page exists instance_attributes]} {
- array set __ia [$page set instance_attributes]
- if {[info exists __ia($attribute)]} {
- set value $__ia($attribute)
- #my log "got value='$value'"
- }
+ set __ia [$page set instance_attributes]
+ if {[dict exists $__ia $attribute]} {
+ set value [dict get $__ia $attribute]
+ }
}
}
}
Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v
diff -u -r1.132.2.3 -r1.132.2.4
--- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 5 Oct 2013 11:26:21 -0000 1.132.2.3
+++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 7 Nov 2013 11:52:26 -0000 1.132.2.4
@@ -737,21 +737,24 @@
my log "-- "
my instvar page_instance_form_atts data
next
- array set __ia [$data set instance_attributes]
+
+ set __ia [$data set instance_attributes]
foreach var $page_instance_form_atts {
- if {[info exists __ia($var)]} {my var $var [list $__ia($var)]}
+ if {[dict exists $__ia $var]} {my var $var [list [dict get $__ia $var]]}
}
}
PageInstanceEditForm instproc edit_data {} {
my log "-- "
my instvar page_instance_form_atts data
- array set __ia [$data set instance_attributes]
+
+ set __ia [$data set instance_attributes]
foreach var $page_instance_form_atts {
- set __ia($var) [my var $var]
+ dict set __ia $var [my var $var]
}
- $data set instance_attributes [array get __ia]
+ $data set instance_attributes $__ia
+
set item_id [next]
my log "-- edit_data item_id=$item_id"
return $item_id
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.3 -r1.472.2.4
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 5 Oct 2013 11:26:21 -0000 1.472.2.3
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 7 Nov 2013 11:52:26 -0000 1.472.2.4
@@ -1497,9 +1497,9 @@
Page instproc detail_link {} {
if {[my exists instance_attributes]} {
- array set __ia [my set instance_attributes]
- if {[info exists __ia(detail_link)] && $__ia(detail_link) ne ""} {
- return $__ia(detail_link)
+ set __ia [my set instance_attributes]
+ if {[dict exists $__ia detail_link] && [dict get $__ia detail_link] ne ""} {
+ return [dict get $__ia detail_link]
}
}
return [my pretty_link]
@@ -2155,7 +2155,7 @@
}
# Make sure to load the instance attributes
- $f array set __ia [$f instance_attributes]
+ #$f array set __ia [$f instance_attributes]
# Call the application specific initialization, when a FormPage is
# initially created. This is used to control the life-cycle of
@@ -2683,19 +2683,18 @@
PageInstance instproc adp_subst {content} {
# initialize template variables (in case, new variables are added to template)
- array set __ia [my template_vars $content]
- # add extra variables as instance attributes
- array set __ia [my set instance_attributes]
+ # and add extra variables from instance attributes
+ set __ia [dict merge [my template_vars $content] [my set instance_attributes]]
- foreach var [array names __ia] {
+ foreach var [dict keys $__ia] {
#my log "-- set $var [list $__ia($var)]"
# TODO: just for the lookup, whether a field is a richt text field,
# there should be a more efficient and easier way...
if {[string match "richtext*" [my get_field_type $var text]]} {
# ignore the text/html info from htmlarea
- set value [lindex $__ia($var) 0]
+ set value [lindex [dict get $__ia $var] 0]
} else {
- set value $__ia($var)
+ set value [dict get $__ia $var]
}
# the value might not be from the form attributes (e.g. title), don't clear it.
if {$value eq "" && [my exists $var]} continue
@@ -2898,7 +2897,7 @@
# make sure, the source package is available
::xo::Package require [$p package_id]
}
- my array set __ia [my instance_attributes]
+ #my array set __ia [my instance_attributes]
next
}
FormPage instproc initialize {} {
@@ -2968,7 +2967,7 @@
set rhs $rhs_expr
lappend sql_clause [subst -nocommands $op_map($op,sql)]
}
- set lhs_var "\$__ia($lhs)"
+ set lhs_var "\[dict get \$__ia $lhs\]"
foreach rhs [split $rhs_expr |] {
if {[info exists op_map($op,tcl)]} {
lappend tcl_clause [subst -nocommands $op_map($op,tcl)]
@@ -3148,8 +3147,7 @@
set init_vars $wc(vars)
foreach p [$items children] {
- array set __ia $init_vars
- array set __ia [$p instance_attributes]
+ set __ia [dict merge $init_vars [$p instance_attributes]]
if {![$p expr $wc(tcl)]} {$items delete $p}
}
}
@@ -3268,79 +3266,92 @@
# part of the code copied from Package->get_parameter
# see xowiki/www/prototypes/folder.form.page
FormPage instproc get_parameter {attribute {default ""}} {
- # TODO: check whether the following comment applies here
- # Try to get the parameter from the parameter_page. We have to
- # be very cautious here to avoid recursive calls (e.g. when
- # resolve_page_name needs as well parameters such as
- # use_connection_locale or subst_blank_in_name, etc.).
- #
- set value ""
- set pp [my property ParameterPages]
- if {$pp ne {}} {
- if {![regexp {/?..:} $pp]} {
- my log "Error: Name of parameter page '$pp' of FormPage [self] must contain a language prefix"
- } else {
- set page [::xo::cc cache [list [my package_id] get_page_from_item_ref $pp]]
- if {$page eq ""} {
- my log "Error: Could not resolve parameter page '$pp' of FormPage [self]."
- }
-
- if {$page ne "" && [$page exists instance_attributes]} {
- array set __ia [$page set instance_attributes]
- if {[info exists __ia($attribute)]} {
- set value $__ia($attribute)
- }
- }
+ # TODO: check whether the following comment applies here
+ # Try to get the parameter from the parameter_page. We have to
+ # be very cautious here to avoid recursive calls (e.g. when
+ # resolve_page_name needs as well parameters such as
+ # use_connection_locale or subst_blank_in_name, etc.).
+ #
+ set value ""
+ set pp [my property ParameterPages]
+ if {$pp ne {}} {
+ if {![regexp {/?..:} $pp]} {
+ my log "Error: Name of parameter page '$pp' of FormPage [self] must contain a language prefix"
+ } else {
+ set page [::xo::cc cache [list [my package_id] get_page_from_item_ref $pp]]
+ if {$page eq ""} {
+ my log "Error: Could not resolve parameter page '$pp' of FormPage [self]."
+ }
+
+ if {$page ne "" && [$page exists instance_attributes]} {
+ set __ia [$page set instance_attributes]
+ if {[dict exists $__ia $attribute]} {
+ set value [dict get $__ia $attribute]
}
+ }
}
-
-
- if {$value eq {}} {set value [next $attribute $default]}
- return $value
+ }
+
+
+ if {$value eq {}} {set value [next $attribute $default]}
+ return $value
}
#
# begin property management
#
- FormPage instproc property_key {name} {
+ #FormPage instproc property_key {name} {
+ # if {[regexp {^_([^_].*)$} $name _ varname]} {
+ # return $varname
+ # } {
+ # return __ia($name)
+ # }
+ #}
+
+ FormPage instproc exists_property {name} {
if {[regexp {^_([^_].*)$} $name _ varname]} {
- return $varname
- } {
- return __ia($name)
+ return [my exists $varname]
}
+ my instvar instance_attributes
+ return [dict exists $instance_attributes $name]
}
- FormPage instproc exists_property {name} {
- return [my exists [my property_key $name]]
- }
-
FormPage instproc property {name {default ""}} {
- set key [my property_key $name]
- #my msg "$key [my exists $key] //[my array names __ia]//"
- if {[my exists $key]} {
- return [my set $key]
+
+ if {[regexp {^_([^_].*)$} $name _ varname]} {
+ if {[my exists $varname]} {
+ return [my set $varname]
+ }
+ return $default
}
+
+ my instvar instance_attributes
+ if {[dict exists $instance_attributes $name]} {
+ return [dict get $instance_attributes $name]
+ }
return $default
}
FormPage instproc set_property {{-new 0} name value} {
if {[string match "_*" $name]} {
set key [string range $name 1 end]
- set instance_attributes_refresh 0
- } {
- set key __ia($name)
- set instance_attributes_refresh 1
+
+ if {!$new && ![my exists $key]} {
+ error "property '$name' ($key) does not exist. \
+ you might use flag '-new 1' for set_property to create new properties"
+ }
+ my set $key $value
+
+ } else {
+
+ my instvar instance_attributes
+ if {!$new && ![dict exists $instance_attributes $name]} {
+ error "property '$name' does not exist. \
+ you might use flag '-new 1' for set_property to create new properties"
+ }
+ dict set instance_attributes $name $value
}
- if {!$new && ![my exists $key]} {
- error "property '$name' ($key) does not exist. \
- you might use flag '-new 1' for set_property to create new properties\n[lsort [my info vars]]"
- }
- my set $key $value
- #my msg "[self] set $key $value"
- if {$instance_attributes_refresh} {
- my instance_attributes [my array get __ia]
- }
return $value
}
@@ -3365,8 +3376,7 @@
#my log "$value => [my adp_subst $value]"
array set wc [::xowiki::FormPage filter_expression [my adp_subst $value] &&]
#my log "wc= [array get wc]"
- array set __ia $wc(vars)
- array set __ia [my instance_attributes]
+ set __ia [dict merge $wc(vars) [my instance_attributes]]
#my log "expr $wc(tcl) returns => [expr $wc(tcl)]"
return [expr $wc(tcl)]
}
@@ -3668,7 +3678,7 @@
Page instproc unset_temporary_instance_variables {} {
# don't marshall/save/cache the following vars
- my array unset __ia
+ #my array unset __ia
my array unset __field_in_form
my array unset __field_needed
}
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.320.2.6 -r1.320.2.7
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 13 Oct 2013 18:13:58 -0000 1.320.2.6
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 7 Nov 2013 11:52:26 -0000 1.320.2.7
@@ -804,7 +804,7 @@
#}
}
- array set __ia [my set instance_attributes]
+ #array set __ia [my set instance_attributes]
my load_values_into_form_fields $form_fields
foreach f $form_fields {set ff([$f name]) $f }
@@ -1771,16 +1771,17 @@
Store the instance attributes or default values in the form.
} {
::require_html_procs
+ my instvar instance_attributes
- array set __ia [my instance_attributes]
+ #array set __ia [my instance_attributes]
foreach f $form_fields {
set att [$f name]
# just handle fields of the form entry
if {![my exists __field_in_form($att)]} continue
- #my msg "set form_value to form-field $att __ia($att) [info exists __ia($att)]"
- if {[info exists __ia($att)]} {
- #my msg "my set_form_value from ia $att '$__ia($att)', external='[$f convert_to_external $__ia($att)]' f.value=[$f value]"
- my set_form_value $att [$f convert_to_external $__ia($att)]
+ #my msg "set form_value to form-field $att [dict exists $instance_attributes $att]"
+ if {[dict exists $instance_attributes $att]} {
+ #my msg "my set_form_value from ia $att '[dict get $instance_attributes $att]', external='[$f convert_to_external [dict get $instance_attributes $att]]' f.value=[$f value]"
+ my set_form_value $att [$f convert_to_external [dict get $instance_attributes $att]]
} else {
# do we have a value in the form? If yes, keep it.
set form_value [my get_form_value $att]
@@ -1812,12 +1813,12 @@
set validation_errors 0
set category_ids [list]
array set containers [list]
- my instvar __ia package_id
+ my instvar __ia package_id instance_attributes
set cc [$package_id context]
- if {[my exists instance_attributes]} {
- array unset __ia
- array set __ia [my set instance_attributes]
- }
+ #if {[my exists instance_attributes]} {
+ # array unset __ia
+ # array set __ia [my set instance_attributes]
+ #}
if {![info exists field_names]} {
set field_names [$cc array names form_parameter]
@@ -1862,7 +1863,7 @@
set f [my lookup_form_field -name $att $form_fields]
set value [$f value [string trim [$cc form_parameter $att]]]
#my msg "value of $att ($f) = '$value' exists=[$cc exists_form_parameter $att]"
- if {![string match "*.*" $att]} {set __ia($att) $value}
+ if {![string match "*.*" $att]} {dict set instance_attributes $att $value}
if {[$f exists is_category_field]} {foreach v $value {lappend category_ids $v}}
}
}
@@ -1891,8 +1892,8 @@
set f [my lookup_form_field -name $c $form_fields]
set processed($c) 1
#my msg "container $c: compute value of $c [$f info class]"
- set __ia($c) [$f value]
- #my msg "container $c: __ia($c) is set to '$__ia($c)'"
+ dict set instance_attributes $c [$f value]
+ #my msg "container $c: is set to '[dict get $instance_attributes $c]'"
}
}
}
@@ -1934,11 +1935,11 @@
# the old value is due to "show-solution" in the qti
# use-case. Maybe one should alter this use-case to
# simplify the semantics here.
- if {[info exists __ia($att)]} {set default $__ia($att)}
+ if {[dict exists $instance_attributes $att]} {set default [dict get $instance_attributes $att]}
set v [$f value_if_nothing_is_returned_from_form $default]
#my msg "value_if_nothing_is_returned_from_form '$default' => '$v' (type=[$f info class])"
set value [$f value $v]
- if {![string match "*.*" $att]} {set __ia($att) $value}
+ if {![string match "*.*" $att]} {dict set instance_attributes $att $value}
}
}
}
@@ -1982,7 +1983,7 @@
}
}
- my instance_attributes [array get __ia]
+ #my instance_attributes [array get __ia]
#my msg category_ids=$category_ids
return [list $validation_errors [lsort -unique $category_ids]]
}
@@ -2109,7 +2110,7 @@
}
FormPage instproc load_values_into_form_fields {form_fields} {
- array set __ia [my set instance_attributes]
+ my instvar instance_attributes
foreach f $form_fields {
set att [$f name]
switch -glob $att {
@@ -2119,9 +2120,9 @@
$f value [$f convert_to_external [my set $varname]]
}
default {
- if {[info exists __ia($att)]} {
- #my msg "setting $f ([$f info class]) value $__ia($att)"
- $f value [$f convert_to_external $__ia($att)]
+ if {[dict exists $instance_attributes $att]} {
+ #my msg "setting $f ([$f info class]) value [dict get $instance_attributes $att]"
+ $f value [$f convert_to_external [dict get $instance_attributes $att]]
}
}
}