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.45 -r1.46
--- openacs-4/packages/xowiki/tcl/link-procs.tcl 2 Jun 2008 12:28:13 -0000 1.45
+++ openacs-4/packages/xowiki/tcl/link-procs.tcl 20 Jul 2008 18:18:24 -0000 1.46
@@ -7,26 +7,40 @@
}
namespace eval ::xowiki {
-
#
# generic links
#
- Class create ExternalLink -parameter {
- href label title target
+ Class create BaseLink -parameter {
+ cssclass href label title target
}
+
+ BaseLink instproc mk_css_class {-additional {-default ""}} {
+ set cls [expr {[my exists cssclass] ? [my cssclass] : $default}]
+ if {[info exists additional]} {
+ if {$cls eq ""} {set cls $additional} else {append cls " " $additional}
+ }
+ if {$cls ne ""} {set cls "class='$cls'"}
+ return $cls
+ }
+
+ #
+ # external links
+ #
+ Class create ExternalLink -superclass BaseLink
ExternalLink instproc render {} {
my instvar href label title target
set title_att ""
if {[info exists title]} {append title_att " title='$title'"}
if {[info exists target]} {append title_att " target='$target'"}
- return "$label"
+ return "$label"
}
- Class create Link -parameter {
- type name lang stripped_name label page
+ #
+ # internal links
+ #
+ Class create Link -superclass BaseLink -parameter {
+ type name lang stripped_name page
folder_id package_id
- title target
- href
}
Link instproc atts {} {
set atts ""
@@ -58,13 +72,14 @@
return [::xo::db::CrClass lookup -name $name -parent_id [my folder_id]]
}
Link instproc render_found {href label} {
- return "$label"
+ return "$label"
}
Link instproc render_not_found {href label} {
if {$href eq ""} {
return \[$label\]
} else {
- return " \[ $label \] "
+ return " \[ $label\
+ \] "
}
}
Link instproc render {} {
@@ -134,22 +149,22 @@
my instvar lang name package_id
set item_id [my resolve]
if {$item_id} {
- set css_class "found"
+ set image_css_class "found"
set link [$package_id pretty_link -lang $lang [my stripped_name]]
} else {
- set css_class "undefined"
+ 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 \
edit-new object_type name last_page_id]
}
# my log "--lang_link=$link"
- if {[my exists return_only] && [my return_only] ne $css_class} {
+ if {[my exists return_only] && [my return_only] ne $image_css_class} {
set link ""
}
if {$link ne ""} {
- $page lappend lang_links($css_class) \
- ""
}
return ""
@@ -161,7 +176,7 @@
Class create ::xowiki::Link::image -superclass ::xowiki::Link \
-parameter {
- href cssclass
+ href
center float width height
padding padding-right padding-left padding-top padding-bottom
margin margin-left margin-right margin-top margin-bottom
@@ -206,14 +221,14 @@
}
if {$style ne ""} {set style "style='$style'"}
set label [string map [list ' "'"] $label]
- set cls [expr {[my exists cssclass] ? [my cssclass] : "xowikiimage"}]
+ set cls [my mk_css_class -default image]
if {[my exists href]} {
set href [my set href]
if {[string match "java*" $href]} {set href .}
- return ""
+ set css_class
+ return "$pre$post"
} else {
-
- return "$pre$post"
+ return "$pre$post"
}
}
@@ -253,8 +268,7 @@
}
}
if {![info exists embed_options]} {
- return "$label"
+ return "$label"
} else {
set internal_href [string map [list %2e .] $internal_href]
return ""
@@ -438,8 +452,7 @@
::xo::Page requireJS "/resources/xowiki/popup-handler.js"
::xo::Page requireJS "/resources/xowiki/overlib/overlib.js"
return "$label"
+ [my mk_css_class -additional glossary]>$label"
}
#