My Favorites#

I liked the idea of having an personal extension of the LeftMenu. It would allow you to personalise the wiki, so you can easily jump to the pages of your interest. ( see IdeaPersonalLeftMenu )

So here is my quick fix of the default wiki template. --DF

Use #

A user has created a page with his personal favorites called <username>Favorites.

When the user is known (e.g. has set it's name via UserPreferences) and his personal favorites page exists, then the personal page is inserted at the top of the leftmenu.

Implementation#

Cut-n-paste this stuff into LeftMenu.jsp which you can find in the ./templates/default folder.

As you can see, I had to revert to some java-jsp-spaghetti due to some limitations of the JSPWikiTags. Probably there is a more elegant way to do this, plse let me know.

<!-- insert this line at the top of the LeftMenu.jsp -->
<%@ page import="com.ecyrd.jspwiki.*" %> 

... 

<!-- insert this block just after the logo block, before the insert LeftMenu -->
<wiki:UserCheck status="known">
  <% 
    WikiContext c = (WikiContext) pageContext.getAttribute( "jspwiki.context",
                                                         PageContext.REQUEST_SCOPE ); 
    String username = null;
    try { 
          username = c.getEngine().getVariableManager().getValue(c, "username" );
        } catch( Exception  e )  { /* dont care */ }
    if( username == null ) username = "";
    String myFav = username + "Favorites";
  %>
  <wiki:PageExists page="<%= myFav %>">
    <wiki:InsertPage page="<%= myFav %>"/>
  </wiki:PageExists>
</wiki:UserCheck>

Back to BrushedTemplate


it's a good template

--carolword, 26-May-2007

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 26-May-2007 12:56 by carolword