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.90.2.2 -r1.90.2.3 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 13 Mar 2014 13:00:01 -0000 1.90.2.2 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 10 Nov 2014 19:48:28 -0000 1.90.2.3 @@ -80,7 +80,11 @@ return [my item_id] } Link instproc render_found {href label} { - return "$label" + if {$href eq ""} { + return $label + } else { + return "$label" + } } Link instproc render_not_found {href label} { if {$href eq ""} { @@ -129,7 +133,10 @@ if {$item_id} { $page lappend references [list $item_id [my type]] ::xowiki::Package require $package_id - my render_found [my pretty_link $item_id] [my label] + if {![my exists href]} { + my set href [my pretty_link $item_id] + } + my render_found [my set href] [my label] } else { $page incr unresolved_references set new_link [my new_link] Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.472.2.23 -r1.472.2.24 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 10 Nov 2014 18:50:01 -0000 1.472.2.23 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 10 Nov 2014 19:48:28 -0000 1.472.2.24 @@ -1198,6 +1198,25 @@ return 1 } + Page instproc can_link {item_id} { + # + # This is a stub which can / should be refined in applications, + # which want to disallow links to other pages, in the sense, that + # the links are not shown at all. A sample implementation might + # look like the follwing. + # + # if {$item_id ne 0} { + # set obj [::xo::db::CrClass get_instance_from_db -item_id $item_id] + # return [$obj can_be_linked] + # } + # + return 1 + } + + Page instproc can_be_linked {} { + return 1 + } + Page instproc can_save {} { # # Determine the parent object of the page to be saved. If the @@ -1669,14 +1688,19 @@ if {$label eq $arg} {set label $(link)} set item_name [string trimleft $(prefix):$(stripped_name) :] - + Link create [self]::link \ -page [self] -form $(form) \ -type $(link_type) [list -name $item_name] -lang $(prefix) \ [list -anchor $(anchor)] [list -query $(query)] \ [list -stripped_name $(stripped_name)] [list -label $label] \ -parent_id $(parent_id) -item_id $(item_id) -package_id $package_id - + + # in case, we can't link, flush the href + if {[my can_link $(item_id)] == 0} { + [self]::link href "" + } + if {[catch {[self]::link configure {*}$options} errorMsg]} { ns_log error "$errorMsg\n$::errorInfo" return "
Error during processing of options [list $options] of link of type [[self]::link info class]:
$errorMsg
"