dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17723
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7167: (mobile) Sending SMS to Person/Patient - Fixed GUI.
------------------------------------------------------------
revno: 7167
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-04 15:37:52 +0700
message:
(mobile) Sending SMS to Person/Patient - Fixed GUI.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/patient.css
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/question.png
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm
--
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/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-06-04 08:37:52 +0000
@@ -821,7 +821,7 @@
$.ajax({
url: 'searchRegistrationPatient.action',
type:"POST",
- data: getParamsForDiv('searchPatientDiv'),
+ data: getParamsForDiv( 'searchPatientDiv' ),
success: function( html ){
statusSearching = 1;
setInnerHTML( 'listPatientDiv', html );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-06-04 06:37:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-06-04 08:37:52 +0000
@@ -110,4 +110,15 @@
please_select_village=Please select village
please_select=Please Select
activity_grouping_attribute=Activity Grouping Attribute
-sms_configuration_not_initialized=SMS Service is not initialized.\nPlease fill in two fields as below then click "Save Settings".
\ No newline at end of file
+sms_configuration_not_initialized=SMS Service is not initialized.\nPlease fill in two fields as below then click "Save Settings".
+search_details=Search details
+male=Male
+female=Female
+age=Age
+full_name=Full name
+no_phone=No phone
+add_phone_to_list=Add phone to list
+hierachy_orgunit=Hierarchy organisation unit
+total_result=Total number of results
+search_result_matching_the_search_criteria=Result matches the search criteria
+search_patients_by_attributes=Search persons by attributes
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-06-04 06:37:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-06-04 08:37:52 +0000
@@ -66,6 +66,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm</param>
<param name="menu">/dhis-web-maintenance-mobile/menuWithTree.vm</param>
+ <param name="stylesheets">css/patient.css</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
<param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
</action>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css 2012-05-24 05:13:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css 1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
-table
-{
- margin-bottom:10px;
- font-size: 13px;
- line-height:18px;
-}
-
-input.button
-{
- width: 150px;
- padding-left:5px;
- padding-right:5px;
-}
-
-input.imgButton
-{
- width:20px;
- height:20px;
- cursor: pointer;
-}
-
-.hidden
-{
- display:none;
-}
-
-.text-column
-{
- text-align:left;
- padding-right:20px;
- padding-left:5px;
-}
-
-.infor
-{
- border:1px solid #808080;
- vertical-align:top;
- padding:10px;
-}
-
-.buttons
-{
- text-align:right;
- padding-bottom:10px;
- width:100%;
-}
-
-.list-table
-{
- width:100%;
-}
-
-.heading-column { width : 450px;}
-td.input-column { width : 390px;}
-td.input-column input[type="text"]{ width: 360px;}
-td.input-column select { width: 367px;}
-td.error {padding-left:1em}
-
-.infor td{vertical-align: top;}
-
-.focusCell{background-color: #AFCCFF}
-.errorCell{background-color: #FFCFCF}
-.sectionOpen {display: true}
-.sectionClose{ display: none}
-.togglePanel.open {height:25px;padding-left:25px; background-image: url(../images/open.gif) ; background-repeat: no-repeat; background-position: top left}
-.togglePanel.close {height:25px;padding-left:25px; background-image: url(../images/close.gif) ; background-repeat: no-repeat; background-position: top left}
-
-#facilityCol
-{
- width: 130px;
-}
-
-fieldset
-{
- border: 1px solid #3f5d8e;
-}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/patient.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/patient.css 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/patient.css 2012-06-04 08:37:52 +0000
@@ -0,0 +1,90 @@
+table
+{
+ margin-bottom:10px;
+ font-size: 13px;
+ line-height:18px;
+}
+
+input.button
+{
+ width: 150px;
+ padding-left:5px;
+ padding-right:5px;
+}
+
+input.imgButton
+{
+ width:20px;
+ height:20px;
+ cursor: pointer;
+}
+
+.hidden
+{
+ display:none;
+}
+
+.text-column
+{
+ text-align:left;
+ padding-right:20px;
+ padding-left:5px;
+}
+
+.infor
+{
+ border:1px solid #808080;
+ vertical-align:top;
+ padding:10px;
+}
+
+.buttons
+{
+ text-align:right;
+ padding-bottom:10px;
+ width:100%;
+}
+
+.list-table
+{
+ width:100%;
+}
+
+.heading-column { width : 450px;}
+td.input-column { width : 390px;}
+td.input-column input[type="text"]{ width: 360px;}
+td.input-column select { width: 367px;}
+td.error {padding-left:1em}
+
+.infor td{vertical-align: top;}
+
+.focusCell{background-color: #AFCCFF}
+.errorCell{background-color: #FFCFCF}
+.sectionOpen {display: true}
+.sectionClose{ display: none}
+.togglePanel.open {height:25px;padding-left:25px; background-image: url(../images/open.gif) ; background-repeat: no-repeat; background-position: top left}
+.togglePanel.close {height:25px;padding-left:25px; background-image: url(../images/close.gif) ; background-repeat: no-repeat; background-position: top left}
+
+.warnmessage {
+ color: red;
+}
+
+#facilityCol
+{
+ width: 130px;
+}
+
+fieldset
+{
+ border: 1px solid #3f5d8e;
+}
+
+.overlaps
+{
+ background-color: #BAFFBC;
+ border: 1px solid #12CD17;
+ display: none;
+ margin: 1em;
+ padding: 1em;
+ width: 500px;
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/question.png'
Binary files dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/question.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/images/question.png 2012-06-04 08:37:52 +0000 differ
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js 2012-05-09 02:52:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js 1970-01-01 00:00:00 +0000
@@ -1,235 +0,0 @@
-
-function verifiedOnchange( container ){
-
- var checked = byId( 'verified' ).checked;
- if( checked )
- {
- disable( 'age' );
- }
- else
- {
- enable( 'age' );
- }
-}
-
-// ----------------------------------------------------------------------------
-// Search patients by name
-// ----------------------------------------------------------------------------
-
-function getPatientsByName( divname )
-{
- var fullName = jQuery('#' + divname + ' [id=fullName]').val().replace(/^\s+|\s+$/g,"");
- if( fullName.length > 0)
- {
- contentDiv = 'resultSearchDiv';
- $('#resultSearchDiv' ).load("getPatientsByName.action",
- {
- fullName: fullName
- }).dialog({
- title: i18n_search_result,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{ background:'#000000', opacity: 0.8},
- width: 800,
- height: 400
- });
- }
- else
- {
- alert( i18n_no_patients_found );
- }
-}
-
-// -----------------------------------------------------------------------------
-// Advanced search
-// -----------------------------------------------------------------------------
-
-function addAttributeOption()
-{
- var rowId = 'advSearchBox' + jQuery('#advancedSearchTB select[name=searchingAttributeId]').length + 1;
- var contend = '<td>' + getInnerHTML('searchingAttributeIdTD') + '</td>';
- contend += '<td>' + searchTextBox ;
- contend += '<input type="button" value="-" onclick="removeAttributeOption(' + "'" + rowId + "'" + ');"></td>';
- contend = '<tr id="' + rowId + '">' + contend + '</tr>';
-
- jQuery('#advancedSearchTB > tbody:last').append( contend );
-}
-
-function removeAttributeOption( rowId )
-{
- jQuery( '#' + rowId ).remove();
-}
-
-//------------------------------------------------------------------------------
-// Search patients by selected attribute
-//------------------------------------------------------------------------------
-
-function searchingAttributeOnChange( this_ )
-{
- var container = jQuery(this_).parent().parent().attr('id');
- var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val();
- var element = jQuery('#' + container+ ' [id=searchText]');
- var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType');
-
- if( attributeId == '-1' )
- {
- element.replaceWith( getDateField( container ) );
- datePickerValid( 'searchDateField-' + container + ' [id=searchText]' );
- }
- else if( attributeId == '0' )
- {
- element.replaceWith( programComboBox );
- }
- else if ( valueType=='YES/NO' )
- {
- element.replaceWith( trueFalseBox );
- }
- else
- {
- element.replaceWith( searchTextBox );
- }
-}
-
-function getDateField( container )
-{
- var dateField = '<div id="searchDateField-' + container + '" > <input type="text" id="searchText" name="searchText" maxlength="30" style="width:18em" onkeyup="searchPatientsOnKeyUp( event );"></div>';
- return dateField;
-}
-
-//-----------------------------------------------------------------------------
-// Search Patient
-//-----------------------------------------------------------------------------
-
-function searchPatientsOnKeyUp( event )
-{
- var key = getKeyCode( event );
-
- if ( key==13 )// Enter
- {
- searchAdvancedPatients()();
- }
-}
-
-function getKeyCode(e)
-{
- if (window.event)
- return window.event.keyCode;
- return (e)? e.which : null;
-}
-
-function searchAdvancedPatients()
-{
- hideById( 'listPatientDiv' );
- var searchTextFields = jQuery('[name=searchText]');
- var flag = true;
- jQuery( searchTextFields ).each( function( i, item )
- {
- if( jQuery( item ).val() == '' )
- {
- showWarningMessage( i18n_specify_search_criteria );
- flag = false;
- }
- });
-
- if(!flag) return;
-
- contentDiv = 'listPatientDiv';
- jQuery( "#loaderDiv" ).show();
- searchPatient();
-
-}
-
-// ----------------------------------------------------------------------------
-// Show patients
-// ----------------------------------------------------------------------------
-
-function isDeathOnChange()
-{
- var isDeath = byId('isDead').checked;
- if(isDeath)
- {
- showById('deathDateTR');
- }
- else
- {
- hideById('deathDateTR');
- }
-}
-
-// ----------------------------------------------------------------
-// Get Params form Div
-// ----------------------------------------------------------------
-
-function getParamsForDiv( patientDiv)
-{
- var params = '';
- jQuery("#" + patientDiv + " :input").each(function()
- {
- var elementId = $(this).attr('id');
-
- if( $(this).attr('type') == 'checkbox' )
- {
- var checked = jQuery(this).attr('checked') ? true : false;
- params += elementId + "=" + checked + "&";
- }
- else if( $(this).attr('type') != 'button' )
- {
- var value = "";
- if( jQuery(this).val() != '' )
- {
- value = htmlEncode(jQuery(this).val());
- }
- params += elementId + "="+ value + "&";
- }
- });
-
- return params;
-}
-
-// -----------------------------------------------------------------------------
-// View patient details
-// -----------------------------------------------------------------------------
-
-function showPatientDetails( patientId )
-{
- $('#detailsInfo').load("getPatientDetails.action",
- {
- id:patientId
- }
- , function( ){
- }).dialog({
- title: i18n_patient_details,
- maximize: true,
- closable: true,
- modal:false,
- overlay:{background:'#000000', opacity:0.1},
- width: 450,
- height: 300
- });
-}
-
-function showPatientHistory( patientId )
-{
- $('#detailsInfo').load("getPatientHistory.action",
- {
- patientId:patientId
- }
- , function( ){
-
- }).dialog({
- title: i18n_patient_details_and_history,
- maximize: true,
- closable: true,
- modal:false,
- overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 520
- });
-}
-
-function exportPatientHistory( patientId, type )
-{
- var url = "getPatientHistory.action?patientId=" + patientId + "&type=" + type;
- window.location.href = url;
-}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js 2012-05-29 15:37:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js 1970-01-01 00:00:00 +0000
@@ -1,891 +0,0 @@
-var COLOR_GREEN = '#b9ffb9';
-var COLOR_YELLOW = '#fffe8c';
-var COLOR_WHITE = '#ffffff';
-var COLOR_ORANGE = '#ff6600';
-var COLOR_RED = '#ff8a8a';
-var COLOR_GREY = '#cccccc';
-
-function organisationUnitSelected( orgUnits, orgunitNames )
-{
- showById('selectDiv');
- hideById('listPatientDiv');
- showById('searchPatientDiv');
- setFieldValue('selectedOrgunitText', orgunitNames[0] );
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-
-// -----------------------------------------------------------------------------
-// Remove patient
-// -----------------------------------------------------------------------------
-
-function removePatient( patientId, fullName )
-{
- removeItem( patientId, fullName, i18n_confirm_delete, 'removePatient.action' );
-}
-
-function sortPatients()
-{
- hideById( 'listPatientDiv' );
-
- contentDiv = 'listPatientDiv';
- jQuery( "#loaderDiv" ).show();
- jQuery('#listPatientDiv').load("searchRegistrationPatient.action",
- {
- sortPatientAttributeId: getFieldValue('sortPatientAttributeId')
- }
- , function(){
- showById('listPatientDiv');
- jQuery( "#loaderDiv" ).hide();
- });
-}
-
-// -----------------------------------------------------------------------------
-// Add Patient
-// -----------------------------------------------------------------------------
-
-function validateAddPatient()
-{
- $("#editPatientDiv :input").attr("disabled", true);
- $.ajax({
- type: "POST",
- url: 'validatePatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success:addValidationCompleted
- });
-}
-
-function addValidationCompleted( data )
-{
- var type = jQuery(data).find('message').attr('type');
- var message = jQuery(data).find('message').text();
-
- if ( type == 'success' )
- {
- removeDisabledIdentifier( );
- addPatient( );
- }
- else
- {
- $("#editPatientDiv :input").attr("disabled", true);
- if ( type == 'error' )
- {
- showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- showWarningMessage( message );
- }
- else if( type == 'duplicate' )
- {
- showListPatientDuplicate(data, false);
- }
-
- $("#editPatientDiv :input").attr("disabled", false);
- }
-}
-
-
-// -----------------------------------------------------------------------------
-// Update Patient
-// -----------------------------------------------------------------------------
-
-function validateUpdatePatient()
-{
- $("#editPatientDiv :input").attr("disabled", true);
- $.ajax({
- type: "POST",
- url: 'validatePatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success:updateValidationCompleted
- });
-}
-
-function updateValidationCompleted( messageElement )
-{
- var type = jQuery(messageElement).find('message').attr('type');
- var message = jQuery(messageElement).find('message').text();
-
- if ( type == 'success' )
- {
- removeDisabledIdentifier();
- updatePatient();
- }
- else
- {
- $("#editPatientDiv :input").attr("disabled", true);
- if ( type == 'error' )
- {
- showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- showWarningMessage( message );
- }
- else if( type == 'duplicate' )
- {
- showListPatientDuplicate(messageElement, true);
- }
- $("#editPatientDiv :input").attr("disabled", false);
- }
-}
-// get and build a param String of all the identifierType id and its value
-// excluding inherited identifiers
-function getIdParams()
-{
- var params = "";
- jQuery("input.idfield").each(function(){
- if( jQuery(this).val() && !jQuery(this).is(":disabled") )
- params += "&" + jQuery(this).attr("name") +"="+ jQuery(this).val();
- });
- return params;
-}
-
-// -----------------------------------------------------------------------------
-// check duplicate patient
-// -----------------------------------------------------------------------------
-
-function checkDuplicate( divname )
-{
- $.postUTF8( 'validatePatient.action',
- {
- fullName: jQuery( '#' + divname + ' [id=fullName]' ).val(),
- dobType: jQuery( '#' + divname + ' [id=dobType]' ).val(),
- gender: jQuery( '#' + divname + ' [id=gender]' ).val(),
- birthDate: jQuery( '#' + divname + ' [id=birthDate]' ).val(),
- age: jQuery( '#' + divname + ' [id=age]' ).val()
- }, function( xmlObject, divname )
- {
- checkDuplicateCompleted( xmlObject, divname );
- });
-}
-
-function checkDuplicateCompleted( messageElement, divname )
-{
- checkedDuplicate = true;
- var type = jQuery(messageElement).find('message').attr('type');
- var message = jQuery(messageElement).find('message').text();
-
- if( type == 'success')
- {
- showSuccessMessage(i18n_no_duplicate_found);
- }
- if ( type == 'input' )
- {
- showWarningMessage(message);
- }
- else if( type == 'duplicate' )
- {
- showListPatientDuplicate( messageElement, true );
- }
-}
-/**
- * Show list patient duplicate by jQuery thickbox plugin
- * @param rootElement : root element of the response xml
- * @param validate : is TRUE if this method is called from validation method
- */
-function showListPatientDuplicate( rootElement, validate )
-{
- var message = jQuery(rootElement).find('message').text();
- var patients = jQuery(rootElement).find('patient');
-
- var sPatient = "";
- jQuery( patients ).each( function( i, patient )
- {
- sPatient += "<hr style='margin:5px 0px;'><table>";
- sPatient += "<tr><td class='bold'>" + i18n_patient_system_id + "</td><td>" + jQuery(patient).find('systemIdentifier').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_full_name + "</td><td>" + jQuery(patient).find('fullName').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_gender + "</td><td>" + jQuery(patient).find('gender').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_date_of_birth + "</td><td>" + jQuery(patient).find('dateOfBirth').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_age + "</td><td>" + jQuery(patient).find('age').text() + "</td></tr>" ;
- sPatient += "<tr><td class='bold'>" + i18n_patient_phone_number + "</td><td>" + jQuery(patient).find('phoneNumber').text() + "</td></tr>";
-
- var identifiers = jQuery(patient).find('identifier');
- if( identifiers.length > 0 )
- {
- sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_identifiers + "</td></tr>";
-
- jQuery( identifiers ).each( function( i, identifier )
- {
- sPatient +="<tr class='identifierRow'>"
- +"<td class='bold'>" + jQuery(identifier).find('name').text() + "</td>"
- +"<td>" + jQuery(identifier).find('value').text() + "</td> "
- +"</tr>";
- });
- }
-
- var attributes = jQuery(patient).find('attribute');
- if( attributes.length > 0 )
- {
- sPatient += "<tr><td colspan='2' class='bold'>" + i18n_patient_attributes + "</td></tr>";
-
- jQuery( attributes ).each( function( i, attribute )
- {
- sPatient +="<tr class='attributeRow'>"
- +"<td class='bold'>" + jQuery(attribute).find('name').text() + "</td>"
- +"<td>" + jQuery(attribute).find('value').text() + "</td> "
- +"</tr>";
- });
- }
- sPatient += "<tr><td colspan='2'><input type='button' id='"+ jQuery(patient).find('id').first().text() + "' value='" + i18n_edit_this_patient + "' onclick='showUpdatePatientForm(this.id)'/></td></tr>";
- sPatient += "</table>";
- });
-
- var result = i18n_duplicate_warning;
- if( !validate )
- {
- result += "<input type='button' value='" + i18n_create_new_patient + "' onClick='removeDisabledIdentifier( );addPatient();'/>";
- result += "<br><hr style='margin:5px 0px;'>";
- }
-
- result += "<br>" + sPatient;
- jQuery('#resultSearchDiv' ).html( result );
- jQuery('#resultSearchDiv' ).dialog({
- title: i18n_duplicated_patient_list,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 400
- });
-}
-
-// -----------------------------------------------------------------------------
-// Show representative form
-// -----------------------------------------------------------------------------
-
-function toggleUnderAge(this_)
-{
- if( jQuery(this_).is(":checked"))
- {
- jQuery('#representativeDiv').dialog('destroy').remove();
- jQuery('<div id="representativeDiv">' ).load( 'showAddRepresentative.action' ).dialog({
- title: i18n_child_representative,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 800,
- height: 450
- });
- }else
- {
- jQuery("#representativeDiv :input.idfield").each(function(){
- if( jQuery(this).is(":disabled"))
- {
- jQuery(this).removeAttr("disabled").val("");
- }
- });
- jQuery("#representativeId").val("");
- jQuery("#relationshipTypeId").val("");
- }
-}
-
-// ----------------------------------------------------------------
-// Add Patient
-// ----------------------------------------------------------------
-
-function showAddPatientForm()
-{
- hideById('listPatientDiv');
- hideById('selectDiv');
- hideById('searchPatientDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#editPatientDiv').load('showAddPatientForm.action'
- , function()
- {
- showById('editPatientDiv');
- jQuery('#loaderDiv').hide();
- });
-
-}
-
-function addPatient()
-{
- $.ajax({
- type: "POST",
- url: 'addPatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success: function(json) {
- var type = json.response;
- showProgramEnrollmentSelectForm( json.message );
- jQuery('#resultSearchDiv').dialog('close');
- }
- });
- return false;
-}
-
-// ----------------------------------------------------------------
-// Update Patient
-// ----------------------------------------------------------------
-
-function showUpdatePatientForm( patientId )
-{
- hideById('listPatientDiv');
- setInnerHTML('editPatientDiv', '');
- hideById('selectDiv');
- hideById('searchPatientDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#editPatientDiv').load('showUpdatePatientForm.action',
- {
- id:patientId
- }, function()
- {
- showById('editPatientDiv');
- jQuery('#searchPatientsDiv').dialog('close');
- jQuery('#loaderDiv').hide();
- });
-
- jQuery('#resultSearchDiv').dialog('close');
-}
-
-function updatePatient()
-{
- $.ajax({
- type: "POST",
- url: 'updatePatient.action',
- data: getParamsForDiv('editPatientDiv'),
- success: function( json ) {
- showProgramEnrollmentSelectForm( getFieldValue('id') );
- }
- });
-}
-
-// ----------------------------------------------------------------
-// Enrollment program
-// ----------------------------------------------------------------
-
-function showProgramEnrollmentSelectForm( patientId )
-{
- hideById('listPatientDiv');
- hideById('editPatientDiv');
- hideById('selectDiv');
- hideById('searchPatientDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#enrollmentDiv').load('showProgramEnrollmentForm.action',
- {
- id:patientId
- }, function()
- {
- showById('enrollmentDiv');
-
- jQuery('#loaderDiv').hide();
- });
-}
-
-function showProgramEnrollmentForm( patientId, programId )
-{
- if( programId == 0 )
- {
- jQuery('#enrollBtn').attr('value',i18n_enroll_to_program);
- hideEnrolmentField();
-
- hideById('programEnrollmentDiv');
-
- return;
- }
-
- jQuery('#loaderDiv').show();
- jQuery('#programEnrollmentDiv').load('enrollmentform.action',
- {
- patientId:patientId,
- programId:programId
- }, function()
- {
- showById('programEnrollmentDiv');
- showEnrolmentField();
-
- var singleEvent = jQuery('#enrollmentDiv [name=programId] option:selected').attr('singleevent');
-
- if(singleEvent=='true')
- {
- hideEnrolmentField();
- }
- else
- {
- showEnrolmentField();
- var hideDateOfIncident = jQuery('#programEnrollmentSelectDiv [name=programId] option:selected').attr('hidedateofincident');
-
- if( hideDateOfIncident=='true')
- {
- hideById( 'dateOfIncidentTR');
- }
- else
- {
- showById( 'dateOfIncidentTR');
- }
- }
-
- jQuery('#loaderDiv').hide();
- });
-}
-
-function validateProgramEnrollment()
-{
- $.ajax({
- type: "GET",
- url: 'validatePatientProgramEnrollment.action',
- data: getParamsForDiv('programEnrollmentSelectDiv'),
- success: function(json) {
- hideById('message');
- var type = json.response;
- if ( type == 'success' )
- {
- saveProgramEnrollment();
- }
- else if ( type == 'error' )
- {
- setMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- setMessage( json.message );
- }
- }
- });
- return false;
-}
-
-function saveProgramEnrollment()
-{
- $.ajax({
- type: "POST",
- url: 'saveProgramEnrollment.action',
- data: getParamsForDiv('programEnrollmentSelectDiv'),
- success: function( html ) {
- setInnerHTML('programEnrollmentDiv', html );
- jQuery('#enrollBtn').attr('value',i18n_update);
- showSuccessMessage( i18n_enrol_success );
- }
- });
- return false;
-}
-
-// ----------------------------------------------------------------
-// Un-Enrollment program
-// ----------------------------------------------------------------
-
-function showUnenrollmentSelectForm( patientId )
-{
- hideById('listPatientDiv');
- hideById('editPatientDiv');
- hideById('selectDiv');
- hideById('searchPatientDiv');
- hideById('migrationPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#enrollmentDiv').load('showProgramUnEnrollmentForm.action',
- {
- patientId:patientId
- }, function()
- {
- showById('enrollmentDiv');
- jQuery('#loaderDiv').hide();
- });
-}
-
-function showUnenrollmentForm( programInstanceId )
-{
- if( programInstanceId == 0 )
- {
- hideById( 'unenrollmentFormDiv' );
- return;
- }
-
- jQuery('#loaderDiv').show();
- jQuery.getJSON( "getProgramInstance.action",
- {
- programInstanceId:programInstanceId
- },
- function( json )
- {
- showById( 'unenrollmentFormDiv' );
- jQuery( "#loaderDiv" ).hide();
- });
-}
-
-function unenrollmentForm( programInstanceId )
-{
- if( programInstanceId == 0 )
- {
- disable('enrollBtn');
- return;
- }
-
- $.ajax({
- type: "POST",
- url: 'removeEnrollment.action',
- data: getParamsForDiv('enrollmentDiv'),
- success: function( json )
- {
- showSuccessMessage( i18n_unenrol_success );
- hideEnrolmentField( 'enrollmentDateTR' );
- jQuery('#enrollmentDiv [name=programId]').val('0');
- hideById( 'programEnrollmentDiv' );
- }
- });
-}
-
-//-----------------------------------------------------------------------------
-//Save
-//-----------------------------------------------------------------------------
-
-function saveDueDate( programStageInstanceId, programStageInstanceName )
-{
- var field = document.getElementById( 'value_' + programStageInstanceId + '_date' );
-
- var dateOfIncident = new Date( byId('dateOfIncident').value );
- var dueDate = new Date(field.value);
-
- if( dueDate < dateOfIncident )
- {
- field.style.backgroundColor = '#FFCC00';
- alert( i18n_date_less_incident );
- return;
- }
-
- field.style.backgroundColor = '#ffffcc';
-
- var dateDueSaver = new DateDueSaver( programStageInstanceId, field.value, '#ccffcc' );
- dateDueSaver.save();
-}
-
-//----------------------------------------------------
-// Show relationship with new patient
-//----------------------------------------------------
-
-function showRelationshipList( patientId )
-{
- hideById('addRelationshipDiv');
-
- if ( getFieldValue('isShowPatientList') == 'false' )
- {
- hideById('selectDiv');
- hideById('searchPatientDiv');
- hideById('listPatientDiv');
-
- jQuery('#loaderDiv').show();
- jQuery('#listRelationshipDiv').load('showRelationshipList.action',
- {
- id:patientId
- }, function()
- {
- showById('listRelationshipDiv');
- jQuery('#loaderDiv').hide();
- });
- }
- else
- {
- loadPatientList();
- }
-}
-
-// ----------------------------------------------------------------
-// Click Back to Search button
-// ----------------------------------------------------------------
-
-function onClickBackBtn()
-{
- showById('selectDiv');
- showById('searchPatientDiv');
- showById('listPatientDiv');
-
- hideById('editPatientDiv');
- hideById('enrollmentDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('migrationPatientDiv');
-}
-
-function loadPatientList()
-{
- hideById('editPatientDiv');
- hideById('enrollmentDiv');
- hideById('listRelationshipDiv');
- hideById('addRelationshipDiv');
- hideById('dataRecordingSelectDiv');
- hideById('dataEntryFormDiv');
- hideById('migrationPatientDiv');
-
- showById('selectDiv');
- showById('searchPatientDiv');
-
- if( statusSearching == 0)
- {
- loadAllPatients();
- }
- else if( statusSearching == 1 )
- {
- searchAdvancedPatients();
- }
-}
-
-// -----------------------------------------------------------------------------
-// Load all patients
-// -----------------------------------------------------------------------------
-
-function loadAllPatients()
-{
- hideById('listPatientDiv');
-
- var sortPatientAttributeId = getFieldValue('sortPatientAttributeId');
-
- jQuery('#loaderDiv').show();
- contentDiv = 'listPatientDiv';
- jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{
- listAll:true,
- sortPatientAttributeId: (sortPatientAttributeId ? sortPatientAttributeId : "")
- },
- function(){
- statusSearching = 0;
- showById('listPatientDiv');
- jQuery('#loaderDiv').hide();
- });
- hideLoader();
-}
-
-function addPhoneToList( elementList, _id, _patientName, _phoneNo )
-{
- var list = jQuery( "#" + elementList );
- list.append( "<option value='" + _id + "'>\"" + _patientName + " <" + _phoneNo + ">" + "\"</option>" );
-
- jQuery( "tr#tr" + _id ).hide();
-}
-
-
-function removePhoneFromList( elementList, _id )
-{
- var list = jQuery( "#" + elementList + " option[value='" + _id + "']" ).remove();
-
- jQuery( "tr#tr" + _id ).show();
-}
-
-//-----------------------------------------------------------------------------
-// Saver objects
-//-----------------------------------------------------------------------------
-
-function DateDueSaver( programStageInstanceId_, dueDate_, resultColor_ )
-{
- var programStageInstanceId = programStageInstanceId_;
- var dueDate = dueDate_;
- var resultColor = resultColor_;
-
- this.save = function()
- {
- var params = 'programStageInstanceId=' + programStageInstanceId + '&dueDate=' + dueDate;
- $.ajax({
- type: "POST",
- url: "saveDueDate.action",
- data: params,
- dataType: "xml",
- success: function(result){
- handleResponse (result);
- },
- error: function(request,status,errorThrown) {
- handleHttpError (request);
- }
- });
- };
-
- function handleResponse( rootElement )
- {
- var codeElement = rootElement.getElementsByTagName( 'code' )[0];
- var code = parseInt( codeElement.firstChild.nodeValue );
-
- if ( code == 0 )
- {
- markValue( resultColor );
- }
- else
- {
- markValue( COLOR_GREY );
- window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
- }
- }
-
- function handleHttpError( errorCode )
- {
- markValue( COLOR_GREY );
- window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
- }
-
- function markValue( color )
- {
-
- var element = document.getElementById( 'value_' + programStageInstanceId + '_date' );
-
- element.style.backgroundColor = color;
- }
-}
-
-
-// -----------------------------------------------------------------------------
-// remove value of all the disabled identifier fields
-// an identifier field is disabled when its value is inherited from another person ( underAge is true )
-// we don't save inherited identifiers. Only save the representative id.
-// -----------------------------------------------------------------------------
-
-function removeDisabledIdentifier()
-{
- jQuery("input.idfield").each(function(){
- if( jQuery(this).is(":disabled"))
- jQuery(this).val("");
- });
-}
-
-function addEventForPatientForm( divname )
-{
- jQuery("#" + divname + " [id=searchPatientByNameBtn]").click(function() {
- getPatientsByName( divname );
- });
-
- jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() {
- checkDuplicate( divname );
- });
-
- jQuery("#" + divname + " [id=dobType]").change(function() {
- dobTypeOnChange( divname );
- });
-}
-
-function showRepresentativeInfo( patientId)
-{
- jQuery('#representativeInfo' ).dialog({
- title: i18n_representative_info,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 400,
- height: 300
- });
-}
-
-function hideEnrolmentField()
-{
- setFieldValue( 'enrollmentDate', '' );
- setFieldValue( 'dateOfIncident', '' );
- hideById('enrollmentDateTR');
- hideById('dateOfIncidentTR');
- hideById('enrollBtn');
-}
-
-function showEnrolmentField()
-{
- showById('enrollmentDateTR');
- showById('dateOfIncidentTR');
- showById('enrollBtn');
-}
-
-function saveIdentifierAndAttribute()
-{
- $.ajax({
- type: "POST",
- url: 'savePatientIdentifierAndAttribute.action',
- data: getParamsForDiv('programEnrollmentInforForm'),
- success: function(json)
- {
- showSuccessMessage( i18n_save_success );
- }
- });
-}
-
-//--------------------------------------------------------------------------------------------
-// Show selected data-recording
-//--------------------------------------------------------------------------------------------
-
-function showSelectedDataRecoding( patientId )
-{
- showLoader();
- hideById('searchPatientDiv');
- hideById('dataEntryFormDiv');
- hideById('migrationPatientDiv');
- jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action',
- {
- patientId: patientId
- },
- function()
- {
- jQuery('#dataRecordingSelectDiv [id=patientInfoDiv]').hide();
- jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide();
- showById('dataRecordingSelectDiv');
-
- var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val();
- $('#dataRecordingSelectDiv [id=programId]').val( programId );
- $('#dataRecordingSelectDiv [id=programIdTR]').hide();
-
- loadProgramStages();
- hideLoader();
- hideById('contentDiv');
- });
-}
-
-function searchPatient()
-{
- $.ajax({
- url: 'searchRegistrationPatient.action',
- type:"POST",
- data: getParamsForDiv('searchPatientDiv'),
- success: function( html ){
- statusSearching = 1;
- setInnerHTML( 'listPatientDiv', html );
- showById('listPatientDiv');
- jQuery( "#loaderDiv" ).hide();
- }
- });
-}
-
-//--------------------------------------------------------------------------------------------
-// Migration patient
-//--------------------------------------------------------------------------------------------
-
-function getPatientLocation( patientId )
-{
- hideById('listPatientDiv');
- hideById('selectDiv');
- hideById('searchPatientDiv');
-
- jQuery('#loaderDiv').show();
-
- jQuery('#migrationPatientDiv').load("getPatientLocation.action",
- {
- patientId: patientId
- }
- , function(){
- showById( 'migrationPatientDiv' );
- jQuery( "#loaderDiv" ).hide();
- });
-}
-
-function verifyOrgunitRegistration( patientId )
-{
- $.getJSON( 'verifyOrgunitRegistration.action', {}
- , function( json )
- {
- var type = json.response;
- if( type == 'success' )
- {
- registerPatientLocation( patientId );
- }
- else if( type == 'input' )
- {
- showWarningMessage( i18n_can_not_register_patient_for_orgunit);
- }
- } );
-}
-
-function registerPatientLocation( patientId )
-{
- $.getJSON( 'registerPatientLocation.action',{ patientId:patientId }
- , function( json )
- {
- showSuccessMessage( i18n_save_success );
- } );
-}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js 2012-06-04 08:37:52 +0000
@@ -0,0 +1,268 @@
+isAjax = true;
+
+function organisationUnitSelected( orgUnits, orgUnitNames )
+{
+ showById('selectDiv');
+ hideById('listPatientDiv');
+
+ setFieldValue( "selectedOrgunitText", orgUnitNames[0] );
+}
+
+selection.setListenerFunction( organisationUnitSelected );
+
+// ----------------------------------------------------------------------------
+// Search patients by name
+// ----------------------------------------------------------------------------
+
+function getPatientsByName( divname )
+{
+ var fullName = jQuery('#' + divname + ' [id=fullName]').val().replace(/^\s+|\s+$/g,"");
+ if( fullName.length > 0)
+ {
+ contentDiv = 'resultSearchDiv';
+ $('#resultSearchDiv' ).load("getPatientsByName.action",
+ {
+ fullName: fullName
+ }).dialog({
+ title: i18n_search_result,
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{ background:'#000000', opacity: 0.8},
+ width: 800,
+ height: 400
+ });
+ }
+ else
+ {
+ alert( i18n_no_patients_found );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// Advanced search
+// -----------------------------------------------------------------------------
+
+function addAttributeOption()
+{
+ var rowId = 'advSearchBox' + jQuery('#advancedSearchTB select[name=searchingAttributeId]').length + 1;
+ var contend = '<td>' + getInnerHTML('searchingAttributeIdTD') + '</td>';
+ contend += '<td>' + searchTextBox ;
+ contend += '<input type="button" value="-" onclick="removeAttributeOption(' + "'" + rowId + "'" + ');"></td>';
+ contend = '<tr id="' + rowId + '">' + contend + '</tr>';
+
+ jQuery('#advancedSearchTB > tbody:last').append( contend );
+}
+
+function removeAttributeOption( rowId )
+{
+ jQuery( '#' + rowId ).remove();
+}
+
+//------------------------------------------------------------------------------
+// Search patients by selected attribute
+//------------------------------------------------------------------------------
+
+function searchingAttributeOnChange( this_ )
+{
+ var container = jQuery(this_).parent().parent().attr('id');
+ var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val();
+ var element = jQuery('#' + container+ ' [id=searchText]');
+ var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType');
+
+ if( attributeId == '-1' )
+ {
+ element.replaceWith( getDateField( container ) );
+ datePickerValid( container + ' [id=searchText]' );
+ return;
+ }
+
+ $('#' + container+ ' [id=searchText]').datepicker("destroy");
+ $('#' + container+ ' [id=dateOperator]').replaceWith("");
+
+ if( attributeId == '0' )
+ {
+ element.replaceWith( programComboBox );
+ }
+ else if ( attributeId == '-2' )
+ {
+ element.replaceWith( genderSelector );
+ }
+ else if ( valueType=='YES/NO' )
+ {
+ element.replaceWith( trueFalseBox );
+ }
+ else
+ {
+ element.replaceWith( searchTextBox );
+ }
+}
+
+function getDateField( container )
+{
+ var dateField = '<select id="dateOperator" name="dateOperator" ><option value=">"> > </option><option value="="> = </option><option value="<"> < </option></select>';
+ dateField += '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:18em" onkeyup="searchPatientsOnKeyUp( event );">';
+ return dateField;
+}
+
+//-----------------------------------------------------------------------------
+// Search Patient
+//-----------------------------------------------------------------------------
+
+function searchPatientsOnKeyUp( event )
+{
+ var key = getKeyCode( event );
+
+ if ( key == 13 )// Enter
+ {
+ searchAdvancedPatients()();
+ }
+}
+
+function getKeyCode(e)
+{
+ if (window.event)
+ return window.event.keyCode;
+ return (e)? e.which : null;
+}
+
+function searchAdvancedPatients()
+{
+ hideById( 'listPatientDiv' );
+
+ var searchTextFields = jQuery( '[name=searchText]' );
+ var flag = true;
+
+ jQuery( searchTextFields ).each( function( i, item )
+ {
+ if( jQuery( item ).val() == '' )
+ {
+ showWarningMessage( i18n_specify_search_criteria );
+ flag = false;
+ }
+ });
+
+ if ( !flag ) return;
+
+ contentDiv = 'listPatientDiv';
+ jQuery( "#loaderDiv" ).show();
+ searchPatient();
+
+}
+
+// ----------------------------------------------------------------
+// Get Params form Div
+// ----------------------------------------------------------------
+
+function getParamsForDiv( patientDiv)
+{
+ var params = '';
+ var dateOperator = '';
+
+ jQuery("#" + patientDiv + " :input").each(function()
+ {
+ var elementId = $(this).attr('id');
+
+ if( $(this).attr('type') == 'checkbox' )
+ {
+ var checked = jQuery(this).is( ':checked' );
+ params += elementId + "=" + checked + "&";
+ }
+ else if( elementId == 'dateOperator' )
+ {
+ dateOperator = jQuery(this).val();
+ }
+ else if( $(this).attr('type') != 'button' )
+ {
+ var value = "";
+ if( jQuery(this).val() != '' )
+ {
+ value = htmlEncode(jQuery(this).val());
+ }
+ if( dateOperator != '' )
+ {
+ value = dateOperator + "'" + value + "'";
+ dateOperator = "";
+ }
+ params += elementId + "="+ value + "&";
+ }
+ } );
+
+ return params;
+}
+
+// -----------------------------------------------------------------------------
+// Load all patients
+// -----------------------------------------------------------------------------
+
+function loadAllPatients()
+{
+ hideById( 'listPatientDiv' );
+
+ var sortPatientAttributeId = getFieldValue('sortPatientAttributeId');
+
+ jQuery('#loaderDiv').show();
+ contentDiv = 'listPatientDiv';
+ jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{
+ listAll:true,
+ sortPatientAttributeId: (sortPatientAttributeId ? sortPatientAttributeId : "")
+ },
+ function(){
+ statusSearching = 0;
+ showById('listPatientDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+}
+
+function addPhoneToList( elementList, _id, _patientName, _phoneNo )
+{
+ var list = jQuery( "#" + elementList );
+ list.append( "<option value='" + _id + "'>\"" + _patientName + " <" + _phoneNo + ">" + "\"</option>" );
+
+ jQuery( "tr#tr" + _id ).hide();
+}
+
+function removePhoneFromList( elementList, _id )
+{
+ var list = jQuery( "#" + elementList + " option[value='" + _id + "']" ).remove();
+
+ jQuery( "tr#tr" + _id ).show();
+}
+
+function searchPatient()
+{
+ $.ajax({
+ url: 'searchRegistrationPatient.action',
+ type:"POST",
+ data: getParamsForDiv( 'advancedSearchTB' ),
+ success: function( html ){
+ statusSearching = 1;
+ setInnerHTML( 'listPatientDiv', html );
+ showById('listPatientDiv');
+ jQuery( "#loaderDiv" ).hide();
+ }
+ });
+}
+
+//--------------------------------------------------------------------------------------------
+// Migration patient
+//--------------------------------------------------------------------------------------------
+
+function getPatientLocation( patientId )
+{
+ hideById('listPatientDiv');
+ hideById('selectDiv');
+ hideById('searchPatientDiv');
+
+ jQuery('#loaderDiv').show();
+
+ jQuery('#migrationPatientDiv').load("getPatientLocation.action",
+ {
+ patientId: patientId
+ }
+ , function(){
+ showById( 'migrationPatientDiv' );
+ jQuery( "#loaderDiv" ).hide();
+ });
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm 2012-05-09 02:52:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm 2012-06-04 08:37:52 +0000
@@ -1,24 +1,38 @@
-<table>
- <tr>
- <td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
- <td> </td>
- <td> </td>
- <td>
- #if($!listAll)
- $i18n.getString( "list_all_patients" )
- #else
- $i18n.getString( "search_patients_by_attributes" )
- #end
- </td>
- </tr>
-
- <tr>
- <td class='text-column' >$i18n.getString( "total_result" )</td>
- <td> </td>
- <td> </td>
- <td>$!total</td>
- </tr>
-</table>
+<style>
+ .overlaps
+ {
+ background-color: #BAFFBC;
+ border: 1px solid #12CD17;
+ display: none;
+ margin: 1em;
+ padding: 1em;
+ width: 500px;
+ }
+</style>
+
+<div class="overlaps" style="display:block;">
+ <table>
+ <tr>
+ <td class='text-column' ><strong>$i18n.getString( "search_result_matching_the_search_criteria" ):</strong></td>
+ <td> </td>
+ <td> </td>
+ <td>
+ #if( $!listAll )
+ $i18n.getString( "list_all_patients" )
+ #else
+ $i18n.getString( "search_patients_by_attributes" )
+ #end
+ </td>
+ </tr>
+
+ <tr>
+ <td class='text-column' ><strong>$i18n.getString( "total_result" )</strong></td>
+ <td> </td>
+ <td> </td>
+ <td>$!total</td>
+ </tr>
+ </table>
+</div>
#if( $patients.size() > 0 )
<table class="mainPageTable">
@@ -88,17 +102,15 @@
<td>$!patient.getAge()</td>
- #if($mapPatientOrgunit.size()!=0)
-
- <td>$!mapPatientOrgunit.get($patient.id)</td>
-
+ #if( $mapPatientOrgunit.size() > 0 )
+ <td>$!mapPatientOrgunit.get($patient.id)</td>
#end
<td>
#if ( $!patient.phoneNumber() && $!patient.phoneNumber() != "" )
<a href="javascript:addPhoneToList( 'recipients', '$patient.id', '$patient.getFullName()', '$!patient.phoneNumber' )" title='$i18n.getString( "add_phone_to_list" )'><img src="../images/move_down.png" alt='$i18n.getString( "add_phone_to_list" )'></a>
#else
- <img src="../images/question2.png" alt='$i18n.getString( "no_phone" )'>
+ <img src="images/question.png" title='$i18n.getString( "no_phone" )'/>
#end
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm 2012-05-24 05:13:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm 2012-06-04 08:37:52 +0000
@@ -65,7 +65,7 @@
</tbody>
</table>
- <table>
+ <table id='advancedSearchTB'>
<tbody>
<tr>
<th colspan="5">$i18n.getString( "search_details" )</th>
@@ -73,7 +73,8 @@
<tr>
<td><label>$i18n.getString( "registering_unit" )</label></td>
<td><input type="text" id='selectedOrgunitText' readonly style="min-width:16em"></td>
- <td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='loadAllPatients();'></td>
+ <td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='loadAllPatients();'/></td>
+ <td><span id='warnmessage' style='color:red'></span></td>
</tr>
<tr id='advSearchBox0'>
@@ -82,6 +83,8 @@
<option value="">$i18n.getString( "search_by_name_identifier" )</option>
<option value="0">$i18n.getString( "search_by_program" )</option>
<option value="-1">$i18n.getString( "date_of_birth" )</option>
+ <option value="-2">$i18n.getString( "gender" )</option>
+ <option value="-4">$i18n.getString( "phone_number" )</option>
#foreach( $attribute in $patientAttributes )
<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
#end
@@ -91,9 +94,15 @@
<td>
<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );'/>
</td>
- <td><input type="button" value='+' onclick='addAttributeOption();'/>
+ <td>
+ <input type="button" value='+' onclick='addAttributeOption();'/>
+
+ $i18n.getString( 'search_by_selected_unit' )
+ <input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
<input type="button" value='$i18n.getString( "search" )' onclick='searchAdvancedPatients();'/>
</td>
+ <td>
+ </td>
</tr>
</tbody>
</table>
@@ -108,7 +117,9 @@
<tr>
<td colspan="2">
<select id="recipients" name="recipients" multiple="true" style="width:50em;height:10em" class="{validate:{required:true}}"
- ondblclick="removePhoneFromList( 'recipients', this.value );"></select></td></tr>
+ ondblclick="removePhoneFromList( 'recipients', this.value );"></select>
+ </td>
+ </tr>
<tr><th colspan="2">$i18n.getString( "message" )</th></tr>
<tr><td colspan="2"><textarea id="smsMessage" name="smsMessage" cols="95" rows="5" class="{validate:{required:true}}"></textarea></td></tr>
@@ -179,20 +190,9 @@
var i18n_select_program = '[' + '$encoder.jsEscape( $i18n.getString( "select_program" ), "'")' + ']';
var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
var i18n_list_all_patient = '$encoder.jsEscape( $i18n.getString( "list_all_patient" ) , "'")';
- var i18n_enrol_success = '$encoder.jsEscape( $i18n.getString( "enrol_success" ) , "'")';
- var i18n_unenrol_success = '$encoder.jsEscape( $i18n.getString( "unenrol_success" ) , "'")';
var i18n_list_patients_by_program = '$encoder.jsEscape( $i18n.getString( "list_patients_by_program" ) , "'" )';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )';
- var i18n_adding_patient_failed = '$encoder.jsEscape( $i18n.getString( "adding_patient_failed" ), "'")';
- var i18n_updating_patient_failed = '$encoder.jsEscape( $i18n.getString( "updating_patient_failed" ), "'")';
- var i18n_program_enrollment_failed = '$encoder.jsEscape( $i18n.getString( "program_enrollment_failed" ) , "'")';
- var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
- var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
var i18n_date_invalid = '$encoder.jsEscape( $i18n.getString( "date_invalid" ) , "'")';
- var i18n_date_less_incident = '$encoder.jsEscape( $i18n.getString( "date_less_incident" ) , "'")';
- var i18n_enroll_to_program = '$encoder.jsEscape( $i18n.getString( "enroll_to_program" ) , "'")';
- var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';
var i18n_patient_attributes = '$encoder.jsEscape( $i18n.getString( "patient_attributes" ) , "'")';
@@ -227,21 +227,14 @@
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
- var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
- + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
- + dateFormat.replace('yy', 'yyyy') + " '" ;
- var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
- var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+
var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
- var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
- var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
-
+
var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
- var i18n_please_fill_out_only_one_of_these_fields = '$encoder.jsEscape( $i18n.getString( "please_fill_out_only_one_of_these_fields" ) , "'")';
- var checkedDuplicate = false;
+
// -1: no search anything
// 0: show list all patient
// 1: search with conditions
@@ -260,7 +253,13 @@
trueFalseBox += '<option value="false">' + i18n_no + '</option>';
trueFalseBox += '</select>';
+ var genderSelector = '<select id="searchText" name="searchText" style="width:20.2em" >';
+ genderSelector += '<option value="M">$i18n.getString( "male" )</option>';
+ genderSelector += '<option value="F">$i18n.getString( "female" )</option>';
+ genderSelector += '</select>';
+
var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
+
#foreach ( $program in $programs )
programComboBox += '<option value="$program.id">$program.name</option>';
#end