=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/AddAttributeGroupAction.java 2014-09-26 11:31:48 +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.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup; import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; -import com.opensymphony.xwork2.Action; +import java.util.ArrayList; +import java.util.List; /** * @author Chau Thu Tran @@ -71,8 +70,6 @@ private String description; - private String[] selectedAttributes; - // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -87,9 +84,11 @@ this.name = name; } - public void setSelectedAttributes( String[] selectedAttributes ) + private List teaSelected = new ArrayList<>(); + + public void setTeaSelected( List teaSelected ) { - this.selectedAttributes = selectedAttributes; + this.teaSelected = teaSelected; } // ------------------------------------------------------------------------- @@ -105,12 +104,12 @@ attributeGroup.setDescription( description ); List attributes = new ArrayList<>(); - for ( String attributeId : selectedAttributes ) + + for ( String attributeId : teaSelected ) { - TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( Integer - .parseInt( attributeId ) ); - attributes.add( attribute ); + attributes.add( attributeService.getTrackedEntityAttribute( attributeId ) ); } + attributeGroup.setAttributes( attributes ); attributeGroupService.addTrackedEntityAttributeGroup( attributeGroup ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattributegroup/UpdateAttributeGroupAction.java 2014-09-26 11:31:48 +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.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup; import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService; import org.hisp.dhis.trackedentity.TrackedEntityAttributeService; -import com.opensymphony.xwork2.Action; +import java.util.ArrayList; +import java.util.List; /** * @author Chau Thu Tran @@ -73,8 +72,6 @@ private String description; - private String[] selectedAttributes; - // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -94,9 +91,11 @@ this.description = description; } - public void setSelectedAttributes( String[] selectedAttributes ) + private List teaSelected = new ArrayList<>(); + + public void setTeaSelected( List teaSelected ) { - this.selectedAttributes = selectedAttributes; + this.teaSelected = teaSelected; } // ------------------------------------------------------------------------- @@ -112,14 +111,12 @@ attributeGroup.setDescription( description ); List attributes = new ArrayList<>(); - - for ( String attributeId : selectedAttributes ) + + for ( String attributeId : teaSelected ) { - TrackedEntityAttribute attribute = attributeService.getTrackedEntityAttribute( Integer - .parseInt( attributeId ) ); - attributes.add( attribute ); + attributes.add( attributeService.getTrackedEntityAttribute( attributeId ) ); } - + attributeGroup.setAttributes( attributes ); attributeGroupService.updateTrackedEntityAttributeGroup( attributeGroup ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeGroupForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeGroupForm.vm 2014-08-06 15:20:54 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeGroupForm.vm 2014-09-26 11:31:48 +0000 @@ -21,6 +21,12 @@ +#jqSelected({ + "prefix": "tea", + "i18n_available": "availableAttribute", + "i18n_selected": "selectedAttribute" +}) + @@ -28,31 +34,6 @@ - - - - - - - - - - - -
$i18n.getString( "availableAttribute" )$i18n.getString( "filter" )$i18n.getString( "selectedAttribute" ) -
- - -
-
-
- -
- - - $i18n.getString( 'move_up' )

- $i18n.getString( 'move_up' ) -
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeGroupForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeGroupForm.js 2014-08-06 15:20:54 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeGroupForm.js 2014-09-26 11:31:48 +0000 @@ -1,33 +1,25 @@ -jQuery(document).ready( function(){ - - jQuery('name').focus(); - - validation2( 'addAttributeGroupForm', function( form ) - { - form.submit(); - },{ - 'beforeValidateHandler' : function() - { - selectAllById('selectedAttributes'); - if(jQuery("#selectedAttributes option").length > 0 ){ - setFieldValue('attributeList', 'true'); - } - }, - 'rules' : getValidationRules( "trackedEntityAttributeGroup" ) - }); - - jQuery("#availableAttributes").dhisAjaxSelect({ - source: 'getAttributeWithoutGroup.action', - iterator: 'attributes', - connectedTo: 'selectedAttributes', - handler: function(item){ - var option = jQuery( "
+#jqSelected({ + "prefix": "tea", + "i18n_available": "availableAttribute", + "i18n_selected": "selectedAttribute", + "objects": $attributeGroup.attributes +}) + @@ -31,44 +38,11 @@ - - - - - - - - - - - - - -
$i18n.getString( "availableAttribute" )$i18n.getString( "filter" )$i18n.getString( "selectedAttribute" ) - -
- - -
-
-
- -
- - - $i18n.getString( 'move_up' )

- $i18n.getString( 'move_up' ) -
+