← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11304: extra confirmation dialog when creating a new root ou

 

------------------------------------------------------------
revno: 11304
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-07-02 14:29:40 +0700
message:
  extra confirmation dialog when creating a new root ou
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.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/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2013-04-08 08:33:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties	2013-07-02 07:29:40 +0000
@@ -1,3 +1,4 @@
+create_new_root=Are you sure you want to create a new root organisation unit?
 create_new_org_unit=Create new organisation unit
 registers_data=Registers data
 crease_new_org_unit_group=Create new organisation unit group

=== 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	2013-03-07 05:46:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm	2013-07-02 07:29:40 +0000
@@ -1,8 +1,23 @@
 <script type="text/javascript">
+    var previousName = '';
+    var adding_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "adding_the_org_unit_failed" ) , "'" )';
+
 	jQuery(document).ready(function() {
 		validation2('addOrganisationUnitForm', function(form) {
-			selectAllById("dataSets");
-			form.submit();
+            $.ajax({
+               url: '../dhis-web-commons/ouwt/getselected.action',
+               dataType: 'json'
+            } ).done(function(data) {
+                if(data.selectedUnits.length == 0) {
+                    if ( confirm( '$i18n.getString( "create_new_root" )' ) ) {
+                        selectAllById( "dataSets" );
+                        form.submit();
+                    }
+                } else {
+                    selectAllById( "dataSets" );
+                    form.submit();
+                }
+            });
 		}, {
 	        'beforeValidateHandler' : function()
 	        {
@@ -20,16 +35,11 @@
 		
         jQuery("#name").focus();
 	});
-
-	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" class="inputForm">
-
 <table>
 	<tr>
 		<th colspan="2">$i18n.getString( "details" )</th>
@@ -166,4 +176,4 @@
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='organisationUnit.action'" style="width: 10em;" />
 </p>
 
-</form>
\ No newline at end of file
+</form>