← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9132: local vn - Added "Rollback" button into importing form.

 

------------------------------------------------------------
revno: 9132
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-27 13:33:42 +0700
message:
  local vn - Added "Rollback" button into importing form.
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/RollbackImportingAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/menu.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 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/RollbackImportingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/RollbackImportingAction.java	2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/importing/action/RollbackImportingAction.java	2012-11-27 06:33:42 +0000
@@ -27,22 +27,22 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.HashSet;
 import java.util.Set;
 
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
 import org.hisp.dhis.reportsheet.state.SelectionManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
-
 /**
  * @author Dang Duy Hieu
  * @version $Id$
  */
 
 public class RollbackImportingAction
-    implements Action
+    extends ActionSupport
 {
     @Autowired
     private SelectionManager selectionManager;
@@ -56,24 +56,47 @@
 
     public String execute()
     {
+        message = "";
+        
         Set<DataValue> oldDataValues = selectionManager.getOldDataValueList();
         Set<DataValue> newDataValues = selectionManager.getNewDataValueList();
 
-        if ( oldDataValues != null )
+        int i = 0;
+
+        if ( oldDataValues != null && !oldDataValues.isEmpty() )
         {
             for ( DataValue dv : oldDataValues )
             {
                 dataValueService.updateDataValue( dv );
+
+                i++;
             }
+            
+            selectionManager.setOldDataValueList( new HashSet<DataValue>() );
+
+            message = i18n.getString( "old_value" ) + ": " + i + "/" + oldDataValues.size() + " "
+                + i18n.getString( "reverted" ) + "<br/>";
         }
 
-        if ( newDataValues != null )
+        i = 0;
+
+        if ( newDataValues != null && !newDataValues.isEmpty() )
         {
             for ( DataValue dv : newDataValues )
             {
                 dataValueService.deleteDataValue( dv );
+
+                i++;
             }
+
+            selectionManager.setNewDataValueList( new HashSet<DataValue>() );
+            
+            message = i18n.getString( "new_value" ) + ": " + i + "/" + oldDataValues.size() + " "
+                + i18n.getString( "deleted" );
         }
+        
+        oldDataValues = null;
+        newDataValues = null;
 
         return SUCCESS;
     }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-11-27 04:26:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-11-27 06:33:42 +0000
@@ -357,7 +357,7 @@
 intro_attribute_group_order = Create new, update, view, sort and delete the group of attribute value. This group can be used in entry hospital, ie. Group of ICD Diseases
 intro_organisation_unit_prototype = Create new, update, view and delete an Organisation Unit Prototype. This one is the name of unit which can be apperanced in other upper units. 
 intro_organisation_unit_prototype_group = Create new, update, view and delete an Organisation Unit Prototype Group. This group contain the list of Organisation Unit Prototypes.
-into_add_multi_organisation_unit = Allow to create multi-org-unit at the same time based on the selected parent unit and many other params.
+intro_add_multi_organisation_unit = Allow to create multi-org-unit at the same time based on the selected parent unit and many other params.
 orgunit_prototype_management = Organisation Unit Prototype Management
 create_new_orgunit_prototype = Create new Organisation unit prototype
 edit_org_unit_prototype 	 = Edit Organisation unit prototype
@@ -380,4 +380,10 @@
 uncompleted					 = uncompleted
 specified_data_set_unavailable = Selected data set is not exist
 specified_data_set_unassign_to_export_report = Selected data set is not assign to any Export report
-data_value					= data value
\ No newline at end of file
+roll_back_import 			= Rollback imported value
+data_value					= data value
+old_value					= The old value
+new_value					= The new value
+reverted					= reverted
+deleted						= deleted
+no_value_rollbacked			= There is no value rollbacked
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-11-27 04:26:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-11-27 06:33:42 +0000
@@ -386,7 +386,7 @@
 intro_attribute_group_order = Cho ph\u00e9p th\u00eam, x\u00f3a, s\u1eafp th\u1ee9 t\u1ef1, s\u1eeda c\u00e1c nh\u00f3m. Trong \u0111\u00f3 m\u1ed7i nh\u00f3m c\u00f3 th\u1ec3 ch\u1ee9 m\u1ed9t ho\u1eb7c nhi\u1ec1u gi\u00e1 tr\u1ecb Thu\u1ed9c t\u00ednh. V\u00ed d\u1ee5 s\u1eed d\u1ee5ng cho nh\u1eadp d\u1eef li\u1ec7u b\u1ec7nh vi\u1ec7n m\u1eabu ICD.
 intro_organisation_unit_prototype = T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c \u0110\u01a1n v\u1ecb ki\u1ec3u m\u1eabu. M\u1ed9t \u0111\u01a1n v\u1ecb ki\u1ec3u m\u1eabu c\u00f3 c\u00e1c th\u00f4ng tin nh\u01b0 T\u00ean v\u00e0 T\u00ean vi\u1ebft t\u1eaft.
 intro_organisation_unit_prototype_group = T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c Nh\u00f3m \u0110\u01a1n v\u1ecb ki\u1ec3u m\u1eabu. M\u1ed9t Nh\u00f3m \u0111\u01a1n v\u1ecb ki\u1ec3u m\u1eabu c\u00f3 c\u00e1c th\u00f4ng tin nh\u01b0 T\u00ean v\u00e0 danh s\u00e1ch c\u00e1c \u0111\u01a1n v\u1ecb ki\u1ec3u m\u1eabu.
-into_add_multi_organisation_unit = Ch\u1ee9c n\u0103ng cho ph\u00e9p b\u1ea1n t\u1ea1o nhi\u1ec1u \u0111\u01a1n v\u1ecb c\u00f9ng l\u00fac d\u1ef1a tr\u00ean \u0111\u01a1n v\u1ecb cha \u0111\u01b0\u1ee3c ch\u1ecdn v\u00e0 c\u00e1c th\u00f4ng s\u1ed1 li\u00ean quan. 
+intro_add_multi_organisation_unit = Ch\u1ee9c n\u0103ng cho ph\u00e9p b\u1ea1n t\u1ea1o nhi\u1ec1u \u0111\u01a1n v\u1ecb c\u00f9ng l\u00fac d\u1ef1a tr\u00ean \u0111\u01a1n v\u1ecb cha \u0111\u01b0\u1ee3c ch\u1ecdn v\u00e0 c\u00e1c th\u00f4ng s\u1ed1 li\u00ean quan. 
 create_new_orgunit_prototype = T\u1ea1o m\u1edbi \u0110\u01a1n v\u1ecb ki\u1ec3u m\u1eabu
 edit_org_unit_prototype = Ch\u1ec9nh s\u1eeda \u0110\u01a1n v\u1ecb ki\u1ec3u m\u1eabu
 orgunit_prototype_management = Qu\u1ea3n l\u00fd \u0110\u01a1n v\u1ecb ki\u1ec3u m\u1eabu
@@ -410,4 +410,10 @@
 uncompleted	= ch\u01b0a ho\u00e0n t\u1ea5t
 specified_data_set_unavailable = M\u1eabu b\u00e1o c\u00e1o n\u00e0y kh\u00f4ng t\u1ed3n t\u1ea1i
 specified_data_set_unassign_to_export_report = M\u1eabu b\u00e1o c\u00e1o n\u00e0y ch\u01b0a \u0111\u01b0\u1ee3c g\u00e1n v\u00e0o b\u1ea5t k\u1ef3 bi\u1ec3u Xu\u1ea5t n\u00e0o
-data_value = gi\u00e1 tr\u1ecb
\ No newline at end of file
+roll_back_import = Ph\u1ee5c h\u1ed3i gi\u00e1 tr\u1ecb import
+data_value = gi\u00e1 tr\u1ecb
+old_value = D\u1eef li\u1ec7u c\u0169
+new_value = D\u1eef li\u1ec7u m\u1edbi
+reverted = ph\u1ee5c h\u1ed3i
+deleted	= b\u1ecb x\u00f3a
+no_value_rollbacked = Kh\u00f4ng c\u00f3 d\u1eef li\u1ec7u n\u00e0o \u0111\u01b0\u1ee3c ph\u1ee5c h\u1ed3i
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm	2012-11-27 04:26:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm	2012-11-27 06:33:42 +0000
@@ -44,8 +44,9 @@
 	 
 <hr/>
 <input type="button" onClick="javascript: getPreviewImportData();" style="width:100px" value="$i18n.getString('preview')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
+<input type="button" onClick="javascript: selectAllData( this );" style="width:100px" value="$i18n.getString('select_all')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
 <input type="button" onClick="javascript: importData();" style="width:100px" value="$i18n.getString('import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
-<input type="button" onClick="javascript: selectAllData( this );" style="width:100px" value="$i18n.getString('select_all')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
+<input type="button" onClick="javascript: rollbackImporting();" style="width:100px" value="$i18n.getString('roll_back_import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
 
 <br/><br/>
 
@@ -58,6 +59,7 @@
 	var i18n_select_all = '$encoder.jsEscape( $i18n.getString( "select_all" ) , "'")';
 	var i18n_unselect_all = '$encoder.jsEscape( $i18n.getString( "unselect_all" ) , "'")';
 	var i18n_data_value = '$encoder.jsEscape( $i18n.getString( "data_value" ) , "'")';
+	var i18n_no_value_rollbacked = '$encoder.jsEscape( $i18n.getString( "no_value_rollbacked" ) , "'")';
 
 	#if ( $!fileExcel && $!organisationUnit )
 		getPeriodsByImportReport( jQuery("#importReportId").val() );

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js	2012-11-27 04:26:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js	2012-11-27 06:33:42 +0000
@@ -138,8 +138,8 @@
 	);
 }
 	
-function uploadExcelImport(){
-	
+function uploadExcelImport()
+{	
 	jQuery( "#upload" ).upload( 'uploadExcelImport.action',
 		{ 'draft': true },
 		function( data, e ) {
@@ -151,4 +151,15 @@
 			}
 		}
 	);
+}
+
+function rollbackImporting()
+{
+	jQuery.get( "rollbackImporting.action", {}, function( json ) {
+		if ( json.response && json.response == "success" ) {
+			showSuccessMessage( json.message );
+		} else {
+			showWarningMessage( i18n_no_value_rollbacked );
+		}
+	} );
 }
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/menu.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/menu.vm	2012-11-19 04:33:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/menu.vm	2012-11-27 06:33:42 +0000
@@ -5,9 +5,10 @@
 
 <h2><a href="selectExportReportParam.action">$i18n.getString( "generate_report" )&nbsp;</a></h2>
 <ul>
-	<li><a href="viewDataEntryStatus.action">$i18n.getString( "view_data_status" )</a></li>
+	<li><a href="../dhis-web-reporting/displayViewDataCompletenessForm.action">$i18n.getString( "view_data_status" )</a></li>
 	<li><a href="selectExportReportParam.action">$i18n.getString( "generate_report" )&nbsp;</a></li>
 	<!--
+	<li><a href="viewDataEntryStatus.action">$i18n.getString( "view_data_status" )</a></li>
 	<li><a href="viewJCharts.action">$i18n.getString( "chart" )&nbsp;</a></li>
 	<li><a href="selectAdvancedExportForm.action">$i18n.getString( "generate_advanced_report" )&nbsp;</a></li>
 	<li><a href="dataSetCompletedReports.action">$i18n.getString( "dataset_completed_report" )&nbsp;</a></li>