← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13416: Data set report, js namespace

 

------------------------------------------------------------
revno: 13416
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-24 14:05:37 +0100
message:
  Data set report, js namespace
modified:
  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/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2013-09-23 09:18:40 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2013-12-24 13:05:37 +0000
@@ -1,6 +1,8 @@
 
-var currentPeriodOffset = 0;
-var periodTypeFactory = new PeriodType();
+dhis2.util.namespace( 'dhis2.dsr' );
+
+dhis2.dsr.currentPeriodOffset = 0;
+dhis2.dsr.periodTypeFactory = new PeriodType();
 
 //------------------------------------------------------------------------------
 // Get and set methods
@@ -14,7 +16,7 @@
         pe: $( "#periodId" ).val(),
         ou: selectionTreeSelection.getSelectedUid()[0],
         selectedUnitOnly: $( "#selectedUnitOnly" ).is( ":checked" ),
-        offset: currentPeriodOffset
+        offset: dhis2.dsr.currentPeriodOffset
     };
     
     var groups = "";
@@ -40,7 +42,7 @@
 	$( "#dataSetId" ).val( dataSetReport.dataSet );
 	$( "#periodType" ).val( dataSetReport.periodType );
 	
-	currentPeriodOffset = dataSetReport.offset;
+	dhis2.dsr.currentPeriodOffset = dataSetReport.offset;
 	
 	displayPeriods();
 	$( "#periodId" ).val( dataSetReport.period );
@@ -62,9 +64,9 @@
 function displayPeriods()
 {
     var periodType = $( "#periodType" ).val();
-    var periods = periodTypeFactory.get( periodType ).generatePeriods( currentPeriodOffset );
-    periods = periodTypeFactory.reverse( periods );
-    periods = periodTypeFactory.filterFuturePeriodsExceptCurrent( periods );
+    var periods = dhis2.dsr.periodTypeFactory.get( periodType ).generatePeriods( dhis2.dsr.currentPeriodOffset );
+    periods = dhis2.dsr.periodTypeFactory.reverse( periods );
+    periods = dhis2.dsr.periodTypeFactory.filterFuturePeriodsExceptCurrent( periods );
 
     $( "#periodId" ).removeAttr( "disabled" );
     clearListById( "periodId" );
@@ -77,16 +79,16 @@
 
 function displayNextPeriods()
 {
-    if ( currentPeriodOffset < 0 ) // Cannot display future periods
+    if ( dhis2.dsr.currentPeriodOffset < 0 ) // Cannot display future periods
     {
-        currentPeriodOffset++;
+        dhis2.dsr.currentPeriodOffset++;
         displayPeriods();
     }
 }
 
 function displayPreviousPeriods()
 {
-    currentPeriodOffset--;
+    dhis2.dsr.currentPeriodOffset--;
     displayPeriods();
 }