← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16824: use new available/selected plugin in cog/cogs mgmt

 

------------------------------------------------------------
revno: 16824
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-26 13:23:19 +0700
message:
  use new available/selected plugin in cog/cogs mgmt
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowUpdateCategoryOptionGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.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-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java	2014-09-26 06:23:19 +0000
@@ -28,19 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashSet;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ AddCategoryOptionGroupAction.java Feb 12, 2014 11:20:01 PM $
  */
 public class AddCategoryOptionGroupAction
     implements Action
@@ -77,11 +74,11 @@
         this.code = code;
     }
 
-    private Set<String> groupMembers = new HashSet<>();
+    private Set<String> coSelected = new HashSet<>();
 
-    public void setGroupMembers( Set<String> groupMembers )
+    public void setCoSelected( Set<String> coSelected )
     {
-        this.groupMembers = groupMembers;
+        this.coSelected = coSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -96,10 +93,9 @@
         categoryOptionGroup.setShortName( shortName );
         categoryOptionGroup.setCode( code );
 
-        for ( String id : groupMembers )
+        for ( String id : coSelected )
         {
-            categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( 
-                Integer.parseInt( id ) ) );
+            categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( id ) );
         }
 
         dataElementCategoryService.saveCategoryOptionGroup( categoryOptionGroup );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java	2014-09-26 06:23:19 +0000
@@ -28,21 +28,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ ShowUpdateCategoryOptionGroupAction.java Feb 12, 2014 11:20:01 PM
- *          $
  */
 public class ShowUpdateCategoryOptionGroupAction
     implements Action
@@ -79,13 +75,6 @@
         return categoryOptions;
     }
 
-    private List<DataElementCategoryOption> groupMembers;
-
-    public List<DataElementCategoryOption> getGroupMembers()
-    {
-        return groupMembers;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -96,7 +85,7 @@
     {
         categoryOptionGroup = dataElementCategoryService.getCategoryOptionGroup( id );
 
-        groupMembers = new ArrayList<>( categoryOptionGroup.getMembers() );
+        categoryOptions = new ArrayList<>( categoryOptionGroup.getMembers() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/UpdateCategoryOptionGroupAction.java	2014-09-26 06:23:19 +0000
@@ -28,19 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashSet;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ UpdateCategoryOptionGroupAction.java Feb 12, 2014 11:25:01 PM $
  */
 public class UpdateCategoryOptionGroupAction
     implements Action
@@ -84,11 +81,11 @@
         this.code = code;
     }
 
-    private Set<String> groupMembers = new HashSet<>();
+    private Set<String> coSelected = new HashSet<>();
 
-    public void setGroupMembers( Set<String> groupMembers )
+    public void setCoSelected( Set<String> coSelected )
     {
-        this.groupMembers = groupMembers;
+        this.coSelected = coSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -105,10 +102,9 @@
         categoryOptionGroup.setCode( code );
         categoryOptionGroup.getMembers().clear();
 
-        for ( String id : groupMembers )
+        for ( String id : coSelected )
         {
-            categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( 
-                Integer.parseInt( id ) ) );
+            categoryOptionGroup.addCategoryOption( dataElementCategoryService.getDataElementCategoryOption( id ) );
         }
 
         dataElementCategoryService.updateCategoryOptionGroup( categoryOptionGroup );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java	2014-09-26 06:23:19 +0000
@@ -28,20 +28,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ AddCategoryOptionGroupSetAction.java Feb 12, 2014 11:20:01 PM $
  */
 public class AddCategoryOptionGroupSetAction
     implements Action
@@ -78,11 +77,11 @@
         this.dataDimension = dataDimension;
     }
 
-    private List<String> groupMembers = new ArrayList<>();
+    private Set<String> cogSelected = new HashSet<>();
 
-    public void setGroupMembers( List<String> groupMembers )
+    public void setCogSelected( Set<String> cogSelected )
     {
-        this.groupMembers = groupMembers;
+        this.cogSelected = cogSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -98,14 +97,12 @@
         categoryOptionGroupSet.setDataDimension( dataDimension );
 
         List<CategoryOptionGroup> members = new ArrayList<>();
-        
-        for ( String id : groupMembers )
+
+        for ( String id : cogSelected )
         {
-            CategoryOptionGroup group = dataElementCategoryService.getCategoryOptionGroup( Integer.parseInt( id ) );
-            
-            members.add( group );
+            members.add( dataElementCategoryService.getCategoryOptionGroup( id ) );
         }
-        
+
         categoryOptionGroupSet.setMembers( members );
 
         dataElementCategoryService.saveCategoryOptionGroupSet( categoryOptionGroupSet );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowUpdateCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowUpdateCategoryOptionGroupSetAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowUpdateCategoryOptionGroupSetAction.java	2014-09-26 06:23:19 +0000
@@ -28,15 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Chau Thu Tran
@@ -71,18 +70,11 @@
 
     private List<CategoryOptionGroup> categoryOptionGroups;
 
-    public List<CategoryOptionGroup> getCategoryOptions()
+    public List<CategoryOptionGroup> getCategoryOptionGroups()
     {
         return categoryOptionGroups;
     }
 
-    private List<CategoryOptionGroup> groupMembers;
-
-    public List<CategoryOptionGroup> getGroupMembers()
-    {
-        return groupMembers;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -93,7 +85,7 @@
     {
         categoryOptionGroupSet = dataElementCategoryService.getCategoryOptionGroupSet( id );
 
-        groupMembers = new ArrayList<>( categoryOptionGroupSet.getMembers() );
+        categoryOptionGroups = new ArrayList<>( categoryOptionGroupSet.getMembers() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/UpdateCategoryOptionGroupSetAction.java	2014-09-26 06:23:19 +0000
@@ -28,20 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.CategoryOptionGroup;
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ UpdateCategoryOptionGroupSetAction.java Feb 12, 2014 11:25:01 PM $
  */
 public class UpdateCategoryOptionGroupSetAction
     implements Action
@@ -85,11 +81,11 @@
         this.dataDimension = dataDimension;
     }
 
-    private List<String> groupMembers = new ArrayList<>();
+    private Set<String> cogSelected = new HashSet<>();
 
-    public void setGroupMembers( List<String> groupMembers )
+    public void setCogSelected( Set<String> cogSelected )
     {
-        this.groupMembers = groupMembers;
+        this.cogSelected = cogSelected;
     }
 
     // -------------------------------------------------------------------------
@@ -105,12 +101,10 @@
         categoryOptionGroupSet.setDescription( description );
         categoryOptionGroupSet.setDataDimension( dataDimension );
         categoryOptionGroupSet.getMembers().clear();
-        
-        for ( String id : groupMembers )
+
+        for ( String id : cogSelected )
         {
-            CategoryOptionGroup group = dataElementCategoryService.getCategoryOptionGroup( Integer.parseInt( id ) );
-            
-            categoryOptionGroupSet.getMembers().add( group );
+            categoryOptionGroupSet.getMembers().add( dataElementCategoryService.getCategoryOptionGroup( id ) );
         }
 
         dataElementCategoryService.updateCategoryOptionGroupSet( categoryOptionGroupSet );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2014-09-24 07:43:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2014-09-26 06:23:19 +0000
@@ -230,6 +230,7 @@
 create_new_category_option_group_set = Create new category option group set
 edit_category_option_group_set = Edit category option group set
 available_category_option_groups = Available category option groups
+selected_category_option_groups = Selected category option groups
 confirm_delete_category_option_group_set = Are you sure you want to delete this category option group set?
 show_more_options=Show more options
 show_fewer_options=Show fewer options

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm	2014-02-13 12:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm	2014-09-26 06:23:19 +0000
@@ -3,8 +3,8 @@
         validation('addCategoryOptionGroupForm', function ( form ) {
             form.submit();
         },function(){
-			selectAllById('groupMembers');
-			if(jQuery("#groupMembers option").length > 0 ){
+            $("#coSelected").find("option").attr("selected", "selected");
+			if(jQuery("#coSelected option").length > 0 ){
 				setFieldValue('hasOptions', 'true');
 			}
 		});
@@ -13,18 +13,12 @@
 		checkValueIsExist( "shortName", "validateCategoryOptionGroup.action" );
 	    checkValueIsExist( "code", "validateCategoryOptionGroup.action" );
 		
-		jQuery("#availableCategoryOptionsList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElementCategoryOptions.action",
-			iterator: "dataElementCategoryOptions",
-			connectedTo: 'groupMembers',
-			handler: function(item) {
-				var option = jQuery("<option data-id='" + item.groups + "' />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			}
-		});
+        $('#coAvailable').selected({
+          url: '../api/categoryOptions.json',
+          target: $('#coSelected'),
+          search: $('#coAvailableSearch'),
+          iterator: 'categoryOptions'
+        });
 	});
 </script>
 
@@ -51,38 +45,11 @@
 	</tr>
 </table>
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-
-	<tr>
-		<th>$i18n.getString( "available_category_options" )</th>
-		<th></th>
-		<th>$i18n.getString( "group_members" )
-			<input type='hidden' id='hasOptions' name='hasOptions' class="{validate:{required:true}}">
-		</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableCategoryOptionsList" name="availableCategoryOptionsList" 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( 'availableCategoryOptionsList' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableCategoryOptionsList' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
-		</td>
-
-		<td>
-			<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "co",
+  "i18n_available": "available_category_options",
+  "i18n_selected": "selected_category_options"
+})
 
 <p>
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm	2014-02-13 15:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm	2014-09-26 06:23:19 +0000
@@ -3,26 +3,20 @@
         validation('addCategoryOptionGroupSetForm', function ( form ) {
             form.submit();
         },function(){
-			selectAllById('groupMembers');
-			if(jQuery("#groupMembers option").length > 0 ){
+            $("#cogSelected").find("option").attr("selected", "selected");
+			if(jQuery("#cogSelected option").length > 0 ){
 				setFieldValue('hasOptions', 'true');
 			}
 		});
 
         checkValueIsExist("name", "validateCategoryOptionGroupSet.action");
 		
-		jQuery("#availableCategoryOptionsList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getCategoryOptionGroups.action",
-			iterator: "categoryOptionGroups",
-			connectedTo: 'groupMembers',
-			handler: function(item) {
-				var option = jQuery("<option data-id='" + item.groups + "' />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			}
-		});
+        $('#cogAvailable').selected({
+          url: '../api/categoryOptionGroups.json',
+          target: $('#cogSelected'),
+          search: $('#cogAvailableSearch'),
+          iterator: 'categoryOptionGroups'
+        });
 	});
 </script>
 
@@ -54,38 +48,11 @@
 	</tr>
 </table>
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-
-	<tr>
-		<th>$i18n.getString( "available_category_option_groups" )</th>
-		<th></th>
-		<th>$i18n.getString( "group_members" )
-			<input type='hidden' id='hasOptions' name='hasOptions' class="{validate:{required:true}}">
-		</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableCategoryOptionsList" name="availableCategoryOptionsList" 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( 'availableCategoryOptionsList' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableCategoryOptionsList' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
-		</td>
-
-		<td>
-			<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "cog",
+  "i18n_available": "available_category_option_groups",
+  "i18n_selected": "selected_category_option_groups"
+})
 
 <p>
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm	2014-02-13 12:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm	2014-09-26 06:23:19 +0000
@@ -4,8 +4,8 @@
         {
             form.submit();
         },function(){
-			selectAllById('groupMembers');
-			if(jQuery("#groupMembers option").length > 0 ){
+            $("#coSelected").find("option").attr("selected", "selected");
+			if(jQuery("#coSelected option").length > 0 ){
 				setFieldValue('hasOptions', 'true');
 			}
 		});
@@ -22,18 +22,12 @@
             id : getFieldValue( 'id' )
         } );
 
-		jQuery("#availableCategoryOptionsList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElementCategoryOptions.action",
-			iterator: "dataElementCategoryOptions",
-			connectedTo: 'groupMembers',
-			handler: function(item) {
-				var option = jQuery("<option data-id='" + item.groups + "' />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			}
-		});
+        $('#coAvailable').selected({
+          url: '../api/categoryOptions.json',
+          target: $('#coSelected'),
+          search: $('#coAvailableSearch'),
+          iterator: 'categoryOptions'
+        });
 	});
 </script>
 
@@ -65,42 +59,12 @@
 	</tr>
 </table>
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-
-	<tr>
-		<th>$i18n.getString( "available_category_options" )</th>
-		<th></th>
-		<th>$i18n.getString( "group_members" )
-			<input type='hidden' id='hasOptions' name='hasOptions' class="{validate:{required:true}}">
-		</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableCategoryOptionsList" name="availableCategoryOptionsList" 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( 'availableCategoryOptionsList' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableCategoryOptionsList' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
-        </td>
-
-		<td>
-			<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
-				#foreach( $categoryOption in $groupMembers )
-					<option value="$categoryOption.id">$encoder.htmlEncode( $categoryOption.displayName )</option>
-				#end
-			</select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "co",
+  "i18n_available": "available_category_options",
+  "i18n_selected": "selected_category_options",
+  "objects": $categoryOptions
+})
 
 <p>
 	<input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm	2014-02-13 15:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm	2014-09-26 06:23:19 +0000
@@ -4,8 +4,8 @@
         {
             form.submit();
         },function(){
-			selectAllById('groupMembers');
-			if(jQuery("#groupMembers option").length > 0 ){
+            $("#cogSelected").find("option").attr("selected", "selected");
+			if(jQuery("#cogSelected option").length > 0 ){
 				setFieldValue('hasOptions', 'true');
 			}
 		});
@@ -13,23 +13,17 @@
         checkValueIsExist( "name", "validateCategoryOptionGroupSet.action", {
             id : getFieldValue( 'id' )
         } );
-		
-		jQuery("#availableCategoryOptionsList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getCategoryOptionGroups.action",
-			iterator: "categoryOptionGroups",
-			connectedTo: 'groupMembers',
-			handler: function(item) {
-				var option = jQuery("<option data-id='" + item.groups + "' />");
-				option.text( item.name );
-				option.attr( "value", item.id );
 
-				return option;
-			}
-		});
+        $('#cogAvailable').selected({
+          url: '../api/categoryOptionGroups.json',
+          target: $('#cogSelected'),
+          search: $('#cogAvailableSearch'),
+          iterator: 'categoryOptionGroups'
+        });
 	});
 </script>
 
-<h3>$i18n.getString( "edit_category_option_group" )</h3>
+<h3>$i18n.getString( "edit_category_option_group_set" )</h3>
 
 <form id="updateCategoryOptionGroupSetForm" action="updateCategoryOptionGroupSet.action" method="post" class="inputForm">
 
@@ -62,42 +56,12 @@
 	</tr>
 </table>
 
-<table>
-    <colgroup>
-      <col style="width: 500px;"/>
-      <col/>
-      <col style="width: 500px;"/>
-    </colgroup>
-
-	<tr>
-		<th>$i18n.getString( "available_category_option_groups" )</th>
-		<th></th>
-		<th>$i18n.getString( "group_members" )
-			<input type='hidden' id='hasOptions' name='hasOptions' class="{validate:{required:true}}">
-		</th>
-	</tr>
-
-	<tr>
-		<td>
-			<select id="availableCategoryOptionsList" name="availableCategoryOptionsList" 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( 'availableCategoryOptionsList' );"/><br/>
-            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
-			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableCategoryOptionsList' );"/><br/>
-			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
-        </td>
-
-		<td>
-			<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
-				#foreach( $categoryOption in $groupMembers )
-					<option value="$categoryOption.id">$encoder.htmlEncode( $categoryOption.displayName )</option>
-				#end
-			</select>
-		</td>
-	</tr>
-</table>
+#jqSelected({
+  "prefix": "cog",
+  "i18n_available": "available_category_option_groups",
+  "i18n_selected": "selected_category_option_groups",
+  "objects": $categoryOptionGroups
+})
 
 <p>
 	<input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>