← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3319: Fix bug: Indicator-group-editor-indicators-not-ordered and move js method to js file.

 

------------------------------------------------------------
revno: 3319
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-08 12:34:52 +0700
message:
  Fix bug: Indicator-group-editor-indicators-not-ordered and move js method to js file.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditorView.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/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2011-04-08 05:34:52 +0000
@@ -110,7 +110,8 @@
 			class="org.hisp.dhis.dd.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm</param>
-			<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>			
+			<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>	
+			<param name="javascripts">javascript/dataElementGroupEditorView.js</param>		
 		</action>	
 
 		<action name="getAssignedDataElementGroups"
@@ -371,7 +372,8 @@
 			class="org.hisp.dhis.dd.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-datadictionary/indicatorGroupEditorView.vm</param>
-			<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>			
+			<param name="menu">/dhis-web-maintenance-datadictionary/menu.vm</param>	
+			<param name="javascripts">javascript/indicatorGroupEditorView.js</param>
 		</action>
 		
 		<action name="getAssignedIndicatorGroups"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm	2011-03-31 13:13:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm	2011-04-08 05:34:52 +0000
@@ -1,14 +1,4 @@
 <script type="text/javascript">
-	jQuery(document).ready(function() {
-		loadAvailableGroups();
-		getDataElementsByGroup();
-		loadAvailableDataElements();
-		getAssignedDataElementGroups();
-		
-		jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});		
-		jQuery("#tabs").tabs();
-	});
-
 	var dataElementGroups = new Array();
 	#foreach( $dataElementGroup in $dataElementGroups )
         dataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )';
@@ -24,317 +14,10 @@
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
 	var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
 	var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
-	
-	function loadAvailableDataElements()
-	{
-		var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val();
-		var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #availableDataElements" );
-		var list_2 = jQuery( "#view_2 #availableDataElements2" );
-		list_1.empty();
-		list_2.empty();
-		
-		for( var id in availableDataElements)
-		{
-			var text = availableDataElements[id];
-			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-			{	
-				list_1.append('<option value="' + id + '">' + text + '</option>' );
-				list_2.append('<option value="' + id + '">' + text + '</option>' );
-			}
-		}
-		
-		sortList( 'availableDataElements', 'ASC' );
-		sortList( 'availableDataElements2', 'ASC' );
-		list_1.find(":first").attr("selected", "selected");		
-		list_2.find(":first").attr("selected", "selected");		
-		
-	}	
-	
-	function loadAvailableGroups()
-	{
-		var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val();
-		var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #dataElementGroups" );
-		var list_2 = jQuery( "#view_2 #availableGroups" );			
-		list_1.empty();				
-		list_2.empty();				
-		for( var id in dataElementGroups)
-		{
-			var text = dataElementGroups[id];
-			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-			{
-				list_1.append('<option value="' + id + '">' + text + '</option>' );
-				list_2.append('<option value="' + id + '">' + text + '</option>' );
-			}
-		}
-		sortList( 'dataElementGroups', 'ASC' );
-		sortList( 'availableGroups', 'ASC' );
-		list_1.find(":first").attr("selected", "selected");		
-		list_2.find(":first").attr("selected", "selected");	
-		
-		var list_3 = jQuery( "#view_2 #assignedGroups").children();
-		list_2.children().each( function(i, item ){
-			list_3.each( function(k, it ){
-				if( it.value == item.value ){
-					jQuery( item ).remove();
-				}
-			});
-		});
-	}
-	
-	function getDataElementsByGroup()
-	{
-		
-		loadAvailableDataElements();
-		
-		var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #selectedDataElements" );
-		list_1.empty();				
-		
-		jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", {
-			id: jQuery( '#view_1 #dataElementGroups' ).val()
-		}, function( json ){
-			jQuery.each( json.dataElements, function(i, item){				
-				var text = item.name;
-				if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-				{
-					list_1.append('<option value="' + item.id + '">' + text + '</option>' );
-				}
-				jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){
-					if( item.id == it.value )
-					{
-						jQuery(it).remove();
-					}
-				});
-			});
-		});
-	}
-	
-	function showAddGroup()
-	{
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){				
-				jQuery.postJSON( "validateDataElementGroup.action", {					
-					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "addDataElementGroupEditor.action", {
-							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }					
-						}, function( json ){
-							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
-							loadAvailableGroups();		
-							loadAvailableDataElements();
-							jQuery( "#view_1 #selectedDataElements" ).empty();
-							jQuery( '#addDataElementGroupForm' ).dialog('close');
-						} );
-					}else{
-						markInvalid( "addDataElementGroupForm #name", json.message );
-					}
-				});	
-			}
-		}]);
-
-		jQuery( '#addDataElementGroupForm' ).dialog('open');		
-	}
-	
-	function showAddGroupView2()
-	{
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){				
-				jQuery.postJSON( "validateDataElementGroup.action", {					
-					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "addDataElementGroupEditor.action", {
-							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }					
-						}, function( json ){
-							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
-							loadAvailableGroups();							
-							jQuery( '#addDataElementGroupForm' ).dialog('close');
-						} );
-					}else{
-						markInvalid( "addDataElementGroupForm #name", json.message );
-					}
-				});	
-			}
-		}]);
-		jQuery( '#addDataElementGroupForm' ).dialog('open');		
-	}
-	
-	function showUpdateGroup()
-	{
-		var id = jQuery( "#view_1 #dataElementGroups" ).val();		
-		var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text();
-		jQuery( '#addDataElementGroupForm #name' ).val( text );
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){
-				
-				jQuery.postJSON( "validateDataElementGroup.action", {
-					id: id,
-					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "renameDataElementGroupEditor.action", {
-							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
-							id: id
-						}, function( json ){
-							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
-							loadAvailableGroups();			
-							jQuery( '#addDataElementGroupForm' ).dialog('close');
-							showSuccessMessage( i18n_update_success );
-						} );
-					}else{
-						markInvalid( "addDataElementGroupForm #name", json.message );
-					}
-				});				
-			}
-		}]);
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
-		jQuery( '#addDataElementGroupForm' ).dialog('open');		
-	}
-	
-	function showUpdateGroup2()
-	{
-		var id = jQuery( "#view_2 #availableGroups" ).val();		
-		var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
-		jQuery( '#addDataElementGroupForm #name' ).val( text );
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){
-				
-				jQuery.postJSON( "validateDataElementGroup.action", {
-					id: id,
-					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "renameDataElementGroupEditor.action", {
-							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
-							id: id
-						}, function( json ){
-							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
-							loadAvailableGroups();							
-							jQuery( '#addDataElementGroupForm' ).dialog('close');
-							showSuccessMessage( i18n_update_success );
-						} );
-					}else{
-						markInvalid( "addDataElementGroupForm #name", json.message );
-					}
-				});				
-			}
-		}]);
-		
-		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
-		jQuery( '#addDataElementGroupForm' ).dialog('open');		
-	}
-	
-	function deleteDataElemenGroup()
-	{
-		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
-        {
-			var id = jQuery( "#view_1 #dataElementGroups" ).val();
-			
-			jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
-				id: id
-			}, function( json ){
-				if( json.response == 'success'){
-					dataElementGroups.splice(id, 1);
-					loadAvailableGroups();		
-					showSuccessMessage( json.message );
-				}else{
-					showErrorMessage( json.message );
-				}
-			});
-		}
-	}
-	
-	function deleteDataElemenGroupView2()
-	{
-		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
-        {
-			var id = jQuery( "#view_2 #availableGroups" ).val()[0];		
-			
-			jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
-				id: id
-			}, function( json ){
-				if( json.response == 'success'){
-					dataElementGroups.splice(id, 1);
-					loadAvailableGroups();							
-					showSuccessMessage( json.message );
-				}else{
-					showErrorMessage( json.message );
-				}
-			});
-		}
-	}
-	
-	function updateGroupMembers()
-	{
-		var id = jQuery( "#view_1 #dataElementGroups" ).val();
-		
-		jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ),
-		function( json ){
-			showSuccessMessage( i18n_update_success );
-		});
-	}
-	
-	function toQueryString( jQueryString, paramName )
-	{
-		var p = "";
-		jQuery( jQueryString ).children().each(function(i, item ){
-			item.selected = "selected";
-			p += paramName + "=" + item.value + "&";			
-		});
-		return p;
-	}
-	
-	// View 2
-	
-	function getAssignedDataElementGroups()
-	{	
-		loadAvailableGroups();
-		
-		var id = jQuery( "#view_2 #availableDataElements2" ).val();
-		var list_2 = jQuery( "#view_2 #assignedGroups" );	
-		list_2.empty();	
-		
-		jQuery.postJSON( "getAssignedDataElementGroups.action", {
-			dataElementId: id
-		}, function( json ){
-			jQuery.each(json.dataElementGroups, function(i, item ){
-				list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
-				
-				jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
-					if( item.id == it.value )
-					{
-						jQuery(it).remove();
-					}
-				});	
-				
-			});				
-			
-		});			
-	}
-	
-	function assignGroupsForDataElement()
-	{
-		var dataElementId = jQuery("#view_2 #availableDataElements2").val();
-		
-		jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ),
-		function( json ){
-			showSuccessMessage( i18n_update_success );
-		});
-	}
+	var i18n_new = '$encoder.jsEscape( $i18n.getString( "new" ) , "'")';
+	var i18n_save = '$encoder.jsEscape( $i18n.getString( "save" ) , "'")';
+	var i18n_rename = '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")';
+	
 </script>
 
 <style type="text/css">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditorView.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditorView.vm	2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditorView.vm	2011-04-08 05:34:52 +0000
@@ -1,12 +1,4 @@
 <script type="text/javascript">
-	jQuery(document).ready(function() {
-		loadAvailableGroups();
-		getIndicatorsByGroup();	
-		getAssignedIndicatorGroups();	
-		jQuery( "#addIndicatorGroupForm" ).dialog({autoOpen:false, modal:true});		
-		jQuery("#tabs").tabs();
-	});
-
 	var indicatorGroups = new Array();
 	#foreach( $indicatorGroup in $indicatorGroups )
 		indicatorGroups['$indicatorGroup.id'] = '$encoder.jsEscape( $indicatorGroup.name, "'" )';
@@ -22,321 +14,10 @@
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_indicator_group" ) , "'")';
 	var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
 	var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
-	
-	function loadAvailableIndicators()
-	{
-		var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val();
-		var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #availableIndicators" );
-		var list_2 = jQuery( "#view_2 #availableIndicators2" );
-		list_1.empty();
-		list_2.empty();
-		
-		for( var id in availableIndicators)
-		{
-			var text = availableIndicators[id];
-			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-			{				
-				list_1.append('<option value="' + id + '">' + text + '</option>' );
-				list_2.append('<option value="' + id + '">' + text + '</option>' );
-			}
-		}
-		
-		sortList( 'availableIndicators', 'ASC' );
-		sortList( 'availableIndicators2', 'ASC' );
-		list_1.find(":first").attr("selected", "selected");		
-		list_2.find(":first").attr("selected", "selected");		
-		
-	}
-	
-	function loadAvailableGroups()
-	{
-		var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val();
-		var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #indicatorGroups" );
-		var list_2 = jQuery( "#view_2 #availableGroups" );			
-		list_1.empty();				
-		list_2.empty();				
-		for( var id in indicatorGroups)
-		{
-			var text = indicatorGroups[id];
-			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-			{
-				list_1.append('<option value="' + id + '">' + text + '</option>' );
-				list_2.append('<option value="' + id + '">' + text + '</option>' );
-			}
-		}
-		
-		sortList( 'indicatorGroups', 'ASC' );
-		sortList( 'availableGroups', 'ASC' );
-		list_1.find(":first").attr("selected", "selected");		
-		list_2.find(":first").attr("selected", "selected");
-		
-		var list_3 = jQuery( "#view_2 #assignedGroups").children();
-		list_2.children().each( function(i, item ){
-			list_3.each( function(k, it ){
-				if( it.value == item.value ){
-					jQuery( item ).remove();
-				}
-			});
-		});
-	}
-	
-	function getIndicatorsByGroup()
-	{
-		
-		loadAvailableIndicators();
-		
-		var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val();
-		var list_1 = jQuery( "#view_1 #selectedIndicators" );
-		list_1.empty();				
-		
-		jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", {
-			id: jQuery( '#view_1 #indicatorGroups' ).val()
-		}, function( json ){
-			jQuery.each( json.indicators, function(i, item){				
-				var text = item.name;
-				if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
-				{
-					list_1.append('<option value="' + item.id + '">' + text + '</option>' );
-				}
-				jQuery( "#view_1 #availableIndicators" ).children().each( function(k, it){
-					if( item.id == it.value )
-					{
-						jQuery(it).remove();
-					}
-				});
-			});
-		});
-	}
-	
-	function showAddGroup()
-	{
-		
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){				
-				jQuery.postJSON( "validateIndicatorGroup.action", {					
-					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "addIndicatorGroupEditor.action", {
-							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }					
-						}, function( json ){
-							indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
-							loadAvailableGroups();								
-							loadAvailableIndicators();
-							
-							jQuery( "#view_1 #selectedIndicators" ).empty();
-							jQuery( '#addIndicatorGroupForm' ).dialog('close');
-						} );
-					}else{
-						markInvalid( "addIndicatorGroupForm #name", json.message );
-					}
-				});	
-			}
-		}]);
-		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
-		
-	}
-	
-	function showUpdateGroup()
-	{
-		var id = jQuery( "#view_1 #indicatorGroups" ).val();		
-		var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
-		jQuery( '#addIndicatorGroupForm #name' ).val( text );
-		
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){
-				
-				jQuery.postJSON( "validateIndicatorGroup.action", {
-					id: id,
-					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "renameIndicatorGroupEditor.action", {
-							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
-							id: id
-						}, function( json ){
-							indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
-							loadAvailableGroups();		
-							jQuery( '#addIndicatorGroupForm' ).dialog('close');
-							showSuccessMessage( i18n_update_success );
-						} );
-					}else{
-						markInvalid( "addIndicatorGroupForm #name", json.message );
-					}
-				});				
-			}
-		}]);
-		
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
-		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
-		
-	}
-	
-	function deleteIndicatorGroup()
-	{
-		var id = jQuery( "#view_1 #indicatorGroups" ).val();
-		var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
-		
-		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
-        {
-			
-			jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
-				id: id
-			}, function( json ){
-				if( json.response == 'success'){
-					indicatorGroups.splice(id, 1);
-					loadAvailableGroups();		
-					showSuccessMessage( json.message );
-				}else{
-					showErrorMessage( json.message );
-				}
-			});
-		}
-	}
-	
-	function updateGroupMembers()
-	{
-		var id = jQuery( "#view_1 #indicatorGroups" ).val();
-		
-		jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ),
-		function( json ){
-			showSuccessMessage( i18n_update_success );
-		});
-	}
-	
-	function toQueryString( jQueryString, paramName )
-	{
-		var p = "";
-		jQuery( jQueryString ).children().each(function(i, item ){
-			item.selected = "selected";
-			p += paramName + "=" + item.value + "&";			
-		});
-		return p;
-	}
-	
-	// View2
-	function getAssignedIndicatorGroups()
-	{
-		loadAvailableGroups();
-		
-		var id = jQuery( "#view_2 #availableIndicators2" ).val();
-		var list_2 = jQuery( "#view_2 #assignedGroups" );	
-		list_2.empty();	
-		
-		jQuery.postJSON( "getAssignedIndicatorGroups.action", {
-			indicatorId: id
-		}, function( json ){
-			jQuery.each(json.indicatorGroups, function(i, item ){
-				list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
-				
-				jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
-					if( item.id == it.value )
-					{
-						jQuery(it).remove();
-					}
-				});	
-				
-			});				
-			
-		});		
-	}
-	
-	function showAddGroup2()
-	{
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "new" ) , "'")');
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){				
-				jQuery.postJSON( "validateIndicatorGroup.action", {					
-					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "addIndicatorGroupEditor.action", {
-							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }					
-						}, function( json ){
-							indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
-							loadAvailableGroups();								
-							jQuery( '#addIndicatorGroupForm' ).dialog('close');
-						} );
-					}else{
-						markInvalid( "addIndicatorGroupForm #name", json.message );
-					}
-				});	
-			}
-		}]);
-		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
-	}
-
-	function showUpdateGroup2()
-	{
-		var id = jQuery( "#view_2 #availableGroups" ).val()[0];		
-		var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
-		jQuery( '#addIndicatorGroupForm #name' ).val( text );
-		
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
-			text: '$encoder.jsEscape( $i18n.getString( "save" ) , "'")',
-			click: function(){				
-				jQuery.postJSON( "validateIndicatorGroup.action", {
-					id: id,
-					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
-				}, function( json ){
-					if( json.response == 'success' ){
-						jQuery.postJSON( "renameIndicatorGroupEditor.action", {
-							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
-							id: id
-						}, function( json ){
-							indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
-							loadAvailableGroups();		
-							jQuery( '#addIndicatorGroupForm' ).dialog('close');
-							showSuccessMessage( i18n_update_success );
-						} );
-					}else{
-						markInvalid( "addIndicatorGroupForm #name", json.message );
-					}
-				});				
-			}
-		}]);
-
-		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")');
-		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
-	}
-
-	function deleteIndicatorGroup2()
-	{
-		var id = jQuery( "#view_2 #availableGroups" ).val()[0];
-		var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
-		
-		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
-        {
-			
-			jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
-				id: id
-			}, function( json ){
-				if( json.response == 'success'){
-					indicatorGroups.splice(id, 1);
-					loadAvailableGroups();		
-					showSuccessMessage( json.message );
-				}else{
-					showErrorMessage( json.message );
-				}
-			});
-		}
-	}
-
-	function assignGroupsForIndicator()
-	{
-		var id = jQuery( "#view_2 #availableIndicators2" ).val();
-		
-		jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ),
-		function( json ){
-			showSuccessMessage( i18n_update_success );
-		});
-	}
+	var i18n_new = '$encoder.jsEscape( $i18n.getString( "new" ) , "'")';
+	var i18n_save = '$encoder.jsEscape( $i18n.getString( "save" ) , "'")';
+	var i18n_rename = '$encoder.jsEscape( $i18n.getString( "rename" ) , "'")';
+	
 </script>
 
 <style type="text/css">

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js	2011-04-08 05:34:52 +0000
@@ -0,0 +1,316 @@
+jQuery(document).ready(function() {
+		loadAvailableGroups();
+		getDataElementsByGroup();
+		getAssignedDataElementGroups();
+		
+		jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});		
+		jQuery("#tabs").tabs();
+	});
+	
+	function loadAvailableDataElements()
+	{
+		var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val();
+		var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #availableDataElements" );
+		var list_2 = jQuery( "#view_2 #availableDataElements2" );
+		list_1.empty();
+		list_2.empty();
+		
+		for( var id in availableDataElements)
+		{
+			var text = availableDataElements[id];
+			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+			{	
+				list_1.append('<option value="' + id + '">' + text + '</option>' );
+				list_2.append('<option value="' + id + '">' + text + '</option>' );
+			}
+		}
+		list_1.find(":first").attr("selected", "selected");		
+		list_2.find(":first").attr("selected", "selected");		
+		
+	}	
+	
+	function loadAvailableGroups()
+	{
+		var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val();
+		var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #dataElementGroups" );
+		var list_2 = jQuery( "#view_2 #availableGroups" );			
+		list_1.empty();				
+		list_2.empty();				
+		for( var id in dataElementGroups)
+		{
+			var text = dataElementGroups[id];
+			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+			{
+				list_1.append('<option value="' + id + '">' + text + '</option>' );
+				list_2.append('<option value="' + id + '">' + text + '</option>' );
+			}
+		}
+		sortList( 'dataElementGroups', 'ASC' );
+		sortList( 'availableGroups', 'ASC' );
+		list_1.find(":first").attr("selected", "selected");		
+		list_2.find(":first").attr("selected", "selected");	
+		
+		var list_3 = jQuery( "#view_2 #assignedGroups").children();
+		list_2.children().each( function(i, item ){
+			list_3.each( function(k, it ){
+				if( it.value == item.value ){
+					jQuery( item ).remove();
+				}
+			});
+		});
+	}
+	
+	function getDataElementsByGroup()
+	{
+		
+		loadAvailableDataElements();
+		
+		var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #selectedDataElements" );
+		list_1.empty();				
+		
+		jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", {
+			id: jQuery( '#view_1 #dataElementGroups' ).val()
+		}, function( json ){
+			jQuery.each( json.dataElements, function(i, item){				
+				var text = item.name;
+				if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+				{
+					list_1.append('<option value="' + item.id + '">' + text + '</option>' );
+				}
+				jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){
+					if( item.id == it.value )
+					{
+						jQuery(it).remove();
+					}
+				});
+			});
+		});
+	}
+	
+	function showAddGroup()
+	{
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){				
+				jQuery.postJSON( "validateDataElementGroup.action", {					
+					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "addDataElementGroupEditor.action", {
+							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }					
+						}, function( json ){
+							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+							loadAvailableGroups();		
+							loadAvailableDataElements();
+							jQuery( "#view_1 #selectedDataElements" ).empty();
+							jQuery( '#addDataElementGroupForm' ).dialog('close');
+						} );
+					}else{
+						markInvalid( "addDataElementGroupForm #name", json.message );
+					}
+				});	
+			}
+		}]);
+
+		jQuery( '#addDataElementGroupForm' ).dialog('open');		
+	}
+	
+	function showAddGroupView2()
+	{
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){				
+				jQuery.postJSON( "validateDataElementGroup.action", {					
+					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "addDataElementGroupEditor.action", {
+							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }					
+						}, function( json ){
+							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+							loadAvailableGroups();							
+							jQuery( '#addDataElementGroupForm' ).dialog('close');
+						} );
+					}else{
+						markInvalid( "addDataElementGroupForm #name", json.message );
+					}
+				});	
+			}
+		}]);
+		jQuery( '#addDataElementGroupForm' ).dialog('open');		
+	}
+	
+	function showUpdateGroup()
+	{
+		var id = jQuery( "#view_1 #dataElementGroups" ).val();		
+		var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text();
+		jQuery( '#addDataElementGroupForm #name' ).val( text );
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){
+				
+				jQuery.postJSON( "validateDataElementGroup.action", {
+					id: id,
+					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "renameDataElementGroupEditor.action", {
+							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+							id: id
+						}, function( json ){
+							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+							loadAvailableGroups();			
+							jQuery( '#addDataElementGroupForm' ).dialog('close');
+							showSuccessMessage( i18n_update_success );
+						} );
+					}else{
+						markInvalid( "addDataElementGroupForm #name", json.message );
+					}
+				});				
+			}
+		}]);
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
+		jQuery( '#addDataElementGroupForm' ).dialog('open');		
+	}
+	
+	function showUpdateGroup2()
+	{
+		var id = jQuery( "#view_2 #availableGroups" ).val();		
+		var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+		jQuery( '#addDataElementGroupForm #name' ).val( text );
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){
+				
+				jQuery.postJSON( "validateDataElementGroup.action", {
+					id: id,
+					name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "renameDataElementGroupEditor.action", {
+							name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+							id: id
+						}, function( json ){
+							dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+							loadAvailableGroups();							
+							jQuery( '#addDataElementGroupForm' ).dialog('close');
+							showSuccessMessage( i18n_update_success );
+						} );
+					}else{
+						markInvalid( "addDataElementGroupForm #name", json.message );
+					}
+				});				
+			}
+		}]);
+		
+		jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
+		jQuery( '#addDataElementGroupForm' ).dialog('open');		
+	}
+	
+	function deleteDataElemenGroup()
+	{
+		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+			var id = jQuery( "#view_1 #dataElementGroups" ).val();
+			
+			jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+				id: id
+			}, function( json ){
+				if( json.response == 'success'){
+					dataElementGroups.splice(id, 1);
+					loadAvailableGroups();		
+					showSuccessMessage( json.message );
+				}else{
+					showErrorMessage( json.message );
+				}
+			});
+		}
+	}
+	
+	function deleteDataElemenGroupView2()
+	{
+		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+			var id = jQuery( "#view_2 #availableGroups" ).val()[0];		
+			
+			jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+				id: id
+			}, function( json ){
+				if( json.response == 'success'){
+					dataElementGroups.splice(id, 1);
+					loadAvailableGroups();							
+					showSuccessMessage( json.message );
+				}else{
+					showErrorMessage( json.message );
+				}
+			});
+		}
+	}
+	
+	function updateGroupMembers()
+	{
+		var id = jQuery( "#view_1 #dataElementGroups" ).val();
+		
+		jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ),
+		function( json ){
+			showSuccessMessage( i18n_update_success );
+		});
+	}
+	
+	function toQueryString( jQueryString, paramName )
+	{
+		var p = "";
+		jQuery( jQueryString ).children().each(function(i, item ){
+			item.selected = "selected";
+			p += paramName + "=" + item.value + "&";			
+		});
+		return p;
+	}
+	
+	// View 2
+	
+	function getAssignedDataElementGroups()
+	{	
+		loadAvailableGroups();
+		
+		var id = jQuery( "#view_2 #availableDataElements2" ).val();
+		var list_2 = jQuery( "#view_2 #assignedGroups" );	
+		list_2.empty();	
+		
+		jQuery.postJSON( "getAssignedDataElementGroups.action", {
+			dataElementId: id
+		}, function( json ){
+			jQuery.each(json.dataElementGroups, function(i, item ){
+				list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
+				
+				jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
+					if( item.id == it.value )
+					{
+						jQuery(it).remove();
+					}
+				});	
+				
+			});				
+			
+		});			
+	}
+	
+	function assignGroupsForDataElement()
+	{
+		var dataElementId = jQuery("#view_2 #availableDataElements2").val();
+		
+		jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ),
+		function( json ){
+			showSuccessMessage( i18n_update_success );
+		});
+	}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js	2011-04-08 05:34:52 +0000
@@ -0,0 +1,321 @@
+jQuery(document).ready(function() {
+		loadAvailableGroups();
+		getIndicatorsByGroup();	
+		getAssignedIndicatorGroups();	
+		jQuery( "#addIndicatorGroupForm" ).dialog({autoOpen:false, modal:true});		
+		jQuery("#tabs").tabs();
+	});
+
+	
+	function loadAvailableIndicators()
+	{
+		var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val();
+		var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #availableIndicators" );
+		var list_2 = jQuery( "#view_2 #availableIndicators2" );
+		list_1.empty();
+		list_2.empty();
+		
+		for( var id in availableIndicators)
+		{
+			var text = availableIndicators[id];
+			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+			{				
+				list_1.append('<option value="' + id + '">' + text + '</option>' );
+				list_2.append('<option value="' + id + '">' + text + '</option>' );
+			}
+		}
+		
+		list_1.find(":first").attr("selected", "selected");		
+		list_2.find(":first").attr("selected", "selected");		
+		
+	}
+	
+	function loadAvailableGroups()
+	{
+		var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val();
+		var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #indicatorGroups" );
+		var list_2 = jQuery( "#view_2 #availableGroups" );			
+		list_1.empty();				
+		list_2.empty();				
+		for( var id in indicatorGroups)
+		{
+			var text = indicatorGroups[id];
+			if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+			{
+				list_1.append('<option value="' + id + '">' + text + '</option>' );
+				list_2.append('<option value="' + id + '">' + text + '</option>' );
+			}
+		}
+		
+		sortList( 'indicatorGroups', 'ASC' );
+		sortList( 'availableGroups', 'ASC' );
+		list_1.find(":first").attr("selected", "selected");		
+		list_2.find(":first").attr("selected", "selected");
+		
+		var list_3 = jQuery( "#view_2 #assignedGroups").children();
+		list_2.children().each( function(i, item ){
+			list_3.each( function(k, it ){
+				if( it.value == item.value ){
+					jQuery( item ).remove();
+				}
+			});
+		});
+	}
+	
+	function getIndicatorsByGroup()
+	{
+		
+		loadAvailableIndicators();
+		
+		var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val();
+		var list_1 = jQuery( "#view_1 #selectedIndicators" );
+		list_1.empty();				
+		
+		jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", {
+			id: jQuery( '#view_1 #indicatorGroups' ).val()
+		}, function( json ){
+			jQuery.each( json.indicators, function(i, item){				
+				var text = item.name;
+				if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+				{
+					list_1.append('<option value="' + item.id + '">' + text + '</option>' );
+				}
+				jQuery( "#view_1 #availableIndicators" ).children().each( function(k, it){
+					if( item.id == it.value )
+					{
+						jQuery(it).remove();
+					}
+				});
+			});
+		});
+	}
+	
+	function showAddGroup()
+	{
+		
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){				
+				jQuery.postJSON( "validateIndicatorGroup.action", {					
+					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "addIndicatorGroupEditor.action", {
+							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }					
+						}, function( json ){
+							indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
+							loadAvailableGroups();								
+							loadAvailableIndicators();
+							
+							jQuery( "#view_1 #selectedIndicators" ).empty();
+							jQuery( '#addIndicatorGroupForm' ).dialog('close');
+						} );
+					}else{
+						markInvalid( "addIndicatorGroupForm #name", json.message );
+					}
+				});	
+			}
+		}]);
+		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
+		
+	}
+	
+	function showUpdateGroup()
+	{
+		var id = jQuery( "#view_1 #indicatorGroups" ).val();		
+		var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
+		jQuery( '#addIndicatorGroupForm #name' ).val( text );
+		
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){
+				
+				jQuery.postJSON( "validateIndicatorGroup.action", {
+					id: id,
+					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "renameIndicatorGroupEditor.action", {
+							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
+							id: id
+						}, function( json ){
+							indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
+							loadAvailableGroups();		
+							jQuery( '#addIndicatorGroupForm' ).dialog('close');
+							showSuccessMessage( i18n_update_success );
+						} );
+					}else{
+						markInvalid( "addIndicatorGroupForm #name", json.message );
+					}
+				});				
+			}
+		}]);
+		
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
+		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
+		
+	}
+	
+	function deleteIndicatorGroup()
+	{
+		var id = jQuery( "#view_1 #indicatorGroups" ).val();
+		var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
+		
+		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+			
+			jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
+				id: id
+			}, function( json ){
+				if( json.response == 'success'){
+					indicatorGroups.splice(id, 1);
+					loadAvailableGroups();		
+					showSuccessMessage( json.message );
+				}else{
+					showErrorMessage( json.message );
+				}
+			});
+		}
+	}
+	
+	function updateGroupMembers()
+	{
+		var id = jQuery( "#view_1 #indicatorGroups" ).val();
+		
+		jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ),
+		function( json ){
+			showSuccessMessage( i18n_update_success );
+		});
+	}
+	
+	function toQueryString( jQueryString, paramName )
+	{
+		var p = "";
+		jQuery( jQueryString ).children().each(function(i, item ){
+			item.selected = "selected";
+			p += paramName + "=" + item.value + "&";			
+		});
+		return p;
+	}
+	
+	// View2
+	function getAssignedIndicatorGroups()
+	{
+		loadAvailableGroups();
+		
+		var id = jQuery( "#view_2 #availableIndicators2" ).val();
+		var list_2 = jQuery( "#view_2 #assignedGroups" );	
+		list_2.empty();	
+		
+		jQuery.postJSON( "getAssignedIndicatorGroups.action", {
+			indicatorId: id
+		}, function( json ){
+			jQuery.each(json.indicatorGroups, function(i, item ){
+				list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
+				
+				jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
+					if( item.id == it.value )
+					{
+						jQuery(it).remove();
+					}
+				});	
+				
+			});				
+			
+		});		
+	}
+	
+	function showAddGroup2()
+	{
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){				
+				jQuery.postJSON( "validateIndicatorGroup.action", {					
+					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "addIndicatorGroupEditor.action", {
+							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }					
+						}, function( json ){
+							indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
+							loadAvailableGroups();								
+							jQuery( '#addIndicatorGroupForm' ).dialog('close');
+						} );
+					}else{
+						markInvalid( "addIndicatorGroupForm #name", json.message );
+					}
+				});	
+			}
+		}]);
+		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
+	}
+
+	function showUpdateGroup2()
+	{
+		var id = jQuery( "#view_2 #availableGroups" ).val()[0];		
+		var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+		jQuery( '#addIndicatorGroupForm #name' ).val( text );
+		
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+			text: i18n_save,
+			click: function(){				
+				jQuery.postJSON( "validateIndicatorGroup.action", {
+					id: id,
+					name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+				}, function( json ){
+					if( json.response == 'success' ){
+						jQuery.postJSON( "renameIndicatorGroupEditor.action", {
+							name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
+							id: id
+						}, function( json ){
+							indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
+							loadAvailableGroups();		
+							jQuery( '#addIndicatorGroupForm' ).dialog('close');
+							showSuccessMessage( i18n_update_success );
+						} );
+					}else{
+						markInvalid( "addIndicatorGroupForm #name", json.message );
+					}
+				});				
+			}
+		}]);
+
+		jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
+		jQuery( '#addIndicatorGroupForm' ).dialog('open');		
+	}
+
+	function deleteIndicatorGroup2()
+	{
+		var id = jQuery( "#view_2 #availableGroups" ).val()[0];
+		var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+		
+		if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+			
+			jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
+				id: id
+			}, function( json ){
+				if( json.response == 'success'){
+					indicatorGroups.splice(id, 1);
+					loadAvailableGroups();		
+					showSuccessMessage( json.message );
+				}else{
+					showErrorMessage( json.message );
+				}
+			});
+		}
+	}
+
+	function assignGroupsForIndicator()
+	{
+		var id = jQuery( "#view_2 #availableIndicators2" ).val();
+		
+		jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ),
+		function( json ){
+			showSuccessMessage( i18n_update_success );
+		});
+	}
\ No newline at end of file