dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29720
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15059: add utility methods to generate/generate and reverse periods by periodType+offset
------------------------------------------------------------
revno: 15059
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-28 18:06:02 +0545
message:
add utility methods to generate/generate and reverse periods by periodType+offset
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.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/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2014-04-28 12:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2014-04-28 12:21:02 +0000
@@ -98,6 +98,24 @@
};
/**
+ * @param generator Generator to use (String)
+ * @param offset Offset for generatePeriods
+ * @returns Array of periods
+ */
+dhis2.period.PeriodGenerator.prototype.generatePeriods = function( generator, offset ) {
+ return this.periodTypes[generator].generatePeriods(offset);
+};
+
+/**
+ * @param generator Generator to use (String)
+ * @param offset Offset for generatePeriods
+ * @returns Array of periods
+ */
+dhis2.period.PeriodGenerator.prototype.generateReversedPeriods = function( generator, offset ) {
+ return this.reverse(this.periodTypes[generator].generatePeriods(offset));
+};
+
+/**
* Convenience method to get Daily generator
*/
dhis2.period.PeriodGenerator.prototype.daily = function( offset ) {