dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14065
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4629: implemented sorting for attribute
------------------------------------------------------------
revno: 4629
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-21 17:41:25 +0200
message:
implemented sorting for attribute
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeSortOrderComparator.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListSortOrderAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/SaveAttributeSortOrderAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sortAttributeForm.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2011-09-21 15:41:25 +0000
@@ -55,10 +55,12 @@
private boolean userAttribute;
+ private Integer sortOrder;
+
private Set<AttributeOption> attributeOptions = new HashSet<AttributeOption>();
-
+
private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
-
+
public Attribute()
{
@@ -120,6 +122,16 @@
this.organisationUnitAttribute = organisationUnitAttribute;
}
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
+ public void setSortOrder( Integer sortOrder )
+ {
+ this.sortOrder = sortOrder;
+ }
+
public boolean isUserAttribute()
{
return userAttribute;
@@ -144,12 +156,7 @@
{
return attributeValues;
}
-
- public void setAttributeValues( Set<AttributeValue> attributeValues )
- {
- this.attributeValues = attributeValues;
- }
-
+
// -------------------------------------------------------------------------
// Helpers
// -------------------------------------------------------------------------
@@ -165,4 +172,9 @@
attributeOption.getAttributes().remove( this );
attributeOptions.remove( attributeOption );
}
+
+ public Integer getSortOrder()
+ {
+ return sortOrder;
+ }
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeSortOrderComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeSortOrderComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/comparator/AttributeSortOrderComparator.java 2011-09-21 15:41:25 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.attribute.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.attribute.Attribute;
+
+/**
+ * @author mortenoh
+ */
+public class AttributeSortOrderComparator
+ implements Comparator<Attribute>
+{
+ @Override
+ public int compare( Attribute attribute0, Attribute attribute1 )
+ {
+ if ( attribute0.getSortOrder() == null || attribute0.getSortOrder() == 0 )
+ {
+ return attribute0.getName().compareTo( attribute1.getName() );
+ }
+ if ( attribute1.getSortOrder() == null || attribute1.getSortOrder() == 0 )
+ {
+ return attribute0.getName().compareTo( attribute1.getName() );
+ }
+
+ return attribute0.getSortOrder() - attribute1.getSortOrder();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2011-09-21 15:41:25 +0000
@@ -26,6 +26,8 @@
<property name="userAttribute" />
+ <property name="sortOrder" />
+
<set name="attributeOptions" table="attributeattributeoptions">
<key column="attributeid" />
<many-to-many column="attributeoptionid" class="AttributeOption" />
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListSortOrderAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/GetAttributeListSortOrderAction.java 2011-09-21 15:41:25 +0000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author mortenoh
+ */
+public class GetAttributeListSortOrderAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ {
+ attributes = new ArrayList<Attribute>( attributeService.getAllAttributes() );
+
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/SaveAttributeSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/SaveAttributeSortOrderAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/SaveAttributeSortOrderAction.java 2011-09-21 15:41:25 +0000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.dataadmin.action.attribute;
+
+import java.util.List;
+
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class SaveAttributeSortOrderAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<Integer> attributes;
+
+ public void setAttributes( List<Integer> attributes )
+ {
+ this.attributes = attributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ {
+ int sortOrder = 1;
+
+ for ( Integer id : attributes )
+ {
+ Attribute attribute = attributeService.getAttribute( id );
+
+ attribute.setSortOrder( sortOrder++ );
+
+ attributeService.updateAttribute( attribute );
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2011-09-11 10:39:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2011-09-21 15:41:25 +0000
@@ -79,7 +79,7 @@
scope="prototype">
<property name="statisticsProvider" ref="org.hisp.dhis.statistics.StatisticsProvider" />
<property name="userService" ref="org.hisp.dhis.user.UserService" />
- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService"/>
+ <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
</bean>
<bean id="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsChartAction" class="org.hisp.dhis.dataadmin.action.statistics.GetStatisticsChartAction"
@@ -288,6 +288,11 @@
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
+ <bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListSortOrderAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListSortOrderAction"
+ scope="prototype">
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ </bean>
+
<bean id="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionListAction" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeOptionListAction"
scope="prototype">
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
@@ -323,6 +328,11 @@
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
+ <bean id="org.hisp.dhis.dataadmin.action.attribute.SaveAttributeSortOrderAction" class="org.hisp.dhis.dataadmin.action.attribute.SaveAttributeSortOrderAction"
+ scope="prototype">
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ </bean>
+
<bean id="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction"
scope="prototype">
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2011-09-21 15:41:25 +0000
@@ -354,8 +354,9 @@
edit_attribute = Edit Attribute
create_new_attribute_option = Add Attribute Option
edit_attribute_option = Edit Attribute Option
-assigned_to = Assigned To
+assigned_to = Assigned to
available_attribute_options = Available Attribute Options
selected_attribute_options = Selected Attribute Options
+attribute_sort_order = Attribute sort order
data_element_does_not_exist = Data element does not exist
category_option_combo_does_not_exist = Category option combo does not exist
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-09-08 19:37:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-09-21 15:41:25 +0000
@@ -523,6 +523,11 @@
<param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
</action>
+ <action name="showSortAttributeForm" class="org.hisp.dhis.dataadmin.action.attribute.GetAttributeListSortOrderAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/sortAttributeForm.vm</param>
+ </action>
+
<action name="addAttribute" class="org.hisp.dhis.dataadmin.action.attribute.AddAttributeAction">
<result name="success" type="redirect">attribute.action</result>
<result name="error" type="redirect">index.action</result>
@@ -535,6 +540,11 @@
<param name="requiredAuthorities">F_DATAELEMENT_ADD</param>
</action>
+ <action name="saveAttributeSortOrder" class="org.hisp.dhis.dataadmin.action.attribute.SaveAttributeSortOrderAction">
+ <result name="success" type="redirect">attribute.action</result>
+ <param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
+ </action>
+
<action name="updateAttribute" class="org.hisp.dhis.dataadmin.action.attribute.UpdateAttributeAction">
<result name="success" type="redirect">attribute.action</result>
<result name="error" type="redirect">index.action</result>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm 2011-09-09 08:14:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm 2011-09-21 15:41:25 +0000
@@ -36,6 +36,7 @@
<tr>
<td>#filterDiv( "attribute" )</td>
<td colspan="4" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortAttributeForm.action'" style="width:80px"/>
<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddAttributeForm.action'" style="width:80px"/>
</td>
</tr>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sortAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sortAttributeForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/sortAttributeForm.vm 2011-09-21 15:41:25 +0000
@@ -0,0 +1,33 @@
+<script type="text/javascript">
+ function submitForm()
+ {
+ selectAllById( "attributes" );
+ document.getElementById( "sortOrderForm" ).submit();
+ }
+</script>
+
+<h3>$i18n.getString( "attribute_sort_order" )</h3>
+
+<form id="sortOrderForm" action="saveAttributeSortOrder.action" method="post">
+
+<p>
+ <input type="button" value="$i18n.getString( 'move_up' )" style="width:130px" onclick="moveUpSelectedOption( 'attributes' )" />
+ <input type="button" value="$i18n.getString( 'move_down' )" style="width:130px" onclick="moveDownSelectedOption( 'attributes' )" />
+ <input type="button" value="$i18n.getString( 'move_to_top' )" style="width:130px" onclick="moveSelectedOptionToTop( 'attributes' )" />
+ <input type="button" value="$i18n.getString( 'move_to_bottom' )" style="width:130px" onclick="moveSelectedOptionToBottom( 'attributes' )" />
+</p>
+
+<p>
+<select multiple id="attributes" name="attributes" size="25" style="width:680px">
+#foreach ( $attribute in $attributes )
+ <option value="$attribute.id">$attribute.name</option>
+#end
+</select>
+</p>
+
+<p>
+ <input type="button" value="$i18n.getString( 'save' )" style="width:130px" onclick="submitForm()"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" style="width:130px" onclick="window.location.href='attribute.action'"/>
+</p>
+
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListSortOrderAction.java 2011-09-21 15:41:25 +0000
@@ -85,11 +85,11 @@
public String execute()
{
dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
-
+
Collections.sort( dataElements, new DataElementSortOrderComparator() );
-
+
displayPropertyHandler.handle( dataElements );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2011-09-16 09:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2011-09-21 15:41:25 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
@@ -143,7 +144,7 @@
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2011-09-21 15:41:25 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -184,7 +185,7 @@
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
attributeValues = AttributeUtils.getAttributeValueMap( dataElement.getAttributeValues() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java 2011-09-21 15:41:25 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -145,7 +146,7 @@
attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
attributeValues = AttributeUtils.getAttributeValueMap( indicator.getAttributeValues() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java 2011-09-21 15:41:25 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.indicator.comparator.IndicatorTypeNameComparator;
@@ -125,7 +126,7 @@
attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java 2011-09-21 15:41:25 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
@@ -167,7 +168,7 @@
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
attributeValues = AttributeUtils.getAttributeValueMap( organisationUnit.getAttributeValues() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java 2011-09-21 15:41:25 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
@@ -126,7 +127,7 @@
Collections.sort( dataSets, new DataSetNameComparator() );
Collections.sort( groupSets, new OrganisationUnitGroupSetNameComparator() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java 2011-09-21 15:41:25 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.attribute.comparator.AttributeNameComparator;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
@@ -180,7 +181,7 @@
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
- Collections.sort( attributes, new AttributeNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
return SUCCESS;
}