← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13190: use uids in oust, wip

 

------------------------------------------------------------
revno: 13190
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-10 12:48:42 +0100
message:
  use uids in oust, wip
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/AddSelectedOrganisationUnitAction.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/RemoveSelectedOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SelectAllOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SetSelectedOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/AddLockExceptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js	2013-11-06 10:41:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js	2013-12-10 11:48:42 +0000
@@ -16,43 +16,37 @@
 
 function SelectionTreeSelection()
 {
-    var onSelectFunction = undefined;
-
-    var listenerFunction = undefined;
-
-    var multipleSelectionAllowed = true;
-
-    this.setOnSelectFunction = function( onSelectFunction_ )
-    {
-        onSelectFunction = onSelectFunction_;
-    };
-
-    this.setListenerFunction = function( listenerFunction_ )
-    {
-        listenerFunction = listenerFunction_;
-    };
-
-    this.setMultipleSelectionAllowed = function( allowed )
-    {
-        multipleSelectionAllowed = allowed;
-    };
-	
-	this.getSelected = function()
-	{
-		return selectedOrganisationUnit;
-	};
-	
-	this.getSelectedUid = function()
-	{
-		return selectedOrganisationUnitUid;
-	}
-	
-	this.isSelected = function()
-	{
-		return selectedOrganisationUnit && selectedOrganisationUnit.length > 0;
-	}
-
-    this.select = function( unitId )
+  var onSelectFunction = undefined;
+
+  var listenerFunction = undefined;
+
+  var multipleSelectionAllowed = true;
+
+  this.setOnSelectFunction = function( onSelectFunction_ ) {
+    onSelectFunction = onSelectFunction_;
+  };
+
+  this.setListenerFunction = function( listenerFunction_ ) {
+    listenerFunction = listenerFunction_;
+  };
+
+  this.setMultipleSelectionAllowed = function( allowed ) {
+    multipleSelectionAllowed = allowed;
+  };
+
+  this.getSelected = function() {
+    return selectedOrganisationUnit;
+  };
+
+  this.getSelectedUid = function() {
+    return selectedOrganisationUnitUid;
+  }
+
+  this.isSelected = function() {
+    return selectedOrganisationUnit && selectedOrganisationUnit.length > 0;
+  }
+
+  this.select = function( unitId )
     {
        if ( onSelectFunction )
         {
@@ -99,27 +93,25 @@
 
     function responseReceived( json )
     {
-		selectedOrganisationUnit = new Array();
-		selectedOrganisationUnitUid = new Array();
-
-		var unitIds = new Array();
-		var unitUids = new Array();
-
-        for ( i in json.selectedUnits )
-        {
-            unitIds[i] = json.selectedUnits[i].id;
-			selectedOrganisationUnit.push( unitIds[i] );
-			
-			unitUids[i] = json.selectedUnits[i].uid;
-			selectedOrganisationUnitUid.push( unitUids[i] );
-        }
-
-        jQuery( 'body' ).trigger( 'oust.selected', selectedOrganisationUnit );
-        
-        if ( listenerFunction )
-        {
-        	listenerFunction( unitIds );
-        }
+      selectedOrganisationUnit = [];
+      selectedOrganisationUnitUid = [];
+
+      var unitIds = [];
+      var unitUids = [];
+
+      for( i in json.selectedUnits ) {
+        unitIds[i] = json.selectedUnits[i].id;
+        selectedOrganisationUnit.push(unitIds[i]);
+
+        unitUids[i] = json.selectedUnits[i].uid;
+        selectedOrganisationUnitUid.push(unitUids[i]);
+      }
+
+      jQuery('body').trigger('oust.selected', selectedOrganisationUnit);
+
+      if( listenerFunction ) {
+        listenerFunction(unitIds);
+      }
     }
 
     function getTagId( unitId )
@@ -270,7 +262,7 @@
 
         if ( hasChildren )
         {
-            toggleTag.onclick = new Function( 'selectionTree.toggle( ' + childId + ' )' );
+            toggleTag.onclick = new Function( 'selectionTree.toggle( \"' + childId + '\" )' );
             toggleTag.appendChild( getToggleExpand() );
         }
         else
@@ -279,7 +271,7 @@
         }
 
         var linkTag = document.createElement( 'a' );
-        linkTag.href = 'javascript:void selectionTreeSelection.select( ' + childId + ' )';
+        linkTag.href = 'javascript:void selectionTreeSelection.select( \"' + childId + '\" )';
         linkTag.appendChild( document.createTextNode( child.firstChild.nodeValue ));
 
         if ( child.getAttribute( 'selected' ) == 'true' )

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm	2013-12-09 21:32:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm	2013-12-10 11:48:42 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <units>
 #foreach( $unit in $collapsedUnits )
-	<unit uid="$encoder.xmlEncode( $unit.uid )">$unit.id</unit>
+	<unit>$encoder.xmlEncode( $unit.uid )</unit>
 #end
 </units>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm	2010-04-27 07:20:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm	2013-12-10 11:48:42 +0000
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<message type="error">$encoder.xmlEncode( $message )</message>
+<message type="error">$encoder.xmlEncode( $!message )</message>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm	2013-12-09 21:32:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm	2013-12-10 11:48:42 +0000
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <units>
 #foreach( $parent in $parents )
-	<parent parentId="$parent.id">
+	<parent parentId="$encoder.xmlEncode( $parent.uid )">
 	#foreach( $child in $childrenMap.get( $parent ) )
-  		<child id="$child.id" uid="$encoder.xmlEncode( $child.uid )" hasChildren="$child.children.size()">$encoder.xmlEncode( $child.name )</child>
+  		<child id="$encoder.xmlEncode( $child.uid )" hasChildren="$child.children.size()">$encoder.xmlEncode( $child.name )</child>
   	#end
   	</parent>
 #end

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm	2010-04-27 07:20:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm	2013-12-10 11:48:42 +0000
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<message type="success">$encoder.xmlEncode( $message )</message>
+<message type="success">$encoder.xmlEncode( $!message )</message>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm	2013-12-09 21:32:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm	2013-12-10 11:48:42 +0000
@@ -2,17 +2,17 @@
 <units>
 	<roots>
 	#foreach( $root in $roots )
-		<unit id="${root.id}" uid="${root.uid}" #if( $selected.contains( $root )) selected="true" #end>$encoder.xmlEncode( $root.name )</unit>
+		<unit id="$encoder.xmlEncode( $root.uid )" #if( $selected.contains( $root )) selected="true" #end>$encoder.xmlEncode( $root.name )</unit>
 	#end
 	</roots>
 
 	<children>
 	#foreach( $parent in $parents )
-		<parent parentId="$parent.id">
+  <parent parentId="$encoder.xmlEncode( $parent.uid )">
 		#foreach( $child in $childrenMap.get( $parent ) )
-  			<child id="${child.id}" uid="${child.uid}" hasChildren="$child.children.size()" #if( $selected.contains( $child )) selected="true" #end>$encoder.xmlEncode( $child.name )</child>
+    <child id="$encoder.xmlEncode( $child.uid )" hasChildren="$child.children.size()" #if( $selected.contains( $child )) selected="true" #end>$encoder.xmlEncode( $child.name )</child>
 		#end
-  		</parent>
+  </parent>
 	#end
 	</children>
 </units>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/AddSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/AddSelectedOrganisationUnitAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/AddSelectedOrganisationUnitAction.java	2013-12-10 11:48:42 +0000
@@ -28,15 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.HashSet;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
+import java.util.HashSet;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -75,9 +74,9 @@
     // Input/output
     // -------------------------------------------------------------------------
 
-    private Integer id;
+    private String id;
 
-    public void setId( Integer organisationUnitId )
+    public void setId( String organisationUnitId )
     {
         this.id = organisationUnitId;
     }

=== 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	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ExpandSubtreeAction.java	2013-12-10 11:48:42 +0000
@@ -28,16 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-
-import com.opensymphony.xwork2.Action;
-
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: ExpandSubtreeAction.java 2869 2007-02-20 14:26:09Z andegje $
@@ -60,9 +59,9 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private int parentId;
+    private String parentId;
 
-    public void setParentId( int organisationUnitId )
+    public void setParentId( String organisationUnitId )
     {
         this.parentId = organisationUnitId;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/RemoveSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/RemoveSelectedOrganisationUnitAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/RemoveSelectedOrganisationUnitAction.java	2013-12-10 11:48:42 +0000
@@ -28,21 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: RemoveSelectedOrganisationUnitAction.java 2869 2007-02-20
- *          14:26:09Z andegje $
  */
 public class RemoveSelectedOrganisationUnitAction
     implements Action
@@ -76,9 +73,9 @@
     // Input/output
     // -------------------------------------------------------------------------
 
-    private Integer id;
+    private String id;
 
-    public void setId( Integer organisationUnitId )
+    public void setId( String organisationUnitId )
     {
         this.id = organisationUnitId;
     }
@@ -138,13 +135,11 @@
 
         if ( organisationUnitGroupId != null )
         {
-            selectedUnits.removeAll( organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroupId )
-                .getMembers() );
+            selectedUnits.removeAll( organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroupId ).getMembers() );
         }
 
         if ( children != null && children == true )
         {
-
             Set<OrganisationUnit> selectedOrganisationUnits = new HashSet<OrganisationUnit>( selectedUnits );
 
             for ( OrganisationUnit selected : selectedOrganisationUnits )

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SelectAllOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SelectAllOrganisationUnitAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SelectAllOrganisationUnitAction.java	2013-12-10 11:48:42 +0000
@@ -1,12 +1,11 @@
 package org.hisp.dhis.oust.action;
 
-import java.util.Collection;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
 
 /*
  * Copyright (c) 2004-2013, University of Oslo
@@ -38,7 +37,6 @@
 
 /**
  * @author Tran Thanh Tri
- * @version $Id: SelectAllOrganisationUnitAction
  */
 public class SelectAllOrganisationUnitAction
     implements Action

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SetSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SetSelectedOrganisationUnitAction.java	2013-08-28 12:33:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/SetSelectedOrganisationUnitAction.java	2013-12-10 11:48:42 +0000
@@ -38,7 +38,6 @@
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: SetSelectedOrganisationUnitAction.java 2869 2007-02-20 14:26:09Z andegje $
  */
 public class SetSelectedOrganisationUnitAction
     implements Action
@@ -65,9 +64,9 @@
     // Input/output
     // -------------------------------------------------------------------------
 
-    private Integer id;
+    private String id;
 
-    public void setId( Integer organisationUnitId )
+    public void setId( String organisationUnitId )
     {
         this.id = organisationUnitId;
     }
@@ -86,7 +85,7 @@
     public String execute()
         throws Exception
     {
-        if ( id == 0 )
+        if ( id == null )
         {
             selectionTreeManager.clearSelectedOrganisationUnits();
             return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/AddLockExceptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/AddLockExceptionAction.java	2013-09-27 13:45:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/AddLockExceptionAction.java	2013-12-10 11:48:42 +0000
@@ -120,7 +120,7 @@
 
         for ( String id : organisationUnitId.split( "," ) )
         {
-            OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( id ) );
+            OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id );
 
             if ( organisationUnit == null )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java	2013-12-10 11:48:42 +0000
@@ -29,7 +29,6 @@
  */
 
 import com.opensymphony.xwork2.Action;
-
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -95,7 +94,7 @@
         dataSets = getDataSetsForCurrentUser( id );
 
         Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
-        
+
         return SUCCESS;
     }
 
@@ -110,7 +109,7 @@
 
         for ( String id : ids.split( "," ) )
         {
-            OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( id ) );
+            OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id );
 
             if ( organisationUnit == null )
             {