diff --git a/ccm-bundle/bundles/demo/cfg/integration.properties b/ccm-bundle/bundles/demo/cfg/integration.properties index da5b82fbe..e3016a17e 100644 --- a/ccm-bundle/bundles/demo/cfg/integration.properties +++ b/ccm-bundle/bundles/demo/cfg/integration.properties @@ -28,7 +28,7 @@ waf.templating.stylesheet_paths=/WEB-INF/resources/librecms-stylesheet-paths.txt core.ui.pagemap.root_page_url=navigation/ core.ui.pagemap.workspace_url=navigation/ -core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp +core.ui.pagemap.user_redirect_url=content-center/redirect.jsp ; workflow configuration waf.workflow.simple.alerts_enabled=true diff --git a/ccm-bundle/bundles/devel/cfg/integration.properties b/ccm-bundle/bundles/devel/cfg/integration.properties index 87f9d1ce4..9a30306ef 100644 --- a/ccm-bundle/bundles/devel/cfg/integration.properties +++ b/ccm-bundle/bundles/devel/cfg/integration.properties @@ -28,7 +28,7 @@ waf.templating.stylesheet_paths=/WEB-INF/resources/librecms-stylesheet-paths.txt core.ui.pagemap.root_page_url=navigation/ core.ui.pagemap.workspace_url=navigation/ -core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp +core.ui.pagemap.user_redirect_url=content-center/redirect.jsp ; workflow configuration waf.workflow.simple.alerts_enabled=true @@ -57,6 +57,7 @@ com.arsdigita.cms.default_template_resolver_class=com.arsdigita.subsite.dispatch ; com.arsdigita.cms.dhtml_editor_hidden_buttons= ; com.arsdigita.cms.dhtml_editor_plugins=TableOperations,CSS +com.arsdigita.cms.allow_content_create_in_section_listing=false com.arsdigita.cms.disable_item_pfs=true com.arsdigita.cms.hide_admin_tabs=true diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileXmlUtil.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileXmlUtil.java index 53e2be842..a0debefda 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileXmlUtil.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileXmlUtil.java @@ -86,7 +86,7 @@ public class PublicPersonalProfileXmlUtil { /*navList.addAttribute("url", String.format("%s/%s", appUrl, profile.getProfileUrl()));*/ - navList.addAttribute("url", String.format("/ccm/%s", + navList.addAttribute("url", String.format("/ccm%s", UI.getConfig().getRootPage())); @@ -142,7 +142,7 @@ public class PublicPersonalProfileXmlUtil { //homeElem.addAttribute("url", String.format("%s/%s", // appUrl, // profile.getProfileUrl())); - homeElem.addAttribute("url", String.format("/ccm/%s", + homeElem.addAttribute("url", String.format("/ccm%s", UI.getConfig().getRootPage())); final Element profileElem = diff --git a/ccm-cms/src/com/arsdigita/cms/CMSConfig.java b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java index 5f977e54d..86bca438d 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java @@ -152,10 +152,9 @@ public final class CMSConfig extends AbstractConfig { * Path is relative to webapp root. */ private final Parameter m_templateRootPath = - new StringParameter( - "com.arsdigita.cms.template_root_path", - Parameter.REQUIRED, - "/templates/ccm-cms/content-section"); + new StringParameter("com.arsdigita.cms.template_root_path", + Parameter.REQUIRED, + "/templates/ccm-cms/content-section"); // up to version 6.6.4 // "/packages/content-section/templates"); @@ -175,10 +174,9 @@ public final class CMSConfig extends AbstractConfig { * specifications. Path is relative to webapp root. */ private final Parameter m_itemAdapters = - new ResourceParameter( - "com.arsdigita.cms.item_adapters", - Parameter.REQUIRED, - "/WEB-INF/resources/cms-item-adapters.xml"); + new ResourceParameter("com.arsdigita.cms.item_adapters", + Parameter.REQUIRED, + "/WEB-INF/resources/cms-item-adapters.xml"); // URL resource: protocol handler removal: END /** * Use streamlined content creation: upon item creation, diff --git a/ccm-cms/src/com/arsdigita/cms/ContentSection.java b/ccm-cms/src/com/arsdigita/cms/ContentSection.java index 1dd04b5d3..303c3c62a 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentSection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentSection.java @@ -255,8 +255,8 @@ public class ContentSection extends Application { * it contains the static prefix (if one is configured, "ccm" by default) * and must not be used to construct an url for internal links! * - * @return The URL of the site node on which the content section is mounted. - * This URL includes the webapp context path. + * @return The URL where the content section is mounted. + * This URL includes the webapp context path. */ public String getURL() { String sURL = null; diff --git a/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java b/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java index 7faedd532..97ba31f49 100644 --- a/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java +++ b/ccm-cms/src/com/arsdigita/cms/WorkspaceServlet.java @@ -96,7 +96,9 @@ public class WorkspaceServlet extends BaseApplicationServlet { requireTrailingSlash(""); /** Set Template base path for JSP's */ - m_templatePath = ContentSection.getConfig().getTemplateRoot(); + // ToDo: Make it configurable by an appropriate config registry entry! +// m_templatePath = CMS.getConfig().getTemplateRoot(); + m_templatePath = "/templates/ccm-cms/content-center"; Assert.exists(m_templatePath, String.class); Assert.isTrue(m_templatePath.startsWith("/"), "template-path must start with '/'"); @@ -139,15 +141,20 @@ public class WorkspaceServlet extends BaseApplicationServlet { } // Check user access. - checkUserAccess(sreq, sresp); + // checkUserAccess(sreq, sresp); ResourceHandler page = getResource(url); if ( page != null ) { + + // Check user access. + checkUserAccess(sreq, sresp); // Serve the page. page.init(); page.dispatch(sreq, sresp, ctx); } else { // Fall back on the JSP application dispatcher. + // NOTE: The JSP must ensure the proper authentication and + // authorisation if required! if (s_log.isInfoEnabled()) { s_log.info("NO page registered to serve the requst url."); } diff --git a/ccm-cms/web/templates/ccm-cms/content-section/content-center-redirect.jsp b/ccm-cms/web/templates/ccm-cms/content-center/redirect.jsp similarity index 100% rename from ccm-cms/web/templates/ccm-cms/content-section/content-center-redirect.jsp rename to ccm-cms/web/templates/ccm-cms/content-center/redirect.jsp diff --git a/ccm-core/src/com/arsdigita/kernel/KernelHelper.java b/ccm-core/src/com/arsdigita/kernel/KernelHelper.java index fb4533e37..46310b8a0 100755 --- a/ccm-core/src/com/arsdigita/kernel/KernelHelper.java +++ b/ccm-core/src/com/arsdigita/kernel/KernelHelper.java @@ -199,14 +199,6 @@ public class KernelHelper { return Kernel.getSecurityConfig().getAdminContactEmail(); } - /** - * @deprecated Use - * Kernel.getConfig().getPrimaryUserIdentifier() - */ - public static synchronized boolean emailIsPrimaryIdentifier() { - return Kernel.getConfig().getPrimaryUserIdentifier().equals("email"); - } - /** * * diff --git a/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java b/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java index d3fbab034..dca84cbc6 100755 --- a/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java +++ b/ccm-core/src/com/arsdigita/kernel/UserAuthentication.java @@ -495,8 +495,8 @@ public class UserAuthentication extends DomainObject { } set("id", user.getID()); setAssociation("user", user); - set("primaryEmail", user.getPrimaryEmail().getEmailAddress()); - set("screenName", user.getScreenName()); + set("primaryEmail", user.getPrimaryEmail().getEmailAddress()); + set("screenName", user.getScreenName()); m_user = user; } @@ -510,10 +510,10 @@ public class UserAuthentication extends DomainObject { * @return The login name used for the user. **/ private static String getLoginNameForUser(User user) { - if (KernelHelper.emailIsPrimaryIdentifier()) { - return user.getPrimaryEmail().getEmailAddress(); - } - return user.getScreenName(); + if (Kernel.getConfig().emailIsPrimaryIdentifier()) { + return user.getPrimaryEmail().getEmailAddress(); + } + return user.getScreenName(); } } diff --git a/ccm-core/src/com/arsdigita/ui/UI.java b/ccm-core/src/com/arsdigita/ui/UI.java index 8b96df769..893ab1e65 100644 --- a/ccm-core/src/com/arsdigita/ui/UI.java +++ b/ccm-core/src/com/arsdigita/ui/UI.java @@ -40,39 +40,14 @@ public abstract class UI { private static final UIConfig s_config = UIConfig.getConfig(); - /** (Relative) URL for systems public top level page. */ - // In old LegacyInitializer ROOT_PAGE_KEY =pagemap.root= register/ | portal/ + /** URL for systems public top level page (entry or start page). */ private static final String s_rootPageURL = s_config.getRootPage(); - /** */ - private static final String s_userRedirectURL = s_config.getUserRedirect(); - /** (Relative) URL for workspace page. */ + /** URL to page a user should be redirected to after login. */ + private static final String s_userRedirectURL = s_config.getUserRedirect(); + /** (Absolute) URL for workspace page. */ private static final String s_workspaceURL = s_config.getWorkspace(); - /** Root URL */ - // This address used to be determinded by - // SiteNode.getRootSiteNode().getURL(); - // It provides a sitenode without a name an without any parent, i.e. "/" - // There is no information whether the context path (in case we are not - // installed as root application (context) of the servlet(!) container). - // It does obviously NOT include the constant prefix, generated by the - // new dispatcher. - // - // Previously an variant had been used: - // SiteNode.getRootSiteNode().getURL(request); - // but according to a developers comment the latter is not save: - // "this isn't safe since you aren't neccessarily calling it from - // the root webapp - so we can't blindly prepend the context path - // from the current request." - // - // Sitenode is deprecated, web.Application should be used instead. But here - // there is no application to invoke, but we need the root part of the URL - // for a page to be prepended to its address. This depends on the - // installation, not on the request or the specific application. - // - // XXX must be generated from an installation config record. - private static final String s_rootURL = "/"; - /** * Provides a handle to the UI config record. * @@ -83,59 +58,119 @@ public abstract class UI { } /** - * Provides an absolute URL (leading slash) into the system top-level page. - * It is relative to document root without any constant prefix if there is - * one configured. + * Provides an absolute URL (leading slash) into the system top-level page + * (entry page / start page). It is relative to document root without any + * constant prefix if there is one configured. + * + * Method is typically called by servlets and especially by JSP's. + * + * Currently just a wrapper script to getRootPageURL() because req is + * currently ignored. * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * Therefore the request parameter is not ignored! This variant is retained - * for backwards compatibility only. - * The leading slash is API change! It's impacts have to be checked. (2011-02) + * @param req HttpServletRequest, may be used to determin the context of + * the current thread (application), currently not used and + * introduced here for backwards compatibility * * @return URL for top-level page as String */ - // In old LegacyInitializer ROOT_PAGE_KEY = pagemap.root = register/ - // (usually modif. to portal/nav) public static String getRootPageURL(HttpServletRequest req) { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL); - } - - if ((s_rootURL == null) || (s_rootPageURL == null)) { - return null; - } - return s_rootURL + s_rootPageURL; + return getRootPageURL(); } /** - * Provides an absolute URL (leading slash) into the system top-level page. - * It is relative to document root without any constant prefix if there is - * one configured. - * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * The leading slash it API change! It's impacts have tp be checked. (2011-02) + * Provides an absolute URL (leading slash) into the system top-level page + * (entry page / start page). It is relative to document root without any + * constant prefix if there is one configured. + * + * Method is typically called by servlets and especially by JSP's. * * @return URL for top-level page as String */ - // In old LegacyInitializer ROOT_PAGE_KEY = register/ (modif. to portal/nav) public static String getRootPageURL() { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_rootPageURL); - } - - if ((s_rootURL == null) || (s_rootPageURL == null)) { - return null; - } - return s_rootURL + s_rootPageURL; - // return s_rootPageURL; + return s_rootPageURL; } + /** + * Provides the absolute URL of a page, which redirects an incomming request + * based on some clients property, usually whether the user is logged in, + * either to a general public page or to a user (client) specific page. + * + * It is relative to document root including leading slash but without any + * constant prefix if there is one configured. + * + * It is typically used after login to redirect to an appropriate page, by + * default to /peremissions/. A site should configure an application + * to their specific purposes. e.g ccm-cms provides a page + * content-center/redirect.jsp which redirects a user to the content-center + * if logged in. + * + * @return full URL of a user redirect page, may be null + */ + public static String getUserRedirectURL() { + return s_userRedirectURL; + } + + /** + * Wrapper method for {@see getUserRedirectURL()} + * which redirects a user to the content-center if logged in. + * + * Method is specifically used by various redirect JSP's. + * + * @param req HttpServletRequest, may be used to determin the context of + * the current thread (application), currently not used and + * introduced here for backwards compatibility + * @return full URL of a user redirect page, may be null + */ + public static String getUserRedirectURL(HttpServletRequest req) { + return getUserRedirectURL(); + } + + /** + * Provides the absolute URL for the system workspace page. It is relative + * to document root including leading slash but without any constant prefix + * if there is one configured. + * + * It is used by the user redirection page (see above) as redirection target + * if no logged in user exists or no user specific page is configured. By + * default it is configured as "pvt/" as well. An installation usually + * defines a different page according to their specific purposes, e.g. + * portal or navigation. + * + * @return URL for workspace page as String + */ + public static String getWorkspaceURL() { + return s_workspaceURL; + } + + /** + * Provides the absolute URL for the system workspace page. + * It is relative to document root including leading slash but without any + * constant prefix if there is one configured. + * + * Method is typically called by servlets and especially by JSP's. + * + * Currently just a wrapper script to getWorkspaceURL() because req is + * currently ignored. + * + * @param req HttpServletRequest, may be used to determin the context of + * the current thread (application), currently not used and + * introduced here for backwards compatibility + * + * @return URL for workspace page as String + */ + // In old LegacyInitializer + // WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav) + public static String getWorkspaceURL(HttpServletRequest req) { + return getWorkspaceURL(); + } + + + // //////////////////////////////////////////////////////////////////////// + // Various deprfecated methods, to be removed as soon as invoking code is + // refactored. + // //////////////////////////////////////////////////////////////////////// + + /** * Provides an absolute URL (leading slash) into the system login page. * It is relative to document root without any constant prefix if there is @@ -196,168 +231,4 @@ public abstract class UI { return LoginServlet.getLogoutPageURL(); } - /** - * Provides the absolute URL of a page, which redirects an incomming request - * based on some clients property, usually whether the user is logged in, - * either to a general public page or to a user (client) specific page. - * - * It is relative to document root including leading slash but without any - * constant prefix if there is one configured. - * - * It is used by the ccm index page (home/start page) ~/index.jsp. By default - * it is configured as "pvt/" which redirects to a user specific home page - * if the initial incomming request comes from a logged in user. - * Applications may configure a different page according to their specific - * purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp - * which redirects a user to the content-center if logged in. - * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * Previous implementation of this method signature (no parameter) returned - * an url without leading slash. - * The leading slash it API change! It's impacts have tp be checked. (2011-02) - * - * @return full URL of a user redirect page, may be null - */ - // In old LegacyInitializer - // LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/ - // (usually modified to "content/content-center-redirect-page.jsp") - public static String getUserRedirectURL() { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL); - } - - if ((s_rootURL == null) || (s_userRedirectURL == null)) { - return null; - } - return s_rootURL + s_userRedirectURL; - } - - /** - * Provides the absolute URL of a page, which redirects an incomming request - * based on some clients property, usually whether the user is logged in, - * either to a general public page or to a user (client) specific page. - * - * It is relative to document root including leading slash but without any - * constant prefix if there is one configured. - * - * It is used by the ccm index page (home/start page) ~/index.jsp. By default - * it is configured as "pvt/" which redirects to a user specific home page - * if the initial incomming request comes from a logged in user. - * Applications may configure a different page according to their specific - * purposes. e.g ccm-cms provides a page content/content-center-redirect.jsp - * which redirects a user to the content-center if logged in. - * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * Previous implementation of this method signature (HTTPServletRequest) - * returned an url to a registration redirect page either starting with a - * slash for root context or the context path part. HTTPServletRequest is - * no longer significant here and method signature retained here for - * backwards compatibility only. - * - * @param req HttpServletRequest, may be used to determin the context of - * the current thread (application), currently not used and - * introduced here for backwards compatibility - * @return full URL of a user redirect page, may be null - */ - // see comment at top about getRootURL(req) for details! - // In old LegacyInitializer - // LOGIN_REDIRECT_PAGE_KEY =page.kernel.login.redirect=pvt/ - // (usually modified to "content/content-center-redirect-page.jsp") - public static String getUserRedirectURL(HttpServletRequest req) { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_userRedirectURL); - } - - if ((s_rootURL == null) || (s_userRedirectURL == null)) { - return null; - } - return s_rootURL + s_userRedirectURL; - } - - /** - * Provides the absolute URL for the system workspace page. It is relative - * to document root including leading slash but without any constant prefix - * if there is one configured. - * - * It is used by the user redirection page (see above) as redirection target - * if no logged in user exists or no user specific page is configured. By - * default it is configured as "pvt/" as well. An installation usually - * defines a different page according to their specific purposes, e.g. - * portal or navigation. - * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * Previous implementation of this method signature (no parameter) returned - * an url without leading slash. - * The leading slash it API change! It's impacts have tp be checked. (2011-02) - * - * @return URL for workspace page as String - */ - // In old LegacyInitializer - // WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav) - public static String getWorkspaceURL() { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL); - } - - if ((s_rootURL == null) || (s_workspaceURL == null)) { - return null; - } - return s_rootURL + s_workspaceURL; - } - - /** - * Provides the absolute URL for the system workspace page. - * It is relative to document root including leading slash but without any - * constant prefix if there is one configured. - * - * It is used by the user redirection page (see above) as redirection target - * if no logged in user exists or no user specific page is configured. By - * default it is configured as "pvt/" as well. An installation usually - * defines a different page according to their specific purposes, e.g. - * portal or navigation. - * - * XXX This implementation starts with a leading slash and ends with a slash. - * In previous configurations String urls began without a slash in order - * to be able to provide a full URL which also contains the context part. - * Since version 5.2 the context part is handled by (new) dispatcher. - * Previous implementation of this method signature (HTTPServletRequest) - * returned an url to a workspace page either starting with a - * slash for root context or the context path part. HTTPServletRequest is - * no longer significant here and method signature retained here for - * backwards compatibility only. - * - * - * @param req HttpServletRequest, may be used to determin the context of - * the current thread (application), currently not used and - * introduced here for backwards compatibility - * @return URL for workspace page as String - */ - // In old LegacyInitializer - // WORKSPACE_PAGE_KEY = page.kernel.workspace=pvt/ (mod- t0 portal/nav) - public static String getWorkspaceURL(HttpServletRequest req) { - if (s_log.isDebugEnabled()) { - s_log.debug("Root is " + s_rootURL + ", url is " + s_workspaceURL); - } - - if ((s_rootURL == null) || (s_workspaceURL == null)) { - return null; - } - return s_rootURL + s_workspaceURL; - } - - // In old LegacyInitializer - // PERMISSION_PAGE_KEY = page.kernel.permission = permissions/ - - // In old LegacyInitializer - // PERM_SINGLE_PAGE_KEY = page.kernel.perm-single = permissions/one/ - } diff --git a/ccm-core/src/com/arsdigita/ui/UIConfig.java b/ccm-core/src/com/arsdigita/ui/UIConfig.java index b4f47da6f..e70a0748e 100644 --- a/ccm-core/src/com/arsdigita/ui/UIConfig.java +++ b/ccm-core/src/com/arsdigita/ui/UIConfig.java @@ -20,8 +20,6 @@ package com.arsdigita.ui; import com.arsdigita.runtime.AbstractConfig; -import com.arsdigita.ui.login.Login; -import com.arsdigita.ui.login.LoginServlet; import com.arsdigita.util.StringUtils; import com.arsdigita.util.parameter.StringParameter; import com.arsdigita.util.parameter.StringArrayParameter; @@ -140,21 +138,23 @@ public class UIConfig extends AbstractConfig { ); /** String containing the relative URL for the top level page - * (or entry page / home page) of the site, Without leading slash but with - * trailing slash in case of a directory. - * By default it is the login page, but usually the root page of the main - * presentation application, e.g. portal, navigation, forum, etc. */ - // Old initializer: waf.pagemap.root - private final Parameter m_rootPageURL = new StringParameter - ("core.ui.pagemap.root_page_url", Parameter.REQUIRED, "register/"); + * (or entry page / home page) of the site, Without leading slash but + * with trailing slash in case of a directory. + * By default it is the login page, but usually the root page of the + * main presentation application, e.g. portal, navigation, forum, etc. */ + private final Parameter m_rootPageURL = + new StringParameter("core.ui.pagemap.root_page_url", + Parameter.REQUIRED, "/register/"); - /** String containing the URL for a page which may perform a user specific - * redirect if logged in or to a general public page if not. */ - // Used to be LOGIN_REDIRECT_PAGE_KEY in old kernel/security/initializer - // parameter waf.pagemap.login_redirect = pvt/ - // XXX url pvt seems not to exist anymore! (pboy 2011-02-03) - private final Parameter m_userRedirectURL = new StringParameter - ("core.ui.pagemap.user_redirect_url", Parameter.REQUIRED, "pvt/"); + /** String containing the URL of a page, a servlet or a jsp, to which a + * user after login will be redirected to. + * In case of a jsp or servlet it may contain user specific logic to + * redirect to a page specific for the user or a group of users. + * By default it is the /permissions/ page, but usually it is an + * application like personal-portal or content-center. */ + private final Parameter m_userRedirectURL = + new StringParameter("core.ui.pagemap.user_redirect_url", + Parameter.REQUIRED, "/permissions/"); /** String containing the URL for the workspace of the site. */ // Old initializer: waf.pagemap.workspace @@ -237,16 +237,27 @@ public class UIConfig extends AbstractConfig { * @return root page url */ public String getRootPage() { - return (String)get(m_rootPageURL) ; + String rootPageURL = (String)get(m_rootPageURL) ; + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( rootPageURL.startsWith("/") ? + rootPageURL : "/"+rootPageURL ); } /** - * Retrieve systems user login redirect page url. + * Retrieve systems user login redirect page url, that is the page, a + * servlet oder a JSP ti which a user is redirected to after login. + * By default it is the /permissions/ page, but usually it is an application + * like personal-portal or content-center. * * @return user login redirect page url */ public String getUserRedirect() { - return (String)get(m_userRedirectURL) ; + String userRedirectURL = (String)get(m_userRedirectURL); + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( userRedirectURL.startsWith("/") ? + userRedirectURL : "/"+userRedirectURL ); } /** @@ -255,7 +266,11 @@ public class UIConfig extends AbstractConfig { * @return workspace page url */ public String getWorkspace() { - return (String)get(m_workspaceURL) ; + String workspaceURL = (String)get(m_workspaceURL); + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( workspaceURL.startsWith("/") ? + workspaceURL : "/"+workspaceURL ); } } diff --git a/ccm-core/src/com/arsdigita/ui/login/LoginServlet.java b/ccm-core/src/com/arsdigita/ui/login/LoginServlet.java index f1f2fa4c3..bdf642e39 100644 --- a/ccm-core/src/com/arsdigita/ui/login/LoginServlet.java +++ b/ccm-core/src/com/arsdigita/ui/login/LoginServlet.java @@ -111,12 +111,6 @@ public class LoginServlet extends BebopApplicationServlet { // define final static String s_loginURL = Login.LOGIN_PAGE_URL; - // final static String s_loginURL = (Login.getLoginPageURL().endsWith("/") ? - // Login.getLoginPageURL() - // .substring(0, - // Login.getLoginPageURL() - // .length()-1) : - // Login.getLoginPageURL() ); /** * User extension point used to create the pages to server and setup a @@ -127,9 +121,6 @@ public class LoginServlet extends BebopApplicationServlet { @Override public void doInit() throws ServletException { - // Should be handled elsewhere, we have to check for it. - // put("/",UI.getRootPageURL()); - // Allow world caching for pages without authentication, // ie, /register, /register/explain-persistent-cookies, // /register/login-expired, /register/recover-password diff --git a/ccm-core/src/com/arsdigita/ui/login/UserForm.java b/ccm-core/src/com/arsdigita/ui/login/UserForm.java index b75738360..78313ffa9 100755 --- a/ccm-core/src/com/arsdigita/ui/login/UserForm.java +++ b/ccm-core/src/com/arsdigita/ui/login/UserForm.java @@ -39,7 +39,7 @@ import com.arsdigita.bebop.parameters.StringLengthValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.URLParameter; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.PersonName; import com.arsdigita.kernel.User; import com.arsdigita.persistence.DataQuery; @@ -356,7 +356,7 @@ public abstract class UserForm extends Form // If this query returns with any rows we have a duplicate // screen name, email address, or both. Check the results and // produce appropriate error messages. - boolean checkPrimaryEmail = KernelHelper.emailIsPrimaryIdentifier(); + boolean checkPrimaryEmail = Kernel.getConfig().emailIsPrimaryIdentifier(); Filter filter = null; if (checkPrimaryEmail) { diff --git a/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java b/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java index b18ad8ad6..324b53b39 100755 --- a/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java +++ b/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java @@ -43,11 +43,9 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.URLParameter; import com.arsdigita.kernel.Kernel; -import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.security.AccountNotFoundException; import com.arsdigita.kernel.security.Credential; import com.arsdigita.kernel.security.CredentialException; -// import com.arsdigita.kernel.security.LegacyInitializer; import com.arsdigita.kernel.security.SecurityConfig; import com.arsdigita.kernel.security.UserContext; import com.arsdigita.ui.UI; @@ -183,7 +181,7 @@ public class UserLoginForm extends Form LoginServlet.SUBSITE_NS_URI); - if (KernelHelper.emailIsPrimaryIdentifier()) { + if (Kernel.getConfig().emailIsPrimaryIdentifier()) { loginMessage.setClassAttr("email"); } else { loginMessage.setClassAttr("screenName"); @@ -191,7 +189,7 @@ public class UserLoginForm extends Form add(loginMessage); - if (KernelHelper.emailIsPrimaryIdentifier()) { + if (Kernel.getConfig().emailIsPrimaryIdentifier()) { add(new Label(LoginHelper.getMessage( "login.userRegistrationForm.email"))); m_loginName = new TextField(new EmailParameter(FORM_LOGIN)); @@ -297,7 +295,7 @@ public class UserLoginForm extends Form try { UserContext ctx = Web.getUserContext(); String username = null; - if (KernelHelper.emailIsPrimaryIdentifier()) { + if (Kernel.getConfig().emailIsPrimaryIdentifier()) { username = ((InternetAddress) m_loginName.getValue(state)). getAddress(); } else { @@ -406,24 +404,23 @@ public class UserLoginForm extends Form Object persistentLoginValue = m_isPersistent.getValue(state); - String[] values; - String value; + String value ; if (persistentLoginValue == null) { return defaultValue; } if (persistentLoginValue instanceof String[]) { - values = (String[]) persistentLoginValue; - return "1".equals(values[0]); + value = ((String[])persistentLoginValue)[0]; } - - if (persistentLoginValue instanceof String) { + else if (persistentLoginValue instanceof String) { value = (String) persistentLoginValue; - return "1".equals(value); + } + else { + value = "0"; } - return defaultValue; + return "1".equals(value); } /** diff --git a/ccm-core/src/com/arsdigita/ui/login/UserNewForm.java b/ccm-core/src/com/arsdigita/ui/login/UserNewForm.java index 2a69356d0..f281e1d11 100755 --- a/ccm-core/src/com/arsdigita/ui/login/UserNewForm.java +++ b/ccm-core/src/com/arsdigita/ui/login/UserNewForm.java @@ -38,7 +38,6 @@ import com.arsdigita.web.ReturnSignal; import com.arsdigita.kernel.EmailAddress; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; -import com.arsdigita.kernel.KernelHelper; import com.arsdigita.kernel.User; import com.arsdigita.kernel.UserAuthentication; import com.arsdigita.kernel.permissions.PermissionDescriptor; @@ -123,7 +122,7 @@ public class UserNewForm extends UserForm m_confirm.setValue(state, ""); String loginName = (String)m_loginName.getValue(state); if (loginName != null) { - if (KernelHelper.emailIsPrimaryIdentifier()) { + if (Kernel.getConfig().emailIsPrimaryIdentifier()) { m_email.setValue(state, loginName); } else { m_screenName.setValue(state, loginName); @@ -146,7 +145,7 @@ public class UserNewForm extends UserForm final String firstName = (String)m_firstName.getValue(state); final String lastName = (String)m_lastName.getValue(state); String sn = null; - if (!KernelHelper.emailIsPrimaryIdentifier()) { + if (!Kernel.getConfig().emailIsPrimaryIdentifier()) { sn = (String)m_screenName.getValue(state); } final String screenName = sn; @@ -167,7 +166,7 @@ public class UserNewForm extends UserForm user.getPersonName().setGivenName(firstName); user.getPersonName().setFamilyName(lastName); user.setPrimaryEmail(new EmailAddress(email)); - if (!KernelHelper.emailIsPrimaryIdentifier()) { + if (!Kernel.getConfig().emailIsPrimaryIdentifier()) { user.setScreenName(screenName); } user.setURI(urlFinal); @@ -203,7 +202,7 @@ public class UserNewForm extends UserForm // finally log the user in (sets the // appropriate session or permanent cookie) String loginName = email; - if (!KernelHelper.emailIsPrimaryIdentifier()) { + if (!Kernel.getConfig().emailIsPrimaryIdentifier()) { loginName = screenName; } Web.getUserContext().login diff --git a/ccm-core/src/com/arsdigita/web/URL.java b/ccm-core/src/com/arsdigita/web/URL.java index 184846ee1..a3b310a10 100755 --- a/ccm-core/src/com/arsdigita/web/URL.java +++ b/ccm-core/src/com/arsdigita/web/URL.java @@ -155,6 +155,10 @@ public class URL { public static final String THEMES_DIR = "/themes"; + + /** Base direcotry for template files provided by packages. Each package + * has to place files into a subdirectory with its name */ + public static final String TEMPLATE_DIR = "/templates"; /** * The standard location for servlets. diff --git a/ccm-sci-bundle/bundles/demo/cfg/integration.properties b/ccm-sci-bundle/bundles/demo/cfg/integration.properties index 10f61fef5..a13d86a8f 100644 --- a/ccm-sci-bundle/bundles/demo/cfg/integration.properties +++ b/ccm-sci-bundle/bundles/demo/cfg/integration.properties @@ -28,7 +28,8 @@ waf.templating.stylesheet_paths=/WEB-INF/resources/scientificCMS-stylesheet-path core.ui.pagemap.root_page_url=navigation/ core.ui.pagemap.workspace_url=navigation/ -core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp +# core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp +core.ui.pagemap.user_redirect_url=content-center/redirect.jsp ; workflow configuration waf.workflow.simple.alerts_enabled=true diff --git a/ccm-sci-bundle/bundles/devel/cfg/integration.properties b/ccm-sci-bundle/bundles/devel/cfg/integration.properties index 17f9b57ce..4c87c5df1 100644 --- a/ccm-sci-bundle/bundles/devel/cfg/integration.properties +++ b/ccm-sci-bundle/bundles/devel/cfg/integration.properties @@ -28,7 +28,7 @@ waf.templating.stylesheet_paths=/WEB-INF/resources/scientificCMS-stylesheet-path core.ui.pagemap.root_page_url=navigation/ core.ui.pagemap.workspace_url=navigation/ -core.ui.pagemap.user_redirect_url=content/content-center-redirect.jsp +core.ui.pagemap.user_redirect_url=content-center/redirect.jsp ; workflow configuration waf.workflow.simple.alerts_enabled=true