← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14617: Approval, period selection

 

------------------------------------------------------------
revno: 14617
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-02 17:49:34 +0200
message:
  Approval, period selection
modified:
  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
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.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-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2014-04-02 12:33:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2014-04-02 15:49:34 +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/dataApproval.js</param>
+      <param name="javascripts">../dhis-web-commons/oust/oust.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-02 15:07:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataApprovalForm.vm	2014-04-02 15:49:34 +0000
@@ -42,7 +42,7 @@
 }
 </style>
 
-<h3 id="dataSetReportHeader">$i18n.getString( "dataset_report" ) #openHelp( "dataset_reports" )</h3>
+<h3 id="dataSetReportHeader">$i18n.getString( "data_approval" )</h3>
 
 <div id="control">
 <input type="button" value='$i18n.getString( "data" )' style="width:140px" onclick="dhis2.dsr.showCriteria()">
@@ -58,32 +58,22 @@
 
 <div class="inputSection">
 <label>$i18n.getString( "dataset" )</label><br>
-<select id="dataSetId" name="dataSetId" style="width:330px" onchange="dhis2.dsr.dataSetSelected()">
+<select id="dataSetId" name="dataSetId" style="width:330px" onchange="dhis2.appr.dataSetSelected()">
   <option value="">[ $i18n.getString( "select" ) ]</option>
   #foreach( $dataSet in $dataSets )
-  <option value="$dataSet.uid" data-approval="${dataSet.approveData}">
+  <option value="$dataSet.uid" data-pt="${dataSet.periodType.name}">
   $encoder.htmlEncode( $dataSet.displayName )
   </option>
   #end
 </select>
 </div>
 
-<div id="categoryOptionGroupSetDiv" style="display:none"></div>
-<div id="attributeComboDiv" style="display:none"></div>
-
 <!-- Period -->
 
 <div class="inputSection">
 <label>$i18n.getString( "report_period" )</label><br>
-<select id="periodType" name="periodType" style="width:174px" onchange="dhis2.dsr.displayPeriods()">
-  <option value="">[ $i18n.getString( "select_period_type" ) ]</option>
-  #foreach ( $type in $periodTypes )
-  <option value="$type.name">$i18n.getString( $type.name )</option>
-  #end
-</select>
-<input type="button" style="width:75px" value="$i18n.getString( 'prev_year' )" onclick="dhis2.dsr.displayPreviousPeriods()" />
-<input type="button" style="width:75px" value="$i18n.getString( 'next_year' )" onclick="dhis2.dsr.displayNextPeriods()" /><br>
-
+<input type="button" style="width:75px" value="$i18n.getString( 'prev_year' )" onclick="dhis2.appr.displayPreviousPeriods()" />
+<input type="button" style="width:75px" value="$i18n.getString( 'next_year' )" onclick="dhis2.appr.displayNextPeriods()" /><br>
 <select id="periodId" name="periodId" style="width:330px" disabled="disabled">
 </select>
 </div>
@@ -100,6 +90,11 @@
 <div id="selectionTree" style="width:328px; height:200px; overflow:auto; border:1px solid #ccc; margin-bottom: 8px;"></div>
 </div>
 
+<div class="inputSection">
+<input type="button" value='$i18n.getString( "get_report" )' style="width:120px" onclick="dhis2.dsr.generateDataSetReport()">
+<input type="button" value='$i18n.getString( "cancel" )' style="width:120px" onclick="hideCriteria()">
+</div>
+
 </div>
 
 #parse( "dhis-web-commons/loader/loader.vm" )

=== 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-02 12:33:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-04-02 15:49:34 +0000
@@ -0,0 +1,30 @@
+
+dhis2.util.namespace( 'dhis2.appr' );
+
+dhis2.appr.currentPeriodOffset = 0;
+
+dhis2.appr.dataSetSelected = function()
+{
+	dhis2.appr.displayPeriods();
+}
+
+dhis2.appr.displayPeriods = function()
+{
+	var pt = $( '#dataSetId :selected' ).data( "pt" );
+	dhis2.dsr.displayPeriodsInternal( pt, dhis2.appr.currentPeriodOffset );
+}
+
+dhis2.appr.displayNextPeriods = function()
+{	
+    if ( dhis2.appr.currentPeriodOffset < 0 ) // Cannot display future periods
+    {
+        dhis2.appr.currentPeriodOffset++;
+        dhis2.appr.displayPeriods();
+    }
+}
+
+dhis2.appr.displayPreviousPeriods = function()
+{
+    dhis2.appr.currentPeriodOffset--;
+    dhis2.appr.displayPeriods();
+}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2014-04-02 15:07:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2014-04-02 15:49:34 +0000
@@ -183,7 +183,12 @@
 dhis2.dsr.displayPeriods = function()
 {
     var periodType = $( "#periodType" ).val();
-    var periods = dhis2.dsr.periodTypeFactory.get( periodType ).generatePeriods( dhis2.dsr.currentPeriodOffset );
+    dhis2.dsr.displayPeriodsInternal( periodType, dhis2.dsr.currentPeriodOffset );
+}
+
+dhis2.dsr.displayPeriodsInternal = function( periodType, offset )
+{
+	var periods = dhis2.dsr.periodTypeFactory.get( periodType ).generatePeriods( offset );
     periods = dhis2.dsr.periodTypeFactory.reverse( periods );
     periods = dhis2.dsr.periodTypeFactory.filterFuturePeriodsExceptCurrent( periods );