mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixes AR-238, AWC-505 and descending sort config issue
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2337 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -102,7 +102,8 @@
|
|||||||
<!-- allowable values: details|bubble -->
|
<!-- allowable values: details|bubble -->
|
||||||
<view>bubble</view>
|
<view>bubble</view>
|
||||||
<sort-column>created</sort-column>
|
<sort-column>created</sort-column>
|
||||||
<sort-descending>true</sort-descending>
|
<!-- allowable values: ascending|descending -->
|
||||||
|
<sort-direction>descending</sort-direction>
|
||||||
<page-size>
|
<page-size>
|
||||||
<bubble>5</bubble>
|
<bubble>5</bubble>
|
||||||
<details>20</details>
|
<details>20</details>
|
||||||
|
@@ -139,6 +139,16 @@ public abstract class AbstractWizardBean
|
|||||||
logger.debug("Started wizard : " + getWizardTitle() + " for editing");
|
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
|
* Deals with the next button being pressed
|
||||||
*
|
*
|
||||||
|
@@ -33,10 +33,13 @@ import org.alfresco.config.element.ConfigElementAdapter;
|
|||||||
public class ViewsConfigElement extends ConfigElementAdapter
|
public class ViewsConfigElement extends ConfigElementAdapter
|
||||||
{
|
{
|
||||||
public static final String CONFIG_ELEMENT_ID = "views";
|
public static final String CONFIG_ELEMENT_ID = "views";
|
||||||
|
|
||||||
public static final String VIEW_DETAILS = "details";
|
public static final String VIEW_DETAILS = "details";
|
||||||
public static final String VIEW_ICONS = "icons";
|
public static final String VIEW_ICONS = "icons";
|
||||||
public static final String VIEW_LIST = "list";
|
public static final String VIEW_LIST = "list";
|
||||||
public static final String VIEW_BUBBLE = "bubble";
|
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 = ":";
|
private static final String SEPARATOR = ":";
|
||||||
|
|
||||||
@@ -58,7 +61,7 @@ public class ViewsConfigElement extends ConfigElementAdapter
|
|||||||
private Map<String, String> sortColumns = new HashMap<String, String>(4);
|
private Map<String, String> sortColumns = new HashMap<String, String>(4);
|
||||||
|
|
||||||
// list of pages that have been configured to have ascending sorts
|
// list of pages that have been configured to have ascending sorts
|
||||||
private List<String> descendingSorts = new ArrayList<String>(1);
|
private Map<String, String> sortDirections = new HashMap<String, String>(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
@@ -127,9 +130,9 @@ public class ViewsConfigElement extends ConfigElementAdapter
|
|||||||
newElement.addDefaultSortColumn(page, this.sortColumns.get(page));
|
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
|
// 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));
|
newElement.addDefaultSortColumn(page, existingSortColumns.get(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: There is a potential problem here - how would you remove the
|
Map<String, String> existingSortDirs = existingElement.getSortDirections();
|
||||||
// descending sort for a page
|
for (String page : existingSortDirs.keySet())
|
||||||
for (String page : existingElement.getDescendingSorts())
|
|
||||||
{
|
{
|
||||||
newElement.addDescendingSort(page);
|
newElement.addSortDirection(page, existingSortDirs.get(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
return newElement;
|
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 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)
|
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<String> getDescendingSorts()
|
/*package*/ Map<String, String> getSortDirections()
|
||||||
{
|
{
|
||||||
return this.descendingSorts;
|
return this.sortDirections;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ public class ViewsElementReader implements ConfigElementReader
|
|||||||
public static final String ELEMENT_VIEWDEFAULTS = "view-defaults";
|
public static final String ELEMENT_VIEWDEFAULTS = "view-defaults";
|
||||||
public static final String ELEMENT_PAGESIZE = "page-size";
|
public static final String ELEMENT_PAGESIZE = "page-size";
|
||||||
public static final String ELEMENT_SORTCOLUMN = "sort-column";
|
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);
|
private static Log logger = LogFactory.getLog(ViewsElementReader.class);
|
||||||
|
|
||||||
@@ -95,15 +95,11 @@ public class ViewsElementReader implements ConfigElementReader
|
|||||||
configElement.addDefaultSortColumn(pageName, column);
|
configElement.addDefaultSortColumn(pageName, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the sort descending option
|
// get the sort direction option
|
||||||
Element sortDesc = page.element(ELEMENT_SORTDESCENDING);
|
Element sortDir = page.element(ELEMENT_SORTDIRECTION);
|
||||||
if (sortDesc != null)
|
if (sortDir != null)
|
||||||
{
|
{
|
||||||
Boolean descending = new Boolean(sortDesc.getTextTrim());
|
configElement.addSortDirection(pageName, sortDir.getTextTrim());
|
||||||
if (descending.booleanValue() == true)
|
|
||||||
{
|
|
||||||
configElement.addDescendingSort(pageName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// process the page-size element
|
// process the page-size element
|
||||||
|
@@ -529,9 +529,7 @@ public class WebClientConfigTest extends BaseTest
|
|||||||
assertFalse("default sort direction should be ascending", config.hasDescendingSort("not-there"));
|
assertFalse("default sort direction should be ascending", config.hasDescendingSort("not-there"));
|
||||||
assertFalse("browse screen should use an ascending sort", config.hasDescendingSort("browse"));
|
assertFalse("browse screen should use an ascending sort", config.hasDescendingSort("browse"));
|
||||||
assertTrue("topic screen should use a descending sort", config.hasDescendingSort("forum"));
|
assertTrue("topic screen should use a descending sort", config.hasDescendingSort("forum"));
|
||||||
|
assertFalse("topic screen should use an ascending sort", config.hasDescendingSort("topic"));
|
||||||
// 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
|
// make sure the getChildren method throws an exception
|
||||||
try
|
try
|
||||||
|
@@ -62,7 +62,7 @@
|
|||||||
<!-- define a sort column to the forum page -->
|
<!-- define a sort column to the forum page -->
|
||||||
<sort-column>modified</sort-column>
|
<sort-column>modified</sort-column>
|
||||||
<!-- turn on descending sorting for the forum page -->
|
<!-- turn on descending sorting for the forum page -->
|
||||||
<sort-descending>true</sort-descending>
|
<sort-direction>descending</sort-direction>
|
||||||
<page-size>
|
<page-size>
|
||||||
<!-- change the details page size to 50 -->
|
<!-- change the details page size to 50 -->
|
||||||
<details>50</details>
|
<details>50</details>
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
</forum>
|
</forum>
|
||||||
<topic>
|
<topic>
|
||||||
<!-- reset the descending sort for the topic view -->
|
<!-- reset the descending sort for the topic view -->
|
||||||
<sort-descending>false</sort-descending>
|
<sort-direction>ascending</sort-direction>
|
||||||
</topic>
|
</topic>
|
||||||
</view-defaults>
|
</view-defaults>
|
||||||
</views>
|
</views>
|
||||||
|
@@ -86,7 +86,8 @@
|
|||||||
<browse>
|
<browse>
|
||||||
<!-- allowable values: list|details|icons -->
|
<!-- allowable values: list|details|icons -->
|
||||||
<view>icons</view>
|
<view>icons</view>
|
||||||
<sort-descending>false</sort-descending>
|
<!-- allowable values: ascending|descending -->
|
||||||
|
<sort-direction>ascending</sort-direction>
|
||||||
<page-size>
|
<page-size>
|
||||||
<list>10</list>
|
<list>10</list>
|
||||||
<details>10</details>
|
<details>10</details>
|
||||||
@@ -113,7 +114,7 @@
|
|||||||
<!-- allowable values: details|bubble -->
|
<!-- allowable values: details|bubble -->
|
||||||
<view>bubble</view>
|
<view>bubble</view>
|
||||||
<sort-column>created</sort-column>
|
<sort-column>created</sort-column>
|
||||||
<sort-descending>true</sort-descending>
|
<sort-direction>descending</sort-direction>
|
||||||
<page-size>
|
<page-size>
|
||||||
<bubble>5</bubble>
|
<bubble>5</bubble>
|
||||||
<details>20</details>
|
<details>20</details>
|
||||||
|
@@ -294,10 +294,6 @@
|
|||||||
<property-name>fileFolderService</property-name>
|
<property-name>fileFolderService</property-name>
|
||||||
<value>#{FileFolderService}</value>
|
<value>#{FileFolderService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>navigator</property-name>
|
<property-name>navigator</property-name>
|
||||||
<value>#{NavigationBean}</value>
|
<value>#{NavigationBean}</value>
|
||||||
@@ -991,10 +987,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>namespaceService</property-name>
|
<property-name>namespaceService</property-name>
|
||||||
<value>#{NamespaceService}</value>
|
<value>#{NamespaceService}</value>
|
||||||
@@ -1028,10 +1020,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>namespaceService</property-name>
|
<property-name>namespaceService</property-name>
|
||||||
<value>#{NamespaceService}</value>
|
<value>#{NamespaceService}</value>
|
||||||
@@ -1053,10 +1041,6 @@
|
|||||||
<property-name>fileFolderService</property-name>
|
<property-name>fileFolderService</property-name>
|
||||||
<value>#{FileFolderService}</value>
|
<value>#{FileFolderService}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>navigator</property-name>
|
<property-name>navigator</property-name>
|
||||||
<value>#{NavigationBean}</value>
|
<value>#{NavigationBean}</value>
|
||||||
@@ -1102,10 +1086,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>namespaceService</property-name>
|
<property-name>namespaceService</property-name>
|
||||||
<value>#{NamespaceService}</value>
|
<value>#{NamespaceService}</value>
|
||||||
@@ -1139,10 +1119,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>contentService</property-name>
|
<property-name>contentService</property-name>
|
||||||
<value>#{ContentService}</value>
|
<value>#{ContentService}</value>
|
||||||
@@ -1180,10 +1156,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>namespaceService</property-name>
|
<property-name>namespaceService</property-name>
|
||||||
<value>#{NamespaceService}</value>
|
<value>#{NamespaceService}</value>
|
||||||
@@ -1328,10 +1300,6 @@
|
|||||||
<property-name>browseBean</property-name>
|
<property-name>browseBean</property-name>
|
||||||
<value>#{BrowseBean}</value>
|
<value>#{BrowseBean}</value>
|
||||||
</managed-property>
|
</managed-property>
|
||||||
<managed-property>
|
|
||||||
<property-name>searchService</property-name>
|
|
||||||
<value>#{SearchService}</value>
|
|
||||||
</managed-property>
|
|
||||||
<managed-property>
|
<managed-property>
|
||||||
<property-name>contentService</property-name>
|
<property-name>contentService</property-name>
|
||||||
<value>#{ContentService}</value>
|
<value>#{ContentService}</value>
|
||||||
|
@@ -127,7 +127,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><h:outputText value="#{msg.type}"/>:</td>
|
<td><h:outputText value="#{msg.type}"/>:</td>
|
||||||
<td width="90%">
|
<td width="90%">
|
||||||
<h:selectOneMenu value="#{NewRuleWizard.type}">
|
<h:selectOneMenu value="#{NewRuleWizard.type}" disabled="#{NewRuleWizard.inEditMode}">
|
||||||
<f:selectItems value="#{NewRuleWizard.types}" />
|
<f:selectItems value="#{NewRuleWizard.types}" />
|
||||||
</h:selectOneMenu>
|
</h:selectOneMenu>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user