diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..0f4a4c2 --- /dev/null +++ b/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..61611cc --- /dev/null +++ b/.project @@ -0,0 +1,42 @@ + + + social-dockbar-hook + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..b72a6a4 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..8fb0e26 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..69c31cd --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..e6f7678 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles=Liferay-v6.2-CE-(Tomcat-7)-(2) +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..d68ab1c --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..1e1fabd --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..a434e9f --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -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 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c31269c --- /dev/null +++ b/pom.xml @@ -0,0 +1,88 @@ + + + + 4.0.0 + org.gcube.portal.liferay + social-dockbar-hook + war + social-dockbar-hook Hook + 1.0.0-SNAPSHOT + + + + com.liferay.maven.plugins + liferay-maven-plugin + ${liferay.maven.plugin.version} + + ${liferay.auto.deploy.dir} + ${liferay.app.server.deploy.dir} + ${liferay.app.server.lib.global.dir} + ${liferay.app.server.portal.dir} + ${liferay.version} + hook + + + + maven-compiler-plugin + 2.5 + + UTF-8 + 1.6 + 1.6 + + + + maven-resources-plugin + 2.5 + + UTF-8 + + + + + + + com.liferay.portal + portal-service + ${liferay.version} + provided + + + com.liferay.portal + util-java + ${liferay.version} + provided + + + javax.portlet + portlet-api + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.servlet.jsp + jsp-api + 2.0 + provided + + + + + Liferay-v6.2-CE-(Tomcat-7)-(2) + + 6.2.5 + 6.2.5 + /Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-hook.xml b/src/main/webapp/WEB-INF/liferay-hook.xml new file mode 100644 index 0000000..530f1d5 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-hook.xml @@ -0,0 +1,6 @@ + + + + + /custom_jsps + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..9e27d8b --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -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 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7d8c082 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf new file mode 100644 index 0000000..c61b903 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/custom_dockbar_view.jspf @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/init-ext.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/init-ext.jsp new file mode 100644 index 0000000..8aa75ad --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/init-ext.jsp @@ -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. + */ +--%> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/init.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/init.jsp new file mode 100644 index 0000000..363f064 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/init.jsp @@ -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" %> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/preview_panel.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/preview_panel.jsp new file mode 100644 index 0000000..cf6b8d1 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/preview_panel.jsp @@ -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" %> + +
+ + +

+ + + +
+ + 100% +
+
+ + +
+ + 768px +
+
+ + +
+ + 1024px +
+
+ + +
+ + 1280px +
+
+ + +

(px)

+ + × +
+
+ +
+ +
+
+ + + var devicePreview = new Liferay.Dockbar.DevicePreview( + { + devices: { + autosize: { + skin: 'autosize' + }, + custom: { + height: '#height', + resizable: true, + width: '#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: '#height', + inputWidth: '#width', + namespace: '' + } + ); + + Liferay.once('dockbarHidePanel', A.bind('destroy', devicePreview)); + \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/view.jsp new file mode 100644 index 0000000..0f428b6 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view.jsp @@ -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")); +%> + + + + <%@ include file="/html/portlet/dockbar/custom_dockbar_view.jspf" %> + + + + + <% + 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()); + } + %> + + +
+ "> + + + + + + + +

+ + + <%@ include file="/html/portal/layout/view/control_panel_site_selector.jspf" %> + + / + + + + + + + + + + + + + + + + +

+
+
+
+ + <% + String controlPanelCategory = themeDisplay.getControlPanelCategory(); + %> + + + + + + <% + 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"; + } + %> + + + + + + <% + } + %> + + + + + + <% + 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)); + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%@ include file="/html/portlet/dockbar/view_user_panel.jspf" %> +
+ +
+
+ +
+ + +
+ +<% +List layoutPrototypes = LayoutPrototypeServiceUtil.search(company.getCompanyId(), Boolean.TRUE, null); +%> + + +
+ +
+
+ + + Liferay.Dockbar.init('#dockbar'); + + var customizableColumns = A.all('.portlet-column-content.customizable'); + + if (customizableColumns.size() > 0) { + customizableColumns.get('parentNode').addClass('customizable'); + } + + +<%! +private boolean _hasPortlets(String category, ThemeDisplay themeDisplay) throws SystemException { + List portlets = PortalUtil.getControlPanelPortlets(category, themeDisplay); + + if (portlets.isEmpty()) { + return false; + } + + return true; +} +%> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_admin_links.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_admin_links.jspf new file mode 100644 index 0000000..0101ff1 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_admin_links.jspf @@ -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. + */ +--%> + + + + + + + <% + Map> categoriesMap = PortalUtil.getSiteAdministrationCategoriesMap(request); + + if (!categoriesMap.isEmpty()) { + String currentSiteCategory = PortletCategoryKeys.CURRENT_SITE.concat(StringPool.PERIOD); + %> + +
    + + <% + for (String category : categoriesMap.keySet()) { + String url = HttpUtil.setParameter(themeDisplay.getURLSiteAdministration(), "controlPanelCategory", StringUtil.replace(category, PortletCategoryKeys.SITE_ADMINISTRATION, currentSiteCategory)); + %> + + + + <% + } + %> + +
+ + <% + } + %> + +
+
+ + + + +
+ + +
\ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_category.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_category.jsp new file mode 100644 index 0000000..c0f22fe --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_category.jsp @@ -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 categories = ListUtil.fromCollection(portletCategory.getCategories()); + +categories = ListUtil.sort(categories, new PortletCategoryComparator(locale)); + +List portlets = new ArrayList(); + +Set 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()); +%> + +
+ + + + + <% + 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); + %> + + + + + + <% + 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; + } + %> + + + + + <% + Map data = new HashMap(); + + 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"; + } + %> + + + class="<%= cssClass %>"> + "> + + + + + <% + data.remove("draggable"); + %> + + class='add-content-item <%= portletLocked ? "lfr-portlet-used" : StringPool.BLANK %>'> + + + + + <% + List 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 portletItemData = new HashMap(); + + 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())); + %> + + + class="<%= cssClass %>"> + "> + + + + + class='add-content-item <%= portletLocked ? "lfr-portlet-used" : StringPool.BLANK %>'> + + + + + <% + } + %> + + + + + + + + <% + } + %> + + + +
+ + + +<% +} +%> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_my_sites.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_my_sites.jspf new file mode 100644 index 0000000..0710639 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_my_sites.jspf @@ -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. + */ +--%> + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_page_customization_bar.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_page_customization_bar.jspf new file mode 100644 index 0000000..b8a2bac --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_page_customization_bar.jspf @@ -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; +%> + + + + <% + boolean dockbarMessagesHidden = GetterUtil.getBoolean(SessionClicks.get(request, "dockbarMessagesHidden", "false")); + %> + + +
+ +
+
+ + + + + +
+ +
+ + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + <% + 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"; + } + %> + + + + + + + + + + + <% + 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.provide( + window, + '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'] + ); + +
+ + + var toggleCustomizedView = A.one('#toggleCustomizedView'); + + if (toggleCustomizedView) { + toggleCustomizedView.on('click', toggleCustomizedView); + } + +
+
+ + +
+ + + + +
+
+
+ + + 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')); + } + ); + +
+
\ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_resources.jsp b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_resources.jsp new file mode 100644 index 0000000..bb4aeaf --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_resources.jsp @@ -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"); +%> + + + +
+ + <% + 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"; + } + %> + + + + + <% + 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 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 data = new HashMap(); + + 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"; + } + %> + + + + +
"> + <liferay-ui:message key=" src="<%= HtmlUtil.escapeAttribute(assetRenderer.getThumbnailPath(liferayPortletRequest)) %>" /> +
+ +
"> +
+ <%= title %> +
+ +
+ <%= HtmlUtil.escape(StringUtil.shorten(assetRenderer.getSummary(themeDisplay.getLocale()), 120)) %> +
+
+
+ +
class="add-content-item"> + +
+
+
+
+ + <% + } + %> + +
+
+
+
+ + + + <% + long classPK = ParamUtil.getLong(request, "classPK"); + String className = ParamUtil.getString(request, "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); + %> + +
+ +
+
+
+
\ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.jspf new file mode 100644 index 0000000..e794724 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.jspf @@ -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. + */ +--%> + + + + <% + request.setAttribute(WebKeys.RENDER_PORTLET_BOUNDARY, false); + %> + + + + <% + request.removeAttribute(WebKeys.RENDER_PORTLET_BOUNDARY); + %> + + + + +<%@ include file="/html/portlet/dockbar/view_user_account.portal.jspf" %> \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.portal.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.portal.jspf new file mode 100644 index 0000000..5dfaa5d --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.portal.jspf @@ -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-ui:message key=" class="user-avatar-image" src="<%= HtmlUtil.escape(user.getPortraitURL(themeDisplay)) %>" /> + + + <%= HtmlUtil.escape(user.getFullName()) %> + + + + + + + + + <% + 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())}); + } + %> + +
<%= impersonatingUserLabel %>
+ + + (<%= HtmlUtil.escape(realUser.getFullName()) %>) + + + + + <% + Locale realUserLocale = realUser.getLocale(); + Locale userLocale = user.getLocale(); + %> + + + + <% + 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)); + } + %> + + + +
+ + + <% + List mySiteGroups = user.getMySiteGroups(new String[] {User.class.getName()}, false, QueryUtil.ALL_POS); + + for (Group mySiteGroup : mySiteGroups) { + %> + + + + <% + 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); + %> + +
  • + + + + + +
  • +
    + + + + <% + 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); + %> + +
  • + + + + + +
  • +
    + + <% + } + %> + + <% + String myAccountURL = themeDisplay.getURLMyAccount().toString(); + + myAccountURL = HttpUtil.setParameter(myAccountURL, "controlPanelCategory", PortletCategoryKeys.MY); + %> + + +
    + + + + +
    +
    + + + <% + Map anchorData = new HashMap(); + + anchorData.put("redirect", String.valueOf(PortalUtil.isLoginRedirectRequired(request))); + %> + + + +
    \ No newline at end of file diff --git a/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_panel.jspf b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_panel.jspf new file mode 100644 index 0000000..9a517b3 --- /dev/null +++ b/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_panel.jspf @@ -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. + */ +--%> + + + + <%@ include file="/html/portlet/dockbar/view_page_customization_bar.jspf" %> + + + + + + + + <%@ include file="/html/portlet/dockbar/view_admin_links.jspf" %> + + <%@ include file="/html/portlet/dockbar/view_my_sites.jspf" %> + + + <%@ include file="/html/portlet/dockbar/view_user_account.jspf" %> + \ No newline at end of file