Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.284.2.40 -r1.284.2.41 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 18 Oct 2019 16:41:02 -0000 1.284.2.40 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 21 Oct 2019 18:26:23 -0000 1.284.2.41 @@ -392,7 +392,7 @@ set spec ${:widget_type} if {[info exists :spell]} {append spec ",[expr {${:spell} ? {} : {no}}]spell"} - if {![:required]} {append spec ",optional"} + if {!${:required}} {append spec ",optional"} if {[info exists :editor]} {append spec " {options {editor ${:editor}}} "} append spec " {label " [list ${:label}] "} " @@ -429,7 +429,7 @@ FormField instproc render {} { # In case, we use an asHTML of a FormField, we use this # render definition - if {[:inline]} { + if {${:inline}} { # with label, error message, help text :render_form_widget } else { @@ -444,7 +444,7 @@ set CSSclass [:form_widget_CSSclass] if {[:error_msg] ne ""} {append CSSclass " form-widget-error"} set atts [list class $CSSclass] - if {[:inline]} {lappend atts style "display: inline;"} + if {${:inline}} {lappend atts style "display: inline;"} ::html::div $atts { :render_input } } @@ -537,9 +537,9 @@ } ::html::div -class $CSSclass { ::html::label -for ${:id} { - ::html::t [:label] + ::html::t ${:label} } - if {[:required] && [:mode] eq "edit"} { + if {${:required} && [:mode] eq "edit"} { ::html::div -class form-required-mark { ::html::t " (#acs-templating.required#)" } @@ -699,7 +699,7 @@ array set "" [${:object} item_ref -default_lang [${:object} lang] -parent_id $parent_id $entry_name] - set label [:label] ;# the label is used for alt and title + set label ${:label} ;# the label is used for alt and title if {$label eq $(stripped_name)} { # # The label is apparently the default. For Photo.form instances, @@ -817,7 +817,7 @@ next } file instproc entry_info {} { - if {[:multiple]} { + if {${:multiple}} { if {[info exists :tmpfile]} { set list ${:tmpfile} } else { @@ -1050,7 +1050,7 @@ # every form the file again. To implement the sticky option, we # set temporarily the "required" attribute to false # - if {[:required]} { + if {${:required}} { set reset_required 1 set :required false } @@ -1091,7 +1091,7 @@ # - the formfield is not disabled, and # - the form-field is not sticky (default) # - set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + set disabled [expr {[info exists :disabled] && ${:disabled} != "false"}] if {${:value} ne "" && !$disabled && ![:sticky] } { ::html::input -type button -value [_ xowiki.clear] -id $id-control template::add_event_listener \ @@ -1288,9 +1288,9 @@ next if {${:help_text} eq ""} { set :help_text "#xowiki.formfield-correct_when-help_text#" - } + } } - + ########################################################### # # ::xowiki::formfield::color @@ -1478,23 +1478,23 @@ next set :widget_type numeric # check, if we have an integer format - set :is_integer [regexp {%[0-9.]*d} [:format]] + set :is_integer [regexp {%[0-9.]*d} ${:format}] } numeric instproc convert_to_external value { if {$value eq ""} { set result "" } else { ad_try { - return [lc_numeric $value [:format] [:locale]] + return [lc_numeric $value ${:format} [:locale]] } on error errorMsg { - util_user_message -message "[:label]: $errorMsg (locale=[:locale])" + util_user_message -message "${:label}: $errorMsg (locale=[:locale])" } # # try again # set converted_value $value ad_try { - scan $value [:format] result + scan $value ${:format} result } on error {errMsg} { set result $value } @@ -1924,7 +1924,7 @@ } richtext::ckeditor instproc render_input {} { - set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + set disabled [expr {[info exists :disabled] && ${:disabled} != "false"}] if {![:istype ::xowiki::formfield::richtext] || $disabled } { :render_richtext_as_div } else { @@ -1977,7 +1977,7 @@ :value " " } :render_richtext_as_div - if {[:inline]} { + if {${:inline}} { set wrapper_class "" } else { set wrapper_class "form-item-wrapper" @@ -2124,7 +2124,7 @@ } richtext::ckeditor4 instproc render_input {} { - set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + set disabled [expr {[info exists :disabled] && ${:disabled} != "false"}] set is_repeat_template [expr {[info exists :is_repeat_template] && ${:is_repeat_template} == "true"}] # :msg "${:id} ${:name} - $is_repeat_template" @@ -2344,7 +2344,7 @@ set :widget_type richtext } richtext::wym instproc render_input {} { - set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + set disabled [expr {[info exists :disabled] && ${:disabled} != "false"}] if {![:istype ::xowiki::formfield::richtext] || $disabled } { :render_richtext_as_div } else { @@ -2452,7 +2452,7 @@ } richtext::xinha instproc render_input {} { - set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + set disabled [expr {[info exists :disabled] && ${:disabled} != "false"}] if {![:istype ::xowiki::formfield::richtext] || $disabled} { :render_richtext_as_div } else { @@ -2529,7 +2529,7 @@ # first entry of the options. This is as well the value, which is # returned from the browser in such cases. # - if {[:required] && ${:value} eq ""} { + if {${:required} && ${:value} eq ""} { set :value [lindex ${:options} 0 1] } } @@ -2605,7 +2605,7 @@ } :options $options set :is_category_field 1 - # :msg label_could_be=$tree_name,existing=[:label] + # :msg label_could_be=$tree_name,existing=${:label} # if {![info exists :label]} { # :label $tree_name # } @@ -2631,7 +2631,7 @@ lassign $o label rep set atts [:get_attributes disabled] if {[info exists :forced_name]} { - set name [:forced_name] + set name ${:forced_name} } { set name ${:name} } @@ -2641,12 +2641,12 @@ lappend atts checked checked } set label_class "" - if {[:horizontal]} {set label_class "radio-inline"} + if {${:horizontal}} {set label_class "radio-inline"} ::html::label -for $id -class $label_class { ::html::input $atts {} ::html::t " $label " } - if {![:horizontal]} { + if {!${:horizontal}} { html::br } } @@ -2687,26 +2687,26 @@ # identical to radio, except "checkbox" type and "in" expression for value; # maybe we can push this up to enumeration.... set value [:value] - foreach o [:options] { + foreach o ${:options} { lassign $o label rep set id ${:id}:$rep set atts [:get_attributes disabled] lappend atts id $id name ${:name} type checkbox value $rep if {$rep in $value} {lappend atts checked checked} set label_class "" - if {[:horizontal]} {set label_class "checkbox-inline"} + if {${:horizontal}} {set label_class "checkbox-inline"} ::html::label -for $id -class $label_class { ::html::input $atts {} ::html::t " $label " } - if {![:horizontal]} { + if {!${:horizontal}} { html::br } #::html::input $atts {} #::html::label -for $id {html::t "$label "} - #if {![:horizontal]} {html::br} + #if {!${:horizontal}} {html::br} } } @@ -2729,8 +2729,8 @@ select instproc render_input {} { set atts [:get_attributes id name disabled {CSSclass class}] - if {[:multiple]} {lappend atts multiple [:multiple]} - if {![:required]} { + if {${:multiple}} {lappend atts multiple ${:multiple}} + if {!${:required}} { set :options [linsert ${:options} 0 [list "--" ""]] } ::html::select $atts { @@ -2774,9 +2774,9 @@ #:msg "mul ${:multiple} dnd ${:dnd}" # makes only sense currently for multiple selects - if {[:multiple] && [:dnd]} { + if {${:multiple} && ${:dnd}} { - if {[info exists :disabled] && [:disabled]} { + if {[info exists :disabled] && ${:disabled}} { html::t -disableOutputEscaping [:pretty_value [:value]] } else { @@ -2897,7 +2897,7 @@ set parent_id [${:object} parent_id] set package ::${:package_id} set :options [:get_labels $v] - if {[:multiple]} { + if {${:multiple}} { set default_lang [$package default_language] set root_folder [$package folder_id] set package_root [$package package_url] @@ -2930,7 +2930,7 @@ lassign $o label value #:log "comparing '$value' with '$v'" if {$value eq $v} { - if {[:as_box]} { + if {${:as_box}} { return [${:object} include [list $value -decoration rightbox]] } set href [$package pretty_link -parent_id $parent_id $value] @@ -3056,7 +3056,7 @@ -where_clause "p.page_id = bt.revision_id $extra_where_clause" \ -orderby ci.name \ ] { - lappend :options [list [set [:entry_label]] $name] + lappend :options [list [set ${:entry_label}] $name] } } @@ -3389,8 +3389,8 @@ } -extend_slot_default validator compound CompoundField instproc check=compound {value} { - #:msg "check compound in [:components]" - foreach c [:components] { + #:msg "check compound in ${:components}" + foreach c ${:components} { set error [$c validate [self]] if {$error ne ""} { set msg "[$c label]: $error" @@ -3409,7 +3409,7 @@ } else { :unset -nocomplain disabled } - foreach c [:components] { + foreach c ${:components} { $c set_disabled $disable } } @@ -3421,7 +3421,7 @@ } else { :unset -nocomplain is_repeat_template } - foreach c [:components] { + foreach c ${:components} { $c set_is_repeat_template $is_template } } @@ -3459,7 +3459,7 @@ # # Called with a single value, set object for all components # - foreach c [:components] { + foreach c ${:components} { $c object [lindex $args 0] } @@ -3474,7 +3474,7 @@ CompoundField instproc validate {obj} { # Delegate validate to the components. If a validation of a # component fails, report the error message back. - foreach c [:components] { + foreach c ${:components} { set result [$c validate $obj] if {$result ne ""} { return $result @@ -3489,7 +3489,7 @@ ns_log notice "CompoundField: error during setting compound value with $value: $errorMsg" } # set the value parts for each components - foreach c [:components] { + foreach c ${:components} { # Set only those parts, for which attribute values pairs are # given. Components might have their own default values, which # we do not want to overwrite ... @@ -3506,7 +3506,7 @@ set cc [[${:object} package_id] context] set value [list] - foreach c [:components] { + foreach c ${:components} { lappend value [$c name] [$c value] } #:log "${:name}: get_compound_value returns value=$value" @@ -3638,7 +3638,7 @@ # Render content within in a fieldset, but with labels etc. # html::fieldset [:get_attributes id {CSSclass class}] { - foreach c [:components] { $c render } + foreach c ${:components} { $c render } } } @@ -3650,7 +3650,7 @@ # set ff [dict create {*}$v] set html "