/** * @require framework/widgets/form/SearchField.js */ /** * @namespace framework.widgets */ Ext.namespace("framework.widgets"), framework.widgets.CATGestione = Ext.extend(Ext.Panel, { /** * Target link to the father object. * @public * @type Object */ target: null, /** * url di base per la chiamata al servizio * @private * @type String */ baseUrl: '', /** * Nome della servlet per la ricerca * @private * @type String */ serveltName: 'catastorequest', /** * the authenticate user * @public * @type Ext.data.Store */ userAuthDS: null, /** * A configured map or a configuration object * for the map constructor, required only if :attr:`zoom` is set to * value greater than or equal to 0. * @public * @type OpenLayers.Map or Object */ map: null, constructor: function (config) { if (Ext.isDefined(config.toolbarname)) { this.toolbarname = config.toolbarname; } framework.widgets.CATGestione.superclass.constructor.apply(this, arguments); }, initComponent: function () { this.provinceStore = new Ext.data.Store({ url: this.baseUrl + this.serveltName + "?method=getComuni4User&user=" + this.userAuthDS.myid + "&onlyEnabled=true", autoLoad: true, reader: new Ext.data.JsonReader({ id: 'istat' }, [ {name: 'istat', mapping: 'istat'}, {name: 'nomeProvincia', mapping: 'text'}, {name: 'children', mapping: 'children'} ]) }); this.comuniStore = new Ext.data.Store({ reader: new Ext.data.JsonReader({ id: 'istat' }, [ {name: 'istat', mapping: 'istat'}, {name: 'codiceBelfiore', mapping: 'codiceBelfiore'}, {name: 'nomeComune', mapping: 'text'} ]) }); this.filesStore = new Ext.data.Store({ autoLoad: true, url: this.baseUrl + this.serveltName + "?method=getNomenclatura", reader: new Ext.data.JsonReader({ id: 'id' }, [ {name: 'id', mapping: 'id'}, {name: 'nome', mapping: 'nome'} ]) }); this.comboProvince = new Ext.form.ComboBox({ name: 'cmbProvince', id: 'idCmbProvince', mode: 'local', // width: 180, listWidth: 180, editable: false, store: this.provinceStore, typeAhead: true, valueField: 'istatProvincia', forceSelection: true, displayField: 'nomeProvincia', emptyText: 'Seleziona una provincia...', fieldLabel: 'Provincia', triggerAction: 'all', labelWidth: 180, labelAlign: 'top', listeners: { select: function (combo, record, index) { this.comboProvince.setValue(record.data.nomeProvincia); if (record.data.istatProvinciaPoi !== "") { if (record.data.children.length > 0) { this.comuniStore.loadData(record.data.children); this.comboComuni.setValue(''); this.comboComuni.enable(); } else { this.comboComuni.setValue('Nessun comune abilitato!'); this.comboComuni.disable(); } } else { this.comboComuni.setValue(""); this.comboComuni.disable(); } }, scope: this } }); this.comboComuni = new Ext.form.ComboBox({ name: 'codiceBelfiore', id: 'idCmbComuni', mode: 'local', enabled: false, // width: 180, listWidth: 180, editable: false, store: this.comuniStore, typeAhead: true, valueField: 'codiceBelfiore', forceSelection: true, displayField: 'nomeComune', emptyText: 'Seleziona un comune...', fieldLabel: 'Comune', triggerAction: 'all', labelWidth: 180, labelAlign: 'top' }); this.comboFiles = new Ext.form.ComboBox({ name: 'cmbFiles', id: 'idCmbFiles', mode: 'local', // width: 180, listWidth: 180, editable: false, store: this.filesStore, typeAhead: true, valueField: 'nome', forceSelection: true, displayField: 'nome', emptyText: 'Seleziona uno shapefile...', fieldLabel: 'Shapefile', triggerAction: 'all', labelWidth: 180, labelAlign: 'top' }); this.items = [{ xtype: 'box', cls: 'boxInsPOI', autoEl: {id: 'userId'}, html: this.insertTitleUser(), width: 'auto' }, { width: 225, height: 250, xtype: 'fieldset', title: 'Area di interesse', id: 'areaInteresseCat', autoScroll: true, collapsible: false, defaults: {width: 180}, style: 'margin-left: 10px;', defaultType: 'textfield', labelAlign: 'top', items: [ this.comboProvince, this.comboComuni, this.comboFiles, { xtype: 'button', id: 'idDownload', cls: 'buttonInsPOI', text: 'Download', handler: this.submitDownload, scope: this } ] }]; framework.widgets.CATGestione.superclass.initComponent.call(this); }, updateuserAuth: function (userAuthDS) { this.userAuthDS = userAuthDS; }, insertTitleUser: function () { var text = "