← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16829: use new available/selected plugin in oug/ougs mgmt

 

------------------------------------------------------------
revno: 16829
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-26 17:43:08 +0700
message:
  use new available/selected plugin in oug/ougs mgmt
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm	2012-02-17 19:42:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm	2014-09-26 10:43:08 +0000
@@ -2,7 +2,7 @@
 { "dataSets": [
 #foreach( $dataSet in $dataSets )
   {
-    "id": $!{dataSet.id},
+    "id": "$!encoder.jsonEncode( ${dataSet.uid} )",
     "name": "$!encoder.jsonEncode( ${dataSet.displayName} )",
     "shortName": "$!encoder.jsonEncode( ${dataSet.displayShortName} )",
     "periodTypeId": "$!{dataSet.periodTypeId}",

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java	2014-09-26 10:43:08 +0000
@@ -28,9 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.List;
-
+import com.opensymphony.xwork2.ActionSupport;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -39,7 +37,9 @@
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import com.opensymphony.xwork2.ActionSupport;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -119,11 +119,11 @@
         this.jsonAttributeValues = jsonAttributeValues;
     }
 
-    private Collection<String> selectedDataSetsList;
+    private List<String> dsSelected = new ArrayList<>();
 
-    public void setSelectedDataSetsList( Collection<String> selectedDataSetsList )
+    public void setDsSelected( List<String> dsSelected )
     {
-        this.selectedDataSetsList = selectedDataSetsList;
+        this.dsSelected = dsSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -157,11 +157,11 @@
                 jsonAttributeValues, attributeService );
         }
 
-        if ( selectedDataSetsList != null )
+        if ( dsSelected != null )
         {
-            for ( String id : selectedDataSetsList )
+            for ( String id : dsSelected )
             {
-                organisationUnitGroup.addDataSet( dataSetService.getDataSet( Integer.parseInt( id ) ) );
+                organisationUnitGroup.addDataSet( dataSetService.getDataSet( id ) );
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java	2014-09-26 10:43:08 +0000
@@ -38,6 +38,7 @@
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.system.util.AttributeUtils;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -128,11 +129,11 @@
         this.jsonAttributeValues = jsonAttributeValues;
     }
 
-    private Collection<String> selectedDataSetsList;
+    private List<String> dsSelected = new ArrayList<>();
 
-    public void setSelectedDataSetsList( Collection<String> selectedDataSetsList )
+    public void setDsSelected( List<String> dsSelected )
     {
-        this.selectedDataSetsList = selectedDataSetsList;
+        this.dsSelected = dsSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -162,13 +163,13 @@
                 jsonAttributeValues, attributeService );
         }
 
-        if ( selectedDataSetsList != null )
+        if ( dsSelected != null )
         {
             Set<DataSet> dataSets = new HashSet<>();
 
-            for ( String id : selectedDataSetsList )
+            for ( String id : dsSelected )
             {
-                dataSets.add( dataSetService.getDataSet( Integer.parseInt( id ) ) );
+                dataSets.add( dataSetService.getDataSet( id ) );
             }
 
             organisationUnitGroup.updateDataSets( dataSets );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/AddGroupSetAction.java	2014-09-26 10:43:08 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -98,11 +99,11 @@
         this.dataDimension = dataDimension;
     }
 
-    private Collection<String> selectedGroups;
+    private List<String> ougSelected = new ArrayList<>();
 
-    public void setSelectedGroups( Collection<String> selectedGroups )
+    public void setOugSelected( List<String> ougSelected )
     {
-        this.selectedGroups = selectedGroups;
+        this.ougSelected = ougSelected;
     }
 
     private List<String> jsonAttributeValues;
@@ -123,11 +124,11 @@
 
         Set<OrganisationUnitGroup> selectedMembers = new HashSet<>();
 
-        if ( selectedGroups != null )
+        if ( ougSelected != null )
         {
-            for ( String groupId : selectedGroups )
+            for ( String groupId : ougSelected )
             {
-                selectedMembers.add( organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( groupId ) ) );
+                selectedMembers.add( organisationUnitGroupService.getOrganisationUnitGroup( groupId ) );
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/UpdateGroupSetAction.java	2014-09-26 10:43:08 +0000
@@ -28,19 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-
-import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.system.util.AttributeUtils;
 
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 /**
  * @author Lars Helge Overland
  */
@@ -104,11 +103,11 @@
         this.dataDimension = dataDimension;
     }
 
-    private Collection<String> selectedGroups;
+    private List<String> ougSelected = new ArrayList<>();
 
-    public void setSelectedGroups( Collection<String> selectedGroups )
+    public void setOugSelected( List<String> ougSelected )
     {
-        this.selectedGroups = selectedGroups;
+        this.ougSelected = ougSelected;
     }
 
     private List<String> jsonAttributeValues;
@@ -134,11 +133,11 @@
 
         Set<OrganisationUnitGroup> selectedMembers = new HashSet<>();
 
-        if ( selectedGroups != null )
+        if ( ougSelected != null )
         {
-            for ( String groupId : selectedGroups )
+            for ( String groupId : ougSelected )
             {
-                selectedMembers.add( organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( groupId ) ) );
+                selectedMembers.add( organisationUnitGroupService.getOrganisationUnitGroup( groupId ) );
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm	2014-01-19 06:27:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm	2014-09-26 10:43:08 +0000
@@ -7,24 +7,18 @@
     }, {
         'beforeValidateHandler' : function()
         {
-			jQuery( "#selectedDataSetsList" ).find( "option" ).attr( "selected", "selected" );
+            $("#dsSelected").find("option").attr("selected", "selected");
             #tblDynamicAttributesJavascript()
         },
         'rules' : getValidationRules( "organisationUnitGroup" )
     } );
-	
-	jQuery( "#availableDataSetsList" ).dhisAjaxSelect({
-		source: "../dhis-web-commons-ajax-json/getDataSets.action",
-		iterator: "dataSets",
-		connectedTo: "selectedDataSetsList",
-		handler: function( item ) {
-			var option = jQuery( "<option />" );
-			option.text( item.name );
-			option.attr( "value", item.id );
-			
-			return option;
-		}
-	});
+
+    $('#dsAvailable').selected({
+        url: '../dhis-web-commons-ajax-json/getDataSets.action',
+        target: $('#dsSelected'),
+        search: $('#dsAvailableSearch'),
+        iterator: 'dataSets'
+    });
 
     checkValueIsExist( "name", "validateOrganisationUnitGroup.action" );
 	checkValueIsExist( "shortName", "validateOrganisationUnitGroup.action" );
@@ -74,36 +68,11 @@
 	</tr>
 </table>
 
-<table id="dataSetSelectionArea">
-	<colgroup>
-		<col style="width: 500px;"/>
-		<col/>
-		<col style="width: 500px;"/>
-	</colgroup>
-	<thead>
-	<tr>
-		<th>$i18n.getString( "available_data_sets" )</th>
-		<th>$i18n.getString( "filter" )</th>
-		<th>$i18n.getString( "selected_data_sets" )</th>
-	</tr>
-	</thead>
-	<tbody>
-		<tr>
-			<td>
-				<select id="availableDataSetsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
-			</td>
-			<td style="text-align:center">
-				<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataSetsList' );"/><br/>
-				<input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataSetsList' );"/><br/>
-				<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataSetsList' );"/><br/>
-				<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataSetsList' );"/>
-			</td>
-			<td>
-				<select id="selectedDataSetsList" name="selectedDataSetsList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 24px;"></select>
-			</td>
-		</tr>
-	</tbody>
-</table>
+#jqSelected({
+  "prefix": "ds",
+  "i18n_available": "available_data_sets",
+  "i18n_selected": "selected_data_sets"
+})
 
 <p>
 	<input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm	2014-03-25 07:54:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm	2014-09-26 10:43:08 +0000
@@ -1,10 +1,10 @@
 <script type="text/javascript">
-	jQuery(function() {
+    jQuery(document).ready(function() {
         validation2('addOrganisationUnitGroupSetForm', function(form) {
      	    form.submit();
      	}, {
      		'beforeValidateHandler' : function() {
-     			selectAllById('selectedGroups');
+                $("#ougSelected").find("option").attr("selected", "selected");
                 #tblDynamicAttributesJavascript()
      		},
      		'rules' : getValidationRules("organisationUnitGroupSet")
@@ -14,21 +14,12 @@
 
      	changeCompulsory(getFieldValue('compulsory'));
 
-		jQuery("#availableGroups").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getOrganisationUnitGroups.action",
-			iterator: "organisationUnitGroups",
-			connectedTo: 'selectedGroups',
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			},
-			params: {
-				filterNoGroupSet: true
-			}
-		});
+        $('#ougAvailable').selected({
+          url: '../api/organisationUnitGroups.json?filter=organisationUnitGroupSet:null',
+          target: $('#ougSelected'),
+          search: $('#ougAvailableSearch'),
+          iterator: 'organisationUnitGroups'
+        });
 	});
 </script>
 
@@ -80,36 +71,11 @@
 
 #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-	
-  	<tr>
-  		<th>$i18n.getString( "available_groups" )</th>
-  		<th></th>
-  		<th>$i18n.getString( "selected_groups" )</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableGroups" name="availableGroups" multiple="multiple" style="height: 200px; width: 100%;"></select>
-		</td>
-
-		<td style="text-align:center">
-        	<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableGroups' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedGroups' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableGroups' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedGroups' );"/>
-		</td>
-
-		<td>
-			<select id="selectedGroups" name="selectedGroups" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "oug",
+  "i18n_available": "available_groups",
+  "i18n_selected": "selected_groups"
+})
 
 <p>
 	<input type="submit" name="save" value="$i18n.getString( 'add' )" style="width:10em" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js	2014-06-13 08:01:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js	2014-09-26 10:43:08 +0000
@@ -39,25 +39,25 @@
 function changeCompulsory( value )
 {
 	if( value == 'true' ){
-		addValidatorRulesById( 'selectedGroups', {required:true} );
+		addValidatorRulesById( 'ougSelected', {required:true} );
 	}else{
-		removeValidatorRulesById( 'selectedGroups' );
+		removeValidatorRulesById( 'ougSelected' );
 	}
 }
 
 function validateAddOrganisationGroupSet( form )
 {
 	var url = "validateOrganisationUnitGroupSet.action?";
-		url += getParamString( 'selectedGroups', 'selectedGroups' );
+		url += getParamString( 'ougSelected', 'selectedGroups' );
 
 	jQuery.postJSON( url, function( json )
 	{
 		if( json.response == 'success' ){
-			markValid( 'selectedGroups' );
-			selectAllById( 'selectedGroups' );
+			markValid( 'ougSelected' );
+			selectAllById( 'ougSelected' );
 			form.submit();
 		}else{
-			markInvalid( 'selectedGroups', json.message );				
+			markInvalid( 'ougSelected', json.message );
 		}
 	});		
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm	2014-01-19 06:27:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm	2014-09-26 10:43:08 +0000
@@ -6,24 +6,18 @@
         }, {
             'beforeValidateHandler' : function()
             {
-				jQuery( "#selectedDataSetsList" ).find( "option" ).attr( "selected", "selected" );
+                $("#dsSelected").find("option").attr("selected", "selected");
                 #tblDynamicAttributesJavascript()
             },
             'rules' : getValidationRules( "organisationUnitGroup" )
         } );
 
-		jQuery( "#availableDataSetsList" ).dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataSets.action",
-			iterator: "dataSets",
-			connectedTo: "selectedDataSetsList",
-			handler: function( item ) {
-				var option = jQuery( "<option />" );
-				option.text( item.name );
-				option.attr( "value", item.id );
-				
-				return option;
-			}
-		});
+        $('#dsAvailable').selected({
+            url: '../dhis-web-commons-ajax-json/getDataSets.action',
+            target: $('#dsSelected'),
+            search: $('#dsAvailableSearch'),
+            iterator: 'dataSets'
+        });
 		
 		checkValueIsExist( "name", "validateOrganisationUnitGroup.action", {id:$!organisationUnitGroup.id} );
 		checkValueIsExist( "shortName", "validateOrganisationUnitGroup.action", {id:$!organisationUnitGroup.id} );
@@ -76,40 +70,12 @@
     </tr>
 </table>
 
-<table id="dataSetSelectionArea">
-	<colgroup>
-		<col style="width: 500px;"/>
-		<col/>
-		<col style="width: 500px;"/>
-	</colgroup>
-	<thead>
-	<tr>
-		<th>$i18n.getString( "available_data_sets" )</th>
-		<th>$i18n.getString( "filter" )</th>
-		<th>$i18n.getString( "selected_data_sets" )</th>
-	</tr>
-	</thead>
-	<tbody>
-		<tr>
-			<td>
-				<select id="availableDataSetsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
-			</td>
-			<td>
-				<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataSetsList' );"/><br/>
-				<input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataSetsList' );"/><br/>
-				<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataSetsList' );"/><br/>
-				<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataSetsList' );"/>
-			</td>			
-			<td>
-				<select id="selectedDataSetsList" name="selectedDataSetsList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 24px;">
-				#foreach( $dataSet in $organisationUnitGroup.dataSets )
-					<option value="$dataSet.id">$!encoder.htmlEncode( $dataSet.displayName )</option>
-				#end
-				</select>
-			</td>
-		</tr>
-	</tbody>
-</table>
+#jqSelected({
+  "prefix": "ds",
+  "i18n_available": "available_data_sets",
+  "i18n_selected": "selected_data_sets",
+  "objects": $organisationUnitGroup.dataSets
+})
 
 <p>
     <input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm	2014-01-19 06:27:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm	2014-09-26 10:43:08 +0000
@@ -1,10 +1,10 @@
 <script type="text/javascript">
-	jQuery(function() {
+    jQuery(document).ready(function() {
         validation2('updateOrganisationUnitGroupSetForm', function(form) {
      	    form.submit();
      	}, {
      		'beforeValidateHandler' : function() {
-     			selectAllById('selectedGroups');
+                $("#ougSelected").find("option").attr("selected", "selected");
                 #tblDynamicAttributesJavascript()
      		},
      		'rules' : getValidationRules("organisationUnitGroupSet")
@@ -12,21 +12,12 @@
 
      	changeCompulsory(getFieldValue('compulsory'));
 
-		jQuery("#availableGroups").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getOrganisationUnitGroups.action",
-			iterator: "organisationUnitGroups",
-			connectedTo: 'selectedGroups',
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			},
-			params: {
-				filterNoGroupSet: true
-			}
-		});
+        $('#ougAvailable').selected({
+          url: '../api/organisationUnitGroups.json?filter=organisationUnitGroupSet:null',
+          target: $('#ougSelected'),
+          search: $('#ougAvailableSearch'),
+          iterator: 'organisationUnitGroups'
+        });
 
 		checkValueIsExist("name", "validateOrganisationUnitGroupSet.action", {
 			id : $organisationUnitGroupSet.id
@@ -84,40 +75,12 @@
 
 #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-	
-  	<tr>
-  		<th>$i18n.getString( "available_groups" )</th>
-  		<th></th>
-  		<th>$i18n.getString( "selected_groups" )</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableGroups" name="availableGroups" multiple="multiple" style="height: 200px; width: 100%;"></select>
-		</td>
-
-		<td style="text-align:center">
-        	<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableGroups' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedGroups' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableGroups' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedGroups' );"/>
-		</td>
-
-		<td>
-			<select id="selectedGroups" name="selectedGroups" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
-				#foreach ( $group in $selectedGroups )
-    				<option value="$group.id">$group.displayName</option>
-    			#end
-			</select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "oug",
+  "i18n_available": "available_groups",
+  "i18n_selected": "selected_groups",
+  "objects": $selectedGroups
+})
 
 <p>
 	<input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>