dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19957
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8930: (GIS) Facility filter implemented.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 8930 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 14:48:02 +0300
message:
(GIS) Facility filter implemented.
removed:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button/
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button/ColorButton.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel/
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel/LayerItemPanel.js
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.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-mapping/src/main/webapp/dhis-web-mapping/app/index.html'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html 2012-11-06 12:22:24 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html 2012-11-07 11:32:26 +0000
@@ -29,18 +29,12 @@
document.body.oncontextmenu = function(){return false;};
</script>
+<!--
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
+-->
<script type="text/javascript" src="../../dhis-web-commons/javascripts/ext/ext-all.js"></script>
- <script type="text/javascript">
- Ext.Loader.setConfig({enabled: true, paths: {
- 'Ext.ux': 'scripts/ext-ux'
- }});
- Ext.require([
- 'Ext.ux.button.ColorButton',
- 'Ext.ux.panel.LayerItemPanel'
- ]);
- </script>
+ <script type="text/javascript" src="scripts/ext-ux/ext-ux-custom.js"></script>
<script type="text/javascript" src="scripts/openlayers/OpenLayers.js"></script>
<script type="text/javascript" src="scripts/openlayers-ux/newSelectFeature.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2012-11-06 17:02:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2012-11-07 11:32:26 +0000
@@ -952,7 +952,7 @@
};
items.push(item);
- if (base.id !== GIS.base.boundary.id && base.id !== GIS.base.facility.id) {
+ if (base.id !== GIS.base.boundary.id) {
item = {
text: 'Filter..', //i18n
iconCls: 'gis-menu-item-icon-filter',
@@ -966,7 +966,8 @@
}
}
- base.widget.cmp.filterWindow = new GIS.obj.FilterWindow(base);
+ base.widget.cmp.filterWindow = base.id === GIS.base.facility.id ?
+ new GIS.obj.FilterFacilityWindow(base) : new GIS.obj.FilterWindow(base);
base.widget.cmp.filterWindow.show();
}
};
@@ -1398,6 +1399,78 @@
return window;
};
+ GIS.obj.FilterFacilityWindow = function(base) {
+ var that = base.widget,
+ window,
+ multiSelect,
+ button,
+ filter,
+ selection,
+ features = [],
+ groupSetName = that.view.organisationUnitGroupSet.name,
+ store = GIS.store.groupsByGroupSet;
+
+ filter = function() {
+ features = [];
+
+ if (!selection.length || !selection[0]) {
+ features = that.features;
+ }
+ else {
+ for (var i = 0; i < that.features.length; i++) {
+ for (var j = 0; j < selection.length; j++) {
+ if (that.features[i].attributes[groupSetName] === selection[j]) {
+ features.push(that.features[i]);
+ }
+ }
+ }
+ }
+
+ that.layer.removeAllFeatures();
+ that.layer.addFeatures(features);
+ };
+
+ multiSelect = Ext.create('Ext.ux.form.MultiSelect', {
+ hideLabel: true,
+ dataFields: ['id', 'name'],
+ valueField: 'name',
+ displayField: 'name',
+ width: 200,
+ height: 300,
+ store: store
+ });
+
+ button = Ext.create('Ext.button.Button', {
+ text: 'Filter',
+ handler: function() {
+ selection = multiSelect.getValue();
+ filter();
+ }
+ });
+
+ window = Ext.create('Ext.window.Window', {
+ title: 'Filter by value',
+ iconCls: 'gis-window-title-icon-filter',
+ cls: 'gis-container-default',
+ //width: GIS.conf.layout.tool.window_width,
+ resizable: false,
+ filter: filter,
+ items: multiSelect,
+ bbar: [
+ '->',
+ button
+ ],
+ listeners: {
+ destroy: function() {
+ that.layer.removeAllFeatures();
+ that.layer.addFeatures(that.features);
+ }
+ }
+ });
+
+ return window;
+ };
+
GIS.obj.LabelWindow = function(base) {
var layer = base.layer,
fontSize,
=== removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button'
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button/ColorButton.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button/ColorButton.js 2012-10-10 22:28:24 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/button/ColorButton.js 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-Ext.define('Ext.ux.button.ColorButton', {
- extend: 'Ext.button.Button',
- alias: 'widget.colorbutton',
- width: 109,
- height: 22,
- defaultValue: null,
- value: 'f1f1f1',
- getValue: function() {
- return this.value;
- },
- setValue: function(color) {
- this.value = color;
- if (Ext.isDefined(this.getEl())) {
- this.getEl().dom.style.background = '#' + color;
- }
- },
- reset: function() {
- this.setValue(this.defaultValue);
- },
- menu: {},
- menuHandler: function() {},
- initComponent: function() {
- var that = this;
- this.defaultValue = this.value;
- this.menu = Ext.create('Ext.menu.Menu', {
- showSeparator: false,
- items: {
- xtype: 'colorpicker',
- closeAction: 'hide',
- listeners: {
- select: function(cp, color) {
- that.setValue(color);
- that.menu.hide();
- that.menuHandler(cp, color);
- }
- }
- }
- });
- this.callParent();
- },
- listeners: {
- render: function() {
- this.setValue(this.value);
- }
- }
-});
-
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/ext-ux-custom.js 2012-11-07 11:32:26 +0000
@@ -0,0 +1,506 @@
+/* ColorButton */
+
+Ext.define('Ext.ux.button.ColorButton', {
+ extend: 'Ext.button.Button',
+ alias: 'widget.colorbutton',
+ width: 109,
+ height: 22,
+ defaultValue: null,
+ value: 'f1f1f1',
+ getValue: function() {
+ return this.value;
+ },
+ setValue: function(color) {
+ this.value = color;
+ if (Ext.isDefined(this.getEl())) {
+ this.getEl().dom.style.background = '#' + color;
+ }
+ },
+ reset: function() {
+ this.setValue(this.defaultValue);
+ },
+ menu: {},
+ menuHandler: function() {},
+ initComponent: function() {
+ var that = this;
+ this.defaultValue = this.value;
+ this.menu = Ext.create('Ext.menu.Menu', {
+ showSeparator: false,
+ items: {
+ xtype: 'colorpicker',
+ closeAction: 'hide',
+ listeners: {
+ select: function(cp, color) {
+ that.setValue(color);
+ that.menu.hide();
+ that.menuHandler(cp, color);
+ }
+ }
+ }
+ });
+ this.callParent();
+ },
+ listeners: {
+ render: function() {
+ this.setValue(this.value);
+ }
+ }
+});
+
+/* LayerItemPanel */
+
+Ext.define('Ext.ux.panel.LayerItemPanel', {
+ extend: 'Ext.panel.Panel',
+ alias: 'widget.layeritempanel',
+ layout: 'column',
+ layer: null,
+ checkbox: null,
+ numberField: null,
+ imageUrl: null,
+ text: null,
+ width: 184,
+ height: 22,
+ value: false,
+ opacity: 0.8,
+ getValue: function() {
+ return this.checkbox.getValue();
+ },
+ setValue: function(value, opacity) {
+ this.checkbox.setValue(value);
+ this.numberField.setDisabled(!value);
+ this.layer.setVisibility(value);
+
+ if (opacity === 0) {
+ this.numberField.setValue(0);
+ this.setOpacity(0.01);
+ }
+ else if (opacity > 0) {
+ this.numberField.setValue(opacity * 100);
+ this.setOpacity(opacity);
+ }
+ else {
+ this.numberField.setValue(this.opacity * 100);
+ this.setOpacity(this.opacity);
+ }
+ },
+ getOpacity: function() {
+ return this.opacity;
+ },
+ setOpacity: function(opacity) {
+ this.opacity = opacity === 0 ? 0.01 : opacity;
+ this.layer.setLayerOpacity(this.opacity);
+ },
+ disableItem: function() {
+ this.checkbox.setValue(false);
+ this.numberField.disable();
+ this.layer.setVisibility(false);
+ },
+ updateItem: function(value) {
+ this.numberField.setDisabled(!value);
+ this.layer.setVisibility(value);
+ },
+ initComponent: function() {
+ var that = this,
+ image;
+
+ this.checkbox = Ext.create('Ext.form.field.Checkbox', {
+ width: 14,
+ checked: this.value,
+ listeners: {
+ change: function(chb, value) {
+ if (value && that.layer.layerType === GIS.conf.finals.layer.type_base) {
+ var layers = GIS.util.map.getLayersByType(GIS.conf.finals.layer.type_base),
+ layer;
+ for (var i = 0; i < layers.length; i++) {
+ layer = layers[i];
+ if (layer !== that.layer) {
+ layer.item.checkbox.suppressChange = true;
+ layer.item.disableItem();
+ }
+ }
+ }
+ that.updateItem(value);
+
+ GIS.cmp.downloadButton.xable();
+ }
+ }
+ });
+
+ image = Ext.create('Ext.Img', {
+ width: 14,
+ height: 14,
+ src: this.imageUrl
+ });
+
+ this.numberField = Ext.create('Ext.form.field.Number', {
+ cls: 'gis-numberfield',
+ width: 47,
+ height: 18,
+ minValue: 0,
+ maxValue: 100,
+ value: this.opacity * 100,
+ allowBlank: false,
+ disabled: this.numberFieldDisabled,
+ listeners: {
+ change: function() {
+ var value = this.getValue(),
+ opacity = value === 0 ? 0.01 : value/100;
+
+ that.setOpacity(opacity);
+ }
+ }
+ });
+
+ this.items = [
+ {
+ width: this.checkbox.width + 6,
+ items: this.checkbox
+ },
+ {
+ width: image.width + 5,
+ items: image,
+ bodyStyle: 'padding-top: 4px'
+ },
+ {
+ width: 98,
+ html: this.text,
+ bodyStyle: 'padding-top: 4px'
+ },
+ {
+ width: this.numberField.width,
+ items: this.numberField
+ }
+ ];
+
+ this.layer.setOpacity(this.opacity);
+
+ this.callParent();
+ }
+});
+
+/* MultiSelect */
+
+Ext.define("Ext.ux.layout.component.form.MultiSelect",{extend:"Ext.layout.component.field.Field",alias:["layout.multiselectfield"],type:"multiselectfield",defaultHeight:200,sizeBodyContents:function(a,b){var c=this;if(!Ext.isNumber(b)){b=c.defaultHeight}c.owner.panel.setSize(a,b)}});
+
+/*
+This file is part of Ext JS 4
+Copyright (c) 2011 Sencha Inc
+Contact: http://www.sencha.com/contact
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+*/
+/**
+ * @class Ext.ux.form.MultiSelect
+ * @extends Ext.form.field.Base
+ * A control that allows selection and form submission of multiple list items.
+ *
+ * @history
+ * 2008-06-19 bpm Original code contributed by Toby Stuart (with contributions from Robert Williams)
+ * 2008-06-19 bpm Docs and demo code clean up
+ *
+ * @constructor
+ * Create a new MultiSelect
+ * @param {Object} config Configuration options
+ * @xtype multiselect
+ */
+Ext.define('Ext.ux.form.MultiSelect', {
+ extend: 'Ext.form.field.Base',
+ alternateClassName: 'Ext.ux.Multiselect',
+ alias: ['widget.multiselect', 'widget.multiselectfield'],
+ uses: ['Ext.view.BoundList', 'Ext.form.FieldSet', 'Ext.ux.layout.component.form.MultiSelect', 'Ext.view.DragZone', 'Ext.view.DropZone'],
+ /**
+ * @cfg {String} listTitle An optional title to be displayed at the top of the selection list.
+ */
+ /**
+ * @cfg {String/Array} dragGroup The ddgroup name(s) for the MultiSelect DragZone (defaults to undefined).
+ */
+ /**
+ * @cfg {String/Array} dropGroup The ddgroup name(s) for the MultiSelect DropZone (defaults to undefined).
+ */
+ /**
+ * @cfg {Boolean} ddReorder Whether the items in the MultiSelect list are drag/drop reorderable (defaults to false).
+ */
+ ddReorder: false,
+ /**
+ * @cfg {Object/Array} tbar An optional toolbar to be inserted at the top of the control's selection list.
+ * This can be a {@link Ext.toolbar.Toolbar} object, a toolbar config, or an array of buttons/button configs
+ * to be added to the toolbar. See {@link Ext.panel.Panel#tbar}.
+ */
+ /**
+ * @cfg {String} appendOnly True if the list should only allow append drops when drag/drop is enabled
+ * (use for lists which are sorted, defaults to false).
+ */
+ appendOnly: false,
+ /**
+ * @cfg {String} displayField Name of the desired display field in the dataset (defaults to 'text').
+ */
+ displayField: 'text',
+ /**
+ * @cfg {String} valueField Name of the desired value field in the dataset (defaults to the
+ * value of {@link #displayField}).
+ */
+ /**
+ * @cfg {Boolean} allowBlank False to require at least one item in the list to be selected, true to allow no
+ * selection (defaults to true).
+ */
+ allowBlank: true,
+ /**
+ * @cfg {Number} minSelections Minimum number of selections allowed (defaults to 0).
+ */
+ minSelections: 0,
+ /**
+ * @cfg {Number} maxSelections Maximum number of selections allowed (defaults to Number.MAX_VALUE).
+ */
+ maxSelections: Number.MAX_VALUE,
+ /**
+ * @cfg {String} blankText Default text displayed when the control contains no items (defaults to 'This field is required')
+ */
+ blankText: 'This field is required',
+ /**
+ * @cfg {String} minSelectionsText Validation message displayed when {@link #minSelections} is not met (defaults to 'Minimum {0}
+ * item(s) required'). The {0} token will be replaced by the value of {@link #minSelections}.
+ */
+ minSelectionsText: 'Minimum {0} item(s) required',
+ /**
+ * @cfg {String} maxSelectionsText Validation message displayed when {@link #maxSelections} is not met (defaults to 'Maximum {0}
+ * item(s) allowed'). The {0} token will be replaced by the value of {@link #maxSelections}.
+ */
+ maxSelectionsText: 'Maximum {0} item(s) allowed',
+ /**
+ * @cfg {String} delimiter The string used to delimit the selected values when {@link #getSubmitValue submitting}
+ * the field as part of a form. Defaults to ','. If you wish to have the selected values submitted as separate
+ * parameters rather than a single delimited parameter, set this to <tt>null</tt>.
+ */
+ delimiter: ',',
+ /**
+ * @cfg {Ext.data.Store/Array} store The data source to which this MultiSelect is bound (defaults to <tt>undefined</tt>).
+ * Acceptable values for this property are:
+ * <div class="mdetail-params"><ul>
+ * <li><b>any {@link Ext.data.Store Store} subclass</b></li>
+ * <li><b>an Array</b> : Arrays will be converted to a {@link Ext.data.ArrayStore} internally.
+ * <div class="mdetail-params"><ul>
+ * <li><b>1-dimensional array</b> : (e.g., <tt>['Foo','Bar']</tt>)<div class="sub-desc">
+ * A 1-dimensional array will automatically be expanded (each array item will be the combo
+ * {@link #valueField value} and {@link #displayField text})</div></li>
+ * <li><b>2-dimensional array</b> : (e.g., <tt>[['f','Foo'],['b','Bar']]</tt>)<div class="sub-desc">
+ * For a multi-dimensional array, the value in index 0 of each item will be assumed to be the combo
+ * {@link #valueField value}, while the value at index 1 is assumed to be the combo {@link #displayField text}.
+ * </div></li></ul></div></li></ul></div>
+ */
+ componentLayout: 'multiselectfield',
+ fieldBodyCls: Ext.baseCSSPrefix + 'form-multiselect-body',
+ // private
+ initComponent: function () {
+ var me = this;
+ me.bindStore(me.store, true);
+ if (me.store.autoCreated) {
+ me.valueField = me.displayField = 'field1';
+ if (!me.store.expanded) {
+ me.displayField = 'field2';
+ }
+ }
+ if (!Ext.isDefined(me.valueField)) {
+ me.valueField = me.displayField;
+ }
+ me.callParent();
+ },
+ bindStore: function (store, initial) {
+ var me = this,
+ oldStore = me.store,
+ boundList = me.boundList;
+ if (oldStore && !initial && oldStore !== store && oldStore.autoDestroy) {
+ oldStore.destroy();
+ }
+ me.store = store ? Ext.data.StoreManager.lookup(store) : null;
+ if (boundList) {
+ boundList.bindStore(store || null);
+ }
+ },
+ // private
+ onRender: function (ct, position) {
+ var me = this,
+ panel, boundList, selModel;
+ me.callParent(arguments);
+ boundList = me.boundList = Ext.create('Ext.view.BoundList', {
+ multiSelect: true,
+ store: me.store,
+ displayField: me.displayField,
+ border: false
+ });
+ selModel = boundList.getSelectionModel();
+ me.mon(selModel, {
+ selectionChange: me.onSelectionChange,
+ scope: me
+ });
+ panel = me.panel = Ext.create('Ext.panel.Panel', {
+ title: me.listTitle,
+ tbar: me.tbar,
+ items: [boundList],
+ renderTo: me.bodyEl,
+ layout: 'fit'
+ });
+ // Must set upward link after first render
+ panel.ownerCt = me;
+ // Set selection to current value
+ me.setRawValue(me.rawValue);
+ },
+ // No content generated via template, it's all added components
+ getSubTplMarkup: function () {
+ return '';
+ },
+ // private
+ afterRender: function () {
+ var me = this;
+ me.callParent();
+ if (me.ddReorder && !me.dragGroup && !me.dropGroup) {
+ me.dragGroup = me.dropGroup = 'MultiselectDD-' + Ext.id();
+ }
+ if (me.draggable || me.dragGroup) {
+ me.dragZone = Ext.create('Ext.view.DragZone', {
+ view: me.boundList,
+ ddGroup: me.dragGroup,
+ dragText: '{0} Item{1}'
+ });
+ }
+ if (me.droppable || me.dropGroup) {
+ me.dropZone = Ext.create('Ext.view.DropZone', {
+ view: me.boundList,
+ ddGroup: me.dropGroup,
+ handleNodeDrop: function (data, dropRecord, position) {
+ var view = this.view,
+ store = view.getStore(),
+ records = data.records,
+ index;
+ // remove the Models from the source Store
+ data.view.store.remove(records);
+ index = store.indexOf(dropRecord);
+ if (position === 'after') {
+ index++;
+ }
+ store.insert(index, records);
+ view.getSelectionModel().select(records);
+ }
+ });
+ }
+ },
+ onSelectionChange: function () {
+ this.checkChange();
+ },
+ /**
+ * Clears any values currently selected.
+ */
+ clearValue: function () {
+ this.setValue([]);
+ },
+ /**
+ * Return the value(s) to be submitted for this field. The returned value depends on the {@link #delimiter}
+ * config: If it is set to a String value (like the default ',') then this will return the selected values
+ * joined by the delimiter. If it is set to <tt>null</tt> then the values will be returned as an Array.
+ */
+ getSubmitValue: function () {
+ var me = this,
+ delimiter = me.delimiter,
+ val = me.getValue();
+ return Ext.isString(delimiter) ? val.join(delimiter) : val;
+ },
+ // inherit docs
+ getRawValue: function () {
+ var me = this,
+ boundList = me.boundList;
+ if (boundList) {
+ me.rawValue = Ext.Array.map(boundList.getSelectionModel().getSelection(), function (model) {
+ return model.get(me.valueField);
+ });
+ }
+ return me.rawValue;
+ },
+ // inherit docs
+ setRawValue: function (value) {
+ var me = this,
+ boundList = me.boundList,
+ models;
+ value = Ext.Array.from(value);
+ me.rawValue = value;
+ if (boundList) {
+ models = [];
+ Ext.Array.forEach(value, function (val) {
+ var undef, model = me.store.findRecord(me.valueField, val, undef, undef, true, true);
+ if (model) {
+ models.push(model);
+ }
+ });
+ boundList.getSelectionModel().select(models, false, true);
+ }
+ return value;
+ },
+ // no conversion
+ valueToRaw: function (value) {
+ return value;
+ },
+ // compare array values
+ isEqual: function (v1, v2) {
+ var fromArray = Ext.Array.from,
+ i, len;
+ v1 = fromArray(v1);
+ v2 = fromArray(v2);
+ len = v1.length;
+ if (len !== v2.length) {
+ return false;
+ }
+ for (i = 0; i < len; i++) {
+ if (v2[i] !== v1[i]) {
+ return false;
+ }
+ }
+ return true;
+ },
+ getErrors: function (value) {
+ var me = this,
+ format = Ext.String.format,
+ errors = me.callParent(arguments),
+ numSelected;
+ value = Ext.Array.from(value || me.getValue());
+ numSelected = value.length;
+ if (!me.allowBlank && numSelected < 1) {
+ errors.push(me.blankText);
+ }
+ if (numSelected < this.minSelections) {
+ errors.push(format(me.minSelectionsText, me.minSelections));
+ }
+ if (numSelected > this.maxSelections) {
+ errors.push(format(me.maxSelectionsText, me.maxSelections));
+ }
+ return errors;
+ },
+ onDisable: function () {
+ this.callParent();
+ this.disabled = true;
+ this.updateReadOnly();
+ },
+ onEnable: function () {
+ this.callParent();
+ this.disabled = false;
+ this.updateReadOnly();
+ },
+ setReadOnly: function (readOnly) {
+ this.readOnly = readOnly;
+ this.updateReadOnly();
+ },
+ /**
+ * @private Lock or unlock the BoundList's selection model to match the current disabled/readonly state
+ */
+ updateReadOnly: function () {
+ var me = this,
+ boundList = me.boundList,
+ readOnly = me.readOnly || me.disabled;
+ if (boundList) {
+ boundList.getSelectionModel().setLocked(readOnly);
+ }
+ },
+ onDestroy: function () {
+ Ext.destroyMembers(this, 'panel', 'boundList', 'dragZone', 'dropZone');
+ this.callParent();
+ }
+});
+
=== removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel'
=== removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel/LayerItemPanel.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel/LayerItemPanel.js 2012-11-04 10:03:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/ext-ux/panel/LayerItemPanel.js 1970-01-01 00:00:00 +0000
@@ -1,137 +0,0 @@
-Ext.define('Ext.ux.panel.LayerItemPanel', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.layeritempanel',
- layout: 'column',
- layer: null,
- checkbox: null,
- numberField: null,
- imageUrl: null,
- text: null,
- width: 184,
- height: 22,
- value: false,
- opacity: 0.8,
- getValue: function() {
- return this.checkbox.getValue();
- },
- setValue: function(value, opacity) {
- this.checkbox.setValue(value);
- this.numberField.setDisabled(!value);
- this.layer.setVisibility(value);
-
- if (opacity === 0) {
- this.numberField.setValue(0);
- this.setOpacity(0.01);
- }
- else if (opacity > 0) {
- this.numberField.setValue(opacity * 100);
- this.setOpacity(opacity);
- }
- else {
- this.numberField.setValue(this.opacity * 100);
- this.setOpacity(this.opacity);
- }
-
-
-
- //opacity = opacity === 0 ? 0.01 : (opacity || this.opacity);
- //this.checkbox.setValue(value);
- //this.numberField.setValue(opacity * 100);
- //this.numberField.setDisabled(!value);
- //this.layer.setVisibility(value);
- //this.setOpacity(opacity);
- },
- getOpacity: function() {
- return this.opacity;
- },
- setOpacity: function(opacity) {
- this.opacity = opacity === 0 ? 0.01 : opacity;
- this.layer.setLayerOpacity(this.opacity);
- },
- disableItem: function() {
- this.checkbox.setValue(false);
- this.numberField.disable();
- this.layer.setVisibility(false);
- },
- updateItem: function(value) {
- this.numberField.setDisabled(!value);
- this.layer.setVisibility(value);
- },
- initComponent: function() {
- var that = this,
- image;
-
- this.checkbox = Ext.create('Ext.form.field.Checkbox', {
- width: 14,
- checked: this.value,
- listeners: {
- change: function(chb, value) {
- if (value && that.layer.layerType === GIS.conf.finals.layer.type_base) {
- var layers = GIS.util.map.getLayersByType(GIS.conf.finals.layer.type_base),
- layer;
- for (var i = 0; i < layers.length; i++) {
- layer = layers[i];
- if (layer !== that.layer) {
- layer.item.checkbox.suppressChange = true;
- layer.item.disableItem();
- }
- }
- }
- that.updateItem(value);
-
- GIS.cmp.downloadButton.xable();
- }
- }
- });
-
- image = Ext.create('Ext.Img', {
- width: 14,
- height: 14,
- src: this.imageUrl
- });
-
- this.numberField = Ext.create('Ext.form.field.Number', {
- cls: 'gis-numberfield',
- width: 47,
- height: 18,
- minValue: 0,
- maxValue: 100,
- value: this.opacity * 100,
- allowBlank: false,
- disabled: this.numberFieldDisabled,
- listeners: {
- change: function() {
- var value = this.getValue(),
- opacity = value === 0 ? 0.01 : value/100;
-
- that.setOpacity(opacity);
- }
- }
- });
-
- this.items = [
- {
- width: this.checkbox.width + 6,
- items: this.checkbox
- },
- {
- width: image.width + 5,
- items: image,
- bodyStyle: 'padding-top: 4px'
- },
- {
- width: 98,
- html: this.text,
- bodyStyle: 'padding-top: 4px'
- },
- {
- width: this.numberField.width,
- items: this.numberField
- }
- ];
-
- this.layer.setOpacity(this.opacity);
-
- this.callParent();
- }
-});
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-11-06 07:41:32 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-11-07 11:32:26 +0000
@@ -193,22 +193,7 @@
this.config.extended.updateLegend = true;
store.proxy.url = GIS.conf.url.path_gis + 'getOrganisationUnitGroupsByGroupSet.action?id=' + value;
- store.load(); //{
- //scope: this.scope,
- //callback: function() {
- //if (this.config.extended.updateGui) { // If favorite, wait for callback and continue execution
- //if (this.config.extended.updateOrganisationUnit) {
- //this.loadOrganisationUnits();
- //}
- //else {
- //this.loadLegend();
- //}
- //}
- //else {
- //this.config.extended.updateLegend = true;
- //}
- //}
- //});
+ store.load();
}
}
}
@@ -846,8 +831,6 @@
return;
}
- this.features = this.layer.features.slice(0);
-
this.loadData(features);
}
});
@@ -867,6 +850,8 @@
if (this.tmpView.extended.updateOrganisationUnit) {
this.layer.features = GIS.util.vector.getTransformedFeatureArray(this.layer.features);
}
+
+ this.features = this.layer.features.slice(0);
this.loadLegend();
},