Mercurial > lada > lada-client
changeset 1146:645f888e34be
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 27 May 2016 14:52:56 +0200 |
parents | 7ac4d811cf89 (diff) 52b2c1d1ca53 (current diff) |
children | 1cf5280bbc45 356941a04ba0 |
files | resources/i18n/Lada_de-DE.properties |
diffstat | 15 files changed, 250 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/Ort.js Fri May 27 11:09:02 2016 +0200 +++ b/app/controller/Ort.js Fri May 27 14:52:56 2016 +0200 @@ -12,7 +12,7 @@ var me = this; this.control({ 'ortpanel button[action=addMap]': { - click: me.addFeature + click: me.activateDraw }, 'ortpanel button[action=add]': { click: me.addRecord @@ -23,22 +23,92 @@ 'ortpanel ortstammdatengrid': { edit: me.gridSave, canceledit: me.cancelEdit, - select: me.activateButtons, - deselect: me.deactivateButtons + select: me.select + }, + 'ortpanel map': { + featureadded: me.featureadded } }); }, - addFeature: function(button) { - console.log('add feature'); + featureadded: function(record) { + var grid = Ext.ComponentQuery.query('ortpanel ortstammdatengrid')[0]; + if (grid.getCollapsed()) { + grid.expand(); + } + if (!record.get('letzteAenderung')) { + record.data.letzteAenderung = new Date(); + } + grid.store.insert(0, record); + grid.rowEditing.startEdit(0, 1); + }, + + activateDraw: function(button) { + var map = button.up('ortpanel').down('map'); + var record = Ext.create('Lada.model.Ort'); + map.activateDraw(record); }, addRecord: function(button) { - console.log('add record'); + var record = Ext.create('Lada.model.Ort'); + var grid = button.up('ortpanel').down('ortstammdatengrid'); + if (grid.getCollapsed()) { + grid.expand(); + } + if (!record.get('letzteAenderung')) { + record.data.letzteAenderung = new Date(); + } + grid.store.insert(0, record); + grid.rowEditing.startEdit(0, 1); }, deleteItem: function(button) { - console.log('delete item'); + var grid = button.up('ortpanel').down('ortstammdatengrid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + var i18n = Lada.getApplication().bundle; + Ext.MessageBox.confirm(i18n.getMsg('delete'), + i18n.getMsg('confirmation.question'), + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + //DO NOTHING + }, + failure: function(request, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.response.body')); + } + } + }); + } + }); + grid.up('ortpanel').down('button[action=delete]').disable(); + }, + + select: function(rowModel, record) { + this.checkEdit(rowModel, record); + this.buttonToggle(rowModel, record); + }, + + checkEdit: function(rowModel, record) { + if (!Ext.Array.contains(Lada.netzbetreiber, + record.get('netzbetreiberId')) && + record.get('netzbetreiberId') !== '') { + var grid = Ext.ComponentQuery.query('ortpanel ortstammdatengrid')[0]; + grid.rowEditing.cancelEdit(); + return; + } }, /** @@ -51,7 +121,9 @@ var i18n = Lada.getApplication().bundle; context.record.save({ success: function(record, response) { - //Do Nothing + var grid = Ext.ComponentQuery.query('ortstammdatengrid')[0]; + grid.store.reload(); + Ext.StoreManager.get('orte').load(); }, failure: function(record, response) { var json = response.request.scope.reader.jsonData; @@ -80,29 +152,35 @@ } context.grid.getSelectionModel().deselect(context.record); }, - /** - * Toggles the buttons in the toolbar - **/ - activateButtons: function(rowModel, record) { - var panel = rowModel.view.up('ortpanel'); - this.buttonToggle(true, panel); - }, - - /** - * Toggles the buttons in the toolbar - **/ - deactivateButtons: function(rowModel, record) { - var panel = rowModel.view.up('ortpanel'); - // Only disable buttons when nothing is selected - if (rowModel.selected.items == 0) { - this.buttonToggle(false, panel); - } - }, /** * Enables/Disables a set of buttons **/ - buttonToggle: function(enabled, panel) { + buttonToggle: function(rowModel, record) { + if (!Ext.Array.contains(Lada.funktionen, 4)) { + return; + } + var grid = Ext.ComponentQuery.query('ortstammdatengrid')[0]; + if (!record || + !Ext.Array.contains(Lada.netzbetreiber, + record.get('netzbetreiberId'))) { + grid.up('ortpanel').down('button[action=delete]').disable(); + return; + } + if (record.get('readonly') || + rowModel.selected.items.length === 0) { + grid.up('ortpanel').down('button[action=delete]').disable(); + } + else { + if (grid.getPlugin('rowedit').editing) { + //only enable buttons, when grid is not beeing edited + grid.up('ortpanel').down('button[action=delete]').disable(); + } + else { + grid.up('ortpanel').down('button[action=delete]').enable(); + } + } + /* if (!enabled && panel.down('button[action=delete]')) { panel.down('button[action=delete]').disable(); @@ -119,5 +197,6 @@ panel.down('button[action=delete]').disable(); } } + */ } });
--- a/app/controller/form/Ortszuordnung.js Fri May 27 11:09:02 2016 +0200 +++ b/app/controller/form/Ortszuordnung.js Fri May 27 14:52:56 2016 +0200 @@ -66,7 +66,7 @@ formPanel.clearMessages(); formPanel.setRecord(record); formPanel.setMessages(json.errors, json.warnings); - formPanel.up('window').grid.store.reload(); + formPanel.up('window').parentWindow.initData(); } //try to refresh the Grid of the Probe try { @@ -152,7 +152,9 @@ */ dirtyForm: function(form, dirty) { if (dirty) { - form.owner.down('button[action=save]').setDisabled(false); + if (form.getValues().ortId !== '') { + form.owner.down('button[action=save]').setDisabled(false); + } form.owner.down('button[action=discard]').setDisabled(false); } else {
--- a/app/model/Ort.js Fri May 27 11:09:02 2016 +0200 +++ b/app/model/Ort.js Fri May 27 14:52:56 2016 +0200 @@ -49,8 +49,6 @@ }, { name: 'langtext' }, { - name: 'beschreibung' - }, { name: 'unscharf' }, { name: 'hoeheLand' @@ -73,6 +71,9 @@ } return new Date(v); } + }, { + name: 'readonly', + type: 'boolean' }], idProperty: 'id',
--- a/app/view/form/Ortszuordnung.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/form/Ortszuordnung.js Fri May 27 14:52:56 2016 +0200 @@ -81,7 +81,9 @@ }, { xtype: 'tfield', labelWidth: 125, - maxLength: 100, + maxLength: 1, + allowBlank: false, + regex: /[U,E,Z,A]/, name: 'ortszuordnungTyp', fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp') }, { @@ -146,6 +148,9 @@ refreshOrt: function(ortId) { var orteStore = Ext.StoreManager.get('orte'); var ort = orteStore.getById(ortId); + if (!ort) { + return; + } var verwStore = Ext.StoreManager.get('verwaltungseinheiten'); var verw = verwStore.getById(ort.get('gemId')); var staatStore = Ext.StoreManager.get('staaten');
--- a/app/view/grid/DatensatzErzeuger.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/DatensatzErzeuger.js Fri May 27 14:52:56 2016 +0200 @@ -69,7 +69,6 @@ sortable: false, width: 30, getClass: function (val, meta, rec) { - console.log(rec.get('statusEdit')); if (rec.get('readonly') === false) { return 'edit'; }
--- a/app/view/grid/MessprogrammKategorie.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/MessprogrammKategorie.js Fri May 27 14:52:56 2016 +0200 @@ -70,7 +70,6 @@ sortable: false, width: 30, getClass: function (val, meta, rec) { - console.log(rec.get('statusEdit')); if (rec.get('readonly') === false) { return 'edit'; }
--- a/app/view/grid/Messwert.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/Messwert.js Fri May 27 14:52:56 2016 +0200 @@ -117,8 +117,6 @@ editor: { xtype: 'expnumberfield', allowBlank: false, - maxValue: 9.99e+99, - minValue: 1e-99 }, renderer: function(value) { if (!value || value === '') { @@ -176,8 +174,6 @@ width: 80, editor: { xtype: 'expnumberfield', - maxValue: 9.99e+99, - minValue: 1e-99 }, renderer: function(value) { if (!value || value === '') {
--- a/app/view/grid/Orte.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/Orte.js Fri May 27 14:52:56 2016 +0200 @@ -49,41 +49,96 @@ sortable: false, width: 30, getClass: function (val, meta, rec) { - console.log(rec.get('statusEdit')); if (rec.get('readonly') === false) { return 'edit'; } return 'noedit'; } }, { + header: i18n.getMsg('netzbetreiberId'), + renderer: function(value) { + var r = ''; + if (!value || value === '') { + r = 'Error'; + } + var store = Ext.data.StoreManager.get('netzbetreiber'); + var record = store.getById(value); + if (record) { + r = record.get('netzbetreiber'); + } + return r; + }, + editor: { + xtype: 'combobox', + store: Ext.data.StoreManager.get('netzbetreiberFiltered'), + displayField: 'netzbetreiber', + valueField: 'id', + allowBlank: false + }, + dataIndex: 'netzbetreiberId' + }, { header: i18n.getMsg('orte.ortId'), + editor: { + xtype: 'textfield', + allowBlank: false + }, dataIndex: 'ortId' }, { header: i18n.getMsg('orte.nutsCode'), + editor: { + xtype: 'textfield' + }, dataIndex: 'nutsCode' }, { header: i18n.getMsg('orte.anlageId'), + editor: { + xtype: 'numberfield' + }, dataIndex: 'anlageId' }, { header: i18n.getMsg('orte.gemId'), dataIndex: 'gemId', width: 120, renderer: function(value) { + if (!value) { + return ''; + } var store = Ext.data.StoreManager.get('verwaltungseinheiten'); var record = store.getById(value); return record.get('bezeichnung'); + }, + editor: { + xtype: 'combobox', + store: Ext.data.StoreManager.get('verwaltungseinheiten'), + displayField: 'bezeichnung', + valueField: 'id', + allowBlank: false } }, { header: i18n.getMsg('orte.staatId'), dataIndex: 'staatId', width: 70, renderer: function(value) { + if (!value) { + return ''; + } var staaten = Ext.data.StoreManager.get('staaten'); var record = staaten.getById(value); return record.get('staatIso'); + }, + editor: { + xtype: 'combobox', + store: Ext.data.StoreManager.get('staaten'), + displayField: 'staatIso', + valueField: 'id', + allowBlank: false } }, { header: i18n.getMsg('orte.kdaId'), + editor: { + xtype: 'numberfield', + allowBlank: false + }, dataIndex: 'kdaId' }, { header: i18n.getMsg('orte.ozId'), @@ -93,48 +148,90 @@ dataIndex: 'ortTyp' }, { header: i18n.getMsg('orte.mpArt'), + editor: { + xtype: 'textfield' + }, dataIndex: 'mpArt' }, { header: i18n.getMsg('orte.zone'), + editor: { + xtype: 'textfield' + }, dataIndex: 'zone' }, { header: i18n.getMsg('orte.sektor'), + editor: { + xtype: 'textfield' + }, dataIndex: 'sektor' }, { header: i18n.getMsg('orte.zustaendigkeit'), + editor: { + xtype: 'textfield' + }, dataIndex: 'zustaendigkeit' }, { header: i18n.getMsg('orte.berichtstext'), + editor: { + xtype: 'textfield' + }, dataIndex: 'berichtstext' }, { header: i18n.getMsg('orte.kurztext'), + editor: { + xtype: 'textfield', + allowBlank: false + }, dataIndex: 'kurztext' }, { header: i18n.getMsg('orte.langtext'), + editor: { + xtype: 'textfield', + allowBlank: false + }, dataIndex: 'langtext' }, { - header: i18n.getMsg('orte.beschreibung'), - dataIndex: 'beschreibung' - }, { header: i18n.getMsg('orte.unscharf'), + editor: { + xtype: 'textfield' + }, dataIndex: 'unscharf' }, { header: i18n.getMsg('orte.hoeheLand'), + editor: { + xtype: 'numberfield' + }, dataIndex: 'hoeheLand' }, { header: i18n.getMsg('orte.koordXExtern'), + editor: { + xtype: 'textfield', + allowBlank: false + }, dataIndex: 'koordXExtern' }, { header: i18n.getMsg('orte.koordYExtern'), + editor: { + xtype: 'textfield', + allowBlank: false + }, dataIndex: 'koordYExtern' }, { header: i18n.getMsg('orte.longitude'), + editor: { + xtype: 'numberfield' + }, dataIndex: 'longitude' }, { header: i18n.getMsg('orte.latitude'), + editor: { + xtype: 'numberfield' + }, dataIndex: 'latitude' }, { - header: i18n.getMsg('orte.letzteAenderung'), + header: i18n.getMsg('letzteAenderung'), + xtype: 'datecolumn', + format: 'd.m.Y H:i', dataIndex: 'letzteAenderung' }]; this.callParent(arguments); @@ -163,6 +260,12 @@ }]); } } + + if (Ext.Array.contains(Lada.funktionen, 4)) { + var panel = this.up('ortpanel'); + panel.down('button[action=add]').enable(); + panel.down('button[action=addMap]').enable(); + } }, selectOrt: function(map, feature) {
--- a/app/view/grid/Probenehmer.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/Probenehmer.js Fri May 27 14:52:56 2016 +0200 @@ -70,7 +70,6 @@ sortable: false, width: 30, getClass: function (val, meta, rec) { - console.log(rec.get('statusEdit')); if (rec.get('readonly') === false) { return 'edit'; }
--- a/app/view/grid/Probenzusatzwert.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/grid/Probenzusatzwert.js Fri May 27 14:52:56 2016 +0200 @@ -94,8 +94,6 @@ flex: 1, editor: { xtype: 'expnumberfield', - maxValue: 9.99e+99, - minValue: 1e-99 }, renderer: function(value) { if (!value || value === '') { @@ -128,8 +126,6 @@ flex: 1, editor: { xtype: 'expnumberfield', - maxValue: 9.99e+99, - minValue: 1e-99 }, renderer: function(value) { if (!value || value === '') {
--- a/app/view/panel/Map.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/panel/Map.js Fri May 27 14:52:56 2016 +0200 @@ -86,6 +86,9 @@ }, selectFeature: function(model, record) { + if (!record.get('id') || record.get('id') === '') { + return; + } var feature = this.featureLayer.getFeaturesByAttribute('id', record.get('id')); this.map.setCenter( new OpenLayers.LonLat(feature[0].geometry.x, feature[0].geometry.y)); @@ -109,8 +112,9 @@ this.locationRecord.set('latitude', features.feature.geometry.y); this.locationRecord.set('longitude', features.feature.geometry.x); this.drawPoint.deactivate(); - this.selectControl.unselectAll(); - this.selectControl.select(features.feature); + this.fireEvent('featureadded', this.locationRecord); + // this.selectControl.unselectAll(); + // this.selectControl.select(features.feature); }, addLocations: function(locationStore) {
--- a/app/view/widget/base/TextField.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/widget/base/TextField.js Fri May 27 14:52:56 2016 +0200 @@ -28,7 +28,7 @@ enforceMaxLength: this.enforceMaxLength || true, fieldLabel: this.fieldLabel, labelWidth: this.labelWidth, - readOnly: this.readOnly || false, + readOnly: this.readOnly || false, listeners: this.listeners }, { xtype: 'image', @@ -46,6 +46,12 @@ hidden: true }]; this.callParent(arguments); + if (this.regex) { + Ext.apply(this.down('textfield'), {regex: this.regex}); + } + if (this.allowBlank === false) { + Ext.apply(this.down('textfield'), {allowBlank: this.allowBlank}); + } }, showWarnings: function(warnings) {
--- a/app/view/window/MessungEdit.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/window/MessungEdit.js Fri May 27 14:52:56 2016 +0200 @@ -137,7 +137,7 @@ }, success: function(record, response) { var me = this; - if (this.probe.get('treeModified') < record.get('parentModified')) { + if (this.parentWindow.record.get('treeModified') < record.get('parentModified')) { Ext.Msg.show({ title: 'Probe nicht aktuell!', msg: 'Die zugehörige Probe wurde verändert.\n' +
--- a/app/view/window/Ortszuordnung.js Fri May 27 11:09:02 2016 +0200 +++ b/app/view/window/Ortszuordnung.js Fri May 27 14:52:56 2016 +0200 @@ -45,7 +45,7 @@ + ' ' + i18n.getMsg('probe') + ' ' - + this.probe.get('hauptprobennr') + + this.probe.get('hauptprobenNr') + ' ' + i18n.getMsg('edit'); } @@ -57,7 +57,7 @@ + ' ' + i18n.getMsg('probe') + ' ' - + this.probe.get('hauptprobennr') + + this.probe.get('hauptprobenNr') + ' ' + i18n.getMsg('create'); } @@ -88,7 +88,6 @@ margin: 5 }, { xtype: 'ortpanel', - editableGrid: false, flex: 1, toolbarPos: 'bottom', margin: 5 @@ -100,6 +99,13 @@ * Initialise the Data of this Window */ initData: function() { + if (!this.record) { + this.record = Ext.create('Lada.model.Ortszuordnung'); + if (!this.record.get('letzteAenderung')) { + this.record.data.letzteAenderung = new Date(); + } + this.record.set('probeId', this.probe.get('id')); + } this.down('ortszuordnungform').setRecord(this.record); this.down('ortpanel').setStore(); },
--- a/resources/i18n/Lada_de-DE.properties Fri May 27 11:09:02 2016 +0200 +++ b/resources/i18n/Lada_de-DE.properties Fri May 27 14:52:56 2016 +0200 @@ -304,7 +304,6 @@ orte.koordYExtern:Y-Koordinate orte.longitude:Geographische Länge orte.latitude:Geographische Breite -orte.letzteAenderung:Zuletzt geändert ##