------------------------------------------------------------ revno: 11030 committer: Tran Chau <tran.hispviet...@gmail.com> branch nick: dhis2 timestamp: Tue 2013-05-28 10:10:26 +0700 message: Auto-select program when only one program is available in list. modified: 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/multiDataEntry.js dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm 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/searchPatientCriteria.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
-- 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/activityPlanSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-05-24 09:10:42 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm 2013-05-28 03:10:26 +0000 @@ -47,7 +47,11 @@ <td>$i18n.getString('program')</td> <td> <select id='programIdAddPatient' name='programIdAddPatient' class="{validate:{required:true}}" > - <option value="">[$i18n.getString("please_select")]</option> + #if($programs.size()==0) + <option value="">[$i18n.getString( "none_program" )]</option> + #elseif($programs.size()>1) + <option value="">[$i18n.getString( "please_select" )]</option> + #end #foreach($program in $programs) #if($program.type=='1') <option value="$program.id" type='$program.type'>$program.displayName</option> === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2013-05-12 14:37:19 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2013-05-28 03:10:26 +0000 @@ -17,12 +17,19 @@ jQuery.get("getPrograms.action",{}, function(json) { - jQuery( '#programIdAddPatient').append( '<option value="">' + i18n_please_select + '</option>' ); + var count = 0; for ( i in json.programs ) { if(json.programs[i].type==1){ + count ++; jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' ); } } + if(count==0){ + jQuery( '#programIdAddPatient').prepend( '<option value="" >' + i18n_none_program + '</option>' ); + } + else if(count>1){ + jQuery( '#programIdAddPatient').prepend( '<option value="" selected>' + i18n_please_select + '</option>' ); + } enableBtn(); hideById('programLoader'); jQuery('#programIdAddPatient').width(width); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2013-05-06 04:40:47 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js 2013-05-28 03:10:26 +0000 @@ -12,10 +12,18 @@ clearListById('programIdAddPatient'); $.postJSON( 'singleEventPrograms.action', {}, function( json ) { - jQuery( '#programIdAddPatient').append( '<option value="" programStageId="">[' + i18n_please_select + ']</option>' ); + var count = 0; for ( i in json.programs ) { jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' ); } + + if(json.programs.length==0){ + jQuery( '#programIdAddPatient').prepend( '<option value="" >' + i18n_none_program + '</option>' ); + } + else if(json.programs.length>1){ + jQuery( '#programIdAddPatient').prepend( '<option value="" selected>' + i18n_please_select + '</option>' ); + } + enableBtn(); hideById('programLoader'); jQuery('#programIdAddPatient').width(width); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2013-05-21 05:35:18 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2013-05-28 03:10:26 +0000 @@ -26,12 +26,20 @@ jQuery.get("getPrograms.action",{}, function(json) { - jQuery( '#programIdAddPatient').append( '<option value="">' + i18n_please_select + '</option>' ); + var count = 0; for ( i in json.programs ) { if(json.programs[i].type==1){ + count++; jQuery( '#programIdAddPatient').append( '<option value="' + json.programs[i].id +'" type="' + json.programs[i].type + '">' + json.programs[i].name + '</option>' ); } } + if(count==0){ + jQuery( '#programIdAddPatient').prepend( '<option value="" selected>' + i18n_none_program + '</option>' ); + } + else if(count>1){ + jQuery( '#programIdAddPatient').prepend( '<option value="" selected>' + i18n_please_select + '</option>' ); + } + enableBtn(); hideById('programLoader'); jQuery('#programIdAddPatient').width(width); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-04-10 04:35:21 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/multiDataEntrySelect.vm 2013-05-28 03:10:26 +0000 @@ -6,9 +6,14 @@ item.remove(); } }); + if(jQuery("#programIdAddPatient option").length==1) + { + jQuery("#programIdAddPatient [value=]").remove(); + } hideById('addPatientBtn'); - hideById('listPatientBtn'); + var i18n_list_events = '$encoder.jsEscape( $i18n.getString( "list_events" ) , "'")'; + setFieldValue('listPatientBtn', i18n_list_events); showById('dueDateTR'); showById('programStageAddPatientTR'); showById('scheduleVisitTR'); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2013-01-23 10:27:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2013-05-28 03:10:26 +0000 @@ -23,7 +23,11 @@ <td class='text-column'><label for="programId">$i18n.getString( "program" )</label></td> <td class='input-column'> <select id="programId" name="programId" onchange='programOnchange(this.value);'> - <option value="">[$i18n.getString( "select" )]</option> + #if($programs.size()==0) + <option value="">[$i18n.getString( "none_program" )]</option> + #elseif($programs.size()>1) + <option value="">[$i18n.getString( "please_select" )]</option> + #end #foreach( $program in $programs ) <option value="$program.id" programType='$program.type' displayIncidentDate='$!program.displayIncidentDate' === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm 2013-05-21 10:08:44 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageCompletenessSelect.vm 2013-05-28 03:10:26 +0000 @@ -30,7 +30,11 @@ <td>$i18n.getString('program')</td> <td> <select id='programId' name='programId' class="{validate:{required:true}}" > - <option value="">[$i18n.getString("please_select")]</option> + #if( $programs.size()== 0 ) + <option value=''>[$i18n.getString('none_program')]</option> + #elseif( $programs.size() > 1 ) + <option value=''>[$i18n.getString('please_select')]</option> + #end #foreach($program in $programs) <option value="$program.id" type='$program.type'>$program.displayName</option> #end === 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 2013-04-15 07:46:11 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm 2013-05-28 03:10:26 +0000 @@ -22,7 +22,11 @@ <td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td> <td> <select id="programId" name="programId" #if($!programs) #else disabled #end class="{validate:{required:true}}" > - <option value=''>[$i18n.getString('please_select_a_program')]</option> + #if( $programs.size()== 0 ) + <option value=''>[$i18n.getString('none_program')]</option> + #elseif( $programs.size() > 1 ) + <option value=''>[$i18n.getString('please_select')]</option> + #end #foreach( $program in $programs ) <option value='$program.id'>$program.displayName</option> #end === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2013-05-21 03:37:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2013-05-28 03:10:26 +0000 @@ -11,7 +11,7 @@ <td> <input type="text" id='orgunitName' readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end > </td> - <td rowspan='3' valign='bottom'> + <td rowspan='4' valign='bottom'> <input type="button" style='width:130px' id='listPatientBtn' style='260px;' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" > <input type="button" style='width:130px' id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();" > <input type="button" style='width:130px' id='advancedSearchBtn' value='$i18n.getString( "advanced_search" )' onclick="jQuery('#advanced-search').toggle();" > @@ -21,7 +21,11 @@ <td>$i18n.getString('program')</td> <td> <select id='programIdAddPatient' name='programIdAddPatient' onchange='enableBtn();'> + #if($programs.size()==0) + <option value="">[$i18n.getString( "none_program" )]</option> + #elseif($programs.size()>1) <option value='' type='2' id='emptyProgramOption'>[$i18n.getString("please_select")]</option> + #end #foreach($program in $programs) <option value="$program.id" type='$program.type'>$program.displayName</option> #end @@ -32,7 +36,7 @@ <tr id='scheduleVisitTR' class='hidden'> <td>$i18n.getString('scheduled_visits')</td> <td> - <select id='scheduledVisitDays' name='scheduledVisitDays' onchange='javascript:listAllPatient();' > + <select id='scheduledVisitDays' name='scheduledVisitDays' > <option value=''>[$i18n.getString("please_select")]</option> <option value='0'>$i18n.getString("today")</option> <option value='7'>$i18n.getString("last_7_days")</option> @@ -141,6 +145,8 @@ var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")'; var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")'; var i18n_view_all = '[' + '$encoder.jsEscape( $i18n.getString( "view_all" ) , "'")' + ']'; + var i18n_none_program = '[' + '$encoder.jsEscape( $i18n.getString( "none_program" ) , "'")' + ']'; + var i18n_please_select = '[' + '$encoder.jsEscape( $i18n.getString( "please_select" ) , "'")' + ']'; datePicker( 'startDueDate', true ); datePicker( 'endDueDate', true ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-05-03 14:18:26 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm 2013-05-28 03:10:26 +0000 @@ -6,6 +6,15 @@ item.remove(); } }); + if(jQuery("#programIdAddPatient option").length==0) + { + jQuery( '#programIdAddPatient').append( '<option value="" type="">' + i18n_none_program + '</option>' ); + } + else if(jQuery("#programIdAddPatient option").length==1) + { + jQuery("#programIdAddPatient [value=]").remove(); + } + disable('advancedSearchBtn'); hideById('removeEventLink'); setFieldValue('isSearchByProgram', true); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm 2013-03-11 16:14:54 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/statisticalProgramReportSelect.vm 2013-05-28 03:10:26 +0000 @@ -26,7 +26,11 @@ <td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td> <td> <select id="programId" name="programId" #if($!programs) #else disabled #end class="{validate:{required:true}}" > - <option value=''>[$i18n.getString('please_select_a_program')]</option> + #if( $programs.size()== 0 ) + <option value=''>[$i18n.getString('none_program')]</option> + #elseif( $programs.size() > 1 ) + <option value=''>[$i18n.getString('please_select')]</option> + #end #foreach( $program in $programs ) <option value='$program.id'>$program.displayName</option> #end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-05-27 05:30:40 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-05-28 03:10:26 +0000 @@ -411,4 +411,7 @@ patient_attribute_visit_schedule = Patient Attribute Visit Schedule patient_attribute_visit_schedule_form = Patient attribute visit schedule intro_patient_attribute_visit_schedule = Allow to configure which person attributes that are added to the visit schedule.This is very useful when the list is printed and used for tracking in the community. -selected_program_stages = Selected program stages \ No newline at end of file +selected_program_stages = Selected program stages +list_events = List events +none_program = None program +none_dataset = None dataset \ No newline at end of file
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp