dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18779
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7960: Add missing files
------------------------------------------------------------
revno: 7960
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-08-23 12:49:32 +0700
message:
Add missing files
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.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
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.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/J2meClientUpdateAction.java 2012-08-23 05:49:32 +0000
@@ -0,0 +1,113 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.api.mobile.PatientMobileSettingService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientMobileSetting;
+
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Nguyen Kim Lai
+ *
+ * @version $ J2meClientUpdateAction.java Aug 15, 2012 $
+ */
+public class J2meClientUpdateAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ PatientMobileSettingService patientMobileSettingService;
+
+ public void setPatientMobileSettingService( PatientMobileSettingService patientMobileSettingService )
+ {
+ this.patientMobileSettingService = patientMobileSettingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private double version;
+
+ public void setVersion( double version )
+ {
+ this.version = version;
+ }
+
+ private String autoUpdate;
+
+ public void setAutoUpdate( String autoUpdate )
+ {
+ this.autoUpdate = autoUpdate;
+ }
+
+ private PatientMobileSetting patientMobileSetting;
+
+ public PatientMobileSetting getPatientMobileSetting()
+ {
+ return patientMobileSetting;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ List<PatientMobileSetting> list = new ArrayList<PatientMobileSetting>();
+
+ list = (List<PatientMobileSetting>) patientMobileSettingService.getCurrentSetting();
+
+ this.patientMobileSetting = list.get( 0 );
+
+ if ( this.version != 0 )
+ {
+ this.patientMobileSetting.setVersionToUpdate( this.version );
+ }
+ if ( autoUpdate != null && autoUpdate.equals( "yes" ) )
+ {
+ this.patientMobileSetting.setAutoUpdateClient( true );
+ }
+
+ if ( autoUpdate != null && autoUpdate.equals( "no" ) )
+ {
+ this.patientMobileSetting.setAutoUpdateClient( false );
+ }
+ patientMobileSettingService.savePatientMobileSetting( this.patientMobileSetting );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/j2meClientUpdatePage.vm 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/j2meClientUpdatePage.vm 2012-08-23 05:49:32 +0000
@@ -0,0 +1,49 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation2( "j2meClientUpdatePage", function( form ) {
+ checkIsAutoUpdate();
+ form.submit();
+ }, {
+ 'rules': getValidationRules( 'autoUpdateClient' )
+ } );
+ } );
+
+ function checkIsAutoUpdate()
+ {
+ var aa = document.getElementById( 'j2meClientUpdatePage' );
+ for (var i = 0; i < aa.elements.length; i++)
+ {
+ if ( aa.elements[i].checked && aa.elements[i].value == 1 )
+ document.getElementById( 'autoUpdate' ).value = "yes";
+ if ( aa.elements[i].checked && aa.elements[i].value == 0 )
+ document.getElementById( 'autoUpdate' ).value = "no";
+ }
+ };
+</script>
+<h3>$i18n.getString( 'j2me_client_update_config' )</h3>
+<form id="j2meClientUpdatePage" name="j2meClientUpdatePage" action="showJ2meClientUpdatePage.action" method="post">
+ <input type="hidden" name="autoUpdate" id="autoUpdate" value=""/>
+ <table>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString("configuration")</th>
+ </tr>
+ </thead>
+ <tbody id="autoUpdateClientDetail">
+ <tr>
+ <td>$i18n.getString( 'auto_update_client' ):</td>
+ <td>
+ <input type="radio" name="cbxAutoUpdate" value="1" #if( $!patientMobileSetting.autoUpdateClient == true ) checked #end/>Yes
+ <input type="radio" name="cbxAutoUpdate" value="0" #if( $!patientMobileSetting.autoUpdateClient == false ) checked #end/>No
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( 'client_older_than' ) <em title="$i18n.getString( 'required' )" class="required">*</em>:</td>
+ <td><input type="text" name="version" id="version" value="$!patientMobileSetting.versionToUpdate"/></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right"><input type="submit" value="$i18n.getString( 'save_settings' )" style="width:8em"/></td>
+ </tr>
+ </tbody>
+ </table>
+</form>
\ No newline at end of file