diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index ddefb03744..a5bdc0db95 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -102,7 +102,8 @@ bubble created - true + + descending 5
20
diff --git a/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java b/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java index d80b696486..9d57d77ed8 100644 --- a/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java +++ b/source/java/org/alfresco/web/bean/wizard/AbstractWizardBean.java @@ -139,6 +139,16 @@ public abstract class AbstractWizardBean logger.debug("Started wizard : " + getWizardTitle() + " for editing"); } + /** + * Determines whether the wizard is in edit mode + * + * @return true if the wizard is in edit mode, false if it is in creation mode + */ + public boolean isInEditMode() + { + return this.editMode; + } + /** * Deals with the next button being pressed * diff --git a/source/java/org/alfresco/web/config/ViewsConfigElement.java b/source/java/org/alfresco/web/config/ViewsConfigElement.java index bff7fef81a..68f5dd806a 100644 --- a/source/java/org/alfresco/web/config/ViewsConfigElement.java +++ b/source/java/org/alfresco/web/config/ViewsConfigElement.java @@ -33,10 +33,13 @@ import org.alfresco.config.element.ConfigElementAdapter; 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"; + public static final String SORT_ASCENDING = "ascending"; + public static final String SORT_DESCENDING = "descending"; private static final String SEPARATOR = ":"; @@ -58,7 +61,7 @@ public class ViewsConfigElement extends ConfigElementAdapter private Map sortColumns = new HashMap(4); // list of pages that have been configured to have ascending sorts - private List descendingSorts = new ArrayList(1); + private Map sortDirections = new HashMap(1); /** * Default Constructor @@ -127,9 +130,9 @@ public class ViewsConfigElement extends ConfigElementAdapter newElement.addDefaultSortColumn(page, this.sortColumns.get(page)); } - for (String page : this.descendingSorts) + for (String page : this.sortDirections.keySet()) { - newElement.addDescendingSort(page); + newElement.addSortDirection(page, this.sortDirections.get(page)); } // copy all the config from the element to be combined into the new one @@ -161,11 +164,10 @@ public class ViewsConfigElement extends ConfigElementAdapter 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()) + Map existingSortDirs = existingElement.getSortDirections(); + for (String page : existingSortDirs.keySet()) { - newElement.addDescendingSort(page); + newElement.addSortDirection(page, existingSortDirs.get(page)); } return newElement; @@ -322,13 +324,14 @@ public class ViewsConfigElement extends ConfigElementAdapter } /** - * Sets the given page as using descending sorts + * Sets the given page as using the given sort direction * * @param page The name of the page i.e. browse, forums etc. + * @param dir The sort direction */ - /*package*/ void addDescendingSort(String page) + /*package*/ void addSortDirection(String page, String dir) { - this.descendingSorts.add(page); + this.sortDirections.put(page, dir); } /** @@ -340,16 +343,24 @@ public class ViewsConfigElement extends ConfigElementAdapter */ public boolean hasDescendingSort(String page) { - return this.descendingSorts.contains(page); + boolean usesDescendingSort = false; + + String sortDir = this.sortDirections.get(page); + if (sortDir != null && sortDir.equalsIgnoreCase(SORT_DESCENDING)) + { + usesDescendingSort = true; + } + + return usesDescendingSort; } /** - * Returns a list of pages that use a descending sort + * Returns a map of the sort directions * - * @return List of pages that use a descending sort + * @return Map of sort directions */ - /*package*/ List getDescendingSorts() + /*package*/ Map getSortDirections() { - return this.descendingSorts; + return this.sortDirections; } } diff --git a/source/java/org/alfresco/web/config/ViewsElementReader.java b/source/java/org/alfresco/web/config/ViewsElementReader.java index e376191de8..3351c1dde9 100644 --- a/source/java/org/alfresco/web/config/ViewsElementReader.java +++ b/source/java/org/alfresco/web/config/ViewsElementReader.java @@ -37,7 +37,7 @@ public class ViewsElementReader implements ConfigElementReader 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_SORTDIRECTION = "sort-direction"; private static Log logger = LogFactory.getLog(ViewsElementReader.class); @@ -95,15 +95,11 @@ public class ViewsElementReader implements ConfigElementReader configElement.addDefaultSortColumn(pageName, column); } - // get the sort descending option - Element sortDesc = page.element(ELEMENT_SORTDESCENDING); - if (sortDesc != null) + // get the sort direction option + Element sortDir = page.element(ELEMENT_SORTDIRECTION); + if (sortDir != null) { - Boolean descending = new Boolean(sortDesc.getTextTrim()); - if (descending.booleanValue() == true) - { - configElement.addDescendingSort(pageName); - } + configElement.addSortDirection(pageName, sortDir.getTextTrim()); } // process the page-size element diff --git a/source/java/org/alfresco/web/config/WebClientConfigTest.java b/source/java/org/alfresco/web/config/WebClientConfigTest.java index 689fd781d0..acdbba59c7 100644 --- a/source/java/org/alfresco/web/config/WebClientConfigTest.java +++ b/source/java/org/alfresco/web/config/WebClientConfigTest.java @@ -529,9 +529,7 @@ public class WebClientConfigTest extends BaseTest 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")); + assertFalse("topic screen should use an ascending sort", config.hasDescendingSort("topic")); // make sure the getChildren method throws an exception try diff --git a/source/test-resources/test-config-override.xml b/source/test-resources/test-config-override.xml index 54f80c1d25..72d35de2de 100644 --- a/source/test-resources/test-config-override.xml +++ b/source/test-resources/test-config-override.xml @@ -62,7 +62,7 @@ modified - true + descending
50
@@ -70,7 +70,7 @@ - false + ascending diff --git a/source/test-resources/test-config.xml b/source/test-resources/test-config.xml index b761650764..a8ade331dc 100644 --- a/source/test-resources/test-config.xml +++ b/source/test-resources/test-config.xml @@ -86,7 +86,8 @@ icons - false + + ascending 10
10
@@ -113,7 +114,7 @@ bubble created - true + descending 5
20
diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index a951f0f46c..6c97700f3e 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -294,10 +294,6 @@ fileFolderService #{FileFolderService} - - searchService - #{SearchService} - navigator #{NavigationBean} @@ -991,10 +987,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - namespaceService #{NamespaceService} @@ -1028,10 +1020,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - namespaceService #{NamespaceService} @@ -1053,10 +1041,6 @@ fileFolderService #{FileFolderService} - - searchService - #{SearchService} - navigator #{NavigationBean} @@ -1102,10 +1086,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - namespaceService #{NamespaceService} @@ -1139,10 +1119,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - contentService #{ContentService} @@ -1180,10 +1156,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - namespaceService #{NamespaceService} @@ -1328,10 +1300,6 @@ browseBean #{BrowseBean} - - searchService - #{SearchService} - contentService #{ContentService} diff --git a/source/web/jsp/wizard/new-rule/details.jsp b/source/web/jsp/wizard/new-rule/details.jsp index 8ea798d14f..96e0db7809 100644 --- a/source/web/jsp/wizard/new-rule/details.jsp +++ b/source/web/jsp/wizard/new-rule/details.jsp @@ -127,7 +127,7 @@ : - +