← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6084: Js fix. Removed unused templates.

 

------------------------------------------------------------
revno: 6084
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-22 19:23:04 +0100
message:
  Js fix. Removed unused templates.
removed:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseError.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseInput.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseSuccess.vm
modified:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.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-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2012-02-22 18:07:04 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2012-02-22 18:23:04 +0000
@@ -193,9 +193,8 @@
     </action>
 
     <action name="validateRunAnalysis" class="org.hisp.dhis.validationrule.action.dataanalysis.ValidationRunAnalysisAction">
-      <result name="success" type="velocity-xml">/dhis-web-validationrule/responseSuccess.vm</result>
-      <result name="error" type="velocity-xml">/dhis-web-validationrule/responseError.vm</result>
-      <result name="input" type="velocity-xml">/dhis-web-validationrule/responseInput.vm</result>
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+      <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
     </action>
     
 	<!-- PDF -->

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm	2011-06-15 10:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm	2012-02-22 18:23:04 +0000
@@ -81,7 +81,7 @@
 	</tr>
 	<tr>
 		<td colspan="2">
-			<div id="selectionTree" style="width:400px;height:350px;overflow:auto;"></div>
+			<div id="selectionTree" style="width:400px;height:250px;overflow:auto;"></div>
 			<script type="text/javascript">
 
           		selectionTreeSelection.setMultipleSelectionAllowed( false );
@@ -124,7 +124,7 @@
 
 <table> 
     <tr>
-        <td colspan="2" style="height:10px"></td>
+        <td colspan="2" style="height:5px"></td>
     </tr>
 	<tr>
 		<td>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js	2012-02-22 17:36:22 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js	2012-02-22 18:23:04 +0000
@@ -9,26 +9,33 @@
 {
     if ( analyseDataInvalid() )
     {
-        $.post( "validateRunAnalysis.action", {
+        $.getJSON( "validateRunAnalysis.action", {
             fromDate : getFieldValue( 'fromDate' ),
             toDate : getFieldValue( 'toDate' )
         }, 
-        function( data )
+        function( json )
         {
-            runValidationCompleted( data );
-        }, 'xml' );
+            if ( json.response == "success" )
+            {
+            	analyseData();
+            }
+            else
+            {
+            	setMessage( json.message );
+            }
+        } );
     }
 }
 
 function analyseDataInvalid()
 {
-    if ( $( '#fromDate' ).val().length == 0 )
+    if ( $( "#fromDate" ).val().length == 0 )
     {
         setMessage( i18n_specify_a_start_date );
         return false;
     }
 
-    if ( $( '#toDate' ).val().length == 0 )
+    if ( $( "#toDate" ).val().length == 0 )
     {
         setMessage( i18n_specify_an_ending_date );
         return false;
@@ -45,25 +52,6 @@
     return true;
 }
 
-function runValidationCompleted( messageElement )
-{
-    var type = messageElement.firstChild.getAttribute( 'type' );
-    var message = messageElement.firstChild.firstChild.nodeValue;
-
-    if ( type == 'success' )
-    {
-        analyseData();
-    }
-    else if ( type == 'error' )
-    {
-        window.alert( i18n_validation_failed + ':' + '\n' + message );
-    }
-    else if ( type == 'input' )
-    {
-        setMessage( message );
-    }
-}
-
 function analyseData()
 {
     setWaitMessage( i18n_analysing_please_wait );

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseError.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseError.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseError.vm	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<message type="error">$encoder.xmlEncode( $message )</message>

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseInput.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseInput.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseInput.vm	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<message type="input">$encoder.xmlEncode( $message )</message>

=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseSuccess.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseSuccess.vm	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<message type="success">$encoder.xmlEncode( $message )</message>