← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1902: Changed to using javascript validation for locking. Reusing template which was identical to another

 

------------------------------------------------------------
revno: 1902
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-08-05 21:54:11 +0200
message:
  Changed to using javascript validation for locking. Reusing template which was identical to another
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgUnitValidateAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectSuccess.vm
renamed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectError.vm => dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseError.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseSuccess.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
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgUnitValidateAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgUnitValidateAction.java	2010-08-05 14:34:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgUnitValidateAction.java	1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
-package org.hisp.dhis.dataadmin.action.lock;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-public class OrgUnitValidateAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    
-    private SelectionTreeManager selectionTreeManager;
-
-    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
-    {
-        this.selectionTreeManager = selectionTreeManager;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Input & Output
-    // -------------------------------------------------------------------------
-
-    private String message;
-
-    public String getMessage()
-    {
-        return message;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-    
-    public String execute()
-        throws Exception
-    {
-        Collection<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
-        organisationUnits = selectionTreeManager.getSelectedOrganisationUnits();
-        
-        if ( organisationUnits == null || organisationUnits.size() == 0 )
-        {
-            message = "Please select organisation unit";
-            
-            return INPUT;
-        }
-
-        message = "Success"; 
-        
-        return SUCCESS;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2010-08-05 15:15:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml	2010-08-05 19:54:11 +0000
@@ -31,15 +31,7 @@
 			<ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
 		</property>
 	</bean>
-	
-    <bean id="org.hisp.dhis.dataadmin.action.lock.OrgUnitValidateAction"
-        class="org.hisp.dhis.dataadmin.action.lock.OrgUnitValidateAction"
-        scope="prototype">
-       <property name="selectionTreeManager">
-       <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager" />
-       </property>
-    </bean>
-		
+			
 	<bean id="org.hisp.dhis.dataadmin.action.lock.GetPeriodTypesAction"
 		class="org.hisp.dhis.dataadmin.action.lock.GetPeriodTypesAction"
 		scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2010-08-04 06:14:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2010-08-05 19:54:11 +0000
@@ -262,12 +262,13 @@
 locking_mode													    = Locking mode
 lock                                     						    = Lock
 unlock                                  						    = Unlock
-period_not_selected     											= Select Avaliable Period
-dataset_not_selected												= Select Avaliable data sets 
-select_all_at_level_saved  											= Select All at Level Saved
-unselect_all_at_level_saved											= Unselect	All at Level Saved
-select_all_in_group_saved											= Select All at Group Saved 
-unselect_all_in_group_saved											= Unselect All at Group Saved
-information_successfully_locked										= Data Successfully Locked
-information_successfully_unlocked									= Data Successfully Unlocked 
+period_not_selected     											= Please select a period
+dataset_not_selected												= Please select a data set
+organisation_unit_not_selected										= Please select an organisation unit 
+select_all_at_level_saved  											= Saved lock on all at level
+unselect_all_at_level_saved											= Removed lock on all at level
+select_all_in_group_saved											= Saved lock on all in group 
+unselect_all_in_group_saved											= Removed lock on all in group
+information_successfully_locked										= Data successfully locked
+information_successfully_unlocked									= Data successfully unlocked 
 		              
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-08-05 15:15:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2010-08-05 19:54:11 +0000
@@ -33,15 +33,6 @@
 			<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/datasetLockReport.js</param>
 		</action>
 		
-		<action name="orgUnitValidate"
-			class="org.hisp.dhis.dataadmin.action.lock.OrgUnitValidateAction">
-			<result name="success" type="velocity-xml">
-				/dhis-web-maintenance-dataadmin/responseOrgUnitSelectSuccess.vm</result>
-			<result name="input" type="velocity-xml">
-				/dhis-web-maintenance-dataadmin/responseOrgUnitSelectError.vm</result>
-			<param name="onExceptionReturn">plainTextError</param>
-		</action>
-		
 		<action name="getDataSetsForPeriodType"
 			class="org.hisp.dhis.dataadmin.action.lock.GetDataSetsForPeriodTypeAction">
 			<result name="success" type="velocity">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm	2010-08-05 15:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingForm.vm	2010-08-05 19:54:11 +0000
@@ -1,17 +1,4 @@
 
-<script type="text/javascript">
-	
-	var i18n_organisation_not_selected = '$encoder.jsEscape( $i18n.getString( "organisation_not_selected" ) , "'")';
-	var i18n_period_not_selected = '$encoder.jsEscape( $i18n.getString( "period_not_selected" ) , "'")';
-	var i18n_dataset_not_selected = '$encoder.jsEscape( $i18n.getString( "dataset_not_selected" ) , "'")';
-	var i18n_lock = '$encoder.jsEscape( $i18n.getString( "lock" ) , "'")';
-	var i18n_unlock = '$encoder.jsEscape( $i18n.getString( "unlock" ) , "'")';
-	var i18n_select_all_at_level = '$encoder.jsEscape( $i18n.getString( "select_all_at_level" ) , "'")';
-	var i18n_unselect_all_at_level = '$encoder.jsEscape( $i18n.getString( "unselect_all_at_level" ) , "'")';
-	var i18n_select_all_at_group = '$encoder.jsEscape( $i18n.getString( "select_all_in_group" ) , "'")';
-    var i18n_unselect_all_at_group = '$encoder.jsEscape( $i18n.getString( "unselect_all_in_group" ) , "'")';
-</script>
-
 <h3>$i18n.getString( "data_locking_form" ) #openHelp( "dataLocking" )</h3>
 	
 <form id="lockingForm" name="lockingForm" action="collectiveDataLocking.action" method="post" onsubmit="return validateCollectiveDataLockingForm()">
@@ -102,13 +89,20 @@
 </form>
 							 
 <script type="text/javascript">
-	
-	var i18n_loading = '$encoder.jsEncode( $i18n.getString( "loading" ) )';
-	var numberOfSelects = 0;
     selectionTreeSelection.setMultipleSelectionAllowed( true );
     selectionTreeSelection.setOnSelectFunction( treeClicked );
     selectionTreeSelection.setListenerFunction( selectCompleted );
     selectionTree.clearSelectedOrganisationUnits();
     selectionTree.buildSelectionTree();
 
-</script>
\ No newline at end of file
+	var i18n_loading = '$encoder.jsEncode( $i18n.getString( "loading" ) )';
+	var i18n_organisation_unit_not_selected = '$encoder.jsEscape( $i18n.getString( "organisation_unit_not_selected" ) , "'")';
+	var i18n_period_not_selected = '$encoder.jsEscape( $i18n.getString( "period_not_selected" ) , "'")';
+	var i18n_dataset_not_selected = '$encoder.jsEscape( $i18n.getString( "dataset_not_selected" ) , "'")';
+	var i18n_lock = '$encoder.jsEscape( $i18n.getString( "lock" ) , "'")';
+	var i18n_unlock = '$encoder.jsEscape( $i18n.getString( "unlock" ) , "'")';
+	var i18n_select_all_at_level = '$encoder.jsEscape( $i18n.getString( "select_all_at_level" ) , "'")';
+	var i18n_unselect_all_at_level = '$encoder.jsEscape( $i18n.getString( "unselect_all_at_level" ) , "'")';
+	var i18n_select_all_at_group = '$encoder.jsEscape( $i18n.getString( "select_all_in_group" ) , "'")';
+    var i18n_unselect_all_at_group = '$encoder.jsEscape( $i18n.getString( "unselect_all_in_group" ) , "'")';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm	2010-08-04 06:14:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/collectiveDataLockingStatus.vm	2010-08-05 19:54:11 +0000
@@ -1,4 +1,6 @@
 
 <h3>$i18n.getString( "data_locking_form" ) #openHelp( "dataLocking" )</h3>
 
-<div align="left"><h3>$message</h3></div>
\ No newline at end of file
+<div align="left"><h3>$message</h3></div>
+
+<p><input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='displayLockingForm.action'" style="width:100px"></p>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js	2010-08-05 15:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js	2010-08-05 19:54:11 +0000
@@ -1,5 +1,7 @@
 
 var clickedButtonElement = null;
+var numberOfSelects = 0;
+var selectedOrgunits = new Array();
 	
 function setClickedButtonElementValue( buttonElement )
 {
@@ -21,13 +23,13 @@
 		}
 		if( i == periodIdOptions.length )
 		{
-			setHeaderMessage(i18n_period_not_selected);
+			setHeaderDelayMessage(i18n_period_not_selected);
 			return false;
 		}
 	}
 	else
 	{
-		setHeaderMessage( i18n_period_not_selected );
+		setHeaderDelayMessage( i18n_period_not_selected );
 		return false;
 	}
 		
@@ -43,20 +45,23 @@
 		}
 		if( i==dataSetIdsOptions.length )
 		{
-			setHeaderMessage( i18n_dataset_not_selected );
+			setHeaderDelayMessage( i18n_dataset_not_selected );
 			return false;
 		}
 	}
 	else
 	{
-		setHeaderMessage( i18n_dataset_not_selected );
+		setHeaderDelayMessage( i18n_dataset_not_selected );
 		return false;
 	}
 			
     if( clickedButtonElement == i18n_lock || clickedButtonElement == i18n_unlock )
     {
-		orgUnitSelectValidation();
-		return false;
+		if ( selectedOrgunits == null || selectedOrgunits.length <= 0 )
+		{
+			setHeaderDelayMessage( i18n_organisation_unit_not_selected );
+			return false;			
+		}
     }
 	else if( clickedButtonElement == i18n_select_all_at_level || clickedButtonElement == i18n_unselect_all_at_level )
 	{	
@@ -79,9 +84,7 @@
 //------------------------------------------------------------------------------
 function treeClicked() {
 	numberOfSelects++;
-
-	setMessage(i18n_loading);
-
+	
 	document.getElementById("Lock").disabled = true;
 	document.getElementById("Unlock").disabled = true;
 }
@@ -90,47 +93,12 @@
 	numberOfSelects--;
 
 	if (numberOfSelects <= 0) {
-		hideMessage();
 
 		document.getElementById("Lock").disabled = false;
 		document.getElementById("Unlock").disabled = false;
 	}
-}
-
-function selectReceived() {
-	selectionTree.buildSelectionTree();
-}
-// ------------------------------------------------------------------------------
-// Tree Selection validation Method
-// ------------------------------------------------------------------------------
-function orgUnitSelectValidation()
-{
-	var request = new Request();
-	request.setResponseTypeXML('message');
-	request.setCallbackSuccess(orgUnitSelectValidationCompleted);
-
-	var requestString = 'orgUnitValidate.action';
-
-	request.send(requestString);
-
-	return false;
-}
-
-function orgUnitSelectValidationCompleted(messageElement)
-{
-	var type = messageElement.getAttribute('type');
-	var message = messageElement.firstChild.nodeValue;
-
-	if (type == 'success')
-	{
-		document.forms['lockingForm'].submit();
-	} 
-	else if (type == 'input') 
-	{
-		// setMessage( i18n_loading );
-		document.getElementById('message').innerHTML = message;
-		document.getElementById('message').style.display = 'block';
-	}
+	
+	selectedOrgunits = selectedUnits;
 }
 
 // ------------------------------------------------------------------------------

=== renamed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectError.vm' => 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseError.vm'
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectSuccess.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectSuccess.vm	2010-08-03 12:43:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseOrgUnitSelectSuccess.vm	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<message type="success">$encoder.xmlEncode( $message )</message>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseSuccess.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/responseSuccess.vm	2010-08-05 19:54:11 +0000
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<message type="success">$encoder.xmlEncode( $message )</message>
+<message type="success">$encoder.xmlEncode( $message )</message>
\ No newline at end of file