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 Javier padrĂ³n <jp...@nartexsoft.com> on 2007/03/07 14:00:43 UTC

Header.vm, customize menu, ask for security-constraints ??

In decoration/layout/layoutName/header.vm', have next code to generate standar menu, in this case iterate over all standar pages and filter by 'isHidden' to show only public pages

// ----- header.vm ----
<ul>Pages Menu
#foreach($element in $pagesStandardMenu.elements.iterator())
            #if ($element.isHidden()== false)
                    #set($tabTitle = $element.getTitle($preferedLocale))
                    #set($tabName = $element.getShortTitle($preferedLocale))
                      #if($element.isSelected($site))
                        <li title="$!tabTitle"><b>${tabName}</b></li>
                      #else
                        #set($tabUrl = $jetspeed.getAbsoluteUrl($element.url))
                                    <li title="$!tabTitle"><a href="$tabUrl">${tabName}</a></li>
                      #end
                #end
            #end
#end
</ul>


Good, now I'have others pages with

    <security-constraints>
        <security-constraints-ref>private-view</security-constraints-ref>
    </security-constraints>

...these pages do not have to appear in the menu when the user has not initiated session, and yes when the user has validated itself, this works very well, they are taught and they hidden when they must.

The problem is that I want to show of special form the privated pages, now is thus:

// --- User NO loged ---
<ul>Pages Menu
            <li>public page 1</li>
            <li>public page 2</li>
            <li>public page 3</li>
            ...
</ul>

// --- User Loged OK ---
<ul>Pages Menu
            <li>public page 1</li>
            <li>public page 2</li>
            <li>public page 3</li>
            ...
            <li>private page 1</li>
            <li>private page 2</li>
            ...
</ul>

// -- Finally, I want that one is thus! ---
<ul>Public Pages Menu
            <li>public page 1</li>
            <li>public page 2</li>
            <li>public page 3</li>
            ...
</ul>
<ul>Private Pages Menu
            <li>private page 1</li>
            <li>private page 2</li>
            ...
</ul>

Then, my question is how I can do this in the file header.vm? While iterate the pages I can ask '#if ($element.< whichMethodName>)' in order to know if a page private or no? How?

Thanks!