Index: openacs-4/packages/acs-templating/tcl/style-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/style-procs.tcl,v
diff -u -r1.1.2.2 -r1.1.2.3
--- openacs-4/packages/acs-templating/tcl/style-procs.tcl 11 Apr 2022 13:19:09 -0000 1.1.2.2
+++ openacs-4/packages/acs-templating/tcl/style-procs.tcl 18 Apr 2022 08:56:05 -0000 1.1.2.3
@@ -32,13 +32,16 @@
Return the configured or derived icon set. Potential results are
"classic" (old-style gif/png images), "glyphicons" (Part of
- Bootstrap 3), and "bootstrap-icons" (usable for all themes).
+ Bootstrap 3), "fa-icons" (usable for all themes), and
+ "bootstrap-icons" (usable for all themes).
} {
if { ![info exists subsite_id] } {
set subsite_id [ad_conn subsite_id]
}
- set iconset [parameter::get -parameter IconSet -package_id $subsite_id]
+ set default ""
+ # set default "fa-icons" ;# just for testing
+ set iconset [parameter::get -parameter IconSet -package_id $subsite_id -default $default]
if {$iconset eq ""} {
#
@@ -55,6 +58,11 @@
# Bootstrap icons work with all toolkits
#
set iconset "bootstrap-icons"
+ } elseif {[apm_package_enabled_p "fa-icons"]} {
+ #
+ # Awesome icons work with all toolkits
+ #
+ set iconset "fa-icons"
} else {
set iconset "classic"
}
@@ -65,22 +73,37 @@
ad_proc -private ::template::icon {
-name:required
+ {-alt ""}
+ {-class ""}
+ {-iconset ""}
+ {-style ""}
{-title ""}
- -style
- -class
} {
Return a dict containing the HTML rendering and a potentially
needed command for the ADP code. The latter are necessary for
e.g. style loading.
+ The target icon can be (1) a font glyph, (2) an image or (3) just
+ a text. Method (1) is used for glyphicons and boostrap icons,
+ which is signaled by a value in the icon::map starting with a
+ plain character. When the value starts with a slash "/", then an
+ image will be used. When the name has no graphical counterpart
+ (variant 3), this is signaled via an empty string. In this case,
+ the resulting replacement will be the value of "alt" in text form.
+
The configuration of this method is performed via the Tcl dict
::template::icon::map, which is set in tag-init.tcl
+ @param alt used im classic images. When not specified, use 'title' attribute
+ @param iconset force isage of this icon set
+ @return dict containing 'HTML' and 'cmd'
} {
- set styleAtt [expr {[info exists style] ? "style='$style'" : ""}]
- set class [expr {[info exists class] ? " $class" : ""}]
- set iconset [::template::iconset]
+ set styleAtt [expr {$style ne "" ? "style='$style'" : ""}]
+ if {$iconset eq ""} {
+ set iconset [::template::iconset]
+ }
+
if {[dict exists $::template::icon::map $iconset $name]} {
set name [dict get $::template::icon::map $iconset $name]
}
@@ -98,11 +121,17 @@
set cmd {template::head::add_css -href urn:ad:css:bootstrap-icons}
set template {}
}
+ "fa-icons" {
+ set cmd {template::head::add_css -href urn:ad:css:fa-icons}
+ set template {}
+ }
"text" {
- set template {$title}
+ set alt [expr {[info exists alt] ? $alt : $title}]
+ set template {$alt}
}
default {
- set template {}
+ set alt [expr {[info exists alt] ? $alt : $title}]
+ set template {}
}
}
return [list HTML [subst -nocommands $template] cmd $cmd]