← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1919: Fixed bug does not show warning message in Data element/Indicator editor.

 

------------------------------------------------------------
revno: 1919
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-05-28 12:20:47 +0700
message:
  Fixed bug does not show warning message in Data element/Indicator editor.
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
  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/javascript/dataElementGroupEditorView1.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView1.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView2.js


--
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-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-05-17 02:59:28 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-05-28 05:20:47 +0000
@@ -117,6 +117,7 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
@@ -401,6 +402,7 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
@@ -410,6 +412,7 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
@@ -841,6 +844,8 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
 		<action name="listAllExcelItemGroup"
@@ -981,6 +986,8 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
 		<action name="getSelectedDataElements"
@@ -1142,7 +1149,7 @@
 			</result>
 		</action>
 
-		<!--  function - Prewiew Data - NORMAL  		     -->
+		<!--  function - Prewiew Data - NORMAL -->
 		<action name="previewDataNormal"
 			class="org.hisp.dhis.reportexcel.importing.action.ViewDataNormalAction">
 			<result name="success" type="velocity">
@@ -1266,6 +1273,7 @@
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 

=== 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	2010-05-27 17:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2010-05-28 05:20:47 +0000
@@ -181,10 +181,10 @@
 
 		<action name="deleteDataElemenGroupEditor"
 			class="org.hisp.dhis.dd.action.dataelementgroup.RemoveDataElementGroupAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-maintenance-datadictionary/responseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-maintenance-datadictionary/responseError.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_DATAELEMENTGROUP_DELETE</param>
 		</action>
@@ -412,10 +412,10 @@
 
 		<action name="deleteIndicatorGroupEditor"
 			class="org.hisp.dhis.dd.action.indicatorgroup.RemoveIndicatorGroupAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-maintenance-datadictionary/responseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-maintenance-datadictionary/responseError.vm</result>
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="error" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 			<param name="requiredAuthorities">F_INDICATORGROUP_DELETE</param>
 		</action>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js	2010-05-27 17:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView1.js	2010-05-28 05:20:47 +0000
@@ -216,6 +216,7 @@
     setHeaderDelayMessage( i18n_update_success + " : " + dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text );
 }
 
+/*
 function deleteDataElementGroup()
 {
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
@@ -242,7 +243,7 @@
 {
     var type = xmlObject.getAttribute( 'type' );
 
-    if ( type=='success' )
+    if ( type == 'success' )
     {
         var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
         dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
@@ -256,6 +257,49 @@
 		showWarning();
 	}
 }
+*/
+
+function deleteDataElementGroup()
+{
+    var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+
+    try
+    {
+        var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
+        var name =  dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
+		
+        if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+		    $.getJSON
+			(
+				'deleteDataElemenGroupEditor.action',
+				{
+					"id": id
+				},
+				function( json )
+				{
+					if ( json.response == "success" )
+					{
+						var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
+						dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
+						document.getElementById( 'groupNameView' ).innerHTML = "";
+						selectedDataElements = new Object();
+					}
+					else if ( json.response == "error" )
+					{
+						setFieldValue( 'warningArea', json.message );
+			
+						showWarning();
+					}
+				}
+			);
+        }
+    }
+    catch(e)
+    {
+        alert( i18n_select_dataelement_group );
+    }
+}
 
 function showRenameDataElementGroupForm()
 {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js	2010-05-27 17:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView2.js	2010-05-28 05:20:47 +0000
@@ -178,6 +178,7 @@
     }
 }
 
+/*
 function deleteDataElementGroup()
 {
     var dataElementGroupsSelect = document.getElementById( 'availableGroups' );
@@ -216,6 +217,47 @@
 		showWarning();
 	}
 }
+*/
+
+function deleteDataElementGroup()
+{
+    var dataElementGroupsSelect = document.getElementById( 'availableGroups' );
+
+    try
+    {
+        var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
+        var name =  dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
+		
+        if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+        {
+		    $.getJSON
+			(
+				'deleteDataElemenGroupEditor.action',
+				{
+					"id": id
+				},
+				function( json )
+				{
+					if ( json.response == "success" )
+					{
+						var dataElementGroupsSelect = document.getElementById( 'availableGroups' );
+						dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );                
+					}
+					else if ( json.response == "error" )
+					{
+						setFieldValue( 'warningArea', json.message );
+			
+						showWarning();
+					}
+				}
+			);
+        }
+    }
+    catch(e)
+    {
+        alert( i18n_select_dataelement_group );
+    }
+}
 
 function showRenameDataElementGroupForm()
 {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView1.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView1.js	2010-05-27 17:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView1.js	2010-05-28 05:20:47 +0000
@@ -393,7 +393,7 @@
 /*==============================================================================
  * Delete Indicator Group
  *==============================================================================*/
- 
+/*
 function deleteIndicatorGroup()
 {
 	if( window.confirm( i18n_confirm_delete ) )
@@ -424,5 +424,35 @@
 		showWarning();
 	}
 }
- 
- 
\ No newline at end of file
+*/
+
+function deleteIndicatorGroup()
+{
+	if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+	{
+		var indicatorGroupsSelect = document.getElementById( 'indicatorGroups' );
+		var id = indicatorGroupsSelect.options[ indicatorGroupsSelect.selectedIndex ].value;	
+
+		$.getJSON
+		(
+			'deleteIndicatorGroupEditor.action',
+			{
+				"id": id
+			},
+			function( json )
+			{
+				if ( json.response == "success" )
+				{
+					var indicatorGroupsSelect = document.getElementById( 'indicatorGroups' );
+					indicatorGroupsSelect.remove( indicatorGroupsSelect.selectedIndex );
+				}
+				else if ( json.response == "error" )
+				{
+					setFieldValue( 'warningArea', json.message );
+		
+					showWarning();
+				}
+			}
+		);
+	}
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView2.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView2.js	2010-05-27 17:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView2.js	2010-05-28 05:20:47 +0000
@@ -350,7 +350,7 @@
 /*==============================================================================
  * Delete Indicator Group
  *==============================================================================*/
- 
+/*
 function deleteIndicatorGroup()
 {
 	if( window.confirm( i18n_confirm_delete ) )
@@ -385,5 +385,41 @@
 		showWarning();
 	}
 }
- 
- 
\ No newline at end of file
+*/
+
+function deleteIndicatorGroup()
+{
+	if ( window.confirm( i18n_confirm_delete ) )
+	{
+		var list = byId('availableGroups');
+	
+		if ( list.value == '' )
+		{
+			setHeaderDelayMessage(i18n_select_indicator_group);
+		}
+		else
+		{
+			$.getJSON
+			(
+				'deleteIndicatorGroupEditor.action',
+				{
+					"id": list.value
+				},
+				function( json )
+				{
+					if ( json.response == "success" )
+					{
+						var list = byId('availableGroups');
+						list.remove( list.selectedIndex );
+					}
+					else if ( json.response == "error" )
+					{
+						setFieldValue( 'warningArea', json.message );
+			
+						showWarning();
+					}
+				}
+			);
+		}
+	}
+}
\ No newline at end of file