dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15332
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5511: Disable all date fields, only click date-button to enter date-value ( Patient module ).
------------------------------------------------------------
revno: 5511
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-21 09:54:41 +0700
message:
Disable all date fields, only click date-button to enter date-value ( Patient module ).
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.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/javascript/report.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.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/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2011-12-20 09:47:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2011-12-21 02:54:41 +0000
@@ -14,7 +14,7 @@
<tr>
<td>$i18n.getString('program')</td>
<td>
- <select id='programId' name='programId' style='width:300px' onchange='showEventForm();'>
+ <select id='programId' name='programId' style='width:300px' onchange='loadEventForm();'>
<option value="">[ $i18n.getString('please_select') ]</option>
#foreach( $programInstance in $programInstances)
<option value="$programInstance.program.id" singleevent='$programInstance.program.singleEvent' programInstanceId='$programInstance.id'>$programInstance.program.name</option>
@@ -24,9 +24,10 @@
</tr>
<tr>
<td><label for="executionDate">$i18n.getString( "report_date" ) </label></td>
- <td><input type="text" id="executionDate" name="executionDate" disabled style="width:300px" value="$!format.formatDate( $programStageInstance.executionDate )" >
+ <td><input type="text" id="executionDate" name="executionDate" style="width:300px" value="$!format.formatDate( $programStageInstance.executionDate )" >
<script type="text/javascript">
datePickerValid( 'executionDate', false );
+ jQuery('#executionDate').datepicker( "disable" );
</script>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2011-12-20 09:47:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2011-12-21 02:54:41 +0000
@@ -2,7 +2,7 @@
function organisationUnitSelected( orgUnits )
{
hideById('dataEntryFormDiv');
- disable('executionDate');
+ disableDataPicker( 'executionDate' );
setFieldValue('executionDate', '');
$('#executionDate').unbind('change');
@@ -46,13 +46,13 @@
selection.setListenerFunction( organisationUnitSelected );
-function showEventForm()
+function loadEventForm()
{
+ hideById('dataEntryFormDiv');
setFieldValue('executionDate', '');
+ disableDataPicker( 'executionDate' );
+
var programId = getFieldValue('programId');
-
- hideById('dataEntryFormDiv');
-
if( programId == '' )
{
return;
@@ -75,7 +75,8 @@
}
else
{
- enable('executionDate');
+
+ enableDataPicker( 'executionDate' );
enable('createEventBtn');
disable('deleteCurrentEventBtn');
disable('completeBtn');
@@ -100,23 +101,18 @@
var programStageInstanceId = getFieldValue('programStageInstanceId');
if( programStageInstanceId == '' )
{
- enable('executionDate');
enable('createEventBtn');
disable('deleteCurrentEventBtn');
disable('completeBtn');
disable('validationBtn');
-
- //$('#executionDate').change(function() {
- // saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
- //});
-
+ enableDataPicker( 'executionDate' );
$('#executionDate').bind('change');
}
else
{
if( getFieldValue('completed') == 'true')
{
- disable('executionDate');
+ disableDataPicker( 'executionDate' );
enable('createEventBtn');
enable('deleteCurrentEventBtn');
disable('completeBtn');
@@ -124,16 +120,12 @@
}
else
{
- enable('executionDate');
disable('createEventBtn');
enable('deleteCurrentEventBtn');
enable('completeBtn');
enable('validationBtn');
-
- //$('#executionDate').change(function() {
- // saveExecutionDate( getFieldValue('programStageId'), getFieldValue('executionDate') );
- //});
- $('#executionDate').bind('change');
+ enableDataPicker( 'executionDate' );
+ jQuery('#executionDate').bind('change');
}
}
@@ -192,7 +184,7 @@
enable('createEventBtn');
setFieldValue('executionDate','');
- enable('executionDate');
+ enableDataPicker( 'executionDate' );
$('#executionDate').unbind('change');
selection.enable();
=== 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 2011-12-20 02:45:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2011-12-21 02:54:41 +0000
@@ -96,7 +96,7 @@
var completed = jQuery('#entryFormContainer input[id=completed]').val();
var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
- enable('executionDate');
+ enableDataPicker('dataRecordingSelectDiv input[id=executionDate]');
if( executionDate != '' && completed == 'false' )
{
enable('validationBtn');
@@ -106,7 +106,7 @@
{
disable('validationBtn');
disable('completeBtn');
- disable('executionDate');
+ disableDataPicker('dataRecordingSelectDiv input[id=executionDate]');
}
if( completed == 'true' && irregular == 'true' )
@@ -674,7 +674,7 @@
function markValue( color )
{
- var element = document.getElementById( 'executionDate' );
+ var element = byId( 'executionDate' );
element.style.backgroundColor = color;
}
@@ -772,7 +772,7 @@
disable('validationBtn');
disable('completeBtn');
- disable('executionDate');
+ disableDataPicker('executionDate');
var irregular = jQuery('#entryFormContainer [name=irregular]').val();
if( irregular == 'true')
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2011-10-04 02:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js 2011-12-21 02:54:41 +0000
@@ -15,9 +15,8 @@
if( json.programs.length == 0)
{
disable('programId');
- disable('startDate');
- disable('endDate');
- disable('endDate');
+ disableDataPicker('startDate');
+ disableDataPicker('endDate');
disable('generateBtn');
}
else
@@ -29,9 +28,8 @@
addOptionById( 'programId', json.programs[i].id, json.programs[i].name );
}
enable('programId');
- enable('startDate');
- enable('endDate');
- enable('endDate');
+ enableDataPicker('startDate');
+ enableDataPicker('endDate');
enable('generateBtn');
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2011-10-04 02:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2011-12-21 02:54:41 +0000
@@ -25,7 +25,7 @@
<tr>
<td><label>$i18n.getString( "start_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <input type="text" id="startDate" name="startDate" disabled class="{validate:{required:true}}" />
+ <input type="text" id="startDate" name="startDate" class="{validate:{required:true}}" />
<script type="text/javascript">
datePicker('startDate');
</script>
@@ -35,7 +35,7 @@
<tr>
<td><label>$i18n.getString( "end_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <input type="text" id="endDate" name="endDate" disabled class="{validate:{required:true}}" />
+ <input type="text" id="endDate" name="endDate" class="{validate:{required:true}}" />
<script type="text/javascript">
datePicker('endDate');
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-12-19 07:37:29 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-12-21 02:54:41 +0000
@@ -838,8 +838,9 @@
buttonImage: '../images/calendar.png',
buttonImageOnly: true,
constrainInput: true,
- yearRange: '-100:+100'
+ yearRange: '-100:+100',
});
+ disable( id );
s = jQuery("#" + id );
if( s.val()=='' ) s.val( getCurrentDate() );
}
@@ -859,6 +860,7 @@
constrainInput: true,
yearRange: '-100:+100'
});
+ disable( id );
if( today == undefined ) today = false;
@@ -883,8 +885,19 @@
constrainInput: true,
yearRange: '-100:+100'
});
-}
-
+ disable( id );
+}
+
+function enableDataPicker( id )
+{
+ jQuery('#' + id ).datepicker( "enable" );
+ disable( id );
+}
+
+function disableDataPicker( id )
+{
+ jQuery('#' + id ).datepicker( "disable" );
+}
/**
* Create jQuery datepicker for input text with id * *
*
@@ -906,6 +919,7 @@
constrainInput: true,
yearRange: '-100:+100'
});
+ disable( id );
if ( today == undefined )
{
@@ -958,6 +972,8 @@
dates.not(this).datepicker("option", option, date);
}
});
+ disable( startdate );
+ disable( enddate );
$("#ui-datepicker-div").hide();
}