← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9948: Minor fix for long/lat fields in entry form.

 

------------------------------------------------------------
revno: 9948
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-03-02 12:09:13 +0700
message:
  Minor fix for long/lat fields in entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css


--
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-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-02 05:09:13 +0000
@@ -561,4 +561,9 @@
 reenrol_success = Re-enroll successfully
 longitude = Longitude
 latitude = Latitude
-coordinates = Coordinates
\ No newline at end of file
+enter_a_value_less_than_or_equal_to_180 = Please enter a value less than or equal to 180.
+enter_a_value_greater_than_or_equal_to_nagetive_180 = Please enter a value greater than or equal to -180.
+enter_a_value_less_than_or_equal_to_90 = Please enter a value less than or equal to 90.
+enter_a_value_greater_than_or_equal_to_nagetive_90 = Please enter a value greater than or equal to -90.
+enter_values_for_longitude_and_latitude_fields = Please enter values for both longitude and latitude fields
+enter_a_valid_number = Please enter a valid number.
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-03-02 05:09:13 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.11-SNAPSHOT V14
+# 2.11-SNAPSHOT V22
 NETWORK:
 *
 CACHE:

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-03-02 05:09:13 +0000
@@ -11,9 +11,6 @@
 			setFieldValue( 'executionDate', "$!format.formatDate( $programStageInstance.executionDate )" );
 		#end
 		
-		validation( 'coordinatesForm', function(form){
-			saveCoordinatesEvent($!programStageInstance.id);
-		});
 		entryFormContainerOnReady();
 		
 	});
@@ -34,27 +31,17 @@
 <input type='hidden' name='blockEntryForm' id='blockEntryForm'  value='$!programStageInstance.programInstance.program.blockEntryForm'>
 
 <div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>					
-	<form id='coordinatesForm'>
-		#if($programStageInstance.programStage.captureCoordinates=='true')
-		<fieldset style="width:570px;">
-			<legend>$i18n.getString('coordinates')</legend>
-			<table>
-				<tr>
-					<td><label for="longitude">$i18n.getString( "longitude" )</label></td>
-					<td><input type="text" id="longitude" name="longitude" value="$!{longitude}" class="{validate:{number:true,min:-180,max:180}}"></td>
-				</tr>
-				<tr>
-					<td><label for="latitude">$i18n.getString( "latitude" )</label></td>
-					<td><input type="text" id="latitude" name="latitude" value="$!{latitude}" class="{validate:{number:true,min:-90,max:90}}"></td>
-				</tr>
-				<tr>
-					<td></td>
-					<td><input type='submit' value='$i18n.getString("save")' onclick="" /></td>
-				</tr>
-			</table>
-		</fieldset>
-		#end
-	</form>
+	#if($programStageInstance.programStage.captureCoordinates=='true')
+		<table style="width:740px;margin-top:-9px" class="listTable">
+			<tr>
+				<th class='coordinates1'><label for="longitude">$i18n.getString( "longitude" )</label></th>
+				<th class='coordinates2'><input type="text" class='criteria' id="longitude" name="longitude" value="$!{longitude}" class="{validate:{number:true,min:-180,max:180}}" placeholder='$i18n.getString("enter_a_number")' ></th>
+				<th class='coordinates1'><label for="latitude">$i18n.getString( "latitude" )</label></th>
+				<th class='coordinates2'><input type="text" class='criteria' id="latitude" name="latitude" value="$!{latitude}" class="{validate:{number:true,min:-90,max:90}}" placeholder='$i18n.getString("enter_a_number")' ></th>
+				<th><input type='button' value='$i18n.getString("save")' class='normal-button' onclick='saveCoordinatesEvent($!programStageInstance.id);' /></th>
+			</tr>
+		</table>
+	#end
 	
 	<br>
 	
@@ -107,6 +94,13 @@
 
 <script>
 	var i18n_create_new_event = '$encoder.jsEscape( $i18n.getString( "create_new_event" ) , "'" )';
+	var i18n_enter_a_value_less_than_or_equal_to_180 = '$encoder.jsEscape( $i18n.getString( "enter_a_value_less_than_or_equal_to_180" ) , "'" )';
+	var i18n_enter_a_value_greater_than_or_equal_to_nagetive_180 = '$encoder.jsEscape( $i18n.getString( "enter_a_value_greater_than_or_equal_to_nagetive_180" ) , "'" )';
+	var i18n_enter_a_value_less_than_or_equal_to_90 = '$encoder.jsEscape( $i18n.getString( "enter_a_value_less_than_or_equal_to_90" ) , "'" )';
+	var i18n_enter_a_value_greater_than_or_equal_to_nagetive_90 = '$encoder.jsEscape( $i18n.getString( "enter_a_value_greater_than_or_equal_to_nagetive_90" ) , "'" )';
+	var i18n_enter_values_for_longitude_and_latitude_fields = '$encoder.jsEscape( $i18n.getString( "enter_values_for_longitude_and_latitude_fields" ) , "'" )';
+	var i18n_enter_a_valid_number = '$encoder.jsEscape( $i18n.getString( "enter_a_valid_number" ) , "'" )';
+	
 	#if( $programStageInstance.programInstance.program.type=='1' && $programStageInstance.programInstance.completed=="true")
 		jQuery("[id=entryFormContainer] :input").prop('disabled', true);
 		jQuery("[id=entryFormContainer] :input").datepicker("destroy");

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2013-03-02 05:09:13 +0000
@@ -1917,15 +1917,56 @@
 
 function saveCoordinatesEvent(programStageInstanceId)
 {
-	jQuery.postJSON( "saveCoordinatesEvent.action",
-		{ 
-			programStageInstanceId:programStageInstanceId,
-			longitude: getFieldValue('longitude'),
-			latitude: getFieldValue('latitude')
-		}, 
-		function( json ) 
-		{   
-			 byId('longitude').style.backgroundColor = SUCCESS_COLOR;
-             byId('latitude').style.backgroundColor = SUCCESS_COLOR;
-		});
+	var longitude = jQuery.trim(getFieldValue('longitude'));
+	var latitude = jQuery.trim(getFieldValue('latitude'));
+	var isValid = true;
+	
+	if(longitude=='' || latitude==''){
+		alert(i18n_enter_values_for_longitude_and_latitude_fields);
+		isValid = false;
+	}	
+	else if(!isInt(longitude)){
+		byId('longitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_valid_number);
+		isValid = false;
+	}
+	else if(!isInt(latitude)){
+		byId('latitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_valid_number);
+		isValid = false;
+	}
+	else if(eval(longitude)>180){
+		byId('longitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_value_less_than_or_equal_to_180);
+		isValid = false;
+	}
+	else if(eval(longitude)<-180){
+		byId('longitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_value_greater_than_or_equal_to_nagetive_180);
+		isValid = false;
+	}
+	else if(eval(latitude)>90){
+		byId('latitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_value_less_than_or_equal_to_90);
+		isValid = false;
+	}
+	else if(eval(latitude)<-90){
+		byId('latitude').style.backgroundColor = '#ffcc00';
+		alert(i18n_enter_a_value_greater_than_or_equal_to_nagetive_90);
+		isValid = false;
+	}
+	
+	if( isValid ){
+		jQuery.postJSON( "saveCoordinatesEvent.action",
+			{ 
+				programStageInstanceId:programStageInstanceId,
+				longitude: longitude,
+				latitude: latitude
+			}, 
+			function( json ) 
+			{   
+				 byId('longitude').style.backgroundColor = SUCCESS_COLOR;
+				 byId('latitude').style.backgroundColor = SUCCESS_COLOR;
+			});
+	}
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-02-08 08:58:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-03-02 05:09:13 +0000
@@ -351,7 +351,6 @@
 					jQuery('#executionDate').val(executionDate);
 					jQuery("#org_" + programStageInstanceId ).html(getFieldValue("orgunitName"));
 					showById('inputCriteriaDiv');
-					
 					handleResponse (json);
 			   },
 			   error: function(request,status,errorThrown) {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2013-02-13 15:58:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2013-03-02 05:09:13 +0000
@@ -30,16 +30,17 @@
 					<div id='programInstanceDiv'>
 						#parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
 						<br>		
-						<table id='executionDateTB' name="executionDateTB" class='hidden'>
-							<tr>
-								<th class='text-column'><span id="reportDateDescriptionField">$i18n.getString( "report_date" )</span> <em title="$i18n.getString( "required" )" class="required">*</em> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
-								<th><input type="text" id="executionDate" name="executionDate" class='criteria' value="$!format.formatDate( $programStageInstance.executionDate )">
+						<table style="width:740px;" class="listTable">
+							<tr id='executionDateTB' name="executionDateTB" class='hidden'>
+								<th class='coordinates1'><span id="reportDateDescriptionField">$i18n.getString( "report_date" )</span> <em title="$i18n.getString( "required" )" class="required">*</em> </th>
+								<th class='coordinates2'><input type="text" id="executionDate" name="executionDate" class='criteria' value="$!format.formatDate( $programStageInstance.executionDate )">
 									<script type="text/javascript">
 									   datePickerValid( 'executionDate', false );
 									</script>
 								</th>
-								<th class='text-column'><label for="dueDate">$i18n.getString( "due_date" ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></th>
-								<th><input type="text" id="dueDate" name="dueDate" class='criteria' value="$!format.formatDate( $programStageInstance.dueDate )" readonly > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
+								<th class='coordinates1'><label for="dueDate">$i18n.getString( "due_date" ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label></th>
+								<th class='coordinates2'><input type="text" id="dueDate" name="dueDate" class='criteria' value="$!format.formatDate( $programStageInstance.dueDate )" readonly > </th>
+								<th></th>
 							</tr>
 						</table>
 					</div>
@@ -139,6 +140,10 @@
 			saveIdentifierAndAttribute( $programInstance.patient.id, $programInstance.program.id, 'patientPropertyForm' );
 		});	
 		
+		validation( 'coordinatesForm', function(form){
+			saveCoordinatesEvent($!programStageInstance.id);
+		});
+		
 		#if( $programInstance.completed)
 			jQuery("[id=tab-2] :input").prop('disabled', true);
 			jQuery("[id=tab-3] :input").prop('disabled', true);

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-03-01 09:15:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm	2013-03-02 05:09:13 +0000
@@ -4,8 +4,8 @@
 </div>
 
 <div id='patientInforTB' name="patientInforTB" style="display:none;">
-	<table>
-		#if( $patient )
+	#if( $patient )
+		<table>
 			<tr>            
 				<td>
 					<span class='bold' id="patientName">$i18n.getString( "full_name" ):</span>
@@ -33,20 +33,23 @@
 			</tr>
 			#end
 			<tr><td>&nbsp;</td></tr>
-		#end
+		</table>
+	#end
 		
-		#if( $programStageInstance )
-			<tr>
-				<th><label for="executionDate">$programStageInstance.programStage.reportDateDescription <em title="$i18n.getString( "required" )" class="required">*</em>&nbsp;&nbsp;&nbsp;</label></th>
-				<th><input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.programInstance.program.id, $programStageInstance.id, byId('executionDate') )" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
-					<script type="text/javascript">
-					   datePickerValid( 'executionDate', false );
-					</script>  
-				<th id="dueDateLbl"><label for="dueDate"> $i18n.getString( "due_date" ) &nbsp;&nbsp;&nbsp;</label></th>
-				<th id="dueDateField"><input type="text" id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled">&nbsp;&nbsp;&nbsp;</th>
-			</tr>
-		#end
+	#if( $programStageInstance )
+	<table style="width:740px;" class="listTable">
+		<tr>
+			<th class='coordinates1'><label for="executionDate">$programStageInstance.programStage.reportDateDescription <em title="$i18n.getString( "required" )" class="required">*</em> </label></th>
+			<th class='coordinates2'><input type="text" class='criteria' id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onchange="saveExecutionDate( $programStageInstance.programInstance.program.id, $programStageInstance.id, byId('executionDate') )" > </th>
+				<script type="text/javascript">
+				   datePickerValid( 'executionDate', false );
+				</script>  
+			<th class='coordinates1' id="dueDateLbl"><label for="dueDate"> $i18n.getString( "due_date" )</label> </th>
+			<th class='coordinates2' id="dueDateField"><input type="text" class='criteria' id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled"> </th>
+			<th></th>
+		</tr>
 	</table>
+	#end
 </div>
 
 <input type='hidden' id="programId" name="programId" type="text" readonly="readonly" value="$encoder.htmlEncode( $program.displayName )" style="min-width:350px">		

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2013-02-28 09:23:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2013-03-02 05:09:13 +0000
@@ -19,7 +19,7 @@
 	height: 30px;
 }
 
-input.normal-button[type="button"] 
+input.normal-button[type="button"] , input.normal-button[type="submit"] 
 {
     width: 60px;
 }
@@ -171,7 +171,7 @@
 
 input.criteria
 {
-	width: 150px;
+	width: 130px;
 	margin-right: 5px;
 }
 
@@ -514,3 +514,16 @@
     border-style: solid;
     border-color: #aaa;
 }
+
+
+/* --------------------------------------------------------------
+// Capture Coordinates
+// -------------------------------------------------------------- */
+
+.coordinates1{
+    width: 120px;
+}
+
+.coordinates2{
+    width: 180px;
+}
\ No newline at end of file