← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5644: Fixed bug: Data mart - Validation restrictions while creating or updating datamart export(finished)

 

------------------------------------------------------------
revno: 5644
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-30 15:29:42 +0700
message:
  Fixed bug: Data mart - Validation restrictions while creating or updating datamart export(finished)
modified:
  dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm
  dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.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-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm	2011-12-30 07:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm	2011-12-30 08:29:42 +0000
@@ -140,13 +140,15 @@
     </tr>
 	
 	<!-- Periods -->
-	
+	<tr>
+		<td colspan='3' class='listAlternateRow'>
+			<select id="periodsValidator" class="{validate:{required:true}}" style="display:none"/>
+		</td>
+	</tr>
 	<tr>
 		<th>$i18n.getString( "available_periods" )</th>
 		<td></td>
-		<th>$i18n.getString( "selected_periods" )
-			<select id="periodsValidator" class="{validate:{required:true}}" style="display:none"/>
-		</th>
+		<th>$i18n.getString( "selected_periods" )</th>
 	</tr>	
 	<tr>
 		<td>
@@ -185,10 +187,12 @@
     <!-- Relative periods -->
     
 	<tr>
-		<th colspan="3">$i18n.getString( "relative_periods" )</th>
+		<th colspan="3">$i18n.getString( "relative_periods" )
+			<select id="relativesPeriodsValidator" style="display:none"/>
+		</th>
 	</tr>
 	<tr>
-		<td colspan="3">
+		<td colspan="3" id='relativesPeriodsTD'>
 		    <label for="reportingMonth">$i18n.getString( "reporting_month" )</label>
 			<input type="checkbox" id="reportingMonth" name="reportingMonth" value="true"#if( $!export.relatives.isReportingMonth() ) checked#end/>&nbsp;
 			<label for="monthsThisYear">$i18n.getString( "months_this_year" )</label>

=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js	2011-10-04 05:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js	2011-12-30 08:29:42 +0000
@@ -15,6 +15,18 @@
 			listValidator( 'indicatorsValidator', 'selectedIndicators' );
 			listValidator( 'organisationunitsValidator', 'selectedOrganisationUnits' );
 			listValidator( 'periodsValidator', 'selectedPeriods' );
+			
+			if( byId('selectedPeriods').options.length == 0 )
+			{
+				if( $("input:checked").length > 0 )
+				{
+					$("#periodsValidator").rules("add",{required:false});
+				}
+				else
+				{
+					$("#periodsValidator").rules("add",{required:true});
+				}
+			}
 		},
 		'rules': getValidationRules( 'dataMart' )
 	} );