=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java 2012-09-14 08:13:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsService.java 2012-10-22 08:51:28 +0000 @@ -57,5 +57,7 @@ void updateOutboundSms( OutboundSms sms); + void deleteById( Integer outboundSmsId ); + List getOutboundSms( OutboundSmsStatus status ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java 2012-09-14 08:13:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsStore.java 2012-10-22 08:51:28 +0000 @@ -39,5 +39,7 @@ OutboundSms get( int id ); - List get( OutboundSmsStatus status ); + List get( OutboundSmsStatus status ); + + void delete( OutboundSms sms ); } === modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java' --- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2012-10-01 04:52:51 +0000 +++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2012-10-22 08:51:28 +0000 @@ -36,7 +36,9 @@ import org.hibernate.SessionFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; +import org.springframework.transaction.annotation.Transactional; +@Transactional public class HibernateOutboundSmsStore implements OutboundSmsStore { @@ -135,4 +137,10 @@ { sessionFactory.getCurrentSession().update( sms ); } + + @Override + public void delete( OutboundSms sms ) + { + sessionFactory.getCurrentSession().delete( sms ); + } } === modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java' --- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2012-09-14 09:11:26 +0000 +++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/OutboundSmsServiceImpl.java 2012-10-22 08:51:28 +0000 @@ -131,7 +131,13 @@ public int saveOutboundSms(OutboundSms sms) { return outboundSmsStore.save( sms ); } - + + @Override + public void deleteById( Integer outboundSmsId ) + { + OutboundSms sms = outboundSmsStore.get( outboundSmsId ); + outboundSmsStore.delete( sms ); + } // ------------------------------------------------------------------------- // Support methods // ------------------------------------------------------------------------- @@ -151,4 +157,5 @@ } } + } === modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java' --- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2012-09-14 08:13:33 +0000 +++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/TestOutboundSmsService.java 2012-10-22 08:51:28 +0000 @@ -125,4 +125,11 @@ // TODO Auto-generated method stub return null; } + + @Override + public void deleteById( Integer outboundSmsId ) + { + // TODO Auto-generated method stub + + } } === modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java' --- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-09-18 07:53:45 +0000 +++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SmsLibService.java 2012-10-22 08:51:28 +0000 @@ -485,4 +485,12 @@ { return outboundSmsStore.get( status ); } + + @Override + public void deleteById( Integer outboundSmsId ) + { + OutboundSms sms = outboundSmsStore.get( outboundSmsId ); + + outboundSmsStore.delete( sms ); + } } === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/DeleteSentSMSAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/DeleteSentSMSAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/DeleteSentSMSAction.java 2012-10-22 08:51:28 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.mobile.action; + +import org.hisp.dhis.program.ProgramStageInstanceService; +import org.hisp.dhis.sms.outbound.OutboundSmsService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Nguyen Kim Lai + * + * @version $ DeleteSentSMSAction.java Oct 16, 2012 $ + */ +public class DeleteSentSMSAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OutboundSmsService outboundSmsService; + + public void setOutboundSmsService( OutboundSmsService outboundSmsService ) + { + this.outboundSmsService = outboundSmsService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer[] ids; + + public void setIds( Integer[] ids ) + { + this.ids = ids; + } + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + @Override + public String execute() + throws Exception + { + if ( ids != null && ids.length > 0 ) + { + for ( Integer each : ids ) + { + outboundSmsService.deleteById( each ); + } + } + if ( id != null ) + { + outboundSmsService.deleteById( id ); + } + return SUCCESS; + + } + +} === 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 2012-06-04 06:37:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSentSMSAction.java 2012-10-22 08:51:28 +0000 @@ -1,9 +1,14 @@ package org.hisp.dhis.mobile.action; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import org.hisp.dhis.program.ProgramStageInstanceService; +import org.hisp.dhis.program.SchedulingProgramObject; import org.hisp.dhis.sms.outbound.OutboundSms; import org.hisp.dhis.sms.outbound.OutboundSmsService; +import org.hisp.dhis.sms.outbound.OutboundSmsStatus; import com.opensymphony.xwork2.Action; @@ -22,26 +27,83 @@ this.outboundSmsService = outboundSmsService; } + private ProgramStageInstanceService programStageInstanceService; + + public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) + { + this.programStageInstanceService = programStageInstanceService; + } + // ------------------------------------------------------------------------- // Input & Output // ------------------------------------------------------------------------- - private List ListOutboundSMS; + private List listOutboundSMS; public List getListOutboundSMS() { - return ListOutboundSMS; - } - + return listOutboundSMS; + } + + private Integer filterStatusType; + + public Integer getFilterStatusType() + { + return filterStatusType; + } + + public void setFilterStatusType( Integer filterStatusType ) + { + this.filterStatusType = filterStatusType; + } + + private Collection schedulingProgramObjects; + + public Collection getSchedulingProgramObjects() + { + return schedulingProgramObjects; + } + // ------------------------------------------------------------------------- // Action Implementation // ------------------------------------------------------------------------- - + @Override public String execute() throws Exception { - ListOutboundSMS = outboundSmsService.getAllOutboundSms(); + List tempListOutboundSMS = outboundSmsService.getAllOutboundSms(); + + listOutboundSMS = new ArrayList(); + + if ( filterStatusType != null && filterStatusType == 0) + { + for ( OutboundSms each: tempListOutboundSMS ) + { + if (each.getStatus().equals( OutboundSmsStatus.OUTBOUND )) + { + this.listOutboundSMS.add( each ); + } + } + } + if ( filterStatusType != null && filterStatusType == 1 ) + { + for ( OutboundSms each: tempListOutboundSMS ) + { + if (each.getStatus().equals( OutboundSmsStatus.SENT )) + { + this.listOutboundSMS.add( each ); + } + } + } + if ( filterStatusType != null && filterStatusType == 2 || filterStatusType == null) + { + for ( OutboundSms each: tempListOutboundSMS ) + { + this.listOutboundSMS.add( each ); + } + } + schedulingProgramObjects = programStageInstanceService.getSendMesssageEvents(); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-08-22 07:08:08 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-10-22 08:51:28 +0000 @@ -32,6 +32,13 @@ + + + + + === 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-08-30 12:47:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-10-22 08:51:28 +0000 @@ -34,6 +34,9 @@ send_sms=Send SMS send_sms_beneficiary=Send SMS to Person list_sent_SMS=List Of Sent SMS +sent=Sent +all=All +filter_by_status=Filter by Status add_gateway=Add Gateway type=Type gateway_configuration=Gateway Configuration === 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-08-30 12:47:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-10-22 08:51:28 +0000 @@ -76,6 +76,12 @@ ../dhis-web-commons/ajax/jsonResponseSuccess.vm ../dhis-web-commons/ajax/jsonResponseError.vm plainTextError + + + + ../dhis-web-commons/ajax/jsonResponseSuccess.vm + ../dhis-web-commons/ajax/jsonResponseError.vm + plainTextError + function deleteChecked() + { + var aa = document.getElementById( 'sentSMSPage' ); + var result = ""; + for (var i = 0; i < aa.elements.length; i++) + { + if ( aa.elements[i].checked ) + { + result += "ids=" + aa.elements[i].value + "&"; + } + } + result = result.substring(0 , result.length - 1); + + if( result != "") + { + var confirmation = window.confirm( "$i18n.getString( 'confirm_delete_items' )" ); + if ( confirmation ) + { + jQuery.get( 'deleteSentSMS.action?' + result, {}, + function ( json ) { + if ( json.response == "success" ) { + window.location = "showSentPage.action"; + } else { + showMessage( json.message ); + } + }); + } + } + else + { + showErrorMessage( "$i18n.getString( 'error_delete' )", 7000 ); + } + }; + checked = false; + function checkAll() + { + var aa = document.getElementById( 'sentSMSPage' ); + if (checked == false) + { + checked = true + } + else + { + checked = false + } + for (var i = 0; i < aa.elements.length; i++) + { + aa.elements[i].checked = checked; + } + }; + + function removeSingleItem( key, name ) + { + removeItem( key, name, i18n_confirm_delete, "deleteSentSMS.action" ); + }; + + function filterByStatus(value) + { + window.location.href='showSentPage.action?filterStatusType='+value; + }; + + var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_sms" ) , "'")'; +

$i18n.getString( 'list_sent_SMS' )

-
- + +
+ + + + + +
$i18n.getString('filter_by_status'): + +
+
+ - - + + + - #foreach( $outboundSms in $ListOutboundSMS) - - - - - - - - - #end + + #foreach( $outboundSms in $listOutboundSMS) + + + + + + + + + + #end +
$i18n.getString( "no." ) $i18n.getString( "message" )$i18n.getString( "admin" ) $i18n.getString( "receiver" )$i18n.getString( "date" )$i18n.getString( "status" )$i18n.getString( "delete" )
$velocityCount$outboundSms.messageadmin$outboundSms.recipients
$velocityCount$outboundSms.message$outboundSms.recipients$outboundSms.date$outboundSms.status$i18n.getString( 'remove' )
\ No newline at end of file