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
This commit is contained in:
Gavin Cornwell
2006-02-04 23:18:46 +00:00
parent 432b539097
commit 8ba6c27fe0
24 changed files with 1570 additions and 1007 deletions

View File

@@ -6,28 +6,54 @@
<evaluator id="aspect-name" class="org.alfresco.web.config.AspectEvaluator" />
</evaluators>
<element-readers>
<element-reader element-name="server" class="org.alfresco.web.config.ServerElementReader"/>
<element-reader element-name="client" class="org.alfresco.web.config.ClientElementReader"/>
<element-reader element-name="property-sheet" class="org.alfresco.web.config.PropertySheetElementReader"/>
<element-reader element-name="navigation" class="org.alfresco.web.config.NavigationElementReader" />
<element-reader element-name="languages" class="org.alfresco.web.config.LanguagesElementReader" />
<element-reader element-name="advanced-search" class="org.alfresco.web.config.AdvancedSearchElementReader" />
<element-reader element-name="views" class="org.alfresco.web.config.ViewsElementReader" />
</element-readers>
</plug-ins>
<config>
<server>
<error-page>/jsp/error.jsp</error-page>
<error-pages>
<error-page>/jsp/error.jsp</error-page>
<error-page type="org.alfresco.service.cmr.repository.InvalidNodeRefException">
/jsp/error_missing.jsp
</error-page>
</error-pages>
<login-page>/jsp/login.jsp</login-page>
</server>
<admin>
<initial-password>admin</initial-password>
</admin>
<client>
<!-- the error page the client will use -->
<error-page>/jsp/error.jsp</error-page>
<!-- the login page the client will use -->
<login-page>/jsp/login.jsp</login-page>
<!-- the maximum number of items to show in the recent spaces shelf component -->
<recent-spaces-items>6</recent-spaces-items>
<!-- Shelf component default visibility, set to false to hide the shelf by default -->
<shelf-visible>true</shelf-visible>
<!-- the minimum number of characters required for a valid search string -->
<search-minimum>3</search-minimum>
<!-- The default permissions to apply to a new users Home Space when first created -->
<!-- this permission is for other users attempting to access that Home Space -->
<!-- generally set to "Guest" or empty value to indicate a private hidden space. -->
<!-- see org.alfresco.service.cmr.security.PermissionService for allowed values -->
<home-space-permission>Guest</home-space-permission>
<!-- the URL to the client Help file -->
<help-url>http://www.alfresco.org/help/webclient</help-url>
<!-- the type of edit link to use, NOTE: inline editable will always take precedence -->
<!-- can be: http|webdav|cifs -->
<edit-link-type>http</edit-link-type>
<!-- the from address to use when sending emails from the client -->
<from-email-address>alfresco@alfresco.org</from-email-address>
</client>
</config>
<config evaluator="string-compare" condition="Languages">
<!-- the list of available language files -->
<languages>
<language locale="en_US">English</language>
@@ -35,28 +61,15 @@
<!-- <language locale="de_DE">German</language> -->
<!-- <language locale="ja_JP">Japanese</language> -->
</languages>
</config>
<!-- advanced search custom attribute config -->
<advanced-search>
<!-- type constraint drop-down -->
<content-types>
<!-- cm:content type is implicit in this list -->
<!-- types must extend cm:content for the Alfresco web-client -->
<type name="cm:dictionaryModel" />
<type name="fm:post" />
</content-types>
<!-- custom properties to be shown in the More Options panel -->
<custom-properties>
</custom-properties>
</advanced-search>
<config evaluator="string-compare" condition="Views">
<!-- the views available in the client -->
<views>
<view>org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer</view>
<view>org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer</view>
<view>org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer</view>
<view>org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer</view>
</views>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer</view-impl>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer</view-impl>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer</view-impl>
<view-impl>org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer</view-impl>
<!-- default values for the views available in the client -->
<view-defaults>
@@ -96,32 +109,23 @@
</page-size>
</topic>
</view-defaults>
</views>
</config>
<!-- the maximum number of items to show in the recent spaces shelf component -->
<recent-spaces-items>6</recent-spaces-items>
<!-- Shelf component default visibility, set to false to hide the shelf by default -->
<shelf-visible>true</shelf-visible>
<!-- the minimum number of characters required for a valid search string -->
<search-minimum>3</search-minimum>
<!-- The default permissions to apply to a new users Home Space when first created -->
<!-- this permission is for other users attempting to access that Home Space -->
<!-- generally set to "Guest" or empty value to indicate a private hidden space. -->
<!-- see org.alfresco.service.cmr.security.PermissionService for allowed values -->
<home-space-permission>Guest</home-space-permission>
<!-- the URL to the client Help file -->
<help-url>http://www.alfresco.org/help/webclient</help-url>
<!-- the type of edit link to use, NOTE: inline editable will always take precedence -->
<!-- can be: http|webdav|cifs -->
<edit-link-type>http</edit-link-type>
<!-- the from address to use when sending emails from the client -->
<from-email-address>alfresco@alfresco.org</from-email-address>
</client>
<config evaluator="string-compare" condition="Advanced Search">
<!-- advanced search custom attribute config -->
<advanced-search>
<!-- type constraint drop-down -->
<content-types>
<!-- cm:content type is implicit in this list -->
<!-- types must extend cm:content for the Alfresco web-client -->
<type name="cm:dictionaryModel" />
<type name="fm:post" />
</content-types>
<!-- custom properties to be shown in the More Options panel -->
<custom-properties>
</custom-properties>
</advanced-search>
</config>
<config evaluator="string-compare" condition="Custom Content Types">

View File

@@ -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;

View File

@@ -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<String> types = getClientConfig().getContentTypes();
List<String> 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<String, DataTypeDefinition>(7, 1.0f);
List<CustomProperty> customProps = getClientConfig().getCustomProperties();
List<CustomProperty> 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<String, Boolean> panels = new HashMap(5, 1.0f);

View File

@@ -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;

View File

@@ -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())

View File

@@ -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<String> languages = config.getLanguages();
List<String> 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)

View File

@@ -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<String> contentTypes = null;
private List<CustomProperty> 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<ConfigElement> 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<String> getContentTypes()
{
return this.contentTypes;
}
/**
* @param contentTypes The contentTypes to set.
*/
/*package*/ void setContentTypes(List<String> 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<String>(3);
}
if (this.contentTypes.contains(contentType) == false)
{
this.contentTypes.add(contentType);
}
}
/**
* @return Returns the customProps.
*/
public List<CustomProperty> getCustomProperties()
{
return this.customProps;
}
/**
* @param customProps The customProps to set.
*/
/*package*/ void setCustomProperties(List<CustomProperty> 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<CustomProperty>(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;
}
}

View File

@@ -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<Element> typesItr = contentTypes.elementIterator(ELEMENT_TYPE);
List<String> types = new ArrayList<String>(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<Element> propsItr = customProps.elementIterator(ELEMENT_METADATA);
List<CustomProperty> props = new ArrayList<CustomProperty>(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;
}
}

View File

@@ -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<String> views = new ArrayList<String>(4);
// map to store all the default views
private Map<String, String> defaultViews = new HashMap<String, String>(4);
// map to store all default pages sizes for configured client views
private Map<String, Integer> pagesSizes = new HashMap<String, Integer>(10);
// map to store default sort columns for configured views
private Map<String, String> sortColumns = new HashMap<String, String>(4);
// list of pages that have been configured to have ascending sorts
private List<String> descendingSorts = new ArrayList<String>(1);
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<String, String> localeMap = new HashMap<String, String>();
private List<String> languages = new ArrayList<String>(8);
private String homeSpacePermission = null;
private List<String> contentTypes = null;
private List<CustomProperty> 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;
}
ClientConfigElement existingElement = (ClientConfigElement)configElement;
ClientConfigElement newElement = new ClientConfigElement();
/**
* Adds a configured view
*
* @param renderer The implementation class of the view (the renderer)
*/
public void addView(String renderer)
{
this.views.add(renderer);
}
// 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());
/**
* Returns a map of configured views for the client
*
* @return List of the implementation classes for the configured views
*/
public List<String> 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);
if (view == null)
{
view = this.defaultView;
}
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,33 +111,35 @@ 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 this.errorPage;
}
/**
* @return List of supported language locale strings in config file order
* @param errorPage Sets the error page
*/
public List<String> getLanguages()
/*package*/ void setErrorPage(String errorPage)
{
return this.languages;
this.errorPage = errorPage;
}
/**
* @param locale The locale string to lookup language label for
*
* @return the language label for specified locale string, or null if not found
* @return Returns the login Page.
*/
public String getLabelForLanguage(String locale)
public String getLoginPage()
{
return this.localeMap.get(locale);
return this.loginPage;
}
/**
* @param loginPage The login Page to set.
*/
/*package*/ void setLoginPage(String loginPage)
{
this.loginPage = loginPage;
}
/**
@@ -388,57 +222,4 @@ public class ClientConfigElement extends ConfigElementAdapter
{
this.homeSpacePermission = homeSpacePermission;
}
/**
* @return Returns the contentTypes.
*/
public List<String> getContentTypes()
{
return this.contentTypes;
}
/**
* @param contentTypes The contentTypes to set.
*/
/*package*/ void setContentTypes(List<String> contentTypes)
{
this.contentTypes = contentTypes;
}
/**
* @return Returns the customProps.
*/
public List<CustomProperty> getCustomProperties()
{
return this.customProps;
}
/**
* @param customProps The customProps to set.
*/
/*package*/ void setCustomProperties(List<CustomProperty> 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;
}
}

View File

@@ -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<Element> 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<Element> 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<Element> 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<Element> typesItr = contentTypes.elementIterator(ELEMENT_TYPE);
List<String> types = new ArrayList<String>(5);
while (typesItr.hasNext())
{
Element contentType = typesItr.next();
String type = contentType.attributeValue(ATTRIBUTE_NAME);
if (type != null)
{
types.add(type);
configElement.setErrorPage(errorPage.getTextTrim());
}
}
configElement.setContentTypes(types);
// get the list of custom properties to display
Element customProps = advsearch.element(ELEMENT_CUSTOMPROPS);
Iterator<Element> propsItr = customProps.elementIterator(ELEMENT_METADATA);
List<CustomProperty> props = new ArrayList<CustomProperty>(5);
while (propsItr.hasNext())
// get the login page
Element loginPage = element.element(ELEMENT_LOGINPAGE);
if (loginPage != null)
{
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.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<Element> 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!");
}
}
}
}
}
}

View File

@@ -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<String, String> localeMap = new HashMap<String, String>();
private List<String> languages = new ArrayList<String>(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<ConfigElement> 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<String> 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<String> 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);
}
}

View File

@@ -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<Element> 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;
}
}

View File

@@ -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<String, String> 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<String, String> mimetypes = new HashMap<String, String>(89, 1.0f);
}

View File

@@ -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<Element> 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;
}
}

View File

@@ -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));
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<String> views = new ArrayList<String>(4);
// map to store all the default views
private Map<String, String> defaultViews = new HashMap<String, String>(4);
// map to store all default page sizes for configured client views
private Map<String, Integer> pageSizes = new HashMap<String, Integer>(10);
// map to store default sort columns for configured views
private Map<String, String> sortColumns = new HashMap<String, String>(4);
// list of pages that have been configured to have ascending sorts
private List<String> descendingSorts = new ArrayList<String>(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<ConfigElement> 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<String, String> existingDefaultViews = existingElement.getDefaultViews();
for (String page : existingDefaultViews.keySet())
{
newElement.addDefaultView(page, existingDefaultViews.get(page));
}
Map<String, Integer> 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<String, String> 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<String> 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<String, String> 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<String, Integer> 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<String, String> 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<String> getDescendingSorts()
{
return this.descendingSorts;
}
}

View File

@@ -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<Element> 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<Element> 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<Element> 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!");
}
}
}
}
}
}

View File

@@ -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<String> 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<String> 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());
}
String defaultView = clientConfig.getDefaultView("topic");
assertEquals("Default view for topic should be 'bubble'", "bubble", defaultView);
public void testClientOverride()
{
// setup the config service
List<String> configFiles = new ArrayList<String>(2);
configFiles.add(getResourcesDir() + "test-config.xml");
configFiles.add(getResourcesDir() + "test-config-override.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.init();
// 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);
// try and get the global config section
Config globalSection = svc.getGlobalConfig();
assertNotNull("global section", globalSection);
// 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 client config
ClientConfigElement clientConfig = (ClientConfigElement)globalSection.
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
assertNotNull("client config", clientConfig);
// 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);
}
assertNull(fromViewId);
assertNull(toViewId);
public void testLanguages()
{
// setup the config service
List<String> configFiles = new ArrayList<String>(2);
configFiles.add(getResourcesDir() + "test-config.xml");
configFiles.add(getResourcesDir() + "test-config-override.xml");
XMLConfigService svc = new XMLConfigService(new FileConfigSource(configFiles));
svc.init();
assertEquals("browse", fromOutcome);
assertEquals("newOutcome", toOutcome);
LanguagesConfigElement config = (LanguagesConfigElement)svc.getConfig("Languages").
getConfigElement(LanguagesConfigElement.CONFIG_ELEMENT_ID);
assertNotNull("languages config", config);
// 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<String> configFiles = new ArrayList<String>(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<String> configFiles = new ArrayList<String>(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<String> 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
}
}
}

View File

@@ -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<String> views = clientConfig.getViews();
ViewsConfigElement viewsConfig = (ViewsConfigElement)Application.getConfigService(
FacesContext.getCurrentInstance()).getConfig("Views").
getConfigElement(ViewsConfigElement.CONFIG_ELEMENT_ID);
List<String> views = viewsConfig.getViews();
// instantiate each renderer and add to the list
for (String view : views)

View File

@@ -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<CustomProperty> props = clientConfig.getCustomProperties();
List<CustomProperty> props = config.getCustomProperties();
if (props != null)
{
for (CustomProperty property : props)

View File

@@ -0,0 +1,82 @@
<alfresco-config>
<config>
<client>
<!-- the error page the client will use -->
<error-page>/jsp/error-override.jsp</error-page>
<!-- the login page the client will use -->
<login-page>/jsp/login-override.jsp</login-page>
<!-- the maximum number of items to show in the recent spaces shelf component -->
<recent-spaces-items>1</recent-spaces-items>
<!-- Shelf component default visibility, set to false to hide the shelf by default -->
<shelf-visible>false</shelf-visible>
<!-- the minimum number of characters required for a valid search string -->
<search-minimum>10</search-minimum>
<!-- The default permissions to apply to a new users Home Space when first created -->
<!-- this permission is for other users attempting to access that Home Space -->
<!-- generally set to "Guest" or empty value to indicate a private hidden space. -->
<!-- see org.alfresco.service.cmr.security.PermissionService for allowed values -->
<home-space-permission>Editor</home-space-permission>
<!-- the URL to the client Help file -->
<help-url>http://www.somewhere.com/help</help-url>
<!-- the type of edit link to use, NOTE: inline editable will always take precedence -->
<!-- can be: http|webdav|cifs -->
<edit-link-type>webdav</edit-link-type>
<!-- the from address to use when sending emails from the client -->
<from-email-address>me@somewhere.com</from-email-address>
</client>
</config>
<config evaluator="string-compare" condition="Languages">
<languages>
<language locale="ja_JP">Japanese</language>
<!-- this shouldn't appear in the list twice! -->
<language locale="fr_FR">French</language>
</languages>
</config>
<config evaluator="string-compare" condition="Advanced Search">
<!-- advanced search custom attribute config -->
<advanced-search>
<!-- custom properties to be shown in the More Options panel -->
<custom-properties>
<meta-data aspect="app:simpleworkflow" property="app:rejectStep" displayLabelId="reject_step" />
</custom-properties>
</advanced-search>
</config>
<config evaluator="string-compare" condition="Views">
<views>
<view-impl>org.alfresco.web.bean.ForumsBean$TopicBubbleViewRenderer</view-impl>
<view-defaults>
<browse>
<!-- change the default view for browse page -->
<view>details</view>
</browse>
<forum>
<!-- define a sort column to the forum page -->
<sort-column>modified</sort-column>
<!-- turn on descending sorting for the forum page -->
<sort-descending>true</sort-descending>
<page-size>
<!-- change the details page size to 50 -->
<details>50</details>
</page-size>
</forum>
<topic>
<!-- reset the descending sort for the topic view -->
<sort-descending>false</sort-descending>
</topic>
</view-defaults>
</views>
</config>
</alfresco-config>

View File

@@ -3,9 +3,11 @@
<plug-ins>
<element-readers>
<element-reader element-name="property-sheet" class="org.alfresco.web.config.PropertySheetElementReader"/>
<element-reader element-name="server" class="org.alfresco.web.config.ServerElementReader"/>
<element-reader element-name="client" class="org.alfresco.web.config.ClientElementReader"/>
<element-reader element-name="navigation" class="org.alfresco.web.config.NavigationElementReader" />
<element-reader element-name="languages" class="org.alfresco.web.config.LanguagesElementReader" />
<element-reader element-name="advanced-search" class="org.alfresco.web.config.AdvancedSearchElementReader" />
<element-reader element-name="views" class="org.alfresco.web.config.ViewsElementReader" />
</element-readers>
</plug-ins>
@@ -13,16 +15,71 @@
<property-sheet>
<show-property name="name" />
</property-sheet>
<server>
<mode>servlet</mode>
<error-page>/jsp/error.jsp</error-page>
</server>
<client>
<!-- the error page the client will use -->
<error-page>/jsp/error.jsp</error-page>
<!-- the login page the client will use -->
<login-page>/jsp/login.jsp</login-page>
<!-- the maximum number of items to show in the recent spaces shelf component -->
<recent-spaces-items>6</recent-spaces-items>
<!-- Shelf component default visibility, set to false to hide the shelf by default -->
<shelf-visible>true</shelf-visible>
<!-- the minimum number of characters required for a valid search string -->
<search-minimum>3</search-minimum>
<!-- The default permissions to apply to a new users Home Space when first created -->
<!-- this permission is for other users attempting to access that Home Space -->
<!-- generally set to "Guest" or empty value to indicate a private hidden space. -->
<!-- see org.alfresco.service.cmr.security.PermissionService for allowed values -->
<home-space-permission>Guest</home-space-permission>
<!-- the URL to the client Help file -->
<help-url>http://www.alfresco.org/help/webclient</help-url>
<!-- the type of edit link to use, NOTE: inline editable will always take precedence -->
<!-- can be: http|webdav|cifs -->
<edit-link-type>http</edit-link-type>
<!-- the from address to use when sending emails from the client -->
<from-email-address>alfresco@alfresco.org</from-email-address>
</client>
</config>
<config evaluator="string-compare" condition="Languages">
<languages>
<language locale="en_US">English</language>
<language locale="fr_FR">French</language>
<language locale="de_DE">German</language>
</languages>
</config>
<config evaluator="string-compare" condition="Advanced Search">
<!-- advanced search custom attribute config -->
<advanced-search>
<!-- type constraint drop-down -->
<content-types>
<!-- cm:content type is implicit in this list -->
<!-- types must extend cm:content for the Alfresco web-client -->
<type name="cm:dictionaryModel" />
<type name="fm:post" />
</content-types>
<!-- custom properties to be shown in the More Options panel -->
<custom-properties>
<meta-data type="cm:dictionaryModel" property="cm:modelAuthor" />
<meta-data aspect="app:simpleworkflow" property="app:approveStep" />
</custom-properties>
</advanced-search>
</config>
<config evaluator="string-compare" condition="Views">
<!-- the views available in the client -->
<views>
<view>org.alfresco.web.ui.common.renderer.data.RichListRenderer.DetailsViewRenderer</view>
<view>org.alfresco.web.ui.common.renderer.data.RichListRenderer.IconViewRenderer</view>
</views>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$DetailsViewRenderer</view-impl>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$IconViewRenderer</view-impl>
<!-- default values for the views available in the client -->
<view-defaults>
@@ -63,7 +120,10 @@
</page-size>
</topic>
</view-defaults>
</client>
<view-impl>org.alfresco.web.ui.common.renderer.data.RichListRenderer$ListViewRenderer</view-impl>
</views>
</config>
<config evaluator="string-compare" condition="space-aspect">