You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by "Hu, Yiguang" <Yi...@stercomm.com> on 2006/05/26 16:50:12 UTC

navigation control

I am still having a question about the navigation control. What I need
is to get an extra parameter for menu besides the title for styling
purpose.

I am trying two approaches. One is using logic within velocity using
if...else... on the title. For example, if title is "RootTitle", I
hardcode the need parameter (style). This works but not so elegant.

I am also trying to use the metadata as shown below ("xx"="racine"). The
problem is I only get the metadata for root menu with
title("RootTitle").

The velocity rightly returned me the title for the sub folder simplest,
but not the metadata ("xx") there.

Any suggestions?

Thanks

Yiguang

The menu def in folder.metadata in pages

  <menu name="left-column" options="/" depth="0" paths="false"
regexp="false" skin="rotskin">

         <title>RootTitle</title>

         <metadata name="xx">racine</metadata>

         <options depth="-1" paths="false" regexp="true"
skin="pagena">/*.psml</options>

         <options depth="-1" paths="false" regexp="false"
skin="non-javana">/non-java/</options>

         <options depth="-1" paths="false" regexp="false"
skin="simplestna">/simplest/</options>

         <options depth="-1" paths="false" regexp="false"
skin="chatna">/chat/</options>

     </menu>

 

The folder.metadata in pages/simplest

<?xml version="1.0" encoding="UTF-8"?>

<folder>

  <title>Simplest Portlets</title>

  <metadata name="xx">xxxxx</metadata>

 

  <security-constraints>

    <security-constraints-ref>users</security-constraints-ref>

  </security-constraints>

</folder>


RE: navigation control

Posted by "Hu, Yiguang" <Yi...@stercomm.com>.
#set($navigationsStandardMenu = $site.getMenu("left-column"))
#if(!$navigationsStandardMenu.empty)^M
   <td>
     #displayNestedColumnNavigation($navigationsStandardMenu $TOP_TO_BOTTOM "0")
   </td>
-------- displayNestedColumnNavigation as shown below (minor modification from the original scripts that Jacek shared)
 If I  can get the metadata of <metadata name="xx">xxxxx</metadata>, I can remove the chunk of if....else... to get the $icon

#macro (displayNestedColumnNavigation $_menu $_orientation $level)
        #set($menuTitle = $_menu.getTitle($preferedLocale))
        #set($meta= $_menu.getMetadata().getFields().toArray())
        #set($skin=$meta.length())
        #foreach($kin in $meta )
        #set($skin=$kin.getValue())   
#*this didn't w ork for the subfolder *#
        #end
        #set($skin=$_menu.getTitle())
        #set($menuName = $_menu.getShortTitle($preferedLocale))
        #set($icon="navIconPreference")
        #if($menuTitle=="RootTitle")
        #set($icon="navIconHome")
        #elseif($menuTitle=="Simplest Portlets")
        #set($icon="navIconsimplest")
        #elseif($menuTitle=="non java portlests")
        #set($icon="navIconnonjava")
        #elseif($menuTitle=="chat portlet")
        #set($icon="navIconchat")
        #else
        #set($icon="navIconHome")
        #end
        #set($inPath = $_menu.isSelected($site))
                        <div class="navElementVertical">
                                <div class="navElementLink">
                                        <table width="100%" class="navElementSeparator">
                                                <tr>
                                                        <td class="$icon">&nbsp;</td>
                                                        <td class="navLabel"><a href="$jetspeed.getAbsoluteUrl($_menu.getUrl())">$skin</a></td>
                                                </tr>
                                        </table>
                                </div>
                        </div>
        #if($inPath)

                #foreach($element in $_menu.elements.iterator())
                                #set($selected = $element.isSelected($site))
                                #set($boldEnd = "")
                                #set($boldStart = "")
                                #if($selected)
                                        #set($boldStart = "")
                                        #set($boldEnd = "")
                                        #*set($boldStart = "<b>")*#
                                        #*set($boldEnd = "</b>")*#
                                #end
                        #if($element.elementType == "option")
                                #set($linkTitle = $element.getTitle($preferedLocale))
                                #set($linkName = $element.getShortTitle($preferedLocale))
                                #set($linkUrl = $jetspeed.getAbsoluteUrl($element.url))
                                #set($extra="")
                                #if($element.type == "page")
                                <div class="navLinkVertical">
                                                <a href="$linkUrl" title="$!linkTitle">$extra$linkName</a>
                                </div>
                                #elseif($element.type == "link")
                                        #set($linkTarget = $element.target)
                                         <li class="link">$boldStart<a href="$linkUrl" target="$linkTarget" title="$!linkTitle">$linkName</a>$boldEnd
                                #elseif($element.type == "folder")
                                         <li><a href="$linkUrl" title="$!linkTitle" class="folder">y$linkName</a>
                                #end
                        #elseif($element.elementType == "menu")
                                #displayNestedColumnNavigation($element $_orientation "1")
                        #elseif($element.elementType == "separator")
                                #set($separatorTitle = $element.getTitle($preferedLocale))
                                #set($separatorText = $element.getText($preferedLocale))
                                #*<li class="folder_open">${separatorText}*#
                        #end
                #end
        #end
#end

 

________________________________

From: Randy Watler [mailto:watler@wispertel.net]
Sent: Fri 5/26/2006 9:46 PM
To: Jetspeed Users List
Subject: Re: navigation control



Yiguang,

What does your velocity code look like that is accessing the metadata?
You need to be asking the menu for its metadata, not the page. Please
copy it here so that we can take a look at it.

Thanks,

Randy

On Fri, 2006-05-26 at 10:50 -0400, Hu, Yiguang wrote:
> I am still having a question about the navigation control. What I need
> is to get an extra parameter for menu besides the title for styling
> purpose.
>
> I am trying two approaches. One is using logic within velocity using
> if...else... on the title. For example, if title is "RootTitle", I
> hardcode the need parameter (style). This works but not so elegant.
>
> I am also trying to use the metadata as shown below ("xx"="racine"). The
> problem is I only get the metadata for root menu with
> title("RootTitle").
>
> The velocity rightly returned me the title for the sub folder simplest,
> but not the metadata ("xx") there.
>
> Any suggestions?
>
> Thanks
>
> Yiguang
>
> The menu def in folder.metadata in pages
>
>   <menu name="left-column" options="/" depth="0" paths="false"
> regexp="false" skin="rotskin">
>
>          <title>RootTitle</title>
>
>          <metadata name="xx">racine</metadata>
>
>          <options depth="-1" paths="false" regexp="true"
> skin="pagena">/*.psml</options>
>
>          <options depth="-1" paths="false" regexp="false"
> skin="non-javana">/non-java/</options>
>
>          <options depth="-1" paths="false" regexp="false"
> skin="simplestna">/simplest/</options>
>
>          <options depth="-1" paths="false" regexp="false"
> skin="chatna">/chat/</options>
>
>      </menu>
>
> 
>
> The folder.metadata in pages/simplest
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <folder>
>
>   <title>Simplest Portlets</title>
>
>   <metadata name="xx">xxxxx</metadata>
>
> 
>
>   <security-constraints>
>
>     <security-constraints-ref>users</security-constraints-ref>
>
>   </security-constraints>
>
> </folder>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org




Re: navigation control

Posted by Randy Watler <wa...@wispertel.net>.
Yiguang,

What does your velocity code look like that is accessing the metadata?
You need to be asking the menu for its metadata, not the page. Please
copy it here so that we can take a look at it.

Thanks,

Randy

On Fri, 2006-05-26 at 10:50 -0400, Hu, Yiguang wrote:
> I am still having a question about the navigation control. What I need
> is to get an extra parameter for menu besides the title for styling
> purpose.
> 
> I am trying two approaches. One is using logic within velocity using
> if...else... on the title. For example, if title is "RootTitle", I
> hardcode the need parameter (style). This works but not so elegant.
> 
> I am also trying to use the metadata as shown below ("xx"="racine"). The
> problem is I only get the metadata for root menu with
> title("RootTitle").
> 
> The velocity rightly returned me the title for the sub folder simplest,
> but not the metadata ("xx") there.
> 
> Any suggestions?
> 
> Thanks
> 
> Yiguang
> 
> The menu def in folder.metadata in pages
> 
>   <menu name="left-column" options="/" depth="0" paths="false"
> regexp="false" skin="rotskin">
> 
>          <title>RootTitle</title>
> 
>          <metadata name="xx">racine</metadata>
> 
>          <options depth="-1" paths="false" regexp="true"
> skin="pagena">/*.psml</options>
> 
>          <options depth="-1" paths="false" regexp="false"
> skin="non-javana">/non-java/</options>
> 
>          <options depth="-1" paths="false" regexp="false"
> skin="simplestna">/simplest/</options>
> 
>          <options depth="-1" paths="false" regexp="false"
> skin="chatna">/chat/</options>
> 
>      </menu>
> 
>  
> 
> The folder.metadata in pages/simplest
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <folder>
> 
>   <title>Simplest Portlets</title>
> 
>   <metadata name="xx">xxxxx</metadata>
> 
>  
> 
>   <security-constraints>
> 
>     <security-constraints-ref>users</security-constraints-ref>
> 
>   </security-constraints>
> 
> </folder>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org