← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2439: Fixing Survey module to run in 2.0.6

 

------------------------------------------------------------
revno: 2439
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-12-29 13:23:18 +0530
message:
  Fixing Survey module to run in 2.0.6
added:
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseError.vm
modified:
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/DelSurveyAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/IndicatorListFilteredByGroup.java
  local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties
  local/in/dhis-web-survey/src/main/resources/struts.xml
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/survey.js
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/surveyList.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 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/DelSurveyAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/DelSurveyAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/DelSurveyAction.java	2010-12-29 07:53:18 +0000
@@ -96,12 +96,12 @@
         Survey survey = surveyService.getSurvey( surveyId );
         
         int flag = surveyService.deleteSurvey( survey );
-
+       // System.out.println( "flag is " + flag );
         if ( flag < 0 )
         {
             status = "error";
-            
-            message = survey.getName() + " not Deleted. Contains Data.";
+            String delMseg = i18n.getString( "not_del_contain_data" );
+            message = survey.getName() + " : "+  delMseg;
 
             return ERROR;
         }

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/IndicatorListFilteredByGroup.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/IndicatorListFilteredByGroup.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/IndicatorListFilteredByGroup.java	2010-12-29 07:53:18 +0000
@@ -109,18 +109,17 @@
     public String execute()
         throws Exception
     {
-        if (  indicatorGroupId == null || indicatorGroupId.equals( "ALL" ) )
+        if (  indicatorGroupId == null || indicatorGroupId.equalsIgnoreCase( "ALL" ) )
         {
         	indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
         }
         else
         {
-        	IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( Integer
-                .parseInt( indicatorGroupId ) );
+        	IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( Integer.parseInt( indicatorGroupId ) );
 
         	indicators = new ArrayList<Indicator>( indicatorGroup.getMembers() );
         }
-
+       // System.out.println("\n\n +++ \n selectedIndicators list  is  : " + selectedIndicators + " ,selectedIndicators list size is : "  + selectedIndicators.length );
         if ( selectedIndicators != null && selectedIndicators.length > 0 )
         {
             Iterator<Indicator> iter = indicators.iterator();
@@ -128,9 +127,11 @@
             while ( iter.hasNext() )
             {
             	Indicator indicator = iter.next();
-
+            	//System.out.println("\n\n +++ \n Indicator Id is   : " + indicator.getId() + " , Indicator name is :" + indicator.getName() );
+            	
                 for ( int i = 0; i < selectedIndicators.length; i++ )
                 {
+                    //System.out.println("\n\n +++ \n Indicator Id is   : " + indicator.getId() + " , Indicator name is :" + indicator.getName() );
                     if ( indicator.getId() == Integer.parseInt( selectedIndicators[i] ) )
                     {
                         iter.remove();
@@ -143,7 +144,7 @@
         {
         	Survey survey = surveyService.getSurvey( surveyId );
 
-            indicators.removeAll( survey.getIndicators() );
+                indicators.removeAll( survey.getIndicators() );
         }
 
       //  Collections.sort( indicators, indicatorComparator );

=== modified file 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties'
--- local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties	2010-09-15 13:23:57 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties	2010-12-29 07:53:18 +0000
@@ -33,17 +33,19 @@
 available_indicators=	Available Indicators
 selected_indicators	= 	Selected Indicators
 specify_short_name	=	Specify Short Name
-duplicate_short_names=	Duplicate Short Names
+duplicate_names=	Duplicate Name
+duplicate_short_names=	Duplicate Short Name
 duplicate_codes		=	Duplicate Names
 selected_indicators	= 	Selected Indicators
 no_organisationunit_selected = No Organisation Unit Selected.
 no_survey_selected = No Survey Selected.
 organisation_unit = Organisation Unit
-select = select
+select = Select
 survey = Survey
-specify_name = specify name 
+specify_name = Specify Name 
 define_survey_associations = Define Survey Associations
-value_must_integer  = value must be integer 
+value_must_integer  = Value must be integer 
 none = NONE
-
+not_del_contain_data = Not Deleted Its Contains Data
+confirm_delete_survey = Are you sure you want to Remove Survey?
 

=== modified file 'local/in/dhis-web-survey/src/main/resources/struts.xml'
--- local/in/dhis-web-survey/src/main/resources/struts.xml	2010-09-15 13:23:57 +0000
+++ local/in/dhis-web-survey/src/main/resources/struts.xml	2010-12-29 07:53:18 +0000
@@ -89,8 +89,7 @@
 		<action name="delSurvey"
 			class="org.hisp.dhis.survey.action.DelSurveyAction">
 			<result name="success" type="velocity-xml">/dhis-web-survey/responseSuccess.vm</result>
-			<result name="error" type="velocity-xml">
-				/dhis-web-survey/responseError.vm</result>
+			<result name="error" type="velocity-xml">/dhis-web-survey/responseError.vm</result>
 			<!--<param name="requiredAuthorities">F_DATASET_DELETE</param>-->
 		</action>
 		
@@ -115,8 +114,7 @@
 			class="org.hisp.dhis.survey.action.SetupAssociationsTreeAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-survey/surveyAssociations.vm</param>
-			<param name="javascripts">
-				../dhis-web-commons/oust/oust.js,javascript/IndicatorList.js,javascript/associations.js</param>
+			<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/IndicatorList.js,javascript/associations.js</param>
 			<!--<param name="requiredAuthorities">F_DATASET_ASSIGN</param>-->
 		</action>
 		

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/survey.js'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/survey.js	2010-09-15 13:23:57 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/survey.js	2010-12-29 07:53:18 +0000
@@ -9,7 +9,7 @@
 
 function removeSurvey( surveyId, surveyName )
 {
-  var result = window.confirm( i18n_confirm_delete + '\n\n' + surveyName );
+  var result = window.confirm( i18n_confirm_delete + '\n\n' + " Survey Id =" + surveyId + '\n\n' + " Survey Name ="  + surveyName );
 
   if ( result )
   {
@@ -33,7 +33,9 @@
     if ( type == 'error' )
    {
     	var message = messageElement.firstChild.nodeValue;
-		setFieldValue( 'warningField', message );			
+    	//alert( message );
+		//setFieldValue( 'warningField', message );
+		setInnerHTML( 'warningField', message );
 		showWarning();
    }
    else
@@ -222,17 +224,36 @@
 {
   var selectedList = document.getElementById( 'selectedList' );
 
-  var list = new Array();
+ // var list = new Array();
+  
+  var params = 'indicatorGroupId=' + selectedIndicatorGroup;
+  
   for ( var i = 0; i < selectedList.options.length; ++i)
   {
   	//params += '&selectedIndicators=' + selectedList.options[i].value;
-	list[i] = selectedList.options[i].value;
+  	params += '&selectedIndicators=' + selectedList.options[i].value;
+	//list[i] = selectedList.options[i].value;
   }
   // Clear the list
   var availableList = document.getElementById( 'availableList' );
 
   availableList.options.length = 0;
+  
+ // alert(list);
+  //alert(list.length);
+  
+  var request = new Request();
+  request.setResponseTypeXML( 'indicatorgroup' );
+  request.setCallbackSuccess( filterByIndicatorGroupCompleted );
+  //request.send( url );
 
+  var requestString = "filterAvailableIndicatorsByIndicatorGroup.action";
+ // var params = "indicatorGroupId=" + selectedIndicatorGroup + "&selectedIndicators=" + list;
+  request.sendAsPost( params );
+  request.send( requestString ); 
+  
+ /* 
+  
    $.post("filterAvailableIndicatorsByIndicatorGroup.action",
 		{
 			indicatorGroupId : selectedIndicatorGroup,
@@ -242,6 +263,7 @@
 		{
 			filterByIndicatorGroupCompleted(data);
 		},'xml');
+		*/
 }
 
 function filterByIndicatorGroupCompleted( indicatorGroup )
@@ -256,6 +278,7 @@
     var indicator = indicatorList[i];
     var name = indicator.firstChild.nodeValue;
     var id = indicator.getAttribute( 'id' );
+   // var title = indicator.firstChild.nodeValue;
 
     availableList.add( new Option( name, id ), null );
   }

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseError.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseError.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/responseError.vm	2010-12-29 07:53:18 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="error">$!encoder.xmlEncode( $message )</message>

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/surveyList.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/surveyList.vm	2010-09-15 13:23:57 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/surveyList.vm	2010-12-29 07:53:18 +0000
@@ -80,6 +80,6 @@
 {
 	window.location.href="section.action?surveyId=" + surveyId;
 }
-var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
+var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_survey" ) , "'" )';
 var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'" )';
 </script>