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

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