summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-12-14 02:59:37 (EST)
committer Stephan Born2013-01-25 12:35:56 (EST)
commitc4d0a5e4588ecf14dbb71c2635d6f1776b1967bd (patch)
treef8aa1e212fc5127131b610768392aea0d7400e9f
parent9361c11af56152251046c55a900490883aa48320 (diff)
downloadorg.eclipse.stardust.ui.web-c4d0a5e4588ecf14dbb71c2635d6f1776b1967bd.zip
org.eclipse.stardust.ui.web-c4d0a5e4588ecf14dbb71c2635d6f1776b1967bd.tar.gz
org.eclipse.stardust.ui.web-c4d0a5e4588ecf14dbb71c2635d6f1776b1967bd.tar.bz2
Jira-ID: CRNT-27121
Added PluginResourceUtils.java to get the Plugin skins folder paths Added method in IppThemeProvider to retrieve the Plugin themes from PluginResourceUtils. Added equals and hashCode in IppTheme class Made changes to existing SkinContentServlet.java to retrieve from plugin if filePath contains plugin_id. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@61574 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--portal-api/src/main/java/org/eclipse/stardust/ui/client/dms/SkinContentServlet.java151
-rw-r--r--portal-api/src/main/java/org/eclipse/stardust/ui/client/util/PluginResourceUtils.java153
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java3
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppTheme.java34
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppThemeProvider.java105
5 files changed, 390 insertions, 56 deletions
diff --git a/portal-api/src/main/java/org/eclipse/stardust/ui/client/dms/SkinContentServlet.java b/portal-api/src/main/java/org/eclipse/stardust/ui/client/dms/SkinContentServlet.java
index 3c41475..711c98b 100644
--- a/portal-api/src/main/java/org/eclipse/stardust/ui/client/dms/SkinContentServlet.java
+++ b/portal-api/src/main/java/org/eclipse/stardust/ui/client/dms/SkinContentServlet.java
@@ -10,10 +10,15 @@
*******************************************************************************/
package org.eclipse.stardust.ui.client.dms;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.List;
+import java.util.Map;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
@@ -25,6 +30,7 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
+import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.Function;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.common.config.ExtensionProviderUtils;
@@ -43,6 +49,7 @@ import org.eclipse.stardust.engine.core.runtime.beans.ForkingServiceFactory;
import org.eclipse.stardust.engine.core.runtime.beans.interceptors.PropertyLayerProviderInterceptor;
import org.eclipse.stardust.engine.core.runtime.beans.removethis.SecurityProperties;
import org.eclipse.stardust.engine.core.runtime.removethis.EngineProperties;
+import org.eclipse.stardust.ui.client.util.PluginResourceUtils;
import org.eclipse.stardust.vfs.IDocumentRepositoryService;
import org.eclipse.stardust.vfs.IFile;
import org.eclipse.stardust.vfs.IFolder;
@@ -79,6 +86,8 @@ public class SkinContentServlet extends AbstractVfsContentServlet
public static final String SKIN_PREF_ID = "preference";
public static final String SKIN_PREF_KEY = "ipp-portal-common.configuration.prefs.skin";
public static final String EJB = "ejb";
+ public static final String PLUGIN_FOLDER_PATH = "/public/skins";
+ public static final String PLUGIN_ROOT_FOLDER_PATH = "/plugins/";
private boolean ejbEnvironment = false;
private String context;
@@ -121,63 +130,71 @@ public class SkinContentServlet extends AbstractVfsContentServlet
{
try
{
- Repository repository = null;
-
- if (ejbEnvironment)
+ if (skinFolder.contains(PLUGIN_FOLDER_PATH))
{
- Context context = new InitialContext();
- String path = parameters.getString("ejb.contentRepository.path",
- "java:comp/env/jcr/ContentRepository");
- repository = (javax.jcr.Repository) context.lookup(path);
+ return loadPluginSkin(skinFolder, request.resourceName, downloadManager);
}
else
{
- IDocumentRepositoryService drs = rtEnv.getDocumentRepositoryService();
- if (null != drs && drs instanceof JcrDocumentRepositoryService)
+ Repository repository = null;
+ if (ejbEnvironment)
+ {
+ Context context = new InitialContext();
+ String path = parameters.getString("ejb.contentRepository.path",
+ "java:comp/env/jcr/ContentRepository");
+ repository = (javax.jcr.Repository) context.lookup(path);
+ }
+ else
{
- JcrDocumentRepositoryService jcrDocumentRepositoryService = (JcrDocumentRepositoryService) drs;
- ISessionFactory sessionFactory = jcrDocumentRepositoryService.getSessionFactory();
- if (sessionFactory instanceof JcrSpringSessionFactory)
+ IDocumentRepositoryService drs = rtEnv.getDocumentRepositoryService();
+ if (null != drs && drs instanceof JcrDocumentRepositoryService)
{
- repository = ((JcrSpringSessionFactory) sessionFactory).getRepository();
+ JcrDocumentRepositoryService jcrDocumentRepositoryService = (JcrDocumentRepositoryService) drs;
+ ISessionFactory sessionFactory = jcrDocumentRepositoryService.getSessionFactory();
+ if (sessionFactory instanceof JcrSpringSessionFactory)
+ {
+ repository = ((JcrSpringSessionFactory) sessionFactory).getRepository();
+ }
}
}
- }
- if (null == repository)
- {
- throw new PublicException("No JCR document repository is set. Check the configuration.");
- }
+ if (null == repository)
+ {
+ throw new PublicException(
+ "No JCR document repository is set. Check the configuration.");
+ }
- JcrDocumentRepositoryService jcrDocumentRepService = new JcrDocumentRepositoryService();
- jcrDocumentRepService.setSessionFactory(new IppSkinJcrSessionFactory(repository));
+ JcrDocumentRepositoryService jcrDocumentRepService = new JcrDocumentRepositoryService();
+ jcrDocumentRepService.setSessionFactory(new IppSkinJcrSessionFactory(repository));
- IFolder folder = jcrDocumentRepService.getFolder(skinFolder);
- String skinId = folder.getName();
+ IFolder folder = jcrDocumentRepService.getFolder(skinFolder);
+ String skinId = folder.getName();
- request.resourceFullPath = request.resourceFullPath.replaceFirst(DEFAULT_SKIN_URI, skinId);
+ request.resourceFullPath = request.resourceFullPath
+ .replaceFirst(DEFAULT_SKIN_URI, skinId);
- IFile file = jcrDocumentRepService.getFile(request.resourceFullPath);
- if (null != file)
- {
- downloadManager.setContentLength((int) file.getSize());
- downloadManager.setContentType(file.getContentType());
-
- if (!StringUtils.isEmpty(file.getEncoding()))
+ IFile file = jcrDocumentRepService.getFile(request.resourceFullPath);
+ if (null != file)
{
- downloadManager.setContentEncoding(file.getEncoding());
- }
- downloadManager.setFilename(file.getName());
+ downloadManager.setContentLength((int) file.getSize());
+ downloadManager.setContentType(file.getContentType());
- jcrDocumentRepService.retrieveFileContent(request.resourceFullPath,
- downloadManager.getContentOutputStream());
+ if (!StringUtils.isEmpty(file.getEncoding()))
+ {
+ downloadManager.setContentEncoding(file.getEncoding());
+ }
+ downloadManager.setFilename(file.getName());
- result = HttpServletResponse.SC_OK;
- }
- else
- {
- // file not found
- result = HttpServletResponse.SC_NOT_FOUND;
+ jcrDocumentRepService.retrieveFileContent(request.resourceFullPath,
+ downloadManager.getContentOutputStream());
+
+ result = HttpServletResponse.SC_OK;
+ }
+ else
+ {
+ // file not found
+ result = HttpServletResponse.SC_NOT_FOUND;
+ }
}
}
catch (RepositoryOperationFailedException rofe)
@@ -240,6 +257,56 @@ public class SkinContentServlet extends AbstractVfsContentServlet
return "";
}
}
+
+ /**
+ *
+ * @param skinFolder
+ * @param fileName
+ * @param downloadManager
+ * @return
+ * @throws IOException
+ */
+ private int loadPluginSkin(String skinFolder, String fileName, ContentDownloadController downloadManager) throws IOException
+ {
+ Map<String, List<String>> pluginAvailableSkins = PluginResourceUtils
+ .findPluginSkins(PLUGIN_FOLDER_PATH, fileName);
+
+ if (!CollectionUtils.isEmpty(pluginAvailableSkins))
+ {
+ for (Map.Entry<String, List<String>> entry : pluginAvailableSkins.entrySet())
+ {
+ if (entry.getKey().equals(skinFolder))
+ {
+ for (String filePath : entry.getValue())
+ {
+ File file = new File(filePath);
+ {
+ downloadManager.setContentLength((int) file.length());
+ downloadManager.setFilename(file.getName());
+ byte[] bbuf = new byte[4096];
+ DataInputStream in = new DataInputStream(new FileInputStream(file));
+ int length = 0;
+ OutputStream op = downloadManager.getContentOutputStream();
+ while ((in != null) && ((length = in.read(bbuf)) != -1))
+ {
+ op.write(bbuf, 0, length);
+ }
+
+ in.close();
+ op.flush();
+ op.close();
+ }
+ }
+ }
+ else
+ {
+ return HttpServletResponse.SC_NO_CONTENT;
+ }
+ return HttpServletResponse.SC_OK;
+ }
+ }
+ return HttpServletResponse.SC_NO_CONTENT;
+ }
@Override
protected int doUploadFileContent(final String fileUri, final InputStream contentStream, final int contentLength,
@@ -258,6 +325,7 @@ public class SkinContentServlet extends AbstractVfsContentServlet
result.partitionId = uri.substring(0, uri.indexOf("/"));
result.resource = uri.substring(uri.indexOf("/"));
+ result.resourceName = uri.substring(uri.lastIndexOf("/") + 1);
result.resourceFullPath = getSkinsFolderBasePath(result.partitionId) + result.resource;
return result;
@@ -338,6 +406,7 @@ public class SkinContentServlet extends AbstractVfsContentServlet
public String partitionId;
public String resource;
public String resourceFullPath;
+ public String resourceName;
}
private String getJcrUserProperty()
diff --git a/portal-api/src/main/java/org/eclipse/stardust/ui/client/util/PluginResourceUtils.java b/portal-api/src/main/java/org/eclipse/stardust/ui/client/util/PluginResourceUtils.java
new file mode 100644
index 0000000..f48790b
--- /dev/null
+++ b/portal-api/src/main/java/org/eclipse/stardust/ui/client/util/PluginResourceUtils.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.ui.client.util;
+
+import static java.util.Collections.emptyList;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.stardust.common.CollectionUtils;
+import org.eclipse.stardust.common.log.LogManager;
+import org.eclipse.stardust.common.log.Logger;
+import org.eclipse.stardust.common.utils.io.CloseableUtil;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+
+/**
+ *
+ * @author Sidharth.Singh
+ * @version $Revision: $
+ */
+public class PluginResourceUtils
+{
+ public static final Logger trace = LogManager.getLogger(PluginResourceUtils.class);
+ private static ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+
+ /**
+ *
+ * @param pluginFolder
+ * @param fileName
+ * @return
+ */
+ public static Map<String, List<String>> findPluginSkins(String pluginFolder, String fileName)
+ {
+ Map<String, List<String>> allExtensions = new TreeMap<String, List<String>>(new Comparator<String>()
+ {
+ public int compare(String a, String b)
+ {
+ return b.compareTo(a);
+ }
+ });
+ try
+ {
+ Resource[] resources = resolver.getResources("classpath*:/META-INF/*.portal-plugin");
+ for (Resource resource : resources)
+ {
+ String pluginId = resource.getFilename().substring(0, resource.getFilename().lastIndexOf("."));
+ String webUriPrefix = pluginId + "/";
+
+ InputStream isPluginDescriptor = resource.getInputStream();
+ try
+ {
+ String firstLine = new BufferedReader(new InputStreamReader(isPluginDescriptor)).readLine();
+ Resource webContentReader = resource.createRelative("../").createRelative(firstLine);
+ String webContentBaseUri = webContentReader.getURI().toString();
+ if (!webContentBaseUri.endsWith("/"))
+ {
+ webContentBaseUri += "/";
+ }
+
+ List<Resource> extensionResources;
+ try
+ {
+ extensionResources = discoverModelerExtensions(resolver, webContentBaseUri, pluginFolder, fileName);
+ }
+ // JBoss is throwing an IOException instead of FileNotFoundException if a
+ // file cannot be found
+ catch (IOException ioe)
+ {
+ // failed discovering, skip category for this plugin
+ extensionResources = emptyList();
+ }
+
+ for (Resource extensionResource : extensionResources)
+ {
+ // File URI
+ String extensionResUri = extensionResource.getURI().toString();
+ // Create webURi something like <plugin-id> + public/skins + folder
+ // containing file ex: <views-common/public/skins/skin1/images>
+ String extensionWebUri = webUriPrefix + extensionResUri.substring(webContentBaseUri.length());
+ // Split the above path to create 2 paths ex: a) <views-common> b)
+ // skin1/images
+ String[] splitArr = extensionWebUri.split(pluginFolder + "/");
+
+ String extensionWebUriKey = webUriPrefix.substring(0, webUriPrefix.lastIndexOf("/")) + pluginFolder
+ + "/" + splitArr[1].substring(0, splitArr[1].indexOf("/"));
+
+ File extResourceFile = extensionResource.getFile();
+ List<String> resourceFile = allExtensions.get(extensionWebUri);
+ if (null == resourceFile)
+ {
+ resourceFile = CollectionUtils.newArrayList();
+ allExtensions.put(extensionWebUriKey, resourceFile);
+ }
+ resourceFile.add(extResourceFile.getPath());
+ trace.info("Discovered '" + pluginFolder + "' modeler extensions descriptor at " + extensionWebUri);
+ }
+ }
+ finally
+ {
+ CloseableUtil.closeQuietly(isPluginDescriptor);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return allExtensions;
+
+ }
+
+ /**
+ *
+ * @param resolver
+ * @param modelerExtensionsBaseUri
+ * @param category
+ * @param fileName
+ * @return
+ * @throws IOException
+ */
+ private static List<Resource> discoverModelerExtensions(ResourcePatternResolver resolver,
+ String modelerExtensionsBaseUri, String category, String fileName) throws IOException
+ {
+ List<Resource> extensions = CollectionUtils.newArrayList();
+ Resource[] jsModules = null;
+ if (null == fileName)
+ jsModules = resolver.getResources(modelerExtensionsBaseUri + category + "/*/*.*");
+ else
+ jsModules = resolver.getResources(modelerExtensionsBaseUri + category + "/**/" + fileName);
+ for (Resource jsModule : jsModules)
+ {
+ extensions.add(jsModule);
+ }
+
+ return extensions;
+ }
+}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
index 7468f1a..6b00567 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/Constants.java
@@ -66,6 +66,9 @@ public class Constants
public static final String ROOT_GRID = "rootGrid";
+ public static final String PLUGIN_FOLDER_PATH = "/public/skins";
+ public static final String PLUGIN_ROOT_FOLDER_PATH = "/plugins/";
+
public ActivityInstanceStates getActivityInstanceState()
{
return activityInstanceStates;
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppTheme.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppTheme.java
index 5309ea2..2055368 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppTheme.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppTheme.java
@@ -39,4 +39,38 @@ public class IppTheme implements Theme
{
return themeName;
}
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((themeName == null) ? 0 : themeName.hashCode());
+ return result;
+ }
+
+ /**
+ * JCR and Plugin themes can have same name, override equals/hashcode to prevent
+ * duplicate theme names
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IppTheme other = (IppTheme) obj;
+ if (themeName == null)
+ {
+ if (other.themeName != null)
+ return false;
+ }
+ else if (!themeName.equals(other.themeName))
+ return false;
+ return true;
+ }
+
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppThemeProvider.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppThemeProvider.java
index aa14146..d4195cb 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppThemeProvider.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/spi/theme/impl/IppThemeProvider.java
@@ -10,10 +10,16 @@
*******************************************************************************/
package org.eclipse.stardust.ui.web.viewscommon.common.spi.theme.impl;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.common.config.Parameters;
import org.eclipse.stardust.engine.api.runtime.Document;
@@ -21,10 +27,12 @@ import org.eclipse.stardust.engine.api.runtime.DocumentManagementService;
import org.eclipse.stardust.engine.api.runtime.Folder;
import org.eclipse.stardust.engine.core.repository.IRepositoryManager;
import org.eclipse.stardust.engine.core.repository.RepositorySpaceKey;
+import org.eclipse.stardust.ui.client.util.PluginResourceUtils;
import org.eclipse.stardust.ui.web.common.spi.theme.Theme;
import org.eclipse.stardust.ui.web.common.spi.theme.ThemeProvider;
import org.eclipse.stardust.ui.web.common.util.MessagePropertiesBean;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
+import org.eclipse.stardust.ui.web.viewscommon.common.Constants;
import org.eclipse.stardust.ui.web.viewscommon.login.dialogs.LoginDialogBean;
import org.eclipse.stardust.ui.web.viewscommon.utils.DMSHelper;
@@ -44,7 +52,9 @@ public class IppThemeProvider implements ThemeProvider
private static List<Theme> availableThemes;
private String themeId;
+ private String loginStyleSheet;
private List<String> themeStyleSheets;
+ private Map<String, List<String>> pluginAvailableSkins;
/**
*
@@ -53,50 +63,82 @@ public class IppThemeProvider implements ThemeProvider
{
}
- /* (non-Javadoc)
- * @see org.eclipse.stardust.ui.web.common.spi.theme.ThemeProvider#loadTheme(java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.stardust.ui.web.common.spi.theme.ThemeProvider#loadTheme(java.lang.String
+ * )
*/
public void loadTheme(String themeId)
{
this.themeId = themeId;
+ availableThemes = new ArrayList<Theme>();
+ themeStyleSheets = new ArrayList<String>();
+ availableThemes.add(new IppTheme("", MessagePropertiesBean.getInstance().getString(
+ "views.configurationPanel.skins.defaultSkin")));
+
+ Set<Theme> availableThemesSet = CollectionUtils.newHashSet();
+
+ availableThemesSet.addAll(bootstrapThemes());
+ availableThemesSet.addAll(bootstrapPluginThemes());
+
+ availableThemes.addAll(availableThemesSet);
+
+ loginStyleSheet = Parameters.instance().getString(LoginDialogBean.LOGIN_SKIN_CSS_PARAM,
+ LoginDialogBean.DEFAULT_LOGIN_SKIN_CSS_NAME);
- bootstrapThemes();
loadThemeStyleSheets();
+ loadPluginThemeStyleSheets();
}
/**
*
*/
- private void bootstrapThemes()
+ private Set<Theme> bootstrapThemes()
{
- availableThemes = new ArrayList<Theme>();
- availableThemes.add(new IppTheme("", MessagePropertiesBean.getInstance().getString(
- "views.configurationPanel.skins.defaultSkin")));
+ Set<Theme> availableJCRThemes = new HashSet<Theme>();
List<Folder> skins = getSkinsFolders();
for (Folder skinFolder : skins)
{
- availableThemes.add(new IppTheme(skinFolder.getId(), skinFolder.getName()));
+ availableJCRThemes.add(new IppTheme(skinFolder.getId(), skinFolder.getName()));
}
+ return availableJCRThemes;
+ }
+
+ /**
+ * Load the plugin themes from /public/skins folder
+ */
+ private Set<Theme> bootstrapPluginThemes()
+ {
+ Set<Theme> availablePluginThemes = new HashSet<Theme>();
+
+ pluginAvailableSkins = PluginResourceUtils.findPluginSkins(Constants.PLUGIN_FOLDER_PATH, null);
+
+ for (Map.Entry<String, List<String>> entry : pluginAvailableSkins.entrySet())
+ {
+ String key = entry.getKey();
+ availablePluginThemes.add(new IppTheme(key, key.substring(key.lastIndexOf("/")+1)));
+ }
+ return availablePluginThemes;
}
/**
+ * @throws IOException
*
*/
- private void loadThemeStyleSheets()
+ private void loadThemeStyleSheets()
{
String skinFolderId = themeId;
- themeStyleSheets = new ArrayList<String>();
+ List<String> jcrStyleSheets = new ArrayList<String>();
if (StringUtils.isNotEmpty(skinFolderId))
{
Folder skinRoot = getSkinsRootFolder();
if (null != skinRoot)
{
- String loginStyleSheet = Parameters.instance().getString(LoginDialogBean.LOGIN_SKIN_CSS_PARAM,
- LoginDialogBean.DEFAULT_LOGIN_SKIN_CSS_NAME);
-
List<Folder> allSkinFolders = getSkinsFolders();
for (Folder skinFolder : allSkinFolders)
{
@@ -113,14 +155,47 @@ public class IppThemeProvider implements ThemeProvider
{
String path = skinFile.getPath();
path = path.replace(skinRoot.getPath() + "/", "");
- themeStyleSheets.add(THEME_SERVLET_PATH + path);
+ jcrStyleSheets.add(THEME_SERVLET_PATH + path);
}
}
break;
}
}
+ themeStyleSheets.addAll(jcrStyleSheets);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private void loadPluginThemeStyleSheets()
+ {
+ String skinFolderId = themeId;
+ List<String> pluginStyleSheets = new ArrayList<String>();
+
+ if (StringUtils.isNotEmpty(skinFolderId))
+ {
+ Set<String> allSkinFolders = pluginAvailableSkins.keySet();
+ for (String skinFolder : allSkinFolders)
+ {
+ if (skinFolder.equals(skinFolderId))
+ {
+ List<String> documents = pluginAvailableSkins.get(skinFolder);
+ for (String skinFile : documents)
+ {
+ if (skinFile.toLowerCase().endsWith(".css") && !loginStyleSheet.equals(skinFile))
+ {
+ String path = Constants.PLUGIN_ROOT_FOLDER_PATH + skinFolderId + "/"
+ + skinFile.substring(skinFile.lastIndexOf("\\") + 1);
+ pluginStyleSheets.add(path);
+ }
+ }
+ break;
+ }
}
+ themeStyleSheets.addAll(pluginStyleSheets);
}
}
@@ -164,7 +239,7 @@ public class IppThemeProvider implements ThemeProvider
}
return null;
}
-
+
/**
* @param folder
*/