da 1:{scalaVisualMin} a 1:{scalaVisualMax}
',
// displayField: 'id',
width: 300,
blankText : this.blankText,
emptyText: 'Seleziona una scala di visualizzazione...',
fieldLabel: 'Scala di visualizzazione',
hiddenName: 'scalavis',
triggerAction: 'all',
allowBlank: false,
lastQuery: '',
listeners: {
select: function(combo, record, index) {
_self.idscala = record.data.id;
combo.setValue("da 1:"+record.data.scalaVisualMin+" a 1:"+record.data.scalaVisualMax);
}
}
},{
xtype: 'radiogroup',
// fieldLabel: 'Auto Layout',
name: 'publicDizTop',
id: 'publicDizTop',
width: 300,
// height: 18,
// columns: [170, 170],
items: [
{boxLabel: 'Online', name: 'rb-auto', inputValue: 1},
{boxLabel: 'Offline', name: 'rb-auto', inputValue: 2, checked: true}
]
},
{id: 'geometryDiz', xtype: 'hidden', name: 'geometryDiz'},
{
xtype: "framework_topattributidizionimanagement",
id: "topAttributiDizioniManagement",
dizdatapanel: this,
collapsed: false,
title: 'Gestione attributi dizioni',
layout: 'fit',
width: 400,
height: 200,
autoScroll:true,
listeners: {
loadGeometryAttDiz: function(geom) {
this.fireEvent('loadGeometryAttDiz', geom);
},
getGeometryAttrDiz: function() {
this.fireEvent('getGeometryAttrDiz');
},
openWinEditAttDizTOP: function(flag) {
this.fireEvent('openWinEditAttDizTOP', flag);
},
saveAttrDiz: function(attributi){
if (!_self.dizione) {
_self.dizione = {};
}
_self.dizione.lineeBase = attributi;
this.fireEvent('saveAttrDiz', _self.dizione);
},
scope:this
}
}
],
buttons: [{
text: 'Annulla',
handler: function() {
_self.hide();
}
}, {
text: 'Salva',
id: 'btnSaveDizTOP',
handler: function() {
var lang = _self._dizioneform.getForm().findField('language').getValue();
var fonte = _self._dizioneform.getForm().findField('fonte').getValue();
var scalavis = _self._dizioneform.getForm().findField('scalavis').getValue();
var publicDizTopObj = _self._dizioneform.getForm().findField('publicDizTop').getValue();
var publicDizTop = this.publicDizTop = (publicDizTopObj.inputValue === 1) ? true : false;
var lineeBase = Ext.getCmp('topAttributiDizioniManagement').getAttrDizTop();
var idxLingua = _self.langDS.find('lang', lang);
var lingua = _self.langDS.getAt(idxLingua);
var idxFonte = _self.fontiDS.find('codice', fonte);
var fonte = _self.fontiDS.getAt(idxFonte);
var idxScala = _self.scaleDS.find('id', _self.idscala);
var scala = _self.scaleDS.getAt(idxScala);
if (lingua && fonte && scala && lineeBase) {
function compare(a,b) {
if (a.idTesto < b.idTesto)
return -1;
if (a.idTesto > b.idTesto)
return 1;
return 0;
}
lineeBase.sort(compare);
var testo = "";
lineeBase.forEach(function(linea) {
testo += linea.testo+" ";
});
if (!_self.dizione) {
_self.dizione = {};
}
_self.dizione.lingua = lingua.data.desc;
_self.dizione.codLingua = lingua.data.lang;
_self.dizione.fonte = fonte.data;
_self.dizione.scala = scala.data;
_self.dizione.enabled = publicDizTop;
_self.dizione.lineeBase = lineeBase;
_self.dizione.testo = testo;
_self.fireEvent('saveDiz', _self.dizione);
Ext.getCmp('topAttributiDizioniManagement').clearDataAttrDizTop();
_self.hide();
}
else
Ext.Msg.alert('Attenzione', "Compilare tutti i campi e aggiungere almeno un attributo dizione");
}
}]
});
this.items = [this._dizioneform];
this.openEditDizTopForm = function(dizione) {
this.dizione = dizione;
var _self = this;
// _self.topFeature = topFeature;
// _self.topFeatureNew = null;
this.fontiDS.load({params: {method: 'getFonti'}});
this.scaleDS.load({params: {method: 'getScala'}});
if (dizione) {
this.title = 'Modifica dizione';
this._dizioneform.getForm().findField('idDizione').setValue(dizione.idDizione);
this._dizioneform.getForm().findField('language').setValue(dizione.codLingua);
// this._dizioneform.getForm().findField('fonte').setValue(dizione.fonte.codice);
var scala = "da 1:"+dizione.scala.scalaVisualMin+" a 1:"+dizione.scala.scalaVisualMax;
this._dizioneform.getForm().findField('scalavis').setValue(scala);
this.codice_fonte = dizione.fonte.codice;
this.idscala = dizione.scala.id;
if (dizione.enabled)
_self._dizioneform.getForm().findField('publicDizTop').items.items[0].setValue(true);
else
_self._dizioneform.getForm().findField('publicDizTop').items.items[1].setValue(true);
function compare(a,b) {
if (a.idTesto < b.idTesto)
return -1;
if (a.idTesto > b.idTesto)
return 1;
return 0;
}
dizione.lineeBase.sort(compare);
Ext.getCmp('topAttributiDizioniManagement').upDateAttrDizTop(dizione.lineeBase);
}
else {
this.title = 'Nuova dizione';
this._dizioneform.getForm().reset();
this.idscala = null;
Ext.getCmp('topAttributiDizioniManagement').clearDataAttrDizTop();
}
// var poiUUID = (topFeature) ? topFeature.poiUUID : null;
};
framework.widgets.TopDizioniDataPanel.superclass.initComponent.call(this);
},
updateUserAuth: function(userAuthDS) {
this.userAuthDS = userAuthDS;
if (this.userAuthDS.usertype.description === "Amministratore" || this.userAuthDS.usertype.description === "Gestore")
this._dizioneform.getForm().findField('publicTop').enable();
else
this._dizioneform.getForm().findField('publicTop').disable();
}
});
/** api: xtype = framework_panelpoidata */
Ext.reg("framework_topdizionidatapanel", framework.widgets.TopDizioniDataPanel);