Index: openacs-4/packages/xowiki/tcl/link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v diff -u -r1.98 -r1.99 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 30 Sep 2017 18:12:53 -0000 1.98 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 21 Oct 2017 17:06:24 -0000 1.99 @@ -17,20 +17,20 @@ BaseLink instproc built_in_target {} { # currently, we do not support named frames, which are mostly deprecated - return [expr {[my target] in {_blank _self _parent _top}}] + return [expr {[:target] in {_blank _self _parent _top}}] } BaseLink instproc anchor_atts {} { set atts {} - if {[my exists title]} {lappend atts "title='[string map [list ' {'}] [my title]]'"} - if {[my exists target] && [my built_in_target]} { - lappend atts "target='[my target]'" + if {[info exists :title]} {lappend atts "title='[string map [list ' {'}] [:title]]'"} + if {[info exists :target] && [:built_in_target]} { + lappend atts "target='[:target]'" } return [join $atts " "] } BaseLink instproc mk_css_class {{-additional ""} {-default ""}} { - set cls [expr {[my exists cssclass] ? [my cssclass] : $default}] + set cls [expr {[info exists :cssclass] ? [:cssclass] : $default}] if {$additional ne ""} { if {$cls eq ""} {set cls $additional} else {append cls " " $additional} } @@ -39,8 +39,8 @@ } BaseLink instproc mk_css_class_and_id {{-additional ""} {-default ""}} { - if {[my exists cssid]} {set id "id='[my cssid]'"} else {set id ""} - set cls [my mk_css_class -additional $additional -default $default] + if {[info exists :cssid]} {set id "id='[:cssid]'"} else {set id ""} + set cls [:mk_css_class -additional $additional -default $default] return [string trim "$cls $id"] } @@ -49,9 +49,8 @@ # Class create ExternalLink -superclass BaseLink ExternalLink instproc render {} { - my instvar href label - set css_atts [my mk_css_class_and_id -additional external] - return "$label " + set css_atts [:mk_css_class_and_id -additional external] + return "[ns_quotehtml ${:label}] " } # @@ -63,33 +62,31 @@ is_self_link } Link instproc init {} { - my instvar page name - set class [self class]::[my type] - if {[my isclass $class]} {my class $class} - if {![my exists name]} { - set name [string trimleft [my lang]:[my stripped_name] :] - } elseif {![my exists stripped_name]} { + set class [self class]::[:type] + if {[:isclass $class]} {:class $class} + if {![info exists :name]} { + set :name [string trimleft [:lang]:${:stripped_name} :] + } elseif {![info exists :stripped_name]} { # set stripped name and lang from provided name or to the default - my instvar stripped_name lang - if {![regexp {^(..):(.*)$} $name _ lang stripped_name]} { - set stripped_name $name; set lang "" + if {![regexp {^(..):(.*)$} ${:name} _ lang :stripped_name]} { + set :stripped_name ${:name}; set :lang "" } } - if {![my exists label]} {my label $name} - if {![my exists parent_id]} {my parent_id [$page parent_id]} - if {![my exists package_id]} {my package_id [$page package_id]} - #my msg "--L link has class [my info class] // $class // [my type] // [my parent_id]" + if {![info exists :label]} {set :label ${:name}} + if {![info exists :parent_id]} {set :parent_id [${:page} parent_id]} + if {![info exists :package_id]} {set :package_id [${:page} package_id]} + #my msg "--L link has class [:info class] // $class // [:type] // ${:parent_id}" } Link instproc link_name {-lang -stripped_name} { return $lang:$stripped_name } Link instproc resolve {} { - return [my item_id] + return ${:item_id} } Link instproc render_target {href label} { #ns_log notice render_target - set target [my target] + set target [:target] if {[info commands ::xowiki::template::$target] ne ""} { # # The target template exists. use the template @@ -100,8 +97,8 @@ # can be referenced multiple times. The link is included for # each occurrence. # - set item_id [my item_id] - set targetId [xowiki::Includelet html_id [my item_id]-$target] + set item_id ${:item_id} + set targetId [xowiki::Includelet html_id ${:item_id}-$target] set page [::xo::db::CrClass get_instance_from_db -item_id $item_id -revision_id 0] set content "Loading ..." set withBody true @@ -128,39 +125,37 @@ return $result } else { ns_log notice "xowiki::link: unknown target $target" - return "$label" + return "$label" } } Link instproc render_found {href label} { if {$href eq ""} { return "$label" - } elseif {[my exists target] && ![my built_in_target]} { - return [my render_target $href $label] + } elseif {[info exists :target] && ![:built_in_target]} { + return [:render_target $href $label] } else { - return "$label" + return "$label" } } Link instproc render_not_found {href label} { if {$href eq ""} { return \[$label\] } else { - return " $label" + return " $label" } } Link instproc pretty_link {item_id} { - my instvar package_id - return [::$package_id pretty_link -parent_id [my parent_id] -lang [my lang] \ - -anchor [my anchor] -query [my query] [my name]] + return [::${:package_id} pretty_link -parent_id ${:parent_id} -lang [:lang] \ + -anchor [:anchor] -query [:query] [:name]] } Link instproc new_link {} { - my instvar package_id form - set page [my page] - set nls_language [$page get_nls_language_from_lang [my lang]] - if {$form ne ""} { - return [$package_id make_form_link -form $form \ - -parent_id [my parent_id] \ - -name [my name] \ + set page [:page] + set nls_language [$page get_nls_language_from_lang [:lang]] + if {${:form} ne ""} { + return [${:package_id} make_form_link -form ${:form} \ + -parent_id ${:parent_id} \ + -name [:name] \ -nls_language $nls_language] } @@ -180,24 +175,23 @@ } return [$page new_link \ {*}[expr {[info exists object_type] ? [list -object_type $object_type] : {}}] \ - -name [my name] -title [my label] -parent_id [my parent_id] \ - -nls_language $nls_language $package_id] + -name [:name] -title [:label] -parent_id ${:parent_id} \ + -nls_language $nls_language ${:package_id}] } Link instproc render {} { - my instvar package_id - set page [my page] - set item_id [my resolve] + set page [:page] + set item_id [:resolve] if {$item_id} { - $page references resolved [list $item_id [my type]] - ::xowiki::Package require $package_id - if {![my exists href]} { - my set href [my pretty_link $item_id] + $page references resolved [list $item_id [:type]] + ::xowiki::Package require ${:package_id} + if {![info exists :href]} { + set :href [:pretty_link $item_id] } - my render_found [my set href] [my label] + :render_found ${:href} [:label] } else { - set new_link [my new_link] - set html [my render_not_found $new_link [my label]] + set new_link [:new_link] + set html [:render_not_found $new_link [:label]] $page references unresolved $html return $html } @@ -211,7 +205,7 @@ set package_id [site_node::get_children -node_id $a -package_key xowiki \ -filters [list name $name] -element package_id] if {$package_id ne ""} { - #my log "--LINK found package_id=$package_id [my isobject ::$package_id]" + #my log "--LINK found package_id=$package_id [:isobject ::$package_id]" ::xowiki::Package require $package_id return $package_id } @@ -236,8 +230,8 @@ # this can be used into templates as id to safely attach event # handlers to elements set timed_id [clock microseconds] - if {$with_link} {append result [subst [my link_template]]} - if {$with_body} {append result [subst [my body_template]]} + if {$with_link} {append result [subst [:link_template]]} + if {$with_body} {append result [subst [:body_template]]} return $result } @@ -349,9 +343,8 @@ return $stripped_name } ::xowiki::Link::folder instproc pretty_link {item_id} { - my instvar package_id - return [::$package_id pretty_link \ - -anchor [my anchor] -parent_id [my parent_id] -query [my query] [my name] ] + return [::${:package_id} pretty_link \ + -anchor [:anchor] -parent_id ${:parent_id} -query [:query] ${:name} ] } # @@ -361,27 +354,27 @@ return_only } ::xowiki::Link::language instproc render {} { - set page [my page] - my instvar lang name package_id - set item_id [my resolve] + set page [:page] + set item_id [:resolve] if {$item_id} { set image_css_class "found" - set link [$package_id pretty_link -lang $lang -parent_id [my parent_id] [my stripped_name]] + set link [${:package_id} pretty_link -lang ${:lang} -parent_id ${:parent_id} [:stripped_name]] } else { set image_css_class "undefined" set last_page_id [$page set item_id] set object_type [[$page info class] set object_type] - set link [$package_id make_link $package_id \ + set name ${:name} + set link [${:package_id} make_link ${:package_id} \ edit-new object_type name last_page_id] } - # my log "--lang_link=$link" - if {[my exists return_only] && [my return_only] ne $image_css_class} { + # :log "--lang_link=$link" + if {[info exists :return_only] && [:return_only] ne $image_css_class} { set link "" } if {$link ne ""} { $page lappend lang_links($image_css_class) \ - "" + "" } return "" } @@ -398,7 +391,7 @@ border border-width position top botton left right } ::xowiki::Link::image instproc resolve_href {href} { - set l [[my page] create_link $href] + set l [[:page] create_link $href] if {[$l istype ::xowiki::ExternalLink]} { set href [$l href] } else { @@ -408,25 +401,25 @@ return $href } ::xowiki::Link::image instproc render {} { - my instvar name package_id label - set page [my page] - set item_id [my resolve] - #my log "-- image resolve for $page returned $item_id (name=$name, label=$label)" + set page [:page] + set item_id [:resolve] + #my log "-- image resolve for $page returned $item_id (name=${:name}, label=${:label})" if {$item_id} { - set link [$package_id pretty_link -download true -query [my query] \ - -absolute [$page absolute_links] -parent_id [my parent_id] $name] + set link [${:package_id} pretty_link -download true -query [:query] \ + -absolute [$page absolute_links] -parent_id ${:parent_id} ${:name}] #my log "--l fully quali [$page absolute_links], link=$link" - $page references resolved [list $item_id [my type]] - my render_found $link $label + $page references resolved [list $item_id [:type]] + :render_found $link ${:label} } else { set last_page_id [$page set item_id] set object_type ::xowiki::File - set link [$package_id make_link $package_id edit-new object_type \ - [list parent_id [my parent_id]] \ - [list title [ad_html_to_text -no_format -- $label]] \ + set name ${:name} + set link [${:package_id} make_link ${:package_id} edit-new object_type \ + [list parent_id ${:parent_id}] \ + [list title [ad_html_to_text -no_format -- ${:label}]] \ [list return_url [::xo::cc url]] \ autoname name last_page_id] - set html [my render_not_found $link $label] + set html [:render_not_found $link ${:label}] $page references unresolved $html return $html } @@ -439,23 +432,23 @@ margin margin-left margin-right margin-top margin-bottom border border-width position top botton left right } { - if {[my exists $a]} { + if {[info exists :$a]} { if {$a eq "center"} {set pre "