Author: pboy Date: 2012-05-18 01:12:17 +0000 (Fri, 18 May 2012) New Revision: 2322 Modified: trunk/ccm-bundle/bundles/demo/cfg/integration.properties trunk/ccm-bundle/bundles/devel/cfg/integration.properties trunk/ccm-ldn-aplaws/bundles/base/cfg/integration.properties trunk/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties trunk/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties trunk/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties trunk/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties trunk/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java trunk/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java Log: Fixed minor configuration issue (create new theme files from default). Modified: trunk/ccm-bundle/bundles/demo/cfg/integration.properties =================================================================== --- trunk/ccm-bundle/bundles/demo/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-bundle/bundles/demo/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -117,10 +117,11 @@ # 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) Modified: trunk/ccm-bundle/bundles/devel/cfg/integration.properties =================================================================== --- trunk/ccm-bundle/bundles/devel/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-bundle/bundles/devel/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -118,10 +118,11 @@ # 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) Modified: trunk/ccm-ldn-aplaws/bundles/base/cfg/integration.properties =================================================================== --- trunk/ccm-ldn-aplaws/bundles/base/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-ldn-aplaws/bundles/base/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -133,9 +133,11 @@ # ccm-themedirector application +# 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 -# themedirector.default_theme_manifest=ccm-zes-aplaws.web.mf -themedirector.default_theme_path=themes/static/aplaws # ccm-auth-http application ; auth.http.admin_email=web...@ap... Modified: trunk/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties =================================================================== --- trunk/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-ldn-aplaws/bundles/complete/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -133,8 +133,10 @@ # 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 Modified: trunk/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties =================================================================== --- trunk/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-ldn-aplaws/bundles/demo/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -132,8 +132,10 @@ # 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 Modified: trunk/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties =================================================================== --- trunk/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-ldn-aplaws/bundles/devel/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -126,8 +126,10 @@ # 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 Modified: trunk/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties =================================================================== --- trunk/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-ldn-aplaws/bundles/standard/cfg/integration.properties 2012-05-18 01:12:17 UTC (rev 2322) @@ -131,8 +131,10 @@ # 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 Modified: trunk/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java =================================================================== --- trunk/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-themedirector/src/com/arsdigita/themedirector/ThemeDirectorConfig.java 2012-05-18 01:12:17 UTC (rev 2322) @@ -64,13 +64,20 @@ } // 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 @@ /** 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 @@ } /** - * This returns the name of the servlet context containing + * This returns the name of the servlet context containing * the default theme */ public String getDefaultThemeContext() { Modified: trunk/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java =================================================================== --- trunk/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-themedirector/src/com/arsdigita/themedirector/dispatcher/ThemeDownloadServlet.java 2012-05-18 01:12:17 UTC (rev 2322) @@ -137,30 +137,30 @@ DispatcherHelper.maybeCacheDisable(sresp); sresp.setContentType("application/zip; charset=UTF-8"); - // The WebAppRoot should be something like this: - // /var/ccm-devel/web/<username>/<projectname>/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 @@ 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,19 +198,17 @@ 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(); } } Modified: trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java =================================================================== --- trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeControlPanel.java 2012-05-18 01:12:17 UTC (rev 2322) @@ -110,13 +110,20 @@ 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 ); } Modified: trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java =================================================================== --- trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java 2012-05-17 15:13:33 UTC (rev 2321) +++ trunk/ccm-themedirector/src/com/arsdigita/themedirector/ui/ThemeXSLParameterGenerator.java 2012-05-18 01:12:17 UTC (rev 2322) @@ -74,10 +74,11 @@ } 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; |