Massimiliano Assante 2016-02-21 19:37:54 +00:00
parent 8238b87cbc
commit a1db63718d
28 changed files with 1606 additions and 0 deletions

32
.classpath Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

42
.project Normal file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>social-dockbar-hook</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

13
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8

View File

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,4 @@
activeProfiles=Liferay-v6.2-CE-(Tomcat-7)-(2)
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="social-dockbar-hook">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="social-dockbar-hook"/>
<property name="java-output-path" value="/social-dockbar-hook/target/classes"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="liferay.hook" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -0,0 +1 @@
Window

View File

@ -0,0 +1,10 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorList
USER_MANUAL_PREFERENCE=enabledManualValidatorList
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.600.v201501211647
disabled=06target
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.jst.jsp.core.JSPBatchValidator/groups=0107include01113projectNature131org.eclipse.jdt.core.javanature0107include110111contentType134org.eclipse.jst.jsp.core.jspsourceT111contentType142org.eclipse.jst.jsp.core.jspfragmentsourceT111contentType134org.eclipse.jst.jsp.core.tagsourceT07fileext03jspF07fileext04jspfF07fileext03jsfF07fileext03tagF07fileext04tagfF07fileext03jsvF07fileext04jtplF0107exclude0104file127src/main/webapp/custom_jspsT02
vf.version=3

88
pom.xml Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portal.liferay</groupId>
<artifactId>social-dockbar-hook</artifactId>
<packaging>war</packaging>
<name>social-dockbar-hook Hook</name>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>${liferay.maven.plugin.version}</version>
<configuration>
<autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
<appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
<appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
<appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
<liferayVersion>${liferay.version}</liferayVersion>
<pluginType>hook</pluginType>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-java</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Liferay-v6.2-CE-(Tomcat-7)-(2)</id>
<properties>
<liferay.version>6.2.5</liferay.version>
<liferay.maven.plugin.version>6.2.5</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT</liferay.app.server.portal.dir>
</properties>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>

View File

@ -0,0 +1,9 @@
name=social-dockbar-hook
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL

View File

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
</web-app>

View File

@ -0,0 +1,15 @@
<ul class="nav nav-add-controls">
<li class="dockbar-item"><a class="" href="javascript:;"
id="homeIcon" title="To be decided"> <i class="icon-home"
style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class="" href="javascript:;"
id="wsIcon" alt='Workspace' title='Virtual Workspace'> <i
class="icon-folder-open" style="font-size: 24px;"></i>
</a></li>
<li class="dockbar-item"><a class="" href="javascript:;"
id="messagesIcon" alt='See Messages' title='Messages'> <i
class="icon-envelope" style="font-size: 24px;"></i>
</a></li>
</ul>

View File

@ -0,0 +1,15 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>

View File

@ -0,0 +1,25 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/init.jsp" %>
<%@ page import="com.liferay.portal.util.PortletCategoryUtil" %><%@
page import="com.liferay.taglib.aui.AUIUtil" %>
<%@ page import="java.util.regex.Matcher" %><%@
page import="java.util.regex.Pattern" %>
<%@ include file="/html/portlet/dockbar/init-ext.jsp" %>

View File

@ -0,0 +1,104 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/dockbar/init.jsp" %>
<div id="<portlet:namespace />devicePreviewContainer">
<aui:button cssClass="close pull-right" name="closePanelPreview" value="&times;" />
<h1><liferay-ui:message key="preview" /></h1>
<aui:nav cssClass="nav-list">
<aui:nav-item cssClass="autosize lfr-device-item" data-device="autosize">
<div class="device-info">
<span class="device-name"><liferay-ui:message key="autosize" /></span>
<span class="device-dimensions">100%</span>
</div>
</aui:nav-item>
<aui:nav-item cssClass="lfr-device-item selected smartphone" data-device="smartphone">
<div class="device-info">
<span class="device-name"><liferay-ui:message key="smartphone" /></span>
<span class="device-dimensions">768px</span>
</div>
</aui:nav-item>
<aui:nav-item cssClass="lfr-device-item tablet" data-device="tablet">
<div class="device-info">
<span class="device-name"><liferay-ui:message key="tablet" /></span>
<span class="device-dimensions">1024px</span>
</div>
</aui:nav-item>
<aui:nav-item cssClass="desktop lfr-device-item" data-device="desktop">
<div class="device-info">
<span class="device-name"><liferay-ui:message key="desktop" /></span>
<span class="device-dimensions">1280px</span>
</div>
</aui:nav-item>
<aui:nav-item cssClass="lfr-device-item" data-device="custom">
<p><liferay-ui:message key="custom" /> (px)</p>
<aui:input cssClass="input-mini" inlineField="<%= true %>" label="" name="width" value="400" /><span> &times; </span><aui:input cssClass="input-mini" inlineField="<%= true %>" label="" name="height" value="400" />
</aui:nav-item>
</aui:nav>
<div class="alert">
<small><liferay-ui:message key="preview-may-not-be-accurate" /></small>
</div>
</div>
<aui:script use="liferay-dockbar-device-preview">
var devicePreview = new Liferay.Dockbar.DevicePreview(
{
devices: {
autosize: {
skin: 'autosize'
},
custom: {
height: '#<portlet:namespace />height',
resizable: true,
width: '#<portlet:namespace />width'
},
desktop: {
height: 1050,
width: 1300
},
smartphone: {
height: 640,
preventTransition: true,
rotation: true,
selected: true,
skin: 'smartphone',
width: 400
},
tablet: {
height: 900,
preventTransition: true,
rotation: true,
skin: 'tablet',
width: 760
}
},
inputHeight: '#<portlet:namespace />height',
inputWidth: '#<portlet:namespace />width',
namespace: '<portlet:namespace />'
}
);
Liferay.once('dockbarHidePanel', A.bind('destroy', devicePreview));
</aui:script>

View File

@ -0,0 +1,291 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/dockbar/init.jsp" %>
<%
Group group = null;
LayoutSet layoutSet = null;
if (layout != null) {
group = layout.getGroup();
layoutSet = layout.getLayoutSet();
}
boolean hasLayoutCustomizePermission = LayoutPermissionUtil.contains(permissionChecker, layout, ActionKeys.CUSTOMIZE);
boolean hasLayoutUpdatePermission = LayoutPermissionUtil.contains(permissionChecker, layout, ActionKeys.UPDATE);
String toggleControlsState = GetterUtil.getString(SessionClicks.get(request, "liferay_toggle_controls", "visible"));
%>
<aui:nav-bar cssClass="navbar-static-top dockbar" data-namespace="<%= renderResponse.getNamespace() %>" id="dockbar">
<c:if test="<%= ! group.isControlPanel() %>">
<%@ include file="/html/portlet/dockbar/custom_dockbar_view.jspf" %>
</c:if>
<c:if test="<%= group.isControlPanel() %>">
<%
String controlPanelCategory = themeDisplay.getControlPanelCategory();
String refererGroupDescriptiveName = null;
String backURL = null;
if (themeDisplay.getRefererPlid() > 0) {
Layout refererLayout = LayoutLocalServiceUtil.fetchLayout(themeDisplay.getRefererPlid());
if (refererLayout != null) {
Group refererGroup = refererLayout.getGroup();
if (refererGroup.isUserGroup() && (themeDisplay.getRefererGroupId() > 0)) {
refererGroup = GroupLocalServiceUtil.getGroup(themeDisplay.getRefererGroupId());
refererLayout = new VirtualLayout(refererLayout, refererGroup);
}
refererGroupDescriptiveName = refererGroup.getDescriptiveName(locale);
if (refererGroup.isUser() && (refererGroup.getClassPK() == user.getUserId())) {
if (refererLayout.isPublicLayout()) {
refererGroupDescriptiveName = LanguageUtil.get(pageContext, "my-profile");
}
else {
refererGroupDescriptiveName = LanguageUtil.get(pageContext, "my-dashboard");
}
}
backURL = PortalUtil.getLayoutURL(refererLayout, themeDisplay);
if (!CookieKeys.hasSessionId(request)) {
backURL = PortalUtil.getURLWithSessionId(backURL, session.getId());
}
}
}
if (Validator.isNull(refererGroupDescriptiveName) || Validator.isNull(backURL)) {
refererGroupDescriptiveName = themeDisplay.getAccount().getName();
backURL = themeDisplay.getURLHome();
}
if (Validator.isNotNull(themeDisplay.getDoAsUserId())) {
backURL = HttpUtil.addParameter(backURL, "doAsUserId", themeDisplay.getDoAsUserId());
}
if (Validator.isNotNull(themeDisplay.getDoAsUserLanguageId())) {
backURL = HttpUtil.addParameter(backURL, "doAsUserLanguageId", themeDisplay.getDoAsUserLanguageId());
}
%>
<c:if test="<%= controlPanelCategory.startsWith(PortletCategoryKeys.CURRENT_SITE) || !(controlPanelCategory.equals(PortletCategoryKeys.MY) && PropsValues.DOCKBAR_ADMINISTRATIVE_LINKS_SHOW_IN_POP_UP) %>">
<div class="brand">
<a class="control-panel-back-link" href="<%= backURL %>" title="<liferay-ui:message key="back" />">
<i class="control-panel-back-icon icon-chevron-sign-left"></i>
<span class="control-panel-back-text helper-hidden-accessible">
<liferay-ui:message key="back" />
</span>
</a>
<h1>
<c:choose>
<c:when test="<%= controlPanelCategory.startsWith(PortletCategoryKeys.CURRENT_SITE) %>">
<%@ include file="/html/portal/layout/view/control_panel_site_selector.jspf" %>
<span class="divider">/</span>
<span class="site-administration-title">
<liferay-ui:message key="site-administration" />
</span>
</c:when>
<c:when test="<%= controlPanelCategory.equals(PortletCategoryKeys.MY) %>">
<a href="<%= themeDisplay.getURLMyAccount() %>">
<liferay-ui:message key="my-account" />
</a>
</c:when>
<c:otherwise>
<a href="<%= themeDisplay.getURLControlPanel() %>">
<liferay-ui:message key="control-panel" />
</a>
</c:otherwise>
</c:choose>
</h1>
</div>
</c:if>
</c:if>
<%
String controlPanelCategory = themeDisplay.getControlPanelCategory();
%>
<c:if test="<%= !(group.isControlPanel() && controlPanelCategory.startsWith(PortletCategoryKeys.CURRENT_SITE)) %>">
<aui:nav collapsible="<%= true %>" cssClass="nav-navigation" icon="reorder" id="navSiteNavigation">
<c:if test="<%= group.isControlPanel() && !controlPanelCategory.equals(PortletCategoryKeys.MY) && !controlPanelCategory.startsWith(PortletCategoryKeys.CURRENT_SITE) %>">
<%
String[] categories = PortletCategoryKeys.ALL;
for (String curCategory : categories) {
String urlControlPanelCategory = HttpUtil.setParameter(themeDisplay.getURLControlPanel(), "controlPanelCategory", curCategory);
String cssClass = StringPool.BLANK;
String iconCssClass = StringPool.BLANK;
if (curCategory.equals(PortletCategoryKeys.APPS)) {
cssClass = "control-panel-apps";
iconCssClass = "icon-th";
}
else if (curCategory.equals(PortletCategoryKeys.CONFIGURATION)) {
cssClass = "control-panel-configuration";
iconCssClass = "icon-cog";
}
else if (curCategory.equals(PortletCategoryKeys.SITES)) {
cssClass = "control-panel-sites";
iconCssClass = "icon-globe";
}
else if (curCategory.equals(PortletCategoryKeys.USERS)) {
cssClass = "control-panel-users";
iconCssClass = "icon-user";
}
%>
<c:if test="<%= _hasPortlets(curCategory, themeDisplay) %>">
<aui:nav-item anchorId='<%= "controlPanelNav" + curCategory + "Link" %>' cssClass="<%= cssClass %>" href="<%= urlControlPanelCategory %>" iconCssClass="<%= iconCssClass %>" label='<%= "category." + curCategory %>' selected="<%= controlPanelCategory.equals(curCategory) %>" />
</c:if>
<%
}
%>
</c:if>
</aui:nav>
</c:if>
<%
boolean userSetupComplete = user.isSetupComplete();
boolean portalMessageUseAnimation = GetterUtil.getBoolean(PortalMessages.get(request, PortalMessages.KEY_ANIMATION), true);
boolean hasLayoutAddPermission = false;
if (layout.getParentLayoutId() == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
hasLayoutAddPermission = GroupPermissionUtil.contains(permissionChecker, group.getGroupId(), ActionKeys.ADD_LAYOUT);
}
else {
hasLayoutAddPermission = LayoutPermissionUtil.contains(permissionChecker, layout, ActionKeys.ADD_LAYOUT);
}
boolean showAddControls = hasLayoutAddPermission || hasLayoutUpdatePermission || (layoutTypePortlet.isCustomizable() && layoutTypePortlet.isCustomizedView() && hasLayoutCustomizePermission);
boolean showEditControls = themeDisplay.isShowLayoutTemplatesIcon() || themeDisplay.isShowPageSettingsIcon();
boolean showPreviewControls = hasLayoutUpdatePermission || GroupPermissionUtil.contains(permissionChecker, group.getGroupId(), ActionKeys.PREVIEW_IN_DEVICE);
boolean showToggleControls = (!group.hasStagingGroup() || group.isStagingGroup()) && (hasLayoutUpdatePermission || (layoutTypePortlet.isCustomizable() && layoutTypePortlet.isCustomizedView() && hasLayoutCustomizePermission) || PortletPermissionUtil.hasConfigurationPermission(permissionChecker, themeDisplay.getSiteGroupId(), layout, ActionKeys.CONFIGURATION));
%>
<c:if test="<%= !group.isControlPanel() && userSetupComplete && (showAddControls || showPreviewControls || showEditControls || showToggleControls) %>">
<aui:nav ariaLabel='<%= LanguageUtil.get(pageContext, "layout-controls") %>' collapsible="<%= true %>" cssClass='<%= portalMessageUseAnimation ? "nav-add-controls" : "nav-add-controls nav-add-controls-notice" %>' icon="pencil" id="navAddControls">
<c:if test="<%= showAddControls %>">
<portlet:renderURL var="addURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
<portlet:param name="struts_action" value="/dockbar/add_panel" />
<portlet:param name="stateMaximized" value="<%= String.valueOf(themeDisplay.isStateMaximized()) %>" />
<portlet:param name="viewEntries" value="<%= Boolean.TRUE.toString() %>" />
</portlet:renderURL>
<aui:nav-item anchorId="addPanel" cssClass="site-add-controls" data-panelURL="<%= addURL %>" href="javascript:;" iconCssClass="icon-plus" label="add" />
</c:if>
<c:if test="<%= showPreviewControls %>">
<portlet:renderURL var="previewContentURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
<portlet:param name="struts_action" value="/dockbar/preview_panel" />
</portlet:renderURL>
<aui:nav-item anchorId="previewPanel" cssClass="page-preview-controls" data-panelURL="<%= previewContentURL %>" href="javascript:;" iconCssClass="icon-desktop" label="preview" />
</c:if>
<c:if test="<%= showEditControls %>">
<portlet:renderURL var="editLayoutURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
<portlet:param name="struts_action" value="/dockbar/edit_layout_panel" />
<portlet:param name="closeRedirect" value="<%= PortalUtil.getLayoutURL(layout, themeDisplay) %>" />
<portlet:param name="selPlid" value="<%= String.valueOf(plid) %>" />
</portlet:renderURL>
<aui:nav-item anchorId="editLayoutPanel" cssClass="page-edit-controls" data-panelURL="<%= editLayoutURL %>" href="javascript:;" iconCssClass="icon-edit" label="edit" />
</c:if>
<c:if test="<%= showToggleControls %>">
<aui:nav-item anchorCssClass="toggle-controls-link" cssClass="toggle-controls" iconCssClass='<%= "controls-state-icon " + (toggleControlsState.equals("visible") ? "icon-eye-open" : "icon-eye-close") %>' id="toggleControls" label="edit-controls" />
</c:if>
</aui:nav>
</c:if>
<%@ include file="/html/portlet/dockbar/view_user_panel.jspf" %>
</aui:nav-bar>
<div class="dockbar-messages" id="<portlet:namespace />dockbarMessages">
<div class="header"></div>
<div class="body"></div>
<div class="footer"></div>
</div>
<%
List<LayoutPrototype> layoutPrototypes = LayoutPrototypeServiceUtil.search(company.getCompanyId(), Boolean.TRUE, null);
%>
<c:if test="<%= !layoutPrototypes.isEmpty() %>">
<div class="html-template" id="layoutPrototypeTemplate">
<ul class="unstyled">
<%
for (LayoutPrototype layoutPrototype : layoutPrototypes) {
%>
<li>
<a href="javascript:;">
<label>
<input name="template" type="radio" value="<%= layoutPrototype.getLayoutPrototypeId() %>" /> <%= HtmlUtil.escape(layoutPrototype.getName(user.getLanguageId())) %>
</label>
</a>
</li>
<%
}
%>
</ul>
</div>
</c:if>
<aui:script position="inline" use="liferay-dockbar">
Liferay.Dockbar.init('#<portlet:namespace />dockbar');
var customizableColumns = A.all('.portlet-column-content.customizable');
if (customizableColumns.size() > 0) {
customizableColumns.get('parentNode').addClass('customizable');
}
</aui:script>
<%!
private boolean _hasPortlets(String category, ThemeDisplay themeDisplay) throws SystemException {
List<Portlet> portlets = PortalUtil.getControlPanelPortlets(category, themeDisplay);
if (portlets.isEmpty()) {
return false;
}
return true;
}
%>

View File

@ -0,0 +1,57 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<c:if test="<%= (themeDisplay.isShowControlPanelIcon() || themeDisplay.isShowSiteAdministrationIcon()) && (!layout.getGroup().isControlPanel() || (Validator.isNotNull(controlPanelCategory) && (controlPanelCategory.startsWith(PortletCategoryKeys.CURRENT_SITE) || (controlPanelCategory.equals(PortletCategoryKeys.MY) && !PropsValues.DOCKBAR_ADMINISTRATIVE_LINKS_SHOW_IN_POP_UP)))) %>">
<aui:nav-item cssClass="admin-links" dropdown="<%= true %>" id="adminLinks" label="admin">
<c:if test="<%= themeDisplay.isShowSiteAdministrationIcon() %>">
<aui:nav-item anchorId="siteAdministrationLink" href="<%= themeDisplay.getURLSiteAdministration() %>" iconCssClass="icon-cog" label="site-administration">
<%
Map<String, List<Portlet>> categoriesMap = PortalUtil.getSiteAdministrationCategoriesMap(request);
if (!categoriesMap.isEmpty()) {
String currentSiteCategory = PortletCategoryKeys.CURRENT_SITE.concat(StringPool.PERIOD);
%>
<ul class="unstyled site-administration-menu">
<%
for (String category : categoriesMap.keySet()) {
String url = HttpUtil.setParameter(themeDisplay.getURLSiteAdministration(), "controlPanelCategory", StringUtil.replace(category, PortletCategoryKeys.SITE_ADMINISTRATION, currentSiteCategory));
%>
<aui:nav-item anchorId='<%= "siteAdministrationLink-" + category %>' href="<%= url %>" iconCssClass="icon-chevron-right" label='<%= "category." + category %>' />
<%
}
%>
</ul>
<%
}
%>
</aui:nav-item>
</c:if>
<c:if test="<%= themeDisplay.isShowControlPanelIcon() %>">
<aui:nav-item anchorId="controlPanelLink" href="<%= themeDisplay.getURLControlPanel() %>" iconCssClass="icon-wrench" label="control-panel" />
</c:if>
</aui:nav-item>
<aui:nav-item cssClass="divider-vertical"></aui:nav-item>
</c:if>

View File

@ -0,0 +1,228 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/dockbar/init.jsp" %>
<%
String panelContainerId = ParamUtil.getString(request, "panelContainerId");
PortletCategory portletCategory = (PortletCategory)request.getAttribute(WebKeys.PORTLET_CATEGORY);
int portletCategoryIndex = GetterUtil.getInteger((String)request.getAttribute(WebKeys.PORTLET_CATEGORY_INDEX));
String oldCategoryPath = (String)request.getAttribute(WebKeys.PORTLET_CATEGORY_PATH);
String newCategoryPath = LanguageUtil.get(pageContext, portletCategory.getName());
Pattern pattern = Pattern.compile(".*");
Matcher matcher = pattern.matcher(newCategoryPath);
StringBundler divId = new StringBundler();
while (matcher.find()) {
divId.append(matcher.group());
}
newCategoryPath = divId.toString();
if (Validator.isNotNull(oldCategoryPath)) {
newCategoryPath = oldCategoryPath + ":" + newCategoryPath;
}
List<PortletCategory> categories = ListUtil.fromCollection(portletCategory.getCategories());
categories = ListUtil.sort(categories, new PortletCategoryComparator(locale));
List<Portlet> portlets = new ArrayList<Portlet>();
Set<String> portletIds = portletCategory.getPortletIds();
String externalPortletCategory = null;
for (String portletId : portletIds) {
Portlet portlet = PortletLocalServiceUtil.getPortletById(user.getCompanyId(), portletId);
if ((portlet != null) && PortletPermissionUtil.contains(permissionChecker, layout, portlet, ActionKeys.ADD_TO_PAGE)) {
portlets.add(portlet);
PortletApp portletApp = portlet.getPortletApp();
if (portletApp.isWARFile() && Validator.isNull(externalPortletCategory)) {
PortletConfig curPortletConfig = PortletConfigFactoryUtil.create(portlet, application);
ResourceBundle resourceBundle = curPortletConfig.getResourceBundle(locale);
externalPortletCategory = ResourceBundleUtil.getString(resourceBundle, portletCategory.getName());
}
}
}
portlets = ListUtil.sort(portlets, new PortletTitleComparator(application, locale));
if (!categories.isEmpty() || !portlets.isEmpty()) {
String panelId = renderResponse.getNamespace() + "portletCategory" + portletCategoryIndex;
String title = Validator.isNotNull(externalPortletCategory) ? externalPortletCategory : LanguageUtil.get(pageContext, portletCategory.getName());
%>
<div class="lfr-add-content">
<liferay-ui:panel collapsible="<%= layout.isTypePortlet() %>" cssClass="lfr-content-category panel-page-category unstyled" defaultState="closed" extended="<%= true %>" id="<%= panelId %>" parentId="<%= panelContainerId %>" persistState="<%= true %>" title="<%= title %>">
<aui:nav collapsible="<%= false %>" cssClass="nav-list">
<%
for (PortletCategory category : categories) {
request.setAttribute(WebKeys.PORTLET_CATEGORY, category);
request.setAttribute(WebKeys.PORTLET_CATEGORY_INDEX, String.valueOf(portletCategoryIndex));
request.setAttribute(WebKeys.PORTLET_CATEGORY_PATH, newCategoryPath);
%>
<liferay-util:include page="/html/portlet/dockbar/view_category.jsp">
<liferay-util:param name="panelContainerId" value="<%= panelContainerId %>" />
</liferay-util:include>
<%
request.setAttribute(WebKeys.PORTLET_CATEGORY_PATH, oldCategoryPath);
portletCategoryIndex++;
}
for (Portlet portlet : portlets) {
divId.setIndex(0);
divId.append(newCategoryPath);
divId.append(":");
matcher = pattern.matcher(PortalUtil.getPortletTitle(portlet, application, locale));
while (matcher.find()) {
divId.append(matcher.group());
}
boolean portletInstanceable = portlet.isInstanceable();
boolean portletUsed = layoutTypePortlet.hasPortletId(portlet.getPortletId());
boolean portletLocked = (!portletInstanceable && portletUsed);
if (portletInstanceable && layout.isTypePanel()) {
continue;
}
%>
<c:choose>
<c:when test="<%= layout.isTypePortlet() %>">
<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("draggable", true);
data.put("id", renderResponse.getNamespace() + "portletItem" + portlet.getPortletId());
data.put("instanceable", portletInstanceable);
data.put("plid", plid);
data.put("portlet-id", portlet.getPortletId());
data.put("search", divId.toString().replace(':', '-'));
data.put("title", PortalUtil.getPortletTitle(portlet, application, locale));
String cssClass = "drag-content-item";
if (portletLocked) {
cssClass += " lfr-portlet-used";
}
%>
<aui:nav-item cssClass="lfr-content-item" href="">
<span <%= AUIUtil.buildData(data) %> class="<%= cssClass %>">
<i class="<%= portletInstanceable ? "icon-th-large" : "icon-stop" %>"></i>
<liferay-ui:message key="<%= PortalUtil.getPortletTitle(portlet, application, locale) %>" />
</span>
<%
data.remove("draggable");
%>
<span <%= AUIUtil.buildData(data) %> class='add-content-item <%= portletLocked ? "lfr-portlet-used" : StringPool.BLANK %>'>
<liferay-ui:message key="add" />
</span>
</aui:nav-item>
<%
List<PortletItem> portletItems = PortletItemLocalServiceUtil.getPortletItems(themeDisplay.getScopeGroupId(), portlet.getPortletId(), com.liferay.portal.model.PortletPreferences.class.getName());
for (PortletItem portletItem : portletItems) {
divId.setIndex(0);
divId.append(newCategoryPath);
divId.append(":");
divId.append(PortalUtil.getPortletTitle(portlet, application, locale));
divId.append(":");
matcher = pattern.matcher(HtmlUtil.escape(portletItem.getName()));
while (matcher.find()) {
divId.append(matcher.group());
}
Map<String, Object> portletItemData = new HashMap<String, Object>();
portletItemData.put("draggable", true);
portletItemData.put("id", renderResponse.getNamespace() + "portletItem" + portletItem.getPortletItemId());
portletItemData.put("instanceable", portletInstanceable);
portletItemData.put("plid", plid);
portletItemData.put("portlet-id", portlet.getPortletId());
portletItemData.put("portlet-item-id", portletItem.getPortletItemId());
portletItemData.put("search", divId.toString().replace(':', '-'));
portletItemData.put("title", HtmlUtil.escape(portletItem.getName()));
%>
<aui:nav-item cssClass="lfr-content-item lfr-archived-setup" data="<%= portletItemData %>" href="">
<span <%= AUIUtil.buildData(portletItemData) %> class="<%= cssClass %>">
<i class="<%= portletInstanceable ? "icon-th-large" : "icon-stop" %>"></i>
<liferay-ui:message key="<%= HtmlUtil.escape(portletItem.getName()) %>" />
</span>
<span <%= AUIUtil.buildData(portletItemData) %> class='add-content-item <%= portletLocked ? "lfr-portlet-used" : StringPool.BLANK %>'>
<liferay-ui:message key="add" />
</span>
</aui:nav-item>
<%
}
%>
</c:when>
<c:otherwise>
<div>
<a href="<liferay-portlet:renderURL portletName="<%= portlet.getRootPortletId() %>" windowState="<%= WindowState.MAXIMIZED.toString() %>"></liferay-portlet:renderURL>"><%= PortalUtil.getPortletTitle(portlet, application, locale) %></a>
</div>
</c:otherwise>
</c:choose>
<%
}
%>
</aui:nav>
</liferay-ui:panel>
</div>
<input id="<portlet:namespace />portletCategory<%= portletCategoryIndex %>CategoryPath" type="hidden" value="<%= newCategoryPath.replace(':', '-') %>" />
<%
}
%>

View File

@ -0,0 +1,24 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<c:if test="<%= user.hasMySites() %>">
<aui:nav-item cssClass="my-sites" dropdown="<%= true %>" id="mySites" label="my-sites" wrapDropDownMenu="<%= false %>">
<liferay-ui:my-sites classNames="<%= new String[] {Group.class.getName(), Organization.class.getName()} %>" cssClass="dropdown-menu my-sites-menu" />
</aui:nav-item>
</c:if>
<aui:nav-item cssClass="divider-vertical"></aui:nav-item>

View File

@ -0,0 +1,196 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%
boolean customizableLayout = !(group.isLayoutPrototype() || group.isLayoutSetPrototype() || group.isStagingGroup() || group.isUserGroup()) && layoutTypePortlet.isCustomizable() && LayoutPermissionUtil.containsWithoutViewableGroup(permissionChecker, layout, false, ActionKeys.CUSTOMIZE);
boolean linkedLayout = (!SitesUtil.isLayoutUpdateable(layout) || (layout.isLayoutPrototypeLinkActive() && !group.hasStagingGroup())) && LayoutPermissionUtil.containsWithoutViewableGroup(themeDisplay.getPermissionChecker(), layout, false, ActionKeys.UPDATE);
boolean modifiedLayout = (layoutSet != null) && layoutSet.isLayoutSetPrototypeLinkActive() && SitesUtil.isLayoutModifiedSinceLastMerge(layout) && hasLayoutUpdatePermission;
%>
<c:if test="<%= modifiedLayout || linkedLayout || customizableLayout %>">
<%
boolean dockbarMessagesHidden = GetterUtil.getBoolean(SessionClicks.get(request, "dockbarMessagesHidden", "false"));
%>
<aui:nav-item cssClass='<%= "info-items" + (dockbarMessagesHidden ? " hide" : StringPool.BLANK) %>'>
<div class="page-customization-bar-container">
<c:if test="<%= modifiedLayout %>">
<div class="page-customization-bar">
<div class="page-customization-bar-text">
<span class="page-customization-bar-message">
<liferay-ui:message key="this-page-has-been-changed-since-the-last-update-from-the-site-template-excerpt" />
</span>
<liferay-ui:icon-help message="this-page-has-been-changed-since-the-last-update-from-the-site-template" />
</div>
<div class="page-customization-bar-form">
<liferay-portlet:actionURL portletName="<%= PortletKeys.LAYOUTS_ADMIN %>" var="resetPrototypeURL">
<portlet:param name="struts_action" value="/layouts_admin/edit_layouts" />
</liferay-portlet:actionURL>
<aui:form action="<%= resetPrototypeURL %>" cssClass="reset-prototype" name="resetFm" portletNamespace="<%= PortalUtil.getPortletNamespace(PortletKeys.LAYOUTS_ADMIN) %>">
<aui:input name="<%= Constants.CMD %>" type="hidden" value="reset_prototype" />
<aui:input name="redirect" type="hidden" value="<%= PortalUtil.getLayoutURL(themeDisplay) %>" />
<aui:input name="groupId" type="hidden" value="<%= String.valueOf(themeDisplay.getSiteGroupId()) %>" />
<aui:button cssClass="btn-link" name="submit" type="submit" value="reset-changes" />
</aui:form>
</div>
</div>
</c:if>
<c:if test="<%= linkedLayout %>">
<div class="page-customization-bar">
<div class="page-customization-bar-text">
<c:choose>
<c:when test="<%= layout.isLayoutPrototypeLinkActive() && !group.hasStagingGroup() %>">
<liferay-ui:message key="this-page-is-linked-to-a-page-template" />
</c:when>
<c:when test="<%= layout instanceof VirtualLayout %>">
<liferay-ui:message key="this-page-belongs-to-a-user-group" />
</c:when>
<c:otherwise>
<liferay-ui:message key="this-page-is-linked-to-a-site-template-which-does-not-allow-modifications-to-it" />
</c:otherwise>
</c:choose>
</div>
</div>
</c:if>
<c:if test="<%= customizableLayout %>">
<div class="page-customization-bar">
<div class="page-customization-bar-text">
<c:choose>
<c:when test="<%= layoutTypePortlet.isCustomizedView() %>">
<span class="page-customization-bar-message">
<liferay-ui:message key="you-can-customize-this-page" />
</span>
<liferay-ui:icon-help message="customizable-user-help" />
</c:when>
<c:otherwise>
<span class="page-customization-bar-message">
<liferay-ui:message key="this-is-the-default-page-without-your-customizations" />
</span>
<c:if test="<%= hasLayoutUpdatePermission %>">
<liferay-ui:icon-help message="customizable-admin-help" />
</c:if>
</c:otherwise>
</c:choose>
</div>
<div class="page-customization-bar-form">
<%
String taglibImage = "search";
String taglibMessage = "view-default-page";
if (!layoutTypePortlet.isCustomizedView()) {
taglibMessage = "view-my-customized-page";
}
else if (layoutTypePortlet.isDefaultUpdated()) {
taglibImage = "activate";
taglibMessage = "the-defaults-for-the-current-page-have-been-updated-click-here-to-see-them";
}
%>
<liferay-ui:icon id="toggleCustomizedView" label="<%= true %>" message="<%= taglibMessage %>" url="javascript:;" />
<c:if test="<%= layoutTypePortlet.isCustomizedView() %>">
<liferay-portlet:actionURL portletName="<%= PortletKeys.LAYOUTS_ADMIN %>" var="resetCustomizationViewURL">
<portlet:param name="struts_action" value="/layouts_admin/edit_layouts" />
<portlet:param name="groupId" value="<%= String.valueOf(themeDisplay.getSiteGroupId()) %>" />
<portlet:param name="<%= Constants.CMD %>" value="reset_customized_view" />
</liferay-portlet:actionURL>
<%
String taglibURL = "javascript:if (confirm('" + UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-reset-your-customizations-to-default") + "')){submitForm(document.hrefFm, '" + HttpUtil.encodeURL(resetCustomizationViewURL) + "');}";
%>
<liferay-ui:icon label="<%= true %>" message="reset-my-customizations" url="<%= taglibURL %>" />
</c:if>
</div>
<aui:script>
Liferay.provide(
window,
'<portlet:namespace />toggleCustomizedView',
function(event) {
var A = AUI();
A.io.request(
themeDisplay.getPathMain() + '/portal/update_layout',
{
data: {
cmd: 'toggle_customized_view',
customized_view: '<%= String.valueOf(!layoutTypePortlet.isCustomizedView()) %>',
p_auth: '<%= AuthTokenUtil.getToken(request) %>'
},
on: {
success: function(event, id, obj) {
window.location.href = themeDisplay.getLayoutURL();
}
}
}
);
},
['aui-io-request']
);
</aui:script>
</div>
<aui:script use="aui-base">
var toggleCustomizedView = A.one('#<portlet:namespace />toggleCustomizedView');
if (toggleCustomizedView) {
toggleCustomizedView.on('click', <portlet:namespace />toggleCustomizedView);
}
</aui:script>
</c:if>
</div>
<aui:nav-item cssClass="info-link-container">
<div class="info-button">
<a class="info-link" href="javascript:;">
<i class="icon-info"></i>
</a>
<div class="diamond"></div>
</div>
</aui:nav-item>
<aui:script use="aui-base, liferay-store">
A.one('.info-link-container').on(
'click',
function(event) {
event.preventDefault();
var navAccountControls = event.currentTarget.ancestor('.nav-account-controls');
var infoItems = navAccountControls.one('.info-items');
navAccountControls.one('.info-items').toggleClass('hide');
Liferay.Store('dockbarMessagesHidden', infoItems.hasClass('hide'));
}
);
</aui:script>
</aui:nav-item>
</c:if>

View File

@ -0,0 +1,195 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/dockbar/init.jsp" %>
<%
boolean viewEntries = ParamUtil.getBoolean(request, "viewEntries");
boolean viewPreview = ParamUtil.getBoolean(request, "viewPreview");
%>
<c:choose>
<c:when test="<%= viewEntries %>">
<div id="<portlet:namespace />entries">
<%
String displayStyleDefault = GetterUtil.getString(SessionClicks.get(request, "liferay_addpanel_displaystyle", "descriptive"));
String displayStyle = ParamUtil.getString(request, "displayStyle", displayStyleDefault);
String keywords = ParamUtil.getString(request, "keywords");
String panelTitle = "recent";
if (Validator.isNotNull(keywords)) {
panelTitle = "search-results";
}
String navListCssClass = "add-content nav-list ";
if (displayStyle.equals("icon")) {
navListCssClass += "add-content-icon";
}
else if (displayStyle.equals("descriptive")) {
navListCssClass += "add-content-descriptive";
}
else if (displayStyle.equals("icon")) {
navListCssClass += "add-content-list";
}
%>
<liferay-ui:panel collapsible="<%= false %>" cssClass="clearfix lfr-component panel-page-category recent" extended="<%= true %>" id="manageRecentPanel" persistState="<%= true %>" title="<%= panelTitle %>">
<aui:nav cssClass="<%= navListCssClass %>">
<%
int deltaDefault = GetterUtil.getInteger(SessionClicks.get(request, "liferay_addpanel_numitems", "10"));
int delta = ParamUtil.getInteger(request, "delta", deltaDefault);
long[] availableClassNameIds = AssetRendererFactoryRegistryUtil.getClassNameIds(company.getCompanyId());
for (long classNameId : availableClassNameIds) {
AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(PortalUtil.getClassName(classNameId));
if (!assetRendererFactory.isSelectable()) {
availableClassNameIds = ArrayUtil.remove(availableClassNameIds, classNameId);
}
}
AssetEntryQuery assetEntryQuery = new AssetEntryQuery();
assetEntryQuery.setClassNameIds(availableClassNameIds);
assetEntryQuery.setEnd(delta);
assetEntryQuery.setGroupIds(new long[] {scopeGroupId});
assetEntryQuery.setKeywords(keywords);
assetEntryQuery.setOrderByCol1("modifiedDate");
assetEntryQuery.setOrderByCol2("title");
assetEntryQuery.setOrderByType1("DESC");
assetEntryQuery.setOrderByType2("ASC");
assetEntryQuery.setStart(0);
List<AssetEntry> results = null;
if (PropsValues.ASSET_PUBLISHER_SEARCH_WITH_INDEX && (assetEntryQuery.getLinkedAssetEntryId() == 0)) {
Hits hits = AssetUtil.search(request, assetEntryQuery, 0, delta);
results = AssetUtil.getAssetEntries(hits);
}
else {
results = AssetEntryServiceUtil.getEntries(assetEntryQuery);
}
for (AssetEntry assetEntry : results) {
String className = PortalUtil.getClassName(assetEntry.getClassNameId());
long classPK = assetEntry.getClassPK();
AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className);
if (assetRendererFactory == null) {
continue;
}
AssetRenderer assetRenderer = null;
try {
assetRenderer = assetRendererFactory.getAssetRenderer(classPK);
}
catch (Exception e) {
}
if ((assetRenderer == null) || !assetRenderer.isDisplayable()) {
continue;
}
String title = HtmlUtil.escape(StringUtil.shorten(assetRenderer.getTitle(themeDisplay.getLocale()), 60));
Map<String, Object> data = new HashMap<String, Object>();
data.put("class-name", assetEntry.getClassName());
data.put("class-pk", assetEntry.getClassPK());
data.put("draggable", true);
data.put("instanceable", true);
data.put("portlet-id", assetRenderer.getAddToPagePortletId());
data.put("title", title);
String navItemCssClass="content-shortcut drag-content-item lfr-content-item ";
if (!displayStyle.equals("icon")) {
navItemCssClass += "has-preview";
}
%>
<aui:nav-item cssClass='<%= navItemCssClass %>'
data="<%= data %>"
href=""
iconCssClass='<%= displayStyle.equals("list") ? "icon-file" : StringPool.BLANK %>'
label='<%= displayStyle.equals("list") ? title : "" %>'
>
<c:choose>
<c:when test='<%= !displayStyle.equals("list") %>' >
<div class="add-content-thumbnail <%= displayStyle.equals("descriptive") ? "span4" : StringPool.BLANK %>">
<img alt="<liferay-ui:message key="thumbnail" />" src="<%= HtmlUtil.escapeAttribute(assetRenderer.getThumbnailPath(liferayPortletRequest)) %>" />
</div>
<div class="add-content-details <%= displayStyle.equals("descriptive") ? "span8" : StringPool.BLANK %>">
<div class="add-content-title">
<%= title %>
</div>
<div class="add-content-description">
<%= HtmlUtil.escape(StringUtil.shorten(assetRenderer.getSummary(themeDisplay.getLocale()), 120)) %>
</div>
</div>
</c:when>
<c:otherwise >
<div <%= AUIUtil.buildData(data) %> class="add-content-item">
<liferay-ui:message key="add" />
</div>
</c:otherwise>
</c:choose>
</aui:nav-item>
<%
}
%>
</aui:nav>
</liferay-ui:panel>
</div>
</c:when>
<c:when test="<%= viewPreview %>">
<%
long classPK = ParamUtil.getLong(request, "classPK");
String className = ParamUtil.getString(request, "className");
%>
<c:if test="<%= (classPK > 0) && Validator.isNotNull(className) %>">
<%
AssetEntry assetEntry = AssetEntryLocalServiceUtil.getEntry(className, classPK);
AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className);
AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(classPK);
request.setAttribute("add_panel.jsp-assetEntry", assetEntry);
request.setAttribute("add_panel.jsp-assetRendererFactory", assetRendererFactory);
request.setAttribute("add_panel.jsp-assetRenderer", assetRenderer);
%>
<div id="<portlet:namespace />preview">
<liferay-util:include page="<%= assetRenderer.getPreviewPath(liferayPortletRequest, liferayPortletResponse) %>" portletId="<%= assetRendererFactory.getPortletId() %>" servletContext="<%= application %>" />
</div>
</c:if>
</c:when>
</c:choose>

View File

@ -0,0 +1,32 @@
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<c:if test="<%= themeDisplay.isSignedIn() && user.isSetupComplete() %>">
<%
request.setAttribute(WebKeys.RENDER_PORTLET_BOUNDARY, false);
%>
<liferay-portlet:runtime portletName="2_WAR_notificationsportlet" />
<%
request.removeAttribute(WebKeys.RENDER_PORTLET_BOUNDARY);
%>
<aui:nav-item cssClass="divider-vertical"></aui:nav-item>
</c:if>
<%@ include file="/html/portlet/dockbar/view_user_account.portal.jspf" %>

View File

@ -0,0 +1,152 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<liferay-util:buffer var="userName">
<c:if test="<%= themeDisplay.isImpersonated() %>">
<b class="alert-icon icon-warning-sign"></b>
</c:if>
<img alt="<liferay-ui:message key="my-account" />" class="user-avatar-image" src="<%= HtmlUtil.escape(user.getPortraitURL(themeDisplay)) %>" />
<span class="user-full-name">
<%= HtmlUtil.escape(user.getFullName()) %>
</span>
</liferay-util:buffer>
<c:choose>
<c:when test="<%= themeDisplay.isSignedIn() %>">
<aui:nav-item anchorCssClass="user-avatar-link" cssClass='<%= themeDisplay.isImpersonated() ? "user-avatar impersonating-user" : "user-avatar" %>' dropdown="<%= true %>" id="userAvatar" label="<%= userName %>">
<c:if test="<%= themeDisplay.isImpersonated() %>">
<%
String impersonatingUserLabel = "you-are-impersonating-the-guest-user";
if (themeDisplay.isSignedIn()) {
impersonatingUserLabel = LanguageUtil.format(pageContext, "you-are-impersonating-x", new Object[] {HtmlUtil.escape(user.getFullName())});
}
%>
<div class="alert alert-info"><%= impersonatingUserLabel %></div>
<liferay-util:buffer var="leaveImpersonationLabel">
<liferay-ui:message key="be-yourself-again" /> (<%= HtmlUtil.escape(realUser.getFullName()) %>)
</liferay-util:buffer>
<aui:nav-item href="<%= PortalUtil.getLayoutURL(layout, themeDisplay, false) %>" label="<%= leaveImpersonationLabel %>" />
<%
Locale realUserLocale = realUser.getLocale();
Locale userLocale = user.getLocale();
%>
<c:if test="<%= !realUserLocale.equals(userLocale) %>">
<%
String doAsUserLanguageId = null;
String changeLanguageMessage = null;
if (locale.getLanguage().equals(realUserLocale.getLanguage()) && locale.getCountry().equals(realUserLocale.getCountry())) {
doAsUserLanguageId = userLocale.getLanguage() + "_" + userLocale.getCountry();
changeLanguageMessage = LanguageUtil.format(realUserLocale, "use-x's-preferred-language-(x)", new String[] {HtmlUtil.escape(user.getFullName()), userLocale.getDisplayLanguage(realUserLocale)});
}
else {
doAsUserLanguageId = realUserLocale.getLanguage() + "_" + realUserLocale.getCountry();
changeLanguageMessage = LanguageUtil.format(realUserLocale, "use-your-preferred-language-(x)", realUserLocale.getDisplayLanguage(realUserLocale));
}
%>
<aui:nav-item cssClass="current-user-language" href='<%= HttpUtil.setParameter(PortalUtil.getCurrentURL(request), "doAsUserLanguageId", doAsUserLanguageId) %>' label="<%= changeLanguageMessage %>" />
</c:if>
</c:if>
<c:if test="<%= userSetupComplete && Validator.isNotNull(themeDisplay.getURLMyAccount()) %>">
<%
List<Group> mySiteGroups = user.getMySiteGroups(new String[] {User.class.getName()}, false, QueryUtil.ALL_POS);
for (Group mySiteGroup : mySiteGroups) {
%>
<c:if test="<%= mySiteGroup.getPublicLayoutsPageCount() > 0 %>">
<%
PortletURL myProfileURL = new PortletURLImpl(request, PortletKeys.SITE_REDIRECTOR, plid, PortletRequest.ACTION_PHASE);
myProfileURL.setParameter("struts_action", "/my_sites/view");
myProfileURL.setParameter("groupId", String.valueOf(mySiteGroup.getGroupId()));
myProfileURL.setParameter("privateLayout", Boolean.FALSE.toString());
myProfileURL.setPortletMode(PortletMode.VIEW);
myProfileURL.setWindowState(WindowState.NORMAL);
%>
<li class="my-sites-menu public-site">
<a href="<%= myProfileURL.toString() %>" role="menuitem">
<span class="site-name"><liferay-ui:message key="my-profile" /></span>
<span class="badge site-type"><liferay-ui:message key="public" /></span>
</a>
</li>
</c:if>
<c:if test="<%= mySiteGroup.getPrivateLayoutsPageCount() > 0 %>">
<%
PortletURL myDashboardURL = new PortletURLImpl(request, PortletKeys.SITE_REDIRECTOR, plid, PortletRequest.ACTION_PHASE);
myDashboardURL.setParameter("struts_action", "/my_sites/view");
myDashboardURL.setParameter("groupId", String.valueOf(mySiteGroup.getGroupId()));
myDashboardURL.setParameter("privateLayout", Boolean.TRUE.toString());
myDashboardURL.setPortletMode(PortletMode.VIEW);
myDashboardURL.setWindowState(WindowState.NORMAL);
%>
<li class="my-sites-menu private-site">
<a href="<%= myDashboardURL %>" role="menuitem">
<span class="site-name"><liferay-ui:message key="my-dashboard" /></span>
<span class="badge site-type"><liferay-ui:message key="private" /></span>
</a>
</li>
</c:if>
<%
}
%>
<%
String myAccountURL = themeDisplay.getURLMyAccount().toString();
myAccountURL = HttpUtil.setParameter(myAccountURL, "controlPanelCategory", PortletCategoryKeys.MY);
%>
<aui:nav-item href="<%= myAccountURL %>" iconCssClass="icon-user" label="my-account" title="my-account" useDialog="<%= PropsValues.DOCKBAR_ADMINISTRATIVE_LINKS_SHOW_IN_POP_UP %>" />
</c:if>
<c:if test="<%= themeDisplay.isShowSignOutIcon() %>">
<aui:nav-item cssClass="sign-out" href="<%= themeDisplay.getURLSignOut() %>" iconCssClass="icon-off" label="sign-out" />
</c:if>
</aui:nav-item>
</c:when>
<c:otherwise>
<%
Map<String, String> anchorData = new HashMap<String, String>();
anchorData.put("redirect", String.valueOf(PortalUtil.isLoginRedirectRequired(request)));
%>
<aui:nav-item anchorData="<%= anchorData %>" cssClass="sign-in" href="<%= themeDisplay.getURLSignIn() %>" iconCssClass="icon-user" label="sign-in" />
</c:otherwise>
</c:choose>

View File

@ -0,0 +1,33 @@
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<aui:nav collapsible="<%= true %>" cssClass='<%= portalMessageUseAnimation ? "nav-account-controls" : "nav-account-controls nav-account-controls-notice" %>' icon="user" id="navAccountControls">
<c:if test="<%= userSetupComplete %>">
<%@ include file="/html/portlet/dockbar/view_page_customization_bar.jspf" %>
<c:if test="<%= themeDisplay.isShowStagingIcon() %>">
<aui:nav-item cssClass="staging-controls">
<liferay-portlet:runtime portletName="<%= PortletKeys.STAGING_BAR %>" />
</aui:nav-item>
</c:if>
<%@ include file="/html/portlet/dockbar/view_admin_links.jspf" %>
<%@ include file="/html/portlet/dockbar/view_my_sites.jspf" %>
</c:if>
<%@ include file="/html/portlet/dockbar/view_user_account.jspf" %>
</aui:nav>