dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12005
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3545: Paging patient list by ajax.
------------------------------------------------------------
revno: 3545
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-09 12:39:07 +0700
message:
Paging patient list by ajax.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/content.vm
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/paging/paging.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.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-commons-resources/src/main/webapp/content.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/content.vm 2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/content.vm 2011-05-09 05:39:07 +0000
@@ -1,3 +1,7 @@
+#foreach( $javascript in $javascripts )
+ <script type="text/javascript" src="$javascript"></script>
+#end
+
#foreach ( $style in $stylesheets )
<link type="text/css" rel="stylesheet" href="$style">
#end
=== 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-05-07 13:17:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-05-09 05:39:07 +0000
@@ -1390,30 +1390,6 @@
}
/**
- * Paging
- */
-function changePageSize( baseLink )
-{
- var pageSize = jQuery("#sizeOfPage").val();
-
- if(pageSize < 1)
- {
- pageSize = 1;
- }
-
- var currentPage = jQuery("#jumpToPage").val();
- jQuery.cookie("pageSize", pageSize, {path: "/"});
- window.location.href = baseLink +"pageSize=" + pageSize +"¤tPage=" +currentPage;
-}
-
-function jumpToPage( baseLink )
-{
- var pageSize = jQuery("#sizeOfPage").val();
- var currentPage = jQuery("#jumpToPage").val();
- window.location.href = baseLink +"pageSize=" + pageSize +"¤tPage=" +currentPage;
-}
-
-/**
* Used to export PDF file by the given type and the active items in table
*/
function exportPdfByType( type )
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/paging/paging.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/paging/paging.vm 2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/paging/paging.vm 2011-05-09 05:39:07 +0000
@@ -15,14 +15,14 @@
</td>
<td>
<span>$i18n.getString("rows_in_page"):</span>
- <input type="text" id="sizeOfPage" value="$!pageSize" style="width:50px" onchange="changePageSize('$baseLink');">
+ <input type="text" id="sizeOfPage" value="$!pageSize" style="width:50px" onkeyup="changePageSize('$baseLink');">
</td>
<td>
<span>$i18n.getString("jump_to_page"):</span>
- <input type="text" id="jumpToPage" value="$!currentPage" style="width:50px" onchange="jumpToPage('$baseLink');">
+ <input type="text" id="jumpToPage" value="$!currentPage" style="width:50px" onkeyup="changePageSize('$baseLink');">
</td>
<td>
- <input type="button" id="submitButton" value="$i18n.getString('go')" onclick="jumpToPage('$baseLink');">
+ <input type="button" id="submitButton" value="$i18n.getString('go')" onclick="changePageSize('$baseLink');">
</td>
</tr>
<tr>
@@ -72,20 +72,45 @@
<script>
- var isAjax;
-
- function ajaxPaging( currentPage, pageSize )
- {
- if( isAjax == undefined )
- {
- window.location.href = '${baseLink}currentPage=' + currentPage + '&pageSize=' + pageSize;
- }
- else
- {
- showLoader();
- var url = '${baseLink}currentPage=' + currentPage + '&pageSize=' + pageSize;
- $( '#contentDiv' ).load(url);
- hideLoader();
- }
- }
+var isAjax;
+
+function ajaxPaging( currentPage, pageSize )
+{
+ if( isAjax == undefined )
+ {
+ window.location.href = '${baseLink}currentPage=' + currentPage + '&pageSize=' + pageSize;
+ }
+ else
+ {
+ showLoader();
+ var url = '${baseLink}currentPage=' + currentPage + '&pageSize=' + pageSize;
+ $( '#contentDiv' ).load(url);
+ hideLoader();
+ }
+}
+
+function changePageSize( baseLink )
+{
+ var pageSize = jQuery("#sizeOfPage").val();
+
+ if(pageSize < 1)
+ {
+ pageSize = 1;
+ }
+
+ var currentPage = jQuery("#jumpToPage").val();
+ jQuery.cookie("pageSize", pageSize, {path: "/"});
+ var url = baseLink + 'currentPage=' + currentPage + '&pageSize=' + pageSize;
+ if( isAjax == undefined )
+ {
+ window.location.href = url;
+ }
+ else
+ {
+ showLoader();
+ $( '#contentDiv' ).load(url);
+ hideLoader();
+ }
+}
+
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java 2011-05-05 21:18:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/VerifyOrganisationUnitHasParentAction.java 2011-05-09 05:39:07 +0000
@@ -61,13 +61,6 @@
this.orgunitId = orgunitId;
}
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -75,8 +68,6 @@
public String execute()
throws Exception
{
- message = "";
-
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgunitId );
if ( organisationUnit == null )
@@ -86,7 +77,6 @@
if ( !organisationUnit.isHasPatients() )
{
- message = "can_not_register_patient_for_orgunit";
return INPUT;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm 2011-04-28 08:15:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm 2011-05-09 05:39:07 +0000
@@ -59,7 +59,7 @@
<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
<td class="input-column" >
<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[7,50]}}"/>
- <img src='../images/magnifier.png' onclick='startSearch();' style="cursor: pointer;"/>
+ <img src='../images/search.png' onclick='startSearch();' style="cursor: pointer;"/>
</td>
</tr>
<tr><td> </td></tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2011-05-06 04:41:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2011-05-09 05:39:07 +0000
@@ -10,17 +10,21 @@
showLoader();
var url = 'patientform.action';
- $('#patientListDiv').load(url);
- hideById('selectPatientDiv');
- showById('patientListDiv');
+ $('#patientListDiv').load( url, function()
+ {
+ enable('listAllPatientsBtn');
+ setFieldValue('selectedOrgunitText', getFieldValue('orgunitname') );
+ setInnerHTML('warnmessage', '');
+ hideLoader();
+ });
- hideLoader();
}
else if( type == 'input' )
{
setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
- showById('selectPatientDiv');
- hideById('patientListDiv');
+ setFieldValue('selectedOrgunitText', i18n_please_select_village );
+ disable('listAllPatientsBtn');
+ setInnerHTML('patientListDiv', '');
}
} );
}
@@ -740,18 +744,17 @@
{
showLoader();
- $.post("searchPatient.action",
- {
- searchText: getFieldValue('searchText'),
- searchingAttributeId: getFieldValue('searchingAttributeId'),
- sortPatientAttributeId: getFieldValue('sortPatientAttributeId'),
- programId: getFieldValue('programId')
- },
- function (data)
- {
- setInnerHTML('contentDiv', data);
- },'html');
-
+ $('#contentDiv').load("searchPatient.action",
+ {
+ searchText: getFieldValue('searchText'),
+ searchingAttributeId: getFieldValue('searchingAttributeId'),
+ sortPatientAttributeId: getFieldValue('sortPatientAttributeId'),
+ programId: getFieldValue('programId')
+ }
+ , function(){
+
+ });
+
hideLoader();
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm 2011-04-26 02:06:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm 2011-05-09 05:39:07 +0000
@@ -16,7 +16,6 @@
var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ), "'")';
var i18n_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ), "'")';
-
</script>
<table>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm 2011-05-06 04:41:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patient.vm 2011-05-09 05:39:07 +0000
@@ -1,21 +1,4 @@
-<table>
-
- <tr>
- <td><label>$i18n.getString( "registering_unit" )</label></td>
- <td><input type="text" readonly="readonly" value="$encoder.htmlEncode( $organisationUnit.name )" style="min-width:22em"></td>
- <td> </td>
- <td><input type="button" id='listAllPatientsBtn' value="$i18n.getString( 'list_all_patients' )" onclick="loadAllPatients();"></td>
- </tr>
-
- <tr>
- <td></td>
- <td><i><span id='warnmessage' style='color: red;'></span></i> </td>
- </tr>
-
-</table>
-
-<hr style="clear:both">
-
+
<table>
<tr>
<td>
@@ -29,7 +12,7 @@
<em title="$i18n.getString( "required" )" class="required">*</em></label>
</td>
<td>
- <input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText">
+ <input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText" >
<select id="programId" name='programId' style="display:none; width:20.2em" >
<option value="">[ $i18n.getString('select_program') ]</option>
@@ -63,6 +46,5 @@
<p></p>
<p></p>
-<script type="text/javascript">
- var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
-</script>
\ No newline at end of file
+<input type ='hidden' name='orgunitname' id='orgunitname' value='$organisationUnit.name'>
+<div id='contentDiv'></div>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm 2011-05-06 04:41:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/selectPatient.vm 2011-05-09 05:39:07 +0000
@@ -7,9 +7,9 @@
<tr>
<td><label>$i18n.getString( "registering_unit" )</label></td>
- <td><input type="text" readonly="readonly" value="[$i18n.getString( 'please_select_village' )]" style="min-width:22em"></td>
+ <td><input type="text" id='selectedOrgunitText' readonly="readonly" value="[$i18n.getString( 'please_select_village' )]" style="min-width:22em"></td>
<td> </td>
- <td><input type="button" value="$i18n.getString( 'list_all_patients' )" disabled></td>
+ <td><input type="button" id='listAllPatientsBtn' value="$i18n.getString( 'list_all_patients' )" disabled></td>
</tr>
<tr>
@@ -31,5 +31,7 @@
<div id='contentDiv'></div>
<script>
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
var i18n_can_not_register_patient_for_orgunit = '$encoder.jsEscape( $i18n.getString( "can_not_register_patient_for_orgunit" ), "'")';
+ var i18n_please_select_village = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_village" ), "'")' + ']';
</script>
\ No newline at end of file