diff --git a/ccm-bundle/bundles/demo/cfg/integration.properties b/ccm-bundle/bundles/demo/cfg/integration.properties index e3016a17e..80f9dbc67 100644 --- a/ccm-bundle/bundles/demo/cfg/integration.properties +++ b/ccm-bundle/bundles/demo/cfg/integration.properties @@ -117,10 +117,11 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-bundle.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws-generic -themedirector.file_extensions=bmp css gif jpeg jpg js png xml xsl # ccm-bundle (Loader only) diff --git a/ccm-bundle/bundles/devel/cfg/integration.properties b/ccm-bundle/bundles/devel/cfg/integration.properties index 9a30306ef..dfd1882ef 100644 --- a/ccm-bundle/bundles/devel/cfg/integration.properties +++ b/ccm-bundle/bundles/devel/cfg/integration.properties @@ -118,10 +118,11 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-bundle.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws-generic -themedirector.file_extensions=bmp css gif jpeg jpg js png xml xsl # ccm-bundle (Loader only) diff --git a/ccm-ldn-aplaws/bundles/base/cfg/integration.properties b/ccm-ldn-aplaws/bundles/base/cfg/integration.properties index 9321ea7fb..541b1602a 100755 --- a/ccm-ldn-aplaws/bundles/base/cfg/integration.properties +++ b/ccm-ldn-aplaws/bundles/base/cfg/integration.properties @@ -133,8 +133,10 @@ com.arsdigita.london.subsite.root_category_picker=com.arsdigita.london.terms.ui. # ccm-themedirector application -themedirector.default_theme_path=themes/static/aplaws -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-ldn-aplaws.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application diff --git a/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties b/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties index b25f484ea..f84ad4a86 100755 --- a/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties +++ b/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties @@ -133,8 +133,10 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-ldn-aplaws.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application diff --git a/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties b/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties index 1eb3d4c36..ad88427ec 100755 --- a/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties +++ b/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties @@ -132,8 +132,10 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-ldn-aplaws.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application diff --git a/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties b/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties index 1757c6bcb..fdd98d191 100755 --- a/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties +++ b/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties @@ -126,8 +126,10 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-ldn-aplaws.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application diff --git a/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties b/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties index a7e4f3988..def435bb9 100755 --- a/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties +++ b/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties @@ -131,8 +131,10 @@ com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCat # ccm-themedirector application -themedirector.default_theme_context= -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf +# Required to point to the package containing the theme to copy from when creating +# a new theme! (In addition to default_theme_path. Otherwise no files are copied! +themedirector.default_theme_manifest=ccm-ldn-aplaws.web.mf +# Required to denote the dir containing the default theme! themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application diff --git a/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java b/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java index 9326e20be..2b334eb02 100755 --- a/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java +++ b/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java @@ -64,13 +64,20 @@ public class ThemeDirectorConfig extends AbstractConfig { } // set of configuration parameters + // ///////////////////////////////////////////////////////////////// + /** Directory that all of the default themes are copied from. */ private final Parameter m_defaultThemePath = new StringParameter ("themedirector.default_theme_path", Parameter.OPTIONAL, "/themes/master/"); - /** Servlet context path containing the theme. */ + /** Servlet context path containing the default theme. + Previously ccm-themedirector used to be installed in its own + web context. In this case the appropriate web context should + be specified. + Currently, it is installed as part of the main application, + therefore it is empty by default. */ private final Parameter m_defaultThemeContext = new StringParameter ("themedirector.default_theme_context", @@ -79,7 +86,7 @@ public class ThemeDirectorConfig extends AbstractConfig { /** File containing the default themes directory. Used in conjuntion with com.arsdigita.themedirectory.default_directory_filter to dictate the - final default directoroy. */ + final default directory. */ private final Parameter m_defaultThemeManifest = new StringParameter ("themedirector.default_theme_manifest", @@ -193,7 +200,7 @@ public class ThemeDirectorConfig extends AbstractConfig { } /** - * This returns the name of the servlet context containing + * This returns the name of the servlet context containing * the default theme */ public String getDefaultThemeContext() { diff --git a/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java b/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java index 1fc255985..c6e9656d9 100755 --- a/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java +++ b/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java @@ -137,30 +137,30 @@ public class ThemeDownloadServlet extends BaseServlet implements ThemeDirectorCo DispatcherHelper.maybeCacheDisable(sresp); sresp.setContentType("application/zip; charset=UTF-8"); - // The WebAppRoot should be something like this: - // /var/ccm-devel/web///webapps/ccm-ldn-theme; - // and we actually want the webapps directory - File currentRoot = new File(Web.getServletContext().getRealPath("/")); - File webapps = currentRoot.getParentFile(); + // Want the path in the filesystem to webcontext of this application + // (i.e. context root / document root) + File applicationRoot = new File(Web.getServletContext().getRealPath("/")); - // if we have a Theme, we send back either prod or dev, depending on - // the url. If we don't have a theme, then we return everything. if (theme != null) { - File downloadFiles = null; - String prefix = null; + // if we have a Theme, we send back either prod or dev, depending on + // the url. + File downloadFiles = null; // Path to the actual theme to download + String prefix = null; // Wether devel or prod // If "themes-prod" is ever moved to a different directory, // we could then get rid of the "type" argument (see below in // DirectoryFilter) String type = null; + // Determine the path, dependet of devel / prod if (sreq.getPathInfo().indexOf("/" + PUBLISHED_PREFIX) > -1) { prefix = PUBLISHED_PREFIX; - downloadFiles = new File(currentRoot, PROD_THEMES_BASE_DIR); + downloadFiles = new File(applicationRoot, PROD_THEMES_BASE_DIR); type = PROD_DIR_STUB; } else { - downloadFiles = new File(currentRoot, DEV_THEMES_BASE_DIR); + downloadFiles = new File(applicationRoot, DEV_THEMES_BASE_DIR); prefix = DEVELOPMENT_PREFIX; type = DEV_DIR_STUB; } + sresp.setHeader("Content-Disposition", "attachment; filename=\"" + prefix + theme.getURL() + ".zip\""); @@ -170,12 +170,19 @@ public class ThemeDownloadServlet extends BaseServlet implements ThemeDirectorCo Files.listFilesInTree(downloadFiles, new DirectoryFilter(theme.getURL(), type)), downloadFiles); + } else if (theme == null) { - // we have to create our own config becuase no other + // If we don't have a theme, then we return everything (i.e. the + // web tree of each module installed). + + // Get a list of all installed packages by querying + // registry.properties from registry. + // We have to create our own config instance because no other // classes provide access to one RegistryConfig rc = new RegistryConfig(); rc.load(); String[] packages = rc.getPackages(); + ClassLoader loader = Thread.currentThread().getContextClassLoader(); sresp.setHeader("Content-Disposition", @@ -191,18 +198,16 @@ public class ThemeDownloadServlet extends BaseServlet implements ThemeDirectorCo new ZipWriterManifestReader(is, out, current, packages[i]); reader.setFileName(packages[i]); - reader.processFile(); + reader.processFile(); // 2012-05 (PB): Doesn't work! } else { s_log.warn("Unable to open up resource " + current); } } - // Special case add the auto-generated XSL fiel for content types + // Special case add the auto-generated XSL file for content types Iterator paths = ContentType.getXSLFileURLs(); out.putNextEntry(new ZipEntry("waf-xsl/themes/servlet/content-type/index.xsl")); - IO.copy(multiplexXSLFiles(paths), - out); - + IO.copy(multiplexXSLFiles(paths), out); out.close(); } diff --git a/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java b/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java index dc31c8076..b59e67c63 100755 --- a/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java +++ b/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java @@ -110,13 +110,20 @@ public class ThemeControlPanel extends SelectionPanel implements ThemeDirectorCo getBody().connect(addThemeLink, m_themeForm); addAction(addThemeLink, ActionGroup.ADD); - getBody().add(new Label(GlobalizationUtil.globalize("theme.download_default_base_styles"))); - + // add the "Download default base styxle" form + // PB 2012-05: Download in ThemeDownloadServlet doesn't work, commented + // out for now. Not useful anyway because it downloads web tree of every + // package installed, probably filtered by theme file extensions (xsl, + // css, etc). +/* + getBody().add(new Label(GlobalizationUtil + .globalize("theme.download_default_base_styles"))); Link downloadFilesLink = new Link(new Label(GlobalizationUtil.globalize ("theme.download_default_base_styles")), "download/" + ALL_STYLES_ZIP_NAME); addAction(downloadFilesLink, ActionGroup.ADD); - +*/ + // add the "Select Standard Theme" form Form defaultThemeForm = createDefaultThemeForm(); addAction( defaultThemeForm ); } diff --git a/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java b/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java index 8bb144d48..08470bcb5 100755 --- a/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java +++ b/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java @@ -74,10 +74,11 @@ public class ThemeXSLParameterGenerator implements XSLParameterGenerator, } if (themeURL != null) { - // modified as ccm-ldn-theme is no longer installed in its own context + // modified as ccm-themedirector (previously ccm-ldn-theme) is + // no longer installed in its own context // return "/" + WEB_APP_NAME + "/" + THEMES_DIR + "/" + // If we want to install it as a separate web application again we - // should find a way to determin the name from a central configuration + // should find a way to determine the name from a central configuration return "/" + THEMES_DIR + "/" + Web.getContext().getRequestURL().getContextPath() + baseDir + themeURL;