Display Available Icons Snippet

Display Available Icons Snippet

Warning: This snippet will work only on wikis installed on a UNIX system.

Code

{{groovy}}
xcontext.put("iconlist", new HashMap<String,List>())
"ls webapps/xwiki/resources/icons/".execute().text.eachLine() { dir ->
  xcontext.get("iconlist").put(dir, "ls webapps/xwiki/resources/icons/${dir}".execute().text.split("\n") as List)
}
{{/groovy}}
{{velocity}}{{html wiki=true}}
#foreach($dir in $context.get("iconlist").keySet())
== $dir ==
  #foreach($icon in $context.get("iconlist").get($dir))
    #set($path = "icons/$dir/$icon")
    <img src="$xwiki.getSkinFile($path)" title='$icon' />
  #end
#end
{{/html}}{{/velocity}}

Result

iconlist.png

Tags:
Created by Jerome Velociter on 2009/10/19 11:43
Last modified by Jerome Velociter on 2009/10/19 12:04

This wiki is licensed under a Creative Commons license
2.2.1.27354