dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29695
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15038: add override for default date format if nepali is selected
------------------------------------------------------------
revno: 15038
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-28 11:03:45 +0545
message:
add override for default date format if nepali is selected
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.nepali.js
modified:
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/main.vm
--
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 05:12:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2014-04-28 05:18:45 +0000
@@ -28,7 +28,7 @@
dhis2.util.namespace('dhis2.period');
-dhis2.period.DATE_FORMAT = "yyyy-mm-dd";
+dhis2.period.DEFAULT_DATE_FORMAT = "yyyy-mm-dd";
dhis2.period.PeriodGenerator = function( calendar ) {
if( typeof calendar === 'undefined' ) {
@@ -114,9 +114,9 @@
for( var day = 1; day <= cal.daysInYear(year); day++ ) {
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['name'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['name'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['id'] = 'Daily_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyymmdd");
@@ -149,12 +149,12 @@
// goes up to 200, but break when week is back to 1
for( var week = 1; week < 200; week++ ) {
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
// not very elegant, but seems to be best way to get week end, adds a week, then minus 1 day
var endDate = cal.newDate(startDate).add(1, 'w').add(-1, 'd');
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = 'W' + week + ' - ' + period['startDate'] + ' - ' + period['endDate'];
period['id'] = 'Weekly_' + period['startDate'];
period['iso'] = year + 'W' + week;
@@ -190,8 +190,8 @@
var endDate = cal.newDate(startDate).set(startDate.daysInMonth(month), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM yyyy");
period['id'] = 'Monthly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyymm");
@@ -221,8 +221,8 @@
endDate.set(endDate.daysInMonth(month + 1), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM") + '-' + endDate.formatDate('MM') + ' ' + year;
period['id'] = 'BiMonthly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyymm") + 'B';
@@ -252,8 +252,8 @@
endDate.set(endDate.daysInMonth(month + 2), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM") + '-' + endDate.formatDate('MM') + ' ' + year;
period['id'] = 'Quarterly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy") + 'Q' + idx;
@@ -283,8 +283,8 @@
endDate.set(endDate.daysInMonth(6), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM") + '-' + endDate.formatDate('MM') + ' ' + year;
period['id'] = 'SixMonthly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy") + 'S1';
@@ -296,8 +296,8 @@
endDate.set(endDate.daysInMonth(12), 'd');
period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM") + '-' + endDate.formatDate('MM') + ' ' + year;
period['id'] = 'SixMonthly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy") + 'S2';
@@ -325,8 +325,8 @@
endDate.set(endDate.daysInMonth(9), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM") + ' - ' + endDate.formatDate('MM') + ' ' + year;
period['id'] = 'SixMonthlyApril_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy") + 'AprilS1';
@@ -338,8 +338,8 @@
endDate.set(endDate.daysInMonth(endDate.month()), 'd');
period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("MM yyyy") + ' - ' + endDate.formatDate('MM yyyy');
period['id'] = 'SixMonthlyApril_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy") + 'AprilS2';
@@ -369,8 +369,8 @@
endDate.set(endDate.daysInMonth(endDate.month()), 'd');
var period = {};
- period['startDate'] = startDate.formatDate(dhis2.period.DATE_FORMAT);
- period['endDate'] = endDate.formatDate(dhis2.period.DATE_FORMAT);
+ period['startDate'] = startDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
+ period['endDate'] = endDate.formatDate(dhis2.period.DEFAULT_DATE_FORMAT);
period['name'] = startDate.formatDate("yyyy");
period['id'] = 'Yearly_' + period['startDate'];
period['iso'] = startDate.formatDate("yyyy");
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.nepali.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.nepali.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.nepali.js 2014-04-28 05:18:45 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+dhis2.util.namespace('dhis2.period');
+
+// HMIS period format for Nepal
+dhis2.period.DEFAULT_DATE_FORMAT = "dd-mm-yyyy";
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-28 05:12:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-28 05:18:45 +0000
@@ -62,6 +62,11 @@
#end
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.period.js?_rev=$!{buildRevision}"></script>
+
+ #if( $keyCalendar == "nepali" )
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.period.${keyCalendar}.js?_rev=$!{buildRevision}"></script>
+ #end
+
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.selected.js?_rev=$!{buildRevision}"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.comparator.js?_rev=$!{buildRevision}"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.availability.js?_rev=$!{buildRevision}"></script>