You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/09/17 20:05:25 UTC

cvs commit: jakarta-jetspeed-2/portal/src/webapp/WEB-INF jetspeed_macros.vm velocity.properties

weaver      2004/09/17 11:05:25

  Modified:    portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed
                        decorator-top.vm
               portal/src/java/org/apache/jetspeed/velocity
                        JetspeedPowerTool.java
               portal/src/webapp/WEB-INF velocity.properties
  Added:       portal/src/webapp/WEB-INF/templates/navigation/html/folders
                        LeftToRight.vm navigation.properties
               portal/src/webapp/WEB-INF/templates/navigation/html/tabs
                        LeftToRight.vm navigation.properties
               portal/src/webapp/WEB-INF/templates/navigation/html/linksWithIcon1
                        TopToBottom.vm LeftToRight.vm navigation.properties
               portal/src/webapp/WEB-INF jetspeed_macros.vm
  Log:
  - Moved all navigation to individual templates.
  - Added a navigation template type.
  - Added custom jetspeed_macros.vm Velocimacros file.
  - Added ability for navigations to define up to 4 different orientations.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/folders/LeftToRight.vm
  
  Index: LeftToRight.vm
  ===================================================================
  <div class="FolderList">
    #foreach($childFolder in $_nodeSet.iterator())
    <span><a href="$jetspeed.getAbsoluteUrl($childFolder.url)" class="FolderLink">$childFolder.metaData.getTitle($preferedLocale)</a></span>		
    #end
  </div>
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/folders/navigation.properties
  
  Index: navigation.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  # 
  #     http://www.apache.org/licenses/LICENSE-2.0
  # 
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  id=folders
  template.type=velocity
  template.extension=.vm
  
  
  
  1.16      +8 -33     jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm
  
  Index: decorator-top.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/decorations/layout/html/jetspeed/decorator-top.vm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- decorator-top.vm	10 Sep 2004 21:39:36 -0000	1.15
  +++ decorator-top.vm	17 Sep 2004 18:05:25 -0000	1.16
  @@ -14,6 +14,9 @@
   limitations under the License.
   *#
   
  +#* Add all template constants to the current context *#
  +#defineConstants()
  +
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   #set($preferedLocale = $JS2RequestContext.locale)
   <html>
  @@ -46,32 +49,11 @@
   	 </p>
   	#end
   	
  -	<div class="FolderList">
  -	 #foreach($childFolder in $folder.folders.iterator())
  -	  <span><a href="$jetspeed.getAbsoluteUrl($childFolder.url)" class="FolderLink">$childFolder.metaData.getTitle($preferedLocale)</a></span>		
  -	 #end
  -	</div>
  -
  +  #includeNavigation("folders" $folder.folders $LEFT_TO_RIGHT)
   </p>
  -
  -    <p>
  -        <table border="0" cellpadding="0" cellspacing="0" width="100%">
  -            <tr>
  -                #foreach($childPage in $folder.pages.iterator())
  -                #set($tabName = $childPage.getTitle($preferedLocale))
  -                #if($jetspeed.page == $childPage)
  -                <td class="LTabLeft" style="font-size:1pt;" nowrap="true">&nbsp;</td>
  -                <td class="LTab" align="center" valign="middle" nowrap="true">${tabName}</td>
  -                <td class="LTabRight" style="font-size:1pt;" nowrap="true">&nbsp;</td>
  -                #else
  -                <td class="LTabLeftLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
  -                <td class="LTabLow" align="center" valign="middle" nowrap="true"><a href="$jetspeed.getAbsoluteUrl($childPage.path)">${tabName}</a></td>
  -                <td class="LTabRightLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
  -                #end
  -                #end
  -            </tr>
  -        </table>
  -    </p>
  +  <p>
  +  #includeNavigation("tabs" $folder.pages $LEFT_TO_RIGHT)
  +  </p>
   </p>
   	
   <table cellpadding="0" cellspacing="0" border="0" width="100%">
  @@ -82,14 +64,7 @@
        #set($rootFolder = $pageManager.getFolder("/"))
        #set($links = $rootFolder.links)
   	 Additional Links:
  -	
  -     <div id="rootLinks">
  -     #foreach($link in $links.iterator()) 
  -	 <p>
  -      <a href="$link.url" target="$link.target" class="Link">$link.getTitle($preferedLocale)</a>	
  -	 </p> 
  -	 #end
  -	 </div>
  +	 #includeNavigation("linksWithIcon1" $links $TOP_TO_BOTTOM)
   	</td>
   	<td width="99%" nowrap valign="top">
     
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/tabs/LeftToRight.vm
  
  Index: LeftToRight.vm
  ===================================================================
  
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
          #foreach($childPage in $_nodeSet.iterator())
          #set($tabName = $childPage.getTitle($preferedLocale))
          #if($jetspeed.page == $childPage)
          <td class="LTabLeft" style="font-size:1pt;" nowrap="true">&nbsp;</td>
          <td class="LTab" align="center" valign="middle" nowrap="true">${tabName}</td>
          <td class="LTabRight" style="font-size:1pt;" nowrap="true">&nbsp;</td>
          #else
          <td class="LTabLeftLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
          <td class="LTabLow" align="center" valign="middle" nowrap="true"><a href="$jetspeed.getAbsoluteUrl($childPage.path)">${tabName}</a></td>
          <td class="LTabRightLow" style="font-size:1pt;" nowrap="true">&nbsp;</td>
          #end
          #end
    </tr>
  </table>
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/tabs/navigation.properties
  
  Index: navigation.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  # 
  #     http://www.apache.org/licenses/LICENSE-2.0
  # 
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  id=tabs
  template.type=velocity
  template.extension=.vm
  
  
  
  1.26      +41 -2     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java
  
  Index: JetspeedPowerTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- JetspeedPowerTool.java	9 Sep 2004 20:46:04 -0000	1.25
  +++ JetspeedPowerTool.java	17 Sep 2004 18:05:25 -0000	1.26
  @@ -484,6 +484,26 @@
           return getTemplate(path, templateType, templateLocator, templateLocatorDescriptor);
       }
       
  +    public Configuration getTypeConfiguration(String type, String name) throws Exception
  +    {
  +        try
  +        {
  +            TemplateDescriptor locator = getTemplate(name+"/"+type+".properties", type);
  +            return new PropertiesConfiguration(locator.getAbsolutePath());
  +        }
  +        catch (TemplateLocatorException e)
  +        {
  +            log.warn(e.toString(), e);
  +            return null;
  +        }
  +        catch (IOException e)
  +        {
  +
  +            log.warn(e.toString(), e);
  +            return null;
  +        }
  +    }
  +    
       public TemplateDescriptor getDecoration(String path, String templateType) throws TemplateLocatorException
       {
           checkState();
  @@ -544,13 +564,32 @@
       	try
           {
   			flush();
  -            PortletRequestDispatcher pDispatcher = portletConfig.getPortletContext().getRequestDispatcher(getTemplate(template, templateType).getAppRelativePath());
  +            TemplateDescriptor useLocator = getTemplate(template, templateType);
  +            PortletRequestDispatcher pDispatcher = portletConfig.getPortletContext().getRequestDispatcher(useLocator.getAppRelativePath());
               pDispatcher.include(renderRequest, renderResponse);
           }
           catch (Exception e)
           {            
               PrintWriter directError = new PrintWriter(renderResponse.getWriter());
   			directError.write("Error occured process includeTemplate(): "+e.toString()+"\n\n");
  +            e.printStackTrace(directError);
  +            directError.close();            
  +        }    	
  +    }
  +    
  +    public void  includeDecoration(String template, String templateType) throws IOException
  +    {
  +    	checkState();    	
  +    	try
  +        {
  +			flush();
  +            PortletRequestDispatcher pDispatcher = portletConfig.getPortletContext().getRequestDispatcher(getDecoration(template, templateType).getAppRelativePath());
  +            pDispatcher.include(renderRequest, renderResponse);
  +        }
  +        catch (Exception e)
  +        {            
  +            PrintWriter directError = new PrintWriter(renderResponse.getWriter());
  +			directError.write("Error occured process includeDecoration(): "+e.toString()+"\n\n");
               e.printStackTrace(directError);
               directError.close();            
           }    	
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/linksWithIcon1/TopToBottom.vm
  
  Index: TopToBottom.vm
  ===================================================================
  <div >
    #foreach($link in $_nodeSet.iterator()) 
    <p>
      <a href="$link.url" target="$link.target" class="Link">$link.getTitle($preferedLocale)</a>	
    </p> 
    #end
  </div>
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/linksWithIcon1/LeftToRight.vm
  
  Index: LeftToRight.vm
  ===================================================================
  <div >
    #foreach($link in $_nodeSet.iterator()) 
       <a href="$link.url" target="$link.target" class="Link">$link.getTitle($preferedLocale)</a>	
     #end
  </div>
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/templates/navigation/html/linksWithIcon1/navigation.properties
  
  Index: navigation.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  # 
  #     http://www.apache.org/licenses/LICENSE-2.0
  # 
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  id=linksWithIcon1
  template.type=velocity
  template.extension=.vm
  
  
  
  1.4       +3 -0      jakarta-jetspeed-2/portal/src/webapp/WEB-INF/velocity.properties
  
  Index: velocity.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/velocity.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- velocity.properties	18 Mar 2004 19:35:47 -0000	1.3
  +++ velocity.properties	17 Sep 2004 18:05:25 -0000	1.4
  @@ -101,3 +101,6 @@
   #----------------------------------------------------------------------------
   
   external.init = false
  +
  +velocimacro.library.autoreload = true
  +velocimacro.library = /WEB-INF/VM_global_library.vm, /WEB-INF/jetspeed_macros.vm
  
  
  
  1.1                  jakarta-jetspeed-2/portal/src/webapp/WEB-INF/jetspeed_macros.vm
  
  Index: jetspeed_macros.vm
  ===================================================================
  #macro (defineConstants)
    #* Constants for layout orientation *#	
    #set($LEFT_TO_RIGHT = "LeftToRight")
    #set($RIGHT_TO_LEFT = "RightToLeft")
    #set($TOP_TO_BOTTOM = "TopToBottom")
    #set($BOTTOM_TO_TOP = "BottomToTop")
  #end
  
  #* Includes a navigation component *#
  #macro (includeNavigation $name $_nodeSet $orientation)
   #parse($jetspeed.getTemplate("${name}/${orientation}.vm", "navigation").appRelativePath)
  #end
  
  #macro (defineConfig $name $type)
    #set($_navConfig =$jetspeed.getTypeConfiguration("navigation", $name))
  #end
  
  

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