Mercurial > lada > lada-client
changeset 975:fb99332bb48e stammdatengrids
Severe changes concerning the Resultgrids.
- Intrduced "Stammdaten" which can be selected in the Mode Field on the left side,
- Added Stores and Models for the Stammdaten
- Removed the FilterResultgrid and replaced it with a model which uses inheritance.
Dynamic Grid Columns can now be derived from app/view/widget/DynamicGrid.js
For Proben and Messprogramme this is already done.
- There might be some REGRESSION concerning the buttons in the ProbeList and
MessprogrammeList grid, as those are not disabled properly.
This needs to be fixed in future commits.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 02 Dec 2015 17:39:04 +0100 (2015-12-02) |
parents | ea477f62a667 |
children | 3c770fc7cf19 |
files | app.js app/controller/Filter.js app/controller/ProbenPlanungSwitcher.js app/controller/grid/MessprogrammeList.js app/controller/grid/ProbeList.js app/model/DatensatzErzeuger.js app/model/MessprogrammKategorie.js app/model/Probenehmer.js app/model/Query.js app/store/DatensatzErzeuger.js app/store/MessprogrammKategorie.js app/store/MessprogrammQueries.js app/store/MessprogrammeList.js app/store/ProbenList.js app/store/Probenehmer.js app/store/StammdatenQueries.js app/view/ProbenPlanungSwitcher.js app/view/Viewport.js app/view/grid/DatensatzErzeuger.js app/view/grid/FilterResult.js app/view/grid/MessprogrammKategorie.js app/view/grid/MessprogrammeList.js app/view/grid/ProbeList.js app/view/grid/Probenehmer.js app/view/widget/DynamicGrid.js resources/i18n/Lada_de-DE.properties |
diffstat | 26 files changed, 1640 insertions(+), 276 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app.js Wed Dec 02 17:39:04 2015 +0100 @@ -201,7 +201,8 @@ // first before the application "launch" function is called. controllers: [ 'Lada.controller.Filter', - 'Lada.controller.FilterResult', + 'Lada.controller.grid.ProbeList', + 'Lada.controller.grid.MessprogrammeList', 'Lada.controller.form.Probe', 'Lada.controller.form.Messung', 'Lada.controller.form.Ort',
--- a/app/controller/Filter.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/controller/Filter.js Wed Dec 02 17:39:04 2015 +0100 @@ -56,7 +56,11 @@ /** * Function called when the user selects a SQL query in the dropdownlist. * The function will hide/display additional element related to the - * selected search query + * selected search query. + * It also replaces the Store of the Filteresultgrid. + * Two possibilities exist to do so: Proben/Messprogramme where dynamic columns exist, but the + * content remains of the same type and Stammdaten, were columns are fixed but the type might + * vary between orte, kategorien, ... */ selectSql: function(element, record) { var filters = element.up('panel[name=main]').down('fieldset[name=filtervariables]'); @@ -64,20 +68,70 @@ var desc = element.up('fieldset').down('displayfield[name=description]'); this.displayFields = record[0].data.results; var filterFields = record[0].data.filters; + 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 this.reset(element); - var columnString = []; - for (var i = 0; i < this.displayFields.length; i++) { - columnString.push(this.displayFields[i].header); + contentPanel.removeAll(); + +/// THIS IS INTERMEDIARY CODE AND CAN BE REMOVED WHEN TYPES ARE SENT FOR PROBEN AND MESSPROGRAMME + console.log('remove this intermediary code...'); + var modes = element.up('panel[name=main]').down('radiogroup').getChecked(); + queryType = (queryType) ? queryType : modes[0].inputValue; +/// END OF INTERMEDIARY CODE + + + if (queryType == 'proben' || queryType == 'messprogramme') { + var frgrid; // The Resultgrid + var gridstore; // The Store which will be used in the resultgrid. + + switch (queryType) { + case 'proben': + gridstore = Ext.create('Lada.store.ProbenList'); + frgrid = Ext.create('Lada.view.grid.ProbeList'); + break; + case 'messprogramme': + gridstore = Ext.create('Lada.store.MessprogrammeList'); + frgrid = Ext.create('Lada.view.grid.MessprogrammeList'); + break; + } + + var columnString = []; + for (var i = 0; i < this.displayFields.length; i++) { + columnString.push(this.displayFields[i].header); + } + columns.setValue(columnString.join(', ')); + desc.setValue(record[0].data.description); + + // Setup Columns + if (this.displayFields) { + this.displayFields.reverse(); + } + + if (gridstore) { + frgrid.setStore(gridstore); + } + + contentPanel.add(frgrid); } - columns.setValue(columnString.join(', ')); - desc.setValue(record[0].data.description); - - // Setup Columns of the probenlist - this.displayFields.reverse(); - - /* Setup Filters of the probenlist + else { + // Grids which are not build with dynamic columns + var resultGrid; + switch (queryType) { + case 'MessprogrammKategorie': + resultGrid = Ext.create('Lada.view.grid.MessprogrammKategorie'); + break; + case 'DatensatzErzeuger': + resultGrid = Ext.create('Lada.view.grid.DatensatzErzeuger'); + break; + } + if (resultGrid) { + contentPanel.add(resultGrid); + } + } + /* Setup Filters * * Allowed types are * * text @@ -188,12 +242,16 @@ /** * Function is called when the user clicks the search button. The function * will perform a search to the server on refreshes the result list. + * To do so it replaces the store of the Resultgrids. */ search: function(element) { - var resultGrid = element.up('panel[name=main]').down('filterresultgrid'); + 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 search = element.up('fieldset').down('combobox[name=filter]'); + //Type of the search Proben/Messprogramme/Stammdaten + var type = search.store.getById(search.getValue()).get('type') + // Get search parameters: var searchParams = {}; searchParams['qid'] = search.getValue(); @@ -209,18 +267,32 @@ var modes = element.up('panel[name=main]').down('radiogroup').getChecked(); var sname = modes[0].inputValue; - if (sname === 'ProbeList') { + // Todo: Migragte away from sname, use type instead + if (sname === 'proben') { sname = 'Lada.store.ProbenList'; } - else if (sname === 'MessprogrammList') { + else if (sname === 'messprogramme') { sname = 'Lada.store.MessprogrammeList'; } + else if (sname === 'stammdaten') { + //Store depends of the Type... + // TODO the switchcasese should be unified + switch (type) { + case 'MessprogrammKategorie': + sname = 'Lada.store.MessprogrammKategorie'; + break; + case 'DatensatzErzeuger': + sname = 'Lada.store.DatensatzErzeuger'; + break; + } + } // Find the store or create a new one. var store = Ext.StoreManager.lookup(sname); if (!store) { store = Ext.create(sname); } + console.log(store); if (store) { store.addListener('beforeload', this.loadingAnimationOn, resultGrid); store.addListener('load', this.loadingAnimationOff, resultGrid);
--- a/app/controller/ProbenPlanungSwitcher.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/controller/ProbenPlanungSwitcher.js Wed Dec 02 17:39:04 2015 +0100 @@ -16,7 +16,8 @@ requires: [ 'Lada.store.MessprogrammQueries', - 'Lada.store.ProbeQueries' + 'Lada.store.ProbeQueries', + 'Lada.store.StammdatenQueries' ], /** @@ -38,59 +39,55 @@ * according to the checkboxes inputValue, * the function alters the store which was loaded by the * filterpanels combobox, - * If enabled the function also disables / enables the UI-Buttons - * in the Filterresult grid. */ switchModes: function(field) { - - var disableButtons = true; var cbox = field.up('probenplanungswitcher').up().down('combobox'); - var resultGrid = field.up('panel[name=main]').down('filterresultgrid'); filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]'); filters.removeAll(); filters.hide(); - var sname = 'Lada.store.ProbeQueries'; - var gridsname = 'Lada.store.ProbenList'; - if (field.inputValue === 'MessprogrammList' && cbox) { - sname = 'Lada.store.MessprogrammQueries'; - gridsname = 'Lada.store.MessprogrammeList'; + + //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 === 'ProbeList' && cbox) { - sname = 'Lada.store.ProbeQueries'; - gridsname = 'Lada.store.ProbenList'; + else if (field.inputValue === 'proben' && cbox) { + querystorename = 'Lada.store.ProbeQueries'; + } + else if (field.inputValue === 'stammdaten' && cbox) { + querystorename = 'Lada.store.StammdatenQueries'; } - - var store = Ext.StoreManager.lookup(sname); + if (querystorename) { + var store = Ext.StoreManager.lookup(querystorename); - if (!store) { - store = Ext.create(sname, { - //Select first Item on Load - listeners: { - load: function(s){ - var records = new Array(); - records.push(store.getAt(0)); + 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); + cbox.select(records[0]); + cbox.fireEvent('select', cbox, records); + } } + }); + } + + if (store) { + if (!store.autoLoad) { + store.load(); } - }); - } - if (store) { - store.load(); - cbox.reset(); - cbox.bindStore(store); + //cbox.reset(); + cbox.bindStore(store); + } } - - var gridstore = Ext.StoreManager.lookup(gridsname); - if (!gridstore) { - gridstore = Ext.create(gridsname); - } - if (gridstore) { - resultGrid.setStore(gridstore); - resultGrid.show(); - } - } });
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/MessprogrammeList.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,112 @@ +/* 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. + */ + +/** + * Controller for filter result grid. + */ +Ext.define('Lada.controller.grid.MessprogrammeList', { + extend: 'Ext.app.Controller', + requires: [ + 'Lada.view.window.Messprogramm', + 'Lada.view.window.GenProbenFromMessprogramm' + ], + + /** + * Initialize the Controller with listeners + */ + init: function() { + this.control({ + 'messprogrammelistgrid': { + itemdblclick: this.editItem + }, + 'messprogrammelistgrid toolbar button[action=addMessprogramm]': { + click: this.addMessprogrammItem + }, + 'messprogrammelistgrid toolbar button[action=genProbenFromMessprogramm]': { + click: this.genProbenFromMessprogramm + } + }); + this.callParent(arguments); + }, + + /** + * This function is called after a Row in the + * {@link Lada.view.grid.MessprogrammeList} + * was double-clicked. + * The function opens a {@link Lada.view.window.ProbeEdit} + * or a {@link Lada.view.window.Messprogramm}. + * To determine which window has to be opened, the function + * analyse the records modelname. + */ + editItem: function(grid, record) { + var winname = 'Lada.view.window.Messprogramm'; + var win = Ext.create(winname, { + record: record, + style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 + }); + win.show(); + win.initData(); + }, + + /** + * This function opens a new window to create a Probe + * {@link Lada.view.window.Messprogramm} + */ + addMessprogrammItem: function() { + var win = Ext.create('Lada.view.window.Messprogramm'); + win.show(); + win.initData(); + }, + + /** + * This button creates a window to generate Proben + * from a selected messprogramm. + */ + genProbenFromMessprogramm: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var i18n = Lada.getApplication().bundle; + var proben = []; + for (var i = 0; i < selection.length; i++) { + proben.push(selection[i].get('id')); + } + var me = this; + + var winname = 'Lada.view.window.GenProbenFromMessprogramm'; + for (p in proben) { + grid.setLoading(true); + Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], { + failure: function(record, action) { + me.setLoading(false); + // TODO + console.log('An unhandled Failure occured. See following Response and Record'); + console.log(action); + console.log(record); + }, + success: function(record, response) { + grid.setLoading(false); + + var win = Ext.create(winname, { + record: record, + parentWindow: null + }); + win.show(); + win.initData(); + }, + scope: this + }); + } + }, + + reload: function(btn) { + if (btn === 'yes') { + location.reload(); + } + } +}); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/ProbeList.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,307 @@ +/* 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. + */ + +/** + * Controller for the ProbeList result grid. + */ +Ext.define('Lada.controller.grid.ProbeList', { + extend: 'Ext.app.Controller', + requires: [ + 'Lada.view.window.ProbeEdit', + 'Lada.view.window.GenProbenFromMessprogramm' + ], + + /** + * Initialize the Controller with listeners + */ + init: function() { + this.control({ + 'probelistgrid': { + itemdblclick: this.editItem + }, + 'probelistgrid toolbar button[action=addProbe]': { + click: this.addProbeItem + }, + 'probelistgrid toolbar button[action=import]': { + click: this.uploadFile + }, + 'probelistgrid toolbar button[action=export]': { + click: this.downloadFile + }, + 'probelistgrid toolbar button[action=print]': { + click: this.printSelection + } + }); + this.callParent(arguments); + }, + + /** + * This function is called after a Row in the + * {@link Lada.view.grid.ProbeList} + * was double-clicked. + * The function opens a {@link Lada.view.window.ProbeEdit} + * or a {@link Lada.view.window.Messprogramm}. + * To determine which window has to be opened, the function + * analyse the records modelname. + */ + editItem: function(grid, record) { + var winname = 'Lada.view.window.ProbeEdit'; + + var win = Ext.create(winname, { + record: record, + style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 + }); + + win.show(); + win.initData(); + }, + + /** + * This function opens a new window to create a Probe + * {@link Lada.view.window.ProbeCreate} + */ + addProbeItem: function() { + var win = Ext.create('Lada.view.window.ProbeCreate'); + win.show(); + win.initData(); + }, + + /** + * This function opens a {@link Lada.view.window.FileUpload} + * window to upload a LAF-File + */ + uploadFile: function() { + var win = Ext.create('Lada.view.window.FileUpload', { + title: 'Datenimport', + modal: true + }); + + win.show(); + }, + + /** + * This function can be used to Download the items which + * were selected in the {@link Lada.view.grid.ProbeList} + * The Download does not work with Internet Explorers older than v.10 + */ + downloadFile: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var i18n = Lada.getApplication().bundle; + var proben = []; + for (var i = 0; i < selection.length; i++) { + proben.push(selection[i].get('id')); + } + var me = this; + Ext.Ajax.request({ + url: 'lada-server/export/laf', + jsonData: {'proben': proben}, + success: function(response) { + var content = response.responseText; + var blob = new Blob([content],{type: 'text/plain'}); + saveAs(blob, 'export.laf'); + }, + failure: function(response) { + /* + SSO will send a 302 if the Client is not authenticated + unfortunately this seems to be filtered by the browser. + We assume that a 302 was send when the follwing statement + is true. + */ + if (response.status == 0 && response.responseText === "") { + Ext.MessageBox.confirm('Erneutes Login erforderlich', + 'Ihre Session ist abgelaufen.<br/>'+ + 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + + 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + + 'Soll die Anwendung jetzt neu geladen werden?', this.reload); + } + // further error handling + var json = Ext.JSON.decode(response.responseText); + if (json) { + if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ + formPanel.setMessages(json.errors, json.warnings); + } + if(json.message){ + Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') + +' #'+json.message, + Lada.getApplication().bundle.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.laf.filecreatefailed')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.laf.filecreatefailed')); + } + } + }); + }, + + /** + * Send the selection to a Printservice + */ + printSelection: function(button) { + + //disable Button and setLoading... + button.disable(); + button.setLoading(true); + + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var i18n = Lada.getApplication().bundle; + var me = this; + var columns = []; + var columnNames = []; + var visibleColumns = []; + var displayName = ''; + var data = []; + + // Write the columns to an array + try { + for (key in selection[0].data) { + // Do not write owner or readonly or id + if (["owner", "readonly", "id"].indexOf(key) == -1){ + columns.push(key); + } + } + } + catch (e) { + console.log(e); + } + + //Retrieve visible columns' id's and names. + // and set displayName + try { + var grid = button.up('grid'); + var cman = grid.columnManager; + var cols = cman.getColumns(); + + displayName = grid.down('tbtext').text; + + for (key in cols) { + if (cols[key].dataIndex) { + visibleColumns[cols[key].dataIndex] = cols[key].text; + } + } + } + catch (e) { + console.log(e); + } + + + // Retrieve Data from selection + try { + for (item in selection) { + var row = selection[item].data; + var out = []; + //Lookup every column and write to data array. + for (key in columns){ + var attr = columns[key]; + //Only write data to output when the column is not hidden. + if (row[attr] != null && + visibleColumns[attr] != null) { + out.push(row[attr].toString()); + } + else if (visibleColumns[attr] != null) { + out.push(''); + } + } + data.push(out); + } + } + catch (e){ + console.log(e); + } + + //Retrieve the names of the columns. + try { + var grid = button.up('grid'); + var cman = grid.columnManager; + var cols = cman.getColumns(); + //Iterate columns and find column names for the key... + // This WILL run into bad behaviour when column-keys exist twice. + for (key in columns){ + for (k in cols){ + if (cols[k].dataIndex == columns[key]){ + columnNames.push(cols[k].text); + break; + } + } + } + } + catch (e) { + console.log(e); + } + + var printData = { + 'layout': 'A4 landscape', + 'outputFormat': 'pdf', + 'attributes': { + 'title': 'Auszug aus LADA', + 'displayName': displayName, + 'table': { + 'columns': columnNames, + 'data': data + } + } + } + + Ext.Ajax.request({ + url: 'lada-printer/buildreport.pdf', + //configure a proxy in apache conf! + jsonData: printData, + binary: true, + success: function(response) { + var content = response.responseBytes; + var filetype = response.getResponseHeader('Content-Type'); + var blob = new Blob([content],{type: filetype}); + saveAs(blob, 'lada-print.pdf'); + button.enable(); + button.setLoading(false); + }, + failure: function(response) { + console.log('failure'); + // Error handling + // TODO + //console.log(response.responseText) + button.enable(); + button.setLoading(false); + if (response.responseText) { + try { + var json = Ext.JSON.decode(response.responseText); + } + catch(e){ + console.log(e); + } + } + if (json) { + if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ + formPanel.setMessages(json.errors, json.warnings); + } + if(json.message){ + Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') + +' #'+json.message, + Lada.getApplication().bundle.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.print.noContact')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.print.noContact')); + } + } + }); + }, + + reload: function(btn) { + if (btn === 'yes') { + location.reload(); + } + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/DatensatzErzeuger.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,62 @@ +/* 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. + */ + +/** + * Model class for DatensatzErzeuger Stammdaten + */ +Ext.define('Lada.model.DatensatzErzeuger', { + extend: 'Ext.data.Model', + + fields: [{ + name: 'id' + }, { + name: 'netzbetreiberId' + }, { + name: 'daErzeugerId' + }, { + name: 'mstId' + }, { + name: 'bezeichnung' + }, { + name: 'letzteAenderung', + type: 'date', + convert: function(v) { + if (!v) { + return v; + } + 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; + } + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/datensatzerzeuger', + reader: { + type: 'json', + root: 'data' + } + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/MessprogrammKategorie.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,60 @@ +/* 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. + */ + +/** + * Model class for MessprogrammKategorie Stammdaten + */ +Ext.define('Lada.model.MessprogrammKategorie', { + extend: 'Ext.data.Model', + + fields: [{ + name: 'id' + }, { + name: 'netzbetreiberId' + }, { + name: 'mplId' + }, { + name: 'bezeichnung' + }, { + name: 'letzteAenderung', + type: 'date', + convert: function(v) { + if (!v) { + return v; + } + 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; + } + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/messprogrammkategorie', + reader: { + type: 'json', + root: 'data' + } + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/Probenehmer.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,78 @@ +/* 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. + */ + +/** + * Model class for Probenehmer Stammdaten + */ +Ext.define('Lada.model.Probenehmer', { + extend: 'Ext.data.Model', + + fields: [{ + name: 'id' + }, { + name: 'netzbetreiberId' + }, { + name: 'prnId' + }, { + name: 'bearbeiter' + }, { + name: 'bemerkung' + }, { + name: 'bezeichnung' + }, { + name: 'kurzBezeichnung' + }, { + name: 'ort' + }, { + name: 'plz' + }, { + name: 'strasse' + }, { + name: 'telefon' + }, { + name: 'tp' + }, { + name: 'typ' + }, { + name: 'letzteAenderung', + type: 'date', + convert: function(v) { + if (!v) { + return v; + } + 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; + } + }], + + idProperty: 'id', + + proxy: { + type: 'rest', + url: 'lada-server/messprogrammkategorie', + reader: { + type: 'json', + root: 'data' + } + } +});
--- a/app/model/Query.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/model/Query.js Wed Dec 02 17:39:04 2015 +0100 @@ -24,5 +24,7 @@ name: 'results' }, { name: 'filters' + }, { + name: 'type' }] });
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/DatensatzErzeuger.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,15 @@ +/* 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. + */ + +/** + * Store for DatensatzErzeuger Stammdaten + */ +Ext.define('Lada.store.DatensatzErzeuger', { + extend: 'Ext.data.Store', + model: 'Lada.model.DatensatzErzeuger' +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/MessprogrammKategorie.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,15 @@ +/* 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. + */ + +/** + * Store for MessprogrammKategorie Stammdaten + */ +Ext.define('Lada.store.MessprogrammKategorie', { + extend: 'Ext.data.Store', + model: 'Lada.model.MessprogrammKategorie' +});
--- a/app/store/MessprogrammQueries.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/store/MessprogrammQueries.js Wed Dec 02 17:39:04 2015 +0100 @@ -12,7 +12,7 @@ Ext.define('Lada.store.MessprogrammQueries', { extend: 'Ext.data.Store', model: 'Lada.model.Query', - autolad: true, + autoLoad: true, proxy: { type: 'rest', url: 'lada-server/query/messprogramm',
--- a/app/store/MessprogrammeList.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/store/MessprogrammeList.js Wed Dec 02 17:39:04 2015 +0100 @@ -7,7 +7,7 @@ */ /** - * Store for Messprogramme, it is used in the {@link Lada.view.grid.FilterResult} + * Store for Messprogramme, it is used in the {@link Lada.view.grid.MessprogrammeList} */ Ext.define('Lada.store.MessprogrammeList', { extend: 'Ext.data.Store',
--- a/app/store/ProbenList.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/store/ProbenList.js Wed Dec 02 17:39:04 2015 +0100 @@ -7,7 +7,7 @@ */ /** - * Store for Proben, it is used in the {@link Lada.view.grid.FilterResult} + * Store for Proben, it is used in the {@link Lada.view.grid.ProbeList} */ Ext.define('Lada.store.ProbenList', { extend: 'Ext.data.Store',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/Probenehmer.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,15 @@ +/* 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. + */ + +/** + * Store for Probenehmer Stammdaten + */ +Ext.define('Lada.store.Probenehmer', { + extend: 'Ext.data.Store', + model: 'Lada.model.Probenehmer' +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/StammdatenQueries.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,29 @@ +/* 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. + */ + +/** + * Store for Queries for Stammdaten + */ +Ext.define('Lada.store.StammdatenQueries', { + extend: 'Ext.data.Store', + model: 'Lada.model.Query', + autoLoad: true, + data: { data: [ + {id: '0', name: 'MessprogrammKategorie', type: 'MessprogrammKategorie', sql: 'bogus', description: 'bogusBeschr', filters: []}, + {id: '1', name: 'DatensatzErzeuger', type: 'DatensatzErzeuger', sql: 'bogus', description: 'bogusBeschr', filters: []} + ]}, + proxy: { + type: 'memory', + //url: 'lada-server/query/stammdaten', + reader: { + type: 'json', + root: 'data' + } + } +}); +
--- a/app/view/ProbenPlanungSwitcher.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/view/ProbenPlanungSwitcher.js Wed Dec 02 17:39:04 2015 +0100 @@ -30,9 +30,9 @@ items: [{ xtype: 'radiofield', name: 'ppswitch', - boxLabel: i18n.getMsg('probelist'), - inputValue: 'ProbeList', //this determines the store - // which will be loaded, + boxLabel: i18n.getMsg('proben'), + inputValue: 'proben', //this determines the store + // which will be loaded by the controller, checked: true, handler: function(field, state){ if (state === true) { @@ -42,8 +42,18 @@ },{ xtype: 'radiofield', name: 'ppswitch', - boxLabel: i18n.getMsg('probeplanning'), - inputValue: 'MessprogrammList', //name of a store + boxLabel: i18n.getMsg('messprogramme'), + inputValue: 'messprogramme', + handler: function(field, state){ + if (state === true) { + this.fireEvent('check', field); + } + } + },{ + xtype: 'radiofield', + name: 'ppswitch', + boxLabel: i18n.getMsg('stammdaten'), + inputValue: 'stammdaten', handler: function(field, state){ if (state === true) { this.fireEvent('check', field);
--- a/app/view/Viewport.js Mon Nov 30 14:52:59 2015 +0100 +++ b/app/view/Viewport.js Wed Dec 02 17:39:04 2015 +0100 @@ -17,8 +17,7 @@ extend: 'Ext.container.Viewport', requires: [ 'Lada.view.ProbenPlanungSwitcher', - 'Lada.view.FilterPanel', - 'Lada.view.grid.FilterResult' + 'Lada.view.FilterPanel' ], layout: 'fit', initComponent: function() { @@ -76,9 +75,11 @@ items: [] }] }, { - // Resultlist for the query. + xtype: 'panel', + border: 1, + layout: 'fit', + name: 'contentpanel', flex: 3, - xtype: 'filterresultgrid', hidden: false, region: 'center' }]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/DatensatzErzeuger.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,126 @@ +/* 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. + */ + +/** + * Grid to list DatensatzErzeuger Stammdaten + */ +Ext.define('Lada.view.grid.DatensatzErzeuger', { + extend: 'Ext.grid.Panel', + alias: 'widget.datensatzerzeugergrid', + + // minHeight and deferEmptyText are needed to be able to show the + // emptyText message. + minHeight: 110, + viewConfig: { + deferEmptyText: false + }, + + warnings: null, + errors: null, + readOnly: true, + allowDeselect: true, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('de.emptyGrid'); + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('de.gridTitle') + }] + }]; + + this.columns = [{ + header: i18n.getMsg('netzbetreiberId'), + dataIndex: '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('netzbetreiber'), + displayField: 'netzbetreiber', + valueField: 'id', + allowBlank: false + } + }, { + header: i18n.getMsg('daErzeugerId'), + dataIndex: 'daErzeugerId', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('mstId'), + dataIndex: 'mstId', + renderer: function(value) { + var r = ''; + if (!value || value === '') { + r = 'Error'; + } + var store = Ext.data.StoreManager.get('messstellen'); + var record = store.getById(value); + if (record) { + r = record.get('messStelle'); + } + return r; + }, + editor: { + xtype: 'combobox', + store: Ext.data.StoreManager.get('messstellenFiltered'), + displayField: 'messStelle', + valueField: 'id', + allowBlank: false + } + }, { + header: i18n.getMsg('letzteAenderung'), + 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){ + var i18n = Lada.getApplication().bundle; + + this.removeDocked(Ext.getCmp('ptbar'), true); + this.reconfigure(store); + this.addDocked([{ + xtype: 'pagingtoolbar', + id: 'ptbar', + dock: 'bottom', + store: store, + displayInfo: true + }]); + } +});
--- a/app/view/grid/FilterResult.js Mon Nov 30 14:52:59 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* 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. - */ - -/** - * Grid to list the result of the Filter - */ -Ext.define('Lada.view.grid.FilterResult', { - extend: 'Ext.grid.Panel', - alias: 'widget.filterresultgrid', - - requires: 'Lada.view.window.DeleteProbe', - - store: null, //'ProbenList', - - multiSelect: true, - - viewConfig: { - emptyText: 'Keine Ergebnisse gefunden.', - deferEmptyText: false - }, - - initComponent: function() { - var i18n = Lada.getApplication().bundle; - - this.dockedItems = [{ - xtype: 'toolbar', - dock: 'top', - items: [{ - xtype: 'tbtext', - id: 'tbtitle', - text: i18n.getMsg('probelist') - }, - '->', - { - text: 'Probe erstellen', - icon: 'resources/img/list-add.png', - action: 'addProbe', - disabled: false - }, { - text: 'Proben Importieren', - icon: 'resources/img/svn-commit.png', - action: 'import', - disabled: false - }, { - text: 'Proben Exportieren', - icon: 'resources/img/svn-update.png', - action: 'export', - disabled: true - }, { - text: 'Auswahl Drucken', - icon: 'resources/img/printer.png', - action: 'print', - disabled: true - }, - '-', - { - text: 'Messprogramm erstellen', - icon: 'resources/img/list-add.png', - action: 'addMessprogramm', - disabled: true - }, { - text: 'Proben generieren', - icon: 'resources/img/view-time-schedule-insert.png', - action: 'genProbenFromMessprogramm', - disabled: true - }] - }]; - this.columns = []; - this.callParent(arguments); - }, - - /** - * This sets the Store of the FilterResultGrid - */ - setStore: function(store){ - var i18n = Lada.getApplication().bundle; - - this.removeDocked(Ext.getCmp('ptbar'), true); - this.reconfigure(store); - this.addDocked([{ - xtype: 'pagingtoolbar', - id: 'ptbar', - dock: 'bottom', - store: store, - displayInfo: true - }]); - - //Configure the Toolbar. - this.setMode(store); - }, - - /** - * Enables or disables Toolbar-Buttons according to the selected mode - */ - setMode: function(store) { - var t = Ext.getCmp('tbtitle'); - var i18n = Lada.getApplication().bundle; - if (store.model.modelName == 'Lada.model.ProbeList'){ - t.setText(i18n.getMsg('probelist')); - this.down('button[action=addMessprogramm]').disable(); - this.down('button[action=genProbenFromMessprogramm]').disable(); - this.down('button[action=addProbe]').enable(); - this.down('button[action=import]').enable(); - this.down('button[action=export]').enable(); - this.down('button[action=print]').enable(); - } - else if (store.model.modelName == 'Lada.model.MessprogrammList') { - t.setText(i18n.getMsg('probeplanning')); - this.down('button[action=addMessprogramm]').enable(); - this.down('button[action=genProbenFromMessprogramm]').enable(); - this.down('button[action=addProbe]').disable(); - this.down('button[action=import]').disable(); - this.down('button[action=export]').disable(); - this.down('button[action=print]').disable(); - } - else { - t.setText(''); - console.log('The model '+store.model.modelName+ - 'was not defined in the FilterResultGrid.' + - ' Hence the title could not be set.'); - } - }, - - /** - * Setup columns of the Grid dynamically based on a list of given cols. - * The function is called from the {@link Lada.controller.Filter#search - * search event} - * The Images for the Read-Write Icon are defined in CSS - */ - setupColumns: function(cols) { - var resultColumns = []; - var fields = []; - - fields.push(new Ext.data.Field({ - name: 'owner' - })); - fields.push(new Ext.data.Field({ - name: 'readonly' - })); - - resultColumns.push({ - xtype: 'actioncolumn', - text: 'RW', - dataIndex: 'readonly', - sortable: false, - tooltip: 'Probe öffnen', - width: 30, - getClass: function (val, meta, rec) { - return rec.get('readonly') === false ? "edit" : "noedit"; - }, - handler: function(grid, rowIndex, colIndex) { - var rec = grid.getStore().getAt(rowIndex); - grid.fireEvent('itemdblclick', grid, rec); - } - }); - - for (var i = cols.length - 1; i >= 0; i--) { - if (cols[i] === 'id') { - continue; - } - resultColumns.push(cols[i]); - fields.push(new Ext.data.Field({ - name: cols[i].dataIndex - })); - } - if (this.store.$className == 'Lada.store.ProbenList') { - // Add a Delete-Button - // TODO: Might need to be extended to Messprogramme - resultColumns.push({ - xtype: 'actioncolumn', - text: 'Aktion', - sortable: false, - width: 30, - items: [{ - icon: 'resources/img/edit-delete.png', - tooltip: 'Löschen', - isDisabled: function(grid, rowIndex, colIndex) { - var rec = grid.getStore().getAt(rowIndex); - if ( rec.get('readonly') || !rec.get('owner')) { - return true; - } - return false; - }, - handler: function(grid, rowIndex, colIndex){ - var rec = grid.getStore().getAt(rowIndex); - - var winname = 'Lada.view.window.DeleteProbe'; - var win = Ext.create(winname, { - record: rec, - parentWindow: this - }); - win.show(); - win.initData(); - } - }] - }); - } - this.store.model.setFields(fields); - this.reconfigure(this.store, resultColumns); - } -});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/MessprogrammKategorie.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,110 @@ +/* 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. + */ + +/** + * Grid to list MessprogrammKategorie Stammdaten + */ +Ext.define('Lada.view.grid.MessprogrammKategorie', { + extend: 'Ext.grid.Panel', + alias: 'widget.mkgrid', + + // minHeight and deferEmptyText are needed to be able to show the + // emptyText message. + minHeight: 110, + viewConfig: { + deferEmptyText: false + }, + + warnings: null, + errors: null, + readOnly: true, + allowDeselect: true, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('mk.emptyGrid'); + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('mk.gridTitle') + }] + }]; + + this.columns = [{ + header: i18n.getMsg('netzbetreiberId'), + dataIndex: '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('netzbetreiber'), + displayField: 'netzbetreiber', + valueField: 'id', + allowBlank: false + } + }, { + header: i18n.getMsg('mplId'), + dataIndex: 'mplId', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('bezeichnung'), + dataIndex: 'bezeichnung', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('letzteAenderung'), + 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){ + var i18n = Lada.getApplication().bundle; + + this.removeDocked(Ext.getCmp('ptbar'), true); + this.reconfigure(store); + this.addDocked([{ + xtype: 'pagingtoolbar', + id: 'ptbar', + dock: 'bottom', + store: store, + displayInfo: true + }]); + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/MessprogrammeList.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,46 @@ +/* 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. + */ + +/** + * Grid to list the result of the Filter + */ +Ext.define('Lada.view.grid.MessprogrammeList', { + extend: 'Lada.view.widget.DynamicGrid', + alias: 'widget.messprogrammelistgrid', + + requires: 'Lada.view.window.DeleteProbe', + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('messprogramme.emptyGrid'); + + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('messprogramme.gridTitle') + }, + '->', + { + text: i18n.getMsg('messprogramme.button.create'), + icon: 'resources/img/list-add.png', + action: 'addMessprogramm' + }, { + text: i18n.getMsg('messprogramme.button.generate'), + icon: 'resources/img/view-time-schedule-insert.png', + action: 'genProbenFromMessprogramm' + }] + }]; + this.columns = []; + this.callParent(arguments); + } +}); + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/ProbeList.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,101 @@ +/* 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. + */ + +/** + * Grid to list the result of the Filter + */ +Ext.define('Lada.view.grid.ProbeList', { + extend: 'Lada.view.widget.DynamicGrid', + alias: 'widget.probelistgrid', + + requires: 'Lada.view.window.DeleteProbe', + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('probe.emptyGrid'); + + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('probe.gridTitle') + }, + '->', + { + text: i18n.getMsg('probe.button.create'), + icon: 'resources/img/list-add.png', + action: 'addProbe', + disabled: false + }, { + text: i18n.getMsg('probe.button.import'), + icon: 'resources/img/svn-commit.png', + action: 'import', + disabled: false + }, { + text: i18n.getMsg('probe.button.export'), + icon: 'resources/img/svn-update.png', + action: 'export' + }, { + text: i18n.getMsg('probe.button.print'), + icon: 'resources/img/printer.png', + action: 'print' + }] + }]; + this.columns = []; + this.callParent(arguments); + }, + + /** + * Setup columns of the Grid dynamically based on a list of given cols. + * The function is called from the {@link Lada.controller.Filter#search + * search event} + * The Images for the Read-Write Icon are defined in CSS + * This Method overrides setupColumns of the parents class, + * becaus the delete colum is required. + */ + setupColumns: function(cols) { + var caf = this.generateColumnsAndFields(cols); + var columns = caf[0]; + var fields = caf[1]; + var i18n = Lada.getApplication().bundle; + + columns.push({ + xtype: 'actioncolumn', + text: i18n.getMsg('action'), + sortable: false, + width: 30, + items: [{ + icon: 'resources/img/edit-delete.png', + tooltip: i18n.getMsg('delete'), + isDisabled: function(grid, rowIndex, colIndex) { + var rec = grid.getStore().getAt(rowIndex); + if ( rec.get('readonly') || !rec.get('owner')) { + return true; + } + return false; + }, + handler: function(grid, rowIndex, colIndex){ + var rec = grid.getStore().getAt(rowIndex); + + var winname = 'Lada.view.window.DeleteProbe'; + var win = Ext.create(winname, { + record: rec, + parentWindow: this + }); + win.show(); + win.initData(); + } + }] + }); + this.store.model.setFields(fields); + this.reconfigure(this.store, columns); + } +}); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/Probenehmer.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,245 @@ +/* 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. + */ + +/** + * Grid to list Probenehmer Stammdaten + */ +Ext.define('Lada.view.grid.Probenehmer', { + extend: 'Ext.grid.Panel', + alias: 'widget.probenehmergrid', + + // minHeight and deferEmptyText are needed to be able to show the + // emptyText message. + minHeight: 110, + viewConfig: { + deferEmptyText: false + }, + + warnings: null, + errors: null, + readOnly: true, + allowDeselect: true, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.emptyText = i18n.getMsg('pn.emptyGrid'); + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('pn.gridTitle') + }] + /* + //bottom toolbar? + }, { + xtype: 'toolbar', + dock: 'bottom', + items: ['->', { + text: 'Hinzufügen', + icon: 'resources/img/list-add.png', + action: 'add', + probeId: this.probeId + }, { + text: 'Löschen', + icon: 'resources/img/list-remove.png', + action: 'delete' + }] + */ + }]; + /* + // Do we have row-editing + this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { + clicksToMoveEditor: 1, + autoCancel: false, + disabled: false, + pluginId: 'rowedit', + listeners:{ + // Make row ineditable when readonly is set to true + // Normally this would belong into a controller an not the view. + // But the RowEditPlugin is not handled there. + beforeedit: function(e, o) { + var readonlywin = o.grid.up('window').record.get('readonly'); + var readonlygrid = o.record.get('readonly'); + if (readonlywin == true || readonlygrid == true || this.disabled) { + return false; + } + return true; + } + } + }); + this.plugins = [this.rowEditing]; + */ + this.columns = [{ + header: i18n.getMsg('netzbetreiberId'), + dataIndex: '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('netzbetreiber'), + displayField: 'netzbetreiber', + valueField: 'id', + allowBlank: false + } + }, { + header: i18n.getMsg('bearbeiter'), + dataIndex: 'bearbeiter', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('prnId'), + dataIndex: 'prnId', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('bemerkung'), + dataIndex: 'bemerkung', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('kurzBezeichnung'), + dataIndex: 'kurzBezeichnung', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('ort'), + dataIndex: 'ort', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('plz'), + dataIndex: 'plz', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('strasse'), + dataIndex: 'strasse', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('telefon'), + dataIndex: 'telefon', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('tp'), + dataIndex: 'tp', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('typ'), + dataIndex: 'typ', + editor: { + allowBlank: false + } + }, { + header: i18n.getMsg('letzteAenderung'), + dataIndex: 'letzteAenderung' + }]; + this.listeners = { + select: { + fn: this.activateRemoveButton, + scope: this + }, + deselect: { + fn: this.deactivateRemoveButton, + scope: this + } + }; + // this.initData(); //This will be called by the Query Component. + this.callParent(arguments); + //TODO this.setReadOnly(true); //Grid is always initialised as RO + }, + + initData: function() { + this.store = Ext.create('Lada.store.DatensatzErzeuger'); + this.store.load(); //TODO: Params? + }, + + setReadOnly: function(b) { + if (b == true){ + //Readonly + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').disable(); + } + try { + this.down('button[action=delete]').disable(); + this.down('button[action=add]').disable(); + } + catch(e) { + //TODO: Do Nothing... + } + }else{ + //Writable + if (this.getPlugin('rowedit')){ + this.getPlugin('rowedit').enable(); + } + try { + this.down('button[action=delete]').enable(); + this.down('button[action=add]').enable(); + } + catch(e) { + //TODO: Do Nothing... + } + } + }, + /** + * Activate the Remove Button + */ + activateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + try { + grid.down('button[action=delete]').enable(); + } + catch(e) { + //TODO: Do Nothing + } + } + }, + /** + * deactivate the Remove Button + */ + deactivateRemoveButton: function(selection, record) { + var grid = this; + //only enable the remove buttone, when the grid is editable. + if (! grid.readOnly) { + try { + grid.down('button[action=delete]').disable(); + } + catch(e) { + //TODO: Do Nothing + } + } + } +}); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/DynamicGrid.js Wed Dec 02 17:39:04 2015 +0100 @@ -0,0 +1,108 @@ +/* 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. + */ + +/** + * Grid to list the result of the Filter + */ +Ext.define('Lada.view.widget.DynamicGrid', { + extend: 'Ext.grid.Panel', + + store: null, + + multiSelect: true, + + viewConfig: { + deferEmptyText: false + }, + + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.callParent(arguments); + }, + + /** + * This sets the Store of the DynamicGrid + */ + setStore: function(store){ + var i18n = Lada.getApplication().bundle; + + this.removeDocked(Ext.getCmp('ptbar'), true); + this.reconfigure(store); + this.addDocked([{ + xtype: 'pagingtoolbar', + id: 'ptbar', + dock: 'bottom', + store: store, + displayInfo: true + }]); + + }, + + /** + * Setup columns of the Grid dynamically based on a list of given cols. + * The function is called from the {@link Lada.controller.Filter#search + * search event} + * The Images for the Read-Write Icon are defined in CSS + */ + setupColumns: function(cols) { + var caf = this.generateColumnsAndFields(cols); + var columns = caf[0]; + var fields = caf[1]; + this.store.model.setFields(fields); + this.reconfigure(this.store, columns); + }, + + /** + * generateColumnsAndFields + * generates an array of columns which are used for the dynamic grid + * @return an array of two arrays: [0] is an array of colums [1] an array + * of fields + **/ + generateColumnsAndFields: function(cols) { + var resultColumns = []; + var fields = []; + + fields.push(new Ext.data.Field({ + name: 'owner' + })); + fields.push(new Ext.data.Field({ + name: 'readonly' + })); + + resultColumns.push({ + xtype: 'actioncolumn', + text: 'RW', + dataIndex: 'readonly', + sortable: false, + tooltip: 'Probe öffnen', + width: 30, + getClass: function (val, meta, rec) { + return rec.get('readonly') === false ? "edit" : "noedit"; + }, + handler: function(grid, rowIndex, colIndex) { + var rec = grid.getStore().getAt(rowIndex); + grid.fireEvent('itemdblclick', grid, rec); + } + }); + + for (var i = cols.length - 1; i >= 0; i--) { + if (cols[i] === 'id') { + continue; + } + resultColumns.push(cols[i]); + fields.push(new Ext.data.Field({ + name: cols[i].dataIndex + })); + } + var caf = new Array(); + caf[0] = resultColumns; + caf[1] = fields; + return caf; + } +}); +
--- a/resources/i18n/Lada_de-DE.properties Mon Nov 30 14:52:59 2015 +0100 +++ b/resources/i18n/Lada_de-DE.properties Wed Dec 02 17:39:04 2015 +0100 @@ -38,9 +38,13 @@ probenartId:Probenart probeentnahmeBeginn:Probeentnahme Beginn +## +# Modus +## modus:Modus -probeplanning:Messprogramme -probelist:Proben +messprogramme:Messprogramme +proben:Proben +stammdaten:Stammdaten name:Name mstId:Messstelle @@ -65,6 +69,21 @@ from:Von to:Bis 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 + emptytext.probenintervall:Wählen Sie ein Probenintervall emptytext.datenbasis:Wählen Sie eine Datenbasis @@ -121,11 +140,14 @@ messprogtimeperiod:für den Zeitraum select:Auswählen apply:Übernehmen +action:Aktion +remove:Entfernen 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. +undefined:Nicht definiert ## # Msg: @@ -156,3 +178,39 @@ pi.weekly:wöchentlich pi.daily:täglich intervall:Intervall + +## +# ProbeList Grid: +## +probe.emptyGrid:Keine Proben gefunden. +probe.gridTitle:Proben +probe.button.create:Probe erstellen +probe.button.import:Probe importieren +probe.button.export:Probe exportieren +probe.button.print:Auswahl drucken + +## +# MessprogrammeList Grid: +## +messprogramme.emptyGrid:Keine Messprogramme gefunden. +messprogramme.gridTitle:Messprogramme +messprogramme.button.create:Messprogramm erstellen +messprogramme.button.generate:Proben generieren + +## +# DatensatzErzeuger Grid: +## +de.emptyGrid:Keine DatensatzErzeuger gefunden. +de.gridTitle:Datensatzerzeuger + +## +# MessprogrammKategorie Grid: +## +mk.emptyGrid:Keine Messprogrammkategorie gefunden. +mk.gridTitle:Messprogramm Kategorien + +## +# Probenehmer Grid: +## +pn.emptyGrid:Keine Probenehmer gefunden. +pn.gridTitle:Probenehmer