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.96 -r1.97 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 31 Jul 2015 07:40:31 -0000 1.96 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 7 Aug 2017 23:48:30 -0000 1.97 @@ -60,6 +60,7 @@ Class create Link -superclass BaseLink -parameter { {type link} name lang stripped_name page parent_id package_id item_id {form ""} revision_id + is_self_link } Link instproc init {} { my instvar page name @@ -97,7 +98,7 @@ # recursive inclusion is happening. The included content is # added to the html output only once, with a unique id, which # can be referenced multiple times. The link is included for - # each occurance. + # each occurrence. # set item_id [my item_id] set targetId [xowiki::Includelet html_id [my item_id]-$target] @@ -127,7 +128,7 @@ return $result } else { ns_log notice "xowiki::link: unknown target $target" - return "[ns_quotehtml $label]" + return "$label" } } @@ -137,14 +138,14 @@ } elseif {[my exists target] && ![my built_in_target]} { return [my render_target $href $label] } else { - return "[ns_quotehtml $label]" + return "$label" } } Link instproc render_not_found {href label} { if {$href eq ""} { return \[$label\] } else { - return " [ns_quotehtml $label]" + return " $label" } } Link instproc pretty_link {item_id} { @@ -162,6 +163,7 @@ -name [my name] \ -nls_language $nls_language] } + if {[$page exists __unresolved_object_type]} { # get the desired object_type for unresoved entries set object_type [$page set __unresolved_object_type] @@ -176,7 +178,9 @@ set object_type ::xowiki::Page } } - return [$page new_link -name [my name] -title [my label] -parent_id [my parent_id] \ + 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] } @@ -228,7 +232,10 @@ {-label "LABEL"} {-href ""} } { - set result "" + set result "" + # 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]]} return $result @@ -238,7 +245,7 @@ # Small bootstrap modal # ::xowiki::LinkTemplate create ::xowiki::template::modal-sm -link_template { - [ns_quotehtml $label] + $label } -body_template { - " - } + } # # glossary links @@ -553,7 +570,7 @@ set id [my lookup_xowiki_package_by_name [my type] \ [site_node::get_node_id_from_object_id -object_id [my package_id]]] #my log "--LINK glossary lookup returned package_id $id" - if {$id} { + if {$id > 0} { # set correct package id for rendering the link my set package_id $id #my log "-- INITIALIZE $id" @@ -569,8 +586,11 @@ ::xo::Page requireJS "/resources/xowiki/get-http-object.js" ::xo::Page requireJS "/resources/xowiki/popup-handler.js" ::xo::Page requireJS "/resources/xowiki/overlib/overlib.js" - return "[ns_quotehtml $label]" + if {![my exists cssid]} {my cssid [::xowiki::Includelet html_id [self]]} + template::add_event_listener \ + -id [my cssid] \ + -script [subst {showInfo('[ns_quotehtml $href?master=0]','[ns_quotehtml $label]')}] + return "$label" } #