← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1818: Added new method in oust.js which is used to clear the history of the selected orgunits before.

 

------------------------------------------------------------
revno: 1818
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-04-27 14:20:12 +0700
message:
  Added new method in oust.js which is used to clear the history of the selected orgunits before.
  - First of all, the problem is that the orgunit is selected visually in the tree, which has been fixed in some of forms/views.
  - Second, PLS report a general bug that relative to this https://bugs.launchpad.net/bugs/338673. Thanks all.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ClearSelectedOrgUnitsBeforeAction.java
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/SelectReportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/selectTallySheetForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js	2009-10-22 17:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js	2010-04-27 07:20:12 +0000
@@ -113,6 +113,15 @@
 
 function SelectionTree()
 {
+    this.clearSelectedOrgUnitsBefore = function()
+    {
+        var request = new Request();
+        request.setResponseTypeXML( 'xmlObject' );
+		request.setCallbackSuccess( clearSelectedOrgUnitsCompleted );
+		request.send( selectionTreePath + 'clearSelectedOrgUnitsBefore.action' );
+
+    };
+
     this.toggle = function( unitId )
     {
         var parentTag = document.getElementById( getTagId( unitId ));
@@ -332,4 +341,17 @@
     {
         treeTag.style.backgroundImage = 'none';
     }
+		
+	function clearSelectedOrgUnitsCompleted( xmlObject )
+	{
+		if ( xmlObject != null )
+		{
+			var type = xmlObject.getAttribute( 'type' );
+			
+			if ( type == 'error' )
+			{
+				alert( xmlObject.firstChild.nodeValue );
+			}
+		}		
+	}
 }

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseError.vm	2010-04-27 07:20:12 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="error">$encoder.xmlEncode( $message )</message>

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSuccess.vm	2010-04-27 07:20:12 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="success">$encoder.xmlEncode( $message )</message>

=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ClearSelectedOrgUnitsBeforeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ClearSelectedOrgUnitsBeforeAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/oust/action/ClearSelectedOrgUnitsBeforeAction.java	2010-04-27 07:20:12 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.oust.action;
+
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ * @since 2010-04-27
+ */
+public class ClearSelectedOrgUnitsBeforeAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectionTreeManager selectionTreeManager;
+
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+    {
+        this.selectionTreeManager = selectionTreeManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+    public String execute()
+    {
+        try
+        {
+            selectionTreeManager.clearSelectedOrganisationUnits();
+        }
+        catch ( Exception e )
+        {
+            message = "cannot_clear_selected_orgunits";
+
+            return ERROR;
+        }
+
+        message = "OK";
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2010-03-31 09:54:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2010-04-27 07:20:12 +0000
@@ -258,6 +258,14 @@
 			<ref local="org.hisp.dhis.oust.manager.SelectionTreeManager" />
 		</property>
 	</bean>
+	
+	<bean id="org.hisp.dhis.oust.action.ClearSelectedOrgUnitsBeforeAction"
+		class="org.hisp.dhis.oust.action.ClearSelectedOrgUnitsBeforeAction"
+		scope="prototype">
+		<property name="selectionTreeManager">
+			<ref local="org.hisp.dhis.oust.manager.SelectionTreeManager" />
+		</property>
+	</bean>
 
 	<!-- Security : Action -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2010-03-31 09:54:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2010-04-27 07:20:12 +0000
@@ -151,6 +151,15 @@
 				/dhis-web-commons/ouwt/responseSelect.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
+		
+		<action name="clearSelectedOrgUnitsBefore"
+			class="org.hisp.dhis.oust.action.ClearSelectedOrgUnitsBeforeAction">
+			<result name="success" type="velocity-xml">
+				/dhis-web-commons/ouwt/responseSuccess.vm</result>
+			<result name="error" type="velocity-xml">
+				/dhis-web-commons/ouwt/responseError.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
 
 	</package>
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-04-01 09:31:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2010-04-27 07:20:12 +0000
@@ -32,6 +32,7 @@
 
 org_unit_tree = Organisation Unit Tree
 specify_organisationunit = Please specify an organisation unit
+cannot_clear_selected_orgunits = Cannot clear the selected organisation units before !
 
 #-- Modules -------------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties	2010-04-23 13:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties	2010-04-27 07:20:12 +0000
@@ -32,6 +32,7 @@
 
 org_unit_tree 							= C\u00e2y \u0111\u01a1n v\u1ecb
 specify_organisationunit 				= Vui l\u00f2ng ch\u1ecdn \u0111\u01a1n v\u1ecb
+cannot_clear_selected_orgunits          = Kh\u00f4ng th\u1ec3 x\u00f3a c\u00e1c \u0111\u01a1n v\u1ecb \u0111\u01b0\u1ee3c ch\u1ecdn tr\u01b0\u1edbc \u0111\u00f3
 
 #-- Modules -------------------------------------------------------------------#
 

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2010-03-25 08:15:35 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2010-04-27 07:20:12 +0000
@@ -217,4 +217,5 @@
 translation_translate		= Translate
 template_using              = File is using
 template_pending            = File is pending
-expression_not_well_formed 	= Expression is not well formed
\ No newline at end of file
+expression_not_well_formed 	= Expression is not well formed
+print						= Print template...
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties	2010-03-24 02:56:06 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties	2010-04-27 07:20:12 +0000
@@ -210,4 +210,5 @@
 intro_data_status           = Ch\u1ee9c n\u0103ng n\u00e0y d\u00f9ng \u0111\u1ec3 xem tr\u1ea1ng th\u00e1i nh\u1eadp d\u1eef li\u1ec7u (D\u1eef li\u1ec7u \u0111\u01b0\u1ee3c nh\u1eadp xong hay ch\u01b0a ho\u1eb7c s\u1ed1 li\u1ec7u n\u00e0o c\u00f2n thi\u1ebfu v.v...).
 intro_clean_up              = Ch\u1ee9c n\u0103ng n\u00e0y cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng x\u00f3a c\u00e1c t\u1eadp tin t\u1ea1m sinh ra trong qu\u00e1 tr\u00ecnh sinh b\u00e1o c\u00e1o ho\u1eb7c xem tr\u01b0\u1edbc b\u00e1o c\u00e1o.
 intro_excel_item            = T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0o x\u00f3a c\u00e1c ph\u1ea7n t\u1eed excel cho qu\u00e1 tr\u00ecnh import d\u1eef li\u1ec7u t\u1eeb t\u1eadp tin excel. Ph\u1ea7n t\u1eed excel n\u00e0y c\u00f3 ch\u1ee9c n\u0103ng g\u1ea7n gi\u1ed1ng v\u1edbi ph\u1ea7n t\u1eed excel trong m\u1ed9t b\u00e1o c\u00e1o excel.
-intro_excel_template_management = T\u1ea3i ,\u0111\u1ed5i t\u00ean, t\u00ecm ki\u1ebfm, t\u1ea3i v\u1ec1 v\u00e0 x\u00f3a c\u00e1c t\u1eadp tin c\u00f3 \u0111u\u00f4i m\u1edf r\u1ed9ng .xls ho\u1eb7c .xlsx. Ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 nh\u1eadn bi\u1ebft t\u1eadp tin n\u00e0o \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng v\u00e0 t\u1eadp tin n\u00e0o ch\u01b0a d\u00f9ng \u0111\u1ebfn. Cho ph\u00e9p t\u1ef1 \u0111\u1ed9ng c\u1eadp nh\u1eadt l\u1ea1i h\u1ec7 th\u1ed1ng b\u00e1o c\u00e1o excel khi t\u00ean t\u1eadp tin \u0111ang s\u1eed d\u1ee5ng thay \u0111\u1ed5i.  
\ No newline at end of file
+intro_excel_template_management = T\u1ea3i ,\u0111\u1ed5i t\u00ean, t\u00ecm ki\u1ebfm, t\u1ea3i v\u1ec1 v\u00e0 x\u00f3a c\u00e1c t\u1eadp tin c\u00f3 \u0111u\u00f4i m\u1edf r\u1ed9ng .xls ho\u1eb7c .xlsx. Ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 nh\u1eadn bi\u1ebft t\u1eadp tin n\u00e0o \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng v\u00e0 t\u1eadp tin n\u00e0o ch\u01b0a d\u00f9ng \u0111\u1ebfn. Cho ph\u00e9p t\u1ef1 \u0111\u1ed9ng c\u1eadp nh\u1eadt l\u1ea1i h\u1ec7 th\u1ed1ng b\u00e1o c\u00e1o excel khi t\u00ean t\u1eadp tin \u0111ang s\u1eed d\u1ee5ng thay \u0111\u1ed5i.
+print						= In th\u1eed...
\ 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/showAssignMultiDataSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm	2010-03-31 09:54:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm	2010-04-27 07:20:12 +0000
@@ -107,6 +107,7 @@
 			selectionTreeSelection.setMultipleSelectionAllowed( true );
 			selectionTreeSelection.setOnSelectFunction( treeClicked );
 			selectionTreeSelection.setListenerFunction( selectCompleted );
+			selectionTree.clearSelectedOrgUnitsBefore();
 			selectionTree.buildSelectionTree();
 
 			var numberOfSelects = 0;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/SelectReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/SelectReportAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/SelectReportAction.java	2010-04-27 07:20:12 +0000
@@ -44,6 +44,7 @@
  * @author Abyot Asalefew Gizaw
  * @version $Id$
  */
+@SuppressWarnings("serial")
 public class SelectReportAction
     extends AbstractAction
 {
@@ -146,7 +147,7 @@
         throws Exception
     {  
     	dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
-    	selectedStateManager.clearSelectedOrganisationUnits();
+    	
     	// ---------------------------------------------------------------------
         // Remove DataSets which don't have a CalendarPeriodType
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm	2010-04-27 07:20:12 +0000
@@ -51,6 +51,7 @@
         <div id="selectionTree" style="width:40em;height:30em;overflow:auto;border:1px solid #cccccc">			
 			<script type="text/javascript">
           		selectionTreeSelection.setMultipleSelectionAllowed( false );
+				selectionTree.clearSelectedOrgUnitsBefore();
           		selectionTree.buildSelectionTree();
         	</script>										
 		</div>		

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/selectTallySheetForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/selectTallySheetForm.vm	2009-08-22 20:07:24 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/selectTallySheetForm.vm	2010-04-27 07:20:12 +0000
@@ -49,6 +49,7 @@
         <div id="selectionTree" style="width:40em;height:30em;overflow:auto;border:1px solid #cccccc">			
 			<script type="text/javascript">
           		selectionTreeSelection.setMultipleSelectionAllowed( false );
+				selectionTree.clearSelectedOrgUnitsBefore();
           		selectionTree.buildSelectionTree();
         	</script>
 		</div>	

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2010-03-08 14:50:40 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2010-04-27 07:20:12 +0000
@@ -11,6 +11,7 @@
 		            
 		    <script type="text/javascript">
 		        selectionTreeSelection.setMultipleSelectionAllowed( false );
+				selectionTree.clearSelectedOrgUnitsBefore();
 		        selectionTree.buildSelectionTree();
 		    </script>
         </td>