Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-2929
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce authored and bdaw committed May 8, 2013
1 parent 4f35736 commit 18bbb85
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<%
<%
import org.exoplatform.services.organization.User;
import org.gatein.common.text.EntityEncoder;
import org.exoplatform.commons.utils.HTMLEntityEncoder;

def rcontext = _ctx.getRequestContext();

String accountSetting = "javascript:if(document.getElementById('UIMaskWorkspace')) ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'AccountSettings', true));"
%>
<ul class="UIUserInfoPortlet" id="$uicomponent.id">
<li class="Name">
<% if(rcontext.getRemoteUser() != null) {
<% if(rcontext.getRemoteUser() != null) {
EntityEncoder encoder = HTMLEntityEncoder.getInstance();
fullName = encoder.encode(uicomponent.getUser().getFullName());
%>
Expand All @@ -18,4 +18,5 @@
<span></span>
<%}%>
</li>
</li>
<!-- GTNPORTAL-2229 -->
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import org.exoplatform.web.url.navigation.NavigationResource;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteType;

def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.require("SHARED/navigation", "nav").addScripts("nav.UIPortalNavigation.onLoad('" + uicomponent.id + "');");

PortalRequestContext pcontext = Util.getPortalRequestContext();
PortalRequestContext pcontext = Util.getPortalRequestContext();
PortalURL nodeURL = nodeurl();
void renderDashboards(PortalURL nodeURL, PortalRequestContext pcontext, Collection nodes) {
print """
Expand All @@ -29,14 +29,14 @@
</ul>
""" ;
}

void renderPageNode(PortalURL nodeURL, PortalRequestContext pcontext, UserNode node) {
UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
if(selectedNode != null && node.getId().equals(selectedNode.getId())) {
tabStyleNavigation = "SelectedItem";
}

boolean hasChild = (node.getChildrenCount() > 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
Expand All @@ -48,21 +48,24 @@
{
resolvedLabel = _ctx.appRes("UIUserToolBarDashboard.page." + resolvedLabel);
}

boolean toolong = (node.getResolvedLabel().length() > 60);
String label = ( toolong ? HTMLEntityEncoder.getInstance().encode(node.getResolvedLabel().substring(0, 57) + "...") : resolvedLabel);
String title = "";
if(toolong) title = "title='$resolvedLabel'";
else title = "";

def getNodeURL = "";
if (hasChild) {
MimeResponse res = _ctx.getRequestContext().getResponse();
ResourceURL resourceURL = res.createResourceURL();
resourceURL.setResourceID(node.getURI());
getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
resourceURL.setResourceID(node.getURI());
// GTNPORTAL-2229
String temp = resourceURL.toString().replaceAll("&","&amp;");
getNodeURL = "exo:getNodeURL='" + temp + "'";
// getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
}

print """
<li class="MenuItem $clazz $tabStyleNavigation" $getNodeURL>
""";
Expand All @@ -73,20 +76,20 @@
}
if(hasChild) {
print """
<ul class="MenuItemContainer">
<ul class="MenuItemContainer">
""" ;
for(UserNode child : node.getChildren()) {
renderPageNode(nodeURL, pcontext, child);
}
print """
</ul>
""" ;

}
print """
</li>
""" ;
}
""" ;
}
%>

<%
Expand All @@ -98,12 +101,12 @@
<li class="UITab NormalToolbarTab">
<a class="DashboardIcon TBIcon" href="<%= createDashboardLink%>">Dashboard</a>
</li>
</ul>
<%
</ul>
<%
}else{
String link = nodeURL.setResource(new NavigationResource(SiteType.USER, rcontext.getRemoteUser(), null)).toString();
%>
<ul class="UIUserToolBarDashboardPortlet UIHorizontalTabs" id="$uicomponent.id" >
<ul class="UIUserToolBarDashboardPortlet UIHorizontalTabs" id="$uicomponent.id" >
<li class="UITab NormalToolbarTab">
<span class="DashboardIcon TBIcon">Dashboard</span>
<% renderDashboards(nodeURL, pcontext, userNodes); %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%
<%
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
Expand All @@ -16,33 +16,33 @@
def rcontext = _ctx.getRequestContext();
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.require("SHARED/navigation", "nav").addScripts("nav.UIPortalNavigation.onLoad('" + uicomponent.id + "');");

def groupNavigations = uicomponent.getGroupNavigations();
PortalRequestContext pcontext = Util.getPortalRequestContext();

PortalRequestContext pcontext = Util.getPortalRequestContext();
PortalURL nodeURL = nodeurl();

void renderGroupPageNavigation(UserNavigation navigation, PortalURL nodeURL) {
def nodes = uicomponent.getNavigationNodes(navigation);
if(nodes.size() < 1) return ;
String navTitle = _ctx.appRes("UIPageNavigation.label.titleBar") ;
def ownerId = navigation.getKey().getName();
navTitle = navTitle.replace("{0}", OrganizationUtils.getGroupLabel(ownerId));
print """
<li class="TitleBar portlet-menu-description" title="$ownerId">$navTitle</li>
<li class="TitleBar portlet-menu-description" title="$ownerId">$navTitle</li>
""" ;
for(UserNode node : nodes) {
renderPageNode(node, nodeURL);
}
}
}

void renderPageNode(UserNode node, PortalURL nodeURL) {
UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
tabStyleNavigation = "SelectedItem portlet-menu-item-selected";
}

boolean hasChild = node.getChildrenCount() > 0;
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
Expand All @@ -54,16 +54,19 @@
String title = "";
if(toolong) title = "title='" + node.getEncodedResolvedLabel() + "'";
else title = "";

def getNodeURL = "";
if (hasChild) {
def groupId = node.getNavigation().getKey().getName();
MimeResponse res = _ctx.getRequestContext().getResponse();
ResourceURL resourceURL = res.createResourceURL();
resourceURL.setResourceID(groupId + "::" + node.getURI());
getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
ResourceURL resourceURL = res.createResourceURL();
resourceURL.setResourceID(groupId + "::" + node.getURI());
// GTNPORTAL-2229
String temp = resourceURL.toString().replaceAll("&","&amp;");
getNodeURL = "exo:getNodeURL='" + temp + "'";
// getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
}

print """
<li class="MenuItem $clazz $tabStyleNavigation portlet-menu-cascade-item" $getNodeURL>
""";
Expand All @@ -74,25 +77,26 @@
}
if(hasChild) {
print """
<ul class="MenuItemContainer portlet-menu-cascade-separator" style="position: absolute; display:none">
<ul class="MenuItemContainer portlet-menu-cascade-separator" style="position: absolute; display:none">
""" ;
for(UserNode child : node.getChildren()) {
renderPageNode(child, nodeURL);
}
print """
print """
</ul>
""" ;

}
print """
</li>
</li>
""" ;
}
}
def currentPortal = pcontext.getPortalOwner();
%>
%>
<ul class="UIUserToolBarGroupPortlet UIHorizontalTabs" id="$uicomponent.id" >
<li class="UITab NormalToolbarTab portlet-menu-item">
<span class="GroupIcon TBIcon" href="<%=nodeURL.setResource(new NavigationResource(SiteType.PORTAL, currentPortal, "groupnavigation")).toString() %>"><%=_ctx.appRes("UIUserToolBarGroupPortlet.header.group")%></span>
<!-- GTNPORTAL-2929 -->
<a class="GroupIcon TBIcon" href="<%=nodeURL.setResource(new NavigationResource(SiteType.PORTAL, currentPortal, "groupnavigation")).toString() %>"><%=_ctx.appRes("UIUserToolBarGroupPortlet.header.group")%></a>
<% if (!groupNavigations.isEmpty()) { %>
<ul style="display:none" class="MenuItemContainer portlet-menu-cascade">
<% for(nav in groupNavigations) {
Expand All @@ -101,7 +105,7 @@
<li class="HorizontalSeparator"></li>
<li class="MenuItem portlet-menu-cascade-item">
<a class="EditorIcon TBIcon" href="<%=nodeURL.setResource(new NavigationResource(SiteType.PORTAL, currentPortal, "groupnavigation")).toString() %>"><%=_ctx.appRes("UIUserToolBarGroupPortlet.editGroup")%></a>
<li>
</li> <!-- GTNPORTAL-2229 -->
</ul>
<% } %>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%
<%
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.gatein.common.text.EntityEncoder;
Expand All @@ -12,14 +12,14 @@
import org.exoplatform.web.url.PortalURL;
import org.exoplatform.web.url.navigation.NavigationResource;
import org.exoplatform.portal.config.model.PortalConfig;

def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.require("SHARED/navigation", "nav").addScripts("nav.UIPortalNavigation.onLoad('" + uicomponent.id + "');");
PortalRequestContext pcontext = Util.getPortalRequestContext();

PortalRequestContext pcontext = Util.getPortalRequestContext();
PortalURL nodeURL = nodeurl();

void renderPortalNavigations(PortalURL nodeURL) {
print """
<ul style="position: absolute; display:none" class="MenuItemContainer portlet-menu-cascade">
Expand All @@ -33,20 +33,20 @@
String portalName = allPortalNames.get(i);
if(portalName.equals(uicomponent.getCurrentPortal())) {
isCurrent = true;
} else isCurrent = false;
} else isCurrent = false;

nodeURL.setResource(new NavigationResource(SiteType.PORTAL, portalName, null));

if(isCurrent) clazz = "ArrowIcon";
else clazz = "";

href = nodeURL.toString();
EntityEncoder entityEncoder = HTMLEntityEncoder.getInstance();
label = uicomponent.getPortalLabel(portalName);
label = entityEncoder.encode(label);
print """
<li class="MenuItem $clazz portlet-menu-cascade-item">
<a href="$href" class="ItemIcon SiteIcon">$label</a>
<a href="$href" class="ItemIcon SiteIcon">$label</a>
""";
if(isCurrent) {
renderCurrentPortal(nodeURL);
Expand All @@ -58,7 +58,7 @@
def editSitesLink = nodeURL.setResource(new NavigationResource(SiteType.PORTAL, uicomponent.getCurrentPortal(), "portalnavigation")).toString();
label = _ctx.appRes("UIUserToolBarSitePortlet.editSite");
print """

<li class="HorizontalSeparator"></li>
<li class="MenuItem portlet-menu-cascade-item">
<a class="EditorIcon TBIcon" href="$editSitesLink">$label</a>
Expand All @@ -67,7 +67,7 @@
</ul>
""";
}

void renderCurrentPortal(PortalURL nodeURL) {
def nodes = _ctx.getRequestContext().getAttribute("nodes");
print """
Expand All @@ -80,14 +80,14 @@
</ul>
""";
}

void renderPageNode(PortalURL nodeURL, UserNode node) {
UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
if(selectedNode != null && node.getId().equals(selectedNode.getId())) {
if(selectedNode != null && node.getId().equals(selectedNode.getId())) {
tabStyleNavigation = "SelectedItem portlet-menu-cascade-item-selected";
}

boolean hasChild = node.getChildrenCount() > 0;
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
Expand All @@ -99,15 +99,18 @@
String title = "";
if(toolong) title = "title='" + node.getEncodedResolvedLabel() + "'";
else title = "";

def getNodeURL = "";
if (hasChild) {
MimeResponse res = _ctx.getRequestContext().getResponse();
ResourceURL resourceURL = res.createResourceURL();
resourceURL.setResourceID(node.getURI());
getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
resourceURL.setResourceID(node.getURI());
// GTNPORTAL-2229
String temp = resourceURL.toString().replaceAll("&","&amp;");
getNodeURL = "exo:getNodeURL='" + temp + "'";
// getNodeURL = "exo:getNodeURL='" + resourceURL.toString() + "'";
}

print """
<li class="MenuItem $tabStyleNavigation $clazz portlet-menu-cascade-item" $getNodeURL>
""";
Expand All @@ -129,23 +132,23 @@
print """
</ul>
""" ;

}
print """
</li>
""" ;
""" ;
}
def currentPortal = uicomponent.getCurrentPortal();
def navigation = uicomponent.getNavigation(SiteKey.portal(currentPortal));
def nodes = uicomponent.getNavigationNodes(navigation);
_ctx.getRequestContext().setAttribute("nodes", nodes);
%>
%>

<ul class="UIUserToolBarSitePortlet UIHorizontalTabs" id="$uicomponent.id" >
<li class="UITab NormalToolbarTab portlet-menu-item">
<span class="SitesIcon TBIcon">
<%=_ctx.appRes("UIUserToolBarSitePortlet.header.site")%>
</span>
</span>
<% renderPortalNavigations(nodeURL) %>
</li>
</ul>
</ul>

0 comments on commit 18bbb85

Please sign in to comment.