template::CSS proc icon_name (public)

 template::CSS[i] icon_name filename

Defined in packages/xotcl-core/tcl/01-debug-procs.tcl

Return an icon name for the proved filename Default icon name

Parameters:
filename (required)

Testcases:
No testcase defined.
Source code:
#
# Return an icon name for the proved filename
#
# Default icon name
set iconName file
if {${:iconset} eq "bootstrap-icons"} {
    switch [ad_file extension $filename] {
        .doc  -
        .docx -
        .odt  -
        .txt  {set iconName "file-earmark-text"}

        .csv  -
        .ods  -
        .xls  -
        .xlsx {set iconName "file-earmark-spreadsheet"}

        .odp  -
        .ppt  -
        .pptx {set iconName "file-earmark-spreadsheet"}

        .pdf  {set iconName "file-earmark-pdf"}

        .c    -
        .h    -
        .tcl {set iconName "file-earmark-code"}

        .css  -
        .html -
        .java -
        .js   -
        .json -
        .py   -
        .sql {set iconName "filetype-[string range [ad_file extension $filename] 1 end]"}

        default {
            switch -glob [ns_guesstype $filename] {
                image/* {set iconName "file-earmark-image"}
                video/* {set iconName "file-earmark-play"}
                audio/* {set iconName "file-earmark-slides"}
                default {
                    ns_log notice "not handled '[ad_file extension $filename] / [ns_guesstype $filename] of <$filename>"
                }
            }
        }
    }
}
return $iconName
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: