← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2101: Retaining dataset selection if still valid

 

------------------------------------------------------------
revno: 2101
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-11-18 10:42:34 +0100
message:
  Retaining dataset selection if still valid
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xls/converter/OrganisationUnitHierarchyConverter.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.jsp
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.jsp
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.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-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xls/converter/OrganisationUnitHierarchyConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xls/converter/OrganisationUnitHierarchyConverter.java	2010-11-12 17:58:03 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/xls/converter/OrganisationUnitHierarchyConverter.java	2010-11-18 09:42:34 +0000
@@ -74,9 +74,6 @@
 
     public void write( WritableWorkbook workbook, ExportParams params, int sheetIndex )
     {
-        // if ( params.getOrganisationUnits() != null &&
-        // params.getOrganisationUnits().size() > 0 )
-        // {
         I18n i18n = params.getI18n();
 
         int rowNumber = 0;
@@ -119,7 +116,6 @@
         {
             e.printStackTrace();
         }
-        // }
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.jsp'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.jsp	2010-09-30 09:37:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.jsp	2010-11-18 09:42:34 +0000
@@ -26,7 +26,7 @@
                         {
                             formVisible = false;
                 %>
-            <span class="loginMessage">Maximum Tries exceeded... Please try after <%=userAuditService.getLockoutTimeframe() %> mins</span>
+            <span class="loginMessage">Maximum Tries exceeded. Please try after <%=userAuditService.getLockoutTimeframe() %> mins</span>
             <%
                         }
                     }
@@ -39,11 +39,11 @@
                     </tr>
                     <tr>
                         <td><label for="j_username">Username</label></td>
-                        <td><input type="text" id="j_username" name="j_username" style="width:18em" autocomplete="off"></td>
+                        <td><input type="text" id="j_username" name="j_username" style="width:18em"></td>
                     </tr>
                     <tr>
                         <td><label for="j_password">Password</label></td>
-                        <td><input type="password" id="j_password" name="j_password" style="width:18em" autocomplete="off"></td>
+                        <td><input type="password" id="j_password" name="j_password" style="width:18em"></td>
                     </tr>
                     <tr>
                         <td></td>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.jsp'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.jsp	2010-03-30 23:08:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.jsp	2010-11-18 09:42:34 +0000
@@ -40,11 +40,11 @@
                     </tr>
                     <tr>
                         <td><label for="j_username">Username</label></td>
-                        <td><input type="text" id="j_username" name="j_username" style="width:18em" autocomplete="off"></td>
+                        <td><input type="text" id="j_username" name="j_username" style="width:18em"></td>
                     </tr>
                     <tr>
                         <td><label for="j_password">Password</label></td>
-                        <td><input type="password" id="j_password" name="j_password" style="width:18em" autocomplete="off"></td>
+                        <td><input type="password" id="j_password" name="j_password" style="width:18em"></td>
                     </tr>
                     <tr>
                         <td></td>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2010-11-18 08:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2010-11-18 09:42:34 +0000
@@ -43,7 +43,14 @@
     {
         return organisationUnit;
     }
+    
+    private boolean selectionValid;
 
+    public boolean isSelectionValid()
+    {
+        return selectionValid;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -55,6 +62,22 @@
         Collections.sort( dataSets, new DataSetNameComparator() );
 
         organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
+
+        // ---------------------------------------------------------------------
+        // Validate whether current data set selection is still valid
+        // ---------------------------------------------------------------------
+
+        DataSet selectedDataSet = selectedStateManager.getSelectedDataSet();
+        
+        if ( selectedDataSet != null && dataSets.contains( selectedDataSet ) )
+        {
+            selectionValid = true;
+        }
+        else
+        {
+            selectedStateManager.clearSelectedDataSet();
+            selectedStateManager.clearSelectedPeriod();
+        }
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-18 08:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-18 09:42:34 +0000
@@ -20,15 +20,29 @@
 // Selection
 // -----------------------------------------------------------------------------
 
+function clearDataSetAndPeriod()
+{
+	clearList( document.getElementById( 'selectedDataSetId' ) );
+	clearPeriod();
+}
+
+function clearPeriod()
+{	
+	clearList( document.getElementById( 'selectedPeriodIndex' ) );	
+	$('#entryForm').html( '' );
+}
+
 function organisationUnitSelected( orgUnits )
 {
+    var selectedDataSetId = $( '#selectedDataSetId' ).val();
+    
     var url = 'loadDataSets.action';
     
     var list = document.getElementById( 'selectedDataSetId' );
     
     clearList( list );
     addOptionToList( list, '-1', '[ Select ]' );
-        
+    
     $.getJSON( url, function( json ) {
     	$('#selectedOrganisationUnit').val( json.organisationUnit.name );
     	$('#currentOrganisationUnit').html( json.organisationUnit.name );
@@ -36,6 +50,10 @@
     	for ( i in json.dataSets ) {
     		addOptionToList( list, json.dataSets[i].id, json.dataSets[i].name );
     	}
+    	
+    	if ( json.selectionValid && selectedDataSetId != null ) {
+    		$( '#selectedDataSetId' ).val( selectedDataSetId );
+    	} 
     } );
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm	2010-11-18 08:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm	2010-11-18 09:42:34 +0000
@@ -13,5 +13,6 @@
     "id": $!{organisationUnit.id},
     "name": "$!encoder.jsEncode( ${organisationUnit.name} )",
     "shortName": "$!encoder.jsEncode( ${organisationUnit.shortName} )"
-  }
+  },
+  "selectionValid": ${selectionValid}
 }
\ No newline at end of file