← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 749: now while using any lock operational button in data locking, it will dissable all buttons automat...

 

------------------------------------------------------------
revno: 749
committer: brajesh2murari@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-21 07:47:30 +0530
message:
  now while using any lock operational button in data locking, it will dissable all buttons automatically which will prevent in throughing null pointer excepion.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java
  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/javascript/associations.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/oust.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/selectionedTreeInFrame.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-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java	2009-09-15 03:50:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java	2009-09-21 02:17:30 +0000
@@ -164,8 +164,17 @@
         throws Exception
     {
         Period period = new Period();
-        period = periodService.getPeriod( periodId.intValue() );
-        storedBy = currentUserService.getCurrentUsername();
+		
+		if( periodId != null )
+		{
+			period = periodService.getPeriod( periodId.intValue() );
+		}
+		else
+		{
+			return SUCCESS;
+		}
+        
+		storedBy = currentUserService.getCurrentUsername();
 
         // -------------------------------------------------------------------------------
         // For data set movement from locked to unlocked data set list box and

=== 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	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml	2009-09-21 02:17:30 +0000
@@ -14,7 +14,7 @@
     
     <!-- Locking -->
 	  
-	 <action name="emptyOrgunitSetupAssociationsTree"
+	<action name="emptyOrgunitSetupAssociationsTree"
       class="org.hisp.dhis.commons.action.NoAction">
       <result name="success" type="velocity">
         /dhis-web-maintenance-dataadmin/noResponseInFrame.vm</result>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js	2009-09-21 02:17:30 +0000
@@ -24,8 +24,18 @@
     numberOfSelects++;
     
     setMessage( i18n_loading );
-    
-    document.getElementById( "submitButton" ).disabled = true;
+
+    parent.document.getElementById( "submitButton" ).disabled = true;
+}
+
+function saveDissable()
+{
+	parent.document.getElementById( "submitButton" ).disabled = true;
+}
+
+function saveEnable()
+{
+	parent.document.getElementById( "submitButton" ).disabled = false;
 }
 
 function selectCompleted( selectedUnits )
@@ -36,6 +46,6 @@
     {
         hideMessage();
         
-       document.getElementById( "submitButton" ).disabled = false;
+       parent.document.getElementById( "submitButton" ).disabled = false;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js	2009-09-21 02:17:30 +0000
@@ -70,9 +70,11 @@
      }
 }
 
-function LoadOrgUnitTree() {   
-	 desableLockOptionButtons();    
-     var periodList = document.getElementById( "periodId" );
+function LoadOrgUnitTree(){
+	 Reload();
+     desableLockGeneralComponenets(); 
+	 desableLockOptionButtons();
+	 var periodList = document.getElementById( "periodId" );
      var periodId = periodList.options[ periodList.selectedIndex ].value;
      var lockedDataSetList = document.getElementById('lockedDataSets');
      var selectedLockedDataSetId = lockedDataSetList.options[ lockedDataSetList.selectedIndex ].value;
@@ -85,14 +87,47 @@
      iframeForOUTree.location.href='emptyOrgunitSetupAssociationsTree.action';		 
 }
 
+function clearFrame(){
+	x = window.frames["iframeForOUTree"];
+	//x.document.open();
+	x.document.close(); 
+}
+
+function Reload() {
+	var f = document.getElementById('iframeForOUTree');
+	f.contentWindow.location.reload(true);
+}
+
+function enableLockGeneralComponenets(){
+    parent.document.getElementById( "periodTypeId" ).disabled = false;
+	parent.document.getElementById( "periodId" ).disabled = false;
+	parent.document.getElementById( "unlockedDataSets" ).disabled = false;
+	parent.document.getElementById( "lockedDataSets" ).disabled = false;
+	parent.document.getElementById( "button5" ).disabled = false;
+	parent.document.getElementById( "button6" ).disabled = false;
+	parent.document.getElementById( "button7" ).disabled = false;
+	parent.document.getElementById( "button8" ).disabled = false;	
+}
+
+function desableLockGeneralComponenets(){
+	parent.document.getElementById( "periodTypeId" ).disabled = true;
+	parent.document.getElementById( "periodId" ).disabled = true;
+	parent.document.getElementById( "unlockedDataSets" ).disabled = true;
+	parent.document.getElementById( "lockedDataSets" ).disabled = true;
+	parent.document.getElementById( "button5" ).disabled = true;
+	parent.document.getElementById( "button6" ).disabled = true;
+	parent.document.getElementById( "button7" ).disabled = true;
+	parent.document.getElementById( "button8" ).disabled = true;
+}
+
 function enableLockOptionButtons(){
-	 parent.document.getElementById( "submitButton1" ).disabled = false;
-	 parent.document.getElementById( "submitButton2" ).disabled = false;
-	 parent.document.getElementById( "submitButton3" ).disabled = false;
-     parent.document.getElementById( "submitButton4" ).disabled = false; 
-	 parent.document.getElementById( "levelList" ).disabled = false;
-	//document.getElementById( "submitButton" ).disabled = false;
-    //document.getElementById( "submitButton5" ).disabled = false;
+	parent.document.getElementById( "submitButton1" ).disabled = false;
+	parent.document.getElementById( "submitButton2" ).disabled = false;
+	parent.document.getElementById( "submitButton3" ).disabled = false;
+    parent.document.getElementById( "submitButton4" ).disabled = false; 
+	parent.document.getElementById( "levelList" ).disabled = false;
+	parent.document.getElementById( "submitButton9" ).disabled = false;
+	parent.document.getElementById( "submitButton" ).disabled = false;
 }
 		
 function desableLockOptionButtons(){
@@ -101,8 +136,8 @@
     parent.document.getElementById( "submitButton3" ).disabled = true;
 	parent.document.getElementById( "submitButton4" ).disabled = true; 
 	parent.document.getElementById( "levelList" ).disabled = true;
-	//document.getElementById( "submitButton" ).disabled = true;
-	//document.getElementById( "submitButton5" ).disabled = true; 
+	//parent.document.getElementById( "submitButton9" ).disabled = true;
+	parent.document.getElementById( "submitButton" ).disabled = true; 
 }
 		
 function desableLockOptionButtonsForApplyLockOnAll(){
@@ -110,8 +145,8 @@
 	parent.document.getElementById( "submitButton3" ).disabled = true;
 	parent.document.getElementById( "submitButton4" ).disabled = true; 
 	parent.document.getElementById( "levelList" ).disabled = true;
-    //document.getElementById( "submitButton" ).disabled = true;
-	//document.getElementById( "submitButton5" ).disabled = true; 
+    //parent.document.getElementById( "submitButton9" ).disabled = true;
+	parent.document.getElementById( "submitButton" ).disabled = true; 
 }
 		
 function desableLockOptionButtonsForRemoveAllLocks(){
@@ -119,8 +154,8 @@
 	parent.document.getElementById( "submitButton3" ).disabled = true;
 	parent.document.getElementById( "submitButton4" ).disabled = true; 
     parent.document.getElementById( "levelList" ).disabled = true;
-	//document.getElementById( "submitButton" ).disabled = true;
-	//document.getElementById( "submitButton5" ).disabled = true; 
+	//parent.document.getElementById( "submitButton9" ).disabled = true;
+	parent.document.getElementById( "submitButton" ).disabled = true; 
 }
 		
 function desableLockOptionButtonsForLockAtLevel(){
@@ -128,8 +163,8 @@
 	parent.document.getElementById( "submitButton2" ).disabled = true;
 	parent.document.getElementById( "submitButton4" ).disabled = true; 
 	parent.document.getElementById( "levelList" ).disabled = true;
-	//document.getElementById( "submitButton" ).disabled = true;
-	//document.getElementById( "submitButton5" ).disabled = true; 
+	//parent.document.getElementById( "submitButton9" ).disabled = true;
+	parent.document.getElementById( "submitButton" ).disabled = true; 
 }
 		
 function desableLockOptionButtonsForUnlockAtLevel(){
@@ -137,19 +172,23 @@
 	parent.document.getElementById( "submitButton2" ).disabled = true;
 	parent.document.getElementById( "submitButton3" ).disabled = true;
 	parent.document.getElementById( "levelList" ).disabled = true;
-	//document.getElementById( "submitButton" ).disabled = true;
-	//document.getElementById( "submitButton5" ).disabled = true; 
+	//parent.document.getElementById( "submitButton9" ).disabled = true;
+	parent.document.getElementById( "submitButton" ).disabled = true; 
 }
     
 function ApplyAll(){
-     desableLockOptionButtonsForApplyLockOnAll();
+	 desableLockGeneralComponenets();
+	 desableLockOptionButtons();
+     //desableLockOptionButtonsForApplyLockOnAll();
      var lockedDataSetList = document.getElementById('lockedDataSets');
      var selectedLockedDataSetId = lockedDataSetList.options[ lockedDataSetList.selectedIndex ].value;           
      iframeForOUTree.location.href ='selectAll.action?selectedLockedDataSetId=' + selectedLockedDataSetId;
 }
     
 function RemoveAll(){
-	 desableLockOptionButtonsForRemoveAllLocks();       
+	 desableLockGeneralComponenets();
+	 desableLockOptionButtons();
+	 //desableLockOptionButtonsForRemoveAllLocks();       
      var periodList = document.getElementById( "periodId" );
      var periodId = periodList.options[ periodList.selectedIndex ].value;
      var lockedDataSetList = document.getElementById('lockedDataSets');
@@ -158,7 +197,9 @@
 }
     
 function lockAllAtLevel(){
-	 desableLockOptionButtonsForLockAtLevel();
+	 desableLockGeneralComponenets();
+	 desableLockOptionButtons();
+	 //desableLockOptionButtonsForLockAtLevel();
      var periodList = document.getElementById( "periodId" );
      var periodId = periodList.options[ periodList.selectedIndex ].value;
      var list = document.getElementById( 'levelList' );         
@@ -169,7 +210,9 @@
 }
 
 function unLockAllAtLevel(){
-     desableLockOptionButtonsForUnlockAtLevel();
+     desableLockGeneralComponenets();
+	 desableLockOptionButtons();
+     //desableLockOptionButtonsForUnlockAtLevel();
      var periodList = document.getElementById( "periodId" );
      var periodId = periodList.options[ periodList.selectedIndex ].value;
      var list = document.getElementById( 'levelList' );         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/oust.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/oust.js	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/oust.js	2009-09-21 02:17:30 +0000
@@ -34,7 +34,7 @@
     {
         multipleSelectionAllowed = allowed;
     };
-
+	
     this.select = function( unitId ){
         if ( onSelectFunction ){
             onSelectFunction();
@@ -60,7 +60,7 @@
         }
         else
         {    
-        	  request.send( selectionTreePath + 'noactionfordatalocking.action?' );       
+        	request.send( selectionTreePath + 'noactionfordatalocking.action?' );       
             linkTags[0].className = '';          
         }
     };
@@ -89,7 +89,7 @@
 // Subtree
 // -----------------------------------------------------------------------------
 
-function SelectionTree(){
+function SelectionTree(){	
     this.toggle = function( unitId ){
         var parentTag = document.getElementById( getTagId( unitId ));
         var children = parentTag.getElementsByTagName( 'ul' );
@@ -170,7 +170,9 @@
         }
         
         clearLoadingMessage( treeTag );
+		enableLockGeneralComponenets();
         enableLockOptionButtons();
+		saveEnable();
     }
 
     function createChildren( parentTag, parentElement ){

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm	2009-09-21 02:17:30 +0000
@@ -58,10 +58,10 @@
             </select>
         </td>
         <td align="center">
-            <input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:40px" onclick="moveSelectedById( 'unlockedDataSets', 'lockedDataSets' )"><br>
-            <input type="button" value="&lt;" title="$i18n.getString( 'move_all' )" style="width:40px" onclick="moveSelectedById( 'lockedDataSets', 'unlockedDataSets' )"><br>      
-            <input type="button" value="&gt;&gt;" title="$i18n.getString( 'remove_selected' )" style="width:40px" onclick="moveAllById( 'unlockedDataSets', 'lockedDataSets' )"><br>
-            <input type="button" value="&lt;&lt;" title="$i18n.getString( 'remove_all' )" style="width:40px" onclick="moveAllById( 'lockedDataSets', 'unlockedDataSets' )">
+            <input type="button" id="button5"  value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:40px" onclick="moveSelectedById( 'unlockedDataSets', 'lockedDataSets' )"><br>
+            <input type="button" id="button6"  value="&lt;" title="$i18n.getString( 'move_all' )" style="width:40px" onclick="moveSelectedById( 'lockedDataSets', 'unlockedDataSets' )"><br>      
+            <input type="button" id="button7"  value="&gt;&gt;" title="$i18n.getString( 'remove_selected' )" style="width:40px" onclick="moveAllById( 'unlockedDataSets', 'lockedDataSets' )"><br>
+            <input type="button" id="button8"  value="&lt;&lt;" title="$i18n.getString( 'remove_all' )" style="width:40px" onclick="moveAllById( 'lockedDataSets', 'unlockedDataSets' )">
         </td>
         <td>
             <select id="lockedDataSets" name="lockedDataSets" multiple="multiple" style="min-width:325px;height:8em" ondblclick="LoadOrgUnitTree()" disabled="true">
@@ -80,28 +80,34 @@
     	<table> 
 			<tr>
 				<td>
-                	<input type="button" id="submitButton1" value="$i18n.getString( "apply_lock_on_all" )" onclick="ApplyAll()" style="width:12em" disabled="true">                
-    				<input type="button" id="submitButton2" value="$i18n.getString( "remove_all" )" onclick="RemoveAll()" style="width:12em" disabled="true">             
+                	<input type="button" id="submitButton1" value="$i18n.getString( "apply_lock_on_all" )" onclick="ApplyAll()" style="width:11em" disabled="true">                
+    				<input type="button" id="submitButton2" value="$i18n.getString( "remove_all" )" onclick="RemoveAll()" style="width:11em" disabled="true">             
     				<input type="button" id="submitButton3" value="$i18n.getString( "select_all_at_level" )" onclick="lockAllAtLevel()" style="width:12em" disabled="true">      		
-                    <select id="levelList" name="levelList" style="width:12em" disabled="true">
+                    <select id="levelList" name="levelList" style="width:13em" disabled="true">
                     	#foreach( $level in $levels )
                     		<option value="$level.level" #if ( $selectLevel == $level.level )selected="selcted"#end>$encoder.htmlEncode( $level.name )</option>
                     	#end
                     </select> 			
                 	<input type="button" id="submitButton4" value="$i18n.getString( "unselect_all_at_level" )" onclick="unLockAllAtLevel()" style="width:12em" disabled="true">      		
-            	</td>
-			</tr>
-            <tr>
-                  <td colspan="3" height="15"></td>
-            </tr>
-            <tr>
-                  <th colspan="3">$i18n.getString( "organisation_units_lock" )</th>
-            </tr>
-            <tr>
-                  <td colspan="3">
-                           <iframe name="iframeForOUTree" id="iframeForOUTree" width="740px" height="230px" frameborder="0">	   
-        				   </iframe>          
-                  </td>
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<input type="button" id="submitButton" value="$i18n.getString( 'save' )" style="width:30em"  onclick="updateDataSetsOrgunitwise()" disabled="true">									
+					<input type="button" id="submitButton9" value="$i18n.getString( 'cancel' )" style="width:30em"  onclick="cancilSelection()" disabled="true">
+				</td>
+			</tr>
+            <tr>
+                <td colspan="3" height="15"></td>
+            </tr>
+            <tr>
+                <th colspan="3">$i18n.getString( "organisation_units_lock" )</th>
+            </tr>
+            <tr>
+                <td colspan="3">
+                    <iframe name="iframeForOUTree" id="iframeForOUTree" width="740px" height="230px" frameborder="0">	   
+					</iframe>          
+                </td>
             </tr>
         </table>
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/selectionedTreeInFrame.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/selectionedTreeInFrame.vm	2009-09-20 17:27:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/selectionedTreeInFrame.vm	2009-09-21 02:17:30 +0000
@@ -5,17 +5,11 @@
     <link type="image/png" rel="icon" href="../images/favicon.png">    
       
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-	<script type="text/javascript" src="../oust.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/util/commons.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/util/lists.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/util/jquery.js"></script>
     <script type="text/javascript" src="../dhis-web-commons/css/${stylesheetDirectory}/dom.js"></script>
-    
-    <script type="text/javascript">
-      var i18n_show_menu = '$encoder.jsEscape( $i18n.getString( "show_menu" ) , "'")';
-      var i18n_hide_menu = '$encoder.jsEscape( $i18n.getString( "hide_menu" ) , "'")';
-    </script>
-    
+        
 	<script type="text/javascript" src="../request.js"></script>
     #foreach( $javascript in $javascripts )
       <script type="text/javascript" src="$javascript"></script>
@@ -40,7 +34,7 @@
                       selectionTreeSelection.setMultipleSelectionAllowed( true );
                       selectionTreeSelection.setOnSelectFunction( treeClicked );
                       selectionTreeSelection.setListenerFunction( selectCompleted );
-                      selectionTree.buildSelectionTree();
+                      selectionTree.buildSelectionTree( saveDissable );
 					  
                 </script>  			
                 <script type="text/javascript">
@@ -52,13 +46,13 @@
 		
 		<!-- Submit--> 
     
-        <tr>        
+        <!--<tr>        
             <td>
-                <input type="button" id="submitButton" value="$i18n.getString( 'save' )" style="width:15em"  onclick="parent.updateDataSetsOrgunitwise()">									
+                <input type="button" id="submitButton" value="$i18n.getString( 'save' )" style="width:15em"  onclick="parent.updateDataSetsOrgunitwise()" >									
 			    <input type="button" id="submitButton5" value="$i18n.getString( 'cancel' )" style="width:15em"  onclick="parent.cancilSelection()">                                 
             </td>
             <td colspan="2"></td>
-        </tr>    
+        </tr>-->    
     </table>
     </form>
     <span id="message"></span>