dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24234
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11837: paging view received sms page
------------------------------------------------------------
revno: 11837
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-08-30 09:54:18 +0700
message:
paging view received sms page
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateIncomingSmsStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultIncomingSmsService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.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-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsService.java 2013-08-30 02:54:18 +0000
@@ -67,6 +67,8 @@
public void setIncomingSmsQueue( MessageQueue incomingSmsQueue );
Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword );
+
+ Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword, Integer min, Integer max );
IncomingSms convertToIncomingSms( InboundMessage message );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/incoming/IncomingSmsStore.java 2013-08-30 02:54:18 +0000
@@ -44,6 +44,8 @@
IncomingSms get( int id );
Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword );
+
+ Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword, Integer min, Integer max );
Collection<IncomingSms> getSmsByOriginator( String originator );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateIncomingSmsStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateIncomingSmsStore.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateIncomingSmsStore.java 2013-08-30 02:54:18 +0000
@@ -133,4 +133,23 @@
criteria.add( Restrictions.eq( "parsed", false ) );
return criteria.list();
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword, Integer min, Integer max )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( IncomingSms.class ).addOrder( Order.desc( "sentDate" ) );
+ if ( status != null )
+ {
+ criteria.add( Restrictions.eq( "status", status ) );
+ }
+ criteria.add( Restrictions.ilike( "originator", "%" + keyword + "%" ) );
+
+ if ( min != null && max != null )
+ {
+ criteria.setFirstResult( min ).setMaxResults( max );
+ }
+ return criteria.list();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultIncomingSmsService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultIncomingSmsService.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/incoming/DefaultIncomingSmsService.java 2013-08-30 02:54:18 +0000
@@ -201,4 +201,10 @@
return incomingSms;
}
+
+ @Override
+ public Collection<IncomingSms> getSmsByStatus( SmsMessageStatus status, String keyword, Integer min, Integer max )
+ {
+ return incomingSmsStore.getSmsByStatus( status, keyword, min, max );
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-08-27 08:54:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2013-08-30 02:54:18 +0000
@@ -190,7 +190,6 @@
<td></td>
</tr>
</table>
-
<div id="detailsInfo"></div>
#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-08-27 03:31:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2013-08-30 02:54:18 +0000
@@ -3,7 +3,7 @@
<input type="hidden" id='hideLink' name='hideLink' value='false'>
<input type='hidden' id='isSearchByProgram' name='isSearchByProgram' value='false' >
-<table style="margin-bottom:8px" id="commonSearchDiv" name="commonSearchDiv">
+<table style="margin-bottom:8px" id="commonSearchDiv" name="commonSearchDiv" border="1px">
<tr>
<td>
<label>$i18n.getString( "registering_unit" )</label>
@@ -16,7 +16,7 @@
<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();" >
</td>
- </tr>
+ </tr>
<tr id='programAddPatientTR'>
<td>$i18n.getString('program')</td>
<td>
@@ -68,7 +68,6 @@
</td>
</tr>
</table>
-
<div id='advanced-search' name='advanced-search' class='hidden advanced-search'>
<table>
<tr id='searchBySelectedUnitTD'>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java 2013-08-28 04:31:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java 2013-08-30 02:54:18 +0000
@@ -125,7 +125,7 @@
List<OutboundSms> tempListOutboundSMS = outboundSmsService.getAllOutboundSms();
listOutboundSMS = new ArrayList<OutboundSms>();
-
+
if ( filterStatusType != null && filterStatusType == 0 )
{
for ( OutboundSms each : tempListOutboundSMS )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/incoming/ReceivingSMSAction.java 2013-08-30 02:54:18 +0000
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.util.List;
import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.sms.config.ModemGatewayConfig;
import org.hisp.dhis.sms.config.SmsConfigurationManager;
import org.hisp.dhis.sms.incoming.IncomingSms;
@@ -43,7 +44,7 @@
* @author Nguyen Kim Lai
*/
public class ReceivingSMSAction
- implements Action
+ extends ActionPagingSupport<IncomingSms>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -148,11 +149,16 @@
}
if ( keyword == null )
+ {
keyword = "";
-
+ }
+
+ this.paging = createPaging( incomingSmsService.getSmsByStatus( null, keyword.trim() ).size() );
+
if ( smsStatus == null || smsStatus.trim().equals( "" ) )
{
- listIncomingSms = new ArrayList<IncomingSms>( incomingSmsService.getSmsByStatus( null, keyword.trim() ) );
+ listIncomingSms = new ArrayList<IncomingSms>( incomingSmsService.getSmsByStatus( null, keyword,
+ this.paging.getStartPos(), this.paging.getPageSize() ) );
}
else
{
@@ -168,6 +174,7 @@
}
}
}
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2013-08-28 07:52:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/receiveSMSPage.vm 2013-08-30 02:54:18 +0000
@@ -208,6 +208,7 @@
<th style="text-align:center">$i18n.getString( "delete" )</th>
</thead>
<tbody>
+ $listIncomingSms.size()
#foreach( $incomingSms in $listIncomingSms )
<tr id="tr${incomingSms.id}" height="40">
<td style="text-align:center"><input type="checkbox" name="mycheck" value="$incomingSms.id"/></td>
@@ -222,6 +223,14 @@
<td style="text-align:center"><a href="javascript:removeSingleItem( '$incomingSms.id', '$incomingSms.getText()' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></td>
</tr>
#end
+ <tr>
+ <td colspan="8">
+ <p></p>
+ <div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </div>
+ </td>
+ </tr>
</tbody>
</table>
<br/>