Mercurial > lada > lada-client
changeset 1007:23bfcbdb4527
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 20 Jan 2016 17:33:33 +0100 |
parents | 54179b6043b6 (current diff) 15d8c64049d1 (diff) |
children | 9651def05ae6 |
files | app/controller/Filter.js app/controller/ProbenPlanungSwitcher.js app/controller/grid/Status.js app/model/Messung.js app/model/Messwert.js app/model/Status.js app/view/ProbenPlanungSwitcher.js app/view/grid/FilterResult.js resources/i18n/Lada_de-DE.properties |
diffstat | 65 files changed, 2375 insertions(+), 427 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app.js Wed Jan 20 17:33:33 2016 +0100 @@ -63,7 +63,7 @@ Lada.userroles = ''; Lada.logintime = ''; Lada.mst = []; - Lada.clientVersion = '2.1.2'; + Lada.clientVersion = '2.2-STAMMDATEN'; Lada.serverVersion = ''; var queryString = document.location.href.split('?')[1]; @@ -71,7 +71,7 @@ Lada.openIDParams = queryString; } Ext.Ajax.request({ - url: 'lada-server/user', + url: 'lada-server/rest/user', method: 'GET', scope: this, success: this.onLoginSuccess, @@ -179,7 +179,7 @@ getServerVersion: function() { var i18n = Lada.getApplication().bundle; Ext.Ajax.request({ - url: 'lada-server/version', + url: 'lada-server/rest/version', method: 'GET', headers: { 'X-OPENID-PARAMS': Lada.openIDParams @@ -201,7 +201,11 @@ // first before the application "launch" function is called. controllers: [ 'Lada.controller.Filter', - 'Lada.controller.FilterResult', + 'Lada.controller.ModeSwitcher', + '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.Ort', @@ -214,7 +218,6 @@ 'Lada.controller.grid.Status', 'Lada.controller.Map', 'Lada.controller.form.Location', - 'Lada.controller.ProbenPlanungSwitcher', 'Lada.controller.form.Messprogramm', 'Lada.controller.grid.Messmethode' ]
--- a/app/controller/Filter.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/controller/Filter.js Wed Jan 20 17:33:33 2016 +0100 @@ -56,28 +56,89 @@ /** * 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]'); - var columns = element.up('fieldset').down('displayfield[name=columns]'); + + // 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; 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); + 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(', ')); - desc.setValue(record[0].data.description); - // Setup Columns of the probenlist - this.displayFields.reverse(); + // Setup Columns + if (this.displayFields) { + this.displayFields.reverse(); + } - /* Setup Filters of the probenlist + if (queryType == 'probe' || queryType == 'messprogramm') { + // Dynamic Grids + // We need to set both grid and Store. + var frgrid; // The Resultgrid + var gridstore; // The Store which will be used in the resultgrid. + + switch (queryType) { + case 'probe': + gridstore = Ext.create('Lada.store.ProbenList'); + frgrid = Ext.create('Lada.view.grid.ProbeList'); + break; + case 'messprogramm': + gridstore = Ext.create('Lada.store.MessprogrammeList'); + frgrid = Ext.create('Lada.view.grid.MessprogrammeList'); + break; + } + + if (gridstore) { + frgrid.setStore(gridstore); + } + + contentPanel.add(frgrid); + } + else { + // Grids which are not build with dynamic columns + // The store is configured in each grid, hence we only need to set the + // grid + var resultGrid; + switch (queryType) { + case 'messprogrammkategorie': + resultGrid = Ext.create('Lada.view.grid.MessprogrammKategorie'); + break; + case 'datensatzerzeuger': + resultGrid = Ext.create('Lada.view.grid.DatensatzErzeuger'); + break; + case 'ort': + resultGrid = Ext.create('Lada.view.grid.Ort'); + break; + case 'probenehmer': + resultGrid = Ext.create('Lada.view.grid.Probenehmer'); + break; + } + if (resultGrid) { + contentPanel.add(resultGrid); + } + } + /* Setup Filters * * Allowed types are * * text @@ -188,12 +249,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(); @@ -205,15 +270,28 @@ } searchParams[filter.getName()] = value; } - // Retrieve the mode - var modes = element.up('panel[name=main]').down('radiogroup').getChecked(); - var sname = modes[0].inputValue; - if (sname === 'ProbeList') { - sname = 'Lada.store.ProbenList'; - } - else if (sname === 'MessprogrammList') { - sname = 'Lada.store.MessprogrammeList'; + //Store depends of the Type... + // TODO the switchcasese should be unified withj those in SelectSql + switch (type) { + case 'probe': + sname = 'Lada.store.ProbenList'; + break; + case 'messprogramm': + sname = 'Lada.store.MessprogrammeList'; + break; + case 'messprogrammkategorie': + sname = 'Lada.store.MessprogrammKategorie'; + break; + case 'datensatzerzeuger': + sname = 'Lada.store.DatensatzErzeuger'; + break; + case 'ort': + sname = 'Lada.store.Ort'; + break; + case 'probenehmer': + sname = 'Lada.store.Probenehmer'; + break; } // Find the store or create a new one. @@ -224,8 +302,16 @@ if (store) { store.addListener('beforeload', this.loadingAnimationOn, resultGrid); store.addListener('load', this.loadingAnimationOff, resultGrid); + resultGrid.setStore(store); - resultGrid.setupColumns(this.displayFields); + //TODO: Check if this is still necessary, as a Grid exists + // for each Type. + + if (resultGrid.isDynamic) { + //only the dynamic resultgrid can and needs to do the following: + resultGrid.setupColumns(this.displayFields); + } + resultGrid.getStore().proxy.extraParams = searchParams; resultGrid.getStore().load(); resultGrid.show();
--- a/app/controller/FilterResult.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/controller/FilterResult.js Wed Jan 20 17:33:33 2016 +0100 @@ -171,7 +171,7 @@ } var me = this; Ext.Ajax.request({ - url: 'lada-server/export/laf', + url: 'lada-server/data/export/laf', jsonData: {'proben': proben}, success: function(response) { var content = response.responseText;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/ModeSwitcher.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,93 @@ +/* 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 ModeSwitcher + * This controller handles all logic related to the ModeSwitch + */ +Ext.define('Lada.controller.ModeSwitcher', { + extend: 'Ext.app.Controller', + displayFields: null, + + requires: [ + 'Lada.store.MessprogrammQueries', + 'Lada.store.ProbeQueries', + 'Lada.store.StammdatenQueries' + ], + + /** + * Initialize this Controller + * It has 1 Listeners + * A checked ModeSwithch-Radiofield fired a 'check'-event + */ + init: function() { + this.control({ + 'radiofield[name=modeswitch]': { + check: this.switchModes + } + }); + this.callParent(arguments); + }, + + /** + * Function is called when the user selects a checkbox. + * according to the checkboxes inputValue, + * the function alters the store which was loaded by the + * filterpanels combobox, + */ + switchModes: function(field) { + var cbox = field.up('modeswitcher').up().down('combobox'); + filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]'); + filters.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); + } + } + } +});
--- a/app/controller/ProbenPlanungSwitcher.js Wed Jan 13 15:29:09 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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. - */ - -/** - * Controller for the ProbenPlanungSwitcher - * This controller handles all logic related to the PPS - */ -Ext.define('Lada.controller.ProbenPlanungSwitcher', { - extend: 'Ext.app.Controller', - displayFields: null, - - requires: [ - 'Lada.store.MessprogrammQueries', - 'Lada.store.ProbeQueries' - ], - - /** - * Initialize this Controller - * It has 1 Listeners - * A checked PPS-Radiofield fired a 'check'-event - */ - init: function() { - this.control({ - 'radiofield[name=ppswitch]': { - check: this.switchModes - } - }); - this.callParent(arguments); - }, - - /** - * Function is called when the user selects a checkbox. - * 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'; - } - else if (field.inputValue === 'ProbeList' && cbox) { - sname = 'Lada.store.ProbeQueries'; - gridsname = 'Lada.store.ProbenList'; - } - - - var store = Ext.StoreManager.lookup(sname); - - if (!store) { - store = Ext.create(sname, { - //Select first Item on Load - listeners: { - load: function(s){ - var records = new Array(); - records.push(store.getAt(0)); - - cbox.select(records[0]); - cbox.fireEvent('select', cbox, records); - } - } - }); - } - if (store) { - store.load(); - 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/Datensatzerzeuger.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,163 @@ +/* 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. + */ + +/** + * This is a controller for a grid of Datensatzerzeuger Stammdaten + */ +Ext.define('Lada.controller.grid.Datensatzerzeuger', { + extend: 'Ext.app.Controller', + + /** + * Inhitialize the controller + * It has 3 listeners + */ + init: function() { + this.control({ + 'datensatzerzeugergrid': { + edit: this.gridSave, + canceledit: this.cancelEdit, + select: this.activateButtons, + deselect: this.deactivateButtons + }, + 'datensatzerzeugergrid button[action=add]': { + click: this.add + }, + 'datensatzerzeugergrid button[action=delete]': { + click: this.remove + } + }); + }, + + /** + * This function is called when the grids roweditor saves + * the record. + * On success it refreshes the windows which contains the grid + * On failure it displays a message + */ + gridSave: function(editor, context) { + var i18n = Lada.getApplication().bundle; + context.record.save({ + success: function(record, response) { + //Do Nothing + }, + failure: function(record, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.save.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + } + }); + }, + + /** + * When the edit was canceled, + * the empty row might have been created by the roweditor is removed + */ + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + context.grid.getSelectionModel().deselect(context.record); + }, + + /** + * This function adds a new row to add a Datensatzerzeuger + */ + add: function(button) { + var record = Ext.create('Lada.model.DatensatzErzeuger'); + button.up('datensatzerzeugergrid').store.insert(0, record); + button.up('datensatzerzeugergrid').rowEditing.startEdit(0, 1); + }, + + /** + * A record can be removed from the grid with the remove + * function. It asks the user for confirmation + * If the removal was confirmed, it reloads the parent window on success, + * on failure, an error message is shown. + */ + remove: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + var i18n = Lada.getApplication().bundle; + //TODO: i18n + Ext.MessageBox.confirm(i18n.getMsg('delete'), + i18n.getMsg('confirmation.question'), + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + //DO NOTHING + }, + failure: function(request, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.response.body')); + } + } + }); + } + }); + grid.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) { + grid.down('button[action=delete]').disable(); + } + else { + if (!grid.getPlugin('rowedit').editing) { + //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').enable(); + } + //else turn them off again! + else { + this.buttonToggle(false, grid); + } + } + } +}); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/MessprogrammKategorie.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,163 @@ +/* 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. + */ + +/** + * This is a controller for a grid of MessprogrammKategorie Stammdaten + */ +Ext.define('Lada.controller.grid.MessprogrammKategorie', { + extend: 'Ext.app.Controller', + + /** + * Inhitialize the controller + * It has 3 listeners + */ + init: function() { + this.control({ + 'messprogrammkategoriegrid': { + edit: this.gridSave, + canceledit: this.cancelEdit, + select: this.activateButtons, + deselect: this.deactivateButtons + }, + 'messprogrammkategoriegrid button[action=add]': { + click: this.add + }, + 'messprogrammkategoriegrid button[action=delete]': { + click: this.remove + } + }); + }, + + /** + * This function is called when the grids roweditor saves + * the record. + * On success it refreshes the windows which contains the grid + * On failure it displays a message + */ + gridSave: function(editor, context) { + var i18n = Lada.getApplication().bundle; + context.record.save({ + success: function(record, response) { + //Do Nothing + }, + failure: function(record, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.save.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + } + }); + }, + + /** + * When the edit was canceled, + * the empty row might have been created by the roweditor is removed + */ + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + context.grid.getSelectionModel().deselect(context.record); + }, + + /** + * This function adds a new row to add a probenehmer + */ + add: function(button) { + var record = Ext.create('Lada.model.MessprogrammKategorie'); + button.up('messprogrammkategoriegrid').store.insert(0, record); + button.up('messprogrammkategoriegrid').rowEditing.startEdit(0, 1); + }, + + /** + * A record can be removed from the grid with the remove + * function. It asks the user for confirmation + * If the removal was confirmed, it reloads the parent window on success, + * on failure, an error message is shown. + */ + remove: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + var i18n = Lada.getApplication().bundle; + Ext.MessageBox.confirm(i18n.getMsg('delete'), + i18n.getMsg('confirmation.question'), + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + //DO NOTHING + }, + failure: function(request, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.response.body')); + } + } + }); + } + }); + grid.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) { + grid.down('button[action=delete]').disable(); + } + else { + if (!grid.getPlugin('rowedit').editing) { + //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').enable(); + } + //else turn them off again! + else { + this.buttonToggle(false, grid); + } + } + }, +}); + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/MessprogrammeList.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,145 @@ +/* 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, + select: this.activateButtons, + deselect: this.deactivateButtons + }, + '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 + }); + } + }, + + /** + * 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) { + grid.down('button[action=genProbenFromMessprogramm]').disable(); + } + else { + grid.down('button[action=genProbenFromMessprogramm]').enable(); + } + }, + + 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 Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,342 @@ +/* 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, + select: this.activateButtons, + deselect: this.deactivateButtons + }, + '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/data/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')); + } + } + }); + }, + + /** + * 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) { + grid.down('button[action=export]').disable(); + grid.down('button[action=print]').disable(); + } + else { + grid.down('button[action=export]').enable(); + grid.down('button[action=print]').enable(); + } + }, + + reload: function(btn) { + if (btn === 'yes') { + location.reload(); + } + } +});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/Probenehmer.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,162 @@ +/* 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. + */ + +/** + * This is a controller for a grid of Probenehmer Stammdaten + */ +Ext.define('Lada.controller.grid.Probenehmer', { + extend: 'Ext.app.Controller', + + /** + * Inhitialize the controller + * It has 3 listeners + */ + init: function() { + this.control({ + 'probenehmergrid': { + edit: this.gridSave, + canceledit: this.cancelEdit, + select: this.activateButtons, + deselect: this.deactivateButtons + }, + 'probenehmergrid button[action=add]': { + click: this.add + }, + 'probenehmergrid button[action=delete]': { + click: this.remove + } + }); + }, + + /** + * This function is called when the grids roweditor saves + * the record. + * On success it refreshes the windows which contains the grid + * On failure it displays a message + */ + gridSave: function(editor, context) { + var i18n = Lada.getApplication().bundle; + context.record.save({ + success: function(record, response) { + //Do Nothing + }, + failure: function(record, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.save.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + } + }); + }, + + /** + * When the edit was canceled, + * the empty row might have been created by the roweditor is removed + */ + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + context.grid.getSelectionModel().deselect(context.record); + }, + + /** + * This function adds a new row to add a probenehmer + */ + add: function(button) { + var record = Ext.create('Lada.model.Probenehmer'); + button.up('probenehmergrid').store.insert(0, record); + button.up('probenehmergrid').rowEditing.startEdit(0, 1); + }, + + /** + * A record can be removed from the grid with the remove + * function. It asks the user for confirmation + * If the removal was confirmed, it reloads the parent window on success, + * on failure, an error message is shown. + */ + remove: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + var i18n = Lada.getApplication().bundle; + Ext.MessageBox.confirm(i18n.getMsg('delete'), + i18n.getMsg('confirmation.question'), + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + //DO NOTHING + }, + failure: function(request, response) { + var json = response.request.scope.reader.jsonData; + if (json) { + if (json.message){ + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title') + +' #'+json.message, + i18n.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'), + i18n.getMsg('err.msg.response.body')); + } + } + }); + } + }); + grid.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) { + grid.down('button[action=delete]').disable(); + } + else { + if (!grid.getPlugin('rowedit').editing) { + //only enable buttons, when grid is not beeing edited + grid.down('button[action=delete]').enable(); + } + //else turn them off again! + else { + this.buttonToggle(false, grid); + } + } + }, +}); +
--- a/app/controller/grid/Status.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/controller/grid/Status.js Wed Jan 20 17:33:33 2016 +0100 @@ -162,7 +162,7 @@ } Ext.Ajax.request({ - url: 'lada-server/status', + url: 'lada-server/rest/status', jsonData: record.getData(), method: 'POST', success: function(response) {
--- a/app/model/Datenbasis.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Datenbasis.js Wed Jan 20 17:33:33 2016 +0100 @@ -30,7 +30,7 @@ proxy: { type: 'rest', - url: 'lada-server/datenbasis', + url: 'lada-server/rest/datenbasis', reader: { type: 'json', root: 'data'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/DatensatzErzeuger.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,64 @@ +/* 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/rest/datensatzerzeuger', + reader: { + type: 'json', + root: 'data' + } + } +});
--- a/app/model/Deskriptor.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Deskriptor.js Wed Jan 20 17:33:33 2016 +0100 @@ -26,7 +26,7 @@ proxy: { type: 'rest', - url: 'lada-server/deskriptor', + url: 'lada-server/rest/deskriptor', reader: { type: 'json', root: 'data',
--- a/app/model/Location.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Location.js Wed Jan 20 17:33:33 2016 +0100 @@ -55,7 +55,7 @@ proxy: { type: 'rest', - url: 'lada-server/location', + url: 'lada-server/rest/location', reader: { type: 'json', root: 'data'
--- a/app/model/MKommentar.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/MKommentar.js Wed Jan 20 17:33:33 2016 +0100 @@ -42,7 +42,7 @@ proxy: { type: 'rest', - url: 'lada-server/mkommentar', + url: 'lada-server/rest/mkommentar', reader: { type: 'json', root: 'data'
--- a/app/model/Messeinheit.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messeinheit.js Wed Jan 20 17:33:33 2016 +0100 @@ -36,7 +36,7 @@ proxy: { type: 'rest', - url: 'lada-server/messeinheit', + url: 'lada-server/rest/messeinheit', reader: { type: 'json', root: 'data'
--- a/app/model/Messmethode.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messmethode.js Wed Jan 20 17:33:33 2016 +0100 @@ -37,7 +37,7 @@ proxy: { type: 'rest', - url: 'lada-server/messmethode', + url: 'lada-server/rest/messmethode', reader: { type: 'json', root: 'data'
--- a/app/model/Messprogramm.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messprogramm.js Wed Jan 20 17:33:33 2016 +0100 @@ -132,7 +132,7 @@ proxy: { type: 'rest', - url: 'lada-server/messprogramm', //not yet implemented + url: 'lada-server/rest/messprogramm', reader: { type: 'json', root: 'data'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/MessprogrammKategorie.js Wed Jan 20 17:33:33 2016 +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 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/rest/messprogrammkategorie', + reader: { + type: 'json', + root: 'data' + } + } +});
--- a/app/model/MessprogrammList.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/MessprogrammList.js Wed Jan 20 17:33:33 2016 +0100 @@ -21,7 +21,7 @@ proxy: { type: 'rest', - url: 'lada-server/messprogramm', + url: 'lada-server/rest/messprogramm', reader: { type: 'json', root: 'data',
--- a/app/model/Messstelle.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messstelle.js Wed Jan 20 17:33:33 2016 +0100 @@ -39,7 +39,7 @@ proxy: { type: 'rest', - url: 'lada-server/messstelle', + url: 'lada-server/rest/messstelle', reader: { type: 'json', root: 'data'
--- a/app/model/Messung.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messung.js Wed Jan 20 17:33:33 2016 +0100 @@ -82,7 +82,7 @@ proxy: { type: 'rest', - url: 'lada-server/messung', + url: 'lada-server/rest/messung', reader: { type: 'json', root: 'data'
--- a/app/model/Messwert.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Messwert.js Wed Jan 20 17:33:33 2016 +0100 @@ -79,7 +79,7 @@ proxy: { type: 'rest', - url: 'lada-server/messwert', + url: 'lada-server/rest/messwert', reader: { type: 'json', root: 'data'
--- a/app/model/MmtMessprogramm.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/MmtMessprogramm.js Wed Jan 20 17:33:33 2016 +0100 @@ -37,7 +37,7 @@ proxy: { type: 'rest', - url: 'lada-server/messprogrammmmt', + url: 'lada-server/rest/messprogrammmmt', reader: { type: 'json', root: 'data'
--- a/app/model/Netzbetreiber.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Netzbetreiber.js Wed Jan 20 17:33:33 2016 +0100 @@ -42,7 +42,7 @@ proxy: { type: 'rest', - url: 'lada-server/netzbetreiber', + url: 'lada-server/rest/netzbetreiber', reader: { type: 'json', root: 'data'
--- a/app/model/Ort.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Ort.js Wed Jan 20 17:33:33 2016 +0100 @@ -60,7 +60,7 @@ proxy: { type: 'rest', - url: 'lada-server/ort', + url: 'lada-server/rest/ort', reader: { type: 'json', root: 'data'
--- a/app/model/PKommentar.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/PKommentar.js Wed Jan 20 17:33:33 2016 +0100 @@ -42,7 +42,7 @@ proxy: { type: 'rest', - url: 'lada-server/pkommentar', + url: 'lada-server/rest/pkommentar', reader: { type: 'json', root: 'data'
--- a/app/model/Pflichtmessgroesse.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Pflichtmessgroesse.js Wed Jan 20 17:33:33 2016 +0100 @@ -36,7 +36,7 @@ proxy: { type: 'rest', - url: 'lada-server/pflichtmessgroesse', + url: 'lada-server/rest/pflichtmessgroesse', reader: { type: 'json', root: 'data'
--- a/app/model/Probe.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Probe.js Wed Jan 20 17:33:33 2016 +0100 @@ -141,7 +141,7 @@ proxy: { type: 'rest', - url: 'lada-server/probe', + url: 'lada-server/rest/probe', reader: { type: 'json', root: 'data'
--- a/app/model/ProbeList.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/ProbeList.js Wed Jan 20 17:33:33 2016 +0100 @@ -23,7 +23,7 @@ proxy: { type: 'rest', - url: 'lada-server/probe', + url: 'lada-server/rest/probe', reader: { type: 'json', root: 'data',
--- a/app/model/Probenart.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Probenart.js Wed Jan 20 17:33:33 2016 +0100 @@ -33,7 +33,7 @@ proxy: { type: 'rest', - url: 'lada-server/probenart', + url: 'lada-server/rest/probenart', reader: { type: 'json', root: 'data'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/Probenehmer.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,80 @@ +/* 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/rest/probenehmer', + reader: { + type: 'json', + root: 'data' + } + } +});
--- a/app/model/Probenzusatz.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Probenzusatz.js Wed Jan 20 17:33:33 2016 +0100 @@ -44,7 +44,7 @@ proxy: { type: 'rest', - url: 'lada-server/probenzusatz', + url: 'lada-server/rest/probenzusatz', reader: { type: 'json', root: 'data'
--- a/app/model/Query.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Query.js Wed Jan 20 17:33:33 2016 +0100 @@ -24,5 +24,7 @@ name: 'results' }, { name: 'filters' + }, { + name: 'type' }] });
--- a/app/model/Staat.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Staat.js Wed Jan 20 17:33:33 2016 +0100 @@ -27,7 +27,7 @@ proxy: { type: 'rest', - url: 'lada-server/staat', + url: 'lada-server/rest/staat', reader: { type: 'json', root: 'data'
--- a/app/model/Status.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Status.js Wed Jan 20 17:33:33 2016 +0100 @@ -65,7 +65,7 @@ proxy: { type: 'rest', - url: 'lada-server/status', + url: 'lada-server/rest/status', reader: { type: 'json', root: 'data'
--- a/app/model/StatusStufe.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/StatusStufe.js Wed Jan 20 17:33:33 2016 +0100 @@ -23,7 +23,7 @@ proxy: { type: 'rest', - url: 'lada-server/statusstufe', + url: 'lada-server/rest/statusstufe', reader: { type: 'json', root: 'data'
--- a/app/model/StatusWerte.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/StatusWerte.js Wed Jan 20 17:33:33 2016 +0100 @@ -23,7 +23,7 @@ proxy: { type: 'rest', - url: 'lada-server/statuswert', + url: 'lada-server/rest/statuswert', reader: { type: 'json', root: 'data'
--- a/app/model/Umwelt.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Umwelt.js Wed Jan 20 17:33:33 2016 +0100 @@ -33,7 +33,7 @@ proxy: { type: 'rest', - url: 'lada-server/umwelt', + url: 'lada-server/rest/umwelt', reader: { type: 'json', root: 'data'
--- a/app/model/Verwaltungseinheit.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Verwaltungseinheit.js Wed Jan 20 17:33:33 2016 +0100 @@ -57,7 +57,7 @@ proxy: { type: 'rest', - url: 'lada-server/verwaltungseinheit', + url: 'lada-server/rest/verwaltungseinheit', reader: { type: 'json', root: 'data'
--- a/app/model/Zusatzwert.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/model/Zusatzwert.js Wed Jan 20 17:33:33 2016 +0100 @@ -66,7 +66,7 @@ proxy: { type: 'rest', - url: 'lada-server/zusatzwert', + url: 'lada-server/rest/zusatzwert', reader: { type: 'json', root: 'data'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/DatensatzErzeuger.js Wed Jan 20 17:33:33 2016 +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', +});
--- a/app/store/Messgroessen.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/store/Messgroessen.js Wed Jan 20 17:33:33 2016 +0100 @@ -26,7 +26,7 @@ proxy: { type: 'rest', - url: 'lada-server/messgroesse', + url: 'lada-server/rest/messgroesse', reader: { type: 'json', root: 'data'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/MessprogrammKategorie.js Wed Jan 20 17:33:33 2016 +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 Wed Jan 13 15:29:09 2016 +0100 +++ b/app/store/MessprogrammQueries.js Wed Jan 20 17:33:33 2016 +0100 @@ -12,10 +12,10 @@ 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', + url: 'lada-server/rest/query/messprogramm', reader: { type: 'json', root: 'data'
--- a/app/store/MessprogrammeList.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/store/MessprogrammeList.js Wed Jan 20 17:33:33 2016 +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/ProbeQueries.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/store/ProbeQueries.js Wed Jan 20 17:33:33 2016 +0100 @@ -15,7 +15,7 @@ autoLoad: true, proxy: { type: 'rest', - url: 'lada-server/query/probe', + url: 'lada-server/rest/query/probe', reader: { type: 'json', root: 'data'
--- a/app/store/ProbenList.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/store/ProbenList.js Wed Jan 20 17:33:33 2016 +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 Jan 20 17:33:33 2016 +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 Jan 20 17:33:33 2016 +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: 'rest', + url: 'lada-server/rest/query/stammdaten', + reader: { + type: 'json', + root: 'data' + } + } +}); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/ModeSwitcher.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,66 @@ +/* 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. + */ + +/** + * This is a Widget for a ModeSwitcher + */ +Ext.define('Lada.view.ModeSwitcher', { + extend: 'Ext.form.FieldSet', + alias: 'widget.modeswitcher', + + mixins: { + observable: 'Ext.util.Observable' + }, + /** + * Initialise the Widget. + * When the Checkbox is checked, it fires a 'check' Event + */ + initComponent: function() { + var i18n = Lada.getApplication().bundle; + this.title = i18n.getMsg('modus'); + this.items= [{ + xtype: 'radiogroup', + columns: 1, + width: '100%', + items: [{ + xtype: 'radiofield', + name: 'modeswitch', + 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) { + this.fireEvent('check', field); + } + } + },{ + xtype: 'radiofield', + name: 'modeswitch', + boxLabel: i18n.getMsg('messprogramme'), + inputValue: 'messprogramme', + handler: function(field, state){ + if (state === true) { + this.fireEvent('check', field); + } + } + },{ + xtype: 'radiofield', + name: 'modeswitch', + boxLabel: i18n.getMsg('stammdaten'), + inputValue: 'stammdaten', + handler: function(field, state){ + if (state === true) { + this.fireEvent('check', field); + } + } + }] + }]; + this.callParent(arguments); + } +});
--- a/app/view/ProbenPlanungSwitcher.js Wed Jan 13 15:29:09 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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. - */ - -/** - * This is a Widget for a ProbenPlanungSwitcher - */ -Ext.define('Lada.view.ProbenPlanungSwitcher', { - extend: 'Ext.form.FieldSet', - alias: 'widget.probenplanungswitcher', - - mixins: { - observable: 'Ext.util.Observable' - }, - /** - * Initialise the Widget. - * When the Checkbox is checked, it fires a 'check' Event - */ - initComponent: function() { - var i18n = Lada.getApplication().bundle; - this.title = i18n.getMsg('modus'); - this.items= [{ - xtype: 'radiogroup', - columns: 1, - width: '100%', - items: [{ - xtype: 'radiofield', - name: 'ppswitch', - boxLabel: i18n.getMsg('probelist'), - inputValue: 'ProbeList', //this determines the store - // which will be loaded, - checked: true, - handler: function(field, state){ - if (state === true) { - this.fireEvent('check', field); - } - } - },{ - xtype: 'radiofield', - name: 'ppswitch', - boxLabel: i18n.getMsg('probeplanning'), - inputValue: 'MessprogrammList', //name of a store - handler: function(field, state){ - if (state === true) { - this.fireEvent('check', field); - } - } - }] - }]; - this.callParent(arguments); - } -});
--- a/app/view/Viewport.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/view/Viewport.js Wed Jan 20 17:33:33 2016 +0100 @@ -16,9 +16,8 @@ Ext.define('Lada.view.Viewport', { extend: 'Ext.container.Viewport', requires: [ - 'Lada.view.ProbenPlanungSwitcher', - 'Lada.view.FilterPanel', - 'Lada.view.grid.FilterResult' + 'Lada.view.ModeSwitcher', + 'Lada.view.FilterPanel' ], layout: 'fit', initComponent: function() { @@ -34,7 +33,6 @@ }, region: 'west', split: true, - border: 1, flex: 1, dockedItems: [{ xtype: 'toolbar', @@ -60,7 +58,7 @@ }] }], items: [{ - xtype: 'probenplanungswitcher', + xtype: 'modeswitcher', margin: '0, 10, 0, 10' }, { // Auswahl einer Abfrage. @@ -76,9 +74,10 @@ items: [] }] }, { - // Resultlist for the query. + xtype: 'panel', + 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 Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,157 @@ +/* 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, + border: false, + + 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]; + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('de.gridTitle') + }, + '->', + { + text: i18n.getMsg('de.button.add'), + icon: 'resources/img/list-add.png', + action: 'add', + disabled: true // disabled on startup, will be enabled by setStore + }, { + text: i18n.getMsg('de.button.delete'), + icon: 'resources/img/list-remove.png', + action: 'delete', + disabled: true // disabled on startup, will be enabled by controller if necessary + }] + }]; + + 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('bezeichnung'), + dataIndex: 'bezeichnung', + editor: { + allowBlank: false, + xtype: 'textfield' + } + }, { + 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('messstellen'), + 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; + + if (store) { + this.removeDocked(Ext.getCmp('ptbar'), true); + this.reconfigure(store); + this.down('button[action=add]').enable(); + this.addDocked([{ + xtype: 'pagingtoolbar', + id: 'ptbar', + dock: 'bottom', + store: store, + displayInfo: true + }]); + } + } +});
--- a/app/view/grid/FilterResult.js Wed Jan 13 15:29:09 2016 +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 Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,131 @@ +/* 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, + border: false, + + initComponent: function() { + 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]; + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('mk.gridTitle') + }, + '->', + { + text: i18n.getMsg('mk.button.add'), + icon: 'resources/img/list-add.png', + action: 'add', + disabled: true // disabled on startup, will be enabled by setStore + }, { + text: i18n.getMsg('mk.button.delete'), + icon: 'resources/img/list-remove.png', + action: 'delete', + disabled: true // disabled on startup, will be enabled by controller if necessary + }] + }]; + + 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 Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,47 @@ +/* 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', + disabled: true // disabled on startup, will be enabled by controller if necessary + }] + }]; + this.columns = []; + this.callParent(arguments); + } +}); + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/ProbeList.js Wed Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,103 @@ +/* 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', + disabled: true //disabled on start, enabled by the controller + }, { + text: i18n.getMsg('probe.button.print'), + icon: 'resources/img/printer.png', + action: 'print', + disabled: true //disabled on start, enabled by the controller + }] + }]; + 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 Jan 20 17:33:33 2016 +0100 @@ -0,0 +1,187 @@ +/* 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, + border: false, + + initComponent: function() { + 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]; + + // TODO: Which docked Items are required? + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'top', + items: [{ + xtype: 'tbtext', + id: 'tbtitle', + text: i18n.getMsg('pn.gridTitle') + }, + '->', + { + text: i18n.getMsg('pn.button.add'), + icon: 'resources/img/list-add.png', + action: 'add', + disabled: true // disabled on startup, will be enabled by setStore + }, { + text: i18n.getMsg('pn.button.delete'), + icon: 'resources/img/list-remove.png', + action: 'delete', + disabled: true // disabled on startup, will be enabled by controller if necessary + }] + }]; + 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, + xtype: 'textfield' + } + }, { + header: i18n.getMsg('kurzBezeichnung'), + dataIndex: 'kurzBezeichnung', + editor: { + 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: { + 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.callParent(arguments); + }, + + /** + * This sets the Store of this Grid + */ + setStore: function(store){ + var i18n = Lada.getApplication().bundle; + + if (store) { + this.removeDocked(Ext.getCmp('ptbar'), true); + this.reconfigure(store); + this.down('button[action=add]').enable(); + 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/widget/DynamicGrid.js Wed Jan 20 17:33:33 2016 +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. + */ + +/** + * Grid to list the result of the Filter + */ +Ext.define('Lada.view.widget.DynamicGrid', { + extend: 'Ext.grid.Panel', + + store: null, + + border: false, + multiSelect: true, + allowDeselect: true, + + isDynamic: 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/app/view/window/DeleteProbe.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/view/window/DeleteProbe.js Wed Jan 20 17:33:33 2016 +0100 @@ -50,8 +50,7 @@ handler: function() { Ext.Ajax.request({ - //TODO Use correct URLs - url: 'lada-server/probe/'+me.record.get('id'), + url: 'lada-server/rest/probe/'+me.record.get('id'), method: 'DELETE', success: function(response) { var json = Ext.JSON.decode(response.responseText);
--- a/app/view/window/FileUpload.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/view/window/FileUpload.js Wed Jan 20 17:33:33 2016 +0100 @@ -82,7 +82,7 @@ 'X-OPENID-PARAMS': Lada.openIDParams }, method: 'POST', - url: 'lada-server/import/laf' + url: 'lada-server/data/import/laf' }); this.mon(uploader, 'uploadsuccess', win.uploadSuccess, win); this.mon(uploader, 'uploadfailure', win.uploadFailure, win);
--- a/app/view/window/GenProbenFromMessprogramm.js Wed Jan 13 15:29:09 2016 +0100 +++ b/app/view/window/GenProbenFromMessprogramm.js Wed Jan 20 17:33:33 2016 +0100 @@ -56,7 +56,7 @@ Ext.Ajax.request({ - url: 'lada-server/probe/messprogramm', + url: 'lada-server/rest/probe/messprogramm', method: 'POST', jsonData: jsondata, success: function(response) {
--- a/resources/i18n/Lada_de-DE.properties Wed Jan 13 15:29:09 2016 +0100 +++ b/resources/i18n/Lada_de-DE.properties Wed Jan 20 17:33:33 2016 +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,6 +140,8 @@ messprogtimeperiod:für den Zeitraum select:Auswählen apply:Übernehmen +action:Aktion +remove:Entfernen reset:Zurücksetzen error: Fehler @@ -129,6 +150,9 @@ 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 + +confirmation.question: Sind Sie sich sicher? ## Statusgrid statusgrid.emptyText: Keine Statusangaben gefunden. @@ -170,3 +194,45 @@ 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 +de.button.add:Datensatzerzeuger hinzufügen +de.button.delete:Datensatzerzeuger löschen + +## +# MessprogrammKategorie Grid: +## +mk.emptyGrid:Keine Messprogrammkategorie gefunden. +mk.gridTitle:Messprogramm Kategorien +mk.button.add:Kategorie hinzufügen +mk.button.delete:Kategorie löschen + +## +# Probenehmer Grid: +## +pn.emptyGrid:Keine Probenehmer gefunden. +pn.gridTitle:Probenehmer +pn.button.add:Probenehmer hinzufügen +pn.button.delete:Probenehmer löschen