dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18248
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7621: (DV) Prev year and next year buttons for fixed periods.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 7621 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-07-17 12:30:36 +0200
message:
(DV) Prev year and next year buttons for fixed periods.
added:
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/
renamed:
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js => 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/pt.js => dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/periodtype.js
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/periodtype.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 2012-07-04 13:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2012-07-17 09:40:47 +0000
@@ -16,7 +16,7 @@
<script type="text/javascript" src="i18n.action"></script>
<script type="text/javascript" src="../../dhis-web-commons/javascripts/ext/ext-all.js"></script>
<script type="text/javascript" src="../../dhis-web-commons/javascripts/simpleRegression.js"></script>
- <script type="text/javascript" src="pt.js"></script>
- <script type="text/javascript" src="app.js"></script>
+ <script type="text/javascript" src="scripts/periodtype.js"></script>
+ <script type="text/javascript" src="scripts/app.js"></script>
</body>
</html>
=== added directory 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts'
=== renamed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js' => '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/app.js 2012-07-16 15:58:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2012-07-17 10:28:16 +0000
@@ -409,13 +409,14 @@
},
filterAvailable: function(a, s) {
a.store.filterBy( function(r) {
- var filter = true;
+ var keep = true;
s.store.each( function(r2) {
- if (r.data.id === r2.data.id) {
- filter = false;
+ if (r.data.id == r2.data.id) {
+ keep = false;
}
+
});
- return filter;
+ return keep;
});
a.store.sortStore();
},
@@ -3302,29 +3303,64 @@
hideCollapseTool: true,
items: [
{
- xtype: 'combobox',
- cls: 'dv-combo',
- style: 'margin-bottom:8px',
- width: DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_subtractor,
- valueField: 'id',
- displayField: 'name',
- fieldLabel: DV.i18n.select_type,
- labelStyle: 'padding-left:7px;',
- labelWidth: 90,
- editable: false,
- queryMode: 'remote',
- store: DV.store.periodtype,
- listeners: {
- select: function(cb) {
- var pt = new PeriodType();
- var periods = pt.reverse( pt.filterFuturePeriods( pt.get(cb.getValue()).generatePeriods(0) ) );
- DV.store.fixedperiod.available.setIndex(periods);
- DV.store.fixedperiod.available.loadData(periods);
- DV.util.multiselect.filterAvailable(DV.cmp.dimension.fixedperiod.available, DV.cmp.dimension.fixedperiod.selected);
+ xtype: 'panel',
+ layout: 'column',
+ bodyStyle: 'border-style:none',
+ items: [
+ {
+ xtype: 'combobox',
+ cls: 'dv-combo',
+ style: 'margin-bottom:8px',
+ width: 253,
+ valueField: 'id',
+ displayField: 'name',
+ fieldLabel: DV.i18n.select_type,
+ labelStyle: 'padding-left:7px;',
+ labelWidth: 90,
+ editable: false,
+ queryMode: 'remote',
+ store: DV.store.periodtype,
+ periodOffset: 0,
+ listeners: {
+ select: function() {
+ var pt = new PeriodType();
+ var periods = pt.reverse( pt.filterFuturePeriods( pt.get(this.getValue()).generatePeriods(this.periodOffset) ) );
+ DV.store.fixedperiod.available.setIndex(periods);
+ DV.store.fixedperiod.available.loadData(periods);
+ DV.util.multiselect.filterAvailable(DV.cmp.dimension.fixedperiod.available, DV.cmp.dimension.fixedperiod.selected);
+ }
+ }
+ },
+ {
+ xtype: 'button',
+ text: 'Prev year',
+ style: 'margin-left:4px',
+ height: 24,
+ handler: function() {
+ var cb = this.up('panel').down('combobox');
+ if (cb.getValue()) {
+ cb.periodOffset--;
+ cb.fireEvent('select');
+ }
+ }
+ },
+ {
+ xtype: 'button',
+ text: 'Next year',
+ style: 'margin-left:3px',
+ height: 24,
+ handler: function() {
+ var cb = this.up('panel').down('combobox');
+ if (cb.getValue() && cb.periodOffset < 0) {
+ cb.periodOffset++;
+ cb.fireEvent('select');
+ }
+ }
}
- }
+ ]
},
{
+
xtype: 'panel',
layout: 'column',
bodyStyle: 'border-style:none',
=== renamed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/pt.js' => 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/periodtype.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/pt.js 2012-07-09 13:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/periodtype.js 2012-07-17 10:05:44 +0000
@@ -101,9 +101,9 @@
else
{
date.setDate( date.getDate() + ( 8 - day ) );
- }
+ }
- while ( date.getFullYear() === year )
+ while ( date.getFullYear() <= year )
{
var period = {};
period['startDate'] = format_yyyymmdd( date );