← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3110: Fixed BUG: dataSets not selected when submitted on add/update orgunits

 

------------------------------------------------------------
revno: 3110
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-21 16:10:48 +0100
message:
  Fixed BUG: dataSets not selected when submitted on add/update orgunits
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/shortName.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.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-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm	2011-03-17 10:20:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm	2011-03-21 15:10:48 +0000
@@ -1,11 +1,12 @@
 <script type="text/javascript" src="javascript/addOrganisationUnitForm.js"></script>
 <script type="text/javascript">
+	var previousName = '';
 	var adding_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "adding_the_org_unit_failed" ) , "'" )';
 </script>
 
 <h3>$i18n.getString( "create_new_org_unit" ) #openHelp( "ou_edit" )</h3>
 
-<form id="addOrganisationUnitForm" name="addOrganisationUnitForm" action="addOrganisationUnit.action" method="post" onsubmit="return validateFeatureType(this.coordinates, this.featureType)">
+<form id="addOrganisationUnitForm" name="addOrganisationUnitForm" action="addOrganisationUnit.action" method="post">
 
 <table>
 	<tr>
@@ -34,7 +35,8 @@
 	</tr>
     <tr>
         <td><label for="coordinates">$i18n.getString( "coordinates" )</label></td>
-        <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em" onkeyup="setFeatureType(document.addOrganisationUnitForm.featureType, this.value)"></textarea></td>
+        <!-- onkeyup="setFeatureType(document.addOrganisationUnitForm.featureType, this.value)" -->
+        <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em"></textarea></td>
     </tr>
     <tr>
         <td><label for="featureType">$i18n.getString( "feature_type" )</label></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitForm.js	2011-03-16 16:52:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitForm.js	2011-03-21 15:10:48 +0000
@@ -46,7 +46,13 @@
 		}
 	};
 
-	validation2( 'addOrganisationUnitForm', undefined, {
+	validation2( 'addOrganisationUnitForm', function(form) {
+		selectAllById("dataSets");
+		form.submit();
+
+		/* if(validateFeatureType(this.coordinates, this.featureType)) { form.submit(); } */
+		/*  return false; */
+	}, {
 		'rules' : rules
 	} );
 
@@ -62,8 +68,6 @@
 	checkValueIsExist( "name", "validateOrganisationUnit.action" );
 	datePickerValid( 'openingDate', false );
 
-	var previousName = '';
-
 	var nameField = document.getElementById( 'name' );
 	nameField.select();
 	nameField.focus();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/shortName.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/shortName.js	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/shortName.js	2011-03-21 15:10:48 +0000
@@ -5,6 +5,11 @@
 
 function nameChanged()
 {
+	/* fail quietly if previousName is not available */
+	if(previousName === undefined) {
+		return;
+	}
+	
     var nameField = document.getElementById( 'name' );
     var shortNameField = document.getElementById( 'shortName' );
     var maxLength = parseInt( shortNameField.maxLength );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitForm.js	2011-03-16 16:52:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitForm.js	2011-03-21 15:10:48 +0000
@@ -46,7 +46,12 @@
 		}
 	};
 
-	validation2( 'updateOrganisationUnitForm', undefined, {
+	validation2( 'updateOrganisationUnitForm', function(form) {
+		selectAllById("dataSets");
+		form.submit();
+
+		/* if(validateFeatureType(this.coordinates, this.featureType)) {form.submit();} */
+	}, {
 		'rules' : rules
 	} );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm	2011-03-18 14:24:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm	2011-03-21 15:10:48 +0000
@@ -17,10 +17,9 @@
 	var saving_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "saving_the_org_unit_failed" ) , "'" )';
 </script>
 
-
 <h3>$i18n.getString( "edit_org_unit" ) #openHelp( "ou_edit" )</h3>
 
-<form id="updateOrganisationUnitForm" name="updateOrganisationUnitForm" action="updateOrganisationUnit.action" method="post" onsubmit="return validateFeatureType(this.coordinates, this.featureType)">
+<form id="updateOrganisationUnitForm" name="updateOrganisationUnitForm" action="updateOrganisationUnit.action" method="post">
 
 <div>
 	<input type="hidden" id="id" name="id" value="$organisationUnit.id"/>
@@ -68,7 +67,9 @@
 	</tr>
     <tr>
         <td><label for="coordinates">$i18n.getString( "coordinates" )</label></td>
-        <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em" onkeyup="setFeatureType(document.updateOrganisationUnitForm.featureType, this.value)">$!encoder.htmlEncode( $organisationUnit.coordinates )</textarea></td>
+
+        <!-- onkeyup="setFeatureType(document.updateOrganisationUnitForm.featureType, this.value)" -->
+        <td><textarea id="coordinates" name="coordinates" style="width:20em; height:5em">$!encoder.htmlEncode( $organisationUnit.coordinates )</textarea></td>
     </tr>
     <tr>
         <td><label for="featureType">$i18n.getString( "feature_type" )</label></td>
@@ -104,8 +105,10 @@
     </tr>
     <tr>
     	<td></td>
-    	<td><input type="button" value="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'availableDataSets', 'dataSets' )"><input
-    	           type="button" value="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'dataSets', 'availableDataSets' )"></td>
+    	<td>
+    		<input type="button" value="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'availableDataSets', 'dataSets' )">
+			<input type="button" value="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'dataSets', 'availableDataSets' )">
+		</td>
     </tr>
     <tr>
     	<td><label for="dataSets">$i18n.getString( "selected_data_sets" )</label></td>