=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-08-31 09:58:04 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-08-31 10:08:28 +0000 @@ -738,7 +738,6 @@ { text: 'Filter..', iconCls: 'menu-layeroptions-filter', - hidden: widget.legendDiv == 'centroidlegend', scope: this, handler: function() { this.widget.filtering.showFilteringWindow.call(this.widget); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-08-30 14:45:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-08-31 10:08:28 +0000 @@ -675,7 +675,7 @@ xtype: 'form', labelWidth: G.conf.label_width, items: [ - {html: '
Export thematic map to PNG
'}, + {html: '
Export thematic layer 1 and 2 to PNG
'}, { xtype: 'textfield', id: 'exportimagetitle_tf', === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 2011-08-29 15:24:44 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Centroid.js 2011-08-31 10:50:52 +0000 @@ -84,6 +84,135 @@ requireUpdate: false, + filtering: { + cache: [], + options: { + gt: null, + lt: null + }, + cmp: { + gt: null, + lt: null, + button: null + }, + filter: function() { + var gt = this.filtering.options.gt; + var lt = this.filtering.options.lt; + var add = []; + if (!gt && !lt) { + add = this.filtering.cache.slice(0); + } + else if (gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (gt < lt && (this.filtering.cache[i].attributes.value > gt && this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt > lt && (this.filtering.cache[i].attributes.value > gt || this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt == lt && this.filtering.cache[i].attributes.value == gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (gt && !lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value > gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (!gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value < lt) { + add.push(this.filtering.cache[i]); + } + } + } + this.layer.removeAllFeatures(); + this.layer.addFeatures(add); + }, + showFilteringWindow: function() { + var window = new Ext.Window({ + title: 'Organisation unit filter', + layout: 'fit', + autoHeight: true, + height: 'auto', + width: G.conf.window_width, + items: [ + { + xtype: 'form', + bodyStyle:'padding:8px', + autoHeight: true, + height: 'auto', + labelWidth: G.conf.label_width, + items: [ + { html: 'Show organisation units where value is..' }, + { html: '
' }, + { + xtype: 'numberfield', + fieldLabel: 'Greater than', + width: G.conf.combo_number_width_small, + listeners: { + 'change': { + scope: this, + fn: function(nf) { + this.filtering.options.gt = nf.getValue(); + } + } + } + }, + { + xtype: 'numberfield', + fieldLabel: 'Lower than', + width: G.conf.combo_number_width_small, + listeners: { + 'change': { + scope: this, + fn: function(nf) { + this.filtering.options.lt = nf.getValue(); + } + } + } + } + ] + } + ], + bbar: [ + '->', + { + xtype: 'button', + text: G.i18n.update, + iconCls: 'icon-assign', + scope: this, + handler: function() { + this.filtering.filter.call(this); + } + } + ], + listeners: { + 'afterrender': { + scope: this, + fn: function() { + this.filtering.cache = this.layer.features.slice(0); + } + }, + 'close': { + scope: this, + fn: function() { + this.layer.removeAllFeatures(); + this.layer.addFeatures(this.filtering.cache); + this.filtering.options.gt = null; + this.filtering.options.lt = null; + } + } + } + }); + window.setPagePosition(G.conf.window_x_left,G.conf.window_y_left); + window.show(); + } + }, + initComponent: function() { this.initProperties(); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-08-31 09:58:04 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-08-31 10:50:52 +0000 @@ -90,6 +90,11 @@ gt: null, lt: null }, + cmp: { + gt: null, + lt: null, + button: null + }, filter: function() { var gt = this.filtering.options.gt; var lt = this.filtering.options.lt; @@ -97,18 +102,30 @@ if (!gt && !lt) { add = this.filtering.cache.slice(0); } - else { - for (var i = 0; i < this.filtering.cache.length; i++) { - if (gt && lt && this.filtering.cache[i].attributes.value > gt && this.filtering.cache[i].attributes.value < lt) { - add.push(this.filtering.cache[i]); - } - else { - if (!(gt && lt) && gt && this.filtering.cache[i].attributes.value > gt) { - add.push(this.filtering.cache[i]); - } - else if (!(gt && lt) && lt && this.filtering.cache[i].attributes.value < lt) { - add.push(this.filtering.cache[i]); - } + else if (gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (gt < lt && (this.filtering.cache[i].attributes.value > gt && this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt > lt && (this.filtering.cache[i].attributes.value > gt || this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt == lt && this.filtering.cache[i].attributes.value == gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (gt && !lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value > gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (!gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value < lt) { + add.push(this.filtering.cache[i]); } } } @@ -137,10 +154,17 @@ fieldLabel: 'Greater than', width: G.conf.combo_number_width_small, listeners: { + 'afterrender': { + scope: this, + fn: function(nf) { + this.filtering.cmp.gt = nf; + } + }, 'change': { scope: this, fn: function(nf) { this.filtering.options.gt = nf.getValue(); + } } } @@ -150,10 +174,17 @@ fieldLabel: 'Lower than', width: G.conf.combo_number_width_small, listeners: { + 'afterrender': { + scope: this, + fn: function(nf) { + this.filtering.cmp.lt = nf; + } + }, 'change': { scope: this, fn: function(nf) { this.filtering.options.lt = nf.getValue(); + } } } @@ -170,6 +201,14 @@ scope: this, handler: function() { this.filtering.filter.call(this); + }, + listeners: { + 'afterrender': { + scope: this, + fn: function(b) { + this.filtering.cmp.button = b; + } + } } } ], === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-08-31 09:58:04 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-08-31 10:50:52 +0000 @@ -90,6 +90,11 @@ gt: null, lt: null }, + cmp: { + gt: null, + lt: null, + button: null + }, filter: function() { var gt = this.filtering.options.gt; var lt = this.filtering.options.lt; @@ -97,18 +102,30 @@ if (!gt && !lt) { add = this.filtering.cache.slice(0); } - else { - for (var i = 0; i < this.filtering.cache.length; i++) { - if (gt && lt && this.filtering.cache[i].attributes.value > gt && this.filtering.cache[i].attributes.value < lt) { - add.push(this.filtering.cache[i]); - } - else { - if (!(gt && lt) && gt && this.filtering.cache[i].attributes.value > gt) { - add.push(this.filtering.cache[i]); - } - else if (!(gt && lt) && lt && this.filtering.cache[i].attributes.value < lt) { - add.push(this.filtering.cache[i]); - } + else if (gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (gt < lt && (this.filtering.cache[i].attributes.value > gt && this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt > lt && (this.filtering.cache[i].attributes.value > gt || this.filtering.cache[i].attributes.value < lt)) { + add.push(this.filtering.cache[i]); + } + else if (gt == lt && this.filtering.cache[i].attributes.value == gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (gt && !lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value > gt) { + add.push(this.filtering.cache[i]); + } + } + } + else if (!gt && lt) { + for (var i = 0; i < this.filtering.cache.length; i++) { + if (this.filtering.cache[i].attributes.value < lt) { + add.push(this.filtering.cache[i]); } } }