David,
Sorry for the delay in getting back to you, I have been on the road over the
last few days.
Here are the steps I used to try this out working against the Jetspeed 2.2
release:
1. add some metadata entries in a few folder.metadata, *.page, or *.link files
in the pages directory:
<metadata name="icon" xml:lang="en">en-admin-folder.ico</metadata>
<metadata name="icon" xml:lang="fr">fr-admin-folder.ico</metadata>
2. define a macro in the layout-specific decorator-macros.vm file that uses the
metadata defined above:
#* insert element icon *#
#macro (insertIconForMenuElement $_element)
#foreach($metadataField in
$_element.getMetadata().getFields("icon").iterator())
#if("$preferedLocale" == "$metadataField.getLocale()")
#set($icon = $metadataField.getValue())
#elseif("$preferedLocale.getLanguage()" ==
"$metadataField.getLocale().getLanguage()")
#set($langIcon = $metadataField.getValue())
#elseif("$metadataField.getLocale()" == "en")
#set($defaultIcon = $metadataField.getValue())
#end
#end
#if((!$icon) && ($langIcon))
#set($icon = $langIcon)
#end
#if((!$icon) && ($defaultIcon))
#set($icon = $defaultIcon)
#end
#if($icon)
<img src="#GetPageResource('images/$icon')" border="0"/>
#end
#end
3. extend the existing standard layout macros to invoke the macro in the
appropriate places to insert the icon image tag:
...
#if($element.type == "page")
#insertIconForMenuElement($element)<a href="$linkUrl"
class="LinkPage" title="$!linkTitle">${linkName}</a>
#elseif($element.type == "link")
#insertIconForMenuElement($element)<a href="$linkUrl" class="Link"
title="$!linkTitle">${linkName}</a>
#elseif($element.type == "folder")
#insertIconForMenuElement($element)<a href="$linkUrl"
class="LinkFolder" title="$!linkTitle">${linkName}</a>
#else
#insertIconForMenuElement($element)<a href="$linkUrl"
title="$!linkTitle">${linkName}</a>
#end
...
I made these and similar modifications to the following jetspeed source files:
applications/jetspeed/src/main/webapp/WEB-INF/pages/Administrative/folder.metadata
applications/jetspeed/src/main/webapp/WEB-INF/pages/folder.metadata
applications/jetspeed/src/main/webapp/WEB-INF/pages/Public/folder.metadata
applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/decorator-macros.vm
These same files exist in a deployed "demo" jetspeed instance here:
${CATALINA_HOME}/webapps/jetspeed/WEB-INF/pages/...
${CATALINA_HOME}/webapps/jetspeed/decorations/layout/jetspeed/decorator-macros.vm
Obviously, you will want to do this against you own decorators instead of
hacking up the jetspeed decorator, but you get the idea.
HTH,
Randy
--- [email protected] wrote:
From: "David Just" <[email protected]>
To: "Jetspeed Users List" <[email protected]>
Subject: RE: Specifying an icon for a folder
Date: Wed, 3 Jun 2009 07:43:27 -0500
An example of what the metadata for an icon would look like would be
much appreciated. Along with a chunk of example code that shows how to
access that data in a VM macro.
David Just l Software Engineer l Vision Solutions l +1 (507) 529-5939 l
[email protected]
The contents of this e-mail (and any attachments) are privileged and
confidential. Unauthorized use is strictly prohibited.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, June 02, 2009 5:42 PM
To: Jetspeed Users List
Subject: Re: Specifying an icon for a folder
David,
One way to accomplish this is to add the icon URLs in the folder/page
metadata. Titles, for instance, use this metadata approach. The nice
thing about it is that one can have a default and language specific
versions of your icons as well.
Once you have that in place, you will have to tweak the decorator code
that renders the menus.
If you need examples and or detailed instructions, feel free to reply on
this thread.
Randy
--- [email protected] wrote:
From: "David Just" <[email protected]>
To: "Jetspeed Users List" <[email protected]>
Subject: Specifying an icon for a folder
Date: Tue, 2 Jun 2009 15:52:04 -0500
Is it possible to specify extra meta data such as an icon for a folder
in PSML? I would like to put unique icons next to each folder in my
portal.
David Just l Software Engineer l Vision Solutions l +1 (507) 529-5939 l
[email protected]
The contents of this e-mail (and any attachments) are privileged and
confidential. Unauthorized use is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]