← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3025: started separation of templates and javascript

 

------------------------------------------------------------
revno: 3025
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-14 10:46:14 +0100
message:
  started separation of templates and javascript
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about/
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about/feedbackForm.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTree.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeMultipleSelect.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeSingleSelect.js
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/updateUserAccountForm.js
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/feedbackForm.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTree.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeMultipleSelect.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSingleSelect.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.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/about/feedbackForm.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/feedbackForm.vm	2010-05-05 09:17:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/feedbackForm.vm	2011-03-14 09:46:14 +0000
@@ -1,22 +1,6 @@
-
+<script type="text/javascript" src="/dhis-web-commons/javascripts/feedbackForm.js"></script>
 <script type="text/javascript">
-
-var i18n_enter_message = '$encoder.jsEscape( $i18n.getString( "enter_message" ) , "'")';
-
-function validateForm()
-{
-	var userMessage = document.getElementById( "userMessage" );
-	
-	if ( userMessage.value.length == 0 )
-	{
-	    setMessage( i18n_enter_message );
-	}
-	else
-	{
-	    document.getElementById( "messageForm" ).submit();
-	}
-}
-
+	var i18n_enter_message = '$encoder.jsEscape( $i18n.getString( "enter_message" ) , "'")';
 </script>
 
 <h3>$i18n.getString( "send_feedback" )</h3>
@@ -42,4 +26,4 @@
 
 </form>
 
-<span id="message"></span>
\ No newline at end of file
+<span id="message"></span>

=== added directory 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about'
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about/feedbackForm.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about/feedbackForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/about/feedbackForm.js	2011-03-14 09:46:14 +0000
@@ -0,0 +1,10 @@
+function validateForm()
+{
+	var userMessage = document.getElementById("userMessage");
+
+	if (userMessage.value.length == 0) {
+		setMessage(i18n_enter_message);
+	} else {
+		document.getElementById("messageForm").submit();
+	}
+}

=== added directory 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust'
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTree.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTree.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTree.js	2011-03-14 09:46:14 +0000
@@ -0,0 +1,6 @@
+jQuery(document).ready(function()
+{
+	selectionTreeSelection.setMultipleSelectionAllowed(true);
+	selectionTree.clearSelectedOrganisationUnits();
+	selectionTree.buildSelectionTree();
+});

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeMultipleSelect.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeMultipleSelect.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeMultipleSelect.js	2011-03-14 09:46:14 +0000
@@ -0,0 +1,123 @@
+var selectedOrganisationUnitListABCDEF;
+
+function addSelectedOrganisationUnitABCDEF( id )
+{
+	selectedOrganisationUnitListABCDEF.append('<option value="' + id + ' selected="selected">' + id + '</option>');
+}
+
+function selectOrganisationUnitABCDEF( ids )
+{
+	selectedOrganisationUnitListABCDEF.empty();
+
+	jQuery.each(ids, function( i, item )
+	{
+		selectedOrganisationUnitListABCDEF.append('<option value="' + item + ' selected="selected">' + item
+				+ '</option>');
+	});
+	byId('treeSelectedId').selectedIndex = 0;
+}
+
+function unSelectChildren()
+{
+	jQuery.get('../dhis-web-commons/oust/removeorgunit.action', {
+		children : true
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function selectChildren()
+{
+	jQuery.get('../dhis-web-commons/oust/addorgunit.action', {
+		children : true
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function selectOrganisationUnitAtLevel()
+{
+	jQuery.get('../dhis-web-commons/oust/addorgunit.action', {
+		level : getFieldValue('levelList')
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function unSelectOrganisationUnitAtLevel()
+{
+	jQuery.get('../dhis-web-commons/oust/removeorgunit.action', {
+		level : getFieldValue('levelList')
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function unSelectAllTree()
+{
+	jQuery.get('../dhis-web-commons/oust/clearSelectedOrganisationUnits.action', function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function selectAllTree()
+{
+	jQuery.get('../dhis-web-commons/oust/selectallorgunit.action', function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function selectOrganisationUnitByGroup()
+{
+	jQuery.get('../dhis-web-commons/oust/addorgunit.action', {
+		organisationUnitGroupId : getFieldValue('groupList')
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function unSelectOrganisationUnitByGroup()
+{
+	jQuery.get('../dhis-web-commons/oust/removeorgunit.action', {
+		organisationUnitGroupId : getFieldValue('groupList')
+	}, function( xml )
+	{
+		selectedOrganisationUnitXMLABCDEF(xml);
+	});
+}
+
+function loadOrganisationUnitLevel()
+{
+	jQuery.getJSON('../dhis-web-commons-ajax-json/getOrganisationUnitLevels.action', function( json )
+	{
+		var levels = jQuery("#levelList");
+		levels.empty();
+		jQuery.each(json.levels, function( i, item )
+		{
+			levels.append('<option value="' + item.level + '">' + item.name + '</option>');
+		});
+		jQuery("#selectionTreeContainer").fadeIn();
+	});
+}
+
+function loadOrganisationUnitGroup()
+{
+	jQuery.getJSON('../dhis-web-commons-ajax-json/getOrganisationUnitGroups.action', function( json )
+	{
+		var groups = jQuery("#groupList");
+		groups.empty();
+		jQuery.each(json.organisationUnitGroups, function( i, item )
+		{
+			groups.append('<option value="' + item.id + '">' + item.name + '</option>');
+		});
+
+		loadOrganisationUnitLevel();
+	});
+}

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeSingleSelect.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeSingleSelect.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/oust/selectionTreeSingleSelect.js	2011-03-14 09:46:14 +0000
@@ -0,0 +1,20 @@
+
+var selectedOrganisationUnitListABCDEF;
+
+jQuery(document).ready( function() {
+
+});
+
+function addSelectedOrganisationUnitABCDEF( id )
+{
+	selectedOrganisationUnitListABCDEF.append( '<option value="' + id + ' selected="selected">' + id + '</option>');
+}	
+
+function selectOrganisationUnitABCDEF( ids )
+{
+	selectedOrganisationUnitListABCDEF.empty();
+	
+	jQuery.each( ids, function(i, item ) {
+		selectedOrganisationUnitListABCDEF.append( '<option value="' + item + ' selected="selected">' + item + '</option>');
+	});
+}

=== added directory 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount'
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/updateUserAccountForm.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/updateUserAccountForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/updateUserAccountForm.js	2011-03-14 09:46:14 +0000
@@ -0,0 +1,70 @@
+jQuery(document).ready(function()
+{
+	/* validation */
+	var rules = {
+		oldPassword : {
+			required : true
+		},
+		rawPassword : {
+			required : false,
+			password : true,
+			rangelength : [ 8, 35 ],
+			notequalto : '#username'
+		},
+		retypePassword : {
+			required : false,
+			equalTo : '#rawPassword'
+		},
+		surname : {
+			required : true,
+			minlength : 2
+		},
+		firstName : {
+			required : true,
+			minlength : 2
+		},
+		email : {
+			email : true
+		},
+		phoneNumber : {}
+	}
+
+	validation2('updateUserinforForm', updateUser, {
+		'rules' : rules
+	});
+
+	jQuery("#rawPassword").attr("maxlength", "35");
+	jQuery("#retypePassword").attr("maxlength", jQuery("#rawPassword").attr("maxlength"));
+	jQuery("#surname").attr("maxlength", "140");
+	jQuery("#firstName").attr("maxlength", "140");
+	jQuery("#email").attr("maxlength", "160");
+	jQuery("#phoneNumber").attr("maxlength", "80");
+	/* end validation */
+
+	var oldPassword = byId('oldPassword');
+	oldPassword.select();
+	oldPassword.focus();
+});
+
+function updateUser()
+{
+	var request = new Request();
+	request.setResponseTypeXML('xmlObject');
+	request.setCallbackSuccess(updateUserReceived);
+
+	var params = "id=" + byId('id').value;
+	params += "&oldPassword=" + byId('oldPassword').value;
+	params += "&rawPassword=" + byId('rawPassword').value;
+	params += "&retypePassword=" + byId('retypePassword').value;
+	params += "&surname=" + byId('surname').value;
+	params += "&firstName=" + byId('firstName').value;
+	params += "&email=" + byId('email').value;
+	params += "&phoneNumber=" + byId('phoneNumber').value;
+	request.sendAsPost(params);
+	request.send('updateUserAccount.action');
+}
+
+function updateUserReceived( xmlObject )
+{
+	setMessage(xmlObject.firstChild.nodeValue);
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTree.vm	2010-04-28 04:59:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTree.vm	2011-03-14 09:46:14 +0000
@@ -1,12 +1,4 @@
 
 ## You don't have to use this template directly if you don't want to
-
+<script type="text/javascript" src="../dhis-web-commons/javascripts/oust/selectionTree.js"></script>
 <div id="selectionTree"></div>
-
-<script type="text/javascript">
-	
-	selectionTreeSelection.setMultipleSelectionAllowed( true );
-	selectionTree.clearSelectedOrganisationUnits();
-	selectionTree.buildSelectionTree();
-	
-</script>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeMultipleSelect.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeMultipleSelect.vm	2011-03-07 12:18:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeMultipleSelect.vm	2011-03-14 09:46:14 +0000
@@ -1,4 +1,33 @@
 <script type="text/javascript" src="../dhis-web-commons/oust/oust.js"></script>
+<script type="text/javascript" src="../dhis-web-commons/javascripts/oust/selectionTreeMultipleSelect.js"></script>
+<script type="text/javascript">
+jQuery(document).ready( function(){		
+	loadOrganisationUnitGroup();
+	selectionTreeSelection.setMultipleSelectionAllowed( true );
+	selectedOrganisationUnitListABCDEF = jQuery( "#treeSelectedId" );
+	#if( $required )
+		selectionTreeSelection.setListenerFunction( selectOrganisationUnitABCDEF );
+	#end
+	#if( $cleanAll )
+		selectionTree.clearSelectedOrganisationUnits();
+	#end
+	selectionTree.buildSelectionTree();
+});
+
+function selectedOrganisationUnitXMLABCDEF( xml )
+{		
+	#if( $required )
+		selectedOrganisationUnitListABCDEF.empty();
+
+		jQuery.each( jQuery( xml ).find( 'unitId'), function(i, item) {
+			id = item.firstChild.nodeValue;
+			selectedOrganisationUnitListABCDEF.append( '<option value="' + id + ' selected="selected">' + id + '</option>');
+		});
+	#end
+	selectionTree.buildSelectionTree();
+}
+</script>
+
 
 ## You don't have to use this template directly if you don't want to
 <table cellspacing=0 width="795px">
@@ -32,150 +61,3 @@
 		</tr>
 	</tbody>
 </table>	
-
-<script type="text/javascript">
-
-	var selectedOrganisationUnitListABCDEF;
-	
-	function addSelectedOrganisationUnitABCDEF( id )
-	{
-		selectedOrganisationUnitListABCDEF.append( '<option value="' + id + ' selected="selected">' + id + '</option>');
-	}
-
-	function selectOrganisationUnitABCDEF( ids )
-	{
-		selectedOrganisationUnitListABCDEF.empty();
-		
-		jQuery.each( ids, function(i, item ){
-			selectedOrganisationUnitListABCDEF.append( '<option value="' + item + ' selected="selected">' + item + '</option>');
-		});
-		byId('treeSelectedId').selectedIndex = 0;
-	}
-	
-	function selectedOrganisationUnitXMLABCDEF( xml )
-	{		
-		#if( $required )
-			selectedOrganisationUnitListABCDEF.empty();
-			
-			jQuery.each( jQuery( xml ).find( 'unitId'), function(i, item){
-				id = item.firstChild.nodeValue;
-				selectedOrganisationUnitListABCDEF.append( '<option value="' + id + ' selected="selected">' + id + '</option>');
-			});
-		#end
-		selectionTree.buildSelectionTree();
-	}	
-	
-	function unSelectChildren()
-	{
-		jQuery.get( '../dhis-web-commons/oust/removeorgunit.action',
-			{children: true},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function selectChildren()
-	{
-		jQuery.get( '../dhis-web-commons/oust/addorgunit.action',
-			{children: true},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function selectOrganisationUnitAtLevel()
-	{
-		jQuery.get( '../dhis-web-commons/oust/addorgunit.action',
-			{level: getFieldValue( 'levelList' )},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function unSelectOrganisationUnitAtLevel()
-	{
-		jQuery.get( '../dhis-web-commons/oust/removeorgunit.action',
-			{level: getFieldValue( 'levelList' )},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function unSelectAllTree()
-	{
-		jQuery.get( '../dhis-web-commons/oust/clearSelectedOrganisationUnits.action',			
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function selectAllTree()
-	{
-		jQuery.get( '../dhis-web-commons/oust/selectallorgunit.action',			
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function selectOrganisationUnitByGroup()
-	{
-		jQuery.get( '../dhis-web-commons/oust/addorgunit.action',
-			{organisationUnitGroupId: getFieldValue( 'groupList' )},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	function unSelectOrganisationUnitByGroup()
-	{
-		jQuery.get( '../dhis-web-commons/oust/removeorgunit.action',
-			{organisationUnitGroupId: getFieldValue( 'groupList' )},
-			function( xml ){
-				selectedOrganisationUnitXMLABCDEF( xml );
-			});
-	}
-	
-	
-	
-	function loadOrganisationUnitLevel()
-	{		
-		jQuery.getJSON('../dhis-web-commons-ajax-json/getOrganisationUnitLevels.action',
-		function( json ){
-			var levels = jQuery("#levelList");
-			levels.empty();
-			jQuery.each( json.levels, function(i, item){
-				levels.append( '<option value="' + item.level + '">' + item.name + '</option>');
-			});			
-			jQuery( "#selectionTreeContainer" ).fadeIn();
-		});
-	}
-	
-	function loadOrganisationUnitGroup()
-	{
-		jQuery.getJSON('../dhis-web-commons-ajax-json/getOrganisationUnitGroups.action',
-		function( json ){
-			var groups = jQuery("#groupList");
-			groups.empty();
-			jQuery.each( json.organisationUnitGroups, function(i, item){
-				groups.append( '<option value="' + item.id + '">' + item.name + '</option>');
-			});	
-
-			loadOrganisationUnitLevel();	
-		});
-	}
-	
-	
-	jQuery(document).ready( function(){		
-		loadOrganisationUnitGroup();
-		selectionTreeSelection.setMultipleSelectionAllowed( true );
-		selectedOrganisationUnitListABCDEF = jQuery( "#treeSelectedId" );
-		#if( $required )			
-			selectionTreeSelection.setListenerFunction( selectOrganisationUnitABCDEF );
-		#end	
-		#if( $cleanAll )						
-			selectionTree.clearSelectedOrganisationUnits();			
-		#end	
-		selectionTree.buildSelectionTree();	
-	});
-	
-</script>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSingleSelect.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSingleSelect.vm	2010-12-13 21:21:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/selectionTreeSingleSelect.vm	2011-03-14 09:46:14 +0000
@@ -1,4 +1,21 @@
 <script type="text/javascript" src="../dhis-web-commons/oust/oust.js"></script>
+<script type="text/javascript" src="../dhis-web-commons/javascripts/oust/selectionTreeSingleSelect.js"></script>
+<script type="text/javascript">
+jQuery(document).ready( function()
+{
+	selectionTreeSelection.setMultipleSelectionAllowed( false );
+	selectedOrganisationUnitListABCDEF = jQuery( "#treeSelectedId" );
+
+	#if( $required )
+		selectionTreeSelection.setListenerFunction( selectOrganisationUnitABCDEF );
+	#end
+	#if( $cleanAll )						
+		selectionTree.clearSelectedOrganisationUnits();			
+	#end	
+
+	selectionTree.buildSelectionTree();
+});
+</script>
 
 ## You don't have to use this template directly if you don't want to
 <table cellspacing=0 width="100%">
@@ -17,33 +34,3 @@
 		</tr>
 	</tbody>
 </table>
-<script>
-	
-	var selectedOrganisationUnitListABCDEF;
-	
-	function addSelectedOrganisationUnitABCDEF( id )
-	{
-		selectedOrganisationUnitListABCDEF.append( '<option value="' + id + ' selected="selected">' + id + '</option>');
-	}	
-	
-	function selectOrganisationUnitABCDEF( ids )
-	{
-		selectedOrganisationUnitListABCDEF.empty();
-		
-		jQuery.each( ids, function(i, item ){
-			selectedOrganisationUnitListABCDEF.append( '<option value="' + item + ' selected="selected">' + item + '</option>');
-		});
-	}
-
-	jQuery(document).ready( function(){				
-		selectionTreeSelection.setMultipleSelectionAllowed( false );
-		selectedOrganisationUnitListABCDEF = jQuery( "#treeSelectedId" );
-		#if( $required )			
-			selectionTreeSelection.setListenerFunction( selectOrganisationUnitABCDEF );
-		#end
-		#if( $cleanAll )						
-			selectionTree.clearSelectedOrganisationUnits();			
-		#end	
-		selectionTree.buildSelectionTree();	
-	});	
-</script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm	2011-03-11 14:58:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm	2011-03-14 09:46:14 +0000
@@ -1,63 +1,11 @@
-<script>
-	jQuery(document).ready(	function() {
-		/* validation */
-		var rules = {
-			oldPassword: {required: true},
-			rawPassword: {required:false, password:true, rangelength: [8, 35], notequalto:'#username'},
-			retypePassword: {required:false, equalTo:'#rawPassword'},
-			surname: {required:true, minlength:2},
-			firstName: {required:true, minlength:2},
-			email: {email:true},
-			phoneNumber: {}
-		}
-
-		validation2('updateUserinforForm', updateUser, {
-			'rules': rules
-		});
-
-		jQuery("#rawPassword").attr("maxlength", "35");
-		jQuery("#retypePassword").attr("maxlength", jQuery("#rawPassword").attr("maxlength"));
-		jQuery("#surname").attr("maxlength", "140");
-		jQuery("#firstName").attr("maxlength", "140");
-		jQuery("#email").attr("maxlength", "160");
-		jQuery("#phoneNumber").attr("maxlength", "80");
-		/* end validation */
-
-		var oldPassword = byId( 'oldPassword' );
-		oldPassword.select();
-		oldPassword.focus();
-		
-		function updateUser()
-		{
-			var request = new Request();
-			request.setResponseTypeXML( 'xmlObject' );
-			request.setCallbackSuccess(updateUserReceived);
-	
-			var params = "id=" + byId('id').value;
-				params += "&oldPassword=" + byId('oldPassword').value;
-				params += "&rawPassword=" + byId('rawPassword').value;
-				params += "&retypePassword=" + byId('retypePassword').value;
-				params += "&surname=" + byId('surname').value;
-				params += "&firstName=" + byId('firstName').value;
-				params += "&email=" + byId('email').value;
-				params += "&phoneNumber=" + byId('phoneNumber').value;
-			request.sendAsPost( params );
-			request.send( 'updateUserAccount.action');
-		}
-		
-		function updateUserReceived(xmlObject){
-				setMessage(xmlObject.firstChild.nodeValue);
-		}
-	});
-</script>
+<script type="text/javascript" src="../dhis-web-commons/javascripts/useraccount/updateUserAccountForm.js"></script>
 
 <h3>$i18n.getString( "update_user" )</h3>
 
 <form id="updateUserinforForm" action="updateUserAccount.action" method="post" onsubmit='return false;'>
-	
-  <div>
+<div>
 	<input type="hidden" id="id" name="id" value="$userCredentials.id"/>
-  </div>
+</div>
 
 <table>
 	<tr>
@@ -101,7 +49,6 @@
 		<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='$!backUrl'" style="width:120px"/></td>
 	</tr>
 </table>
-
 </form>
 
 <span id="message"></span>