diff --git a/ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl b/ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl similarity index 100% rename from ccm-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl rename to ccm-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl diff --git a/ccm-cms/src/com/arsdigita/cms/Loader.java b/ccm-cms/src/com/arsdigita/cms/Loader.java index e200136f0..f10277fc2 100755 --- a/ccm-cms/src/com/arsdigita/cms/Loader.java +++ b/ccm-cms/src/com/arsdigita/cms/Loader.java @@ -181,7 +181,7 @@ public class Loader extends PackageLoader { public static ApplicationType loadWorkspaceApplicationType() { s_log.debug("Creating CMS Workspace..."); - /* Create new stype legacy compatible application type */ + /* Create new type legacy compatible application type */ ApplicationType type = ApplicationType .createApplicationType(Workspace.PACKAGE_KEY, Workspace.INSTANCE_NAME, diff --git a/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java.nolongerInUse b/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java.nolongerInUse deleted file mode 100755 index b061a0178..000000000 --- a/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java.nolongerInUse +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2003-2004 Red Hat 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. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.templating; - -import com.arsdigita.dispatcher.DispatcherHelper; -import com.arsdigita.kernel.PackageInstance; -import com.arsdigita.kernel.SiteNode; -import com.arsdigita.kernel.Stylesheet; -import com.arsdigita.sitenode.SiteNodeRequestContext; -import com.arsdigita.util.UncheckedWrapperException; -import com.arsdigita.web.Web; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Locale; -import javax.servlet.http.HttpServletRequest; -import org.apache.log4j.Logger; - -/** - *

- * This is the "legacy" stylesheet resolver class. It resolves stylesheets - * using the old packagetype <-> stylesheet and sitenode <-> stylesheet - * mappings in the database. - *

- * @version $Id: LegacyStylesheetResolver.java 287 2005-02-22 00:29:02Z sskracic $ - * - * @deprecated use {@link PatternStylesheetResolver} in new code. - */ -public class LegacyStylesheetResolver implements StylesheetResolver { - - private static final Logger s_log = Logger.getLogger - (LegacyStylesheetResolver.class); - - - public URL resolve(HttpServletRequest request) { - // TransactionContext tctx = - // SessionManager.getSession().getTransactionContext(); - // boolean callerStartedTransaction = tctx.inTxn(); - // if (!callerStartedTransaction) - // tctx.beginTxn(); - - // Get the site node. - final SiteNodeRequestContext context = (SiteNodeRequestContext) - DispatcherHelper.getRequestContext(request); - - final Locale locale = context.getLocale(); - final String output = context.getOutputType(); - final SiteNode node = context.getSiteNode(); - - SiteNode sn = node; - Stylesheet ss = null; - - while (sn != null && ss == null) { - // No style for this site node, but we can try the parent. - ss = sn.getStylesheet(locale, output); - sn = sn.getParent(); - } - - sn = node; - - while (sn != null && ss == null) { - final PackageInstance pi = sn.getPackageInstance(); - - if (pi != null) { - ss = pi.getType().getStylesheet(locale, output); - } - - sn = sn.getParent(); - } - - if (ss == null) { - throw new IllegalStateException - ("No path to XSL stylesheet found"); - } - - // Get the actual path for the Stylesheet we've found. - final String filename = ss.getPath(); - - if (s_log.isDebugEnabled()) { - s_log.debug("Trying path " + filename); - } - - - try { - return new URL(Web.getConfig().getDefaultScheme(), - Web.getConfig().getHost().getName(), - Web.getConfig().getHost().getPort(), - filename); - } catch (MalformedURLException ex) { - throw new UncheckedWrapperException(ex); - } - } -} diff --git a/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java b/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java index fe9479812..bc629d69d 100755 --- a/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java +++ b/ccm-core/src/com/arsdigita/templating/URLPatternGenerator.java @@ -23,6 +23,8 @@ import com.arsdigita.web.Web; import com.arsdigita.util.StringUtils; import com.arsdigita.dispatcher.DispatcherHelper; +import com.arsdigita.kernel.SiteNode; +import com.arsdigita.sitenode.SiteNodeRequestContext; import com.arsdigita.util.Assert; import com.arsdigita.web.Application; @@ -32,10 +34,9 @@ import org.apache.log4j.Logger; /** - * Generates a set of pattern values based on the URL path info - * for the current request. Slashes in the request are - * translated into hyphens; the file extension is stripped; - * the any 'index' is removed, except for the top level. + * Generates a set of pattern values based on the URL path info for the current + * request. Slashes in the request are translated into hyphens; the file + * extension is stripped; any 'index' is removed, except for the top level. * * So some examples: * @@ -52,6 +53,12 @@ public class URLPatternGenerator implements PatternGenerator { private static final String DEFAULT_URL_MATCH = "index"; + /** + * + * @param key + * @param req + * @return + */ public String[] generateValues(String key, HttpServletRequest req) { String path = getPath(); @@ -141,25 +148,30 @@ public class URLPatternGenerator implements PatternGenerator { /** * Provides the base URL of the application in the current Web request - * (i.e. application's PrimaryURL) + * (i.e. application's PrimaryURL). If no application can be found or + * no PrimaryURL can be determined ROOT ("/") is returned. * * XXX fix me, why can't we get this from Web.getConfig.getRequestURL * - * @return primary url of an application + * @return primary url of an application or ROOT */ private String getBasePath() { // OLD code using kernel.SiteNode etc which is deprecatged and no longer // available -// SiteNodeRequestContext ctx = (SiteNodeRequestContext) -// DispatcherHelper.getRequestContext(Web.getRequest()); -// SiteNode node = ctx.getSiteNode(); -// Assert.exists(node, SiteNode.class); -// return node.getURL(); + // SiteNodeRequestContext ctx = (SiteNodeRequestContext) + // DispatcherHelper.getRequestContext(Web.getRequest()); + // SiteNode node = ctx.getSiteNode(); + // Assert.exists(node, SiteNode.class); + // return node.getURL(); // retrieve the application of the request Application app = Web.getContext().getApplication(); - return app.getPrimaryURL(); + if (app == null) { + return "/"; + } else { + return app.getPrimaryURL(); + } } } diff --git a/ccm-ldn-aplaws/web/themes/static/aplaws/content-section-content-admin.xsl b/ccm-ldn-aplaws/web/themes/static/aplaws/content-section-admin.xsl similarity index 100% rename from ccm-ldn-aplaws/web/themes/static/aplaws/content-section-content-admin.xsl rename to ccm-ldn-aplaws/web/themes/static/aplaws/content-section-admin.xsl diff --git a/ccm-sci-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl b/ccm-sci-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl similarity index 100% rename from ccm-sci-bundle/web/themes/static/aplaws-generic/content-section-content-admin.xsl rename to ccm-sci-bundle/web/themes/static/aplaws-generic/content-section-admin.xsl