dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10387
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2855: Reverted R 2843
------------------------------------------------------------
revno: 2855
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-02-15 14:45:11 +0100
message:
Reverted R 2843
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitCustomComparator.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateCustomSortAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitCustomSort.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/sortorder/DefaultSortOrderManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ExpandSubtreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/GetExpandedTreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/interceptor/OrganisationUnitTreeInterceptor.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm
--
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/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-02-15 13:45:11 +0000
@@ -46,57 +46,51 @@
extends Source
{
public static final String FEATURETYPE_NONE = "None";
-
public static final String FEATURETYPE_MULTIPOLYGON = "MultiPolygon";
-
public static final String FEATURETYPE_POLYGON = "Polygon";
-
public static final String FEATURETYPE_POINT = "Point";
-
+
private static final Pattern JSON_COORDINATE_PATTERN = Pattern.compile( "(\\[{3}.*?\\]{3})" );
-
- private static final Pattern COORDINATE_PATTERN = Pattern.compile( "([\\-0-9.]+,[\\-0-9.]+)" );
-
+ private static final Pattern COORDINATE_PATTERN = Pattern.compile("([\\-0-9.]+,[\\-0-9.]+)");
+
private Set<OrganisationUnit> children = new HashSet<OrganisationUnit>();
private OrganisationUnit parent;
-
+
private Date openingDate;
private Date closedDate;
private boolean active;
-
+
private String comment;
-
+
private String geoCode;
private String featureType;
-
+
private String coordinates;
-
+
private String url;
private Date lastUpdated;
private Set<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
-
+
private String contactPerson;
-
+
private String address;
-
+
private String email;
-
+
private String phoneNumber;
private transient int level;
-
+
private transient boolean currentParent;
-
+
private transient String type;
-
- private Integer sortOrder;
-
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -109,7 +103,7 @@
{
this.name = name;
}
-
+
/**
* @param name
* @param shortName
@@ -119,8 +113,8 @@
* @param active
* @param comment
*/
- public OrganisationUnit( String name, String shortName, String code, Date openingDate, Date closedDate,
- boolean active, String comment )
+ public OrganisationUnit( String name, String shortName, String code, Date openingDate,
+ Date closedDate, boolean active, String comment )
{
this.name = name;
this.shortName = shortName;
@@ -141,8 +135,8 @@
* @param active
* @param comment
*/
- public OrganisationUnit( String name, OrganisationUnit parent, String shortName, String code, Date openingDate,
- Date closedDate, boolean active, String comment )
+ public OrganisationUnit( String name, OrganisationUnit parent, String shortName, String code,
+ Date openingDate, Date closedDate, boolean active, String comment )
{
this.name = name;
this.parent = parent;
@@ -157,10 +151,10 @@
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
-
+
public boolean hasChild()
{
- return !this.children.isEmpty();
+ return !this.children.isEmpty();
}
public boolean hasChildrenWithCoordinates()
@@ -172,19 +166,19 @@
return true;
}
}
-
+
return false;
}
-
+
public boolean hasCoordinates()
{
return coordinates != null && coordinates.trim().length() > 0;
}
-
+
public List<CoordinatesTuple> getCoordinatesAsList()
{
List<CoordinatesTuple> list = new ArrayList<CoordinatesTuple>();
-
+
if ( coordinates != null && !coordinates.trim().isEmpty() )
{
Matcher jsonMatcher = JSON_COORDINATE_PATTERN.matcher( coordinates );
@@ -192,29 +186,29 @@
while ( jsonMatcher.find() )
{
CoordinatesTuple tuple = new CoordinatesTuple();
-
+
Matcher matcher = COORDINATE_PATTERN.matcher( jsonMatcher.group() );
-
+
while ( matcher.find() )
{
tuple.addCoordinates( matcher.group() );
}
-
+
list.add( tuple );
}
}
-
+
return list;
}
-
+
public void setMultiPolygonCoordinatesFromList( List<CoordinatesTuple> list )
{
StringBuilder builder = new StringBuilder();
-
+
if ( list != null && list.size() > 0 )
{
builder.append( "[" );
-
+
for ( CoordinatesTuple tuple : list )
{
builder.append( "[[" );
@@ -223,22 +217,22 @@
{
builder.append( "[" + coordinates + "]," );
}
-
- builder.deleteCharAt( builder.lastIndexOf( "," ) );
+
+ builder.deleteCharAt( builder.lastIndexOf( "," ) );
builder.append( "]]," );
}
-
+
builder.deleteCharAt( builder.lastIndexOf( "," ) );
builder.append( "]" );
}
-
+
this.coordinates = StringUtils.trimToNull( builder.toString() );
}
-
+
public void setPointCoordinatesFromList( List<CoordinatesTuple> list )
{
StringBuilder builder = new StringBuilder();
-
+
if ( list != null && list.size() > 0 )
{
for ( CoordinatesTuple tuple : list )
@@ -249,10 +243,10 @@
}
}
}
-
+
this.coordinates = StringUtils.trimToNull( builder.toString() );
}
-
+
public String getChildrenFeatureType()
{
for ( OrganisationUnit child : children )
@@ -262,15 +256,15 @@
return child.getFeatureType();
}
}
-
+
return FEATURETYPE_NONE;
}
-
+
public String getValidCoordinates()
{
return coordinates != null && !coordinates.isEmpty() ? coordinates : "[]";
}
-
+
public OrganisationUnitGroup getGroupInGroupSet( OrganisationUnitGroupSet groupSet )
{
if ( groupSet != null )
@@ -280,20 +274,20 @@
if ( groupSet.getOrganisationUnitGroups().contains( group ) )
{
return group;
- }
+ }
}
}
-
+
return null;
}
-
+
public String getGroupNameInGroupSet( OrganisationUnitGroupSet groupSet )
{
final OrganisationUnitGroup group = getGroupInGroupSet( groupSet );
-
+
return group != null ? group.getName() : null;
}
-
+
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
@@ -376,17 +370,17 @@
{
this.code = code;
}
-
+
public String getAlternativeName()
{
return getShortName();
}
-
+
public void setAlternativeName( String alternativeName )
{
throw new UnsupportedOperationException( "Cannot set alternativename on OrganisationUnit: " + alternativeName );
}
-
+
public Date getOpeningDate()
{
return openingDate;
@@ -556,15 +550,4 @@
{
this.type = type;
}
-
- public Integer getSortOrder()
- {
- return sortOrder;
- }
-
- public void setSortOrder( Integer sortOrder )
- {
- this.sortOrder = sortOrder;
- }
-
}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitCustomComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitCustomComparator.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/comparator/OrganisationUnitCustomComparator.java 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-package org.hisp.dhis.organisationunit.comparator;
-
-/*
- * 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.
- */
-import java.util.Comparator;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id$
- */
-public class OrganisationUnitCustomComparator
- implements Comparator<OrganisationUnit>
-{
-
- @Override
- public int compare( OrganisationUnit arg0, OrganisationUnit arg1 )
- {
- if ( arg0.getSortOrder() == null || arg1.getSortOrder() == null )
- {
- return 0;
- }
-
- return arg0.getSortOrder().compareTo( arg1.getSortOrder() );
- }
-
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2011-02-15 13:45:11 +0000
@@ -55,8 +55,6 @@
<key column="organisationunitid"/>
<many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid"/>
</set>
-
- <property name="sortOrder" column="sortorder"/>
<!-- Contact info -->
=== modified file 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/sortorder/DefaultSortOrderManager.java'
--- dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/sortorder/DefaultSortOrderManager.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/sortorder/DefaultSortOrderManager.java 2011-02-15 13:45:11 +0000
@@ -52,7 +52,6 @@
import org.hisp.dhis.indicator.comparator.IndicatorSortOrderComparator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitCodeComparator;
-import org.hisp.dhis.organisationunit.comparator.OrganisationUnitCustomComparator;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator;
import org.hisp.dhis.user.NoCurrentUserException;
@@ -93,7 +92,7 @@
organisationUnitComparators.put( SORT_ORDER_SHORTNAME, new OrganisationUnitShortNameComparator() );
organisationUnitComparators.put( SORT_ORDER_ALTERNATIVENAME, new OrganisationUnitNameComparator() ); // SIC
organisationUnitComparators.put( SORT_ORDER_CODE, new OrganisationUnitCodeComparator() );
- organisationUnitComparators.put( SORT_ORDER_CUSTOM, new OrganisationUnitCustomComparator() ); // SIC
+ organisationUnitComparators.put( SORT_ORDER_CUSTOM, new OrganisationUnitNameComparator() ); // SIC
dataSetComparators = new HashMap<String, Comparator<DataSet>>();
dataSetComparators.put( SORT_ORDER_NAME, new DataSetNameComparator() );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ExpandSubtreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ExpandSubtreeAction.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ExpandSubtreeAction.java 2011-02-15 13:45:11 +0000
@@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -38,6 +37,7 @@
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import com.opensymphony.xwork2.Action;
@@ -60,17 +60,6 @@
{
this.organisationUnitService = organisationUnitService;
}
-
- // -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
-
- private Comparator<OrganisationUnit> organisationUnitComparator;
-
- public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
- {
- this.organisationUnitComparator = organisationUnitComparator;
- }
// -------------------------------------------------------------------------
// Input
@@ -151,7 +140,7 @@
{
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( parent.getChildren() );
- Collections.sort( children, organisationUnitComparator );
+ Collections.sort( children, new OrganisationUnitNameComparator() );
return children;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/GetExpandedTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/GetExpandedTreeAction.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/GetExpandedTreeAction.java 2011-02-15 13:45:11 +0000
@@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -40,6 +39,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import com.opensymphony.xwork2.Action;
@@ -62,18 +62,7 @@
public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
{
this.selectionTreeManager = selectionTreeManager;
- }
-
- // -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
-
- private Comparator<OrganisationUnit> organisationUnitComparator;
-
- public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
- {
- this.organisationUnitComparator = organisationUnitComparator;
- }
+ }
// -------------------------------------------------------------------------
// Output
@@ -117,7 +106,7 @@
roots = new ArrayList<OrganisationUnit>( selectionTreeManager.getRootOrganisationUnits() );
- Collections.sort( roots, organisationUnitComparator );
+ Collections.sort( roots, new OrganisationUnitNameComparator() );
// ---------------------------------------------------------------------
// Get the units that need to be expanded in order for the selected
@@ -173,7 +162,7 @@
{
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( parent.getChildren() );
- Collections.sort( children, organisationUnitComparator );
+ Collections.sort( children, new OrganisationUnitNameComparator() );
return children;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java 2011-02-15 13:45:11 +0000
@@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -38,6 +37,7 @@
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.ouwt.manager.TreeStateManager;
import com.opensymphony.xwork2.Action;
@@ -68,17 +68,6 @@
{
this.treeStateManager = treeStateManager;
}
-
- // -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
-
- private Comparator<OrganisationUnit> organisationUnitComparator;
-
- public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
- {
- this.organisationUnitComparator = organisationUnitComparator;
- }
// -------------------------------------------------------------------------
// Input
@@ -165,7 +154,7 @@
{
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( parent.getChildren() );
- Collections.sort( children, organisationUnitComparator );
+ Collections.sort( children, new OrganisationUnitNameComparator() );
return children;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java 2011-02-15 13:45:11 +0000
@@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -38,6 +37,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.ouwt.manager.TreeStateManager;
@@ -71,17 +71,6 @@
}
// -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
-
- private Comparator<OrganisationUnit> organisationUnitComparator;
-
- public void setOrganisationUnitComparator( Comparator<OrganisationUnit> organisationUnitComparator )
- {
- this.organisationUnitComparator = organisationUnitComparator;
- }
-
- // -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -126,7 +115,7 @@
roots = new ArrayList<OrganisationUnit>( selectionManager.getRootOrganisationUnits() );
- Collections.sort( roots, organisationUnitComparator );
+ Collections.sort( roots, new OrganisationUnitNameComparator() );
// ---------------------------------------------------------------------
// Get the children of the roots
@@ -134,8 +123,7 @@
for ( OrganisationUnit root : roots )
{
- boolean hasChildren = root.getChildren().size() > 0; // Dirty
- // loading
+ boolean hasChildren = root.getChildren().size() > 0; // Dirty loading
LOG.debug( "OrganisationUnit " + root.getId() + " has children = " + hasChildren );
@@ -165,8 +153,7 @@
for ( OrganisationUnit child : children )
{
- boolean hasChildren = child.getChildren().size() > 0; // Dirty
- // loading
+ boolean hasChildren = child.getChildren().size() > 0; // Dirty loading
LOG.debug( "OrganisationUnit " + child.getId() + " has children = " + hasChildren );
@@ -181,7 +168,7 @@
{
List<OrganisationUnit> children = new ArrayList<OrganisationUnit>( parent.getChildren() );
- Collections.sort( children, organisationUnitComparator );
+ Collections.sort( children, new OrganisationUnitNameComparator() );
return children;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/interceptor/OrganisationUnitTreeInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/interceptor/OrganisationUnitTreeInterceptor.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/interceptor/OrganisationUnitTreeInterceptor.java 2011-02-15 13:45:11 +0000
@@ -37,8 +37,8 @@
import java.util.Set;
import org.hisp.dhis.interceptor.AbstractPreResultListener;
-import org.hisp.dhis.options.sortorder.SortOrderManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.ouwt.manager.TreeStateManager;
@@ -71,14 +71,7 @@
{
this.treeStateManager = treeStateManager;
}
-
- private SortOrderManager sortOrderManager;
- public void setSortOrderManager( SortOrderManager sortOrderManager )
- {
- this.sortOrderManager = sortOrderManager;
- }
-
// -------------------------------------------------------------------------
// PreResult implementation
// -------------------------------------------------------------------------
@@ -118,8 +111,7 @@
throws Exception
{
List<OrganisationUnit> childUnitsSorted = new ArrayList<OrganisationUnit>( childUnits );
-
- Collections.sort( childUnitsSorted, sortOrderManager.getCurrentOrganisationUnitSortOrderComparator() );
+ Collections.sort( childUnitsSorted, new OrganisationUnitNameComparator() );
List<TreeNode> childNodes = new ArrayList<TreeNode>();
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2011-02-15 13:45:11 +0000
@@ -122,9 +122,7 @@
</property>
<property name="treeStateManager">
<ref local="org.hisp.dhis.ouwt.manager.TreeStateManager" />
- </property>
- <property name="sortOrderManager"
- ref="org.hisp.dhis.options.sortorder.SortOrderManager" />
+ </property>
</bean>
<bean id="org.hisp.dhis.ouwt.action.ExpandSubtreeAction" class="org.hisp.dhis.ouwt.action.ExpandSubtreeAction"
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateCustomSortAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateCustomSortAction.java 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateCustomSortAction.java 1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-package org.hisp.dhis.oum.action.organisationunit;
-
-/*
- * 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.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id: UpdateCustomSortAction 2011-02-14
- */
-public class UpdateCustomSortAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private List<Integer> selectedList = new ArrayList<Integer>();
-
- public void setSelectedList( List<Integer> selectedList )
- {
- this.selectedList = selectedList;
- }
-
- @Override
- public String execute()
- throws Exception
- {
- for ( int i = 0; i < selectedList.size(); i++ )
- {
- OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( selectedList.get( i ) );
- organisationUnit.setSortOrder( i );
-
- organisationUnitService.updateOrganisationUnit( organisationUnit );
- }
- return SUCCESS;
- }
-
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2011-02-15 13:45:11 +0000
@@ -95,17 +95,6 @@
class="org.hisp.dhis.oum.action.organisationunit.PrepareAddOrganisationUnitAction"
scope="prototype">
</bean>
-
- <bean
- id="org.hisp.dhis.oum.action.organisationunit.UpdateCustomSortAction"
- class="org.hisp.dhis.oum.action.organisationunit.UpdateCustomSortAction"
- scope="prototype">
- <property name="organisationUnitService">
- <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- </property>
- </bean>
-
-
<!-- OrganisationUnitGroup -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2011-02-15 13:45:11 +0000
@@ -108,5 +108,4 @@
found = Found
all = All
please_select_from_tree = Please select from tree (optional)
-feature_type = Feature type
-sort_order = Sort Order
\ No newline at end of file
+feature_type = Feature type
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module_vi_VN.properties 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module_vi_VN.properties 2011-02-15 13:45:11 +0000
@@ -68,5 +68,4 @@
closed_date_cannot_be_before_opening_date=Ng\u00e0y \u0111\u00f3ng kh\u00f4ng th\u1ec3 tr\u01b0\u1edbc ng\u00e0y m\u1edf
adding_the_org_unit_group_failed=Th\u00eam m\u1edbi \u0111\u01a1n v\u1ecb kh\u00f4ng th\u00e0nh c\u00f4ng v\u1edbi l\u1ed7i sau
an_org_unit_cannot_be_moved_to_be_its_own_child=M\u1ed9t \u0111\u01a1n v\u1ecb kh\u00f4ng th\u1ec3 di chuy\u1ec3n \u0111\u1ebfn con c\u1ee7a ch\u00ednh n\u00f3. Xin ch\u1ecdn m\u1ed9t \u0111\u01a1n v\u1ecb cha m\u1edbi
-saving_the_org_unit_failed=L\u01b0u \u0111\u01a1n v\u1ecb kh\u00f4ng th\u00e0nh c\u00f4ng v\u1edbi l\u1ed7i sau
-sort_order=S\u1eafp x\u1ebfp
\ No newline at end of file
+saving_the_org_unit_failed=L\u01b0u \u0111\u01a1n v\u1ecb kh\u00f4ng th\u00e0nh c\u00f4ng v\u1edbi l\u1ed7i sau
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2011-02-15 13:45:11 +0000
@@ -93,24 +93,6 @@
<param name="onExceptionReturn">plainTextError</param>
<param name="requiredAuthorities">F_ORGANISATIONUNIT_DELETE</param>
</action>
-
- <action name="organisationUnitCustomSort"
- class="org.hisp.dhis.oum.action.organisationunit.GetOrganisationUnitListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-organisationunit/organisationUnitCustomSort.vm</param>
- <param name="menu">/dhis-web-maintenance-organisationunit/menuWithTree.vm</param>
- <param name="menuTreeHeight">328</param>
- <param name="javascripts">
- ../dhis-web-commons/ouwt/ouwt.js
- </param>
- <interceptor-ref name="organisationUnitTreeStack" />
- </action>
-
- <action name="updateCustomSort"
- class="org.hisp.dhis.oum.action.organisationunit.UpdateCustomSortAction">
- <result name="success" type="redirect">organisationUnit.action</result>
- </action>
-
<!-- OrganisationUnitGroup -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm 2011-02-15 13:45:11 +0000
@@ -7,10 +7,7 @@
<table width="100%">
<tr>
<td>#filterDiv( "organisationUnit" )</td>
- <td colspan="3" style="text-align:right">
- <input type="button" value="$i18n.getString( 'sort_order' )" onclick="window.location.href='organisationUnitCustomSort.action'"/>
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/>
- </td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/></td>
</tr>
</table>
<table class="listTable" id="listTable">
@@ -82,6 +79,6 @@
var no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'" )';
var confirm_to_delete_org_unit = '$encoder.jsEscape( $i18n.getString( "confirm_to_delete_org_unit" ) , "'" )';
jQuery(document).ready(function(){
- //tableSorter( 'listTable' );
+ tableSorter( 'listTable' );
});
</script>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitCustomSort.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitCustomSort.vm 2011-02-14 08:40:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitCustomSort.vm 1970-01-01 00:00:00 +0000
@@ -1,36 +0,0 @@
-<h3>$i18n.getString( "sort_order" )</h3>
-
-<form id="organisationUnitSort" action="updateCustomSort.action" method="POST" onsubmit="selectAllById('selectedList')">
-<p>
- <input type="button" value="$i18n.getString( 'move_up' )" style="width:130px" onclick="moveUpSelectedOption( 'selectedList' )"/><input
- type="button" value="$i18n.getString( 'move_down' )" style="width:130px" onclick="moveDownSelectedOption( 'selectedList' )"/><input
- type="button" value="$i18n.getString( 'move_to_top' )" style="width:130px" onclick="moveSelectedOptionToTop( 'selectedList' )"/><input
- type="button" value="$i18n.getString( 'move_to_bottom' )" style="width:130px" onclick="moveSelectedOptionToBottom( 'selectedList' )"/>
-</p>
-<p>
- <select size="25" id="selectedList" name="selectedList" multiple="multiple" size="25" style="width:680px">
- #foreach( $organisationUnit in $organisationUnits )
- <option value="$organisationUnit.id">$encoder.htmlEncode( $organisationUnit.name )</option>
- #end
- </select>
-</p>
-<p>
- <input type="submit" value="$i18n.getString( 'save' )" style="width:100px"/>
- <input type="button" value="$i18n.getString( 'cancel' )" style="width:100px" onclick="window.location.href='organisationUnit.action'"/>
-</p>
-</form>
-
-<script>
-
-// -----------------------------------------------------------------------------
-// Organisation unit selection listener
-// -----------------------------------------------------------------------------
-
-function organisationUnitSelected( orgUnitIds )
-{
- window.location.href = 'organisationUnitCustomSort.action';
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-</script>
-