← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16327: use new period generator in reports: completeness, dataset, approval

 

------------------------------------------------------------
revno: 16327
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-08-06 11:06:04 +0700
message:
  use new period generator in reports: completeness, dataset, approval
modified:
  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/dataCompleteness.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/webapp/dhis-web-reporting/javascript/dataApproval.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-07-12 11:33:56 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataApproval.js	2014-08-06 04:06:04 +0000
@@ -47,14 +47,14 @@
 dhis2.appr.orgUnitSelected = function( orgUnits, orgUnitNames, children )
 {
 	dhis2.appr.displayCategoryOptionGroups();
-}
+};
 
 dhis2.appr.displayPeriods = function()
 {
     var periodType = $( "#periodType" ).val();
     dhis2.dsr.displayPeriodsInternal( periodType, dhis2.appr.currentPeriodOffset );
     dhis2.appr.displayCategoryOptionGroups();
-}
+};
 
 dhis2.appr.displayNextPeriods = function()
 {	
@@ -63,18 +63,18 @@
         dhis2.appr.currentPeriodOffset++;
         dhis2.appr.displayPeriods();
     }
-}
+};
 
 dhis2.appr.displayPreviousPeriods = function()
 {
     dhis2.appr.currentPeriodOffset--;
     dhis2.appr.displayPeriods();
-}
+};
 
 dhis2.appr.periodSelected = function()
 {
     dhis2.appr.displayCategoryOptionGroups();
-}
+};
 
 dhis2.appr.displayCategoryOptionGroups = function()
 {
@@ -101,7 +101,7 @@
 			$( "#categoryOptionGroupSection" ).hide();			
 		}
 	} );
-}
+};
 
 dhis2.appr.getDataReport = function()
 {	
@@ -120,7 +120,7 @@
     }
     
     return dataReport;
-}
+};
 
 dhis2.appr.generateDataReport = function()
 {
@@ -155,13 +155,13 @@
     	setTableStyles();
     	dhis2.appr.setApprovalState();
     } );
-}
+};
 
 dhis2.appr.hideCriteria = function()
 {
 	$( "#criteria" ).hide( "fast" );
 	$( "#dataButton" ).removeAttr( "disabled" );
-}
+};
 
 //------------------------------------------------------------------------------
 // Approval
@@ -288,7 +288,7 @@
 		    }
 	           	
 		} );	
-}
+};
 
 dhis2.appr.approveData = function()
 {
@@ -306,7 +306,7 @@
 			alert( xhr.responseText );
 		}
 	} );
-}
+};
 
 dhis2.appr.unapproveData = function()
 {
@@ -324,7 +324,7 @@
 			alert( xhr.responseText );
 		}
 	} );
-}
+};
 
 dhis2.appr.acceptData = function()
 {
@@ -342,7 +342,7 @@
             alert( xhr.responseText );
         }
     } );
-}
+};
 
 dhis2.appr.unacceptData = function()
 {
@@ -360,18 +360,18 @@
             alert( xhr.responseText );
         }
   } );
-}
+};
 
 dhis2.appr.getApprovalUrl = function()
 {
 	var data = dhis2.appr.getDataReport();
 	var url = "../api/dataApprovals?ds=" + data.ds + "&pe=" + data.pe + "&ou=" + data.ou + "&cog=" + data.cog;
 	return url;
-}
+};
 
 dhis2.appr.getAcceptanceUrl = function()
 {
 	var data = dhis2.appr.getDataReport();
 	var url = "../api/dataApprovals/acceptances?ds=" + data.ds + "&pe=" + data.pe + "&ou=" + data.ou + "&cog=" + data.cog;
 	return url;
-}
+};

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2013-09-27 13:24:04 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2014-08-06 04:06:04 +0000
@@ -1,6 +1,5 @@
 
 var currentPeriodOffset = 0;
-var periodTypeFactory = new PeriodType();
 
 //------------------------------------------------------------------------------
 // Period
@@ -9,9 +8,8 @@
 function displayPeriods()
 {
   var periodType = $( "#periodTypeId" ).val();
-  var periods = periodTypeFactory.get( periodType ).generatePeriods( currentPeriodOffset );
-  periods = periodTypeFactory.reverse( periods );
-  periods = periodTypeFactory.filterFuturePeriodsExceptCurrent( periods );
+  var periods = dhis2.period.generator.generateReversedPeriods(periodType, currentPeriodOffset);
+  periods = dhis2.period.generator.filterFuturePeriods( periods );
 
   $( "#periodId" ).removeAttr( "disabled" );
   clearListById( "periodId" );

=== 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-07-12 11:33:56 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2014-08-06 04:06:04 +0000
@@ -5,7 +5,6 @@
 dhis2.util.namespace( 'dhis2.dsr' );
 
 dhis2.dsr.currentPeriodOffset = 0;
-dhis2.dsr.periodTypeFactory = new PeriodType();
 dhis2.dsr.currentDataSetReport = null;
 
 //------------------------------------------------------------------------------
@@ -44,7 +43,7 @@
     dataSetReport.cp = cps;
     
     return dataSetReport;
-}
+};
 
 dhis2.dsr.setDataSetReport = function( dataSetReport )
 {
@@ -120,7 +119,7 @@
 	} ).fail( function() {
 		$( "#dimensionsDiv" ).hide();
 	} );
-}
+};
 
 //------------------------------------------------------------------------------
 // Period
@@ -130,13 +129,12 @@
 {
     var periodType = $( "#periodType" ).val();
     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 );
+    var periods = dhis2.period.generator.generateReversedPeriods(periodType, offset);
+    periods = dhis2.period.generator.filterFuturePeriodsExceptCurrent( periods );
 
     $( "#periodId" ).removeAttr( "disabled" );
     clearListById( "periodId" );
@@ -145,7 +143,7 @@
     {
         addOptionById( "periodId", periods[i].iso, periods[i].name );
     }
-}
+};
 
 dhis2.dsr.displayNextPeriods = function()
 {
@@ -154,13 +152,13 @@
         dhis2.dsr.currentPeriodOffset++;
         dhis2.dsr.displayPeriods();
     }
-}
+};
 
 dhis2.dsr.displayPreviousPeriods = function()
 {
     dhis2.dsr.currentPeriodOffset--;
     dhis2.dsr.displayPeriods();
-}
+};
 
 //------------------------------------------------------------------------------
 // Run report