# HG changeset patch # User Raimund Renkert # Date 1456837959 -3600 # Node ID 981339d774b88ee5a9c2c793ea3da0e8175dc9b8 # Parent eacf25f071c0e20fc4b267298bed357756c346fd# Parent e0b5e64928c95cdf8baf7379752642dd9621b79d merged stammdatengrids to default. diff -r e0b5e64928c9 -r 981339d774b8 Dockerfile --- a/Dockerfile Tue Mar 01 13:16:10 2016 +0100 +++ b/Dockerfile Tue Mar 01 14:12:39 2016 +0100 @@ -3,14 +3,18 @@ # # Build with e.g. `docker build --force-rm=true -t koala/lada_client .' # Run from the repository root-dir with e.g. -# `docker run --name lada_client -v $PWD:/usr/local/apache2/htdocs/ -# --link lada_wildfly:lada-server -p 8182:80 -d koala/lada_client' +# `docker run --name lada_client +# --link lada_wildfly:lada-server +# -p 8180-8184:80-84 -d koala/lada_client' # # The linked container may be created from the Dockerfile in the lada-server # repository. # # The LADA-application will be available under http://yourdockerhost:8182 # +# Add `-v $PWD:/usr/local/apache2/htdocs/' to the run-command if you want to +# test your local changes (you'll have to run ./install-dependencies.sh again). +# FROM httpd:2.4 MAINTAINER tom.gottfried@intevation.de @@ -31,4 +35,6 @@ RUN ln -sf $PWD/custom-httpd.conf $HTTPD_PREFIX/conf/httpd.conf RUN ln -sf $PWD/custom-vhosts.conf $HTTPD_PREFIX/conf/extra/httpd-vhosts.conf +EXPOSE 80 81 82 83 84 + CMD ["httpd-foreground"] diff -r e0b5e64928c9 -r 981339d774b8 app.js --- a/app.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app.js Tue Mar 01 14:12:39 2016 +0100 @@ -23,6 +23,7 @@ // Setting up translations. This is done using a ext-plgin which can be // found on https://github.com/elmasse/Ext.i18n.Bundle requires: [ + 'Lada.view.Viewport', 'Lada.override.Table', 'Lada.override.RestProxy', 'Lada.override.RowEditor', @@ -30,6 +31,13 @@ 'Lada.override.JSON', 'Ext.i18n.Bundle', 'Ext.layout.container.Column', + 'Lada.store.Deskriptoren', + 'Lada.store.Ortszuordnung', + 'Lada.store.Messungen', + 'Lada.store.Zusatzwerte', + 'Lada.store.Status', + 'Lada.store.Messwerte', + 'Lada.store.MKommentare', 'Lada.store.Datenbasis', 'Lada.store.Messeinheiten', 'Lada.store.Messgroessen', @@ -106,7 +114,6 @@ }, onLoginSuccess: function(response) { - Ext.create('Lada.view.Viewport'); /* Parse Username and Timestamp */ var json = Ext.decode(response.responseText); @@ -114,6 +121,7 @@ Lada.userroles = json.data.roles; Lada.logintime = json.data.servertime; Lada.mst = json.data.mst; //Store Messstellen this user may select + Lada.funktionen = json.data.funktionen; //Lada.serverVersion this.getServerVersion(); @@ -165,6 +173,19 @@ storeId: 'statusstufe', autoLoad: 'true' }); + Ext.create('Lada.store.ProbeQueries', { + storeId: 'probequeries', + autoLoad: 'true' + }); + Ext.create('Lada.store.MessprogrammQueries', { + storeId: 'messprogrammqueries', + autoLoad: 'true' + }); + Ext.create('Lada.store.StammdatenQueries', { + storeId: 'stammdatenqueries', + autoLoad: 'true' + }); + //A Store containing all MST a User is allowed to set. Ext.create('Lada.store.Messstellen', { storeId: 'messstellenFiltered', @@ -175,6 +196,7 @@ return false; } }); + Ext.create('Lada.view.Viewport'); }, getServerVersion: function() { @@ -205,25 +227,23 @@ 'Lada.controller.ModeSwitcher', 'Lada.controller.Map', 'Lada.controller.Ort', + 'Lada.controller.grid.ProbeList', + 'Lada.controller.grid.MessprogrammeList', + 'Lada.controller.grid.Datensatzerzeuger', + 'Lada.controller.grid.Probenehmer', 'Lada.controller.form.Probe', 'Lada.controller.form.Messung', - 'Lada.controller.form.Ortszuordnung', - 'Lada.controller.form.Location', - 'Lada.controller.form.Messprogramm', - 'Lada.controller.grid.Ortszuordnung', 'Lada.controller.grid.Probenzusatzwert', 'Lada.controller.grid.PKommentar', - 'Lada.controller.grid.Messmethode', 'Lada.controller.grid.MKommentar', 'Lada.controller.grid.Messung', 'Lada.controller.grid.Messwert', 'Lada.controller.grid.Status', - //FilterResult - 'Lada.controller.grid.MessprogrammeList', - 'Lada.controller.grid.ProbeList', - //Stammdaten - 'Lada.controller.grid.Datensatzerzeuger', - 'Lada.controller.grid.Probenehmer', - 'Lada.controller.grid.MessprogrammKategorie' + 'Lada.controller.grid.Ortszuordnung', + 'Lada.controller.form.Ortszuordnung', + 'Lada.controller.form.Location', + 'Lada.controller.form.Messprogramm', + 'Lada.controller.grid.Messmethode', + 'Lada.controller.FilterManagement' ] }); diff -r e0b5e64928c9 -r 981339d774b8 app/controller/Filter.js --- a/app/controller/Filter.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/Filter.js Tue Mar 01 14:12:39 2016 +0100 @@ -15,6 +15,9 @@ requires: [ 'Lada.view.widget.Messstelle', + 'Lada.view.grid.MessprogrammeList', + 'Lada.view.grid.ProbeList', + 'Lada.view.window.FilterManagement', 'Lada.view.widget.Umwelt' ], @@ -25,6 +28,10 @@ displayFields: null, + managementWindow: null, + + mode: 'proben', + /** * Initialize this Controller * It has 4 Listeners @@ -33,18 +40,33 @@ this.control({ // CSS like selector to select element in the viewport. See // ComponentQuery documentation for more details. - 'combobox[name=filter]': { + 'filterpanel combobox[name=filter]': { // Map Select event select: this.selectSql }, - 'button[action=search]': { + 'filterpanel button[action=search]': { // Map click event on Button. click: this.search }, - 'button[action=reset]': { + 'filterpanel button[action=reset]': { // Map click event on Button. click: this.reset }, + 'filterpanel button[action=details]': { + click: this.showDetails + }, + 'filterpanel button[action=manage]': { + click: this.showManagement + }, + 'filterpanel checkbox[name=favorites]': { + change: this.triggerFilterUpdate + }, + 'filterpanel button[action=savedefault]': { + click: this.saveFilterDefaults + }, + 'filterpanel button[action=resetdefault]': { + click: this.resetFilterDefaults + }, 'menuitem[action=about]': { // Map click event on Button. click: this.about @@ -63,10 +85,15 @@ * vary between orte, kategorien, ... */ selectSql: function(element, record) { - var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); + var filters = element.up('panel[name=main]').down('panel[name=filtervariables]'); + var filterValues = element.up('panel[name=main]').down('panel[name=filtervalues]'); + var desc = element.up('fieldset').down('displayfield[name=description]'); + if (!record[0]) { + desc.setValue(''); + return; + } // Set "Filter Auswahl" Description - var desc = element.up('fieldset').down('displayfield[name=description]'); desc.setValue(record[0].data.description); this.displayFields = record[0].data.results; @@ -74,19 +101,13 @@ var contentPanel = element.up('panel[name=main]').down('panel[name=contentpanel]'); var queryType = record[0].get('type'); //The type of the query, might be proben, messprogramme, // or a stammdatendtype + var details = element.up('panel[name=main]').down('filterdetails'); + details.setRecord(record[0]); this.reset(element); contentPanel.removeAll(); //clear the panel: make space for new grids - // Set "Filter Auswahl" Columns - var columns = element.up('fieldset').down('displayfield[name=columns]'); - var columnString = []; - for (var i = 0; i < this.displayFields.length; i++) { - columnString.push(this.displayFields[i].header); - } - columns.setValue(columnString.join(', ')); - // Setup Columns if (this.displayFields) { this.displayFields.reverse(); @@ -155,7 +176,7 @@ * * 1. Empty filters */ - filters.removeAll(); + filterValues.removeAll(); var hide = true; /* 2. Iterate over all configured filters */ var j; @@ -164,25 +185,33 @@ var name = filterFields[j].dataIndex; var label = filterFields[j].label; var multi = filterFields[j].multiSelect; + var filterId = filterFields[j].id; var field = null; + var value = filterFields[j].value; if (type === 'text') { field = Ext.create('Ext.form.field.Text', { name: name, - fieldLabel: label + fieldLabel: label, + filterId: filterId, + value: value }); } else if (type === 'number') { field = Ext.create('Ext.form.field.Number', { name: name, labelWidth: 135, - fieldLabel: label + fieldLabel: label, + filterId: filterId, + value: value }); } else if (type === 'datetime') { field = Ext.create('Lada.view.widget.Datetime', { name: name, labelWidth: 135, - fieldLabel: label + fieldLabel: label, + filterId: filterId, + value: value }); } else if (type === 'bool') { @@ -190,6 +219,8 @@ name: name, labelWidth: 135, fieldLabel: label, + value: value, + filterId: filterId, emptyText: '' }); } @@ -198,7 +229,9 @@ name: name, labelWidth: 135, fieldLabel: label, - multiSelect: multi + multiSelect: multi, + filterId: filterId, + value: value }); } else if (type === 'listumw') { @@ -206,6 +239,8 @@ name: name, labelWidth: 135, fieldLabel: label, + value: value, + filterId: filterId, multiSelect: multi, displayTpl: Ext.create('Ext.XTemplate', '{id} ') @@ -216,6 +251,8 @@ name: name, labelWidth: 135, fieldLabel: label, + value: value, + filterId: filterId, multiSelect: multi }); } @@ -224,6 +261,8 @@ name: name, labelWidth: 135, fieldLabel: label, + value: value, + filterId: filterId, multiSelect: multi }); } @@ -232,11 +271,13 @@ name: name, labelWidth: 135, fieldLabel: label, + value: value, + filterId: filterId, multiSelect: multi }); } if (field) { - filters.add(field); + filterValues.add(field); filters.show(); hide = false; } @@ -253,11 +294,14 @@ */ search: function(element) { var resultGrid = element.up('panel[name=main]').down('panel[name=contentpanel]').down('grid'); - var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); + var filters = element.up('panel[name=main]').down('panel[name=filtervalues]'); var search = element.up('fieldset').down('combobox[name=filter]'); + if (!search.getValue()) { + return; + } //Type of the search Proben/Messprogramme/Stammdaten - var type = search.store.getById(search.getValue()).get('type') + var type = search.store.getById(search.getValue()).get('type'); // Get search parameters: var searchParams = {}; @@ -343,14 +387,18 @@ * This function resets the filters */ reset: function(element) { - var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); + var filters = element.up('panel[name=main]').down('panel[name=filtervalues]'); + var search = element.up('fieldset').down('combobox[name=filter]'); + + //Type of the search Proben/Messprogramme/Stammdaten + var qId = search.getValue(); + var query = search.store.getById(qId); for (var i = filters.items.length - 1; i >= 0; i--) { var filter = filters.items.items[i]; - if (filter.clearValue) { - filter.clearValue(); - } - else { - filter.setValue(''); + for (var j = 0; j < query.data.filters.length; j++) { + if (filter.filterId === query.data.filters[j].id) { + filter.setValue(query.data.filters[j].value); + } } } }, @@ -361,5 +409,165 @@ about: function() { var win = Ext.create('Lada.view.window.About'); win.show(); + }, + + showDetails: function(element) { + var search = element.up('fieldset').down('combobox[name=filter]'); + var details = element.up('panel[name=main]').down('filterdetails'); + + //Type of the search Proben/Messprogramme/Stammdaten + var record = search.store.getById(search.getValue()); + details.setRecord(record); + if (element.pressed) { + details.show(); + } + else { + details.hide(); + } + }, + + showManagement: function() { + if (!this.managementWindow) { + this.managementWindow = Ext.create('Lada.view.window.FilterManagement'); + } + this.managementWindow.show(); + }, + + triggerFilterUpdate: function(checkbox) { + var cbox = checkbox.up('fieldset').down('combobox[name=filter]'); + this.updateFilter(cbox); + }, + + updateFilter: function(combobox) { + var store; + var entries; + var fav = combobox.up('fieldset').down('checkbox[name=favorites]'); + if (this.mode === 'proben') { + store = Ext.StoreManager.get('probequeries'); + } + else if (this.mode === 'messprogramme') { + store = Ext.StoreManager.get('messprogrammqueries'); + } + else if (this.mode === 'stammdaten') { + store = Ext.StoreManager.get('stammdatenqueries'); + } + else { + return; + } + var allEntries = store.queryBy(function() { + return true; + }); + var favorites = store.queryBy(function(record) { + if (record.get('favorite')) { + return true; + } + }); + combobox.store.removeAll(); + if (fav.checked && favorites.getCount() > 0) { + combobox.store.add(favorites.items); + } + else { + combobox.store.add(allEntries.items); + if (favorites.getCount() === 0) { + fav.setValue(false); + fav.disable(); + } + else { + fav.enable(); + } + } + combobox.select(combobox.store.getAt(0)); + combobox.fireEvent('select', combobox, [combobox.store.getAt(0)]); + }, + + saveFilterDefaults: function(button) { + var filters = button.up('fieldset').down('panel[name=filtervalues]'); + + var search = button.up('fieldset').down('combobox[name=filter]'); + + //Type of the search Proben/Messprogramme/Stammdaten + var qId = search.getValue(); + var query = search.store.getById(qId); + var ndx = 0; + for (var i = filters.items.items.length - 1; i >= 0; i--) { + var filter = filters.items.items[i]; + var filterId = filter.filterId; + var value = filter.getValue(); + if (value instanceof Array) { + value = value.join(','); + } + Ext.Ajax.request({ + url: 'lada-server/rest/filter', + method: 'PUT', + jsonData: { + id: filterId, + value: value + }, + success: function() { + ndx++; + for (var j = 0; j < query.data.filters.length; i++) { + if (query.data.filters[j].id === filterId) { + query.data.filters[j].value = value; + break; + } + } + if (ndx < filters.items.items.length - 1) { + return; + } + if (query.get('type') === 'probe') { + Ext.StoreManager.get('probequeries').load(); + } + else if (query.get('type') === 'messprogramm') { + Ext.StoreManager.get('messprogrammqueries').load(); + } + else { + Ext.StoreManager.get('stammdatenqueries').load(); + } + } + }); + } + }, + + resetFilterDefaults: function(button) { + var filters = button.up('fieldset').down('panel[name=filtervalues]'); + + var search = button.up('fieldset').down('combobox[name=filter]'); + + var qId = search.getValue(); + var query = search.store.getById(qId); + for (var i = filters.items.length - 1; i >= 0; i--) { + var filter = filters.items.items[i]; + var filterId = filter.filterId; + var value = filter.getValue(); + if (value instanceof Array) { + value = value.join(','); + } + Ext.Ajax.request({ + url: 'lada-server/rest/filter/' + filterId, + method: 'DELETE', + success: function(response) { + var json = Ext.decode(response.responseText); + if (!json.success) { + return; + } + filter.setValue(json.data.value); + for (var j = 0; j < query.data.filters.length; j++) { + if (query.data.filters[j].id === json.data.id) { + query.data.filters[j].value = json.data.value; + break; + } + } + if (query.get('type') === 'probe') { + Ext.StoreManager.get('probequeries').reload(); + } + else if (query.get('type') === 'messprogramm') { + Ext.StoreManager.get('messprogrammqueries').reload(); + } + else { + Ext.StoreManager.get('stammdatenqueries').reload(); + } + } + }); + } } }); diff -r e0b5e64928c9 -r 981339d774b8 app/controller/FilterManagement.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/FilterManagement.js Tue Mar 01 14:12:39 2016 +0100 @@ -0,0 +1,61 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * + */ +Ext.define('Lada.controller.FilterManagement', { + extend: 'Ext.app.Controller', + + /** + * @private + * Initialize the controller. + */ + init: function() { + var me = this; + this.control({ + 'filtermanagement grid favcolumn': { + checkchange: me.checkchange + }, + 'filtermanagement': { + close: me.windowClosed + } + }); + }, + + checkchange: function(column, ndx, value) { + var store = column.up('grid').store; + var record = store.getAt(ndx); + if (value) { + Ext.Ajax.request({ + url: 'lada-server/rest/favorite', + method: 'POST', + jsonData: { + 'queryId': record.get('id') + }, + success: function() { + record.set('favorite', true); + } + }); + } + else { + Ext.Ajax.request({ + url: 'lada-server/rest/favorite?queryId=' + record.get('id'), + method: 'DELETE', + success: function() { + record.set('favorite', false); + } + }); + } + }, + + windowClosed: function() { + var combobox = Ext.ComponentQuery.query('combobox[name=filter]')[0]; + this.getController('Lada.controller.Filter').updateFilter(combobox); + } +}); diff -r e0b5e64928c9 -r 981339d774b8 app/controller/ModeSwitcher.js --- a/app/controller/ModeSwitcher.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/ModeSwitcher.js Tue Mar 01 14:12:39 2016 +0100 @@ -42,52 +42,13 @@ */ switchModes: function(field) { var cbox = field.up('modeswitcher').up().down('combobox'); - filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]'); - filters.removeAll(); + var filterValues = field.up('panel[name=main]').down('panel[name=filtervalues]'); + var filters = field.up('panel[name=main]').down('panel[name=filtervariables]'); + filterValues.removeAll(); filters.hide(); - //Initialise variables which will define the querystore - // and the store which has to be loaded into the grid. - var querystorename = ''; - - // In dependence of the checkboxes input value, - // define the store of the filter. - // app/controller/Filter.js contains similar code. - if (field.inputValue === 'messprogramme' && cbox) { - querystorename = 'Lada.store.MessprogrammQueries'; - } - else if (field.inputValue === 'proben' && cbox) { - querystorename = 'Lada.store.ProbeQueries'; - } - else if (field.inputValue === 'stammdaten' && cbox) { - querystorename = 'Lada.store.StammdatenQueries'; - } - - if (querystorename) { - var store = Ext.StoreManager.lookup(querystorename); - - if (!store) { - store = Ext.create(querystorename, { - //Select first Item on Load - listeners: { - load: function(store){ - var records = new Array(); - records.push(store.getAt(0)); - - cbox.select(records[0]); - cbox.fireEvent('select', cbox, records); - } - } - }); - } - - if (store) { - if (!store.autoLoad) { - store.load(); - } - //cbox.reset(); - cbox.bindStore(store); - } - } + var filterController = this.getController('Lada.controller.Filter'); + filterController.mode = field.inputValue; + filterController.updateFilter(cbox); } }); diff -r e0b5e64928c9 -r 981339d774b8 app/controller/Ort.js --- a/app/controller/Ort.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/Ort.js Tue Mar 01 14:12:39 2016 +0100 @@ -115,7 +115,7 @@ panel.down('button[action=delete]').enable(); } //else turn them off again! - else { + else if (panel.down('button[action=delete]')) { panel.down('button[action=delete]').disable(); } } diff -r e0b5e64928c9 -r 981339d774b8 app/controller/grid/Datensatzerzeuger.js --- a/app/controller/grid/Datensatzerzeuger.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/grid/Datensatzerzeuger.js Tue Mar 01 14:12:39 2016 +0100 @@ -21,8 +21,9 @@ 'datensatzerzeugergrid': { edit: this.gridSave, canceledit: this.cancelEdit, - select: this.activateButtons, - deselect: this.deactivateButtons + select: this.buttonToggle, + deselect: this.buttonToggle, + itemdblclick: this.edit }, 'datensatzerzeugergrid button[action=add]': { click: this.add @@ -33,6 +34,11 @@ }); }, + edit: function() { + var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[0]; + grid.down('button[action=delete]').disable(); + }, + /** * This function is called when the grids roweditor saves * the record. @@ -69,8 +75,11 @@ if (!context.record.get('id') || context.record.get('id') === '') { editor.getCmp().store.remove(context.record); + this.buttonToggle(); } - context.grid.getSelectionModel().deselect(context.record); + else { + this.buttonToggle(context.grid.getSelectionModel(), context.record); + } }, /** @@ -122,42 +131,30 @@ }); grid.down('button[action=delete]').disable(); }, - /** - * Toggles the buttons in the toolbar - **/ - activateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - this.buttonToggle(true, grid); - }, - - /** - * Toggles the buttons in the toolbar - **/ - deactivateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - // Only disable buttons when nothing is selected - if (rowModel.selected.items == 0) { - this.buttonToggle(false, grid); - } - }, /** * Enables/Disables a set of buttons **/ - buttonToggle: function(enabled, grid) { - if (!enabled) { + buttonToggle: function(rowModel, record) { + if (!Ext.Array.contains(Lada.funktionen, 4)) { + return; + } + var grid = Ext.ComponentQuery.query('datensatzerzeugergrid')[0]; + if (!record) { + grid.down('button[action=delete]').disable(); + } + if (record.get('readonly') || + rowModel.selected.items.length === 0) { grid.down('button[action=delete]').disable(); } else { - if (!grid.getPlugin('rowedit').editing) { + if (grid.getPlugin('rowedit').editing) { //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').disable(); + } + else { grid.down('button[action=delete]').enable(); } - //else turn them off again! - else { - this.buttonToggle(false, grid); - } } } }); - diff -r e0b5e64928c9 -r 981339d774b8 app/controller/grid/MessprogrammKategorie.js --- a/app/controller/grid/MessprogrammKategorie.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/grid/MessprogrammKategorie.js Tue Mar 01 14:12:39 2016 +0100 @@ -21,8 +21,9 @@ 'messprogrammkategoriegrid': { edit: this.gridSave, canceledit: this.cancelEdit, - select: this.activateButtons, - deselect: this.deactivateButtons + select: this.buttonToggle, + deselect: this.buttonToggle, + itemdblclick: this.edit }, 'messprogrammkategoriegrid button[action=add]': { click: this.add @@ -33,6 +34,11 @@ }); }, + edit: function() { + var grid = Ext.ComponentQuery.query('messprogrammkategoriegrid')[0]; + grid.down('button[action=delete]').disable(); + }, + /** * This function is called when the grids roweditor saves * the record. @@ -121,43 +127,32 @@ }); grid.down('button[action=delete]').disable(); }, - /** - * Toggles the buttons in the toolbar - **/ - activateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - this.buttonToggle(true, grid); - }, - - /** - * Toggles the buttons in the toolbar - **/ - deactivateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - // Only disable buttons when nothing is selected - if (rowModel.selected.items == 0) { - this.buttonToggle(false, grid); - } - }, /** * Enables/Disables a set of buttons **/ - buttonToggle: function(enabled, grid) { - if (!enabled) { + buttonToggle: function(rowModel, record) { + if (!Ext.Array.contains(Lada.funktionen, 4)) { + return; + } + var grid = Ext.ComponentQuery.query('messprogrammkategoriegrid')[0]; + if (!record) { + grid.down('button[action=delete]').disable(); + } + if (record.get('readonly') || + rowModel.selected.items.length === 0) { grid.down('button[action=delete]').disable(); } else { - if (!grid.getPlugin('rowedit').editing) { + if (grid.getPlugin('rowedit').editing) { //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').disable(); + } + else { grid.down('button[action=delete]').enable(); } - //else turn them off again! - else { - this.buttonToggle(false, grid); - } } - }, + } }); diff -r e0b5e64928c9 -r 981339d774b8 app/controller/grid/Ortszuordnung.js --- a/app/controller/grid/Ortszuordnung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/grid/Ortszuordnung.js Tue Mar 01 14:12:39 2016 +0100 @@ -13,7 +13,7 @@ extend: 'Ext.app.Controller', requires: [ - 'Lada.view.window.Ortszuordnung', + 'Lada.view.window.Ortszuordnung' ], /** diff -r e0b5e64928c9 -r 981339d774b8 app/controller/grid/Probenehmer.js --- a/app/controller/grid/Probenehmer.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/grid/Probenehmer.js Tue Mar 01 14:12:39 2016 +0100 @@ -21,8 +21,9 @@ 'probenehmergrid': { edit: this.gridSave, canceledit: this.cancelEdit, - select: this.activateButtons, - deselect: this.deactivateButtons + select: this.buttonToggle, + deselect: this.buttonToggle, + itemdblclick: this.edit }, 'probenehmergrid button[action=add]': { click: this.add @@ -33,6 +34,11 @@ }); }, + edit: function() { + var grid = Ext.ComponentQuery.query('probenehmergrid')[0]; + grid.down('button[action=delete]').disable(); + }, + /** * This function is called when the grids roweditor saves * the record. @@ -69,8 +75,11 @@ if (!context.record.get('id') || context.record.get('id') === '') { editor.getCmp().store.remove(context.record); + this.buttonToggle(); } - context.grid.getSelectionModel().deselect(context.record); + else { + this.buttonToggle(context.grid.getSelectionModel(), context.record); + } }, /** @@ -121,42 +130,30 @@ }); grid.down('button[action=delete]').disable(); }, - /** - * Toggles the buttons in the toolbar - **/ - activateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - this.buttonToggle(true, grid); - }, - - /** - * Toggles the buttons in the toolbar - **/ - deactivateButtons: function(rowModel, record) { - var grid = rowModel.view.up('grid'); - // Only disable buttons when nothing is selected - if (rowModel.selected.items == 0) { - this.buttonToggle(false, grid); - } - }, /** * Enables/Disables a set of buttons **/ - buttonToggle: function(enabled, grid) { - if (!enabled) { + buttonToggle: function(rowModel, record) { + if (!Ext.Array.contains(Lada.funktionen, 4)) { + return; + } + var grid = Ext.ComponentQuery.query('probenehmergrid')[0]; + if (!record) { + grid.down('button[action=delete]').disable(); + } + if (record.get('readonly') || + rowModel.selected.items.length === 0) { grid.down('button[action=delete]').disable(); } else { - if (!grid.getPlugin('rowedit').editing) { + if (grid.getPlugin('rowedit').editing) { //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').disable(); + } + else { grid.down('button[action=delete]').enable(); } - //else turn them off again! - else { - this.buttonToggle(false, grid); - } } - }, + } }); - diff -r e0b5e64928c9 -r 981339d774b8 app/controller/grid/Status.js --- a/app/controller/grid/Status.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/controller/grid/Status.js Tue Mar 01 14:12:39 2016 +0100 @@ -21,10 +21,12 @@ 'statusgrid': { edit: this.gridSave, canceledit: this.cancelEdit, - select: this.toggleAllowedPermissions }, 'statusgrid button[action=add]': { click: this.add + }, + 'statusgrid button[action=reset]': { + click: this.reset } }); }, @@ -39,7 +41,26 @@ gridSave: function(editor, context) { context.record.set('sdatum', new Date()); context.record.save({ - success: function() { + success: function(response) { + var i18n = Lada.getApplication().bundle; + var json = Ext.JSON.decode(response.responseText); + + if(json) { + if (!json.success) { + if(json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + context.grid.initData(); var win = context.grid.up('window'); win.initData(); @@ -51,19 +72,20 @@ } }, failure: function(request, response) { + var i18n = Lada.getApplication().bundle; var json = response.request.scope.reader.jsonData; if (json) { if (json.message){ - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') + Ext.Msg.alert(i18n.getMsg('err.msg.save.title') +' #'+json.message, - Lada.getApplication().bundle.getMsg(json.message)); + i18n.getMsg(json.message)); } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), - Lada.getApplication().bundle.getMsg('err.msg.generic.body')); + Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), + i18n.getMsg('err.msg.generic.body')); } } else { - Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), - Lada.getApplication().bundle.getMsg('err.msg.response.body')); + Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), + i18n.getMsg('err.msg.response.body')); } } }); @@ -82,39 +104,131 @@ /** * This function adds a new row to add a Status + * and copies the data of the previous status into the new one + * if possible. */ add: function(button) { - var record = Ext.create('Lada.model.Status', { - messungsId: button.up('statusgrid').recordId - }); + var lastrow = button.up('statusgrid').store.count() + + // retrive current status from the messung. + var s = button.up('window').down('messungform').getRecord().get('status'); + var recentStatus = button.up('statusgrid').store.getById(s); + + button.up('statusgrid').statusWerteStore.reload(); + + //If possible copy the previous record into the new one. + //this assumes the store is ordered correctly, most recent status last. + // Do not copy, if current userid differs from the id of the current status + if (lastrow > 0 && + Ext.Array.contains(Lada.mst, recentStatus.get('erzeuger'))) { + + if (recentStatus) { + // clone the status + var record = recentStatus.copy() + } + + record.set('id', null); + if (record.get('statusWert') === 0) { + record.set('statusWert', ''); + } + } else { + //create a new one + var record = Ext.create('Lada.model.Status', { + messungsId: button.up('statusgrid').recordId + }); + if (Ext.data.StoreManager.get('messstellenFiltered').count() === 1) { + record.set('erzeuger', Ext.data.StoreManager.get('messstellenFiltered').getAt(0).get('id')); + } + } + //Set the Date - record.data.datum = new Date(); - var lastrow = button.up('statusgrid').store.count() + record.set('datum', new Date()); + button.up('statusgrid').store.insert(lastrow, record); - button.up('statusgrid').rowEditing.startEdit(lastrow, 1); + button.up('statusgrid').getPlugin('rowedit').startEdit(lastrow, 1); }, - /** - * When a row in a grid is selected, - * this function checks if the row may be edited, - * or if the row can be removed - */ - toggleAllowedPermissions: function(context, record, index){ - - //retrieve the readOnly parameters - var statusEdit = context.view.up('window').record.get('statusEdit'); + * Reset + * This Function instructs the server to reset the current status + * WIP / TODO + * + **/ + reset: function(button) { + var me = this; + var rstbutton = button; + var i18n = Lada.getApplication().bundle; + Ext.MessageBox.confirm( + i18n.getMsg('statusgrid.reset.mbox.title'), + i18n.getMsg('statusgrid.reset.mbox.text'), + function(btn) { + if (btn === 'yes') { + me.doReset(rstbutton); + } + }); + }, - var grid = context.view.up('grid'); - - //retrieve the last record of the store - var lastRecord = context.getStore().last(); + doReset: function(button) { + var i18n = Lada.getApplication().bundle; - //Check if edit is allowed - if (lastRecord != record || - statusEdit === false) { - grid.getPlugin('rowedit').cancelEdit(); + var resetStatusValue = 8; + + var s = button.up('window').down('messungform').getRecord().get('status'); + var messId = button.up('window').down('messungform').getRecord().get('id'); + var recentStatus = button.up('statusgrid').store.getById(s); + + //Set Status to 'Resetted' (8) + if (recentStatus) { + var record = recentStatus.copy(); + record.set('datum', new Date()); + record.set('statusWert', resetStatusValue); + record.set('id', null); + record.set('text', i18n.getMsg('statusgrid.resetText')); } - } + + Ext.Ajax.request({ + url: 'lada-server/rest/status', + jsonData: record.getData(), + method: 'POST', + success: function(response) { + var i18n = Lada.getApplication().bundle; + var json = Ext.JSON.decode(response.responseText); + + if(json) { + if (!json.success) { + if(json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + } + + button.up('window').initData(); + button.up('grid').initData(); + }, + failure: function(response) { + // TODO sophisticated error handling, with understandable Texts + var i18n = Lada.getApplication().bundle; + var json = Ext.JSON.decode(response.responseText); + if (json) { + if(json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + }); + } }); diff -r e0b5e64928c9 -r 981339d774b8 app/model/DatensatzErzeuger.js --- a/app/model/DatensatzErzeuger.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/DatensatzErzeuger.js Tue Mar 01 14:12:39 2016 +0100 @@ -31,24 +31,9 @@ } return new Date(v); } -/* }, { - name: 'treeModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } - }, { - name: 'parentModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } -*/ + name: 'readonly', + type: 'boolean' }], idProperty: 'id', diff -r e0b5e64928c9 -r 981339d774b8 app/model/MessprogrammKategorie.js --- a/app/model/MessprogrammKategorie.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/MessprogrammKategorie.js Tue Mar 01 14:12:39 2016 +0100 @@ -29,24 +29,9 @@ } return new Date(v); } -/* }, { - name: 'treeModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } - }, { - name: 'parentModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } -*/ + name: 'readonly', + type: 'boolean' }], idProperty: 'id', diff -r e0b5e64928c9 -r 981339d774b8 app/model/Messung.js --- a/app/model/Messung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/Messung.js Tue Mar 01 14:12:39 2016 +0100 @@ -76,6 +76,15 @@ } return value; } + }, { + name: 'statusWert', + persist: false + }, { + name: 'messwerteCount', + persist: false + }, { + name: 'kommentarCount', + persist: false }], idProperty: 'id', diff -r e0b5e64928c9 -r 981339d774b8 app/model/Messwert.js --- a/app/model/Messwert.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/Messwert.js Tue Mar 01 14:12:39 2016 +0100 @@ -29,7 +29,14 @@ name: 'messwert', type: 'float' }, { - name: 'messwertNwg' + name: 'messwertNwg', + convert: function(v) { + if (!v) { + return null; + } + return "<"; + }, +// defaultValue: null }, { name: 'messfehler', type: 'float' diff -r e0b5e64928c9 -r 981339d774b8 app/model/Probenehmer.js --- a/app/model/Probenehmer.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/Probenehmer.js Tue Mar 01 14:12:39 2016 +0100 @@ -47,24 +47,9 @@ } return new Date(v); } -/* }, { - name: 'treeModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } - }, { - name: 'parentModified', - serialize: function(value) { - if (value === '') { - return null; - } - return value; - } -*/ + name: 'readonly', + type: 'boolean' }], idProperty: 'id', diff -r e0b5e64928c9 -r 981339d774b8 app/model/Query.js --- a/app/model/Query.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/Query.js Tue Mar 01 14:12:39 2016 +0100 @@ -19,6 +19,8 @@ }, { name: 'description' }, { + name: 'favorite' + }, { name: 'sql' }, { name: 'results' diff -r e0b5e64928c9 -r 981339d774b8 app/model/Status.js --- a/app/model/Status.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/model/Status.js Tue Mar 01 14:12:39 2016 +0100 @@ -27,12 +27,9 @@ name: 'erzeuger' }, { name: 'statusStufe', - type: 'int', - defaultValue: 1 + type: 'int' }, { - name: 'statusWert', - type: 'int', - defaultValue: 0 + name: 'statusWert' }, { name: 'treeModified', serialize: function(value) { diff -r e0b5e64928c9 -r 981339d774b8 app/store/ProbeQueries.js --- a/app/store/ProbeQueries.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/store/ProbeQueries.js Tue Mar 01 14:12:39 2016 +0100 @@ -12,7 +12,7 @@ Ext.define('Lada.store.ProbeQueries', { extend: 'Ext.data.Store', model: 'Lada.model.Query', - autoLoad: true, +// autoLoad: true, proxy: { type: 'rest', url: 'lada-server/rest/query/probe', diff -r e0b5e64928c9 -r 981339d774b8 app/view/FilterPanel.js --- a/app/view/FilterPanel.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/FilterPanel.js Tue Mar 01 14:12:39 2016 +0100 @@ -17,7 +17,7 @@ 'Ext.layout.container.Column' ], - title: 'Filter-Auswahl', + title: 'Filter', initComponent: function() { this.layout = { type: 'vbox', @@ -25,28 +25,69 @@ }; var me = this; this.items = [{ - xtype: 'combobox', - name: 'filter', - editable: false, - store: Ext.create('Lada.store.ProbeQueries',{ - listeners: { - load: function(s){ - var records = new Array(); - records.push(s.getAt(0)); - - var combo = me.down('combobox[name=filter]'); - combo.select(records[0]); - combo.fireEvent('select', combo, records); - } - } - }), - displayField: 'name', - valueField: 'id', - emptyText: 'Wählen Sie eine Abfrage' + layout: 'hbox', + border: false, + items: [{ + xtype: 'combobox', + name: 'filter', + editable: false, + flex: 1, + displayField: 'name', + valueField: 'id', + queryMode: 'local', + emptyText: 'Wählen Sie eine Abfrage' + }, { + xtype: 'button', + action: 'details', + enableToggle: true, + text: 'Details', + margin: '0 0 0 10' + }] + }, { + xtype: 'checkbox', + name: 'favorites', + boxLabel: 'nur Favoriten', + margin: '0, 0, 0, 5', + checked: true + }, { + xtype: 'displayfield', + name: 'description', + shrinkWrap: 3, + margin: '0, 0, 0 ,5', + value: '-/-' }, { xtype: 'panel', border: false, - margin: '0 0 10 0', + name: 'filtervariables', + hidden: true, + margin: '10, 0, 10, 0', + items: [{ + xtype: 'panel', + border: false, + name: 'filtervalues', + items: [] + }, { + + layout: { + type: 'hbox', + pack: 'end' + }, + border: false, + items: [{ + xtype: 'button', + action: 'savedefault', + text: 'Vorbelegung speichern', + margin: '0, 10, 0, 0' + }, { + xtype: 'button', + action: 'resetdefault', + text: 'Vorbelegung löschen' + }] + }] + }, { + xtype: 'panel', + border: false, + margin: '10 0 10 0', items: [{ xtype: 'button', action: 'search', @@ -55,27 +96,35 @@ }, { xtype: 'button', action: 'reset', - text: 'Zurücksetzen' + text: 'Zurücksetzen', + margin: '0 10 0 0' + }, { + xtype: 'button', + action: 'manage', + text: 'Filterauswahl bearbeiten' }], hidden: false - }, { - xtype: 'panel', - maxWidth: '500', - border: false, - margin: '0 10', - items: [{ - xtype: 'displayfield', - name: 'description', - fieldLabel: 'Beschreibung', - shrinkWrap: 3, - value: '-/-' - }, { - xtype: 'displayfield', - name: 'columns', - fieldLabel: 'Spalten', - value: '-/-' - }] }]; this.callParent(arguments); + var combo = me.down('combobox[name=filter]'); + combo.store = Ext.create('Ext.data.Store', { + model: 'Lada.model.Query' + }); + var store = Ext.StoreManager.get('probequeries'); + store.on('load', function storeLoad () { + var entries = store.queryBy(function(record) { + if (record.get('favorite')) { + return true; + } + }); + if (entries.getCount() === 0) { + var cb = me.down('checkbox[name=favorites]'); + cb.setValue(false); + } + combo.store.add(entries.items); + combo.select(combo.store.getAt(0)); + combo.fireEvent('select', combo, [combo.store.getAt(0)]); + store.un('load', storeLoad); + }); } }); diff -r e0b5e64928c9 -r 981339d774b8 app/view/Viewport.js --- a/app/view/Viewport.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/Viewport.js Tue Mar 01 14:12:39 2016 +0100 @@ -17,7 +17,8 @@ extend: 'Ext.container.Viewport', requires: [ 'Lada.view.ModeSwitcher', - 'Lada.view.FilterPanel' + 'Lada.view.FilterPanel', + 'Lada.view.panel.FilterDetails' ], layout: 'fit', initComponent: function() { @@ -66,12 +67,11 @@ margin: '0, 10, 0, 10' }, { // Variables settings for the current selected sql statement. - xtype: 'fieldset', - name: 'filtervariables', - title: 'Variablenbelegung', + xtype: 'filterdetails', + name: 'filterdetails', + title: i18n.getMsg('filterdetails.title'), hidden: true, - margin: '0, 10, 0, 10', - items: [] + margin: '0, 10, 0, 10' }] }, { xtype: 'panel', diff -r e0b5e64928c9 -r 981339d774b8 app/view/form/Messung.js --- a/app/view/form/Messung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/form/Messung.js Tue Mar 01 14:12:39 2016 +0100 @@ -170,6 +170,7 @@ var i18n = Lada.getApplication().bundle; var msg = i18n.getMsg('load.statuswert'); var textfield = this.down('[name=status]'); + var messwin = this.up('window'); if(textfield) { textfield.setRawValue(msg); @@ -181,7 +182,7 @@ messungsId: messungsId }, callback: function(records, operation, success) { - var sw, ss; + var sw, ss, se; var i18n = Lada.getApplication().bundle; if (sStore.getTotalCount() === 0 || !statusId) { sw = 0; @@ -189,9 +190,23 @@ else { sw = sStore.getById(statusId).get('statusWert'); ss = sStore.getById(statusId).get('statusStufe'); + se = sStore.getById(statusId).get('erzeuger'); } this.setStatusWert(sw); this.setStatusStufe(ss); + + // Enable / Disable the statusreset button of the statusgrid of the messungwindow + if (messwin.record.get('statusEdit') === true && + sw != 0 && + sw != 4 && + Ext.Array.contains(Lada.mst, se)) { + + messwin.enableStatusReset(); + } + else { + messwin.disableStatusReset(); + } + }, scope: this }); @@ -325,9 +340,6 @@ this.down('messmethode[name=mmtId]').setReadOnly(value); this.down('datetime[name=messzeitpunkt]').setReadOnly(value); this.down('numberfield[name=messdauer]').setReadOnly(value); - if (!this.getForm().getRecord().get('owner')) { - //Only set this Field to Readonly when the User is NOT the Owner of the Record. - this.down('chkbox[name=fertig]').setReadOnly(value); - } + this.down('chkbox[name=fertig]').setReadOnly(value); } }); diff -r e0b5e64928c9 -r 981339d774b8 app/view/form/Ortszuordnung.js --- a/app/view/form/Ortszuordnung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/form/Ortszuordnung.js Tue Mar 01 14:12:39 2016 +0100 @@ -150,7 +150,6 @@ var verw = verwStore.getById(ort.get('gemId')); var staatStore = Ext.StoreManager.get('staaten'); var staat = staatStore.getById(ort.get('staatId')); - console.log(ort); this.getForm().setValues({ gemeinde: verw.get('bezeichnung'), @@ -165,12 +164,12 @@ * it will set the ortId of this record */ setOrt: function(row, selRecord, index, opts) { - var newOrtId = selRecord.get('id'); var r = this.getRecord(); if (newOrtId) { if (newOrtId != r.get('ortId')) { - this.getForm().setValues({ ortId: newOrtId}); + r.set('ortId', newOrtId); + this.getForm().setValues({ortId: newOrtId}); this.refreshOrt(newOrtId); //set dirty... this.fireEvent('dirtychange', this.getForm(), true); diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/DatensatzErzeuger.js --- a/app/view/grid/DatensatzErzeuger.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/DatensatzErzeuger.js Tue Mar 01 14:12:39 2016 +0100 @@ -29,21 +29,22 @@ initComponent: function() { var i18n = Lada.getApplication().bundle; this.emptyText = i18n.getMsg('de.emptyGrid'); - - this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { - clicksToMoveEditor: 1, - autoCancel: false, - disabled: false, - pluginId: 'rowedit' - }); - this.plugins = [this.rowEditing]; - + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { + clicksToMoveEditor: 1, + autoCancel: false, + disabled: false, + pluginId: 'rowedit' + }); + this.plugins = [this.rowEditing]; + } // TODO: Which docked Items are required? this.dockedItems = [{ xtype: 'toolbar', dock: 'top', items: [{ xtype: 'tbtext', + id: 'tbtitle', text: i18n.getMsg('de.gridTitle') }, '->', @@ -86,15 +87,14 @@ header: i18n.getMsg('daErzeugerId'), dataIndex: 'daErzeugerId', editor: { - xtype: 'textfield', allowBlank: false } }, { header: i18n.getMsg('bezeichnung'), dataIndex: 'bezeichnung', editor: { - xtype: 'textfield', - allowBlank: false + allowBlank: false, + xtype: 'textfield' } }, { header: i18n.getMsg('mstId'), @@ -120,28 +120,39 @@ } }, { header: i18n.getMsg('letzteAenderung'), + xtype: 'datecolumn', + format: 'd.m.Y H:i', dataIndex: 'letzteAenderung' }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; this.callParent(arguments); }, /** * This sets the Store of this Grid */ - setStore: function(store){ + setStore: function(store) { var i18n = Lada.getApplication().bundle; + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.down('button[action=add]').enable(); + } if (store) { + this.removeDocked(Ext.getCmp('ptbar'), true); this.reconfigure(store); - - var ptbar = this.down('pagingtoolbar'); - if (ptbar) { - this.removeDocked(ptbar); - } - this.down('button[action=add]').enable(); this.addDocked([{ xtype: 'pagingtoolbar', + id: 'ptbar', dock: 'bottom', store: store, displayInfo: true diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/MessprogrammKategorie.js --- a/app/view/grid/MessprogrammKategorie.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/MessprogrammKategorie.js Tue Mar 01 14:12:39 2016 +0100 @@ -30,13 +30,15 @@ var i18n = Lada.getApplication().bundle; this.emptyText = i18n.getMsg('mk.emptyGrid'); - this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { - clicksToMoveEditor: 1, - autoCancel: false, - disabled: false, - pluginId: 'rowedit' - }); - this.plugins = [this.rowEditing]; + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { + clicksToMoveEditor: 1, + autoCancel: false, + disabled: false, + pluginId: 'rowedit' + }); + this.plugins = [this.rowEditing]; + } // TODO: Which docked Items are required? this.dockedItems = [{ @@ -98,6 +100,8 @@ } }, { header: i18n.getMsg('letzteAenderung'), + xtype: 'datecolumn', + format: 'd.m.Y H:i', dataIndex: 'letzteAenderung' }]; this.callParent(arguments); @@ -106,8 +110,11 @@ /** * This sets the Store of this Grid */ - setStore: function(store){ + setStore: function(store) { var i18n = Lada.getApplication().bundle; + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.down('button[action=add]').enable(); + } if (store) { this.reconfigure(store); diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Messung.js --- a/app/view/grid/Messung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Messung.js Tue Mar 01 14:12:39 2016 +0100 @@ -81,15 +81,19 @@ }, { header: 'Status', flex: 1, - dataIndex: 'id', - renderer: function(value) { - var statusId = this.store.getById(value).get('status'); - var divId = 'messung-status-item' + value; + dataIndex: 'statusWert', + renderer: function(value, meta, record, rNdx, cNdx) { + var statusId = record.get('status'); + var mId = record.get('id'); //also fwd the record to the asynchronous loading of statuswerte // in order to add the statuswert to the record, // after the grid was rendered... - this.updateStatus(value, divId, statusId, this.store.getById(value)); - return '
Lade...
'; + if (value === '') { + this.updateStatus(mId, statusId, record); + return 'Lade...'; + } + var sta = Ext.data.StoreManager.getByKey('statuswerte'); + return sta.getById(value).get('wert'); } }, { header: 'OK-Flag', @@ -110,21 +114,27 @@ // Gibt die Anzahl der Messwerte wieder, // NICHT die Anzahl der verschiedenen Nukleide // Eventuell ist die Bezeichnug daher irreführend - dataIndex: 'id', + dataIndex: 'messwerteCount', flex: 1, - renderer: function(value) { - var id = 'messung-nuklid-item' + value; - this.updateNuklide(value, id); - return '
Lade...
'; + renderer: function(value, meta, record) { + if (value === '') { + var mId = record.get('id'); + this.updateNuklide(mId, record); + return 'Lade...'; + } + return value; } }, { header: 'Anzahl Kommentare', flex: 1, - dataIndex: 'id', - renderer: function(value) { - var id = 'messung-kommentar-item' + value; - this.updateKommentare(value, id); - return '
Lade...
'; + dataIndex: 'kommentarCount', + renderer: function(value, meta, record) { + if (value === '') { + var mId = record.get('id'); + this.updateKommentare(mId, record); + return 'Lade...'; + } + return value; } }]; this.listeners = { @@ -160,12 +170,12 @@ * Load the statusstore, * afterwards: retrieve the statusid */ - updateStatus: function(value, divId, statusId, record) { + updateStatus: function(value, statusId, record) { var statusStore = Ext.create('Lada.store.Status'); statusStore.on('load', this.updateStatusColumn, this, - {divId: divId, statusId: statusId, record: record}); + {statusId: statusId, record: record}); statusStore.load({ params: { messungsId: value @@ -173,28 +183,28 @@ }); }, - updateNuklide: function(value, divId) { + updateNuklide: function(id, record) { var messwerte = Ext.create('Lada.store.Messwerte'); messwerte.on('load', this.updateColumn, this, - {divId: divId}); + {record: record, type: 'messwerteCount'}); messwerte.load({ params: { - messungsId: value + messungsId: id } }); }, - updateKommentare: function(value, divId) { + updateKommentare: function(id, record) { var kommentare = Ext.create('Lada.store.MKommentare'); kommentare.on('load', this.updateColumn, this, - {divId: divId}); + {record: record, type: 'kommentarCount'}); kommentare.load({ params: { - messungsId: value + messungsId: id } }); }, @@ -212,7 +222,9 @@ else { value = 'k.A.'; } - Ext.fly(opts.divId).update(value); + opts.record.beginEdit(); + opts.record.set(opts.type, value); + opts.record.endEdit(); }, /** @@ -230,52 +242,26 @@ //add the determined statuswert to the record. // this is necessary to let the controller determine // which actions are allowed. - opts.record.data.statusWert = value; - } - } - if (Ext.fly(opts.divId)) { - //Try to get the statuswerte store, - // If it does not exist, create a new one. - var sta = Ext.data.StoreManager.getByKey('statuswerte'); - var val = 'error'; - if (!sta) { - // Set the Data asynchronously - sta = Ext.create('Lada.store.StatusWerte'); - sta.load({ - scope: this, - callback: function(records, operation, success) { - if (success) { - var item = sta.getById(value); - if (item) { - val = item.get('wert'); - } - } - Ext.fly(opts.divId).update(val); - } - }); - } - else { - // set the data - var item = sta.getById(value); - if (item) { - val = item.get('wert'); - } - Ext.fly(opts.divId).update(val); + opts.record.beginEdit(); + opts.record.set('statusWert', value); + opts.record.endEdit(); } } }, setReadOnly: function(b) { - if (b == true){ + this.readOnly = b; + if (b === true) { //Readonly - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').disable(); } this.down('button[action=delete]').disable(); this.down('button[action=add]').disable(); - }else{ + } + else { //Writable - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').enable(); } //this.down('button[action=delete]').enable(); @@ -289,7 +275,9 @@ activateRemoveButton: function(selection, record) { var grid = this; //only enable the remove buttone, when the grid is editable. - if (! grid.readOnly) { + if (! grid.readOnly && + record.get('statusWert') === 0 && + record.get('owner')) { grid.down('button[action=delete]').enable(); } }, diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Messwert.js --- a/app/view/grid/Messwert.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Messwert.js Tue Mar 01 14:12:39 2016 +0100 @@ -95,16 +95,30 @@ triggerAction: 'all' } }, { + header: '<NWG', + width: 60, + dataIndex: 'messwertNwg', + editor: { + xtype: 'checkbox', + inputValue: '<' + } + }, { header: 'Messwert', dataIndex: 'messwert', xtype: 'numbercolumn', width: 80, + renderer: function(value) { + return value.toExponential(2); + }, editor: { xtype: 'numberfield', allowBlank: false, maxLength: 10, - allowExponential: false, - enforceMaxLength: true + allowExponential: true, + enforceMaxLength: true, + hideTrigger: true, + keyNavEnabled: false, + mouseWheelEnabled: false } }, { header: 'Messeinheit', @@ -132,16 +146,6 @@ triggerAction: 'all' } }, { - header: '<NWG', - xtype: 'numbercolumn', - width: 60, - dataIndex: 'messwertNwg' - }, { - header: 'Nachweisgrenze', - xtype: 'numbercolumn', - width: 110, - dataIndex: 'nwgZuMesswert' - }, { header: 'Messfehler', dataIndex: 'messfehler', xtype: 'numbercolumn', @@ -154,6 +158,28 @@ enforceMaxLength: true } }, { + header: 'Nachweisgrenze', + xtype: 'numbercolumn', + dataIndex: 'nwgZuMesswert', + width: 80, + renderer: function(value) { + if (!value) { + return null; + } else { + return value.toExponential(2); + } + }, + editor: { + xtype: 'numberfield', + allowBlank: true, + maxLength: 10, + allowExponential: true, + enforceMaxLength: true, + hideTrigger: true, + keyNavEnabled: false, + mouseWheelEnabled: false + } + }, { header: 'Grenzwertüberschreitung', dataIndex: 'grenzwertueberschreitung', flex: 1, diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Ortszuordnung.js --- a/app/view/grid/Ortszuordnung.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Ortszuordnung.js Tue Mar 01 14:12:39 2016 +0100 @@ -128,16 +128,18 @@ }, setReadOnly: function(b) { - if (b == true){ + this.readOnly = b; + if (b) { //Readonly - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').disable(); } this.down('button[action=delete]').disable(); this.down('button[action=add]').disable(); - }else{ + } + else { //Writable - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').enable(); } //this.down('button[action=delete]').enable(); diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/PKommentar.js --- a/app/view/grid/PKommentar.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/PKommentar.js Tue Mar 01 14:12:39 2016 +0100 @@ -131,16 +131,18 @@ }, setReadOnly: function(b) { - if (b == true){ + this.readOnly = b; + if (b) { //Readonly - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').disable(); } this.down('button[action=delete]').disable(); this.down('button[action=add]').disable(); - }else{ + } + else { //Writable - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').enable(); } //this.down('button[action=delete]').enable(); diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Probenehmer.js --- a/app/view/grid/Probenehmer.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Probenehmer.js Tue Mar 01 14:12:39 2016 +0100 @@ -30,13 +30,15 @@ var i18n = Lada.getApplication().bundle; this.emptyText = i18n.getMsg('pn.emptyGrid'); - this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { - clicksToMoveEditor: 1, - autoCancel: false, - disabled: false, - pluginId: 'rowedit' - }); - this.plugins = [this.rowEditing]; + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { + clicksToMoveEditor: 1, + autoCancel: false, + disabled: false, + pluginId: 'rowedit' + }); + this.plugins = [this.rowEditing]; + } // TODO: Which docked Items are required? this.dockedItems = [{ @@ -44,6 +46,7 @@ dock: 'top', items: [{ xtype: 'tbtext', + id: 'tbtitle', text: i18n.getMsg('pn.gridTitle') }, '->', @@ -85,89 +88,102 @@ header: i18n.getMsg('bearbeiter'), dataIndex: 'bearbeiter', editor: { - xtype: 'textfield' + allowBlank: false } }, { header: i18n.getMsg('prnId'), dataIndex: 'prnId', editor: { - xtype: 'textfield', allowBlank: false } }, { header: i18n.getMsg('bemerkung'), dataIndex: 'bemerkung', editor: { - xtype: 'textfield', - allowBlank: false + allowBlank: false, + xtype: 'textfield' } }, { header: i18n.getMsg('kurzBezeichnung'), dataIndex: 'kurzBezeichnung', editor: { - xtype: 'textfield', - allowBlank: false + allowBlank: false, + xtype: 'textfield' } }, { header: i18n.getMsg('ort'), dataIndex: 'ort', editor: { + allowBlank: false, xtype: 'textfield' } }, { header: i18n.getMsg('plz'), dataIndex: 'plz', editor: { + allowBlank: false, xtype: 'numberfield' } }, { header: i18n.getMsg('strasse'), dataIndex: 'strasse', editor: { + allowBlank: false, xtype: 'textfield' } }, { header: i18n.getMsg('telefon'), dataIndex: 'telefon', editor: { - xtype: 'textfield' + allowBlank: false } }, { header: i18n.getMsg('tp'), dataIndex: 'tp', editor: { - xtype: 'textfield' + allowBlank: false } }, { header: i18n.getMsg('typ'), dataIndex: 'typ', editor: { - xtype: 'textfield' + allowBlank: false } }, { header: i18n.getMsg('letzteAenderung'), + xtype: 'datecolumn', + format: 'd.m.Y H:i', dataIndex: 'letzteAenderung' }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; this.callParent(arguments); }, /** * This sets the Store of this Grid */ - setStore: function(store){ + setStore: function(store) { var i18n = Lada.getApplication().bundle; + if (Ext.Array.contains(Lada.funktionen, 4)) { + this.down('button[action=add]').enable(); + } if (store) { + this.removeDocked(Ext.getCmp('ptbar'), true); this.reconfigure(store); - - var ptbar = this.down('pagingtoolbar'); - if (ptbar) { - this.removeDocked(ptbar); - } - this.down('button[action=add]').enable(); this.addDocked([{ xtype: 'pagingtoolbar', + id: 'ptbar', dock: 'bottom', store: store, displayInfo: true diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Probenzusatzwert.js --- a/app/view/grid/Probenzusatzwert.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Probenzusatzwert.js Tue Mar 01 14:12:39 2016 +0100 @@ -177,16 +177,18 @@ }, setReadOnly: function(b) { - if (b == true){ + this.readOnly = b; + if (b) { //Readonly - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').disable(); } this.down('button[action=delete]').disable(); this.down('button[action=add]').disable(); - }else{ + } + else { //Writable - if (this.getPlugin('rowedit')){ + if (this.getPlugin('rowedit')) { this.getPlugin('rowedit').enable(); } //this.down('button[action=delete]').enable(); diff -r e0b5e64928c9 -r 981339d774b8 app/view/grid/Status.js --- a/app/view/grid/Status.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/grid/Status.js Tue Mar 01 14:12:39 2016 +0100 @@ -14,7 +14,6 @@ alias: 'widget.statusgrid', maxHeight: 350, - emptyText: 'Keine Statusangaben gefunden.', minHeight: 110, viewConfig: { deferEmptyText: false @@ -23,10 +22,14 @@ recordId: null, readOnly: true, allowDeselect: true, + statusWerteStore: null, initComponent: function() { - var statusWerteStore = Ext.create('Lada.store.StatusWerte'); - statusWerteStore.load({ + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('statusgrid.emptyText'); + + this.statusWerteStore = Ext.create('Lada.store.StatusWerte'); + this.statusWerteStore.load({ params: { messungsId: this.recordId } @@ -37,8 +40,22 @@ this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false, - disabled: true, - pluginId: 'rowedit' + disabled: true, //has no effect... but why? + pluginId: 'rowedit', + listeners: { + beforeedit: function(editor, context, eOpts) { + if (context.record.get('id') || + ! context.grid.up('window').record.get('statusEdit')) { + //Check if edit is allowed, this is true, when the selected + // Record has an id (=is not new) + // or is not allowed to add records. + + return false; + } + + + } + } }); this.plugins = [this.rowEditing]; @@ -46,7 +63,13 @@ xtype: 'toolbar', dock: 'bottom', items: ['->', { - text: 'Hinzufügen', + text: i18n.getMsg('reset'), + icon: 'resources/img/edit-redo.png', + action: 'reset', + probeId: this.probeId, + parentId: this.parentId + }, { + text: i18n.getMsg('add'), icon: 'resources/img/list-add.png', action: 'add', probeId: this.probeId, @@ -54,19 +77,19 @@ }] }]; this.columns = [{ - header: 'erstellt', + header: i18n.getMsg('statusgrid.header.datum'), dataIndex: 'datum', xtype: 'datecolumn', format: 'd.m.Y H:i', width: 110, sortable: false }, { - header: 'Erzeuger', + header: i18n.getMsg('statusgrid.header.erzeuger'), dataIndex: 'erzeuger', renderer: function(value) { var r = ''; if (!value || value === '') { - r = 'Error'; + r = i18n.getMsg('error'); } var mstore = Ext.data.StoreManager.get('messstellen'); var item = mstore.getById(value); @@ -81,17 +104,18 @@ displayField: 'messStelle', valueField: 'id', allowBlank: false, + queryMode: 'local', editable: false }, sortable: false }, { - header: 'Stufe', + header: i18n.getMsg('statusgrid.header.statusStufe'), dataIndex: 'statusStufe', renderer: function(value) { var sta = Ext.data.StoreManager.get('statusstufe'); var r; if (value===null || value === '') { - r = 'Error'; + r = i18n.getMsg('error'); } var item = sta.getById(value); if (item) { @@ -101,14 +125,14 @@ }, sortable: false }, { - header: 'Status', + header: i18n.getMsg('statusgrid.header.statusWert'), dataIndex: 'statusWert', renderer: function(value) { var sta = Ext.data.StoreManager.get('statuswerte'); //This store is NOT used in the editor... var r; if (value===null || value === '') { - r = 'Error'; + r = i18n.getMsg('error'); } var item = sta.getById(value); if (item) { @@ -118,16 +142,17 @@ }, editor: { xtype: 'combobox', - store: statusWerteStore, + store: this.statusWerteStore, queryMode: 'local', displayField: 'wert', valueField: 'id', allowBlank: false, - editable: false + editable: false, + forceSelection: true }, sortable: false }, { - header: 'Text', + header: i18n.getMsg('statusgrid.header.text'), dataIndex: 'text', flex: 1, editor: { @@ -147,11 +172,17 @@ this.store.removeAll(); } else { - this.store = Ext.create('Lada.store.Status'); + this.store = Ext.create('Lada.store.Status',{ + sorters: [{ + property: 'datum', + direction: 'ASC' + }] + }); } + this.store.load({ params: { - messungsId: this.recordId + messungsId: this.recordId, } }); }, @@ -164,5 +195,13 @@ //Writable this.down('button[action=add]').enable(); } + }, + + setResetable: function(b) { + if (b == true){ + this.down('button[action=reset]').enable(); + }else{ + this.down('button[action=reset]').disable(); + } } }); diff -r e0b5e64928c9 -r 981339d774b8 app/view/panel/FilterDetails.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/panel/FilterDetails.js Tue Mar 01 14:12:39 2016 +0100 @@ -0,0 +1,63 @@ +/** + * + */ +Ext.define('Lada.view.panel.FilterDetails', { + extend: 'Ext.form.FieldSet', + alias: 'widget.filterdetails', + + record: null, + + title: 'test', + + /** + * @private + * Initialize the view. + */ + initComponent: function() { + var me = this; + var i18n = Lada.getApplication().bundle; + //me.title = i18n.getMsg('filterdetails.title'); + + me.items = [{ + xtype: 'displayfield', + margin: '5, 5, 5, 5', + name: 'name', + fieldLabel: 'Name' + }, { + xtype: 'displayfield', + margin: '0, 5, 5, 5', + name: 'beschreibung', + fieldLabel: 'Beschreibung' + }, { + xtype: 'displayfield', + margin: '0, 5, 5, 5', + name: 'filters', + fieldLabel: 'Filter' + }, { + xtype: 'displayfield', + margin: '0, 5, 5, 5', + name: 'columns', + fieldLabel: 'Spalten' + }]; + + this.callParent(arguments); + }, + + setRecord: function(record) { + this.record = record; + this.down('displayfield[name=name]').setValue(record.get('name')); + this.down('displayfield[name=beschreibung]').setValue(record.get('description')); + var columnString = []; + var value = record.get('results'); + for (var i = 0; i < value.length; i++) { + columnString.push(value[i].header); + } + this.down('displayfield[name=columns]').setValue(columnString.join(', ')); + value = record.get('filters'); + var filterString = []; + for (var i = 0; i < value.length; i++) { + filterString.push(value[i].label); + } + this.down('displayfield[name=filters]').setValue(filterString.join(', ')); + } +}); diff -r e0b5e64928c9 -r 981339d774b8 app/view/panel/Map.js --- a/app/view/panel/Map.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/panel/Map.js Tue Mar 01 14:12:39 2016 +0100 @@ -114,8 +114,6 @@ }, addLocations: function(locationStore) { - console.log('add locations'); - console.log(locationStore); var me = this; locationFeatures = []; @@ -131,10 +129,7 @@ bez: locationStore.getAt(i).get('ortId') } )); - console.log('add feature'); - console.log(locationStore.getAt(i)); } - console.log(locationStore.count()); // Create a new Feature Layer and add it to the map if (!this.featureLayer) { diff -r e0b5e64928c9 -r 981339d774b8 app/view/panel/Ort.js --- a/app/view/panel/Ort.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/panel/Ort.js Tue Mar 01 14:12:39 2016 +0100 @@ -102,7 +102,6 @@ var me = this; var osg = this.down('ortstammdatengrid'); var map = this.down('map'); - console.log(map); if (!store) { var ortstore = Ext.create('Lada.store.Orte', { diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/DynamicGrid.js --- a/app/view/widget/DynamicGrid.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/DynamicGrid.js Tue Mar 01 14:12:39 2016 +0100 @@ -89,7 +89,7 @@ tooltip: 'Probe öffnen', width: 30, getClass: function (val, meta, rec) { - if ( rec.get('readonly') === false || rec.get('owner') ) { + if ( rec.get('readonly') === false && rec.get('owner') === true) { return 'edit'; } else { diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/CheckBox.js --- a/app/view/widget/base/CheckBox.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/base/CheckBox.js Tue Mar 01 14:12:39 2016 +0100 @@ -94,6 +94,10 @@ return this.down('checkbox').getValue(); }, + setValue: function(value) { + this.down('checkbox').setValue(value); + }, + getName: function() { return this.name; }, diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/ComboBox.js --- a/app/view/widget/base/ComboBox.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/base/ComboBox.js Tue Mar 01 14:12:39 2016 +0100 @@ -43,6 +43,7 @@ readOnly: this.readOnly, forceSelection: this.forceSelection || false, msgTarget: 'none', + value: this.value, tpl: this.tpl, displayTpl: this.displayTpl }, { @@ -108,6 +109,10 @@ return this.down('combobox').getValue(); }, + setValue: function(value) { + this.down('combobox').setValue(value); + }, + clearValue: function() { this.down('combobox').clearValue(); }, diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/DateField.js --- a/app/view/widget/base/DateField.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/base/DateField.js Tue Mar 01 14:12:39 2016 +0100 @@ -98,6 +98,10 @@ return this.down('datefield').getValue(); }, + setValue: function(value) { + this.down('datefield').setValue(value); + }, + clearValue: function() { this.down('datefield').clearValue(); }, diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/Datetime.js --- a/app/view/widget/base/Datetime.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/base/Datetime.js Tue Mar 01 14:12:39 2016 +0100 @@ -92,6 +92,14 @@ } }, + getValue: function() { + return this.down('datetimefield').getValue(); + }, + + setValue: function(value) { + this.down('datetimefield').setValue(value); + }, + clearWarningOrError: function() { this.down('datetimefield').clearInvalid(); this.down('image[name=errorImg]').hide(); diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/FavColumn.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/base/FavColumn.js Tue Mar 01 14:12:39 2016 +0100 @@ -0,0 +1,31 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.view.widget.base.FavColumn', { + extend: 'Ext.grid.column.CheckColumn', + alias: 'widget.favcolumn', +/* + constructor: function() { + this.addEvents( + 'checkchange' + ); + this.callParent(arguments); + }, +*/ + renderer: function(value, metaData, record) { + var cssPrefix = Ext.baseCSSPrefix; + var cls = [cssPrefix + 'grid-checkheader']; + if (value) { + cls.push(cssPrefix + 'grid-favcolumn-checked'); + } + else { + cls.push(cssPrefix + 'grid-favcolumn-unchecked'); + } + return '
 
'; + } +}); diff -r e0b5e64928c9 -r 981339d774b8 app/view/widget/base/TextField.js --- a/app/view/widget/base/TextField.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/widget/base/TextField.js Tue Mar 01 14:12:39 2016 +0100 @@ -84,6 +84,14 @@ } }, + getValue: function() { + return this.down('textfield').getValue(); + }, + + setValue: function(value) { + this.down('textfield').setValue(value); + }, + clearWarningOrError: function() { this.down('image[name=errorImg]').hide(); this.down('image[name=warnImg]').hide(); diff -r e0b5e64928c9 -r 981339d774b8 app/view/window/FilterManagement.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/FilterManagement.js Tue Mar 01 14:12:39 2016 +0100 @@ -0,0 +1,167 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + * + */ +Ext.define('Lada.view.window.FilterManagement', { + extend: 'Ext.window.Window', + alias: 'widget.filtermanagement', + + requires: [ + 'Lada.view.widget.base.FavColumn' + ], + + layout: 'fit', + width: window.innerWidth - 100, + height: 500, + closeAction: 'hide', + + /** + * @private + * Initialize the view. + */ + initComponent: function() { + var i18n = Lada.getApplication().bundle; + var me = this; + this.buttons = [{ + text: i18n.getMsg('close'), + scope: this, + handler: this.close + }]; + var probenstore = Ext.StoreManager.get('probequeries'); + var messpstore = Ext.StoreManager.get('messprogrammqueries'); + var stammstore = Ext.StoreManager.get('stammdatenqueries'); + me.items = [{ + xtype: 'tabpanel', + items: [{ + title: i18n.getMsg('querygrid.probe.title'), + xtype: 'grid', + viewConfig: { + markDirty: false, + getRowClass: function() { + return 'x-lada-multiline-grid'; + } + }, + store: probenstore, + columns: [{ + header: i18n.getMsg('querygrid.header.favorite'), + width: 48, + dataIndex: 'favorite', + xtype: 'favcolumn' + }, { + header: i18n.getMsg('querygrid.header.name'), + dataIndex: 'name', + width: 200 + }, { + header: i18n.getMsg('querygrid.header.description'), + dataIndex: 'description', + minWidth: 200, + flex: 3 + }, { + header: i18n.getMsg('querygrid.header.columns'), + dataIndex: 'results', + width: 250, + flex: 2, + renderer: function(value) { + var columnString = []; + for (var i = 0; i < value.length; i++) { + columnString.push(value[i].header); + } + return columnString.join(', '); + } + }, { + header: i18n.getMsg('querygrid.header.filters'), + dataIndex: 'filters', + width: 200, + renderer: function(value) { + var columnString = []; + for (var i = 0; i < value.length; i++) { + columnString.push(value[i].label); + } + return columnString.join(', '); + } + }] + }, { + title: i18n.getMsg('querygrid.messprogramm.title'), + xtype: 'grid', + viewConfig: { + markDirty: false, + getRowClass: function() { + return 'x-lada-multiline-grid'; + } + }, + store: messpstore, + columns: [{ + header: i18n.getMsg('querygrid.header.favorite'), + width: 48, + dataIndex: 'favorite', + xtype: 'favcolumn' + }, { + header: i18n.getMsg('querygrid.header.name'), + dataIndex: 'name', + width: 200 + }, { + header: i18n.getMsg('querygrid.header.description'), + dataIndex: 'description', + minWidth: 200, + flex: 3 + }, { + header: i18n.getMsg('querygrid.header.columns'), + dataIndex: 'results', + width: 250, + flex: 2, + renderer: function(value) { + var columnString = []; + for (var i = 0; i < value.length; i++) { + columnString.push(value[i].header); + } + return columnString.join(', '); + } + }, { + header: i18n.getMsg('querygrid.header.filters'), + dataIndex: 'filters', + width: 200, + renderer: function(value) { + var columnString = []; + for (var i = 0; i < value.length; i++) { + columnString.push(value[i].label); + } + return columnString.join(', '); + } + }] + }, { + title: i18n.getMsg('querygrid.stammdaten.title'), + xtype: 'grid', + viewConfig: { + markDirty: false, + getRowClass: function() { + return 'x-lada-multiline-grid'; + } + }, + store: stammstore, + columns: [{ + header: i18n.getMsg('querygrid.header.favorite'), + width: 48, + dataIndex: 'favorite', + xtype: 'favcolumn' + }, { + header: i18n.getMsg('querygrid.header.name'), + dataIndex: 'name', + width: 200 + }, { + header: i18n.getMsg('querygrid.header.description'), + dataIndex: 'description', + flex: 1 + }] + }] + }]; + + this.callParent(arguments); + } +}); diff -r e0b5e64928c9 -r 981339d774b8 app/view/window/MessungCreate.js --- a/app/view/window/MessungCreate.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/window/MessungCreate.js Tue Mar 01 14:12:39 2016 +0100 @@ -115,5 +115,36 @@ enableChildren: function(){ //intentionally! return true; - } + }, + + /** + * Enable to reset the statusgrid + */ + enableStatusReset: function() { + //intentionally! + return true; + }, + + /** + * Disable to reset the statusgrid + */ + disableStatusReset: function() { + //intentionally! + return true; + }, + /** + * Enable to edit the statusgrid + */ + enableStatusEdit: function() { + //intentionally! + return true; + }, + + /** + * Disable to edit the statusgrid + */ + disableStatusEdit: function() { + //intentionally! + return true; + } }); diff -r e0b5e64928c9 -r 981339d774b8 app/view/window/MessungEdit.js --- a/app/view/window/MessungEdit.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/window/MessungEdit.js Tue Mar 01 14:12:39 2016 +0100 @@ -165,7 +165,8 @@ if (json) { this.setMessages(json.errors, json.warnings); } - if (this.record.get('readonly') === true) { + if (this.record.get('readonly') === true || + this.record.get('owner') === false) { this.disableForm(); } else { @@ -178,6 +179,7 @@ else { this.disableStatusEdit(); } + //Check if it is allowed to reset Status: done in Messungform }, scope: this }); @@ -209,7 +211,8 @@ this.down('fset[name=messwerte]').down('messwertgrid').readOnly = true; this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true); this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true; - this.disableStatusEdit(); + //this.disableStatusEdit(); + //this.disableStatusReset(); }, /** @@ -220,13 +223,27 @@ this.down('fset[name=messwerte]').down('messwertgrid').readOnly = false; this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false); this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false; - this.enableStatusEdit(); + //this.enableStatusEdit(); + //this.enableStatusReset(); }, /** + * Enable to reset the statusgrid + */ + enableStatusReset: function() { + this.down('fset[name=messungstatus]').down('statusgrid').setResetable(true); + }, + + /** + * Disable to reset the statusgrid + */ + disableStatusReset: function() { + this.down('fset[name=messungstatus]').down('statusgrid').setResetable(false); + }, + /** * Enable to edit the statusgrid */ - enableStatusEdit: function () { + enableStatusEdit: function() { this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false); this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false; }, @@ -234,7 +251,7 @@ /** * Disable to edit the statusgrid */ - disableStatusEdit: function () { + disableStatusEdit: function() { this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true); this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true; }, diff -r e0b5e64928c9 -r 981339d774b8 app/view/window/ProbeEdit.js --- a/app/view/window/ProbeEdit.js Tue Mar 01 13:16:10 2016 +0100 +++ b/app/view/window/ProbeEdit.js Tue Mar 01 14:12:39 2016 +0100 @@ -137,7 +137,8 @@ success: function(record, response) { this.down('probeform').setRecord(record); this.record = record; - owner = this.record.get('owner'); + var owner = this.record.get('owner'); + var readonly = this.record.get('readonly'); if (owner) { //Always allow to Add Messungen. @@ -152,7 +153,7 @@ } } // If the Probe is ReadOnly, disable Inputfields and grids - if (this.record.get('readonly') === true) { + if (readonly === true || !owner) { this.down('probeform').setReadOnly(true); this.disableChildren(); } @@ -184,11 +185,8 @@ this.down('fset[name=messungen]').down('messunggrid').readOnly = true; } this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(true); - this.down('fset[name=orte]').down('ortszuordnunggrid').readOnly = true; this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(true); - this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = true; this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(true); - this.down('fset[name=pkommentare]').down('pkommentargrid').readOnly = true; }, /** @@ -196,13 +194,9 @@ */ enableChildren: function() { this.down('fset[name=messungen]').down('messunggrid').setReadOnly(false); - this.down('fset[name=messungen]').down('messunggrid').readOnly = false; this.down('fset[name=orte]').down('ortszuordnunggrid').setReadOnly(false); - this.down('fset[name=orte]').down('ortszuordnunggrid').readOnly = false; this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').setReadOnly(false); - this.down('fset[name=probenzusatzwerte]').down('probenzusatzwertgrid').readOnly = false; this.down('fset[name=pkommentare]').down('pkommentargrid').setReadOnly(false); - this.down('fset[name=pkommentare]').down('pkommentargrid').readOnly = false; }, /** diff -r e0b5e64928c9 -r 981339d774b8 custom-vhosts.conf --- a/custom-vhosts.conf Tue Mar 01 13:16:10 2016 +0100 +++ b/custom-vhosts.conf Tue Mar 01 14:12:39 2016 +0100 @@ -13,6 +13,11 @@ # # You may use the command line option '-S' to verify your virtual host # configuration. +Listen 80 +Listen 81 +Listen 82 +Listen 83 +Listen 84 ServerAdmin webmaster@localhost @@ -21,7 +26,8 @@ # Fake Shibboleth-like authentication headers RequestHeader set X-SHIB-user "testeins" - RequestHeader set X-SHIB-roles "cn=Imis-World, cn=mst_06010, cn=mst_11010" + # Erfasser + RequestHeader set X-SHIB-roles "cn=mst_11010" # Add Proxy for Lada-server ProxyPass "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" @@ -30,3 +36,63 @@ #ProxyPass /lada-client/lada-printer http://MAPFISH-PRINT-URL/lada_print #ProxyPassReverse /lada-client/lada-printer http://MAPFISH-PRINT-URL/lada_print + + + ServerAdmin webmaster@localhost + ErrorLog logs/lada-error_log + CustomLog logs/lada-access_log common + + # Fake Shibboleth-like authentication headers + RequestHeader set X-SHIB-user "testeins" + # Status-Erfasser + RequestHeader set X-SHIB-roles "cn=mst_11010_status,cn=land_11_status" + + # Add Proxy for Lada-server + ProxyPass "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + ProxyPassReverse "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + + + + ServerAdmin webmaster@localhost + ErrorLog logs/lada-error_log + CustomLog logs/lada-access_log common + + # Fake Shibboleth-like authentication headers + RequestHeader set X-SHIB-user "testnull" + # Status-Land + RequestHeader set X-SHIB-roles "cn=land_11_status" + + # Add Proxy for Lada-server + ProxyPass "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + ProxyPassReverse "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + + + + ServerAdmin webmaster@localhost + ErrorLog logs/lada-error_log + CustomLog logs/lada-access_log common + + # Fake Shibboleth-like authentication headers + RequestHeader set X-SHIB-user "testeins" + # Status-Leitstelle + RequestHeader set X-SHIB-roles "cn=lst_kiel" + + # Add Proxy for Lada-server + ProxyPass "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + ProxyPassReverse "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + + + + ServerAdmin webmaster@localhost + ErrorLog logs/lada-error_log + CustomLog logs/lada-access_log common + + # Fake Shibboleth-like authentication headers + RequestHeader set X-SHIB-user "testeins" + # Stammdatenpflege-Land + RequestHeader set X-SHIB-roles "cn=land_06_stamm" + + # Add Proxy for Lada-server + ProxyPass "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + ProxyPassReverse "/lada-server/" "http://lada-server:8080/lada-server-2.2.0/" + diff -r e0b5e64928c9 -r 981339d774b8 resources/css/lada.css --- a/resources/css/lada.css Tue Mar 01 13:16:10 2016 +0100 +++ b/resources/css/lada.css Tue Mar 01 14:12:39 2016 +0100 @@ -14,6 +14,10 @@ border-color: #FF0000; } +.x-lada-multiline-grid .x-grid-cell-inner{ + white-space: normal !important; +} + .window-inactive .x-window-header-text {color: #a9a9a9;} @@ -34,6 +38,21 @@ background-image: url(../img/view-time-schedule-edit.png); } +.x-grid-checkheader { + height: 16px; + background-image: url('images/unchecked.gif'); + background-position: 50%; + background-repeat: no-repeat; + background-color: transparent; +} + +.x-grid-favcolumn-checked { + background-image: url(../img/favorites.png); +} + +.x-grid-favcolumn-unchecked { + background-image: url(../img/favorites_off.png); +} /* do not display clear-button (x) in IE10+ Input fields */ ::-ms-clear { diff -r e0b5e64928c9 -r 981339d774b8 resources/i18n/Lada.properties --- a/resources/i18n/Lada.properties Tue Mar 01 13:16:10 2016 +0100 +++ b/resources/i18n/Lada.properties Tue Mar 01 14:12:39 2016 +0100 @@ -2,7 +2,7 @@ # Error Codes ## ! General errors -200: Kein Fehler +200: Unbekannter Fehler 601: Probe existiert bereits 602: Objekt ist keine Probe 603: Fehler in der Verbindung zur DB diff -r e0b5e64928c9 -r 981339d774b8 resources/i18n/Lada_de-DE.properties --- a/resources/i18n/Lada_de-DE.properties Tue Mar 01 13:16:10 2016 +0100 +++ b/resources/i18n/Lada_de-DE.properties Tue Mar 01 14:12:39 2016 +0100 @@ -2,7 +2,7 @@ # Error Codes ## ! General errors -200:Kein Fehler +200:Unbekannter Fehler 601:Probe existiert bereits 602:Objekt ist keine Probe 603:Fehler in der Verbindung zur DB @@ -72,18 +72,18 @@ offset:Offset letzteAenderung:Letzte Änderung bezeichnung:Bezeichnung -mplId:mplID-TODOTEXT -daErzeugerId:daErzeugerId-TODOTEXT -prnId:prnId-TODOTEXT -bearbeiter:bearbeiter-TODOTEXT -bemerkung:bemerkung-TODOTEXT -kurzBezeichnung:kurzBezeichnung-TODOTEXT -ort:ort-TODOTEXT -plz:plz-TODOTEXT -strasse:strasse-TODOTEXT -telefon:telefon-TODOTEXT -tp:tp-TODOTEXT -typ:typ-TODOTEXT +mplId:mpl_id +daErzeugerId:ID +prnId:ID +bearbeiter:Bearbeiter +bemerkung:Bemerkung +kurzBezeichnung:Kurzbezeichnung +ort:Ort +plz:PLZ +strasse:Straße +telefon:Telefon +tp:tp +typ:Typ emptytext.probenintervall:Wählen Sie ein Probenintervall @@ -152,6 +152,9 @@ action:Aktion remove:Entfernen +reset:Zurücksetzen +error: Fehler + delete.probe.window.title:Probe und ihre Messungen Löschen? delete.probe:Wollen Sie die Probe und alle damit verbundenen Messungen wirklich LÖSCHEN? delete.probe.warning:ACHTUNG: Diese Aktion kann nicht rückgängig gemacht werden. @@ -160,6 +163,17 @@ confirmation.question: Sind Sie sich sicher? +## Statusgrid +statusgrid.emptyText: Keine Statusangaben gefunden. +statusgrid.header.datum: Erstellt +statusgrid.header.erzeuger: Erzeuger +statusgrid.header.statusStufe: Stufe +statusgrid.header.statusWert: Status +statusgrid.header.text: Text +statusgrid.resetText: Der Status wurde zurückgesetzt +statusgrid.reset.mbox.title: Status der Messung zurücksetzen. +statusgrid.reset.mbox.text: Sind Sie sich sicher, dass Sie den Status zurücksetzen wollen? + ## # Msg: ## @@ -231,3 +245,52 @@ pn.gridTitle:Probenehmer pn.button.add:Probenehmer hinzufügen pn.button.delete:Probenehmer löschen + +## +# Orte Grid: +## +orte.emptyGrid:Keine Orte gefunden. +orte.gridTitle:Orte +orte.button.add:Ort hinzufügen +orte.button.delete:Ort löschen + +# Columnnames +orte.ortId:Ort-ID +orte.nutsCode:NUTS-Code +orte.anlageId:Anlage-ID +orte.gemId:Gemeinde-ID +orte.staatId:Staat-ID +orte.kdaId:KDA-ID +orte.ozId:OZ-ID +orte.ortTyp:Ortstyp +orte.mpArt:mpArt +orte.zone:Zone +orte.sektor:Sektor +orte.zustaendigkeit:Zuständigkeit +orte.berichtstext:Berichtstext +orte.kurztext:Kurztext +orte.langtext:Langtext +orte.beschreibung:Beschreibung +orte.unscharf:Unscharf +orte.hoeheLand:Höhe +orte.koordXExtern:X-Koordinate +orte.koordYExtern:Y-Koordinate +orte.longitude:Geographische Länge +orte.latitude:Geographische Breite +orte.letzteAenderung:Zuletzt geändert + + +## +# Map +## +map.button.add:Ort über Karte hinzufügen + +filterdetails.title:Filterdetails +querygrid.header.favorite:Favorit +querygrid.header.name:Name +querygrid.header.description:Beschreibung +querygrid.header.columns:Spalten +querygrid.header.filters:Filter +querygrid.probe.title:Probenfilter +querygrid.messprogramm.title:Messprogrammfilter +querygrid.stammdaten.title:Stammdatenfilter diff -r e0b5e64928c9 -r 981339d774b8 resources/img/edit-redo.png Binary file resources/img/edit-redo.png has changed diff -r e0b5e64928c9 -r 981339d774b8 resources/img/favorites.png Binary file resources/img/favorites.png has changed diff -r e0b5e64928c9 -r 981339d774b8 resources/img/favorites_off.png Binary file resources/img/favorites_off.png has changed