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.250 -r1.251 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 7 Aug 2017 23:48:30 -0000 1.250 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 31 Aug 2017 17:29:34 -0000 1.251 @@ -88,7 +88,7 @@ foreach f [::xowiki::formfield::FormField info instances -closure] { if {[$f name] eq $name} { if {![$f exists object]} { - my msg "strange, $f [$f name] was created without object but fits name" + :msg "strange, $f [$f name] was created without object but fits name" return $f } elseif {$object eq [$f object]} { return $f @@ -101,16 +101,16 @@ #FormField instproc destroy {} { - # my log "=== FormField DESTROY =====" + # :log "=== FormField DESTROY =====" # next #} FormField instproc init {} { - if {![my exists label]} {my label [string totitle [my name]]} - if {![my exists id]} {my id [my name]} - my set html(id) [my id] - #if {[my exists default]} {my set value [my default]} - my config_from_spec [my spec] + if {![info exists :label]} {my label [string totitle ${:name}]} + if {![info exists :id]} {set :id ${:name}} + set :html(id) ${:id} + #if {[info exists :default]} {set :value [:default]} + :config_from_spec ${:spec} } # @@ -124,42 +124,42 @@ } FormField instproc validation_check {validator_method value} { - return [my uplevel [list my $validator_method $value]] + return [:uplevel [list my $validator_method $value]] } FormField instproc validate {obj} { - my instvar name required + :instvar name required # use the 'value' method to deal e.g. with compound fields - set value [my value] - #my msg "[my info class] value=$value req=$required // [my set value] //" + set value [:value] + #my msg "[:info class] value=$value req=$required // ${:value} //" - if {$required && $value eq "" && ![my istype ::xowiki::formfield::hidden]} { - my instvar label + if {$required && $value eq "" && ![:istype ::xowiki::formfield::hidden]} { + :instvar label return [_ acs-templating.Element_is_required] } # - #my msg "++ [my name] [my info class] validator=[my validator] ([llength [my validator]]) value=$value" - foreach validator [my validator] { + #my msg "++ ${:name} [:info class] validator=[:validator] ([llength [:validator]]) value=$value" + foreach validator [:validator] { set errorMsg "" # # The validator might set the variable errorMsg in this scope. # set success 1 set validator_method check=$validator - set proc_info [my procsearch $validator_method] - #my msg "++ [my name]: field-level validator exists '$validator_method' ? [expr {$proc_info ne {}}]" + set proc_info [:procsearch $validator_method] + #my msg "++ ${:name}: field-level validator exists '$validator_method' ? [expr {$proc_info ne {}}]" if {$proc_info ne ""} { # we have a slot checker, call it #my msg "++ call-field level validator $validator_method '$value'" - set success [my validation_check $validator_method $value] + set success [:validation_check $validator_method $value] } if {$success == 1} { # the previous check was ok, check now for a validator on the # object level set validator_method validate=$validator set proc_info [$obj procsearch $validator_method] - #my msg "++ [my name]: page-level validator exists ? [expr {$proc_info ne {}}]" + #my msg "++ ${:name}: page-level validator exists ? [expr {$proc_info ne {}}]" if {$proc_info ne ""} { set success [$obj $validator_method $value] #my msg "++ call page-level validator $validator_method '$value' returns $success" @@ -186,26 +186,26 @@ # such that searchDefaults will pick up the new defaults, when a form field # is reclassed. - if {[my exists per_object_behavior]} { + if {[info exists :per_object_behavior]} { # remove per-object mixin from the "behavior" - my mixin delete [my set per_object_behavior] - my unset per_object_behavior + :mixin delete ${:per_object_behavior} + :unset per_object_behavior } - #my msg "reset along [my info precedence]" - foreach c [my info precedence] { + #my msg "reset along [:info precedence]" + foreach c [:info precedence] { if {$c eq "::xowiki::formfield::FormField"} break foreach s [$c info slots] { if {![$s exists default]} continue set var [$s name] set key processed($var) if {[info exists $key]} continue - my set $var [$s default] + set :$var [$s default] set $key 1 } } - if {[my exists disabled]} { - my set_disabled 0 + if {[info exists :disabled]} { + :set_disabled 0 } } @@ -230,26 +230,26 @@ FormField set cond_regexp {^([^=?]+)[?]([^:]*)[:](.*)$} FormField proc get_single_spec {-package_id -object string} { - if {[regexp [my set cond_regexp] $string _ condition true_spec false_spec]} { - if {[my interprete_condition -package_id $package_id -object $object $condition]} { - return [my get_single_spec -package_id $package_id -object $object $true_spec] + if {[regexp ${:cond_regexp} $string _ condition true_spec false_spec]} { + if {[:interprete_condition -package_id $package_id -object $object $condition]} { + return [:get_single_spec -package_id $package_id -object $object $true_spec] } else { - return [my get_single_spec -package_id $package_id -object $object $false_spec] + return [:get_single_spec -package_id $package_id -object $object $false_spec] } } return $string } FormField instproc remove_omit {} { set m ::xowiki::formfield::omit - if {[my ismixin $m]} {my mixin delete $m} + if {[:ismixin $m]} {my mixin delete $m} } FormField instproc set_disabled {disable} { - #my msg "[my name] set disabled $disable" + #my msg "${:name} set disabled $disable" if {$disable} { - my set disabled true + set :disabled true } else { - my unset -nocomplain disabled + :unset -nocomplain disabled } } @@ -259,35 +259,35 @@ # Specify the behavior of a form field via # per object mixins # - set obj [my object] + set obj ${:object} set pkgctx [[$obj package_id] context] if {[$pkgctx exists embedded_context]} { set ctx [$pkgctx set embedded_context] set classname ${ctx}::$mixin - #my msg ctx=$ctx-viewer=$mixin,found=[my isclass $classname] + #my msg ctx=$ctx-viewer=$mixin,found=[:isclass $classname] # TODO: search different places for the mixin. Special namespace? - if {[my isclass $classname]} { - if {[my exists per_object_behavior]} { - my mixin delete [my set per_object_behavior] + if {[:isclass $classname]} { + if {[info exists :per_object_behavior]} { + :mixin delete ${:per_object_behavior} } - my mixin add $classname - my set per_object_behavior $classname + :mixin add $classname + set :per_object_behavior $classname } else { - my msg "Could not find mixin '$mixin'" + :msg "Could not find mixin '$mixin'" } } } FormField instproc interprete_single_spec {s} { if {$s eq ""} return - set object [my object] + set object ${:object} set package_id [$object package_id] set s [::xowiki::formfield::FormField get_single_spec -object $object -package_id $package_id $s] switch -glob -- $s { - optional {my set required false} - required {my set required true; my remove_omit} + optional {set :required false} + required {set :required true; my remove_omit} omit {my mixin add ::xowiki::formfield::omit} noomit {my remove_omit} disabled {my set_disabled true} @@ -299,10 +299,10 @@ set p [string first = $s] set attribute [string range $s 0 $p-1] set value [string range $s $p+1 end] - set definition_class [lindex [my procsearch $attribute] 0] - set method [my info methods $attribute] + set definition_class [lindex [:procsearch $attribute] 0] + set method [:info methods $attribute] if {[string match "::xotcl::*" $definition_class] || $method eq ""} { - error [_ xowiki.error-form_constraint-unknown_attribute [list class [my info class] name [my name] entry $attribute]] + error [_ xowiki.error-form_constraint-unknown_attribute [list class [:info class] name ${:name} entry $attribute]] } if {[catch { # @@ -322,102 +322,101 @@ } default { # Check, if the spec value $s is a class. - set old_class [my info class] + set old_class [:info class] # Don't allow to use namespaced values, since we would run # into a recursive loop for richtext::wym (could be altered there as well). - if {[my isclass ::xowiki::formfield::$s] && ![string match "*:*" $s]} { - my class ::xowiki::formfield::$s - my remove_omit - if {$old_class ne [my info class]} { - #my msg "[my name]: reset class from $old_class to [my info class]" - my reset_parameter - my set __state reset - #my log "INITIALIZE [my name] due to reclassing old $old_class to new [my info class]" - my initialize + if {[:isclass ::xowiki::formfield::$s] && ![string match "*:*" $s]} { + :class ::xowiki::formfield::$s + :remove_omit + if {$old_class ne [:info class]} { + #my msg "${:name}: reset class from $old_class to [:info class]" + :reset_parameter + set :__state reset + #my log "INITIALIZE ${:name} due to reclassing old $old_class to new [:info class]" + :initialize } } else { if {$s ne ""} { error [_ xowiki.error-form_constraint-unknown_spec_entry \ - [list name [my name] entry $s x "Unknown spec entry for entry '$s'"]] + [list name ${:name} entry $s x "Unknown spec entry for entry '$s'"]] } } } } } FormField instproc config_from_spec {spec} { - #my log "config_from_spec [my name] spec <$spec> [my info class] [[my info class] exists abstract]" - my instvar type - if {[[my info class] exists abstract]} { - # had earlier here: [my info class] eq [self class] + #my log "config_from_spec ${:name} spec <$spec> [:info class] [[:info class] exists abstract]" + if {[[:info class] exists abstract]} { + # had earlier here: [:info class] eq [self class] # Check, whether the actual class is a concrete class (mapped to # concrete field type) or an abstact class. Since # config_from_spec can be called multiple times, we want to do # the reclassing only once. - if {[my isclass ::xowiki::formfield::$type]} { - my class ::xowiki::formfield::$type + if {[:isclass ::xowiki::formfield::${:type}]} { + :class ::xowiki::formfield::${:type} } else { - my class ::xowiki::formfield::text + :class ::xowiki::formfield::text } # set missing instance vars with defaults - my set_instance_vars_defaults + :set_instance_vars_defaults } regsub -all {,\s+} $spec , spec foreach s [split $spec ,] { - my interprete_single_spec [FormField fc_decode $s] + :interprete_single_spec [FormField fc_decode $s] } - #my msg "[my name]: after specs" - my set __state after_specs - #my log "INITIALIZE [my name] due to config_from_spec" - my initialize + #my msg "${:name}: after specs" + set :__state after_specs + #my log "INITIALIZE ${:name} due to config_from_spec" + :initialize # # It is possible, that a default value of a form field is changed through a spec. # Since only the configuration might set values, checking value for "" seems safe here. # - if {[my value] eq "" && [my exists default] && [my default] ne ""} { - #my msg "+++ reset value to [my default]" - my value [my default] + if {[:value] eq "" && [info exists :default] && ${:default} ne ""} { + #my msg "+++ reset value to [:default]" + :value ${:default} } if {[lang::util::translator_mode_p]} { - my mixin add "::xo::TRN-Mode" + :mixin add "::xo::TRN-Mode" } } FormField instproc asWidgetSpec {} { - my instvar widget_type options label help_text format html display_html + :instvar widget_type options label help_text format html display_html set spec $widget_type - if {[my exists spell]} {append spec ",[expr {[my spell] ? {} : {no}}]spell"} + if {[info exists :spell]} {append spec ",[expr {[:spell] ? {} : {no}}]spell"} - if {![my required]} {append spec ",optional"} - if {[my exists editor]} {append spec " {options {editor [my set editor]}} "} + if {![:required]} {append spec ",optional"} + if {[info exists :editor]} {append spec " {options {editor ${:editor}}} "} append spec " {label " [list $label] "} " if {[string match *bootstrap* [subsite::get_theme]]} { - my array set html {class "form-control"} + :array set html {class "form-control"} } - if {[my exists html]} { + if {[info exists :html]} { append spec " {html {" foreach {key value} [array get html] { append spec $key " " [list $value] " " } append spec "}} " } - if {[my exists options]} { + if {[info exists :options]} { append spec " {options " [list $options] "} " } - if {[my exists format]} { + if {[info exists :format]} { append spec " {format " [list $format] "} " } if {$help_text ne ""} { if {[string match "#*#" $help_text]} { - set internationalized [my localize $help_text] + set internationalized [:localize $help_text] append spec " {help_text {$internationalized}}" } else { append spec " {help_text {$help_text}}" @@ -429,23 +428,23 @@ FormField instproc render {} { # In case, we use an asHTML of a FormField, we use this # render definition - if {[my inline]} { + if {[:inline]} { # with label, error message, help text - my render_form_widget + :render_form_widget } else { # without label, error message, help text - my render_item + :render_item } - my set __rendered 1 + set :__rendered 1 } FormField instproc render_form_widget {} { # This method provides the form-widget wrapper - set CSSclass [my form_widget_CSSclass] - if {[my error_msg] ne ""} {append CSSclass " form-widget-error"} + set CSSclass [:form_widget_CSSclass] + if {[:error_msg] ne ""} {append CSSclass " form-widget-error"} set atts [list class $CSSclass] - if {[my inline]} {lappend atts style "display: inline;"} - ::html::div $atts { my render_input } + if {[:inline]} {lappend atts style "display: inline;"} + ::html::div $atts { :render_input } } FormField instproc booleanAttributes {args} { @@ -455,8 +454,8 @@ # set pairs "" foreach att $args { - if {[my exists $att] && [my set $att]} { - my set __#$att $att + if {[info exists :$att] && [set :$att]} { + set :__#$att $att lappend pairs [list __#$att $att] } } @@ -470,7 +469,7 @@ # foreach att $atts { lassign $att var value - if {[my exists $var]} {my unset $var} + if {[info exists :$var]} {my unset $var} } } @@ -480,38 +479,38 @@ # If no special renderer is defined, we fall back to this one, # which is in most cases a simple input fied of type string. # - set value [my value] - if {[my mode] ne "edit"} { - html::t -disableOutputEscaping [my pretty_value $value] + set value [:value] + if {[:mode] ne "edit"} { + html::t -disableOutputEscaping [:pretty_value $value] return } - if {[my exists validate_via_ajax] && [my validator] ne ""} { + if {[info exists :validate_via_ajax] && [:validator] ne ""} { set ajaxhelper 1 ::xowiki::Includelet require_YUI_JS -ajaxhelper 0 "yahoo/yahoo-min.js" ::xowiki::Includelet require_YUI_JS -ajaxhelper 0 "dom/dom-min.js" ::xowiki::Includelet require_YUI_JS -ajaxhelper 0 "event/event-min.js" ::xowiki::Includelet require_YUI_JS -ajaxhelper 0 "connection/connection-min.js" ::xo::Page requireJS "/resources/xowiki/yui-form-field-validate.js" - set package_url [[[my object] package_id] package_url] - ::xo::Page requireJS "YAHOO.xo_form_field_validate.add('[my id]','$package_url');" + set package_url [[${:object} package_id] package_url] + ::xo::Page requireJS "YAHOO.xo_form_field_validate.add('[:id]','$package_url');" } - set booleanAtts [my booleanAttributes required readonly disabled multiple \ + set booleanAtts [:booleanAttributes required readonly disabled multiple \ formnovalidate autofocus] # # We do not want i18n substitutions in the input fields. So, save # away the original value and pass the escaped value to the tDOM # renderer. # - set old_value [my set value] - my set value [xo::escape_message_keys $old_value] - ::html::input [my get_attributes type size maxlength id name value \ + set old_value ${:value} + set :value [xo::escape_message_keys $old_value] + ::html::input [:get_attributes type size maxlength id name value \ autocomplete pattern placeholder {CSSclass class} {*}$booleanAtts] {} # # Reset values to original content # - my resetBooleanAttributes $booleanAtts - my set value $old_value + :resetBooleanAttributes $booleanAtts + set :value $old_value # # Disabled fieds are not returned by the browsers. For some @@ -520,53 +519,53 @@ # change in the future the "name" of the disabled entry to keep # some hypothetical html-checker quiet. # - if {[my exists disabled] && [my exists transmit_field_always]} { + if {[info exists :disabled] && [info exists :transmit_field_always]} { ::html::div { - ::html::input [list type hidden name [my name] value $value] {} + ::html::input [list type hidden name ${:name} value $value] {} } } - my set __rendered 1 + set :__rendered 1 } FormField instproc render_item {} { - ::html::div -class [my form_item_wrapper_CSSclass] { - if {[my error_msg] ne ""} { + ::html::div -class [:form_item_wrapper_CSSclass] { + if {[:error_msg] ne ""} { set CSSclass form-label-error } else { set CSSclass form-label } ::html::div -class $CSSclass { - ::html::label -for [my id] { - ::html::t [my label] + ::html::label -for [:id] { + ::html::t [:label] } - if {[my required] && [my mode] eq "edit"} { + if {[:required] && [:mode] eq "edit"} { ::html::div -class form-required-mark { ::html::t " (#acs-templating.required#)" } } } - my render_form_widget - my render_help_text - my render_error_msg + :render_form_widget + :render_help_text + :render_error_msg html::t \n } } FormField instproc render_error_msg {} { - if {[my error_msg] ne "" && ![my exists error_reported]} { + if {[:error_msg] ne "" && ![info exists :error_reported]} { ::html::div -class form-error { - my instvar label - ::html::t [::xo::localize [my error_msg]] - my render_localizer - my set error_reported 1 + :instvar label + ::html::t [::xo::localize [:error_msg]] + :render_localizer + set :error_reported 1 } } } FormField instproc render_help_text {} { - set text [my help_text] + set text [:help_text] if {$text ne ""} { - html::div -class [my form_help_text_CSSclass] { + html::div -class [:form_help_text_CSSclass] { html::img -src "/shared/images/info.gif" -alt {[i]} -title {Help text} \ -width "12" -height 9 -style "margin-right: 5px" {} html::t $text @@ -583,7 +582,7 @@ # We localize in pretty_value the message keys in the # language of the item (not the connection item). if {[regexp "^#(.*)#$" $v _ key]} { - return [lang::message::lookup [my locale] $key] + return [lang::message::lookup [:locale] $key] } return $v } @@ -598,7 +597,7 @@ } FormField instproc has_instance_variable {var value} { - if {[my exists $var] && [my set $var] eq $value} {return 1} + if {[info exists :$var] && [set :$var] eq $value} {return 1} return 0 } FormField instproc convert_to_internal {} { @@ -610,86 +609,79 @@ } FormField instproc answer_check=eq {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - return [expr {$value eq $arg1}] + set arg1 [lindex [:correct_when] 1] + return [expr {${:value} eq $arg1}] } FormField instproc answer_check=gt {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - return [expr {$value > $arg1}] + set arg1 [lindex [:correct_when] 1] + return [expr {${:value} > $arg1}] } FormField instproc answer_check=ge {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - return [expr {$value >= $arg1}] + set arg1 [lindex [:correct_when] 1] + return [expr {${:value} >= $arg1}] } FormField instproc answer_check=lt {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - return [expr {$value < $arg1}] + set arg1 [lindex [:correct_when] 1] + return [expr {${:value} < $arg1}] } FormField instproc answer_check=le {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - return [expr {$value <= $arg1}] + set arg1 [lindex [:correct_when] 1] + return [expr {${:value} <= $arg1}] } FormField instproc answer_check=btwn {} { - my instvar value - set arg1 [lindex [my correct_when] 1] - set arg2 [lindex [my correct_when] 2] - return [expr {$value >= $arg1 && $value <= $arg2}] + set arg1 [lindex [:correct_when] 1] + set arg2 [lindex [:correct_when] 2] + return [expr {${:value} >= $arg1 && $value <= $arg2}] } FormField instproc answer_check=in {} { - my instvar value - set values [lrange [my correct_when] 1 end] - return [expr {$value in $values}] + set values [lrange [:correct_when] 1 end] + return [expr {${:value} in $values}] } FormField instproc answer_check=match {} { - return [string match [lindex [my correct_when] 1] [my value]] + return [string match [lindex [:correct_when] 1] [:value]] } FormField instproc answer_check=answer_words {} { - set value [regsub -all { +} [my value] " "] - if {[string match "*lower*" [lindex [my correct_when] 1]]} { + set value [regsub -all { +} [:value] " "] + if {[string match "*lower*" [lindex [:correct_when] 1]]} { set value [string tolower $value] } - return [expr {$value eq [my answer]}] + return [expr {$value eq [:answer]}] } FormField instproc answer_is_correct {} { - #my msg "[my name] ([my info class]): value=[my value], answer=[expr {[my exists answer]?[my set answer]:{NONE}}]" - if {[my exists correct_when]} { - set op [lindex [my correct_when] 0] - if {[my procsearch answer_check=$op] ne ""} { - set r [my answer_check=$op] + #my msg "${:name} ([:info class]): value=[:value], answer=[expr {[info exists :answer]?${:answer}:{NONE}}]" + if {[info exists :correct_when]} { + set op [lindex [:correct_when] 0] + if {[:procsearch answer_check=$op] ne ""} { + set r [:answer_check=$op] if {$r == 0} {return -1} {return 1} } else { error "invalid operator '$op'" } - } elseif {![my exists answer]} { + } elseif {![info exists :answer]} { return 0 - } elseif {[my value] ne [my answer]} { - #my msg "v='[my value]' NE a='[my answer]'" + } elseif {[:value] ne [:answer]} { + #my msg "v='[:value]' NE a='[:answer]'" return -1 } else { return 1 } } FormField instproc set_is_repeat_template {is_template} { - # my msg "[my name] set is_repeat_template $is_template" + # :msg "${:name} set is_repeat_template $is_template" if {$is_template} { - my set is_repeat_template true + set :is_repeat_template true } else { - my unset -nocomplain is_repeat_template + :unset -nocomplain is_repeat_template } } FormField instproc field_value {v} { - if {[my exists show_raw_value]} { + if {[info exists :show_raw_value]} { return $v } else { - return [my pretty_value $v] + return [:pretty_value $v] } } @@ -698,7 +690,7 @@ array set "" [${:object} item_ref -default_lang [${:object} lang] -parent_id $parent_id $entry_name] - set label [my 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, @@ -712,7 +704,7 @@ [list -stripped_name $(stripped_name)] [list -label $label] \ -parent_id $(parent_id) -item_id $(item_id)] - if {[my istype file]} { + if {[:istype file]} { if {$revision_id ne ""} { $l revision_id $revision_id } @@ -726,7 +718,7 @@ border border-width position top botton left right geometry } { - if {[my exists $option]} {$l set $option [my set $option]} + if {[info exists :$option]} {$l set $option [set :$option]} } set html [$l render] return $html @@ -746,14 +738,14 @@ Class instproc extend_slot_default {name value} { # Search for the slot. If the slot exists, extend it's default # value with the new value - foreach c [my info heritage] { + foreach c [:info heritage] { if {[info commands ${c}::slot::$name] ne ""} { set value [concat $value [${c}::slot::$name default]] break } } # create a mirroring slot with the maybe extended default - my slots [list Attribute create $name -default $value] + :slots [list Attribute create $name -default $value] } @@ -765,17 +757,17 @@ Class create submit_button -superclass FormField submit_button instproc initialize {} { - my set type submit - my set value [::xo::localize [_ xowiki.Form-submit_button]] + set :type submit + set :value [::xo::localize [_ xowiki.Form-submit_button]] } submit_button instproc render_input {} { # don't disable submit buttons - if {[my type] eq "submit"} {my unset -nocomplain disabled} - ::html::button [my get_attributes name type {form_button_CSSclass class} title disabled] { - ::html::t [my set value] + if {[:type] eq "submit"} {my unset -nocomplain disabled} + ::html::button [:get_attributes name type {form_button_CSSclass class} title disabled] { + ::html::t ${:value} } - #::html::input [my get_attributes name type {form_button_CSSclass class} value title disabled] {} - my render_localizer + #::html::input [:get_attributes name type {form_button_CSSclass class} value title disabled] {} + :render_localizer } ########################################################### @@ -796,11 +788,11 @@ } file instproc check=virus {value} { # In case of an upgrade script, the (uploaded) tmp file might not exist - if {[my viruscheck] - && [my exists tmpfile] + if {[:viruscheck] + && [info exists :tmpfile] && $value ne "" - && [file exists [my set tmpfile]] - && [::xowiki::virus check [my set tmpfile]] + && [file exists ${:tmpfile}] + && [::xowiki::virus check ${:tmpfile}] } { #util_user_message -message "uploaded file contains a virus; upload rejected" return 0 @@ -810,17 +802,17 @@ file instproc tmpfile {value} {my set [self proc] $value} file instproc content-type {value} {my set [self proc] $value} file instproc initialize {} { - my type file - my set booleanHTMLAttributes {multiple} - my set widget_type file(file) + :type file + set :booleanHTMLAttributes {multiple} + set :widget_type file(file) next } file instproc entry_info {} { - if {[my multiple]} { + if {[:multiple]} { if {[info exists :tmpfile]} { set list ${:tmpfile} } else { - set list [my get_from_value ${:value} name] + set list [:get_from_value ${:value} name] } set objName {} for {set i 0} {$i < [llength $list]} {incr i} { @@ -830,7 +822,7 @@ set objName file:${:name} } #my log ENTRY_INFO=[list name $objName parent_id [${:object} item_id]] - return [list name $objName parent_id [[my object] item_id]] + return [list name $objName parent_id [${:object} item_id]] } file instproc get_from_value {value attribute {raw ""}} { @@ -854,19 +846,19 @@ } file instproc no_value_provided {} { - expr {[my set value] eq ""} + expr {${:value} eq ""} } file instproc get_old_value {} { - return [[my object] form_parameter __old_value_[my name] ""] + return [${:object} form_parameter __old_value_${:name} ""] } file instproc value {args} { if {[llength $args] == 0} { - if {[my no_value_provided]} { - return [my get_old_value] + if {[:no_value_provided]} { + return [:get_old_value] } - return [my set value] + return ${:value} } return [next] } @@ -918,7 +910,7 @@ # Create a new file # #my msg "new file" - set package_id [[my object] package_id] + set package_id [${:object} package_id] set file_object [::xowiki::File new -destroy_on_cleanup \ -title $file_name \ -name $object_name \ @@ -942,19 +934,18 @@ file instproc convert_to_internal {} { - my instvar value - if {[my no_value_provided]} { - [my object] set_property -new 1 [my name] [my get_old_value] + if {[:no_value_provided]} { + ${:object} set_property -new 1 ${:name} [:get_old_value] return } - #my log "[my name]: got value '$value'" - #[my object] set_property -new 1 [my name] $value + #my log "${:name}: got value '${:value}'" + #${:object} set_property -new 1 ${:name} ${:value} - set package_id [[my object] package_id] - array set entry_info [my entry_info] + set package_id [${:object} package_id] + array set entry_info [:entry_info] - if {[my searchable]} { + if {[:searchable]} { set publish_date_cmd {;} set save_flag "" } else { @@ -968,20 +959,20 @@ # if {[llength ${:content-type}] == 1} { set :tmpfile [list ${:tmpfile}] - set value [list $value] + set :value [list ${:value}] } set revision_ids {} set newValue "" foreach content_type ${:content-type} \ object_name $entry_info(name) \ - tmpfile [my set tmpfile] \ - fn $value { + tmpfile ${:tmpfile} \ + fn ${:value} { regsub -all {\\+} $fn {/} fn ;# fix IE upload path set v [::file tail $fn] - set file_object [my store_file \ + set file_object [:store_file \ -file_name $fn \ -content_type $content_type \ -package_id $package_id \ @@ -1000,26 +991,26 @@ # the revision_id. TODO: clear revision_id on export. # set newValue [list name $newValue revision_id $revision_ids] - [my object] set_property -new 1 [my name] $newValue - my set value $newValue + ${:object} set_property -new 1 ${:name} $newValue + set :value $newValue } file instproc label_or_value {v} { - if {[my exists link_label]} { - return [my localize [my link_label]] + if {[info exists :link_label]} { + return [:localize [:link_label]] } return $v } file instproc pretty_value {v} { if {$v ne ""} { - my instvar object - array set "" [my entry_info] + :instvar object + array set "" [:entry_info] set result "" - foreach object_name $(name) fn [my get_from_value $v name] { + foreach object_name $(name) fn [:get_from_value $v name] { - array set "" [$object item_ref -default_lang [[my object] lang] -parent_id $(parent_id) $object_name] + array set "" [$object item_ref -default_lang [${:object} lang] -parent_id $(parent_id) $object_name] #my log "name <$object_name> pretty value name '$(stripped_name)'" @@ -1036,48 +1027,48 @@ file instproc render_input {} { - my instvar value - set package_id [[my object] package_id] + :instvar value + set package_id [${:object} package_id] - array set entry_info [my entry_info] - set fns [my get_from_value $value name $value] + array set entry_info [:entry_info] + set fns [:get_from_value $value name $value] # # The HTML5 handling of "required" would force us to upload in # every form the file again. To implement the sticky option, we # set temporarily the "required" attribute to false # - if {[my required]} { + if {[:required]} { set reset_required 1 - my set required false + set :required false } next ::html::t " " - set id __old_value_[my name] + set id __old_value_${:name} ::html::div { ::html::input -type hidden -name $id -id $id -value $value } ::html::div -class file-control -id __a$id { foreach \ object_name $entry_info(name) \ - revision_id [my get_from_value $value revision_id ""] \ + revision_id [:get_from_value $value revision_id ""] \ fn $fns { - #my msg "[my name]: [list my get_from_value <$value> name] => '$fn'" + #my msg "${:name}: [list :get_from_value <$value> name] => '$fn'" set href [$package_id pretty_link -download 1 -parent_id $entry_info(parent_id) $object_name] - if {![my istype image]} { + if {![:istype image]} { append href ?filename=[ns_urlencode $fn] if {$revision_id ne "" && [string is integer $revision_id]} { append href &revision_id=$revision_id } } if {[info exists reset_required]} { - my set required true + set :required true } ::html::div { - ::html::a -href $href {::html::t [my label_or_value $fn] } + ::html::a -href $href {::html::t [:label_or_value $fn] } } } # @@ -1086,8 +1077,8 @@ # - the formfield is not disabled, and # - the form-field is not sticky (default) # - set disabled [expr {[my exists disabled] && [my disabled] != "false"}] - if {$value ne "" && !$disabled && ![my sticky] } { + 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 \ -id $id-control \ @@ -1109,15 +1100,15 @@ } import_archive instproc initialize {} { next - if {[my help_text] eq ""} {my help_text "#xowiki.formfield-import_archive-help_text#"} + if {[:help_text] eq ""} {my help_text "#xowiki.formfield-import_archive-help_text#"} } import_archive instproc pretty_value {v} { - my instvar object + :instvar object set package_id [$object package_id] set parent_id [$object parent_id] if {$v eq ""} {return ""} - array set "" [my entry_info] - set fn [my get_from_value $v name $v] + array set "" [:entry_info] + set fn [:get_from_value $v name $v] # # Get the file object of the imported file to obtain is full name and path # @@ -1135,7 +1126,7 @@ # successful. Note that setting "cleanup" without thought might # lead to maybe unexpected deletions of the form-page # - if {[my cleanup]} { + if {[:cleanup]} { set return_url [$package_id query_parameter "return_url" [$parent_id pretty_link]] $package_id returnredirect [$object pretty_link -query [export_vars {m delete} return_url]] } @@ -1157,9 +1148,9 @@ } image instproc pretty_value {v} { set html "" - array set "" [my entry_info] - foreach object_name $(name) revision_id [my get_from_value $v revision_id] { - append html [my pretty_image \ + array set "" [:entry_info] + foreach object_name $(name) revision_id [:get_from_value $v revision_id] { + append html [:pretty_image \ -parent_id $(parent_id) \ -revision_id $revision_id \ $object_name] @@ -1178,36 +1169,36 @@ {max_age:integer} } -extend_slot_default validator signature hidden instproc initialize {} { - my type hidden - my set widget_type text(hidden) + :type hidden + set :widget_type text(hidden) # remove mixins in case of retyping - my mixin "" - if {[my exists size]} {my unset size} + :mixin "" + if {[info exists :size]} {my unset size} } hidden instproc render_item {} { # don't render the labels - if {[my exists sign] && [my sign]} { + if {[info exists :sign] && [:sign]} { set token_id [sec_get_random_cached_token_id] set secret [ns_config "ns/server/[ns_info server]/acs" parametersecret ""] - if {[my exists max_age]} { - set max_age [my max_age] + if {[info exists :max_age]} { + set max_age [:max_age] } else { set max_age "" } - set value [my value] + set value [:value] set sig [ad_sign -max_age $max_age -secret $secret -token_id $token_id $value] ::html::div { - ::html::input -name [my name] -value $value -type hidden - ::html::input -name __[my name]:sig -value $sig -type hidden + ::html::input -name ${:name} -value $value -type hidden + ::html::input -name __${:name}:sig -value $sig -type hidden } } else { - my render_form_widget + :render_form_widget } } hidden instproc check=signature {value} { set v 1 - if {[my exists sign] && [my sign]} { - set sig [::xo::cc form_parameter __[my name]:sig] + if {[info exists :sign] && [:sign]} { + set sig [::xo::cc form_parameter __${:name}:sig] set secret [ns_config "ns/server/[ns_info server]/acs" parametersecret ""] set v [ad_verify_signature -secret $secret $value $sig] ns_log notice "==== we have sig <$sig> val $v" @@ -1240,12 +1231,12 @@ Class create inform -superclass FormField inform instproc initialize {} { - my type hidden - my set widget_type text(inform) + :type hidden + set :widget_type text(inform) } inform instproc render_input {} { - ::html::t [my value] - ::html::input [my get_attributes type id name value disabled autocomplete {CSSclass class}] {} + ::html::t [:value] + ::html::input [:get_attributes type id name value disabled autocomplete {CSSclass class}] {} } inform instproc render_help_text {} { } @@ -1261,9 +1252,9 @@ maxlength } text instproc initialize {} { - my type text - my set widget_type text - foreach p [list size maxlength] {if {[my exists $p]} {my set html($p) [my $p]}} + :type text + set :widget_type text + foreach p [list size maxlength] {if {[info exists :$p]} {set :html($p) [my $p]}} } ########################################################### @@ -1275,7 +1266,7 @@ Class create color -superclass text color instproc initialize {} { next - my type color + :type color } ########################################################### @@ -1287,7 +1278,7 @@ Class create datetime -superclass text datetime instproc initialize {} { next - my type datetime + :type datetime } ########################################################### @@ -1300,7 +1291,7 @@ Class create h5date -superclass text h5date instproc initialize {} { next - my type date + :type date } ########################################################### @@ -1313,7 +1304,7 @@ Class create h5time -superclass text h5time instproc initialize {} { next - my type time + :type time } @@ -1326,7 +1317,7 @@ Class create datetime-local -superclass text datetime-local instproc initialize {} { next - my type datetime-local + :type datetime-local } ########################################################### @@ -1338,7 +1329,7 @@ Class create time -superclass text time instproc initialize {} { next - my type time + :type time } ########################################################### @@ -1350,7 +1341,7 @@ Class create week -superclass text week instproc initialize {} { next - my type datetime + :type datetime } ########################################################### @@ -1362,7 +1353,7 @@ Class create email -superclass text email instproc initialize {} { next - my type email + :type email } ########################################################### @@ -1374,7 +1365,7 @@ Class create search -superclass text search instproc initialize {} { next - my type search + :type search } ########################################################### # @@ -1385,7 +1376,7 @@ Class create tel -superclass text tel instproc initialize {} { next - my type tel + :type tel } ########################################################### @@ -1398,11 +1389,11 @@ min max step value } number instproc initialize {} { - my type number - my set widget_type text + :type number + set :widget_type text } number instproc render_input {} { - ::html::input [my get_attributes type id name value disabled {CSSclass class} min max step value \ + ::html::input [:get_attributes type id name value disabled {CSSclass class} min max step value \ autofocus autocomplete formnovalidate multiple pattern placeholder readonly required] {} } @@ -1416,11 +1407,11 @@ min max step value } range instproc initialize {} { - my type range - my set widget_type text + :type range + set :widget_type text } range instproc render_input {} { - ::html::input [my get_attributes type id name value disabled {CSSclass class} min max step value \ + ::html::input [:get_attributes type id name value disabled {CSSclass class} min max step value \ autofocus autocomplete formnovalidate multiple pattern placeholder readonly required] {} } @@ -1434,8 +1425,8 @@ Class create password -superclass text password instproc initialize {} { next - my set widget_type password - my type password + set :widget_type password + :type password } ########################################################### # @@ -1448,17 +1439,17 @@ } -extend_slot_default validator numeric numeric instproc initialize {} { next - my set widget_type numeric + set :widget_type numeric # check, if we we have an integer format - my set is_integer [regexp {%[0-9.]*d} [my format]] + set :is_integer [regexp {%[0-9.]*d} [:format]] } numeric instproc convert_to_external value { if {$value ne ""} { - if { [catch "lc_numeric $value [my format] [my locale]" result] } { - util_user_message -message "[my label]: $result (locale=[my locale])" - #my msg [list lc_numeric $value [my format] [my locale]] + if { [catch "lc_numeric $value [:format] [:locale]" result] } { + util_user_message -message "[:label]: $result (locale=[:locale])" + #my msg [list lc_numeric $value [:format] [:locale]] set converted_value $value - if {[catch {scan $value [my format] converted_value}]} { + if {[catch {scan $value [:format] converted_value}]} { return $value } else { return $converted_value @@ -1469,21 +1460,21 @@ return $value } numeric instproc convert_to_internal {} { - if {[my value] ne ""} { - set value [lc_parse_number [my value] [my locale] [my set is_integer]] - [my object] set_property -new 1 [my name] [expr {$value}] + if {[:value] ne ""} { + set value [lc_parse_number [:value] [:locale] ${:is_integer}] + ${:object} set_property -new 1 ${:name} [expr {$value}] return } } numeric instproc check=numeric {value} { - return [expr {[catch {lc_parse_number $value [my locale] [my set is_integer]}] == 0}] + return [expr {[catch {lc_parse_number $value [:locale] ${:is_integer}}] == 0}] } numeric instproc pretty_value value { - return [my convert_to_external $value] + return [:convert_to_external $value] } numeric instproc answer_check=eq {} { # use numeric equality - return [expr {[my value] == [lindex [my correct_when] 1]}] + return [expr {[:value] == [lindex [:correct_when] 1]}] } ########################################################### @@ -1497,7 +1488,7 @@ } user_id instproc initialize {} { next - my set is_party_id 1 + set :is_party_id 1 } user_id instproc pretty_value {v} { return [::xo::get_user_name $v] @@ -1517,17 +1508,17 @@ } author instproc pretty_value {v} { if {$v ne ""} { - my instvar object + :instvar object acs_user::get -user_id $v -array user - if {[my with_photo]} { + if {[:with_photo]} { set portrait_id [acs_user::get_portrait_id -user_id $v] if {$portrait_id == 0} { set md5 [ns_md5 $user(email)] - set src http://www.gravatar.com/avatar/$md5?size=[my photo_size]&d=mm + set src http://www.gravatar.com/avatar/$md5?size=[:photo_size]&d=mm } else { set src "/shared/portrait-bits.tcl?user_id=$v" } - set photo "" + set photo "" set photo_class "photo" } else { set photo "" @@ -1539,7 +1530,7 @@ -form_constraints ""] set date [$date_field pretty_value [$object property _last_modified]] - if {[my with_user_link]} { + if {[:with_user_link]} { set user_link_begin "" set user_link_end "" } else { @@ -1589,12 +1580,12 @@ } url instproc initialize {} { next - my type url + :type url } url instproc pretty_value {v} { if {$v ne ""} { - if {[my exists link_label]} { - set link_label [my localize [my link_label]] + if {[info exists :link_label]} { + set link_label [:localize [:link_label]] } else { set link_label $v } @@ -1617,7 +1608,7 @@ return "" } if {$v ne ""} { - set link_label [my localize [my link_label]] + set link_label [:localize [:link_label]] regsub -all & $v "&" v return " \[ $link_label \]" } @@ -1635,25 +1626,25 @@ {spell false} } textarea instproc initialize {} { - my set widget_type text(textarea) - my set booleanHTMLAttributes {required readonly disabled formnovalidate} - foreach p [list rows cols style] {if {[my exists $p]} {my set html($p) [my $p]}} - if {![my istype ::xowiki::formfield::richtext] && [my exists editor]} { + set :widget_type text(textarea) + set :booleanHTMLAttributes {required readonly disabled formnovalidate} + foreach p [list rows cols style] {if {[info exists :$p]} {set :html($p) [my $p]}} + if {![:istype ::xowiki::formfield::richtext] && [info exists :editor]} { # downgrading - #my msg "downgrading [my info class]" - foreach m [my info mixin] {if {[$m exists editor_mixin]} {my mixin delete $m}} - foreach v {editor options} {if {[my exists $v]} {my unset $v}} + #my msg "downgrading [:info class]" + foreach m [:info mixin] {if {[$m exists editor_mixin]} {my mixin delete $m}} + foreach v {editor options} {if {[info exists :$v]} {my unset $v}} } next } textarea instproc render_input {} { - set booleanAtts [my booleanAttributes {*}[my set booleanHTMLAttributes]] - ::html::textarea [my get_attributes id name cols rows style wrap placeholder data-repeat-template-id {CSSclass class} \ + set booleanAtts [:booleanAttributes {*}${:booleanHTMLAttributes}] + ::html::textarea [:get_attributes id name cols rows style wrap placeholder data-repeat-template-id {CSSclass class} \ {*}$booleanAtts] { - ::html::t [my value] + ::html::t [:value] } - my resetBooleanAttributes $booleanAtts + :resetBooleanAttributes $booleanAtts } ########################################################### @@ -1667,13 +1658,13 @@ {cols 80} } code_listing instproc pretty_value {v} { - [my object] do_substitutions 0 + ${:object} do_substitutions 0 if {[info commands ::apidoc::tclcode_to_html] ne ""} { - set html [::apidoc::tclcode_to_html [my value]] + set html [::apidoc::tclcode_to_html [:value]] regsub -all "\n?\r" $html html return "
$html
" } else { - return "
[string map [list & {&} < {<} > {>}]  [my value]]
" + return "
[string map [list & {&} < {<} > {>}]  [:value]]
" } } @@ -1699,71 +1690,71 @@ # # TODO: this should be made a slot setting # - #my msg "setting editor for [my name], args=$args,[llength $args]" - if {[llength $args] == 0} {return [my set editor]} + #my msg "setting editor for ${:name}, args=$args,[llength $args]" + if {[llength $args] == 0} {return ${:editor}} set editor [lindex $args 0] - if {[my exists editor] && $editor eq [my set editor] && [my exists __initialized]} return + if {[info exists :editor] && $editor eq ${:editor} && [info exists :__initialized]} return set editor_class [self class]::$editor - if {$editor ne "" && ![my hasclass $editor_class]} { - if {![my isclass $editor_class]} { + if {$editor ne "" && ![:hasclass $editor_class]} { + if {![:isclass $editor_class]} { set editors [list] foreach c [::xowiki::formfield::richtext info subclass] { if {![$c exists editor_mixin]} continue lappend editors [namespace tail $c] } error [_ xowiki.error-form_constraint-unknown_editor \ - [list name [my name] editor [my editor] editors $editors]] + [list name ${:name} editor [:editor] editors $editors]] } - foreach m [my info mixin] {if {[$m exists editor_mixin]} {my mixin delete $m}} - my mixin add $editor_class - #my msg "MIXIN $editor: [my info precedence]" - my reset_parameter - my set __initialized 1 + foreach m [:info mixin] {if {[$m exists editor_mixin]} {my mixin delete $m}} + :mixin add $editor_class + #my msg "MIXIN $editor: [:info precedence]" + :reset_parameter + set :__initialized 1 } - my set editor $editor + set :editor $editor } richtext instproc initialize {} { #my display_field false - switch -- [my set displayMode] { + switch -- ${:displayMode} { inplace - inline - standard {} - default {error "value '[my set displayMode]' invalid: valid entries for displayMode are inplace, inline or standard (default)"} + default {error "value '${:displayMode}' invalid: valid entries for displayMode are inplace, inline or standard (default)"} } # # Don't set HTML5 attribute "required", since this does not match # well with Richtext Editors (at least ckeditor4 has problems, # other probably as well). # - my set booleanHTMLAttributes {readonly disabled formnovalidate} + set :booleanHTMLAttributes {readonly disabled formnovalidate} next - #ns_log notice "==== [my name] EDITOR specified? [my exists editor]" - if {![my exists editor]} { - my set editor [parameter::get_global_value -package_key xowiki \ + #ns_log notice "==== ${:name} EDITOR specified? [info exists :editor]" + if {![info exists :editor]} { + set :editor [parameter::get_global_value -package_key xowiki \ -parameter PreferredRichtextEditor -default ckeditor4] - #my msg "setting default of [my name] to [my set editor]" + #my msg "setting default of ${:name} to ${:editor}" } - if {![my exists __initialized]} { + if {![info exists :__initialized]} { # # Mixin the editor based on the attribute 'editor' if necessary # and call initialize again in this case... # - #ns_log notice "==== initializing EDITOR: [my set editor]" - my editor [my set editor] - my initialize + #ns_log notice "==== initializing EDITOR: ${:editor}" + :editor ${:editor} + :initialize } } richtext instproc render_richtext_as_div {} { - #my msg "[my get_attributes id style {CSSclass class}]" - ::html::div [my get_attributes id style {CSSclass class}] { - if {[my wiki]} { - [my object] references clear - ::html::t -disableOutputEscaping [[my object] substitute_markup [my value]] + #my msg "[:get_attributes id style {CSSclass class}]" + ::html::div [:get_attributes id style {CSSclass class}] { + if {[:wiki]} { + ${:object} references clear + ::html::t -disableOutputEscaping [${:object} substitute_markup [:value]] } else { - ::html::t -disableOutputEscaping [my value] + ::html::t -disableOutputEscaping [:value] } } ::html::div @@ -1780,15 +1771,15 @@ set msg [ad_html_security_check $value] } if {$msg ne ""} { - my uplevel [list set errorMsg $msg] + :uplevel [list set errorMsg $msg] return 0 } return 1 } richtext instproc pretty_value {v} { # for richtext, perform minimal output escaping - if {[my wiki]} { - return [[my object] substitute_markup $v] + if {[:wiki]} { + return [${:object} substitute_markup $v] } else { return [string map [list @ "@"] $v] } @@ -1817,7 +1808,7 @@ {customConfig "../ck_config.js"} {callback "/* callback code */"} {destroy_callback "/* callback code */"} - {extraPlugins ""} + {extraPlugins "xowikiimage"} {templatesFiles ""} {templates ""} {contentsCss /resources/xowiki/ck_contents.css} @@ -1826,20 +1817,20 @@ richtext::ckeditor set editor_mixin 1 richtext::ckeditor ad_instproc -deprecated initialize {} { } { - switch -- [my set displayMode] { - inplace { my append help_text " #xowiki.ckeip_help#" } + switch -- ${:displayMode} { + inplace { append :help_text " #xowiki.ckeip_help#" } inline { error "inline is not supported for ckeditor v3"} } next - my set widget_type richtext + set :widget_type richtext # Mangle the id to make it compatible with jquery; most probably # not optimal and just a temporary solution - regsub -all {[.:]} [my id] "" id - my id $id + regsub -all {[.:]} [:id] "" id + :id $id } richtext::ckeditor instproc js_image_helper {} { - set path [[my object] pretty_link] + set path [${:object} pretty_link] append js \ [subst -novariables { function xowiki_image_callback(editor) { @@ -1891,9 +1882,9 @@ } richtext::ckeditor instproc render_input {} { - set disabled [expr {[my exists disabled] && [my disabled] != "false"}] - if {![my istype ::xowiki::formfield::richtext] || $disabled } { - my render_richtext_as_div + set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + if {![:istype ::xowiki::formfield::richtext] || $disabled } { + :render_richtext_as_div } else { ::xo::Page requireJS "/resources/xowiki/jquery/jquery.min.js" ::xo::Page requireJS "/resources/xowiki/ckeditor/ckeditor_source.js" @@ -1904,55 +1895,55 @@ # In contrary to the doc, ckeditor names instances after the id, # not the name. - set id [my id] - set name [my name] - set package_id [[my object] package_id] + set id [:id] + set name ${:name} + set package_id [${:object} package_id] #my extraPlugins {timestamp xowikiimage} - if {"xowikiimage" in [my extraPlugins]} { - my js_image_helper + if {"xowikiimage" in [:extraPlugins]} { + :js_image_helper set ready_callback {xowiki_image_callback(e.editor);} } else { set ready_callback "/*none*/;" } set options [subst { - toolbar : '[my toolbar]', - uiColor: '[my uiColor]', + toolbar : '[:toolbar]', + uiColor: '[:uiColor]', language: '[lang::conn::language]', - skin: '[my skin]', - startupMode: '[my mode]', - parent_id: '[[my object] item_id]', + skin: '[:skin]', + startupMode: '[:mode]', + parent_id: '[${:object} item_id]', package_url: '[$package_id package_url]', - extraPlugins: '[join [my extraPlugins] ,]', - contentsCss: '[my contentsCss]', - imageSelectorDialog: '[my imageSelectorDialog]', + extraPlugins: '[join [:extraPlugins] ,]', + contentsCss: '[:contentsCss]', + imageSelectorDialog: '[:imageSelectorDialog]', ready_callback: '$ready_callback', - customConfig: '[my customConfig]' + customConfig: '[:customConfig]' }] - if {[my templatesFiles] ne ""} { - append options " , templates_files: \['[join [my pathNames [my templatesFiles]] ',' ]' \]\n" + if {[:templatesFiles] ne ""} { + append options " , templates_files: \['[join [:pathNames [:templatesFiles]] ',' ]' \]\n" } - if {[my templates] ne ""} { - append options " , templates: '[my templates]'\n" + if {[:templates] ne ""} { + append options " , templates: '[:templates]'\n" } - #set parent [[[my object] package_id] get_page_from_item_or_revision_id [[my object] parent_id]];# ??? + #set parent [[${:object} package_id] get_page_from_item_or_revision_id [${:object} parent_id]];# ??? - if {[my set displayMode] eq "inplace"} { - if {[my value] eq ""} { - my value " " + if {${:displayMode} eq "inplace"} { + if {[:value] eq ""} { + :value " " } - my render_richtext_as_div - if {[my inline]} { + :render_richtext_as_div + if {[:inline]} { set wrapper_class "" } else { set wrapper_class "form-item-wrapper" - my callback {$(this.element.$).closest('.form-widget').css('clear','both').css('display', 'block');} - my destroy_callback {$(this).closest('.form-widget').css('clear','none');} + :callback {$(this.element.$).closest('.form-widget').css('clear','both').css('display', 'block');} + :destroy_callback {$(this).closest('.form-widget').css('clear','none');} } - set callback [my callback] - set destroy_callback [my destroy_callback] + set callback [:callback] + set destroy_callback [:destroy_callback] ::xo::Page requireJS "/resources/xowiki/ckeip.js" ::xo::Page requireJS [subst -nocommands { @@ -1968,7 +1959,7 @@ }); }] } else { - set callback [my callback] + set callback [:callback] ::xo::Page requireJS [subst -nocommands { \$(document).ready(function() { \$( '#$id' ).ckeditor(function() { $callback }, { @@ -2016,19 +2007,19 @@ richtext::ckeditor4 set editor_mixin 1 richtext::ckeditor4 instproc initialize {} { - switch -- [my set displayMode] { - inplace { my append help_text " #xowiki.ckeip_help#" } + switch -- ${:displayMode} { + inplace { append :help_text " #xowiki.ckeip_help#" } } next - my set widget_type richtext + set :widget_type richtext # Mangle the id to make it compatible with jquery; most probably # not optimal and just a temporary solution - regsub -all {[.:-]} [my id] "" id - my id $id + regsub -all {[.:-]} [:id] "" id + :id $id } richtext::ckeditor4 instproc js_image_helper {} { - set path [[my object] pretty_link] + set path [${:object} pretty_link] append js \ [subst -novariables { function xowiki_image_callback(editor) { @@ -2091,21 +2082,21 @@ } richtext::ckeditor4 instproc render_input {} { - set disabled [expr {[my exists disabled] && [my disabled] != "false"}] - set is_repeat_template [expr {[my exists is_repeat_template] && [my set is_repeat_template] == "true"}] - # my msg "[my id] [my name] - $is_repeat_template" + 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" if {$is_repeat_template} { - my set data-repeat-template-id [my id] + set :data-repeat-template-id [:id] } # if value is empty, we need something to be clickable for display mode inplace - if {[my value] eq "" && ${:displayMode} eq "inplace"} { - my value " " + if {[:value] eq "" && ${:displayMode} eq "inplace"} { + :value " " } - if {![my istype ::xowiki::formfield::richtext] || ($disabled && !$is_repeat_template)} { - my render_richtext_as_div + if {![:istype ::xowiki::formfield::richtext] || ($disabled && !$is_repeat_template)} { + :render_richtext_as_div } else { security::csp::require script-src 'unsafe-eval' @@ -2123,15 +2114,15 @@ # In contrary to the doc, ckeditor4 names instances after the id, # not the name. - set id [my id] - set name [my name] - set package_id [[my object] package_id] + set id [:id] + set name ${:name} + set package_id [${:object} package_id] if {${:displayMode} eq "inline"} { - my lappend extraPlugins sourcedialog + lappend :extraPlugins sourcedialog } - if {"xowikiimage" in [my extraPlugins]} { - my js_image_helper + if {"xowikiimage" in [:extraPlugins]} { + :js_image_helper set ready_callback "xowiki_image_callback(CKEDITOR.instances\['$id'\]);" set ready_callback2 {xowiki_image_callback(e.editor);} } else { @@ -2141,39 +2132,39 @@ } set options [subst { - [my set additionalConfigOptions] - toolbar : '[my toolbar]', - uiColor: '[my uiColor]', + ${:additionalConfigOptions} + toolbar : '[:toolbar]', + uiColor: '[:uiColor]', language: '[lang::conn::language]', - skin: '[my skin]', - startupMode: '[my mode]', - parent_id: '[[my object] item_id]', + skin: '[:skin]', + startupMode: '[:mode]', + parent_id: '[${:object} item_id]', package_url: '[$package_id package_url]', - extraPlugins: '[join [my extraPlugins] ,]', - extraAllowedContent: '[my extraAllowedContent]', - contentsCss: '[my contentsCss]', - imageSelectorDialog: '[my imageSelectorDialog]?parent_id=[[my object] item_id]', + extraPlugins: '[join [:extraPlugins] ,]', + extraAllowedContent: '[:extraAllowedContent]', + contentsCss: '[:contentsCss]', + imageSelectorDialog: '[:imageSelectorDialog]?parent_id=[${:object} item_id]', ready_callback: '$ready_callback2', - customConfig: '[my customConfig]', + customConfig: '[:customConfig]', textarea_id: id }] - if {[my allowedContent] ne ""} { - append options " , allowedContent: '[my allowedContent]'\n" + if {[:allowedContent] ne ""} { + append options " , allowedContent: '[:allowedContent]'\n" } - if {[my templatesFiles] ne ""} { - append options " , templates_files: \['[join [my pathNames [my templatesFiles]] ',' ]' \]\n" + if {[:templatesFiles] ne ""} { + append options " , templates_files: \['[join [:pathNames [:templatesFiles]] ',' ]' \]\n" } - if {[my templates] ne ""} { - append options " , templates: '[my templates]'\n" + if {[:templates] ne ""} { + append options " , templates: '[:templates]'\n" } - #set parent [[[my object] package_id] get_page_from_item_or_revision_id [[my object] parent_id]];# ??? + #set parent [[${:object} package_id] get_page_from_item_or_revision_id [${:object} parent_id]];# ??? if {${:displayMode} eq "inplace"} { - set callback [my callback] - set destroy_callback [my destroy_callback] + set callback [:callback] + set destroy_callback [:destroy_callback] - my lappend CSSclass ckeip + lappend :CSSclass ckeip ::xo::Page requireJS "/resources/xowiki/ckeip.js" ::xo::Page requireJS [subst -nocommands { @@ -2203,20 +2194,20 @@ } ); }] } - my render_richtext_as_div + :render_richtext_as_div } elseif {${:displayMode} eq "inline"} { - if {"xowikiimage" in [my extraPlugins]} { + if {"xowikiimage" in [:extraPlugins]} { set ready_callback "xowiki_image_callback(CKEDITOR.instances\['$id'\]);" set submit_callback "calc_image_tags_to_wiki_image_links_inline('$id');" } - set submit_callback "$submit_callback [my submit_callback]" + set submit_callback "$submit_callback [:submit_callback]" ::xo::Page requireJS [subst { function load_$id (id) { CKEDITOR.inline(id, { on: { instanceReady: function(e) { - \$(e.editor.element.\$).attr('title', '[my set label]'); + \$(e.editor.element.\$).attr('title', '${:label}'); \$(e.editor.element.\$.form).submit(function(e) { $submit_callback }); @@ -2244,7 +2235,7 @@ } next } else { - set callback [my callback] + set callback [:callback] ::xo::Page requireJS [subst -nocommands { function load_$id (id) { // must use id provided as argument @@ -2282,19 +2273,19 @@ richtext::wym set editor_mixin 1 richtext::wym instproc initialize {} { next - my set widget_type richtext + set :widget_type richtext } richtext::wym instproc render_input {} { - set disabled [expr {[my exists disabled] && [my disabled] != "false"}] - if {![my istype ::xowiki::formfield::richtext] || $disabled } { - my render_richtext_as_div + set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + if {![:istype ::xowiki::formfield::richtext] || $disabled } { + :render_richtext_as_div } else { ::xo::Page requireCSS "/resources/xowiki/wymeditor/skins/default/screen.css" ::xo::Page requireJS "/resources/xowiki/jquery/jquery.min.js" ::xo::Page requireJS "/resources/xowiki/wymeditor/jquery.wymeditor.pack.js" set postinit "" foreach plugin {hovertools resizable fullscreen embed} { - if {$plugin in [my plugins]} { + if {$plugin in [:plugins]} { switch -- $plugin { embed {} resizable { @@ -2307,17 +2298,17 @@ ::xo::Page requireJS "/resources/xowiki/wymeditor/plugins/$plugin/jquery.wymeditor.$plugin.js" } } - regsub -all {[.:]} [my id] {\\\\&} JID + regsub -all {[.:]} [:id] {\\\\&} JID # possible skins are per in the distribution: "default", "sliver", "minimal" and "twopanels" - set config [list "skin: '[my skin]'"] + set config [list "skin: '[:skin]'"] - #my msg "wym, h [my exists height] || w [my exists width]" - if {[my exists height] || [my exists width]} { + #my msg "wym, h [info exists :height] || w [info exists :width]" + if {[info exists :height] || [info exists :width]} { set height_cmd "" set width_cmd "" - if {[my exists height]} {set height_cmd "jQuery(wym._box).find(wym._options.iframeSelector).css('height','[my height]');"} - if {[my exists width]} {set width_cmd "wym_box.css('width', '[my width]');"} + if {[info exists :height]} {set height_cmd "jQuery(wym._box).find(wym._options.iframeSelector).css('height','[:height]');"} + if {[info exists :width]} {set width_cmd "wym_box.css('width', '[:width]');"} set postInit [subst -nocommand -nobackslash { postInit: function(wym) { wym_box = jQuery(".wym_box"); @@ -2356,7 +2347,7 @@ } richtext::xinha set editor_mixin 1 richtext::xinha instproc initialize {} { - switch -- [my set displayMode] { + switch -- ${:displayMode} { inplace { ::xo::Page requireJS "/resources/xowiki/xinha-inplace.js" if {![info exists ::__xinha_inplace_init_done]} { @@ -2368,23 +2359,23 @@ } next - my set widget_type richtext - if {![my exists plugins]} { - my plugins \ + set :widget_type richtext + if {![info exists :plugins]} { + :plugins \ [parameter::get -parameter "XowikiXinhaDefaultPlugins" \ -default [::xo::parameter get_from_package_key \ -package_key "acs-templating" -parameter "XinhaDefaultPlugins"]] } - my set options [my get_attributes editor plugins width height folder_id script_dir javascript wiki_p] + set :options [:get_attributes editor plugins width height folder_id script_dir javascript wiki_p] # for the time being, we can't set the defaults via parameter, # but only manually, since the editor is used as a mixin, the parameter # would have precedence over the defaults of subclasses - if {![my exists slim]} {my set slim false} - if {![my exists style]} {my set style "width: 100%;"} - if {![my exists height]} {my set height 350px} - if {![my exists wiki_p]} {my set wiki_p 1} - if {[my set slim]} { - my lappend options javascript { + if {![info exists :slim]} {set :slim false} + if {![info exists :style]} {set :style "width: 100%;"} + if {![info exists :height]} {set :height 350px} + if {![info exists :wiki_p]} {set :wiki_p 1} + if {${:slim}} { + lappend :options javascript { xinha_config.toolbar = [['popupeditor', 'formatblock', 'bold','italic','createlink','insertimage'], ['separator','insertorderedlist','insertunorderedlist','outdent','indent'], ['separator','killword','removeformat','htmlmode'] @@ -2394,9 +2385,9 @@ } richtext::xinha instproc render_input {} { - set disabled [expr {[my exists disabled] && [my disabled] != "false"}] - if {![my istype ::xowiki::formfield::richtext] || $disabled} { - my render_richtext_as_div + set disabled [expr {[info exists :disabled] && [:disabled] != "false"}] + if {![:istype ::xowiki::formfield::richtext] || $disabled} { + :render_richtext_as_div } else { # # required CSP directives for Xinha @@ -2408,10 +2399,10 @@ # the blank master set ::acs_blank_master(xinha) 1 set quoted [list] - foreach e [my plugins] {lappend quoted '$e'} + foreach e [:plugins] {lappend quoted '$e'} set ::acs_blank_master(xinha.plugins) [join $quoted ", "] - array set o [my set options] + array set o ${:options} set xinha_options "" foreach e {width height folder_id fs_package_id file_types attach_parent_id wiki_p package_id} { if {[info exists o($e)]} { @@ -2423,27 +2414,27 @@ append xinha_options $o(javascript) \n } set ::acs_blank_master(xinha.options) $xinha_options - lappend ::acs_blank_master__htmlareas [my id] + lappend ::acs_blank_master__htmlareas [:id] if {${:displayMode} eq "inplace"} { - ::html::div [my get_attributes id name {CSSclass class} disabled] { + ::html::div [:get_attributes id name {CSSclass class} disabled] { set href \# - ::html::a -style "float: right;" -class edit-item-button -href $href -id [my id]-edit { + ::html::a -style "float: right;" -class edit-item-button -href $href -id [:id]-edit { ::html::t -disableOutputEscaping   } template::add_event_listener \ - -id [my id]-edit \ - -script [subst {xinha.inplace.openEditor('[my id]');}] + -id [:id]-edit \ + -script [subst {xinha.inplace.openEditor('[:id]');}] - ::html::div -id "[my id]__CONTENT__" { - ::html::t -disableOutputEscaping [my value] + ::html::div -id "[:id]__CONTENT__" { + ::html::t -disableOutputEscaping [:value] } } - my set hiddenid [my id]__HIDDEN__ - my set type hidden - ::html::input [my get_attributes {hiddenid id} name type value] {} + set :hiddenid [:id]__HIDDEN__ + set :type hidden + ::html::input [:get_attributes {hiddenid id} name type value] {} } else { - #::html::div [my get_attributes id name cols rows style {CSSclass class} disabled] {} + #::html::div [:get_attributes id name cols rows style {CSSclass class} disabled] {} next } } @@ -2462,45 +2453,45 @@ } enumeration set abstract 1 enumeration instproc initialize {} { - if {[my exists category_tree]} { - my config_from_category_tree [my category_tree] + if {[info exists :category_tree]} { + :config_from_category_tree [:category_tree] } next # For required enumerations, the implicit default value is the # first entry of the options. This is as well the value, which is # returned from the browser in such cases. - if {[my required] && [my set value] eq ""} { - my set value [lindex [my set options] 0 1] + if {[:required] && ${:value} eq ""} { + set :value [lindex ${:options} 0 1] } } enumeration abstract instproc render_input {} enumeration instproc get_labels {values} { - if {[my multiple]} { + if {[:multiple]} { set labels [list] - foreach v $values {lappend labels [list [my get_entry_label $v] $v]} + foreach v $values {lappend labels [list [:get_entry_label $v] $v]} return $labels } else { - return [list [list [my get_entry_label $values] $values]] + return [list [list [:get_entry_label $values] $values]] } } enumeration instproc pretty_value {v} { - if {[my exists category_label($v)]} { - return [my set category_label($v)] + if {[info exists :category_label($v)]} { + return [set :category_label($v)] } - if {[my exists multiple] && [my set multiple]} { - foreach o [my set options] { + if {[info exists :multiple] && ${:multiple}} { + foreach o ${:options} { lassign $o label value - set labels($value) [my localize $label] + set labels($value) [:localize $label] } set values [list] foreach i $v {lappend values $labels($i)} return [join $values {, }] } else { - foreach o [my set options] { + foreach o ${:options} { lassign $o label value - if {$value eq $v} {return [my localize $label]} + if {$value eq $v} {return [:localize $label]} } } } @@ -2513,10 +2504,10 @@ # # The usage of the label does not seem to be very useful. # - #set tree_id [category_tree::get_id $tree_name [my locale]] + #set tree_id [category_tree::get_id $tree_name [:locale]] - set package_id [[my object] package_id] - set tree_ids [::xowiki::Category get_mapped_trees -object_id $package_id -locale [my locale] \ + set package_id [${:object} package_id] + set tree_ids [::xowiki::Category get_mapped_trees -object_id $package_id -locale [:locale] \ -names $tree_name -output tree_id] # In case there are multiple trees with the same name, @@ -2525,7 +2516,7 @@ set tree_id [lindex $tree_ids 0] if {$tree_id eq ""} { - my msg "cannot lookup mapped category tree name '$tree_name'" + :msg "cannot lookup mapped category tree name '$tree_name'" return } set subtree_id "" @@ -2535,17 +2526,17 @@ -subtree_id $subtree_id -tree_id $tree_id] { lassign $category category_id category_name deprecated_p level set category_name [ns_quotehtml [lang::util::localize $category_name]] - my set category_label($category_id) $category_name + set :category_label($category_id) $category_name if { $level>1 } { set category_name "[string repeat {.} [expr {2*$level-4}]]..$category_name" } lappend options [list $category_name $category_id] } - my options $options - my set is_category_field 1 - # my msg label_could_be=$tree_name,existing=[my label] - # if {![my exists label]} { - # my label $tree_name + :options $options + set :is_category_field 1 + # :msg label_could_be=$tree_name,existing=[:label] + # if {![info exists :label]} { + # :label $tree_name # } } @@ -2560,31 +2551,31 @@ {forced_name} } radio instproc initialize {} { - my set widget_type text(radio) + set :widget_type text(radio) next } radio instproc render_input {} { - set value [my value] - foreach o [my options] { + set value [:value] + foreach o [:options] { lassign $o label rep - set atts [my get_attributes disabled] - if {[my exists forced_name]} { - set name [my forced_name] + set atts [:get_attributes disabled] + if {[info exists :forced_name]} { + set name [:forced_name] } { - set name [my name] + set name ${:name} } - set id [my id]:$rep + set id [:id]:$rep lappend atts id $id name $name type radio value $rep if {$value eq $rep} { lappend atts checked checked } set label_class "" - if {[my 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 {![my horizontal]} { + if {![:horizontal]} { html::br } } @@ -2600,8 +2591,8 @@ {horizontal false} } checkbox instproc initialize {} { - my set multiple true - my set widget_type text(checkbox) + set :multiple true + set :widget_type text(checkbox) next } @@ -2613,33 +2604,33 @@ # - view mode: the fields were deactivted (made insensitive); # this means: keep the old value - #my msg "[my name] disabled=[my exists disabled]" - if {[my exists disabled]} {return $default} else {return ""} + #my msg "${:name} disabled=[info exists :disabled]" + if {[info exists :disabled]} {return $default} else {return ""} } checkbox instproc render_input {} { # identical to radio, except "checkbox" type and "in" expression for value; # maybe we can push this up to enumeration.... - set value [my value] - foreach o [my options] { + set value [:value] + foreach o [:options] { lassign $o label rep - set id [my id]:$rep - set atts [my get_attributes disabled] - lappend atts id $id name [my name] type checkbox value $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 {[my 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 {![my horizontal]} { + if {![:horizontal]} { html::br } #::html::input $atts {} #::html::label -for $id {html::t "$label "} - #if {![my horizontal]} {html::br} + #if {![:horizontal]} {html::br} } } @@ -2655,25 +2646,25 @@ } select instproc initialize {} { - my set widget_type text(select) + set :widget_type text(select) next - if {![my exists options]} {my options [list]} + if {![info exists :options]} {my options [list]} } select instproc render_input {} { - set atts [my get_attributes id name disabled {CSSclass class}] - if {[my multiple]} {lappend atts multiple [my multiple]} - set options [my options] - if {![my required]} { + set atts [:get_attributes id name disabled {CSSclass class}] + if {[:multiple]} {lappend atts multiple [:multiple]} + set options [:options] + if {![:required]} { set options [linsert $options 0 [list "--" ""]] } ::html::select $atts { foreach o $options { lassign $o label rep - set atts [my get_attributes disabled] + set atts [:get_attributes disabled] lappend atts value $rep - #my msg "lsearch {[my value]} $rep ==> [lsearch [my value] $rep]" - if {$rep in [my value]} { + #my msg "lsearch {[:value]} $rep ==> [lsearch [:value] $rep]" + if {$rep in [:value]} { lappend atts selected selected } ::html::option $atts {::html::t $label} @@ -2694,11 +2685,11 @@ candidate_box_select set abstract 1 candidate_box_select instproc render_input {} { - #my msg "mul=[my multiple]" + #my msg "mul=[:multiple]" # makes only sense currently for multiple selects - if {[my multiple] && [my dnd]} { - if {([my exists disabled] && [my disabled])} { - html::t -disableOutputEscaping [my pretty_value [my value]] + if {[:multiple] && [:dnd]} { + if {([info exists :disabled] && [:disabled])} { + html::t -disableOutputEscaping [:pretty_value [:value]] } else { # utilities.js aggregates "yahoo, dom, event, connection, animation, dragdrop" @@ -2708,7 +2699,7 @@ ::xo::Page requireJS "/resources/xowiki/yui-selection-area.js" set js "" - foreach o [my options] { + foreach o [:options] { lassign $o label rep set js_label [::xowiki::Includelet js_encode $label] set js_rep [::xowiki::Includelet js_encode $rep] @@ -2719,24 +2710,24 @@ ::html::div -class workarea { ::html::h3 { ::html::t "#xowiki.Selection#"} set values "" - foreach v [my value] { + foreach v [:value] { append values $v \n set __values($v) 1 } - my CSSclass selection - my set cols 30 - set atts [my get_attributes id name disabled {CSSclass class}] + :CSSclass selection + set :cols 30 + set atts [:get_attributes id name disabled {CSSclass class}] # TODO what todo with DISABLED? - ::html::textarea [my get_attributes id name cols rows style {CSSclass class} disabled] { + ::html::textarea [:get_attributes id name cols rows style {CSSclass class} disabled] { ::html::t $values } } ::html::div -class workarea { ::html::h3 { ::html::t "#xowiki.Candidates#"} - ::html::ul -id [my id]_candidates -class region { - #my msg [my options] - foreach o [my options] { + ::html::ul -id [:id]_candidates -class region { + #my msg [:options] + foreach o [:options] { lassign $o label rep # Don't show current values under candidates if {[info exists __values($rep)]} continue @@ -2767,7 +2758,7 @@ abstract_page set abstract 1 abstract_page instproc initialize {} { - my set package_id [[my object] package_id] + set :package_id [${:object} package_id] #my compute_options next } @@ -2783,20 +2774,20 @@ } abstract_page instproc get_entry_label {value} { - set item_id [[my set package_id] lookup -parent_id [[my object] parent_id] -name $value] + set item_id [${:package_id} lookup -parent_id [${:object} parent_id] -name $value] if {$item_id} { - return [::xo::cc cache [list my fetch_entry_label [my entry_label] $item_id]] + return [::xo::cc cache [list :fetch_entry_label [:entry_label] $item_id]] } return "" } abstract_page instproc pretty_value {v} { - my instvar package_id - set object [my object] + :instvar package_id + set object ${:object} set parent_id [$object parent_id] - my set options [my get_labels $v] - if {[my multiple]} { - foreach o [my set options] { + set :options [:get_labels $v] + if {[:multiple]} { + foreach o ${:options} { lassign $o label value set href [$package_id pretty_link -parent_id $parent_id $value] set labels($value) "$label" @@ -2810,17 +2801,17 @@ set href [$package_id pretty_link -parent_id $parent_id $i] lappend hrefs "$labels($i)" } - if {[my multiple_style] eq "list"} { + if {[:multiple_style] eq "list"} { return "\n" } else { return [join $hrefs {, }] } } else { - foreach o [my set options] { + foreach o ${:options} { lassign $o label value #my log "comparing '$value' with '$v'" if {$value eq $v} { - if {[my as_box]} { + if {[:as_box]} { return [$object include [list $value -decoration rightbox]] } set href [$package_id pretty_link -parent_id $parent_id $value] @@ -2831,7 +2822,7 @@ } abstract_page instproc render_input {} { - my compute_options + :compute_options next } @@ -2847,26 +2838,26 @@ } form_page instproc initialize {} { - my instvar form_object_item_ids package_id object - if {![my exists form]} { return } + :instvar form_object_item_ids package_id object + if {![info exists :form]} { return } next - set form_name [my form] + set form_name [:form] set package_id [$object package_id] set form_objs [::xowiki::Weblog instantiate_forms \ -parent_id [$object parent_id] \ -default_lang [$object lang] \ -forms $form_name -package_id $package_id] - #set form_obj [[my object] resolve_included_page_name $form_name] + #set form_obj [${:object} resolve_included_page_name $form_name] if {$form_objs eq ""} {error "Cannot lookup Form '$form_name'"} set form_object_item_ids [list] foreach form_obj $form_objs {lappend form_object_item_ids [$form_obj item_id]} } form_page instproc compute_options {} { - my instvar form_object_item_ids where package_id entry_label - #my msg "[my name] compute_options [my exists form]" - if {![my exists form]} { + :instvar form_object_item_ids where package_id entry_label + #my msg "${:name} compute_options [info exists :form]" + if {![info exists :form]} { return } @@ -2908,15 +2899,15 @@ lappend options [list [$i property $entry_label] $package_prefix[$i name]] } - my options $options + :options $options } form_page instproc pretty_value {v} { - my options [my get_labels $v] - if {![my exists form_object_item_ids]} { - error "No forms specified for form_field '[my name]'" + :options [:get_labels $v] + if {![info exists :form_object_item_ids]} { + error "No forms specified for form_field '${:name}'" } - my set package_id [[lindex [my set form_object_item_ids] 0] package_id] + set :package_id [[lindex ${:form_object_item_ids} 0] package_id] next } @@ -2934,31 +2925,29 @@ } page instproc compute_options {} { - my instvar type with_subtypes glob - set extra_where_clause "" - if {[my exists glob]} { - append extra_where_clause [::xowiki::Includelet glob_clause $glob] + if {[info exists :glob]} { + append extra_where_clause [::xowiki::Includelet glob_clause ${:glob}] } - set package_id [[my object] package_id] + set package_id [${:object} package_id] set options [list] ::xo::dc foreach instance_select \ - [$type instance_select_query \ + [${:type} instance_select_query \ -folder_id [$package_id folder_id] \ - -with_subtypes $with_subtypes \ + -with_subtypes ${:with_subtypes} \ -select_attributes [list title] \ -from_clause ", xowiki_page p" \ -where_clause "p.page_id = bt.revision_id $extra_where_clause" \ -orderby ci.name \ ] { - lappend options [list [set [my entry_label]] $name] + lappend options [list [set [:entry_label]] $name] } - my options $options + :options $options } page instproc pretty_value {v} { - my set package_id [[my object] package_id] + set :package_id [${:object} package_id] next } @@ -2974,7 +2963,7 @@ foreach p [lsort [::xowiki::Policy info instances]] { lappend options [list $p $p] } - my options $options + :options $options next } @@ -2986,7 +2975,7 @@ Class create DD -superclass select DD instproc initialize {} { - my options { + :options { {01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9} {10 10} {11 11} {12 12} {13 13} {14 14} {15 15} {16 16} {17 17} {18 18} {19 19} {20 20} {21 21} {22 22} {23 23} {24 24} {25 25} {26 26} {27 27} {28 28} {29 29} {30 30} @@ -3003,7 +2992,7 @@ Class create HH24 -superclass select HH24 instproc initialize {} { - my options { + :options { {00 0} {01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9} {10 10} {11 11} {12 12} {13 13} {14 14} {15 15} {16 16} {17 17} {18 18} {19 19} {20 20} {21 21} {22 22} {23 23} @@ -3019,16 +3008,16 @@ Class create MI -superclass select MI instproc value args { - if {[llength $args] == 0} {return [my set value]} else { + if {[llength $args] == 0} {return ${:value}} else { set v [lindex $args 0] - if {$v eq ""} {return [my set value ""]} else { + if {$v eq ""} {return [:set value ""]} else { # round to 5 minutes - my set value [lindex [my options] [expr {($v + 2) / 5}] 1] + set :value [lindex [:options] [expr {($v + 2) / 5}] 1] } } } MI instproc initialize {} { - my options { + :options { {00 0} {05 5} {10 10} {15 15} {20 20} {25 25} {30 30} {35 35} {40 40} {45 45} {50 50} {55 55} } @@ -3043,7 +3032,7 @@ Class create MM -superclass select MM instproc initialize {} { - my options { + :options { {01 1} {02 2} {03 3} {04 4} {05 5} {06 6} {07 7} {08 8} {09 9} {10 10} {11 11} {12 12} } @@ -3057,14 +3046,14 @@ Class create mon -superclass select mon instproc initialize {} { - set values [lang::message::lookup [my locale] acs-lang.localization-abmon] + set values [lang::message::lookup [:locale] acs-lang.localization-abmon] if {[lang::util::translator_mode_p]} {set values [::xo::localize $values]} set last 0 foreach m {1 2 3 4 5 6 7 8 9 10 11 12} { lappend options [list [lindex $values $last] $m] set last $m } - my options $options + :options $options next } ########################################################### @@ -3075,14 +3064,14 @@ Class create month -superclass select month instproc initialize {} { - set values [lang::message::lookup [my locale] acs-lang.localization-mon] + set values [lang::message::lookup [:locale] acs-lang.localization-mon] if {[lang::util::translator_mode_p]} {set values [::xo::localize $values]} set last 0 foreach m {1 2 3 4 5 6 7 8 9 10 11 12} { lappend options [list [lindex $values $last] $m] set last $m } - my options $options + :options $options next } @@ -3114,7 +3103,7 @@ youtube_url instproc initialize {} { next - if {[my help_text] eq ""} {my help_text "#xowiki.formfield-youtube_url-help_text#"} + if {[:help_text] eq ""} {my help_text "#xowiki.formfield-youtube_url-help_text#"} } youtube_url instproc pretty_value {v} { if {$v eq ""} { @@ -3147,7 +3136,7 @@ } image_url instproc initialize {} { next - if {[my help_text] eq ""} {my help_text "#xowiki.formfield-image_url-help_text#"} + if {[:help_text] eq ""} {my help_text "#xowiki.formfield-image_url-help_text#"} } image_url instproc entry_name {value} { set value [string map [list %2e .] $value] @@ -3158,15 +3147,15 @@ } image_url instproc check=image_check {value} { if {$value eq ""} {return 1} - set entry_name [my entry_name $value] + set entry_name [:entry_name $value] if {$entry_name eq ""} { - my log "--img '$value' does not appear to be an image" + :log "--img '$value' does not appear to be an image" # no image? return 0 } - set folder_id [[my object] set parent_id] + set folder_id [${:object} set parent_id] if {[::xo::db::CrClass lookup -name $entry_name -parent_id $folder_id]} { - my log "--img entry named $entry_name exists already" + :log "--img entry named $entry_name exists already" # file exists already return 1 } @@ -3180,7 +3169,7 @@ set img [expr {[dict exists $request page] ? [dict get $request page] : ""}] } errorMsg]} { # cannot transfer image - my log "--img cannot tranfer image '$value' ($errorMsg)" + :log "--img cannot tranfer image '$value' ($errorMsg)" return 0 } #my msg "guess mime_type of $entry_name = [::xowiki::guesstype $entry_name]" @@ -3191,16 +3180,16 @@ -name $entry_name \ -parent_id $folder_id \ -mime_type [::xowiki::guesstype $entry_name] \ - -package_id [[my object] package_id] \ + -package_id [${:object} package_id] \ -creation_user [::xo::cc user_id] \ ] $file_object set import_file $import_file $file_object save_new return 1 } image_url instproc pretty_value {v} { - set entry_name [my entry_name $v] - return [my pretty_image -parent_id [[my object] parent_id] $entry_name] + set entry_name [:entry_name $v] + return [:pretty_image -parent_id [${:object} parent_id] $entry_name] } @@ -3219,7 +3208,7 @@ include instproc pretty_value {v} { if {$v eq ""} { return $v } - my instvar object + :instvar object set item_id [$object get_property_from_link_page item_id] if {$item_id == 0} { # Here, we could call "::xowiki::Link render" to offer the user means @@ -3231,7 +3220,7 @@ set link_type [$object get_property_from_link_page link_type] $object references resolved [list $item_id $link_type] - set resolve_local [my resolve_local] + set resolve_local [:resolve_local] if {$resolve_local} { # # resetting esp. the item-id is dangerous. @@ -3263,7 +3252,7 @@ redirect instproc pretty_value {v} { #ad_returnredirect -allow_complete_url $v #ad_script_abort - return [[[my object] package_id] returnredirect $v] + return [[${:object} package_id] returnredirect $v] } ########################################################### @@ -3278,12 +3267,12 @@ } -extend_slot_default validator compound CompoundField instproc check=compound {value} { - #my msg "check compound in [my components]" - foreach c [my components] { + #my msg "check compound in [:components]" + foreach c [:components] { set error [$c validate [self]] if {$error ne ""} { set msg "[$c label]: $error" - my uplevel [list set errorMsg $msg] + :uplevel [list set errorMsg $msg] #util_user_message -message "Error in compound field [$c name]: $error" return 0 } @@ -3292,53 +3281,53 @@ } CompoundField instproc set_disabled {disable} { - #my msg "[my name] set disabled $disable" + #my msg "${:name} set disabled $disable" if {$disable} { - my set disabled true + set :disabled true } else { - my unset -nocomplain disabled + :unset -nocomplain disabled } - foreach c [my components] { + foreach c [:components] { $c set_disabled $disable } } CompoundField instproc set_is_repeat_template {is_template} { - # my msg "[my name] set is_repeat_template $is_template" + # :msg "${:name} set is_repeat_template $is_template" if {$is_template} { - my set is_repeat_template true + set :is_repeat_template true } else { - my unset -nocomplain is_repeat_template + :unset -nocomplain is_repeat_template } - foreach c [my components] { + foreach c [:components] { $c set_is_repeat_template $is_template } } CompoundField instproc same_value {v1 v2} { if {$v1 eq $v2} {return 1} foreach {n1 value1} $v1 {n2 value2} $v2 { - set f [my set component_index($n1)] + set f [set :component_index($n1)] if {![$f same_value $value1 $value2]} { return 0 } } return 1 } CompoundField instproc value {args} { if {[llength $args] == 0} { - set v [my get_compound_value] - #my msg "[my name]: reading compound value => '$v'" + set v [:get_compound_value] + #my msg "${:name}: reading compound value => '$v'" return $v } else { - #my msg "[my name]: setting compound value => '[lindex $args 0]'" - my set_compound_value [lindex $args 0] + #my msg "${:name}: setting compound value => '[lindex $args 0]'" + :set_compound_value [lindex $args 0] } } CompoundField instproc validate {obj} { # Delegate validate to the components. If a validation of a # component fails, report the error message back. - foreach c [my components] { + foreach c [:components] { set result [$c validate $obj] if {$result ne ""} { return $result @@ -3353,7 +3342,7 @@ ns_log notice "CompoundField: error during setting compound value with $value: $errorMsg" } # set the value parts for each components - foreach c [my 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 ... @@ -3366,17 +3355,17 @@ CompoundField instproc get_compound_value {} { # Set the internal representation based on the components values. set value [list] - foreach c [my components] { + foreach c [:components] { #my msg "$c [$c info class] lappending [list [$c name] [$c value]]" lappend value [$c name] [$c value] } - #my msg "[my name]: get_compound_value returns value=$value" + #my msg "${:name}: get_compound_value returns value=$value" return $value } CompoundField instproc specs_unmodified {spec_list} { - expr {[my set __state] eq "after_specs" - && [my exists structure] && [my set structure] eq $spec_list + expr {${:__state} eq "after_specs" + && [info exists :structure] && ${:structure} eq $spec_list } } @@ -3385,25 +3374,25 @@ # Omit after specs for compund fields to avoid multiple # recreations. # - if {[my specs_unmodified $spec_list]} return + if {[:specs_unmodified $spec_list]} return # # Build a component structure based on a list of specs # of the form {name spec}. # - my set structure $spec_list - my set components [list] + set :structure $spec_list + set :components [list] foreach entry $spec_list { lassign $entry name spec # # create for each component a form field # set c [::xowiki::formfield::FormField create [self]::$name \ - -name [my name].$name -id [my id].$name \ - -locale [my locale] -object [my object] \ + -name ${:name}.$name -id [:id].$name \ + -locale [:locale] -object ${:object} \ -spec $spec] - my set component_index([my name].$name) $c - my lappend components $c + set :component_index(${:name}.$name) $c + lappend :components $c } } @@ -3412,34 +3401,34 @@ # Add a single component dynamically to the list of already # existing components and return the component as result. # - my lappend structure $entry + lappend :structure $entry lassign $entry name spec set c [::xowiki::formfield::FormField create [self]::$name \ - -name [my name].$name -id [my id].$name \ - -locale [my locale] -object [my object] \ + -name ${:name}.$name -id [:id].$name \ + -locale [:locale] -object ${:object} \ -spec $spec] - my set component_index([my name].$name) $c - my lappend components $c + set :component_index(${:name}.$name) $c + lappend :components $c return $c } CompoundField instproc get_component {component_name} { - set key component_index([my name].$component_name) - if {[my exists $key]} { - return [my set $key] + set key component_index(${:name}.$component_name) + if {[info exists :$key]} { + return [set :$key] } - error "no component named $component_name of compound field [my name]" + error "no component named $component_name of compound field ${:name}" } CompoundField instproc exists_named_sub_component args { # Iterate along the argument list to check components of a deeply # nested structure. For example, # - # my check_named_sub_component a b + # :check_named_sub_component a b # # returns 0 or one depending whether there exists a component "a" # with a subcomponent "b". - set component_name [my name] + set component_name ${:name} set sub [self] foreach e $args { append component_name .$e @@ -3455,10 +3444,10 @@ # Iterate along the argument list to get components of a deeply # nested structure. For example, # - # my get_named_sub_component a b + # :get_named_sub_component a b # # returns the object of the subcomponent "b" of component "a" - set component_name [my name] + set component_name ${:name} set sub [self] foreach e $args { append component_name .$e @@ -3469,8 +3458,8 @@ } CompoundField instproc get_named_sub_component_value {{-default ""} args} { - if {[my exists_named_sub_component {*}$args]} { - return [[my get_named_sub_component {*}$args] value] + if {[:exists_named_sub_component {*}$args]} { + return [[:get_named_sub_component {*}$args] value] } else { return $default } @@ -3486,8 +3475,8 @@ # # Render content within in a fieldset, but with labels etc. # - html::fieldset [my get_attributes id {CSSclass class}] { - foreach c [my components] { $c render } + html::fieldset [:get_attributes id {CSSclass class}] { + foreach c [:components] { $c render } } } @@ -3499,7 +3488,7 @@ # set ff [dict create {*}$v] set html "