From 4ab614055a12bd926caff3e2e1bd14d1c40e86b0 Mon Sep 17 00:00:00 2001 From: pb Date: Sat, 7 Feb 2009 22:44:11 +0000 Subject: [PATCH] Integrate vendor release r1795: First part of the conversion of CCM to be deployed in a standard way r1796: Multilanguage categorization (already local, but upgrade script added, comments and translation added) First part of the conversion of CCM / APLAWS to be deployed in a standard way by a *.war file. Backwards compatible to the procedures so far. The ccm scripts can be used as used to. Only difference is the location of some files (see below). As an alternative the webapps directory created by the ccm scripts can be moved into a standard tomcat container or can be added as a virtual host. APLAWS no longer depends on all the environment variables. For detailed instructions see documentation on the WIKI. This is a temporary solution, further enhancements are on the way! No update script required for this part. Modifications: - Creation of a c.ad.runtime.CCMResourceManager class, which currently handles just the file locations. It replaces the dependency from the CCM_HOME environment variable. It is initialized during startup of the servlet container or by the entry point of the installation tools (i.e. c.ad.packaging.mastertool). It replaces the c.ad.packaging.CCM class as well. Currently contains backwards compatibility code to check the runtime environment just in case the initialization is missing (will be removed later). - Creation of c.ad.web.CCMApplicationContextListener class which is notified by the servlet container at the beginning of the startup procedure. Initialises CCMResourceManager. Must be configured by web.xml (if a contributed package overwrites the trunk values)! - File location changes: - Configuration registry moved to [appbase]/WEB-INF/conf/registry - ps2fs files moved to [appbase]/ps2fs (can be modified by configuration parameter) - lucene index files moved to [appbase]/WEB-INF/work/lucene (can be modified by configuration parameter) Developers watch out! ant clean now removes these files, too (esp. registry)! - XML factory classes are now determined by configuration parameters - waf.xml.xsl_transformer=[saxon (default)|jd.xslt|resin|xalan|xsltc] - waf.xml.dom_builder=[xerces (default) | resin] - waf.xml.sax_parser=[xerces (default) | resin] - Package c.ad.packaging reorganized so it contains just installation related code. Runtime configuration related code moved to c.ad.runtime. Code is not part of the API. - log4j configuration file is still at the old location, but is not used anymore! It will be moved to [appbase]/WEB-INF/conf/ in the future. Developers, modify the file ~/webapps/WEB-INF//classes/log4j.properties in the meantime. - While working on the code some deprecated classes and method invocations replaced by supported API. If a class is no longer used by any module in trunk, the class has been removed by appending "nolongerInUse" to the file name. If any of the contributed modules is still depending on deprecated code it is easy to find and to follow the recommended replacement instructions. Do not re-incorporate deprecated code! We have to clean up the code base! Second part: Multilanguage categories Added update script Translation of some comments, added comments version number bumped to reflect the major changes git-svn-id: https://svn.libreccm.org/ccm/trunk@73 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms/application.xml | 2 +- .../cms/dispatcher/AbstractItemResolver.java | 40 +- .../cms/dispatcher/CMSDispatcher.java | 13 +- .../dispatcher/CategoryItemResolverImpl.java | 67 ++-- ...ltItemTemplateResolver.java.nolongerInUse} | 0 .../dispatcher/DefaultTemplateResolver.java | 12 +- ...> ItemTemplateResolver.java.nolongerInUse} | 0 .../dispatcher/MultilingualItemResolver.java | 75 ++-- ccm-cms/src/com/arsdigita/cms/enterprise.init | 16 +- .../cms/publishToFile/Initializer.java | 33 +- .../cms/publishToFile/PublishToFile.java | 27 +- .../com/arsdigita/cms/ui/SortableList.java | 2 +- .../cms/ui/category/CategoryAdminPane.java | 14 +- .../category/CategoryCollectionListModel.java | 13 +- .../cms/ui/category/CategoryEditForm.java | 6 + .../cms/ui/category/CategoryItemPane.java | 96 +++-- .../category/CategoryLocalizationAddForm.java | 56 ++- .../CategoryLocalizationEditForm.java | 70 ++-- .../ui/category/CategoryLocalizationForm.java | 58 ++- .../category/CategoryLocalizationTable.java | 88 +++-- .../ui/lifecycle/ItemLifecycleSelectForm.java | 6 +- .../com/arsdigita/cms/workflow/CMSTask.java | 2 +- ccm-core/application.xml | 2 +- .../com/arsdigita/categorization/Category.pdl | 2 +- ccm-core/sql/ccm-core/oracle-se-create.sql | 2 +- .../oracle-se/messaging/table-messages.sql | 2 +- ccm-core/sql/ccm-core/postgres-create.sql | 2 +- .../ccm-core/upgrade/postgres-6.5.5-6.5.6.sql | 2 +- ccm-core/src/ccm-core.checklist | 5 + ccm-core/src/ccm-core.upgrade | 4 +- ccm-core/src/com/arsdigita/bebop/Bebop.java | 5 +- ... => BebopMapDispatcher.java.nolongerInUse} | 0 .../com/arsdigita/bebop/PropertyEditor.java | 2 +- ccm-core/src/com/arsdigita/bebop/Table.java | 4 +- .../arsdigita/bebop/demo/AutoDispatcher.java | 7 +- .../bebop/demo/MinimalDispatcher.java | 7 +- .../arsdigita/bebop/demo/OtherDispatcher.java | 7 +- .../arsdigita/bebop/page/PageTransformer.java | 6 +- .../FileSizeValidationListener.java | 13 +- .../NotEmptyValidationListener.java | 14 +- .../arsdigita/bebop/table/TableHeader.java | 4 +- .../categorization/CategorizationConfig.java | 64 ++-- .../CategorizationConfig_parameter.properties | 6 +- .../arsdigita/categorization/Category.java | 2 - .../categorization/CategoryLocalization.java | 22 +- .../CategoryLocalizationCollection.java | 26 +- .../src/com/arsdigita/core/Initializer.java | 173 --------- ccm-core/src/com/arsdigita/core/LibCheck.java | 26 +- ccm-core/src/com/arsdigita/core/Loader.java | 25 -- .../src/com/arsdigita/core/enterprise.init | 8 +- .../arsdigita/core/libcheck.messages_linux | 43 +++ .../SampleUpgrade.java.nolongerInUse} | 0 .../TroikaRickshawUpgrade.java.nolongerInUse} | 0 ...TroikaRickshawUpgrade2.java.nolongerInUse} | 0 .../src/com/arsdigita/initializer/Script.java | 5 +- ccm-core/src/com/arsdigita/kernel/Kernel.java | 8 +- .../kernel/security/SecurityConfig.java | 3 + .../kernel/security/UserContext.java | 8 +- .../src/com/arsdigita/loader/MimeTypeRow.java | 17 +- .../com/arsdigita/loader/PackageLoader.java | 44 ++- ...dapter.java => Adapter.java.nolongerInUse} | 0 ...h.java => LuceneSearch.java.nolongerInUse} | 0 ...va => ObjectTypeFilter.java.nolongerInUse} | 0 ...istry.java => Registry.java.nolongerInUse} | 0 ...ava => StandardAdapter.java.nolongerInUse} | 0 ... => TypeSpecificFilter.java.nolongerInUse} | 0 .../arsdigita/notification/Notification.java | 2 +- .../{core => packaging}/BaseCheck.java | 56 ++- .../src/com/arsdigita/packaging/Check.java | 6 +- .../DBCheck.java => packaging/CheckDB.java} | 73 +++- .../com/arsdigita/packaging/Checklist.java | 5 +- .../src/com/arsdigita/packaging/Clear.java | 4 + .../src/com/arsdigita/packaging/Command.java | 11 +- .../src/com/arsdigita/packaging/Config.java | 46 ++- .../{Files.java => Files.java.deprecated} | 0 ccm-core/src/com/arsdigita/packaging/Get.java | 13 +- .../src/com/arsdigita/packaging/Help.java | 5 +- .../src/com/arsdigita/packaging/HostInit.java | 15 +- .../src/com/arsdigita/packaging/Load.java | 58 ++- .../src/com/arsdigita/packaging/Loader.java | 21 +- .../com/arsdigita/packaging/LoaderInfo.java | 7 +- .../com/arsdigita/packaging/MasterTool.java | 26 +- .../src/com/arsdigita/packaging/Menu.java | 5 +- .../{core => packaging}/MessageMap.java | 7 +- .../arsdigita/packaging/ParameterEditor.java | 7 +- .../com/arsdigita/packaging/ParameterMap.java | 5 +- ccm-core/src/com/arsdigita/packaging/Set.java | 11 +- .../src/com/arsdigita/packaging/Status.java | 6 +- .../src/com/arsdigita/packaging/Unload.java | 10 +- .../src/com/arsdigita/packaging/Usage.java | 5 +- .../basecheck.messages_linux} | 0 .../packaging/checkdb.messages_linux | 84 +++++ .../src/com/arsdigita/packaging/package.html | 14 + .../com/arsdigita/runtime/AbstractConfig.java | 1 - ccm-core/src/com/arsdigita/runtime/CCM.java | 117 ------ .../arsdigita/runtime/CCMResourceManager.java | 353 ++++++++++++++++++ .../ConfigRegistry.java | 33 +- .../runtime/InteractiveParameterLoader.java | 4 +- .../runtime/InteractiveParameterReader.java | 108 ++++++ .../arsdigita/runtime/LegacyInitializer.java | 1 - .../RegistryConfig.java | 7 +- ....java => RuntimeClassLoader.java.notInUse} | 11 + .../com/arsdigita/runtime/RuntimeConfig.java | 25 +- ...=> RuntimeConfigLoader.java.nolongerInUse} | 0 .../com/arsdigita/runtime/ScriptContext.java | 23 +- .../src/com/arsdigita/runtime/package.html | 14 +- .../src/com/arsdigita/search/Initializer.java | 1 + .../com/arsdigita/search/lucene/Index.java | 5 +- .../arsdigita/search/lucene/LuceneConfig.java | 11 +- .../arsdigita/toolbox/ui/ComponentMap.java | 6 +- .../arsdigita/ui/admin/SubsiteDispatcher.java | 2 +- .../arsdigita/ui/login/SubsiteDispatcher.java | 15 +- .../ui/login/SubsiteResources.properties | 62 +++ .../ui/login/SubsiteResources_de.properties | 62 +++ .../ui/permissions/PermissionsDispatcher.java | 2 +- .../ui/sitemap/SiteMapDispatcher.java | 12 +- ... AliasedClassParameter.java.nolongerInUse} | 10 + ccm-core/src/com/arsdigita/util/Assert.java | 120 +++++- .../arsdigita/util/JavaPropertyReader.java | 4 +- .../com/arsdigita/util/ResourceManager.java | 29 +- ... => JavaPropertyLoader.java.nolongerInUse} | 0 .../parameter/CompoundParameterReader.java | 4 +- .../util/parameter/ParameterLoader.java | 6 + ...ava => ParameterRecord.java.nolongerInUse} | 0 .../util/protocol/resource/Handler.java | 21 +- .../util/servlet/HttpParameterMap.java | 6 +- .../com/arsdigita/util/xml/DOMBuilder.java | 12 +- .../src/com/arsdigita/util/xml/SAXParser.java | 12 +- ccm-core/src/com/arsdigita/util/xml/XML.java | 56 ++- .../src/com/arsdigita/util/xml/XMLConfig.java | 120 ++++-- .../util/xml/XMLConfig_parameter.properties | 12 +- .../arsdigita/util/xml/XSLTransformer.java | 16 +- .../com/arsdigita/versioning/Versioning.java | 13 +- .../versioning/VersioningConfig.java | 16 +- .../src/com/arsdigita/web/BaseServlet.java | 21 +- .../web/CCMApplicationContextListener.java | 102 +++++ .../web/ContextRegistrationServlet.java | 4 +- .../com/arsdigita/web/DispatcherServlet.java | 3 + .../arsdigita/webdevsupport/Dispatcher.java | 53 ++- .../webdevsupport/config/ConfigList.java | 2 +- .../com/arsdigita/workflow/simple/Task.java | 49 +-- .../arsdigita/workflow/simple/UserTask.java | 14 +- .../workflow/simple/WorkflowConfig.java | 5 +- ccm-core/src/com/arsdigita/xml/Document.java | 22 +- ccm-core/src/com/arsdigita/xml/XML.java | 6 + ccm-core/src/com/arsdigita/xml/XMLConfig.java | 20 +- .../src/com/redhat/persistence/pdl/PDL.java | 1 + .../profiler/rdbms/SQLSummary.java | 2 + .../arsdigita/search/lucene/LuceneTest.java | 2 +- .../junit/framework/PackageTestSuite.java | 2 +- ccm-core/web/WEB-INF/web.xml-default | 7 + .../src/com/arsdigita/forum/Initializer.java | 173 +++++---- ccm-ldn-aplaws/bundles/complete/cfg/web.xml | 6 + ccm-ldn-aplaws/bundles/demo/cfg/web.xml | 6 + ccm-ldn-aplaws/bundles/devel/cfg/web.xml | 6 + ccm-ldn-aplaws/bundles/standard/cfg/web.xml | 6 + ccm-ldn-aplaws/web/WEB-INF/web.xml-aplaws | 6 + ccm-ldn-navigation/application.xml | 2 +- .../navigation/NavigationFileResolver.java | 31 +- .../navigation/ui/admin/CategoryTree.java | 9 +- ccm-ldn-search/application.xml | 2 +- ccm-shp-aplaws/bundles/devel/cfg/web.xml | 6 + ccm-shp-aplaws/bundles/standard/cfg/web.xml | 6 + ccm-shp-aplaws/web/WEB-INF/web.xml-aplaws | 8 +- 164 files changed, 2624 insertions(+), 1058 deletions(-) rename ccm-cms/src/com/arsdigita/cms/dispatcher/{DefaultItemTemplateResolver.java => DefaultItemTemplateResolver.java.nolongerInUse} (100%) rename ccm-cms/src/com/arsdigita/cms/dispatcher/{ItemTemplateResolver.java => ItemTemplateResolver.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/bebop/{BebopMapDispatcher.java => BebopMapDispatcher.java.nolongerInUse} (100%) delete mode 100755 ccm-core/src/com/arsdigita/core/Initializer.java delete mode 100755 ccm-core/src/com/arsdigita/core/Loader.java create mode 100755 ccm-core/src/com/arsdigita/core/libcheck.messages_linux rename ccm-core/src/com/arsdigita/core/{SampleUpgrade.java => upgrade/SampleUpgrade.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/core/{TroikaRickshawUpgrade.java => upgrade/TroikaRickshawUpgrade.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/core/{TroikaRickshawUpgrade2.java => upgrade/TroikaRickshawUpgrade2.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{Adapter.java => Adapter.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{LuceneSearch.java => LuceneSearch.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{ObjectTypeFilter.java => ObjectTypeFilter.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{Registry.java => Registry.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{StandardAdapter.java => StandardAdapter.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/lucene/{TypeSpecificFilter.java => TypeSpecificFilter.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/{core => packaging}/BaseCheck.java (74%) rename ccm-core/src/com/arsdigita/{core/DBCheck.java => packaging/CheckDB.java} (66%) rename ccm-core/src/com/arsdigita/packaging/{Files.java => Files.java.deprecated} (100%) rename ccm-core/src/com/arsdigita/{core => packaging}/MessageMap.java (92%) rename ccm-core/src/com/arsdigita/{core/checks.messages_linux => packaging/basecheck.messages_linux} (100%) create mode 100755 ccm-core/src/com/arsdigita/packaging/checkdb.messages_linux create mode 100644 ccm-core/src/com/arsdigita/packaging/package.html delete mode 100755 ccm-core/src/com/arsdigita/runtime/CCM.java create mode 100755 ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java rename ccm-core/src/com/arsdigita/{packaging => runtime}/ConfigRegistry.java (91%) create mode 100755 ccm-core/src/com/arsdigita/runtime/InteractiveParameterReader.java rename ccm-core/src/com/arsdigita/{packaging => runtime}/RegistryConfig.java (93%) rename ccm-core/src/com/arsdigita/runtime/{RuntimeClassLoader.java => RuntimeClassLoader.java.notInUse} (82%) rename ccm-core/src/com/arsdigita/runtime/{RuntimeConfigLoader.java => RuntimeConfigLoader.java.nolongerInUse} (100%) create mode 100755 ccm-core/src/com/arsdigita/ui/login/SubsiteResources.properties create mode 100755 ccm-core/src/com/arsdigita/ui/login/SubsiteResources_de.properties rename ccm-core/src/com/arsdigita/util/{AliasedClassParameter.java => AliasedClassParameter.java.nolongerInUse} (90%) rename ccm-core/src/com/arsdigita/util/config/{JavaPropertyLoader.java => JavaPropertyLoader.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/util/parameter/{ParameterRecord.java => ParameterRecord.java.nolongerInUse} (100%) create mode 100644 ccm-core/src/com/arsdigita/web/CCMApplicationContextListener.java diff --git a/ccm-cms/application.xml b/ccm-cms/application.xml index 56005f928..d8109643f 100755 --- a/ccm-cms/application.xml +++ b/ccm-cms/application.xml @@ -2,7 +2,7 @@ diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/AbstractItemResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/AbstractItemResolver.java index 95822c6d1..3940bd2e9 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/AbstractItemResolver.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/AbstractItemResolver.java @@ -35,7 +35,8 @@ public abstract class AbstractItemResolver implements ItemResolver { protected static final String TEMPLATE_CONTEXT_PREFIX = "tem_"; /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#getItem(com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String) + * @see com.arsdigita.cms.dispatcher.ItemResolver#getItem( + * com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String) */ public abstract ContentItem getItem( ContentSection section, @@ -43,12 +44,16 @@ public abstract class AbstractItemResolver implements ItemResolver { String context); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#getCurrentContext(com.arsdigita.bebop.PageState) + * @see com.arsdigita.cms.dispatcher.ItemResolver#getCurrentContext( + * com.arsdigita.bebop.PageState) */ public abstract String getCurrentContext(PageState state); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, java.math.BigDecimal, java.lang.String, com.arsdigita.cms.ContentSection, java.lang.String) + * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL( + * com.arsdigita.bebop.PageState, java.math.BigDecimal, + * java.lang.String, com.arsdigita.cms.ContentSection, + * java.lang.String) */ public abstract String generateItemURL( PageState state, @@ -58,7 +63,12 @@ public abstract class AbstractItemResolver implements ItemResolver { String context); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, java.math.BigDecimal, java.lang.String, com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String) + * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL( + * com.arsdigita.bebop.PageState, + * java.math.BigDecimal, + * java.lang.String, + * com.arsdigita.cms.ContentSection, + * java.lang.String, java.lang.String) */ public abstract String generateItemURL( PageState state, @@ -69,7 +79,11 @@ public abstract class AbstractItemResolver implements ItemResolver { String templateContext); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, com.arsdigita.cms.ContentItem, com.arsdigita.cms.ContentSection, java.lang.String) + * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL( + * com.arsdigita.bebop.PageState, + * com.arsdigita.cms.ContentItem, + * com.arsdigita.cms.ContentSection, + * java.lang.String) */ public abstract String generateItemURL( PageState state, @@ -78,7 +92,11 @@ public abstract class AbstractItemResolver implements ItemResolver { String context); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL(com.arsdigita.bebop.PageState, com.arsdigita.cms.ContentItem, com.arsdigita.cms.ContentSection, java.lang.String, java.lang.String) + * @see com.arsdigita.cms.dispatcher.ItemResolver#generateItemURL( + * com.arsdigita.bebop.PageState, + * com.arsdigita.cms.ContentItem, + * com.arsdigita.cms.ContentSection, + * java.lang.String, java.lang.String) */ public abstract String generateItemURL( PageState state, @@ -88,9 +106,12 @@ public abstract class AbstractItemResolver implements ItemResolver { String templateContext); /* (non-Javadoc) - * @see com.arsdigita.cms.dispatcher.ItemResolver#getMasterPage(com.arsdigita.cms.ContentItem, javax.servlet.http.HttpServletRequest) + * @see com.arsdigita.cms.dispatcher.ItemResolver#getMasterPage( + * com.arsdigita.cms.ContentItem, + * javax.servlet.http.HttpServletRequest) */ - public abstract CMSPage getMasterPage(ContentItem item, HttpServletRequest request) throws ServletException; + public abstract CMSPage getMasterPage(ContentItem item, HttpServletRequest request) + throws ServletException; /** * Finds the template context from the URL and returns it, if it is there. @@ -115,7 +136,8 @@ public abstract class AbstractItemResolver implements ItemResolver { templateContext = tokenizer.nextToken(); } - if (templateContext != null && templateContext.startsWith(TEMPLATE_CONTEXT_PREFIX)) { + if (templateContext != null && templateContext.startsWith( + TEMPLATE_CONTEXT_PREFIX)) { return templateContext.substring(TEMPLATE_CONTEXT_PREFIX.length()); } else { return null; diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java index 9d77fb8ba..349f7b937 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/CMSDispatcher.java @@ -105,7 +105,10 @@ import org.apache.log4j.Logger; */ public class CMSDispatcher implements Dispatcher, ChainedDispatcher { - public static final String versionId = "$Id: CMSDispatcher.java 754 2005-09-02 13:26:17Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; + public static final String versionId = + "$Id: CMSDispatcher.java 1795 2009-02-07 10:47:32Z pboy $" + + " by $Author: pboy $, " + + "$DateTime: 2004/08/17 23:15:09 $"; private static Logger s_log = Logger.getLogger(CMSDispatcher.class); @@ -385,8 +388,8 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher { } if ( !sm.canAccess(user, SecurityManager.ADMIN_PAGES ) ) { throw new AccessDeniedException( - "You do not have access to the administrative pages for the " + - section.getName() + " content section."); + "You do not have access to the administrative pages for the " + + section.getName() + " content section."); } } else { @@ -395,8 +398,8 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher { if ( !sm.canAccess(user, SecurityManager.PUBLIC_PAGES) && !LocalRequestPassword.validLocalRequest(request)) { throw new AccessDeniedException( - "You do not have access to the public pages for the " + - section.getName() + " content section."); + "You do not have access to the public pages for the " + + section.getName() + " content section."); } } } diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/CategoryItemResolverImpl.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/CategoryItemResolverImpl.java index 734cac8f3..e4ab01229 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/CategoryItemResolverImpl.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/CategoryItemResolverImpl.java @@ -44,13 +44,13 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; /** - * Resolves items to URLs and URLs to items with category-based URLs for multiple language - * variants. + * Resolves items to URLs and URLs to items with category-based URLs for + * multiple language variants. * * Created Mon Jan 20 14:30:03 2003. * * @author Scott Seago - * @version $Id: CategoryItemResolverImpl.java 287 2005-02-22 00:29:02Z sskracic $ + * @version $Id: CategoryItemResolverImpl.java 1795 2009-02-07 10:47:32Z pboy $ */ public class CategoryItemResolverImpl extends MultilingualItemResolver implements CategoryItemResolver, TemplateResolver { @@ -138,6 +138,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver * #getCurrentContext}. * @return The content item, or null if no such item exists */ + @Override public ContentItem getItem(final ContentSection section, String url, final String context) { @@ -146,9 +147,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver " at URL '" + url + "' for context " + context); } - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(url, "String url"); - Assert.assertNotNull(context, "String context"); + Assert.exists(section, "ContentSection section"); + Assert.exists(url, "String url"); + Assert.exists(context, "String context"); url = stripTemplateFromURL(url); if ( ContentItem.DRAFT.equals(context) || @@ -158,7 +159,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver } String categoryURL = url.substring(("/"+CATEGORIES_PREFIX).length()); Category root = section.getRootCategory(); - Assert.assertNotNull (root); + Assert.exists(root); String file = null; @@ -191,7 +192,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver cats = root.getChildrenByURL (path + "/" + file); if (cats == null) { // final element wasn't category. assume an item. - if (path == "") { + // Really object identity? Don't think so. + // if (path == "") { + if (path.equals("")) { cats = new Category[1]; cats[0] = root; } else { @@ -204,7 +207,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver return null; } - Assert.assertTrue (cats.length >= 1); + Assert.isTrue (cats.length >= 1); Category cat = cats[cats.length-1]; s_log.debug ("Category is " + cat.getDisplayName()); String lang = null; @@ -312,9 +315,9 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver "' in category '" + category + "'"); } - Assert.assertNotNull(itemId, "BigDecimal itemId"); - Assert.assertNotNull(context, "Sring context"); - Assert.assertNotNull(section, "ContentSection section"); + Assert.exists(itemId, "BigDecimal itemId"); + Assert.exists(context, "Sring context"); + Assert.exists(section, "ContentSection section"); if (ContentItem.DRAFT.equals(context)) { // No template context here. @@ -332,11 +335,11 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver .newInstance(new OID(ContentItem.BASE_DATA_OBJECT_TYPE, itemId)); - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(item, "item"); - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), - "Generating " + ContentItem.LIVE + " " + - "URL; this item must be the live version"); + if (Assert.isEnabled()) { + Assert.exists(item, "item"); + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), + "Generating " + ContentItem.LIVE + " " + + "URL; this item must be the live version"); } return generateLiveURL(section, item, templateContext, category); @@ -392,18 +395,18 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver context + " in category " + category); } - Assert.assertNotNull(item, "ContentItem item"); - Assert.assertNotNull(context, "String context"); + Assert.exists(item, "ContentItem item"); + Assert.exists(context, "String context"); if (section == null) { section = item.getContentSection(); } if (ContentItem.DRAFT.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()), - "Generating " + ContentItem.DRAFT + - " url: item must be draft version"); + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()), + "Generating " + ContentItem.DRAFT + + " url: item must be draft version"); } // CategoryItemResolver doesn't change resolution of // back-end URLs @@ -411,10 +414,10 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver } else if (CMSDispatcher.PREVIEW.equals(context)) { return generatePreviewURL(section, item, templateContext, category); } else if (ContentItem.LIVE.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), - "Generating " + ContentItem.LIVE + - " url: item must be live version"); + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), + "Generating " + ContentItem.LIVE + + " url: item must be live version"); } return generateLiveURL(section, item, templateContext, category); @@ -436,6 +439,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver * @return The URL of the item * @see #getCurrentContext */ + @Override public String generateItemURL(final PageState state, final BigDecimal itemId, final String name, @@ -459,6 +463,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver * @return The URL of the item * @see #getCurrentContext */ + @Override public String generateItemURL(final PageState state, final BigDecimal itemId, final String name, @@ -481,6 +486,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver * @return The URL of the item * @see #getCurrentContext */ + @Override public String generateItemURL(final PageState state, final ContentItem item, final ContentSection section, @@ -502,6 +508,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver * @return The URL of the item * @see #getCurrentContext */ + @Override public String generateItemURL(final PageState state, final ContentItem item, ContentSection section, @@ -638,8 +645,8 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver ContentItem item, String templateContext, Category category) { - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(item, "ContentItem item"); + Assert.exists(section, "ContentSection section"); + Assert.exists(item, "ContentItem item"); Category urlCategory = getURLCategory(item,category); // Use passed-in category, if item is in it, else use default @@ -771,6 +778,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver /** * Returns the template associated with the item (if any) */ + @Override protected String getItemTemplate(ContentSection section, ContentItem item, HttpServletRequest request) { @@ -838,6 +846,7 @@ public class CategoryItemResolverImpl extends MultilingualItemResolver return encodeAsString().equals(obj.encodeAsString()); } + @Override public int hashCode() { return encodeAsString().hashCode(); } diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultItemTemplateResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultItemTemplateResolver.java.nolongerInUse similarity index 100% rename from ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultItemTemplateResolver.java rename to ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultItemTemplateResolver.java.nolongerInUse diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultTemplateResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultTemplateResolver.java index 872efcef3..a9d03360e 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultTemplateResolver.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/DefaultTemplateResolver.java @@ -32,9 +32,12 @@ import org.apache.log4j.Logger; import javax.servlet.http.HttpServletRequest; /** + * ------- May be outdated. TemplateResolver has been reworked. ---------- * Resolves the JSP template to use for dispatching an * item. This replaces TemplateResolver since the latter * has a useless API. + * ------------------------------------------------------------------------ + * *

In general, the process for resolving a template involves two * steps:

* @@ -58,8 +61,8 @@ import javax.servlet.http.HttpServletRequest; * */ -public class DefaultTemplateResolver extends AbstractTemplateResolver - implements TemplateResolver { +public class DefaultTemplateResolver extends AbstractTemplateResolver + implements TemplateResolver { private static Logger s_log = Logger.getLogger(DefaultTemplateResolver.class); @@ -93,7 +96,7 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver template = getDefaultTemplate(section, item, request); - Assert.assertNotNull(template, "default template"); + Assert.exists(template, "default template"); } if (s_log.isInfoEnabled()) { @@ -174,7 +177,8 @@ public class DefaultTemplateResolver extends AbstractTemplateResolver template = manager.getDefaultTemplate(section, type, context, mimeType); } else { if (s_log.isDebugEnabled()) { - s_log.debug("Item has no content type, not looking for a content type specific template"); + s_log.debug("Item has no content type, not looking for a " + + "content type specific template"); } } diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/ItemTemplateResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/ItemTemplateResolver.java.nolongerInUse similarity index 100% rename from ccm-cms/src/com/arsdigita/cms/dispatcher/ItemTemplateResolver.java rename to ccm-cms/src/com/arsdigita/cms/dispatcher/ItemTemplateResolver.java.nolongerInUse diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java index 8cdaf1603..5aac15497 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/MultilingualItemResolver.java @@ -48,12 +48,12 @@ import java.util.StringTokenizer; * Created Mon Jan 20 14:30:03 2003. * * @author Michael Hanisch - * @version $Id: MultilingualItemResolver.java 1160 2006-06-13 16:42:30Z apevec $ + * @version $Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $ */ public class MultilingualItemResolver extends AbstractItemResolver implements ItemResolver { public static final String versionId = - "$Id: MultilingualItemResolver.java 1160 2006-06-13 16:42:30Z apevec $" + - "$Author: apevec $" + + "$Id: MultilingualItemResolver.java 1795 2009-02-07 10:47:32Z pboy $" + + "$Author: pboy $" + "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger @@ -98,12 +98,12 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It " at URL '" + url + "' for context " + context); } - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(url, "String url"); - Assert.assertNotNull(context, "String context"); + Assert.exists(section, "ContentSection section"); + Assert.exists(url, "String url"); + Assert.exists(context, "String context"); Folder rootFolder = section.getRootFolder(); - url = stripTemplateFromURL(url); + url = stripTemplateFromURL(url); // nothing to do, if root folder is null if (rootFolder == null) { @@ -164,8 +164,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It // and return FIXME: Please hack this if there is // more graceful solution. [aavetyan] - if (Assert.isAssertEnabled()) { - Assert.assertTrue + if (Assert.isEnabled()) { + Assert.isTrue (url.indexOf(ITEM_ID) >= 0, "url must contain parameter " + ITEM_ID); } @@ -300,9 +300,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It context + "' with name '" + name + "'"); } - Assert.assertNotNull(itemId, "BigDecimal itemId"); - Assert.assertNotNull(context, "Sring context"); - Assert.assertNotNull(section, "ContentSection section"); + Assert.exists(itemId, "BigDecimal itemId"); + Assert.exists(context, "String context"); + Assert.exists(section, "ContentSection section"); if (ContentItem.DRAFT.equals(context)) { // No template context here. @@ -314,9 +314,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It } else if (ContentItem.LIVE.equals(context)) { ContentItem item = new ContentItem(itemId); - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(item, "item"); - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.exists(item, "item"); + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), "Generating " + ContentItem.LIVE + " " + "URL; this item must be the live version"); } @@ -370,16 +370,16 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It context); } - Assert.assertNotNull(item, "ContentItem item"); - Assert.assertNotNull(context, "String context"); + Assert.exists(item, "ContentItem item"); + Assert.exists(context, "String context"); if (section == null) { section = item.getContentSection(); } if (ContentItem.DRAFT.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.DRAFT.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.DRAFT.equals(item.getVersion()), "Generating " + ContentItem.DRAFT + " url: item must be draft version"); } @@ -388,8 +388,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It } else if (CMSDispatcher.PREVIEW.equals(context)) { return generatePreviewURL(section, item, templateContext); } else if (ContentItem.LIVE.equals(context)) { - if (Assert.isAssertEnabled()) { - Assert.assertTrue(ContentItem.LIVE.equals(item.getVersion()), + if (Assert.isEnabled()) { + Assert.isTrue(ContentItem.LIVE.equals(item.getVersion()), "Generating " + ContentItem.LIVE + " url: item must be live version"); } @@ -442,10 +442,10 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It " and section " + section); } - if (Assert.isAssertEnabled()) { - Assert.assertTrue(section != null && itemId != null, - "get draft url: neither secion nor item " + - "can be null"); + if (Assert.isEnabled()) { + Assert.isTrue(section != null && itemId != null, + "get draft url: neither secion nor item " + + "can be null"); } final String url = ContentItemPage.getItemURL @@ -495,7 +495,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It * add template context, if one is given */ // This is breaking URL's...not sure why it's here. XXX - // this should work with the appropriate logic. trying again. + // this should work with the appropriate logic. trying again. if (!(templateContext == null || templateContext.length() == 0)) { url.append(TEMPLATE_CONTEXT_PREFIX + templateContext + "/"); } @@ -569,8 +569,8 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It protected String generatePreviewURL(ContentSection section, ContentItem item, String templateContext) { - Assert.assertNotNull(section, "ContentSection section"); - Assert.assertNotNull(item, "ContentItem item"); + Assert.exists(section, "ContentSection section"); + Assert.exists(item, "ContentItem item"); final StringBuffer url = new StringBuffer(100); url.append(section.getPath()); @@ -644,9 +644,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It // XXX this is wrong: here we abort on not finding the // parameter; below we return null. - if (Assert.isAssertEnabled()) { - Assert.assertTrue(pos >= 0, - "Draft URL must contain parameter " + ITEM_ID); + if (Assert.isEnabled()) { + Assert.isTrue(pos >= 0, + "Draft URL must contain parameter " + ITEM_ID); } String item_id = url.substring(pos); // item_id == ITEM_ID=.... ? @@ -720,7 +720,12 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It // will have deal with 'foo' folder. String name = index > 0 ? url.substring(0, index) : ""; - parentFolder = name != "" ? (Folder) parentFolder.getItem(URLEncoder.encode(name), true) : parentFolder; + parentFolder = + // really object identity? Don't think so + // name != "" ? (Folder) parentFolder.getItem(URLEncoder.encode(name), true) + // : parentFolder; + name.isEmpty() ? parentFolder + : (Folder) parentFolder.getItem(URLEncoder.encode(name), true); url = index + 1 < len ? url.substring(index + 1) : ""; return getItemFromLiveURL(url, parentFolder); @@ -833,9 +838,9 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It lang = null; // no extension, so we cannot guess the language } - if (Assert.isAssertEnabled()) { - Assert.assertNotNull(name, "String name"); - Assert.assertTrue(lang == null || lang.length() == 2); + if (Assert.isEnabled()) { + Assert.exists(name, "String name"); + Assert.exists(lang == null || lang.length() == 2); } if (s_log.isDebugEnabled()) { diff --git a/ccm-cms/src/com/arsdigita/cms/enterprise.init b/ccm-cms/src/com/arsdigita/cms/enterprise.init index f19712f7a..ab35a2faf 100755 --- a/ccm-cms/src/com/arsdigita/cms/enterprise.init +++ b/ccm-cms/src/com/arsdigita/cms/enterprise.init @@ -22,17 +22,25 @@ init com.arsdigita.cms.publishToFile.Initializer { // "url stub" }'. // "Content type" is the object type of the content type. // "Root directory" must be a path to a writable directory, relative - // to the file-system root. "Shared storage" must be _true_ if the root + // to the file-system root. + // (pboy): "Root directory here is relative to application base! + // "Shared storage" must be _true_ if the root // directory is shared NFS storage, _false_ otherwise. "URL stub" // must be the path component of the URL from which the live server // will serve from this directory. destination = { { "com.arsdigita.cms.ContentItem", - "data/p2fs", + "p2fs", false, "/p2fs" }, - { "com.arsdigita.cms.Template", - "webapps/ROOT/packages/content-section/templates", + // (pboy): starting with webapps refers to the CCM_HOME env variable which + // points to the installation root of the servlet container. This is not + // used anymore, all specifications are relative to webapplication base. + // So the following may have to be changed to "packages/content-section/templates" + // if someone tries to use p2fs + { "com.arsdigita.cms.Template", + // "webapps/ROOT/packages/content-section/templates", + "packages/content-section/templates", false, "/templates" } }; diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java index dea08cb68..ebb97bb20 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/Initializer.java @@ -33,12 +33,13 @@ import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.TransactionContext; import com.arsdigita.persistence.metadata.MetadataRoot; import com.arsdigita.persistence.metadata.ObjectType; -import com.arsdigita.runtime.CCM; +import com.arsdigita.runtime.CCMResourceManager; import org.apache.log4j.Logger; -import java.io.File; +import java.io.*; +// import java.io.File; import java.util.List; import java.util.Iterator; @@ -47,6 +48,9 @@ import java.util.Iterator; * Initializes the publish-to-file service. The configuration is described in * the {@link com.arsdigita.cms.publishToFile} page. * + * (pboy) ToDo: Adjusting the initialisation to the new configuration method + * without enterprise.init file. + * * @author Jeff Teeters (teeters@arsdigita.com) * @version $Revision: #24 $ $Date: 2004/08/17 $ */ @@ -242,6 +246,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer { } String contentType = (String)entry.get(0); + // destRoot is here relative to webapp root! String destRoot = (String) entry.get(1); Boolean sharedRoot = (Boolean) entry.get(2); String destURL = (String) entry.get(3); @@ -267,8 +272,11 @@ public class Initializer implements com.arsdigita.initializer.Initializer { "' must not end with a '/'"); } - destRoot = new File(System.getProperty("ccm.home"), + // Does destRoot really now turns into an absolute fully pathname?! + destRoot = new File(CCMResourceManager.getBaseDirectory().getPath(), destRoot).getPath(); + s_log.info("Destination Root is set to : " + destRoot); + if (sharedRoot == null) { @@ -299,10 +307,24 @@ public class Initializer implements com.arsdigita.initializer.Initializer { File file = dest.getFile(); if (!file.exists()) { file.mkdirs(); + s_log.info(file.getPath() + " created"); } boolean writable = false; + FileWriter fl; + File fname = new File(file.getPath(),"placeholder.txt"); + s_log.info("Try to create : " + destRoot); try { writable = file.canWrite() && file.isDirectory(); + try { + fl = new FileWriter(fname.getPath()); + fl.write("Location for the p2fs module to store static content. \n"); + fl.close(); + } catch ( IOException e ) { + // Will be reported as an initalization error + s_log.warn("Fehler beim Erstellen der Datei " + fname.getPath()); + } + + } catch ( SecurityException ex ) { // Will be reported as an initalization error } @@ -310,7 +332,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer { // HACK: Let's see if we can write to the config directory. If we can, // then we're running as ccmadmin inside of ccm load, and there is no // need to thrown an exception. - File conf = CCM.getConfigDirectory(); + File conf = CCMResourceManager.getConfigDirectory(); if (conf.isDirectory() && conf.canWrite()) { // we're ok } else { @@ -319,7 +341,8 @@ public class Initializer implements com.arsdigita.initializer.Initializer { } } - if (Template.BASE_DATA_OBJECT_TYPE.equals(contentType) || !ContentSection.getConfig().getDisableItemPfs()) { + if (Template.BASE_DATA_OBJECT_TYPE.equals(contentType) || + !ContentSection.getConfig().getDisableItemPfs()) { PublishToFile.addDestination(contentType, dest); } diff --git a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java index 9f6035944..27046c536 100755 --- a/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java +++ b/ccm-cms/src/com/arsdigita/cms/publishToFile/PublishToFile.java @@ -72,6 +72,9 @@ public class PublishToFile implements PublishToFileListener { private final PublishedHTMLProvider m_provider; + /** + * Default Constructor + */ public PublishToFile() { m_provider = new HttpHTMLProvider(s_timeout); } @@ -357,8 +360,10 @@ public class PublishToFile implements PublishToFileListener { } /** - * Returns an extension given a content type.if the content-type is null assume "html". - * @param contentType Content-Type returned from the request, e.g. text/html;charset=ISO-8859-1 + * Returns an extension given a content type. If the content-type is null + * assume "html". + * @param contentType Content-Type returned from the request, + * e.g. text/html;charset=ISO-8859-1 **/ private static String getFileExtension(String contentType) { if ( contentType == null || contentType == "" ) @@ -371,11 +376,13 @@ public class PublishToFile implements PublishToFileListener { MimeType type = MimeType.loadMimeType(contentType); if (type == null) { - s_log.error("Unknown content type in published item: " + contentType + " assuming extension 'html'"); + s_log.error("Unknown content type in published item: " + + contentType + " assuming extension 'html'"); return ".html"; } else { if (s_log.isDebugEnabled()) { - s_log.debug("File extension for " + contentType + " is " + type.getFileExtension()); + s_log.debug("File extension for " + contentType + " is " + + type.getFileExtension()); } return "." + type.getFileExtension(); } @@ -383,7 +390,8 @@ public class PublishToFile implements PublishToFileListener { /*** - * Publish the page that is at url source to the file system and also any streamed assets that it references. + * Publish the page that is at url source to the file system and also any + * streamed assets that it references. * @param item ContentItem being published. * @param where Location Folder, where item will be published ***/ @@ -394,7 +402,8 @@ public class PublishToFile implements PublishToFileListener { // Read 'public' Template in HTML format and write to FS // It can be either 'deault' or specified template - String publicUrl = url + '?' + ContentSectionServlet.MEDIA_TYPE + '=' + TemplateManager.PUBLIC_CONTEXT; + String publicUrl = url + '?' + ContentSectionServlet.MEDIA_TYPE + '=' + + TemplateManager.PUBLIC_CONTEXT; if ( !publishPageAtDocRoot(readHTML(publicUrl), where, item, null, host) ) return false; @@ -470,7 +479,8 @@ public class PublishToFile implements PublishToFileListener { final String fileExt = getFileExtension(rf.contentType); final String html = rf.body; if (s_log.isDebugEnabled()) { - s_log.debug("content item before getting bundle is " + item.getName() + " with id " + item.getID()); + s_log.debug("content item before getting bundle is " + item.getName() + + " with id " + item.getID()); } @@ -526,7 +536,8 @@ public class PublishToFile implements PublishToFileListener { scanner.transform(out); out.close(); } catch ( IOException ex ) { - throw new PublishToFileException("Unable to write item " + item + " to filesystem.", ex); + throw new PublishToFileException("Unable to write item " + item + + " to filesystem.", ex); } if (s_log.isDebugEnabled()) { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java b/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java index f1e2261e4..7743d76dc 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/SortableList.java @@ -49,7 +49,7 @@ import java.io.IOException; */ public abstract class SortableList extends List { - public static final String versionId = "$Id: SortableList.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/17 23:15:09 $"; + public static final String versionId = "$Id: SortableList.java 1618 2007-09-13 12:14:51Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/17 23:15:09 $"; private static final org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger(SortableList.class); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java index b266b383f..8b7853ed7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java @@ -63,12 +63,12 @@ import org.apache.log4j.Logger; * A split pane for the Category Administration UI. * * @author Justin Ross <jross@redhat.com> - * @version $Id: CategoryAdminPane.java 287 2005-02-22 00:29:02Z sskracic $ + * @version $Id: CategoryAdminPane.java 1795 2009-02-07 10:47:32Z pboy $ */ public final class CategoryAdminPane extends BaseAdminPane { public static final String versionId = - "$Id: CategoryAdminPane.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + + "$Id: CategoryAdminPane.java 1795 2009-02-07 10:47:32Z pboy $" + + "$Author: pboy $" + "$DateTime: 2004/08/17 23:15:09 $"; public static final String CONTEXT_SELECTED="sel_context"; @@ -91,6 +91,7 @@ public final class CategoryAdminPane extends BaseAdminPane { m_contextModel = new UseContextSelectionModel(new StringParameter(CONTEXT_SELECTED)); + /* Left column */ /* Use context section */ List list = new List(new CategoryUseContextModelBuilder()); @@ -102,6 +103,7 @@ public final class CategoryAdminPane extends BaseAdminPane { m_categoryTree.addChangeListener(new SelectionListener()); m_model = m_categoryTree.getSelectionModel(); + setSelectionModel(m_model); setSelector(m_categoryTree); @@ -111,8 +113,6 @@ public final class CategoryAdminPane extends BaseAdminPane { ActionGroup contextGroup = new ActionGroup(); contextSection.setBody(contextGroup); contextGroup.setSubject(list); - - /* Add use context form to pane */ ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context"))); Form addContextForm = new AddUseContextForm(m_contextModel); getBody().add(addContextForm); @@ -135,10 +135,6 @@ public final class CategoryAdminPane extends BaseAdminPane { m_parent = new ParentRequestLocal(); m_category = new SelectionRequestLocal(); - /* Right column */ - /* Context section aka category details */ - - /* Action links */ setAdd(gz("cms.ui.category.add"), new CategoryAddForm(m_category, m_model)); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryCollectionListModel.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryCollectionListModel.java index f3765d775..114a35234 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryCollectionListModel.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryCollectionListModel.java @@ -74,13 +74,12 @@ public final class CategoryCollectionListModel implements ListModel { } /** - * Liest den Namen der Kategorie aus. Angepaßt, damit hier immer - * der Wert aus Category gelesen wird und nicht die lokalisierte - * Version. Ist hier sinnvoll, da es Teil der Adminoberfläche für - * Kategorien ist. Eine lokalisierte Anzeige würde hier nur zu - * Verwirrung führen. - * - * Quasimodo + * Reads the name of the category. + * + * Quasimodo: + * Modified to ensure that the value is read from Category (and not the + * localized version). This is necessary because we are in the admin GUI, + * a localized version would be confusing. */ public Object getElement() { return getCategory().getName(""); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryEditForm.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryEditForm.java index 882c179ae..0dd48c7f8 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryEditForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryEditForm.java @@ -28,6 +28,8 @@ import com.arsdigita.dispatcher.AccessDeniedException; import org.apache.log4j.Logger; /** + * XXX + * * @author Justin Ross <jross@redhat.com> * @version $Id: CategoryEditForm.java 287 2005-02-22 00:29:02Z sskracic $ */ @@ -61,6 +63,10 @@ final class CategoryEditForm extends BaseCategoryForm { final PageState state = e.getPageState(); final Category category = m_category.getCategory(state); + // Quasimodo: + // Modified to ensure that the value is read from Category (and not the + // localized version). This is necessary because we are in the admin GUI, + // a localized version would be confusing. m_name.setValue(state, category.getName("")); m_description.setValue(state, category.getDescription("")); m_url.setValue(state, category.getURL("")); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java index a9df661fa..a88433d7f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java @@ -71,6 +71,7 @@ import org.apache.log4j.Logger; * Edits a single category. * * @author Justin Ross <jross@redhat.com> + * @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @version $Id: CategoryItemPane.java 1329 2006-09-27 11:47:05Z sskracic $ */ class CategoryItemPane extends BaseItemPane { @@ -101,7 +102,8 @@ class CategoryItemPane extends BaseItemPane { add(m_detailPane); setDefault(m_detailPane); - final ActionLink orderItemsLink = new ActionLink(new Label(gz("cms.ui.category.categorized_objects"))) { + final ActionLink orderItemsLink = new ActionLink(new Label( + gz("cms.ui.category.categorized_objects"))) { public boolean isVisible(PageState state) { // update for live items only if (!super.isVisible(state)) { @@ -123,23 +125,32 @@ class CategoryItemPane extends BaseItemPane { add(orderItemsForm2); // Change index item - final ActionLink indexLink = new ActionLink(new Label(gz("cms.ui.category.change_index_item"))); + final ActionLink indexLink = new ActionLink(new Label(gz( + "cms.ui.category.change_index_item"))); final Form indexForm = new IndexItemSelectionForm(m_category); add(indexForm); - ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz("cms.ui.category.view_index_item")),""); - EditItemLink editIndexLink = new EditItemLink(new Label(gz("cms.ui.category.edit_index_item")),""); + ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz( + "cms.ui.category.view_index_item")),""); + EditItemLink editIndexLink = new EditItemLink(new Label(gz( + "cms.ui.category.edit_index_item")),""); // Summary - m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink, viewIndexLink, editIndexLink, orderItemsLink)); + m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink, + viewIndexLink, editIndexLink, orderItemsLink)); // Quasimodo: BEGIN // Localizations - ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz("cms.ui.category.localization.add"))) { + ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz( + "cms.ui.category.localization.add"))) { public boolean isVisible(PageState state) { // Only show addLanguage button, if there are langauges to add - int countSupportedLanguages = (new CategorizationConfig()).getSupportedLanguages().countTokens(); - long countLanguages = m_category.getCategory(state).getCategoryLocalizationCollection().size(); + int countSupportedLanguages = ( + new CategorizationConfig()).getSupportedLanguages() + .countTokens(); + long countLanguages = + m_category.getCategory(state) + .getCategoryLocalizationCollection().size(); if(countLanguages < countSupportedLanguages) { return true; @@ -149,7 +160,8 @@ class CategoryItemPane extends BaseItemPane { } }; - CategoryLocalizationAddForm addCategoryLocalizationForm = new CategoryLocalizationAddForm(m_category); + CategoryLocalizationAddForm addCategoryLocalizationForm = + new CategoryLocalizationAddForm(m_category); m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink)); add(addCategoryLocalizationForm); connect(addCategoryLocalizationLink, addCategoryLocalizationForm); @@ -225,8 +237,8 @@ class CategoryItemPane extends BaseItemPane { } /* - * This alternative constructor sets two additional links, allowing the user to view and - * edit the content index item. + * This alternative constructor sets two additional links, allowing + * the user to view and edit the content index item. */ SummarySection(final ActionLink editLink, final ActionLink deleteLink, @@ -373,14 +385,16 @@ class CategoryItemPane extends BaseItemPane { } }; - final ActionLink restoreDefault = new ActionLink(new Label(gz("cms.ui.restore_default_permissions"))) { + final ActionLink restoreDefault = new ActionLink(new Label(gz( + "cms.ui.restore_default_permissions"))) { public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); return PermissionService.getContext(cat) == null; } }; - final ActionLink useCustom = new ActionLink(new Label(gz("cms.ui.use_custom_permissions"))) { + final ActionLink useCustom = new ActionLink(new Label(gz( + "cms.ui.use_custom_permissions"))) { public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); return PermissionService.getContext(cat) != null; @@ -466,11 +480,13 @@ class CategoryItemPane extends BaseItemPane { super(c,s); } - // Build the preview link. This uses a standard redirect link to find the content. - // The prepareURL method is called by the printwriter + // Build the preview link. This uses a standard redirect link to find + // the content. The prepareURL method is called by the printwriter protected String prepareURL(final PageState state, String location) { - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state).getDirectIndexObject())).getPrimaryInstance(); + ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); if(indexItem==null) { return ""; } else { @@ -496,12 +512,18 @@ class CategoryItemPane extends BaseItemPane { EditItemLink(Component c, String s) { super(c,s); } - - // Build the preview link. This is based on code in the ContentSoonExpiredPane class. - // The prepareURL method of the parent is overwritten. This method is called by the printwriter + + /** + * Build the preview link. This is based on code in the + * ContentSoonExpiredPane class. The prepareURL method of the parent + * is overwritten. This method is called by the printwriter + */ + @Override protected String prepareURL(final PageState state, String location) { boolean canEdit = false; - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state).getDirectIndexObject())).getPrimaryInstance(); + ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); if(indexItem==null) { return ""; } @@ -509,12 +531,18 @@ class CategoryItemPane extends BaseItemPane { return ""; } else { BigDecimal draftID = indexItem.getDraftVersion().getID(); - return "item.jsp?item_id=" + draftID + "&set_tab=" + ContentItemPage.AUTHORING_TAB; + return "item.jsp?item_id=" + draftID + "&set_tab=" + + ContentItemPage.AUTHORING_TAB; } } - - // We only show this link when an index item exists for this category and - // the user is allowed to edit this item. + + /** + * We only show this link when an index item exists for this category + * and the user is allowed to edit this item. + * @param state + * @return + */ + @Override public boolean isVisible(PageState state) { if (!super.isVisible(state)) { return false; @@ -526,16 +554,26 @@ class CategoryItemPane extends BaseItemPane { return isItemEditable((ContentItem)indexItem,state); } } - - // This method checks whether a usern is allowed to edit a particular item + + /** + * This method checks whether a usern is allowed to edit a + * particular item. + * + * @param item + * @param state + * @return + */ private boolean isItemEditable(ContentItem item, PageState state) { BigDecimal id = item.getID(); User user = Web.getContext().getUser(); - ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), Integer.parseInt(id.toString()))); - Iterator permissions = PermissionService.getImpliedPrivileges(ci.getOID(), user.getOID()); + ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), + Integer.parseInt(id.toString()))); + Iterator permissions = PermissionService.getImpliedPrivileges( + ci.getOID(), user.getOID()); while (permissions.hasNext()) { PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next(); - if (permission.equals(PrivilegeDescriptor.ADMIN) || permission.equals(PrivilegeDescriptor.EDIT)) { + if (permission.equals(PrivilegeDescriptor.ADMIN) || + permission.equals(PrivilegeDescriptor.EDIT)) { return true; } } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java index 50a68e80c..bb94a55c9 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationAddForm.java @@ -1,12 +1,21 @@ /* - * CategoryLocalizationAddForm.java + * Copyright (C) 2008 Sören Bernstein All Rights Reserved. * - * Created on 18. April 2008, 12:03 + * 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 * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. */ - package com.arsdigita.cms.ui.category; @@ -27,18 +36,19 @@ import java.util.StringTokenizer; import org.apache.log4j.Logger; /** - * Erzeugt ein Formular zum Anlegen einer neuen Lokalisierungen zu der aktuellen Kategorie. - * Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare - * um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien. + * Generates a form for creating new localisations for the given category. * - * @author quasi + * This class is part of the admin GUI of CCM and extends the standard form + * in order to present forms for managing the multi-language categories. + * + * @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de */ public class CategoryLocalizationAddForm extends CategoryLocalizationForm { public static final String versionId = - "$Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; + "$Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $" + + "$Author: sskracic $" + + "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger (CategoryAddForm.class); @@ -46,7 +56,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm { /** Creates a new instance of CategoryLocalizationAddForm */ public CategoryLocalizationAddForm(final CategoryRequestLocal category) { - super("AddCategoryLocalization", gz("cms.ui.category.localization.add"), category); + super("AddCategoryLocalization", + gz("cms.ui.category.localization.add"), category); addInitListener(new InitListener()); addProcessListener(new ProcessListener()); @@ -66,19 +77,23 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm { final Category category = m_category.getCategory(state); // Select one entry - m_locale.addOption(new Option("", new Label((String) GlobalizationUtil.globalize("cms.ui.select_one").localize())), state); + m_locale.addOption(new Option("", + new Label((String) GlobalizationUtil.globalize( + "cms.ui.select_one").localize())), state); - // Für alle Sprachen, die unterstützt werden (registry-Eintrag) + // all supported languages (by registry entry) CategorizationConfig catConfig = new CategorizationConfig(); StringTokenizer strTok = catConfig.getSupportedLanguages(); while(strTok.hasMoreTokens()) { String code = strTok.nextToken(); - - // Wenn die Sprache bereits existiert, dann entferne sie aus der Auswahlliste - if(!category.getCategoryLocalizationCollection().localizationExists(code)) { - m_locale.addOption(new Option(code, new Locale(code).getDisplayLanguage()), state); + + // If lanuage exists, remove it from the selection list + if(!category.getCategoryLocalizationCollection(). + localizationExists(code)) { + m_locale.addOption(new Option(code, + new Locale(code).getDisplayLanguage()), state); } } } @@ -103,7 +118,8 @@ public class CategoryLocalizationAddForm extends CategoryLocalizationForm { //Assert.assertNotNull(parent, "Category parent"); if (s_log.isDebugEnabled()) { - s_log.debug("Adding localization for locale " + locale + " to category " + category); + s_log.debug("Adding localization for locale " + locale + + " to category " + category); } if (category.canEdit()) { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java index 016fc0e51..58ce135f6 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java @@ -1,12 +1,21 @@ /* - * CategoryLocalizationEditForm.java + * Copyright (C) 2008 Sören Bernstein All Rights Reserved. * - * Created on 18. April 2008, 12:03 + * 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 * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. */ - package com.arsdigita.cms.ui.category; import com.arsdigita.bebop.FormProcessException; @@ -22,18 +31,19 @@ import java.util.Locale; import org.apache.log4j.Logger; /** - * Erzeugt ein Formular zum Bearbeiten einer vorhandenen Lokalisierungen zu der aktuellen Kategorie. - * Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare - * um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien. + * Generates a form for editing an existing localisation for the given category. * - * @author quasi + * This class is part of the admin GUI of CCM and extends the standard form + * in order to present forms for managing the multi-language categories. + * + * @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de */ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { public static final String versionId = - "$Id: CategoryLocalizationEditForm.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/17 23:15:09 $"; + "$Id: CategoryLocalizationEditForm.java 287 2005-02-22 00:29:02Z sskracic $" + + "$Author: sskracic $" + + "$DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger (CategoryLocalizationEditForm.class); @@ -46,7 +56,8 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { public CategoryLocalizationEditForm(final CategoryRequestLocal category, final String locale) { - super("EditCategoryLocalization", gz("cms.ui.category.localization.edit"), category); + super("EditCategoryLocalization", gz( + "cms.ui.category.localization.edit"), category); // Speichere Locale ab m_categoryLocalizationLocale = locale; @@ -55,7 +66,10 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { addProcessListener(new ProcessListener()); } - + + /** + * please add: purpose of this class + */ private class InitListener implements FormInitListener { public final void init(final FormSectionEvent e) throws FormProcessException { @@ -63,15 +77,18 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { final PageState state = e.getPageState(); final Category category = m_category.getCategory(state); - // Verstecke Locale-Widget und sperre es (read-only) - m_locale.addOption(new Option(m_categoryLocalizationLocale, new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state); + // Hide Locale-Widget and lock it (read-only) + m_locale.addOption(new Option(m_categoryLocalizationLocale, + new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state); // m_locale.setValue(state, m_categoryLocalizationLocale); // m_locale.setVisible(state, false); m_locale.lock(); m_name.setValue(state, category.getName((String) m_locale.getValue(state))); - m_description.setValue(state, category.getDescription((String) m_locale.getValue(state))); + m_description.setValue(state, category.getDescription( + (String) m_locale.getValue(state))); m_url.setValue(state, category.getURL((String) m_locale.getValue(state))); + if (category.isEnabled((String) m_locale.getValue(state))) { m_isEnabled.setValue(state, "yes"); } else { @@ -80,6 +97,9 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { } } + /** + * ##todo: document purpose of this + */ private class ProcessListener implements FormProcessListener { public final void process(final FormSectionEvent e) throws FormProcessException { @@ -88,14 +108,20 @@ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { final Category category = m_category.getCategory(state); if (s_log.isDebugEnabled()) { - s_log.debug("Editing localization for locale " + m_locale + " for category " + category); + s_log.debug("Editing localization for locale " + m_locale + + " for category " + category); } if (category.canEdit()) { - category.setName((String) m_name.getValue(state), (String) m_locale.getValue(state)); - category.setDescription((String) m_description.getValue(state), (String) m_locale.getValue(state)); - category.setURL((String) m_url.getValue(state), (String) m_locale.getValue(state)); - category.setEnabled("yes".equals((String) m_isEnabled.getValue(state)), (String) m_locale.getValue(state)); + category.setName((String) m_name.getValue(state), + (String) m_locale.getValue(state)); + category.setDescription((String) m_description.getValue(state), + (String) m_locale.getValue(state)); + category.setURL((String) m_url.getValue(state), + (String) m_locale.getValue(state)); + category.setEnabled("yes".equals( + (String) m_isEnabled.getValue(state)), + (String) m_locale.getValue(state)); category.save(); } else { throw new AccessDeniedException(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationForm.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationForm.java index ba4d66c0a..28c979602 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationForm.java @@ -1,12 +1,21 @@ /* - * CategoryLocalizationForm.java + * Copyright (C) 2008 Sören Bernstein All Rights Reserved. * - * Created on 18. April 2008, 12:04 + * 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 * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. */ - package com.arsdigita.cms.ui.category; import com.arsdigita.bebop.FormProcessException; @@ -34,11 +43,12 @@ import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.xml.Element; /** - * Basisklasse für CategoryLocalizationAddForm und CategoryLocalizationEditForm. - * Diese Klasse ist Teil der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare - * um die Formulare für die Bearbeitung der neuen, mehrsprachigen Kategorien. + * Base class for CategoryLocalizationAddForm and CategoryLocalizationEditForm. * - * @author quasi + * This class is part of the admin GUI of CCM and extends the standard form + * in order to present forms for managing the multi-language categories. + * + * @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de */ public class CategoryLocalizationForm extends BaseForm { @@ -48,7 +58,9 @@ public class CategoryLocalizationForm extends BaseForm { final TextArea m_description; final TextField m_url; final RadioGroup m_isEnabled; - private Label m_script = new Label("", false); + private Label m_script = new Label( + "", false); private final static String LOCALE = "locale"; private final static String NAME = "name"; @@ -56,7 +68,10 @@ public class CategoryLocalizationForm extends BaseForm { private final static String URL = "url"; private final static String IS_ENABLED = "isEnabled"; - /** Creates a new instance of CategoryLocalizationForm */ + /** + * Creates a new instance of CategoryLocalizationForm. + * + */ public CategoryLocalizationForm(final String key, final GlobalizedMessage heading, final CategoryRequestLocal category) { @@ -65,7 +80,7 @@ public class CategoryLocalizationForm extends BaseForm { m_category = category; - // Parameter-Model für den SingleSelect + // Parameter-Model for SingleSelect ParameterModel localeParam = new StringParameter(LOCALE); localeParam.addParameterListener(new StringInRangeValidationListener(0, 2)); @@ -145,8 +160,12 @@ public class CategoryLocalizationForm extends BaseForm { super.generateXML(ps, parent); } - // Muß erweitert werden um folgende Funktion: Die Namen müssen eindeutig sein in der - // gewählten Sprache + /** + * Purpose: + * + * XXXToDo: Should be extended with the function: + * Names have to be unambiguous in the selected language + */ class NameUniqueListener implements ParameterListener { private final CategoryRequestLocal m_category; private final Widget m_widget; @@ -164,8 +183,15 @@ public class CategoryLocalizationForm extends BaseForm { m_type = type; } - - // XXX Muß noch angepaßt werden + + /** + * Purpose: + * + * XXX provisional, has to be adapted + * + * @param e + * @throws com.arsdigita.bebop.FormProcessException + */ public final void validate(final ParameterEvent e) throws FormProcessException { final PageState state = e.getPageState(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java index e0a6ac90a..25e6c9057 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java @@ -1,12 +1,21 @@ /* - * CategortyLocalizationTable.java + * Copyright (C) 2008 Sören Bernstein All Rights Reserved. * - * Created on 18. April 2008, 12:03 + * 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 * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. */ - package com.arsdigita.cms.ui.category; import com.arsdigita.bebop.Component; @@ -33,11 +42,12 @@ import java.math.BigDecimal; import java.util.Locale; /** - * Listet alle vorhandenen Lokalisierungen zu der aktuellen Kategorie auf. Diese Klasse ist Teil - * der Admin-Oberfläche von APLAWS+ und erweitert die Standardformulare um die Formulare für die - * Bearbeitung der neuen, mehrsprachigen Kategorien. + * Lists all existing localizations for a selected category. * - * @author quasi + * This class is part of the admin GUI of CCM and extends the standard form + * in order to present forms for managing the multi-language categories. + * + * @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de */ public class CategoryLocalizationTable extends Table implements TableActionListener { @@ -58,17 +68,23 @@ public class CategoryLocalizationTable extends Table implements TableActionListe m_category = category; m_model = model; - // Falls die Tabelle leer ist - setEmptyView(new Label(GlobalizationUtil.globalize("cms.ui.category.localization.none"))); + // if table is empty: + setEmptyView(new Label(GlobalizationUtil.globalize( + "cms.ui.category.localization.none"))); TableColumnModel tab_model = getColumnModel(); - // Spalten definieren - // XXX Globalisieren - tab_model.add(new TableColumn(0, GlobalizationUtil.globalize("cms.ui.category.localization.locale").localize(), TABLE_COL_LANG)); - tab_model.add(new TableColumn(1, GlobalizationUtil.globalize("cms.ui.category.localization.name").localize())); - tab_model.add(new TableColumn(2, GlobalizationUtil.globalize("cms.ui.category.localization.description").localize())); - tab_model.add(new TableColumn(3, GlobalizationUtil.globalize("cms.ui.category.localization.url").localize())); - tab_model.add(new TableColumn(4, GlobalizationUtil.globalize("cms.ui.category.localization.action").localize(), TABLE_COL_DEL)); + // define columns + // XXX globalize + tab_model.add(new TableColumn(0, GlobalizationUtil.globalize( + "cms.ui.category.localization.locale").localize(), TABLE_COL_LANG)); + tab_model.add(new TableColumn(1, GlobalizationUtil.globalize( + "cms.ui.category.localization.name").localize())); + tab_model.add(new TableColumn(2, GlobalizationUtil.globalize( + "cms.ui.category.localization.description").localize())); + tab_model.add(new TableColumn(3, GlobalizationUtil.globalize( + "cms.ui.category.localization.url").localize())); + tab_model.add(new TableColumn(4, GlobalizationUtil.globalize( + "cms.ui.category.localization.action").localize(), TABLE_COL_DEL)); setModelBuilder(new CategoryLocalizationTableModelBuilder()); @@ -78,8 +94,13 @@ public class CategoryLocalizationTable extends Table implements TableActionListe addTableActionListener(this); } - - private class CategoryLocalizationTableModelBuilder extends LockableImpl implements TableModelBuilder { + + /** + * XXXX + * + */ + private class CategoryLocalizationTableModelBuilder extends LockableImpl + implements TableModelBuilder { public TableModel makeModel(Table table, PageState state) { final Category category = m_category.getCategory(state); @@ -91,7 +112,11 @@ public class CategoryLocalizationTable extends Table implements TableActionListe } } } - + + /** + * XXX + * + */ private class CategoryLocalizationTableModel implements TableModel { final private int MAX_DESC_LENGTH = 25; @@ -110,8 +135,10 @@ public class CategoryLocalizationTable extends Table implements TableActionListe } /** - * check collection for the existence of another row.If it has fetch the - * value of current CategoryLocalization object into m_categoryLocalization class variable. + * Check collection for the existence of another row. + * + * If exists, fetch the value of current CategoryLocalization object + * into m_categoryLocalization class variable. */ public boolean nextRow() { @@ -139,7 +166,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe return m_categoryLocalization.getName(); case 2: String desc = m_categoryLocalization.getDescription(); - if(desc != null && desc.length() > MAX_DESC_LENGTH) desc = desc.substring(MAX_DESC_LENGTH - 3).concat("..."); + if(desc != null && desc.length() > MAX_DESC_LENGTH) + desc = desc.substring(MAX_DESC_LENGTH - 3).concat("..."); return desc; case 3: return m_categoryLocalization.getURL(); @@ -172,7 +200,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe int row, int column) { SecurityManager sm = Utilities.getSecurityManager(state); -// CategoryLocalization cl = (CategoryLocalization) m_clSel.getSelectedObject(state); +// CategoryLocalization cl = +// (CategoryLocalization) m_clSel.getSelectedObject(state); // boolean canEdit = sm.canAccess(state.getRequest(), // SecurityManager.DELETE_ITEM, @@ -198,7 +227,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe int row, int column) { // SecurityManager sm = Utilities.getSecurityManager(state); -// CategoryLocalization categoryLocalization = new CategoryLocalization(new BigDecimal(evt.getRowKey().toString())); +// CategoryLocalization categoryLocalization = +// new CategoryLocalization(new BigDecimal(evt.getRowKey().toString())); // boolean canDelete = sm.canAccess(state.getRequest(), // SecurityManager.DELETE_ITEM, @@ -206,7 +236,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe // if (canDelete) { if (true) { ControlLink link = new ControlLink(value.toString()); - link.setConfirmation((String) GlobalizationUtil.globalize("cms.ui.category.localization.confirm_delete").localize()); + link.setConfirmation((String) GlobalizationUtil.globalize( + "cms.ui.category.localization.confirm_delete").localize()); // link.setConfirmation("Delete this localization?"); return link; } else { @@ -225,7 +256,8 @@ public class CategoryLocalizationTable extends Table implements TableActionListe PageState state = evt.getPageState(); // Get selected CategoryLocalization - CategoryLocalization categoryLocalization = new CategoryLocalization(new BigDecimal(evt.getRowKey().toString())); + CategoryLocalization categoryLocalization = + new CategoryLocalization(new BigDecimal(evt.getRowKey().toString())); // Get Category Category category = m_category.getCategory(state); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java b/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java index 340a7681a..538d35885 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java @@ -85,12 +85,12 @@ import com.arsdigita.workflow.simple.WorkflowTemplate; * @author Michael Pih * @author Xixi D'moon <xdmoon@redhat.com> * @author Justin Ross <jross@redhat.com> - * @version $Id: ItemLifecycleSelectForm.java 1563 2007-04-18 15:58:17Z apevec $ + * @version $Id: ItemLifecycleSelectForm.java 1643 2007-09-17 14:19:06Z chrisg23 $ */ class ItemLifecycleSelectForm extends BaseForm { public static final String versionId = - "$Id: ItemLifecycleSelectForm.java 1563 2007-04-18 15:58:17Z apevec $" + - "$Author: apevec $" + + "$Id: ItemLifecycleSelectForm.java 1643 2007-09-17 14:19:06Z chrisg23 $" + + "$Author: chrisg23 $" + "$DateTime: $"; private static final Logger s_log = Logger.getLogger diff --git a/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java b/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java index 18a781be4..4840d52be 100755 --- a/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java +++ b/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java @@ -73,7 +73,7 @@ import java.util.Set; **/ public class CMSTask extends UserTask { - public static final String versionId = "$Id: CMSTask.java 1583 2007-05-25 15:32:13Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/17 23:15:09 $"; + public static final String versionId = "$Id: CMSTask.java 1637 2007-09-17 10:14:27Z chrisg23 $ by $Author: chrisg23 $, $DateTime: 2004/08/17 23:15:09 $"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.workflow.CMSTask"; diff --git a/ccm-core/application.xml b/ccm-core/application.xml index 19ed9ec6c..310be2a36 100755 --- a/ccm-core/application.xml +++ b/ccm-core/application.xml @@ -2,7 +2,7 @@ diff --git a/ccm-core/pdl/com/arsdigita/categorization/Category.pdl b/ccm-core/pdl/com/arsdigita/categorization/Category.pdl index 8252b5966..3e31834a9 100755 --- a/ccm-core/pdl/com/arsdigita/categorization/Category.pdl +++ b/ccm-core/pdl/com/arsdigita/categorization/Category.pdl @@ -23,7 +23,7 @@ import com.arsdigita.kernel.*; object type Category extends ACSObject { - // Hier werden die Default-Werte gespeichert ??? + // Default values are stored here ??? String[0..1] description = cat_categories.description VARCHAR(4000); String[1..1] name = cat_categories.name VARCHAR(200); String[0..1] url = cat_categories.url VARCHAR(200); diff --git a/ccm-core/sql/ccm-core/oracle-se-create.sql b/ccm-core/sql/ccm-core/oracle-se-create.sql index 39f9130fa..d0cf97c6e 100755 --- a/ccm-core/sql/ccm-core/oracle-se-create.sql +++ b/ccm-core/sql/ccm-core/oracle-se-create.sql @@ -15,7 +15,7 @@ -- License along with this library; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --- $Id: oracle-se-create.sql 725 2005-08-23 16:56:33Z sskracic $ +-- $Id: oracle-se-create.sql 1704 2008-06-08 14:45:43Z pboy $ -- $DateTime: 2004/08/16 18:10:38 $ @@ oracle-se/function-currentDate.sql diff --git a/ccm-core/sql/ccm-core/oracle-se/messaging/table-messages.sql b/ccm-core/sql/ccm-core/oracle-se/messaging/table-messages.sql index 93aade6e2..ebb0e9288 100755 --- a/ccm-core/sql/ccm-core/oracle-se/messaging/table-messages.sql +++ b/ccm-core/sql/ccm-core/oracle-se/messaging/table-messages.sql @@ -15,7 +15,7 @@ -- License along with this library; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --- $Id: table-messages.sql 287 2005-02-22 00:29:02Z sskracic $ +-- $Id: table-messages.sql 1704 2008-06-08 14:45:43Z pboy $ -- $DateTime: 2004/08/16 18:10:38 $ create table messages ( diff --git a/ccm-core/sql/ccm-core/postgres-create.sql b/ccm-core/sql/ccm-core/postgres-create.sql index 2ec765bd4..32dd81457 100755 --- a/ccm-core/sql/ccm-core/postgres-create.sql +++ b/ccm-core/sql/ccm-core/postgres-create.sql @@ -15,7 +15,7 @@ -- License along with this library; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --- $Id: postgres-create.sql 725 2005-08-23 16:56:33Z sskracic $ +-- $Id: postgres-create.sql 1704 2008-06-08 14:45:43Z pboy $ -- $DateTime: 2004/08/16 18:10:38 $ begin; diff --git a/ccm-core/sql/ccm-core/upgrade/postgres-6.5.5-6.5.6.sql b/ccm-core/sql/ccm-core/upgrade/postgres-6.5.5-6.5.6.sql index 353ae240c..5f671face 100644 --- a/ccm-core/sql/ccm-core/upgrade/postgres-6.5.5-6.5.6.sql +++ b/ccm-core/sql/ccm-core/upgrade/postgres-6.5.5-6.5.6.sql @@ -1,5 +1,5 @@ -- --- Copyright (C) 2008 pb@zes.uni-bremen.de All Rights Reserved. +-- Copyright (C) 2008 Peter Boy 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 diff --git a/ccm-core/src/ccm-core.checklist b/ccm-core/src/ccm-core.checklist index cbd13b318..f535ca906 100755 --- a/ccm-core/src/ccm-core.checklist +++ b/ccm-core/src/ccm-core.checklist @@ -1,4 +1,9 @@ + + diff --git a/ccm-core/src/ccm-core.upgrade b/ccm-core/src/ccm-core.upgrade index 1e2ef05e0..934c12fdd 100755 --- a/ccm-core/src/ccm-core.upgrade +++ b/ccm-core/src/ccm-core.upgrade @@ -3,9 +3,9 @@