Success

Notes

Error

 
 
 
 
Budget

Small project <800

Posted on

2013-03-21 19:50:58.0

Buyer:

Qee***

This project has expired

Why don't you register anyway? We are sure that you will find many similar projects out of the thousands waiting for you!

Post similar project now

Description

Admin Note:

Dear Service Providers,

the selected budget is being discussed with the client. This is to inform that twago is currently in contact with the client to see if the budget is negotiable.

 

 

Project Skills Required: Java, Liferay, Eclipse For my Liferay system, I have the requirement to display an additional navigation in the footer of the page. This navigation should always and only display the navigation of one particular site (i.e. Base). This is contrary to the default navigation (as it comes shipped) which always shows the navigation for the current site. In order to realize this, a Hook needs to be created. During my research I came across a number of posts concerning such implementation but they all appear to be only relevant for Liferay 6.1.0 or lower. http://www.liferay.com/community/forums/-/message_boards/message/5378939 http://felixchristy.blogspot.co.uk/2011/07/creating-custom-navigation-in-liferay.html Based on the information found, I have already started to build a Hook but got stuck at the "RequestVars" function. The "RequestVars" function has been changed between Liferay 6.1.0 and 6.1.1. With the latter, it now takes an additional parameter, called "TemplateContext". Below links show the differences of the "RequestVars" function between those Liferay versions... Liferay 6.1.0 http://grepcode.com/file/repo1.maven.org/maven2/com.liferay.portal/portal-service/6.1.0/com/liferay/portal/theme/RequestVars.java Liferay 6.1.0 http://grepcode.com/file/repo1.maven.org/maven2/com.liferay.portal/portal-service/6.1.1/com/liferay/portal/theme/RequestVars.java As of the current insight, you would only need to use the code below and then figure out how to retrieve the "TemplateContext" object and then provide it as RequestVars parameter. Steps Required by the Developer 1. Set up a Liferay development environment http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Getting+Started+Tutorial 2. Create a Hook http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/creating-a-hook 3. Use the code below and apply missing logic

Note: Alternatively I can provide you with the current Liferay Hook. ------------------------------------- package com.liferay.trovler.events; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.liferay.portal.kernel.events.Action; import com.liferay.portal.kernel.events.ActionException; import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter; import com.liferay.portal.kernel.templateparser.TemplateContext; import com.liferay.portal.kernel.templateparser.TemplateNode; import com.liferay.portal.model.Group; import com.liferay.portal.model.Layout; import com.liferay.portal.service.GroupLocalServiceUtil; import com.liferay.portal.service.LayoutLocalServiceUtil; import com.liferay.portal.theme.NavItem; import com.liferay.portal.theme.RequestVars; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.WebKeys; import com.liferay.portal.kernel.templateparser.BaseTemplateParser; import com.liferay.portal.kernel.xml.Element; public class StickyBaseNavigation extends Action {         @Override     public void run(HttpServletRequest request, HttpServletResponse respones)             throws ActionException {         ThemeDisplay myThemeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);         Group myBaseCommunity = GroupLocalServiceUtil.getGroup(myThemeDisplay.getCompanyId(), "BASE");         long myDefaultLayoutId = LayoutLocalServiceUtil.getDefaultPlid(myBaseCommunity.getGroupId());         Layout myDefaultLayout = LayoutLocalServiceUtil.getLayout(myDefaultLayoutId);         List myLayoutSet = LayoutLocalServiceUtil.getLayouts(myBaseCommunity.getGroupId(), false);         RequestVars myRequestVars = new RequestVars(request, myThemeDisplay, myDefaultLayout.getAncestorPlid(), myDefaultLayout.getAncestorLayoutId(), TemplateContext);         List myNavItems = NavItem.fromLayouts(myRequestVars,myLayoutSet);         Map vmVariables = new HashMap();         vmVariables.put("baseNavItems", myNavItems);         request.setAttribute(WebKeys.VM_VARIABLES, vmVariables);     } } -------------------------------- 4. Deploy hook 5. Within the Default Liferay theme, change the "portal_normal.vm" accordingly  to incorporate the second menu. See following URL for generic instructions http://felixchristy.blogspot.co.uk/2011/07/creating-custom-navigation-in-liferay.html Success Requirements: 1. The modified "portal_normal.vm" shows two navigations (I don't need this file, you only require it in order to test the created Hook) 2. When users navigates to an other site than the base site, the Hook causes to the second menu to still show the base site navigation. The first (i.e. unchanged navigation) however, will show the navigation for the site you are currently on. 3. This Hook has to work theme/ layout independently. Delivery: Source Code of Liferay Hook as Eclipse project

 

Additonal Note:

Over the next couple of month more complexe project will be posted