← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8269: Add calendar for from/to dates to pre-defined ranges in activity plan.

 

------------------------------------------------------------
revno: 8269
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-26 16:39:48 +0700
message:
  Add calendar for from/to dates to pre-defined ranges in activity plan.
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/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.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-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	2012-09-26 05:19:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-26 09:39:48 +0000
@@ -462,4 +462,5 @@
 management = Management
 change_location = Change location
 user_access = User access
-history = History
\ No newline at end of file
+history = History
+use_calendar = Use calendar
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-21 09:04:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2012-09-26 09:39:48 +0000
@@ -67,6 +67,10 @@
 						<option value='-30'>$i18n.getString("one_month")</option>
 						<option value='ALL'>$i18n.getString("all")</option>
 					</select>
+					<input type='text' id='startDueDate' name='startDueDate' class='hidden'>
+				</td>
+				<td>
+					<input type='checkbox' id='useCalendar' name='useCalendar' onchange="displayCadendar();"> $i18n.getString('use_calendar')
 				</td>
 			</tr>
 			<tr>
@@ -79,6 +83,7 @@
 						<option value='30'>$i18n.getString("one_month")</option>
 						<option value='ALL'>$i18n.getString("all")</option>
 					</select>
+					<input type='text' id='endDueDate' name='endDueDate' class='hidden'>
 				</td>
 			</tr>
 			<tr>
@@ -97,8 +102,6 @@
 #parse( "dhis-web-commons/loader/loader.vm" )
 	
 <div class='hidden'>
-	<input type='text' id='startDueDate' name='startDueDate' >
-	<input type='text' id='endDueDate' name='endDueDate' >
 	<input type='textbox' id='currentDate' name='currentDate'>
 	<script>
 		datePicker( 'currentDate' );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-18 03:50:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2012-09-26 09:39:48 +0000
@@ -20,6 +20,27 @@
 
 selection.setListenerFunction( orgunitSelected );
 
+function displayCadendar()
+{
+	if( byId('useCalendar').checked )
+	{
+		hideById('showEventSince');
+		hideById('showEventUpTo');
+		showById('startDueDate');
+		showById('endDueDate');
+		datePickerInRangeValid( 'startDueDate' , 'endDueDate' );
+	}
+	else
+	{
+		showById('showEventSince');
+		showById('showEventUpTo');
+		hideById('startDueDate');
+		hideById('endDueDate');
+		jQuery('#startDueDate').datepicker("destroy");
+		jQuery('#endDueDate').datepicker("destroy");
+	}
+}
+
 function showActitityList()
 {
 	setFieldValue('listAll', "true");
@@ -104,24 +125,27 @@
 
 function statusEventOnChange()
 {
-	var statusEvent = getFieldValue("statusEvent");
-	
-	if( statusEvent == '1_2_3_4' 
-		|| statusEvent == '3_4' 
-		|| statusEvent == '2_3_4' ){
-		enable('showEventSince');
-		enable('showEventUpTo');
-		setDateRange();
-	}
-	else if( statusEvent == '3' ){
-		disable('showEventSince');
-		enable('showEventUpTo');
-		setDateRange();
-	}
-	else{
-		enable('showEventSince');
-		disable('showEventUpTo');
-		setDateRange();
+	if( !byId('useCalendar').checked )
+	{
+		var statusEvent = getFieldValue("statusEvent");
+		
+		if( statusEvent == '1_2_3_4' 
+			|| statusEvent == '3_4' 
+			|| statusEvent == '2_3_4' ){
+			enable('showEventSince');
+			enable('showEventUpTo');
+			setDateRange();
+		}
+		else if( statusEvent == '3' ){
+			disable('showEventSince');
+			enable('showEventUpTo');
+			setDateRange();
+		}
+		else{
+			enable('showEventSince');
+			disable('showEventUpTo');
+			setDateRange();
+		}
 	}
 }