← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1900: Moved javascript from vm template to js file. Changed to use header message for feedback instead ...

 

------------------------------------------------------------
revno: 1900
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-08-05 17:39:52 +0200
message:
  Moved javascript from vm template to js file. Changed to use header message for feedback instead of alert
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js
  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/javascript/datasetLockReport.js


--
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/util/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2010-07-14 03:04:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2010-08-05 15:39:52 +0000
@@ -418,7 +418,7 @@
 function setHeaderMessage( message )
 {
     $( 'div#headerMessage' ).html( message );
-    $( 'div#headerMessage' ).slideDown();
+    $( 'div#headerMessage' ).slideDown( 'fast' );
 }
 
 /**
@@ -439,7 +439,7 @@
 function setHeaderWaitMessage( message )
 {
 	$( 'div#headerMessage' ).html( message + "&nbsp;&nbsp;&nbsp;<img src='../images/ajax-loader-bar-small.gif'>" );
-    $( 'div#headerMessage' ).slideDown();
+    $( 'div#headerMessage' ).slideDown( 'fast' );
 }
 
 /**
@@ -469,7 +469,7 @@
  */
 function hideHeaderMessage()
 {
-    $( 'div#headerMessage' ).slideUp();
+    $( 'div#headerMessage' ).slideUp( 'fast' );
 }   
 
 /**

=== 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-04 06:14:23 +0000
+++ 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
@@ -10,81 +10,6 @@
 	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" ) , "'")';
-	var clickedButtonElement;
-
-	function setClickedButtonElementValue( buttonElement )
-	{
-		clickedButtonElement = buttonElement.value;
-		document.getElementById("selectBetweenLockUnlock").value = clickedButtonElement;
-	}
-
-	function validateCollectiveDataLockingForm()
-	{		
-		periodIdOptions = document.getElementById("periodId").options;
-			
-		if( periodIdOptions.length > 0 )
-		{
-			var i;
-			for( i=0; i < periodIdOptions.length ; i++ )
-			{
-				if( periodIdOptions[i].selected == true )
-						break;
-			}
-			if( i == periodIdOptions.length )
-			{
-				alert(i18n_period_not_selected);
-				return false;
-			}
-		}
-		else
-		{
-			alert( i18n_period_not_selected );
-			return false;
-		}
-			
-		dataSetIdsOptions = document.getElementById("dataSetIds").options;
-				
-		if( dataSetIdsOptions.length > 0 )
-		{
-			var i;
-			for( i=0; i < dataSetIdsOptions.length ; i++)
-			{
-				if( dataSetIdsOptions[i].selected == true )
-					break;
-			}
-			if( i==dataSetIdsOptions.length )
-			{
-				alert( i18n_dataset_not_selected );
-				return false;
-			}
-		}
-		else
-		{
-			alert(i18n_dataset_not_selected);
-			return false;
-		}
-				
-        if( clickedButtonElement == i18n_lock || clickedButtonElement == i18n_unlock )
-        {
-			orgUnitSelectValidation();
-			return false;
-        }
-		else if( clickedButtonElement == i18n_select_all_at_level || clickedButtonElement == i18n_unselect_all_at_level )
-		{	
-			levelIdOptions = document.getElementById("levelId").options;
-			if(!levelIdOptions.length>0)
-				return false;
-		}
-	    else if( clickedButtonElement == i18n_select_all_at_group || clickedButtonElement == i18n_unselect_all_at_group )
-	    {
-			ougGroupOptions = document.getElementById("orgGroup").options;
-			if( !ougGroupOptions.length > 0 )
-				return false;
-	    } 
-		
-		return true;
-	}
-	               
 </script>
 
 <h3>$i18n.getString( "data_locking_form" ) #openHelp( "dataLocking" )</h3>

=== 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-04 06:14:23 +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 15:39:52 +0000
@@ -1,4 +1,79 @@
 
+var clickedButtonElement = null;
+	
+function setClickedButtonElementValue( buttonElement )
+{
+	clickedButtonElement = buttonElement.value;
+	document.getElementById("selectBetweenLockUnlock").value = clickedButtonElement;
+}
+
+function validateCollectiveDataLockingForm()
+{		
+	periodIdOptions = document.getElementById("periodId").options;
+		
+	if( periodIdOptions.length > 0 )
+	{
+		var i;
+		for( i=0; i < periodIdOptions.length ; i++ )
+		{
+			if( periodIdOptions[i].selected == true )
+					break;
+		}
+		if( i == periodIdOptions.length )
+		{
+			setHeaderMessage(i18n_period_not_selected);
+			return false;
+		}
+	}
+	else
+	{
+		setHeaderMessage( i18n_period_not_selected );
+		return false;
+	}
+		
+	dataSetIdsOptions = document.getElementById("dataSetIds").options;
+			
+	if( dataSetIdsOptions.length > 0 )
+	{
+		var i;
+		for( i=0; i < dataSetIdsOptions.length ; i++)
+		{
+			if( dataSetIdsOptions[i].selected == true )
+				break;
+		}
+		if( i==dataSetIdsOptions.length )
+		{
+			setHeaderMessage( i18n_dataset_not_selected );
+			return false;
+		}
+	}
+	else
+	{
+		setHeaderMessage( i18n_dataset_not_selected );
+		return false;
+	}
+			
+    if( clickedButtonElement == i18n_lock || clickedButtonElement == i18n_unlock )
+    {
+		orgUnitSelectValidation();
+		return false;
+    }
+	else if( clickedButtonElement == i18n_select_all_at_level || clickedButtonElement == i18n_unselect_all_at_level )
+	{	
+		levelIdOptions = document.getElementById("levelId").options;
+		if(!levelIdOptions.length>0)
+			return false;
+	}
+    else if( clickedButtonElement == i18n_select_all_at_group || clickedButtonElement == i18n_unselect_all_at_group )
+    {
+		ougGroupOptions = document.getElementById("orgGroup").options;
+		if( !ougGroupOptions.length > 0 )
+			return false;
+    } 
+	
+	return true;
+}
+
 //------------------------------------------------------------------------------
 // Organisation Tree
 //------------------------------------------------------------------------------