← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14799: Approval report, using org unit web tree. Approval should be restricted to data capture org units.

 

------------------------------------------------------------
revno: 14799
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-04-11 13:43:13 +0200
message:
  Approval report, using org unit web tree. Approval should be restricted to data capture org units.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js


--
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/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2014-04-06 10:52:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2014-04-11 11:43:13 +0000
@@ -123,10 +123,15 @@
         sessionStorage.removeItem( OU_SELECTED_KEY );
     };
 
+    this.isSelected = function() {
+    	var ou = selection.getSelected();    	
+    	return ou && ou.length > 0;
+    };
+    
     this.setSelected = function( selected ) {
         sessionStorage[ OU_SELECTED_KEY ] = JSON.stringify( selected );
     };
-
+    
     this.selectedExists = function() {
         return sessionStorage[ OU_SELECTED_KEY ] != null;
     };

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2014-03-24 19:06:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2014-04-11 11:43:13 +0000
@@ -20,7 +20,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-maintenance-organisationunit/organisationUnit.vm</param>
       <param name="menu">/dhis-web-maintenance-organisationunit/menuWithTree.vm</param>
-      <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js, javascript/organisationUnit.js</param>
+      <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/organisationUnit.js</param>
       <interceptor-ref name="organisationUnitTreeStack" />
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2014-04-03 17:51:13 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2014-04-11 11:43:13 +0000
@@ -194,7 +194,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-reporting/dataApprovalForm.vm</param>
       <param name="menu">/dhis-web-reporting/menu.vm</param>
-      <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/dataSetReport.js,javascript/dataApproval.js</param>
+      <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataSetReport.js,javascript/dataApproval.js</param>
       <param name="stylesheets">style/dhis-web-reporting.css</param>
     </action>
     

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2014-04-03 19:02:51 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2014-04-11 11:43:13 +0000
@@ -1,21 +1,4 @@
 <script type="text/javascript">
-jQuery(document).ready(function() {        
-            
-  #if( $render == true )
-  var dataSetReport = {
-    dataSet: "${ds}",
-    periodType: "${periodType.name}",
-    period: "${pe}",
-    offset: ${offset}
-  };
-  dhis2.dsr.setDataSetReport( dataSetReport );        
-  #else
-  selectionTreeSelection.setMultipleSelectionAllowed( false );
-  selectionTree.clearSelectedOrganisationUnits();
-  selectionTree.buildSelectionTree();
-  #end
-});
-
 var i18n_select_data_set = '$encoder.jsEscape( $i18n.getString( "select_data_set" ), "'")';
 var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ), "'")';
 var i18n_select_organisation_unit = '$encoder.jsEscape( $i18n.getString( "select_organisation_unit" ), "'")';
@@ -32,6 +15,13 @@
 </script>
 
 <style type="text/css">
+div#orgUnitTree {
+  width:328px; 
+  height:200px; 
+  border:1px solid #ccc; 
+  margin-bottom: 8px;
+}	
+
 div#control {
   margin-bottom: 15px;
 }
@@ -91,7 +81,7 @@
 
 <div class="inputSection">
 <label>$i18n.getString( "report_organisation_unit" )</label><br>
-<div id="selectionTree" style="width:328px; height:200px; overflow:auto; border:1px solid #ccc; margin-bottom: 8px;"></div>
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
 </div>
 
 <div class="inputSection" id="categoryOptionGroupSection" style="display:none">

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-09 17:42:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-11 11:43:13 +0000
@@ -70,11 +70,11 @@
 }
 
 dhis2.appr.getDataReport = function()
-{
+{	
     var dataReport = {
         ds: $( "#dataSetId" ).val(),
         pe: $( "#periodId" ).val(),
-        ou: selectionTreeSelection.getSelectedUid()[0]
+        ou: selection.getSelected()[0]
     };
     
     var cog = $( "#categoryOptionGroupId" ).val();
@@ -102,7 +102,7 @@
         setHeaderMessage( i18n_select_period );
         return false;
     }
-    if ( !selectionTreeSelection.isSelected() )
+    if ( !selection.isSelected() )
     {
         setHeaderMessage( i18n_select_organisation_unit );
         return false;