← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8274: implemented pr dataset offline property, allows turning off offline mode for dataentry

 

------------------------------------------------------------
revno: 8274
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-09-27 10:57:57 +0700
message:
  implemented pr dataset offline property, allows turning off offline mode for dataentry
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-09-27 03:57:57 +0000
@@ -163,7 +163,12 @@
      * Property indicating that all validation rules must pass before the form can be completed.
      */
     private boolean validCompleteOnly;
-    
+
+    /**
+     * Property indicating whether offline storage is enabled for this dataSet or not
+     */
+    private boolean skipOffline;
+
     // -------------------------------------------------------------------------
     // Contructors
     // -------------------------------------------------------------------------
@@ -604,6 +609,19 @@
         this.validCompleteOnly = validCompleteOnly;
     }
 
+    @JsonProperty
+    @JsonView( {DetailedView.class, ExportView.class} )
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public boolean isSkipOffline()
+    {
+        return skipOffline;
+    }
+
+    public void setSkipOffline( boolean skipOffline )
+    {
+        this.skipOffline = skipOffline;
+    }
+
     @Override
     public void mergeWith( IdentifiableObject other )
     {
@@ -619,6 +637,11 @@
             dataEntryForm = dataSet.getDataEntryForm() == null ? dataEntryForm : dataSet.getDataEntryForm();
             version = dataSet.getVersion() == null ? version : dataSet.getVersion();
             expiryDays = dataSet.getExpiryDays();
+            skipAggregation = dataSet.isSkipAggregation();
+            allowFuturePeriods = dataSet.isAllowFuturePeriods();
+            fieldCombinationRequired = dataSet.isFieldCombinationRequired();
+            validCompleteOnly = dataSet.isValidCompleteOnly();
+            skipOffline = dataSet.isSkipOffline();
 
             removeAllDataElements();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-09-24 14:34:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-09-27 03:57:57 +0000
@@ -451,8 +451,10 @@
         executeSql( "delete from systemsetting where name='currentStyle' and value like '%blue/blue.css'" );
         
         executeSql( "update dataentryform set style='regular' where style is null" );
-        executeSql( "update dataset set skipaggregation = false where skipaggregation is null" );
-        
+
+        executeSql( "UPDATE dataset SET skipaggregation = false WHERE skipaggregation IS NULL" );
+        executeSql( "UPDATE dataset SET skipoffline = false WHERE skipoffline IS NULL" );
+
         log.info( "Tables updated" );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2012-09-27 03:57:57 +0000
@@ -76,7 +76,9 @@
 
 	<property name="fieldCombinationRequired" />
 	
-	<property name="validCompleteOnly" />
+  <property name="validCompleteOnly" />
+
+  <property name="skipOffline" />
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java	2012-09-19 16:45:22 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandler.java	2012-09-27 03:57:57 +0000
@@ -103,6 +103,7 @@
         statementBuilder.setColumn( "skipaggregation" );
         statementBuilder.setColumn( "fieldcombinationrequired" );
         statementBuilder.setColumn( "validcompleteonly" );
+        statementBuilder.setColumn( "skipoffline" );
     }
 
     protected void setValues( DataSet dataSet )
@@ -120,5 +121,6 @@
         statementBuilder.setValue( dataSet.isSkipAggregation() );
         statementBuilder.setValue( dataSet.isFieldCombinationRequired() );
         statementBuilder.setValue( dataSet.isValidCompleteOnly() );
+        statementBuilder.setValue( dataSet.isSkipOffline() );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-09-22 14:37:38 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-09-27 03:57:57 +0000
@@ -1433,7 +1433,7 @@
     {
         var remoteVersion = dataSets[dataSetId].version;
 
-        if ( !storageManager.formExists( dataSetId ) )
+        if ( !storageManager.formExists( dataSetId ) && !dataSets[dataSetId].skipOffline )
         {
             storageManager.downloadForm( dataSetId, remoteVersion );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm	2012-09-19 16:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm	2012-09-27 03:57:57 +0000
@@ -25,7 +25,7 @@
 #foreach( $dataSet in $dataSets )
 "${dataSet.id}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )",
 "version":"${dataSet.version}","type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}",
-"allowFuturePeriods":${dataSet.allowFuturePeriods},"fieldCombinationRequired":${dataSet.fieldCombinationRequired},"validCompleteOnly":${dataSet.validCompleteOnly}
+"allowFuturePeriods":${dataSet.allowFuturePeriods},"fieldCombinationRequired":${dataSet.fieldCombinationRequired},"validCompleteOnly":${dataSet.validCompleteOnly}, "skipOffline":${dataSet.skipOffline}
 }#if( $velocityCount < $size ),#end
 #end },
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2012-09-27 03:57:57 +0000
@@ -171,6 +171,13 @@
         this.validCompleteOnly = validCompleteOnly;
     }
 
+    private boolean skipOffline;
+
+    public void setSkipOffline( boolean skipOffline )
+    {
+        this.skipOffline = skipOffline;
+    }
+
     private Collection<String> dataElementsSelectedList = new HashSet<String>();
 
     public void setDataElementsSelectedList( Collection<String> dataElementsSelectedList )
@@ -227,6 +234,7 @@
         dataSet.setAllowFuturePeriods( allowFuturePeriods );
         dataSet.setFieldCombinationRequired( fieldCombinationRequired );
         dataSet.setValidCompleteOnly( validCompleteOnly );
+        dataSet.setSkipOffline( skipOffline );
         
         dataSetService.addDataSet( dataSet );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2012-09-27 03:57:57 +0000
@@ -189,6 +189,13 @@
         this.validCompleteOnly = validCompleteOnly;
     }
 
+    private boolean skipOffline;
+
+    public void setSkipOffline( boolean skipOffline )
+    {
+        this.skipOffline = skipOffline;
+    }
+
     private Collection<String> dataElementsSelectedList = new HashSet<String>();
 
     public void setDataElementsSelectedList( Collection<String> dataElementsSelectedList )
@@ -255,6 +262,7 @@
         dataSet.setAllowFuturePeriods( allowFuturePeriods );
         dataSet.setFieldCombinationRequired( fieldCombinationRequired );
         dataSet.setValidCompleteOnly( validCompleteOnly );
+        dataSet.setSkipOffline( skipOffline );
         dataSet.setNotificationRecipients( userGroupService.getUserGroup( notificationRecipients ) );
 
         dataSetService.updateDataSet( dataSet );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties	2012-09-27 03:57:57 +0000
@@ -103,4 +103,5 @@
 all_fields_for_data_element_required=All fields for data elements required
 form_details=Form details
 complete_allowed_only_if_validation_passes=Complete allowed only if validation passes
-notification_recipients=Complete notification recipients
\ No newline at end of file
+notification_recipients=Complete notification recipients
+skip_offline=Skip Offline
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm	2012-09-25 01:44:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm	2012-09-27 03:57:57 +0000
@@ -50,7 +50,7 @@
 <h3>$i18n.getString( "add_dataset" )</h3>
 
 <form id="addDataSetForm" name="addDataSetForm" action="addDataSet.action" method="post" >
-  <table id="detailsList">
+  <table id="detailsList" style="width: 540px;">
     <col/> ## Labels
     <col/> ## Input
     <thead>
@@ -143,6 +143,15 @@
           </select>
         </td>
       </tr>
+      <tr>
+        <td><label>$i18n.getString( "skip_offline" )</label></td>
+        <td>
+          <select id="skipOffline" name="skipOffline" style="min-width:20em; margin:0;">
+            <option value="false">$i18n.getString( "no" )</option>
+            <option value="true">$i18n.getString( "yes" )</option>
+          </select>
+        </td>
+      </tr>
     </tbody>
   </table>
   <br/>&nbsp;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2012-09-25 02:21:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2012-09-27 03:57:57 +0000
@@ -52,7 +52,7 @@
 <form id="editDataSetForm" name="editDataSetForm" action="updateDataSet.action" method="post" >
   <input type="hidden" id="dataSetId" name="dataSetId" value="$dataSet.id"/>
   
-  <table id="detailsList">
+  <table id="detailsList" style="width: 540px;">
     <thead>
       <tr>
         <th colspan="2">$i18n.getString( "dataset_details" )</th>
@@ -117,7 +117,7 @@
     </thead>
     <tbody>
       <tr>
-      	<td><label>$i18n.getString( "allow_future_periods" )</label></td>
+      	<td><label for="allowFuturePeriods">$i18n.getString( "allow_future_periods" )</label></td>
       	<td>
       	  <select id="allowFuturePeriods" name="allowFuturePeriods" style="min-width:20em; margin:0;">
       	  	<option value="false">$i18n.getString( "no" )</option>
@@ -126,7 +126,7 @@
 	    </td>
       </tr>
       <tr>
-      	<td><label>$i18n.getString( "all_fields_for_data_element_required" )</label></td>
+      	<td><label for="fieldCombinationRequired">$i18n.getString( "all_fields_for_data_element_required" )</label></td>
       	<td>
       	  <select id="fieldCombinationRequired" name="fieldCombinationRequired" style="min-width:20em; margin:0;">
       	  	<option value="false">$i18n.getString( "no" )</option>
@@ -135,7 +135,7 @@
 	    </td>
       </tr>
       <tr>
-        <td><label>$i18n.getString( "complete_allowed_only_if_validation_passes" )</label></td>
+        <td><label for="validCompleteOnly">$i18n.getString( "complete_allowed_only_if_validation_passes" )</label></td>
         <td>
           <select id="validCompleteOnly" name="validCompleteOnly" style="min-width:20em; margin:0;">
             <option value="false">$i18n.getString( "no" )</option>
@@ -143,6 +143,15 @@
           </select>
         </td>
       </tr>
+      <tr>
+        <td><label for="skipOffline">$i18n.getString( "skip_offline" )</label></td>
+        <td>
+          <select id="skipOffline" name="skipOffline" style="min-width:20em; margin:0;">
+            <option value="false">$i18n.getString( "no" )</option>
+            <option value="true"#if( $dataSet.skipOffline == true ) selected="selected"#end>$i18n.getString( "yes" )</option>
+          </select>
+        </td>
+      </tr>
       <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
     </tbody>
   </table>