dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32033
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16360: DV support for different calendars.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16360 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-08-09 15:53:51 +0200
message:
DV support for different calendars.
modified:
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.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-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2013-12-24 15:33:27 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2014-08-09 13:53:16 +0000
@@ -20,7 +20,13 @@
<script src="../../dhis-web-commons/javascripts/ext-ux/layout/component/form/MultiSelect.js"></script>
<script src="../../dhis-web-commons/javascripts/ext-ux/form/MultiSelect.js"></script>
- <script src="../../dhis-web-commons/javascripts/periodTypeNoDep.js"></script>
+ <script src="../../dhis-web-commons/javascripts/jQuery/jquery.min.js"></script>
+ <script src="../../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.min.js"></script>
+ <script src="../../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.plus.min.js"></script>
+ <script src="../../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js"></script>
+ <script src="../../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
+ <script src="../../dhis-web-commons/javascripts/date.js"></script>
+
<script src="../../dhis-web-commons/javascripts/simpleRegression.js"></script>
<script src="scripts/core.js"></script>
<script src="scripts/app.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-08-08 13:40:45 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-08-09 13:53:16 +0000
@@ -4253,14 +4253,13 @@
periodOffset: 0,
listeners: {
select: function() {
- var nsype = new PeriodType(),
- periodType = this.getValue();
+ var periodType = this.getValue(),
+ generator = ns.core.init.periodGenerator,
+ periods = generator.filterFuturePeriodsExceptCurrent(generator.generateReversedPeriods(periodType, this.periodOffset));
- var periods = nsype.get(periodType).generatePeriods({
- offset: this.periodOffset,
- filterFuturePeriods: true,
- reversePeriods: true
- });
+ for (var i = 0; i < periods.length; i++) {
+ periods[i].id = periods[i].iso;
+ }
fixedPeriodAvailableStore.setIndex(periods);
fixedPeriodAvailableStore.loadData(periods);
@@ -5959,7 +5958,37 @@
Ext.Ajax.request({
url: init.contextPath + '/api/system/info.json',
success: function(r) {
- init.contextPath = Ext.decode(r.responseText).contextPath || init.contextPath;
+ var info = Ext.decode(r.responseText),
+ dhis2PeriodUrl = '../../dhis-web-commons/javascripts/dhis2/dhis2.period.js',
+ defaultCalendarId = 'gregorian',
+ calendarIdMap = {'iso8601': defaultCalendarId},
+ calendarId = calendarIdMap[info.calendar] || info.calendar || defaultCalendarId,
+ calendarIds = ['coptic', 'ethiopian', 'islamic', 'julian', 'nepali', 'thai'],
+ calendarScriptUrl,
+ createGenerator;
+calendarId = 'nepali';
+
+ // calendar
+ init.dateFormat = info.dateFormat || 'yyyy-mm-dd';
+
+ createGenerator = function() {
+ init.calendar = $.calendars.instance(calendarId);
+ init.periodGenerator = new dhis2.period.PeriodGenerator(init.calendar, init.dateFormat);
+ };
+
+ if (Ext.Array.contains(calendarIds, calendarId)) {
+ calendarScriptUrl = '../../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.' + calendarId + '.min.js';
+
+ Ext.Loader.injectScriptElement(calendarScriptUrl, function() {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ });
+ }
+ else {
+ Ext.Loader.injectScriptElement(dhis2PeriodUrl, createGenerator);
+ }
+
+ // context path
+ init.contextPath = info.contextPath || init.contextPath;
// i18n
requests.push({
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-08-07 10:42:08 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-08-09 13:53:16 +0000
@@ -677,7 +677,7 @@
}
if (!(Ext.isArray(config.rows) && config.rows.length > 0)) {
- if (DV.app) {
+ if (!DV.plugin) {
alert('No values found');
}
return;