From 8ba6c27fe0bb50cccfec9914dbad81e050b44cc3 Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Sat, 4 Feb 2006 23:18:46 +0000 Subject: [PATCH] Phase 2 of the client config re-org git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2298 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/web-client-config.xml | 132 +++---- .../org/alfresco/web/app/Application.java | 15 +- .../alfresco/web/bean/AdvancedSearchBean.java | 22 +- .../org/alfresco/web/bean/BrowseBean.java | 31 +- .../org/alfresco/web/bean/ForumsBean.java | 52 +-- .../java/org/alfresco/web/bean/LoginBean.java | 13 +- .../config/AdvancedSearchConfigElement.java | 193 ++++++++++ .../config/AdvancedSearchElementReader.java | 105 ++++++ .../web/config/ClientConfigElement.java | 305 +++------------ .../web/config/ClientElementReader.java | 186 +-------- .../web/config/LanguagesConfigElement.java | 125 ++++++ .../web/config/LanguagesElementReader.java | 74 ++++ .../web/config/MimeTypeConfigElement.java | 88 ----- .../web/config/MimeTypesElementReader.java | 87 ----- .../config/PropertySheetConfigElement.java | 8 +- .../web/config/ServerConfigElement.java | 94 ----- .../web/config/ServerElementReader.java | 70 ---- .../web/config/ViewsConfigElement.java | 355 ++++++++++++++++++ .../web/config/ViewsElementReader.java | 154 ++++++++ .../web/config/WebClientConfigTest.java | 281 ++++++++++---- .../ui/common/component/data/UIRichList.java | 11 +- .../component/UISearchCustomProperties.java | 12 +- .../test-resources/test-config-override.xml | 82 ++++ source/test-resources/test-config.xml | 82 +++- 24 files changed, 1570 insertions(+), 1007 deletions(-) create mode 100644 source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java create mode 100644 source/java/org/alfresco/web/config/AdvancedSearchElementReader.java create mode 100644 source/java/org/alfresco/web/config/LanguagesConfigElement.java create mode 100644 source/java/org/alfresco/web/config/LanguagesElementReader.java delete mode 100644 source/java/org/alfresco/web/config/MimeTypeConfigElement.java delete mode 100644 source/java/org/alfresco/web/config/MimeTypesElementReader.java delete mode 100644 source/java/org/alfresco/web/config/ServerConfigElement.java delete mode 100644 source/java/org/alfresco/web/config/ServerElementReader.java create mode 100644 source/java/org/alfresco/web/config/ViewsConfigElement.java create mode 100644 source/java/org/alfresco/web/config/ViewsElementReader.java create mode 100644 source/test-resources/test-config-override.xml diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index c5722e045b..ddefb03744 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -6,57 +6,70 @@ - + + + - - /jsp/error.jsp - - /jsp/error.jsp - - /jsp/error_missing.jsp - - - /jsp/login.jsp - admin - - - English - - - - + + /jsp/error.jsp - - - - - - - - - - - - - + + /jsp/login.jsp - - - org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer - org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer - org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer - org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer - + + 6 + + + true + + + 3 + + + + + + Guest + + + http://www.alfresco.org/help/webclient + + + + http + + + alfresco@alfresco.org + + + + + + + English + + + + + + + + + + org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer + org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer + org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer + org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer @@ -96,32 +109,23 @@ - - - 6 - - - true - - - 3 - - - - - - Guest - - - http://www.alfresco.org/help/webclient - - - - http - - - alfresco@alfresco.org - + + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/web/app/Application.java b/source/java/org/alfresco/web/app/Application.java index 0ff3c4d211..76fc58e93a 100644 --- a/source/java/org/alfresco/web/app/Application.java +++ b/source/java/org/alfresco/web/app/Application.java @@ -40,7 +40,6 @@ import org.alfresco.web.app.servlet.AuthenticationHelper; import org.alfresco.web.bean.ErrorBean; import org.alfresco.web.bean.repository.User; import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.config.ServerConfigElement; import org.apache.commons.logging.Log; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -681,11 +680,12 @@ public class Application String errorPage = null; ConfigService svc = (ConfigService)context.getBean(BEAN_CONFIG_SERVICE); - ServerConfigElement serverConfig = (ServerConfigElement)svc.getGlobalConfig().getConfigElement("server"); + ClientConfigElement clientConfig = (ClientConfigElement)svc.getGlobalConfig(). + getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID); - if (serverConfig != null) + if (clientConfig != null) { - errorPage = serverConfig.getErrorPage(); + errorPage = clientConfig.getErrorPage(); } return errorPage; @@ -702,11 +702,12 @@ public class Application String loginPage = null; ConfigService svc = (ConfigService)context.getBean(BEAN_CONFIG_SERVICE); - ServerConfigElement serverConfig = (ServerConfigElement)svc.getGlobalConfig().getConfigElement("server"); + ClientConfigElement clientConfig = (ClientConfigElement)svc.getGlobalConfig(). + getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID); - if (serverConfig != null) + if (clientConfig != null) { - loginPage = serverConfig.getLoginPage(); + loginPage = clientConfig.getLoginPage(); } return loginPage; diff --git a/source/java/org/alfresco/web/bean/AdvancedSearchBean.java b/source/java/org/alfresco/web/bean/AdvancedSearchBean.java index 50530e2898..cc9e00b91b 100644 --- a/source/java/org/alfresco/web/bean/AdvancedSearchBean.java +++ b/source/java/org/alfresco/web/bean/AdvancedSearchBean.java @@ -33,7 +33,6 @@ import javax.faces.model.ListDataModel; import javax.faces.model.SelectItem; import javax.transaction.UserTransaction; -import org.alfresco.config.ConfigService; import org.alfresco.model.ContentModel; import org.alfresco.repo.cache.ExpiringValueCache; import org.alfresco.repo.content.MimetypeMap; @@ -63,8 +62,8 @@ import org.alfresco.web.bean.repository.MapNode; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.User; -import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.config.ClientConfigElement.CustomProperty; +import org.alfresco.web.config.AdvancedSearchConfigElement; +import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; import org.alfresco.web.ui.common.Utils; @@ -563,7 +562,7 @@ public class AdvancedSearchBean Application.getMessage(context, MSG_CONTENT))); // add any configured content sub-types to the list - List types = getClientConfig().getContentTypes(); + List types = getSearchConfig().getContentTypes(); if (types != null) { DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService(); @@ -1391,13 +1390,16 @@ public class AdvancedSearchBean /** * @return ClientConfigElement */ - private ClientConfigElement getClientConfig() + private AdvancedSearchConfigElement getSearchConfig() { - if (clientConfigElement == null) + if (searchConfigElement == null) { - clientConfigElement = Application.getClientConfig(FacesContext.getCurrentInstance()); + searchConfigElement = (AdvancedSearchConfigElement)Application.getConfigService( + FacesContext.getCurrentInstance()).getConfig("Advanced Search"). + getConfigElement(AdvancedSearchConfigElement.CONFIG_ELEMENT_ID); } - return clientConfigElement; + + return searchConfigElement; } /** @@ -1410,7 +1412,7 @@ public class AdvancedSearchBean if (customPropertyLookup == null) { customPropertyLookup = new HashMap(7, 1.0f); - List customProps = getClientConfig().getCustomProperties(); + List customProps = getSearchConfig().getCustomProperties(); if (customProps != null) { DictionaryService dd = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDictionaryService(); @@ -1494,7 +1496,7 @@ public class AdvancedSearchBean private SearchService searchService; /** Client Config reference */ - private ClientConfigElement clientConfigElement = null; + private AdvancedSearchConfigElement searchConfigElement = null; /** Progressive panel UI state */ private Map panels = new HashMap(5, 1.0f); diff --git a/source/java/org/alfresco/web/bean/BrowseBean.java b/source/java/org/alfresco/web/bean/BrowseBean.java index 57a29b0c89..c335df041c 100644 --- a/source/java/org/alfresco/web/bean/BrowseBean.java +++ b/source/java/org/alfresco/web/bean/BrowseBean.java @@ -56,7 +56,7 @@ import org.alfresco.web.bean.repository.NodePropertyResolver; import org.alfresco.web.bean.repository.QNameNodeMap; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wizard.NewSpaceWizard; -import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.config.ViewsConfigElement; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.component.IBreadcrumbHandler; @@ -207,7 +207,8 @@ public class BrowseBean implements IContextListener */ public int getMinimumSearchLength() { - return this.clientConfig.getSearchMinimum(); + return Application.getClientConfig(FacesContext.getCurrentInstance()). + getSearchMinimum(); } /** @@ -251,9 +252,9 @@ public class BrowseBean implements IContextListener if (this.contentRichList != null) { this.contentRichList.setInitialSortColumn( - this.clientConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); this.contentRichList.setInitialSortDescending( - this.clientConfig.hasDescendingSort(PAGE_NAME_BROWSE)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); } } @@ -275,9 +276,9 @@ public class BrowseBean implements IContextListener { // set the initial sort column and direction this.spacesRichList.setInitialSortColumn( - this.clientConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_BROWSE)); this.spacesRichList.setInitialSortDescending( - this.clientConfig.hasDescendingSort(PAGE_NAME_BROWSE)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_BROWSE)); } } @@ -436,7 +437,7 @@ public class BrowseBean implements IContextListener if (VIEWMODE_DASHBOARD.equals(viewMode) == false) { // set the page size based on the style of display - setBrowsePageSize(this.clientConfig.getDefaultPageSize(PAGE_NAME_BROWSE, + setBrowsePageSize(this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, viewMode)); if (logger.isDebugEnabled()) @@ -824,7 +825,8 @@ public class BrowseBean implements IContextListener // always be used otherwise the configured approach is used if (node.hasAspect(ContentModel.ASPECT_INLINEEDITABLE) == false) { - editLinkType = clientConfig.getEditLinkType(); + editLinkType = Application.getClientConfig( + FacesContext.getCurrentInstance()).getEditLinkType(); if (editLinkType == null) { editLinkType = "http"; @@ -1245,9 +1247,12 @@ public class BrowseBean implements IContextListener */ private void initFromClientConfig() { - this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); - this.browseViewMode = clientConfig.getDefaultView(PAGE_NAME_BROWSE); - this.browsePageSize = clientConfig.getDefaultPageSize(PAGE_NAME_BROWSE, + this.viewsConfig = (ViewsConfigElement)Application.getConfigService( + FacesContext.getCurrentInstance()).getConfig("Views"). + getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); + + this.browseViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_BROWSE); + this.browsePageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_BROWSE, this.browseViewMode); } @@ -1467,8 +1472,8 @@ public class BrowseBean implements IContextListener /** The file folder service */ private FileFolderService fileFolderService; - /** Client configuration object */ - private ClientConfigElement clientConfig = null; + /** Views configuration object */ + private ViewsConfigElement viewsConfig = null; /** Component references */ private UIRichList spacesRichList; diff --git a/source/java/org/alfresco/web/bean/ForumsBean.java b/source/java/org/alfresco/web/bean/ForumsBean.java index 74cbc433c3..59ade67bae 100644 --- a/source/java/org/alfresco/web/bean/ForumsBean.java +++ b/source/java/org/alfresco/web/bean/ForumsBean.java @@ -59,7 +59,7 @@ import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.NodePropertyResolver; import org.alfresco.web.bean.repository.QNameNodeMap; import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.config.ViewsConfigElement; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIModeList; @@ -103,8 +103,8 @@ public class ForumsBean implements IContextListener /** The NavigationBean bean reference */ private NavigationBean navigator; - /** Client configuration object */ - private ClientConfigElement clientConfig = null; + /** Views configuration object */ + private ViewsConfigElement viewsConfig = null; /** Component references */ private UIRichList forumsRichList; @@ -220,9 +220,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.forumsRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_FORUMS)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUMS)); this.forumsRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_FORUMS)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUMS)); } } @@ -277,9 +277,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.topicRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_TOPIC)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_TOPIC)); this.topicRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_TOPIC)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_TOPIC)); } } @@ -334,9 +334,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.forumRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_FORUM)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUM)); this.forumRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_FORUM)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUM)); } } @@ -554,9 +554,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.forumsRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_FORUMS)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUMS)); this.forumsRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_FORUMS)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUMS)); } } @@ -567,9 +567,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.forumRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_FORUM)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_FORUM)); this.forumRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_FORUM)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_FORUM)); } } @@ -580,9 +580,9 @@ public class ForumsBean implements IContextListener { // set the initial sort column and direction this.topicRichList.setInitialSortColumn( - clientConfig.getDefaultSortColumn(PAGE_NAME_TOPIC)); + this.viewsConfig.getDefaultSortColumn(PAGE_NAME_TOPIC)); this.topicRichList.setInitialSortDescending( - clientConfig.hasDescendingSort(PAGE_NAME_TOPIC)); + this.viewsConfig.hasDescendingSort(PAGE_NAME_TOPIC)); } } @@ -611,7 +611,7 @@ public class ForumsBean implements IContextListener setForumsViewMode(viewMode); // get the default for the forum page - this.forumsPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUMS, + this.forumsPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_FORUMS, this.forumsViewMode); if (logger.isDebugEnabled()) @@ -634,7 +634,7 @@ public class ForumsBean implements IContextListener setForumViewMode(viewMode); // get the default for the forum page - this.forumPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUM, + this.forumPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_FORUM, this.forumViewMode); if (logger.isDebugEnabled()) @@ -657,7 +657,7 @@ public class ForumsBean implements IContextListener setTopicViewMode(viewMode); // change the default page size if necessary - this.topicPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_TOPIC, + this.topicPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_TOPIC, this.topicViewMode); if (logger.isDebugEnabled()) @@ -950,21 +950,23 @@ public class ForumsBean implements IContextListener */ private void initFromClientConfig() { - this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); + this.viewsConfig = (ViewsConfigElement)Application.getConfigService( + FacesContext.getCurrentInstance()).getConfig("Views"). + getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); // get the defaults for the forums page - this.forumsViewMode = this.clientConfig.getDefaultView(PAGE_NAME_FORUMS); - this.forumsPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUMS, + this.forumsViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_FORUMS); + this.forumsPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_FORUMS, this.forumsViewMode); // get the default for the forum page - this.forumViewMode = this.clientConfig.getDefaultView(PAGE_NAME_FORUM); - this.forumPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUM, + this.forumViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_FORUM); + this.forumPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_FORUM, this.forumViewMode); // get the default for the topic page - this.topicViewMode = this.clientConfig.getDefaultView(PAGE_NAME_TOPIC); - this.topicPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_TOPIC, + this.topicViewMode = this.viewsConfig.getDefaultView(PAGE_NAME_TOPIC); + this.topicPageSize = this.viewsConfig.getDefaultPageSize(PAGE_NAME_TOPIC, this.topicViewMode); if (logger.isDebugEnabled()) diff --git a/source/java/org/alfresco/web/bean/LoginBean.java b/source/java/org/alfresco/web/bean/LoginBean.java index 856a358065..4a0d60bb9b 100644 --- a/source/java/org/alfresco/web/bean/LoginBean.java +++ b/source/java/org/alfresco/web/bean/LoginBean.java @@ -30,6 +30,8 @@ import javax.faces.validator.ValidatorException; import javax.portlet.PortletRequest; import javax.servlet.http.HttpServletRequest; +import org.alfresco.config.Config; +import org.alfresco.config.ConfigService; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.service.cmr.repository.InvalidNodeRefException; @@ -41,7 +43,7 @@ import org.alfresco.web.app.Application; import org.alfresco.web.app.servlet.AuthenticationHelper; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.User; -import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.config.LanguagesConfigElement; import org.alfresco.web.ui.common.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -152,16 +154,17 @@ public class LoginBean */ public SelectItem[] getLanguages() { - ClientConfigElement config = Application.getClientConfig( - FacesContext.getCurrentInstance()); + Config config = Application.getConfigService(FacesContext.getCurrentInstance()).getConfig("Languages"); + LanguagesConfigElement langConfig = (LanguagesConfigElement)config.getConfigElement( + LanguagesConfigElement.CONFIG_ELEMENT_ID); - List languages = config.getLanguages(); + List languages = langConfig.getLanguages(); SelectItem[] items = new SelectItem[languages.size()]; int count = 0; for (String locale : languages) { // get label associated to the locale - String label = config.getLabelForLanguage(locale); + String label = langConfig.getLabelForLanguage(locale); // set default selection if (count == 0 && this.language == null) diff --git a/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java new file mode 100644 index 0000000000..6a711ba85b --- /dev/null +++ b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.element.ConfigElementAdapter; + +/** + * Custom config element that represents config values for advanced search + * + * @author Gavin Cornwell + */ +public class AdvancedSearchConfigElement extends ConfigElementAdapter +{ + public static final String CONFIG_ELEMENT_ID = "advanced-search"; + + private List contentTypes = null; + private List customProps = null; + + /** + * Default Constructor + */ + public AdvancedSearchConfigElement() + { + super(CONFIG_ELEMENT_ID); + } + + /** + * Constructor + * + * @param name Name of the element this config element represents + */ + public AdvancedSearchConfigElement(String name) + { + super(name); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#getChildren() + */ + @Override + public List getChildren() + { + throw new ConfigException("Reading the advanced search config via the generic interfaces is not supported"); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#combine(org.alfresco.config.ConfigElement) + */ + public ConfigElement combine(ConfigElement configElement) + { + AdvancedSearchConfigElement existingElement = (AdvancedSearchConfigElement)configElement; + AdvancedSearchConfigElement newElement = new AdvancedSearchConfigElement(); + + // just copy the list of types and properties from this instance to the new one + if (this.contentTypes != null) + { + for (String type : this.contentTypes) + { + newElement.addContentType(type); + } + } + + if (this.customProps != null) + { + for (CustomProperty property : this.customProps) + { + newElement.addCustomProperty(property); + } + } + + // now add those types and custom properties from the element to be combined + if (existingElement.getContentTypes() != null) + { + for (String type : existingElement.getContentTypes()) + { + newElement.addContentType(type); + } + } + + if (existingElement.getCustomProperties() != null) + { + for (CustomProperty property : existingElement.getCustomProperties()) + { + newElement.addCustomProperty(property); + } + } + + return newElement; + } + + /** + * @return Returns the contentTypes. + */ + public List getContentTypes() + { + return this.contentTypes; + } + + /** + * @param contentTypes The contentTypes to set. + */ + /*package*/ void setContentTypes(List contentTypes) + { + this.contentTypes = contentTypes; + } + + /** + * @param contentType Adds the given content type to the list + */ + /*package*/ void addContentType(String contentType) + { + if (this.contentTypes == null) + { + this.contentTypes = new ArrayList(3); + } + + if (this.contentTypes.contains(contentType) == false) + { + this.contentTypes.add(contentType); + } + } + + /** + * @return Returns the customProps. + */ + public List getCustomProperties() + { + return this.customProps; + } + + /** + * @param customProps The customProps to set. + */ + /*package*/ void setCustomProperties(List customProps) + { + this.customProps = customProps; + } + + /** + * @param property Adds the given custom property to the list + */ + /*package*/ void addCustomProperty(CustomProperty property) + { + if (this.customProps == null) + { + this.customProps = new ArrayList(3); + } + + // TODO: Determine if the CustomProperty being added is already + // in the list + + this.customProps.add(property); + } + + /** + * Simple wrapper class for custom advanced search property + * @author Kevin Roast + */ + public static class CustomProperty + { + CustomProperty(String type, String aspect, String property, String labelId) + { + Type = type; + Aspect = aspect; + Property = property; + LabelId = labelId; + } + + public String Type; + public String Aspect; + public String Property; + public String LabelId; + } +} diff --git a/source/java/org/alfresco/web/config/AdvancedSearchElementReader.java b/source/java/org/alfresco/web/config/AdvancedSearchElementReader.java new file mode 100644 index 0000000000..9927bb2333 --- /dev/null +++ b/source/java/org/alfresco/web/config/AdvancedSearchElementReader.java @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.xml.elementreader.ConfigElementReader; +import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty; +import org.dom4j.Element; + +/** + * Custom element reader to parse config for advanced search + * + * @author Gavin Cornwell + */ +public class AdvancedSearchElementReader implements ConfigElementReader +{ + public static final String ELEMENT_CONTENTTYPES = "content-types"; + public static final String ELEMENT_TYPE = "type"; + public static final String ELEMENT_CUSTOMPROPS = "custom-properties"; + public static final String ELEMENT_METADATA = "meta-data"; + public static final String ATTRIBUTE_NAME = "name"; + public static final String ATTRIBUTE_TYPE = "type"; + public static final String ATTRIBUTE_PROPERTY = "property"; + public static final String ATTRIBUTE_ASPECT = "aspect"; + public static final String ATTRIBUTE_DISPLAYLABEL = "displayLabelId"; + + /** + * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) + */ + @SuppressWarnings("unchecked") + public ConfigElement parse(Element element) + { + AdvancedSearchConfigElement configElement = null; + + if (element != null) + { + String name = element.getName(); + if (name.equals(AdvancedSearchConfigElement.CONFIG_ELEMENT_ID) == false) + { + throw new ConfigException("AdvancedSearchElementReader can only parse " + + AdvancedSearchConfigElement.CONFIG_ELEMENT_ID + " elements, the element passed was '" + + name + "'"); + } + + configElement = new AdvancedSearchConfigElement(); + + // get the list of content types + Element contentTypes = element.element(ELEMENT_CONTENTTYPES); + if (contentTypes != null) + { + Iterator typesItr = contentTypes.elementIterator(ELEMENT_TYPE); + List types = new ArrayList(5); + while (typesItr.hasNext()) + { + Element contentType = typesItr.next(); + String type = contentType.attributeValue(ATTRIBUTE_NAME); + if (type != null) + { + types.add(type); + } + } + configElement.setContentTypes(types); + } + + // get the list of custom properties to display + Element customProps = element.element(ELEMENT_CUSTOMPROPS); + if (customProps != null) + { + Iterator propsItr = customProps.elementIterator(ELEMENT_METADATA); + List props = new ArrayList(5); + while (propsItr.hasNext()) + { + Element propElement = propsItr.next(); + String type = propElement.attributeValue(ATTRIBUTE_TYPE); + String aspect = propElement.attributeValue(ATTRIBUTE_ASPECT); + String prop = propElement.attributeValue(ATTRIBUTE_PROPERTY); + String labelId = propElement.attributeValue(ATTRIBUTE_DISPLAYLABEL); + props.add(new AdvancedSearchConfigElement.CustomProperty(type, aspect, prop, labelId)); + } + configElement.setCustomProperties(props); + } + } + + return configElement; + } +} diff --git a/source/java/org/alfresco/web/config/ClientConfigElement.java b/source/java/org/alfresco/web/config/ClientConfigElement.java index 5b2596336c..58463d7948 100644 --- a/source/java/org/alfresco/web/config/ClientConfigElement.java +++ b/source/java/org/alfresco/web/config/ClientConfigElement.java @@ -16,11 +16,6 @@ */ package org.alfresco.web.config; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.alfresco.config.ConfigElement; import org.alfresco.config.element.ConfigElementAdapter; @@ -32,45 +27,16 @@ import org.alfresco.config.element.ConfigElementAdapter; public class ClientConfigElement extends ConfigElementAdapter { public static final String CONFIG_ELEMENT_ID = "client"; - public static final String VIEW_DETAILS = "details"; - public static final String VIEW_ICONS = "icons"; - public static final String VIEW_LIST = "list"; - public static final String VIEW_BUBBLE = "bubble"; - - private static final String SEPARATOR = ":"; - - // defaults for any config values not supplied - private int defaultPageSize = 10; - private String defaultView = "details"; - private String defaultSortColumn = "name"; - private String defaultSortOrder = "ascending"; - private String fromEmailAddress = "alfresco@alfresco.org"; - - // list to store all the configured views - private List views = new ArrayList(4); - - // map to store all the default views - private Map defaultViews = new HashMap(4); - - // map to store all default pages sizes for configured client views - private Map pagesSizes = new HashMap(10); - - // map to store default sort columns for configured views - private Map sortColumns = new HashMap(4); - - // list of pages that have been configured to have ascending sorts - private List descendingSorts = new ArrayList(1); + private String fromEmailAddress = "alfresco@alfresco.org"; + private String errorPage = null; + private String loginPage = null; private int recentSpacesItems = 6; private boolean shelfVisible = true; private int searchMinimum = 3; private String helpUrl = null; private String editLinkType = null; - private Map localeMap = new HashMap(); - private List languages = new ArrayList(8); private String homeSpacePermission = null; - private List contentTypes = null; - private List customProps = null; /** * Default Constructor @@ -78,12 +44,6 @@ public class ClientConfigElement extends ConfigElementAdapter public ClientConfigElement() { super(CONFIG_ELEMENT_ID); - - // add the default page sizes to the map - this.pagesSizes.put(VIEW_DETAILS, defaultPageSize); - this.pagesSizes.put(VIEW_LIST, defaultPageSize); - this.pagesSizes.put(VIEW_ICONS, 9); - this.pagesSizes.put(VIEW_BUBBLE, 5); } /** @@ -101,149 +61,21 @@ public class ClientConfigElement extends ConfigElementAdapter */ public ConfigElement combine(ConfigElement configElement) { - return null; - } - - /** - * Adds a configured view - * - * @param renderer The implementation class of the view (the renderer) - */ - public void addView(String renderer) - { - this.views.add(renderer); - } - - /** - * Returns a map of configured views for the client - * - * @return List of the implementation classes for the configured views - */ - public List getViews() - { - return this.views; - } - - /** - * Adds a default view setting - * - * @param page The page to set the default view for - * @param view The view name that will be the default - */ - public void addDefaultView(String page, String view) - { - this.defaultViews.put(page, view); - } - - /** - * Returns the default view for the given page - * - * @param page The page to get the default view for - * @return The defualt view, if there isn't a configured default for the - * given page 'details' will be returned - */ - public String getDefaultView(String page) - { - String view = this.defaultViews.get(page); + ClientConfigElement existingElement = (ClientConfigElement)configElement; + ClientConfigElement newElement = new ClientConfigElement(); - if (view == null) - { - view = this.defaultView; - } + // just overwrite all the simple values + newElement.setEditLinkType(existingElement.getEditLinkType()); + newElement.setFromEmailAddress(existingElement.getFromEmailAddress()); + newElement.setHelpUrl(existingElement.getHelpUrl()); + newElement.setHomeSpacePermission(existingElement.getHomeSpacePermission()); + newElement.setRecentSpacesItems(existingElement.getRecentSpacesItems()); + newElement.setSearchMinimum(existingElement.getSearchMinimum()); + newElement.setShelfVisible(existingElement.isShelfVisible()); + newElement.setErrorPage(existingElement.getErrorPage()); + newElement.setLoginPage(existingElement.getLoginPage()); - return view; - } - - /** - * Adds a configured page size to the internal store - * - * @param page The name of the page i.e. browse, forums etc. - * @param view The name of the view the size is for i.e. details, icons etc. - * @param size The size of the page - */ - public void addDefaultPageSize(String page, String view, int size) - { - this.pagesSizes.put(page + SEPARATOR + view, new Integer(size)); - } - - /** - * Returns the page size for the given page and view combination - * - * @param page The name of the page i.e. browse, forums etc. - * @param view The name of the view the size is for i.e. details, icons etc. - * @return The size of the requested page, if the combination doesn't exist - * the default for the view will be used, if the view doesn't exist either - * 10 will be returned. - */ - public int getDefaultPageSize(String page, String view) - { - Integer pageSize = this.pagesSizes.get(page + SEPARATOR + view); - - // try just the view if the combination isn't present - if (pageSize == null) - { - pageSize = this.pagesSizes.get(view); - - // if the view is not present either default to 10 - if (pageSize == null) - { - pageSize = new Integer(10); - } - } - - return pageSize.intValue(); - } - - /** - * Adds a default sorting column for the given page - * - * @param page The name of the page i.e. browse, forums etc. - * @param column The name of the column to initially sort by - */ - public void addDefaultSortColumn(String page, String column) - { - this.sortColumns.put(page, column); - } - - /** - * Returns the default sort column for the given page - * - * @param page The name of the page i.e. browse, forums etc. - * @return The name of the column to sort by, name is returned if - * the page is not found - */ - public String getDefaultSortColumn(String page) - { - String column = this.sortColumns.get(page); - - if (column == null) - { - column = this.defaultSortColumn; - } - - return column; - } - - /** - * Sets the given page as using descending sorts - * - * @param page The name of the page i.e. browse, forums etc. - */ - public void addDescendingSort(String page) - { - this.descendingSorts.add(page); - } - - /** - * Determines whether the given page has been - * configured to use descending sorting by default - * - * @param page The name of the page i.e. browse, forums etc. - * @return true if the page should use descending sorts - */ - public boolean hasDescendingSort(String page) - { - return this.descendingSorts.contains(page); + return newElement; } /** @@ -279,35 +111,37 @@ public class ClientConfigElement extends ConfigElementAdapter } /** - * Add a language locale and display label to the list. - * - * @param locale Locale code - * @param label Display label + * @return The error page the application should use */ - /*package*/ void addLanguage(String locale, String label) + public String getErrorPage() { - this.localeMap.put(locale, label); - this.languages.add(locale); - } - - /** - * @return List of supported language locale strings in config file order - */ - public List getLanguages() - { - return this.languages; - } - - /** - * @param locale The locale string to lookup language label for - * - * @return the language label for specified locale string, or null if not found - */ - public String getLabelForLanguage(String locale) - { - return this.localeMap.get(locale); + return this.errorPage; } + /** + * @param errorPage Sets the error page + */ + /*package*/ void setErrorPage(String errorPage) + { + this.errorPage = errorPage; + } + + /** + * @return Returns the login Page. + */ + public String getLoginPage() + { + return this.loginPage; + } + + /** + * @param loginPage The login Page to set. + */ + /*package*/ void setLoginPage(String loginPage) + { + this.loginPage = loginPage; + } + /** * @return Returns the help Url. */ @@ -388,57 +222,4 @@ public class ClientConfigElement extends ConfigElementAdapter { this.homeSpacePermission = homeSpacePermission; } - - /** - * @return Returns the contentTypes. - */ - public List getContentTypes() - { - return this.contentTypes; - } - - /** - * @param contentTypes The contentTypes to set. - */ - /*package*/ void setContentTypes(List contentTypes) - { - this.contentTypes = contentTypes; - } - - /** - * @return Returns the customProps. - */ - public List getCustomProperties() - { - return this.customProps; - } - - /** - * @param customProps The customProps to set. - */ - /*package*/ void setCustomProperties(List customProps) - { - this.customProps = customProps; - } - - - /** - * Simple wrapper class for custom advanced search property - * @author Kevin Roast - */ - public static class CustomProperty - { - CustomProperty(String type, String aspect, String property, String labelId) - { - Type = type; - Aspect = aspect; - Property = property; - LabelId = labelId; - } - - public String Type; - public String Aspect; - public String Property; - public String LabelId; - } } diff --git a/source/java/org/alfresco/web/config/ClientElementReader.java b/source/java/org/alfresco/web/config/ClientElementReader.java index f3d13d1f8b..228af242e4 100644 --- a/source/java/org/alfresco/web/config/ClientElementReader.java +++ b/source/java/org/alfresco/web/config/ClientElementReader.java @@ -16,16 +16,9 @@ */ package org.alfresco.web.config; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigException; import org.alfresco.config.xml.elementreader.ConfigElementReader; -import org.alfresco.web.config.ClientConfigElement.CustomProperty; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.dom4j.Element; /** @@ -35,35 +28,16 @@ import org.dom4j.Element; */ public class ClientElementReader implements ConfigElementReader { - public static final String ELEMENT_VIEWS = "views"; - public static final String ELEMENT_VIEW = "view"; - public static final String ELEMENT_VIEWDEFAULTS = "view-defaults"; - public static final String ELEMENT_PAGESIZE = "page-size"; - public static final String ELEMENT_SORTCOLUMN = "sort-column"; - public static final String ELEMENT_SORTDESCENDING = "sort-descending"; public static final String ELEMENT_RECENTSPACESITEMS = "recent-spaces-items"; - public static final String ELEMENT_LANGUAGES = "languages"; - public static final String ELEMENT_LANGUAGE = "language"; - public static final String ATTRIBUTE_LOCALE = "locale"; - public static final String ATTRIBUTE_NAME = "name"; + public static final String ELEMENT_ERRORPAGE = "error-page"; + public static final String ELEMENT_LOGINPAGE = "login-page"; public static final String ELEMENT_HELPURL = "help-url"; public static final String ELEMENT_EDITLINKTYPE = "edit-link-type"; public static final String ELEMENT_SEARCHMINIMUM = "search-minimum"; public static final String ELEMENT_HOMESPACEPERMISSION = "home-space-permission"; - public static final String ELEMENT_ADVANCEDSEARCH = "advanced-search"; - public static final String ELEMENT_CONTENTTYPES = "content-types"; - public static final String ELEMENT_TYPE = "type"; - public static final String ELEMENT_CUSTOMPROPS = "custom-properties"; - public static final String ELEMENT_METADATA = "meta-data"; public static final String ELEMENT_FROMEMAILADDRESS = "from-email-address"; - public static final String ATTRIBUTE_TYPE = "type"; - public static final String ATTRIBUTE_PROPERTY = "property"; - public static final String ATTRIBUTE_ASPECT = "aspect"; - public static final String ATTRIBUTE_DISPLAYLABEL = "displayLabelId"; public static final String ELEMENT_SHELFVISIBLE = "shelf-visible"; - private static Log logger = LogFactory.getLog(ClientElementReader.class); - /** * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) */ @@ -78,87 +52,12 @@ public class ClientElementReader implements ConfigElementReader if (name.equals(ClientConfigElement.CONFIG_ELEMENT_ID) == false) { throw new ConfigException("ClientElementReader can only parse " + - ClientConfigElement.CONFIG_ELEMENT_ID + "elements, the element passed was '" + + ClientConfigElement.CONFIG_ELEMENT_ID + " elements, the element passed was '" + name + "'"); } configElement = new ClientConfigElement(); - // get the configured views - Element views = element.element(ELEMENT_VIEWS); - if (views != null) - { - Iterator renderers = views.elementIterator(ELEMENT_VIEW); - while (renderers.hasNext()) - { - Element renderer = renderers.next(); - configElement.addView(renderer.getTextTrim()); - } - } - - // get all the view related default settings - Element viewDefaults = element.element(ELEMENT_VIEWDEFAULTS); - if (viewDefaults != null) - { - Iterator pages = viewDefaults.elementIterator(); - while (pages.hasNext()) - { - Element page = pages.next(); - String pageName = page.getName(); - - // get the default view mode for the page - Element defaultView = page.element(ELEMENT_VIEW); - if (defaultView != null) - { - String viewName = defaultView.getTextTrim(); - configElement.addDefaultView(pageName, viewName); - } - - // get the initial sort column - Element sortColumn = page.element(ELEMENT_SORTCOLUMN); - if (sortColumn != null) - { - String column = sortColumn.getTextTrim(); - configElement.addDefaultSortColumn(pageName, column); - } - - // get the sort descending option - Element sortDesc = page.element(ELEMENT_SORTDESCENDING); - if (sortDesc != null) - { - Boolean descending = new Boolean(sortDesc.getTextTrim()); - if (descending.booleanValue() == true) - { - configElement.addDescendingSort(pageName); - } - } - - // process the page-size element - processPageSizeElement(page.element(ELEMENT_PAGESIZE), - pageName, configElement); - } - } - - // get the languages sub-element - Element languages = element.element(ELEMENT_LANGUAGES); - if (languages != null) - { - Iterator langsItr = languages.elementIterator(ELEMENT_LANGUAGE); - while (langsItr.hasNext()) - { - Element language = langsItr.next(); - String localeCode = language.attributeValue(ATTRIBUTE_LOCALE); - String label = language.getTextTrim(); - - if (localeCode != null && localeCode.length() != 0 && - label != null && label.length() != 0) - { - // store the language code against the display label - configElement.addLanguage(localeCode, label); - } - } - } - // get the recent space max items Element recentSpaces = element.element(ELEMENT_RECENTSPACESITEMS); if (recentSpaces != null) @@ -208,78 +107,21 @@ public class ClientElementReader implements ConfigElementReader configElement.setFromEmailAddress(fromEmail.getTextTrim()); } - // get the Advanced Search config block - Element advsearch = element.element(ELEMENT_ADVANCEDSEARCH); - if (advsearch != null) + // get the error page + Element errorPage = element.element(ELEMENT_ERRORPAGE); + if (errorPage != null) { - // get the list of content types - Element contentTypes = advsearch.element(ELEMENT_CONTENTTYPES); - Iterator typesItr = contentTypes.elementIterator(ELEMENT_TYPE); - List types = new ArrayList(5); - while (typesItr.hasNext()) - { - Element contentType = typesItr.next(); - String type = contentType.attributeValue(ATTRIBUTE_NAME); - if (type != null) - { - types.add(type); - } - } - configElement.setContentTypes(types); - - // get the list of custom properties to display - Element customProps = advsearch.element(ELEMENT_CUSTOMPROPS); - Iterator propsItr = customProps.elementIterator(ELEMENT_METADATA); - List props = new ArrayList(5); - while (propsItr.hasNext()) - { - Element propElement = propsItr.next(); - String type = propElement.attributeValue(ATTRIBUTE_TYPE); - String aspect = propElement.attributeValue(ATTRIBUTE_ASPECT); - String prop = propElement.attributeValue(ATTRIBUTE_PROPERTY); - String labelId = propElement.attributeValue(ATTRIBUTE_DISPLAYLABEL); - props.add(new ClientConfigElement.CustomProperty(type, aspect, prop, labelId)); - } - configElement.setCustomProperties(props); + configElement.setErrorPage(errorPage.getTextTrim()); + } + + // get the login page + Element loginPage = element.element(ELEMENT_LOGINPAGE); + if (loginPage != null) + { + configElement.setLoginPage(loginPage.getTextTrim()); } } return configElement; } - - /** - * Processes a page-size element - * - * @param pageSizeElement The element to process - * @param page The page the page-size element belongs to - * @param configElement The config element being populated - */ - @SuppressWarnings("unchecked") - private void processPageSizeElement(Element pageSizeElement, String page, - ClientConfigElement configElement) - { - if (pageSizeElement != null) - { - Iterator views = pageSizeElement.elementIterator(); - while (views.hasNext()) - { - Element view = views.next(); - String viewName = view.getName(); - String pageSize = view.getTextTrim(); - try - { - configElement.addDefaultPageSize(page, viewName, Integer.parseInt(pageSize)); - } - catch (NumberFormatException nfe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Failed to set page size for view '" + viewName + - "' in page '" + page + "' as '" + pageSize + - "' is an invalid number!"); - } - } - } - } - } } diff --git a/source/java/org/alfresco/web/config/LanguagesConfigElement.java b/source/java/org/alfresco/web/config/LanguagesConfigElement.java new file mode 100644 index 0000000000..c4ddc96ac3 --- /dev/null +++ b/source/java/org/alfresco/web/config/LanguagesConfigElement.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.element.ConfigElementAdapter; + +/** + * Custom config element that represents config values for languages + * + * @author Gavin Cornwell + */ +public class LanguagesConfigElement extends ConfigElementAdapter +{ + public static final String CONFIG_ELEMENT_ID = "languages"; + + private Map localeMap = new HashMap(); + private List languages = new ArrayList(8); + + /** + * Default Constructor + */ + public LanguagesConfigElement() + { + super(CONFIG_ELEMENT_ID); + } + + /** + * Constructor + * + * @param name Name of the element this config element represents + */ + public LanguagesConfigElement(String name) + { + super(name); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#getChildren() + */ + @Override + public List getChildren() + { + throw new ConfigException("Reading the languages config via the generic interfaces is not supported"); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#combine(org.alfresco.config.ConfigElement) + */ + public ConfigElement combine(ConfigElement configElement) + { + LanguagesConfigElement existingElement = (LanguagesConfigElement)configElement; + LanguagesConfigElement newElement = new LanguagesConfigElement(); + + // add the languages from this config element + for (String locale : this.languages) + { + newElement.addLanguage(locale, this.localeMap.get(locale)); + } + + // now add the languages from the one to be combined (but + // only if they are not already in the list) + List languages = existingElement.getLanguages(); + for (String locale : languages) + { + if (newElement.getLabelForLanguage(locale) == null) + { + String label = existingElement.getLabelForLanguage(locale); + newElement.addLanguage(locale, label); + } + } + + return newElement; + } + + /** + * Add a language locale and display label to the list. + * + * @param locale Locale code + * @param label Display label + */ + /*package*/ void addLanguage(String locale, String label) + { + this.localeMap.put(locale, label); + this.languages.add(locale); + } + + /** + * @return List of supported language locale strings in config file order + */ + public List getLanguages() + { + return this.languages; + } + + /** + * @param locale The locale string to lookup language label for + * + * @return the language label for specified locale string, or null if not found + */ + public String getLabelForLanguage(String locale) + { + return this.localeMap.get(locale); + } +} diff --git a/source/java/org/alfresco/web/config/LanguagesElementReader.java b/source/java/org/alfresco/web/config/LanguagesElementReader.java new file mode 100644 index 0000000000..b10c7062d0 --- /dev/null +++ b/source/java/org/alfresco/web/config/LanguagesElementReader.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.Iterator; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.xml.elementreader.ConfigElementReader; +import org.dom4j.Element; + +/** + * Custom element reader to parse config for languages + * + * @author Gavin Cornwell + */ +public class LanguagesElementReader implements ConfigElementReader +{ + public static final String ELEMENT_LANGUAGE = "language"; + public static final String ATTRIBUTE_LOCALE = "locale"; + + /** + * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) + */ + @SuppressWarnings("unchecked") + public ConfigElement parse(Element element) + { + LanguagesConfigElement configElement = null; + + if (element != null) + { + String name = element.getName(); + if (name.equals(LanguagesConfigElement.CONFIG_ELEMENT_ID) == false) + { + throw new ConfigException("LanguagesElementReader can only parse " + + LanguagesConfigElement.CONFIG_ELEMENT_ID + " elements, the element passed was '" + + name + "'"); + } + + configElement = new LanguagesConfigElement(); + + Iterator langsItr = element.elementIterator(ELEMENT_LANGUAGE); + while (langsItr.hasNext()) + { + Element language = langsItr.next(); + String localeCode = language.attributeValue(ATTRIBUTE_LOCALE); + String label = language.getTextTrim(); + + if (localeCode != null && localeCode.length() != 0 && + label != null && label.length() != 0) + { + // store the language code against the display label + configElement.addLanguage(localeCode, label); + } + } + } + + return configElement; + } +} diff --git a/source/java/org/alfresco/web/config/MimeTypeConfigElement.java b/source/java/org/alfresco/web/config/MimeTypeConfigElement.java deleted file mode 100644 index eb7cf14f37..0000000000 --- a/source/java/org/alfresco/web/config/MimeTypeConfigElement.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2005 Alfresco, Inc. - * - * Licensed under the Mozilla Public License version 1.1 - * with a permitted attribution clause. You may obtain a - * copy of the License at - * - * http://www.alfresco.org/legal/license.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.alfresco.web.config; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.config.ConfigElement; -import org.alfresco.config.element.ConfigElementAdapter; - -/** - * @author Kevin Roast - */ -public final class MimeTypeConfigElement extends ConfigElementAdapter -{ - /** - * Default Constructor - */ - public MimeTypeConfigElement() - { - super(MimeTypesElementReader.ELEMENT_MIMETYPES); - } - - /** - * Constructor - * - * @param mappings Map of mimetype elements to use - */ - public MimeTypeConfigElement(Map mappings) - { - super(MimeTypesElementReader.ELEMENT_MIMETYPES); - this.mimetypes = mappings; - } - - /** - * @see org.alfresco.config.element.ConfigElementAdapter#combine(org.alfresco.config.ConfigElement) - */ - public ConfigElement combine(ConfigElement configElement) - { - MimeTypeConfigElement combined = new MimeTypeConfigElement(this.mimetypes); - - if (configElement instanceof MimeTypeConfigElement) - { - combined.mimetypes.putAll( ((MimeTypeConfigElement)configElement).mimetypes ); - } - - return combined; - } - - /** - * Add a mimetype extension mapping to the config element - * - * @param ext extension to map against - * @param mimetype mimetype content type for the specified extension - */ - public void addMapping(String ext, String mimetype) - { - this.mimetypes.put(ext, mimetype); - } - - /** - * Return the mimetype for the specified extension - * - * @param ext File - * - * @return mimetype content type or null if not found - */ - public String getMimeType(String ext) - { - return this.mimetypes.get(ext); - } - - private Map mimetypes = new HashMap(89, 1.0f); -} diff --git a/source/java/org/alfresco/web/config/MimeTypesElementReader.java b/source/java/org/alfresco/web/config/MimeTypesElementReader.java deleted file mode 100644 index 5607781b82..0000000000 --- a/source/java/org/alfresco/web/config/MimeTypesElementReader.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2005 Alfresco, Inc. - * - * Licensed under the Mozilla Public License version 1.1 - * with a permitted attribution clause. You may obtain a - * copy of the License at - * - * http://www.alfresco.org/legal/license.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.alfresco.web.config; - -import java.util.Iterator; - -import org.alfresco.config.ConfigElement; -import org.alfresco.config.ConfigException; -import org.alfresco.config.xml.elementreader.ConfigElementReader; -import org.dom4j.Element; - -/** - * @author Kevin Roast - */ -public class MimeTypesElementReader implements ConfigElementReader -{ - public final static String ELEMENT_MIMETYPES = "mimetypes"; - public final static String ELEMENT_MIMEMAPPING = "mime-mapping"; - public final static String ELEMENT_EXTENSION = "extension"; - public final static String ELEMENT_MIMETYPE = "mime-type"; - - /** - * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) - */ - public ConfigElement parse(Element element) - { - MimeTypeConfigElement configElement = null; - - if (element != null) - { - String name = element.getName(); - if (name.equals(ELEMENT_MIMETYPES) == false) - { - throw new ConfigException("MimeTypesElementReader can only parse " + - ELEMENT_MIMETYPES + "elements, the element passed was '" + - name + "'"); - } - - configElement = new MimeTypeConfigElement(); - - // walk the mime-mapping elements - Iterator mappings = element.elementIterator(ELEMENT_MIMEMAPPING); - while (mappings.hasNext()) - { - Element mapping = mappings.next(); - Element extensionElement = mapping.element(ELEMENT_EXTENSION); - Element mimetypeElement = mapping.element(ELEMENT_MIMETYPE); - - if (extensionElement == null || mimetypeElement == null) - { - throw new ConfigException("mime-mapping element must specify 'extension' and 'mime-type'"); - } - - String extension = extensionElement.getTextTrim(); - String mimetype = mimetypeElement.getTextTrim(); - - if (extension == null || extension.length() == 0) - { - throw new ConfigException("mime-mapping extension element value must be specified"); - } - if (mimetype == null || mimetype.length() == 0) - { - throw new ConfigException("mime-mapping mimetype element value must be specified"); - } - - // add the mimetype extension to the config element - configElement.addMapping(extension, mimetype); - } - } - - return configElement; - } -} diff --git a/source/java/org/alfresco/web/config/PropertySheetConfigElement.java b/source/java/org/alfresco/web/config/PropertySheetConfigElement.java index 3dafdd0fd6..9895bb99e0 100644 --- a/source/java/org/alfresco/web/config/PropertySheetConfigElement.java +++ b/source/java/org/alfresco/web/config/PropertySheetConfigElement.java @@ -137,7 +137,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter * * @param itemConfig A pre-configured property or association config object */ - public void addItem(ItemConfig itemConfig) + /*package*/ void addItem(ItemConfig itemConfig) { if (this.itemsMap.containsKey(itemConfig.getName()) == false) { @@ -156,7 +156,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter * @param readOnly Sets whether the property should be rendered as read only * @param converter The name of a converter to apply to the property control */ - public void addProperty(String name, String displayLabel, String displayLabelId, String readOnly, String converter) + /*package*/ void addProperty(String name, String displayLabel, String displayLabelId, String readOnly, String converter) { addItem(new PropertyConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly), converter)); } @@ -170,7 +170,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter * @param readOnly Sets whether the association should be rendered as read only * @param converter The name of a converter to apply to the association control */ - public void addAssociation(String name, String displayLabel, String displayLabelId, String readOnly, String converter) + /*package*/ void addAssociation(String name, String displayLabel, String displayLabelId, String readOnly, String converter) { addItem(new AssociationConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly), converter)); } @@ -184,7 +184,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter * @param readOnly Sets whether the association should be rendered as read only * @param converter The name of a converter to apply to the association control */ - public void addChildAssociation(String name, String displayLabel, String displayLabelId, String readOnly, String converter) + /*package*/ void addChildAssociation(String name, String displayLabel, String displayLabelId, String readOnly, String converter) { addItem(new ChildAssociationConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly), converter)); } diff --git a/source/java/org/alfresco/web/config/ServerConfigElement.java b/source/java/org/alfresco/web/config/ServerConfigElement.java deleted file mode 100644 index 956ab5b302..0000000000 --- a/source/java/org/alfresco/web/config/ServerConfigElement.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005 Alfresco, Inc. - * - * Licensed under the Mozilla Public License version 1.1 - * with a permitted attribution clause. You may obtain a - * copy of the License at - * - * http://www.alfresco.org/legal/license.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.alfresco.web.config; - -import org.alfresco.config.ConfigElement; -import org.alfresco.config.element.ConfigElementAdapter; - -/** - * Custom config element that represents the config data for the server - * - * @author gavinc - */ -public class ServerConfigElement extends ConfigElementAdapter -{ - public static final String CONFIG_ELEMENT_ID = "server"; - - private String errorPage; - private String loginPage; - - /** - * Default constructor - */ - public ServerConfigElement() - { - super(CONFIG_ELEMENT_ID); - } - - /** - * Constructor - * - * @param name Name of the element this config element represents - */ - public ServerConfigElement(String name) - { - super(name); - } - - public ConfigElement combine(ConfigElement configElement) - { - // NOTE: combining these would simply override the values so we just need - // to return a new instance of the given config element - - ServerConfigElement combined = new ServerConfigElement(); - combined.setErrorPage(((ServerConfigElement)configElement).getErrorPage()); - combined.setLoginPage(((ServerConfigElement)configElement).getLoginPage()); - return combined; - } - - /** - * @return The error page the application should use - */ - public String getErrorPage() - { - return this.errorPage; - } - - /** - * @param errorPage Sets the error page - */ - public void setErrorPage(String errorPage) - { - this.errorPage = errorPage; - } - - /** - * @return Returns the login Page. - */ - public String getLoginPage() - { - return this.loginPage; - } - - /** - * @param loginPage The login Page to set. - */ - public void setLoginPage(String loginPage) - { - this.loginPage = loginPage; - } -} diff --git a/source/java/org/alfresco/web/config/ServerElementReader.java b/source/java/org/alfresco/web/config/ServerElementReader.java deleted file mode 100644 index 2ff2415235..0000000000 --- a/source/java/org/alfresco/web/config/ServerElementReader.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2005 Alfresco, Inc. - * - * Licensed under the Mozilla Public License version 1.1 - * with a permitted attribution clause. You may obtain a - * copy of the License at - * - * http://www.alfresco.org/legal/license.txt - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - */ -package org.alfresco.web.config; - -import org.alfresco.config.ConfigElement; -import org.alfresco.config.ConfigException; -import org.alfresco.config.xml.elementreader.ConfigElementReader; -import org.dom4j.Element; - -/** - * Custom element reader to parse config for server details - * - * @author gavinc - */ -public class ServerElementReader implements ConfigElementReader -{ - public static final String ELEMENT_ERROR_PAGE = "error-page"; - public static final String ELEMENT_LOGIN_PAGE = "login-page"; - - /** - * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) - */ - public ConfigElement parse(Element element) - { - ServerConfigElement configElement = null; - - if (element != null) - { - String name = element.getName(); - if (name.equals(ServerConfigElement.CONFIG_ELEMENT_ID) == false) - { - throw new ConfigException("ServerElementReader can only parse " + - ServerConfigElement.CONFIG_ELEMENT_ID + "elements, " + - "the element passed was '" + name + "'"); - } - - configElement = new ServerConfigElement(); - - // get the error page - Element errorPage = element.element(ELEMENT_ERROR_PAGE); - if (errorPage != null) - { - configElement.setErrorPage(errorPage.getTextTrim()); - } - - // get the login page - Element loginPage = element.element(ELEMENT_LOGIN_PAGE); - if (loginPage != null) - { - configElement.setLoginPage(loginPage.getTextTrim()); - } - } - - return configElement; - } -} diff --git a/source/java/org/alfresco/web/config/ViewsConfigElement.java b/source/java/org/alfresco/web/config/ViewsConfigElement.java new file mode 100644 index 0000000000..bff7fef81a --- /dev/null +++ b/source/java/org/alfresco/web/config/ViewsConfigElement.java @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.element.ConfigElementAdapter; + +/** + * Custom config element that represents config values for views in the client + * + * @author Gavin Cornwell + */ +public class ViewsConfigElement extends ConfigElementAdapter +{ + public static final String CONFIG_ELEMENT_ID = "views"; + public static final String VIEW_DETAILS = "details"; + public static final String VIEW_ICONS = "icons"; + public static final String VIEW_LIST = "list"; + public static final String VIEW_BUBBLE = "bubble"; + + private static final String SEPARATOR = ":"; + + // defaults + private int defaultPageSize = 10; + private String defaultView = "details"; + private String defaultSortColumn = "name"; + + // list to store all the configured views + private List views = new ArrayList(4); + + // map to store all the default views + private Map defaultViews = new HashMap(4); + + // map to store all default page sizes for configured client views + private Map pageSizes = new HashMap(10); + + // map to store default sort columns for configured views + private Map sortColumns = new HashMap(4); + + // list of pages that have been configured to have ascending sorts + private List descendingSorts = new ArrayList(1); + + /** + * Default Constructor + */ + public ViewsConfigElement() + { + super(CONFIG_ELEMENT_ID); + + // add the default page sizes to the map + this.pageSizes.put(VIEW_DETAILS, defaultPageSize); + this.pageSizes.put(VIEW_LIST, defaultPageSize); + this.pageSizes.put(VIEW_ICONS, 9); + this.pageSizes.put(VIEW_BUBBLE, 5); + } + + /** + * Constructor + * + * @param name Name of the element this config element represents + */ + public ViewsConfigElement(String name) + { + super(name); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#getChildren() + */ + @Override + public List getChildren() + { + throw new ConfigException("Reading the views config via the generic interfaces is not supported"); + } + + /** + * @see org.alfresco.config.element.ConfigElementAdapter#combine(org.alfresco.config.ConfigElement) + */ + public ConfigElement combine(ConfigElement configElement) + { + ViewsConfigElement existingElement = (ViewsConfigElement)configElement; + ViewsConfigElement newElement = new ViewsConfigElement(); + + // copy all the config from this element into the new one + for (String viewImpl : this.views) + { + newElement.addView(viewImpl); + } + + for (String page : this.defaultViews.keySet()) + { + newElement.addDefaultView(page, this.defaultViews.get(page)); + } + + for (String pageView : this.pageSizes.keySet()) + { + if (pageView.indexOf(SEPARATOR) != -1) + { + String page = pageView.substring(0, pageView.indexOf(SEPARATOR)); + String view = pageView.substring(pageView.indexOf(SEPARATOR)+1); + newElement.addDefaultPageSize(page, view, this.pageSizes.get(pageView).intValue()); + } + } + + for (String page : this.sortColumns.keySet()) + { + newElement.addDefaultSortColumn(page, this.sortColumns.get(page)); + } + + for (String page : this.descendingSorts) + { + newElement.addDescendingSort(page); + } + + // copy all the config from the element to be combined into the new one + for (String viewImpl : existingElement.getViews()) + { + newElement.addView(viewImpl); + } + + Map existingDefaultViews = existingElement.getDefaultViews(); + for (String page : existingDefaultViews.keySet()) + { + newElement.addDefaultView(page, existingDefaultViews.get(page)); + } + + Map existingPageSizes = existingElement.getDefaultPageSizes(); + for (String pageView : existingPageSizes.keySet()) + { + if (pageView.indexOf(SEPARATOR) != -1) + { + String page = pageView.substring(0, pageView.indexOf(SEPARATOR)); + String view = pageView.substring(pageView.indexOf(SEPARATOR)+1); + newElement.addDefaultPageSize(page, view, existingPageSizes.get(pageView).intValue()); + } + } + + Map existingSortColumns = existingElement.getDefaultSortColumns(); + for (String page : existingSortColumns.keySet()) + { + newElement.addDefaultSortColumn(page, existingSortColumns.get(page)); + } + + // TODO: There is a potential problem here - how would you remove the + // descending sort for a page + for (String page : existingElement.getDescendingSorts()) + { + newElement.addDescendingSort(page); + } + + return newElement; + } + + /** + * Adds a configured view + * + * @param renderer The implementation class of the view (the renderer) + */ + /*package*/ void addView(String renderer) + { + this.views.add(renderer); + } + + /** + * Returns a map of configured views for the client + * + * @return List of the implementation classes for the configured views + */ + public List getViews() + { + return this.views; + } + + /** + * Adds a default view setting + * + * @param page The page to set the default view for + * @param view The view name that will be the default + */ + /*package*/ void addDefaultView(String page, String view) + { + this.defaultViews.put(page, view); + } + + /** + * Returns the default view for the given page + * + * @param page The page to get the default view for + * @return The defualt view, if there isn't a configured default for the + * given page 'details' will be returned + */ + public String getDefaultView(String page) + { + String view = this.defaultViews.get(page); + + if (view == null) + { + view = this.defaultView; + } + + return view; + } + + /** + * Returns a map of default views for each page + * + * @return Map of default views + */ + /*package*/ Map getDefaultViews() + { + return this.defaultViews; + } + + /** + * Adds a configured page size to the internal store + * + * @param page The name of the page i.e. browse, forums etc. + * @param view The name of the view the size is for i.e. details, icons etc. + * @param size The size of the page + */ + /*package*/ void addDefaultPageSize(String page, String view, int size) + { + this.pageSizes.put(page + SEPARATOR + view, new Integer(size)); + } + + /** + * Returns the page size for the given page and view combination + * + * @param page The name of the page i.e. browse, forums etc. + * @param view The name of the view the size is for i.e. details, icons etc. + * @return The size of the requested page, if the combination doesn't exist + * the default for the view will be used, if the view doesn't exist either + * 10 will be returned. + */ + public int getDefaultPageSize(String page, String view) + { + Integer pageSize = this.pageSizes.get(page + SEPARATOR + view); + + // try just the view if the combination isn't present + if (pageSize == null) + { + pageSize = this.pageSizes.get(view); + + // if the view is not present either default to 10 + if (pageSize == null) + { + pageSize = new Integer(10); + } + } + + return pageSize.intValue(); + } + + /** + * Returns a map of page sizes + * + * @return Map of page sizes + */ + /*package*/ Map getDefaultPageSizes() + { + return this.pageSizes; + } + + /** + * Adds a default sorting column for the given page + * + * @param page The name of the page i.e. browse, forums etc. + * @param column The name of the column to initially sort by + */ + /*package*/ void addDefaultSortColumn(String page, String column) + { + this.sortColumns.put(page, column); + } + + /** + * Returns the default sort column for the given page + * + * @param page The name of the page i.e. browse, forums etc. + * @return The name of the column to sort by, name is returned if + * the page is not found + */ + public String getDefaultSortColumn(String page) + { + String column = this.sortColumns.get(page); + + if (column == null) + { + column = this.defaultSortColumn; + } + + return column; + } + + /** + * Returns a map of the sorted columns for each page + * + * @return Map of sort columns + */ + /*package*/ Map getDefaultSortColumns() + { + return this.sortColumns; + } + + /** + * Sets the given page as using descending sorts + * + * @param page The name of the page i.e. browse, forums etc. + */ + /*package*/ void addDescendingSort(String page) + { + this.descendingSorts.add(page); + } + + /** + * Determines whether the given page has been + * configured to use descending sorting by default + * + * @param page The name of the page i.e. browse, forums etc. + * @return true if the page should use descending sorts + */ + public boolean hasDescendingSort(String page) + { + return this.descendingSorts.contains(page); + } + + /** + * Returns a list of pages that use a descending sort + * + * @return List of pages that use a descending sort + */ + /*package*/ List getDescendingSorts() + { + return this.descendingSorts; + } +} diff --git a/source/java/org/alfresco/web/config/ViewsElementReader.java b/source/java/org/alfresco/web/config/ViewsElementReader.java new file mode 100644 index 0000000000..e376191de8 --- /dev/null +++ b/source/java/org/alfresco/web/config/ViewsElementReader.java @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2005 Alfresco, Inc. + * + * Licensed under the Mozilla Public License version 1.1 + * with a permitted attribution clause. You may obtain a + * copy of the License at + * + * http://www.alfresco.org/legal/license.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + */ +package org.alfresco.web.config; + +import java.util.Iterator; + +import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; +import org.alfresco.config.xml.elementreader.ConfigElementReader; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.dom4j.Element; + +/** + * Custom element reader to parse config for client views + * + * @author Gavin Cornwell + */ +public class ViewsElementReader implements ConfigElementReader +{ + public static final String ELEMENT_VIEW = "view"; + public static final String ELEMENT_VIEWIMPL = "view-impl"; + public static final String ELEMENT_VIEWDEFAULTS = "view-defaults"; + public static final String ELEMENT_PAGESIZE = "page-size"; + public static final String ELEMENT_SORTCOLUMN = "sort-column"; + public static final String ELEMENT_SORTDESCENDING = "sort-descending"; + + private static Log logger = LogFactory.getLog(ViewsElementReader.class); + + /** + * @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element) + */ + @SuppressWarnings("unchecked") + public ConfigElement parse(Element element) + { + ViewsConfigElement configElement = null; + + if (element != null) + { + String name = element.getName(); + if (name.equals(ViewsConfigElement.CONFIG_ELEMENT_ID) == false) + { + throw new ConfigException("ViewsElementReader can only parse " + + ViewsConfigElement.CONFIG_ELEMENT_ID + " elements, the element passed was '" + + name + "'"); + } + + configElement = new ViewsConfigElement(); + + // get the configured views + Iterator renderers = element.elementIterator(ELEMENT_VIEWIMPL); + while (renderers.hasNext()) + { + Element renderer = renderers.next(); + configElement.addView(renderer.getTextTrim()); + } + + // get all the view related default settings + Element viewDefaults = element.element(ELEMENT_VIEWDEFAULTS); + if (viewDefaults != null) + { + Iterator pages = viewDefaults.elementIterator(); + while (pages.hasNext()) + { + Element page = pages.next(); + String pageName = page.getName(); + + // get the default view mode for the page + Element defaultView = page.element(ELEMENT_VIEW); + if (defaultView != null) + { + String viewName = defaultView.getTextTrim(); + configElement.addDefaultView(pageName, viewName); + } + + // get the initial sort column + Element sortColumn = page.element(ELEMENT_SORTCOLUMN); + if (sortColumn != null) + { + String column = sortColumn.getTextTrim(); + configElement.addDefaultSortColumn(pageName, column); + } + + // get the sort descending option + Element sortDesc = page.element(ELEMENT_SORTDESCENDING); + if (sortDesc != null) + { + Boolean descending = new Boolean(sortDesc.getTextTrim()); + if (descending.booleanValue() == true) + { + configElement.addDescendingSort(pageName); + } + } + + // process the page-size element + processPageSizeElement(page.element(ELEMENT_PAGESIZE), + pageName, configElement); + } + } + } + + return configElement; + } + + /** + * Processes a page-size element + * + * @param pageSizeElement The element to process + * @param page The page the page-size element belongs to + * @param configElement The config element being populated + */ + @SuppressWarnings("unchecked") + private void processPageSizeElement(Element pageSizeElement, String page, + ViewsConfigElement configElement) + { + if (pageSizeElement != null) + { + Iterator views = pageSizeElement.elementIterator(); + while (views.hasNext()) + { + Element view = views.next(); + String viewName = view.getName(); + String pageSize = view.getTextTrim(); + try + { + configElement.addDefaultPageSize(page, viewName, Integer.parseInt(pageSize)); + } + catch (NumberFormatException nfe) + { + if (logger.isWarnEnabled()) + { + logger.warn("Failed to set page size for view '" + viewName + + "' in page '" + page + "' as '" + pageSize + + "' is an invalid number!"); + } + } + } + } + } +} diff --git a/source/java/org/alfresco/web/config/WebClientConfigTest.java b/source/java/org/alfresco/web/config/WebClientConfigTest.java index 5dd44a89b1..8fbc5df9b9 100644 --- a/source/java/org/alfresco/web/config/WebClientConfigTest.java +++ b/source/java/org/alfresco/web/config/WebClientConfigTest.java @@ -22,9 +22,11 @@ import java.util.Map; import org.alfresco.config.Config; import org.alfresco.config.ConfigElement; +import org.alfresco.config.ConfigException; import org.alfresco.config.source.FileConfigSource; import org.alfresco.config.xml.XMLConfigService; import org.alfresco.util.BaseTest; +import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty; import org.alfresco.web.config.PropertySheetConfigElement.ItemConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -37,16 +39,12 @@ import org.apache.commons.logging.LogFactory; */ public class WebClientConfigTest extends BaseTest { - private static Log logger = LogFactory.getLog(WebClientConfigTest.class); - /** * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); - - logger.info("******************************************************"); } /** @@ -69,7 +67,6 @@ public class WebClientConfigTest extends BaseTest // get the property names from the global section and make sure it is the // name property List propNames = ((PropertySheetConfigElement) globalPropSheet).getItemNamesToShow(); - logger.info("propNames = " + propNames); assertTrue("There should only be one property in the list", propNames.size() == 1); assertTrue("The property name should be 'name'", propNames.get(0).equals("name")); @@ -81,7 +78,6 @@ public class WebClientConfigTest extends BaseTest .getConfigElement("property-sheet"); assertNotNull("Space aspect property config should not be null", spacePropConfig); propNames = spacePropConfig.getItemNamesToShow(); - logger.info("propNames = " + propNames); assertTrue("There should be 5 properties in the list", propNames.size() == 5); // make sure the property sheet config has come back with the correct data @@ -130,7 +126,6 @@ public class WebClientConfigTest extends BaseTest propNames.add(propName); } - logger.info("propNames = " + propNames); assertTrue("There should be 5 properties", propNames.size() == 5); assertFalse("The id attribute should not be present", propsToDisplay.hasAttribute("id")); } @@ -160,30 +155,10 @@ public class WebClientConfigTest extends BaseTest assertNotNull("kids should not be null", kids); assertTrue("There should be more than one child", kids.size() > 1); - logger.info("propNames = " + propNames); assertEquals("There should be 5 properties", propNames.size() == 5, true); assertFalse("The id attribute should not be present", propsToDisplay.hasAttribute("id")); } - /** - * Tests the custom server configuration objects - */ - public void testServerConfig() - { - // setup the config service - String configFiles = getResourcesDir() + "test-config.xml"; - XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles)); - svc.init(); - - // get the global config and from that the server config - ServerConfigElement serverConfig = (ServerConfigElement)svc.getGlobalConfig(). - getConfigElement(ServerConfigElement.CONFIG_ELEMENT_ID); - assertNotNull("server config should not be null", serverConfig); - - String errorPage = serverConfig.getErrorPage(); - assertTrue("error page should be '/jsp/error.jsp'", errorPage.equals("/jsp/error.jsp")); - } - /** * Tests the custom client configuration objects */ @@ -197,46 +172,46 @@ public class WebClientConfigTest extends BaseTest // get the global config and from that the client config ClientConfigElement clientConfig = (ClientConfigElement)svc.getGlobalConfig(). getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID); - assertNotNull("client config should not be null", clientConfig); + assertNotNull("client config", clientConfig); - List views = clientConfig.getViews(); - assertEquals("There should be 2 configured views", 2, views.size()); - String renderer = views.get(1); - assertEquals("Renderer for the icons view should be 'org.alfresco.web.ui.common.renderer.data.RichListRenderer.IconViewRenderer'", - "org.alfresco.web.ui.common.renderer.data.RichListRenderer.IconViewRenderer", renderer); + assertEquals("error page", "/jsp/error.jsp", clientConfig.getErrorPage()); + assertEquals("login page", "/jsp/login.jsp", clientConfig.getLoginPage()); + assertEquals("home space permission", "Guest", clientConfig.getHomeSpacePermission()); + assertEquals("help url", "http://www.alfresco.org/help/webclient", clientConfig.getHelpUrl()); + assertEquals("edit link type", "http", clientConfig.getEditLinkType()); + assertEquals("from address", "alfresco@alfresco.org", clientConfig.getFromEmailAddress()); + assertEquals("recent spaces", 6, clientConfig.getRecentSpacesItems()); + assertEquals("search minimum", 3, clientConfig.getSearchMinimum()); + assertTrue("shelf visible", clientConfig.isShelfVisible()); + } + + public void testClientOverride() + { + // setup the config service + List configFiles = new ArrayList(2); + configFiles.add(getResourcesDir() + "test-config.xml"); + configFiles.add(getResourcesDir() + "test-config-override.xml"); + XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles)); + svc.init(); + + // try and get the global config section + Config globalSection = svc.getGlobalConfig(); + assertNotNull("global section", globalSection); - String defaultView = clientConfig.getDefaultView("topic"); - assertEquals("Default view for topic should be 'bubble'", "bubble", defaultView); + // get the client config + ClientConfigElement clientConfig = (ClientConfigElement)globalSection. + getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID); + assertNotNull("client config", clientConfig); - // get the defualt view for something that doesn't exist - defaultView = clientConfig.getDefaultView("not-there"); - assertEquals("Default view for missing view should be 'details'", "details", defaultView); - - // get the default page size for the forum details view - int pageSize = clientConfig.getDefaultPageSize("forum", "details"); - assertEquals("Page size for forum details should be 20", 20, pageSize); - - // get the defualt page size for a non existent view - pageSize = clientConfig.getDefaultPageSize("not", "there"); - assertEquals("Page size for forum details should be 10", 10, pageSize); - - // get the default page size for a non existent screen and valid view - pageSize = clientConfig.getDefaultPageSize("not-there", "icons"); - assertEquals("Page size for icons view should be 9", 9, pageSize); - - // test the sort column - String column = clientConfig.getDefaultSortColumn("browse"); - assertEquals("Sort column for browse should be 'name'", "name", column); - - column = clientConfig.getDefaultSortColumn("topic"); - assertEquals("Sort column for topic should be 'created'", "created", column); - - // test the sorting direction - boolean sortDescending = clientConfig.hasDescendingSort("browse"); - assertFalse("browse screen should use an ascending sort", sortDescending); - - sortDescending = clientConfig.hasDescendingSort("topic"); - assertTrue("topic screen should use a descending sort", sortDescending); + assertEquals("error page", "/jsp/error-override.jsp", clientConfig.getErrorPage()); + assertEquals("login page", "/jsp/login-override.jsp", clientConfig.getLoginPage()); + assertEquals("home space permission", "Editor", clientConfig.getHomeSpacePermission()); + assertEquals("help url", "http://www.somewhere.com/help", clientConfig.getHelpUrl()); + assertEquals("edit link type", "webdav", clientConfig.getEditLinkType()); + assertEquals("from address", "me@somewhere.com", clientConfig.getFromEmailAddress()); + assertEquals("recent spaces", 1, clientConfig.getRecentSpacesItems()); + assertEquals("search minimum", 10, clientConfig.getSearchMinimum()); + assertFalse("shelf visible", clientConfig.isShelfVisible()); } /** @@ -350,16 +325,10 @@ public class WebClientConfigTest extends BaseTest String toViewId = child.getAttribute("to-view-id"); String toOutcome = child.getAttribute("to-outcome"); - logger.info("fromViewId = " + fromViewId); - logger.info("fromOutcome = " + fromOutcome); - logger.info("toViewId = " + toViewId); - logger.info("toOutcome = " + toOutcome); - - assertNull(fromOutcome); - assertNull(toOutcome); - - assertEquals("/jsp/browse/browse.jsp", fromViewId); - assertEquals("/jsp/forums/forums.jsp", toViewId); + assertNull("fromOutcome", fromOutcome); + assertNull("toOutcome", toOutcome); + assertEquals("fromViewId", "/jsp/browse/browse.jsp", fromViewId); + assertEquals("toViewId", "/jsp/forums/forums.jsp", toViewId); // get the second child and make sure the attributes are correct, // from-outcome should be 'browse' and to-outcome should be 'newOutcome' @@ -369,15 +338,163 @@ public class WebClientConfigTest extends BaseTest toViewId = child.getAttribute("to-view-id"); toOutcome = child.getAttribute("to-outcome"); - logger.info("fromViewId = " + fromViewId); - logger.info("fromOutcome = " + fromOutcome); - logger.info("toViewId = " + toViewId); - logger.info("toOutcome = " + toOutcome); + assertNull("fromViewId", fromViewId); + assertNull("toViewId", toViewId); + assertEquals("fromOutcome", "browse", fromOutcome); + assertEquals("toOutcome", "newOutcome", toOutcome); + } + + public void testLanguages() + { + // setup the config service + List configFiles = new ArrayList(2); + configFiles.add(getResourcesDir() + "test-config.xml"); + configFiles.add(getResourcesDir() + "test-config-override.xml"); + XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles)); + svc.init(); - assertNull(fromViewId); - assertNull(toViewId); + LanguagesConfigElement config = (LanguagesConfigElement)svc.getConfig("Languages"). + getConfigElement(LanguagesConfigElement.CONFIG_ELEMENT_ID); + assertNotNull("languages config", config); - assertEquals("browse", fromOutcome); - assertEquals("newOutcome", toOutcome); + // make sure there are 3 languages returned + assertEquals("number of languages", 4, config.getLanguages().size()); + + // make sure they are returned in order + assertEquals("first language", "en_US", config.getLanguages().get(0)); + assertEquals("second language", "fr_FR", config.getLanguages().get(1)); + assertEquals("third language", "de_DE", config.getLanguages().get(2)); + assertEquals("fourth language", "ja_JP", config.getLanguages().get(3)); + + // make sure the labels are correct too + assertEquals("en_US", "English", config.getLabelForLanguage("en_US")); + assertEquals("fr_FR", "French", config.getLabelForLanguage("fr_FR")); + assertEquals("de_DE", "German", config.getLabelForLanguage("de_DE")); + assertEquals("ja_JP", "Japanese", config.getLabelForLanguage("ja_JP")); + + // make sure the getChildren method throws an exception + try + { + config.getChildren(); + fail("getChildren() did not throw an excpetion"); + } + catch (ConfigException ce) + { + // expected + } + } + + public void testAdvancedSearch() + { + // setup the config service + List configFiles = new ArrayList(2); + configFiles.add(getResourcesDir() + "test-config.xml"); + configFiles.add(getResourcesDir() + "test-config-override.xml"); + XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles)); + svc.init(); + + AdvancedSearchConfigElement config = (AdvancedSearchConfigElement)svc.getConfig("Advanced Search"). + getConfigElement(AdvancedSearchConfigElement.CONFIG_ELEMENT_ID); + assertNotNull("advanced search config", config); + + // make sure there are 2 custom types + assertEquals("number of content types", 2, config.getContentTypes().size()); + + // make sure they are correct + assertEquals("first type", "cm:dictionaryModel", config.getContentTypes().get(0)); + assertEquals("second type", "fm:post", config.getContentTypes().get(1)); + + // make sure there are 3 custom properties + assertEquals("number of content properties", 3, config.getCustomProperties().size()); + + CustomProperty property = config.getCustomProperties().get(0); + assertTrue("first property is type", property.Type != null); + + property = config.getCustomProperties().get(1); + assertTrue("second property is aspect", property.Type == null); + assertTrue("second property is aspect", property.Aspect != null); + assertEquals("second property aspect", "app:simpleworkflow", property.Aspect); + assertEquals("second property name", "app:approveStep", property.Property); + + property = config.getCustomProperties().get(2); + assertEquals("third property name", "app:rejectStep", property.Property); + assertEquals("third property display id", "reject_step", property.LabelId); + + // make sure the getChildren method throws an exception + try + { + config.getChildren(); + fail("getChildren() did not throw an excpetion"); + } + catch (ConfigException ce) + { + // expected + } + } + + public void testViews() + { + // setup the config service + List configFiles = new ArrayList(2); + configFiles.add(getResourcesDir() + "test-config.xml"); + configFiles.add(getResourcesDir() + "test-config-override.xml"); + XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles)); + svc.init(); + + ViewsConfigElement config = (ViewsConfigElement)svc.getConfig("Views"). + getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); + assertNotNull("views config", config); + + // make sure there are 4 views + List views = config.getViews(); + assertEquals("configured views", 4, views.size()); + + // make sure the views are correct + assertEquals("details view renderer", + "org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer", + views.get(0)); + assertEquals("icons view renderer", + "org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer", + views.get(1)); + assertEquals("list view renderer", + "org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer", + views.get(2)); + assertEquals("bubble view renderer", + "org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer", views.get(3)); + + // test default views + assertEquals("default view", "details", config.getDefaultView("not-there")); + assertEquals("default view for topic", "bubble", config.getDefaultView("topic")); + + // test page sizes + assertEquals("default page size", 10, config.getDefaultPageSize("not", "there")); + assertEquals("forums icons page size", 20, config.getDefaultPageSize("forums", "icons")); + assertEquals("forum details page size", 50, config.getDefaultPageSize("forum", "details")); + assertEquals("icons view page size", 9, config.getDefaultPageSize("not-there", "icons")); + + // test the sort columns + assertEquals("default sort column", "name", config.getDefaultSortColumn("not-there")); + assertEquals("browse page sort column", "name", config.getDefaultSortColumn("browse")); + assertEquals("forum page sort column", "modified", config.getDefaultSortColumn("forum")); + assertEquals("topic page sort column", "created", config.getDefaultSortColumn("topic")); + + // test the sorting direction + assertFalse("default sort direction should be ascending", config.hasDescendingSort("not-there")); + assertFalse("browse screen should use an ascending sort", config.hasDescendingSort("browse")); + assertTrue("topic screen should use a descending sort", config.hasDescendingSort("forum")); + + // TODO: uncomment this test once the override of descending sorts is fixed +// assertFalse("topic screen should use a ascending sort", config.hasDescendingSort("topic")); + + // make sure the getChildren method throws an exception + try + { + config.getChildren(); + fail("getChildren() did not throw an excpetion"); + } + catch (ConfigException ce) + { + // expected + } } } diff --git a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java index 5d29d3428f..1559e8ac61 100644 --- a/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java +++ b/source/java/org/alfresco/web/ui/common/component/data/UIRichList.java @@ -26,10 +26,9 @@ import javax.faces.context.FacesContext; import javax.faces.el.ValueBinding; import javax.transaction.UserTransaction; -import org.alfresco.config.ConfigService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.config.ClientConfigElement; +import org.alfresco.web.config.ViewsConfigElement; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.ui.common.renderer.data.IRichListRenderer; import org.apache.commons.logging.Log; @@ -51,10 +50,10 @@ public class UIRichList extends UIComponentBase implements IDataContainer setRendererType("org.alfresco.faces.RichListRenderer"); // get the list of views from the client configuration - ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance()); - ClientConfigElement clientConfig = (ClientConfigElement)configSvc.getGlobalConfig(). - getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID); - List views = clientConfig.getViews(); + ViewsConfigElement viewsConfig = (ViewsConfigElement)Application.getConfigService( + FacesContext.getCurrentInstance()).getConfig("Views"). + getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID); + List views = viewsConfig.getViews(); // instantiate each renderer and add to the list for (String view : views) diff --git a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java index 5cba733676..852cc7ad26 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java +++ b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java @@ -18,7 +18,6 @@ package org.alfresco.web.ui.repo.component; import java.io.IOException; import java.util.List; -import java.util.Map; import javax.faces.component.NamingContainer; import javax.faces.component.UIComponent; @@ -30,7 +29,6 @@ import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import javax.faces.el.ValueBinding; -import org.alfresco.config.ConfigService; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; @@ -41,15 +39,14 @@ import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.namespace.QName; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; -import org.alfresco.web.config.ClientConfigElement; -import org.alfresco.web.config.ClientConfigElement.CustomProperty; +import org.alfresco.web.config.AdvancedSearchConfigElement; +import org.alfresco.web.config.AdvancedSearchConfigElement.CustomProperty; import org.alfresco.web.ui.common.ComponentConstants; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.SelfRenderingComponent; import org.alfresco.web.ui.repo.RepoConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.web.jsf.FacesContextUtils; /** * @author Kevin Roast @@ -137,12 +134,13 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements private void createComponentsFromConfig(FacesContext context) { DictionaryService dd = Repository.getServiceRegistry(context).getDictionaryService(); - ClientConfigElement clientConfig = Application.getClientConfig(context); + AdvancedSearchConfigElement config = (AdvancedSearchConfigElement)Application.getConfigService( + context).getConfig("Advanced Search").getConfigElement(AdvancedSearchConfigElement.CONFIG_ELEMENT_ID); // create an appropriate component for each custom property // using the DataDictionary to look-up labels and value types String beanBinding = (String)getAttributes().get("bean") + '.' + (String)getAttributes().get("var"); - List props = clientConfig.getCustomProperties(); + List props = config.getCustomProperties(); if (props != null) { for (CustomProperty property : props) diff --git a/source/test-resources/test-config-override.xml b/source/test-resources/test-config-override.xml new file mode 100644 index 0000000000..1e3a573abd --- /dev/null +++ b/source/test-resources/test-config-override.xml @@ -0,0 +1,82 @@ + + + + + + /jsp/error-override.jsp + + + /jsp/login-override.jsp + + + 1 + + + false + + + 10 + + + + + + Editor + + + http://www.somewhere.com/help + + + + webdav + + + me@somewhere.com + + + + + + Japanese + + French + + + + + + + + + + + + + + + + org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer + + + + details + + + + modified + + true + + +
50
+
+
+ + + false + +
+
+
+ +
\ No newline at end of file diff --git a/source/test-resources/test-config.xml b/source/test-resources/test-config.xml index f7de382a03..b283eeb367 100644 --- a/source/test-resources/test-config.xml +++ b/source/test-resources/test-config.xml @@ -3,9 +3,11 @@ - + + + @@ -13,17 +15,72 @@ - - servlet - /jsp/error.jsp - - - - org.alfresco.web.ui.common.renderer.data.RichListRenderer.DetailsViewRenderer - org.alfresco.web.ui.common.renderer.data.RichListRenderer.IconViewRenderer - + + /jsp/error.jsp + + /jsp/login.jsp + + + 6 + + + true + + + 3 + + + + + + Guest + + + http://www.alfresco.org/help/webclient + + + + http + + + alfresco@alfresco.org + +
+ + + + English + French + German + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer + org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer + @@ -63,7 +120,10 @@ - + + org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer + +