# HG changeset patch # User Raimund Renkert # Date 1426771867 -3600 # Node ID 39dd18124ebd454e0a000223eab339bb5a2cff2c # Parent 74cc7f086d8364d34852514a350bb1d220448568# Parent 8756f7e423fbe1afd957898f9d9048adc1c52f47 Merged branch openid back to default. diff -r 8756f7e423fb -r 39dd18124ebd .hgtags --- a/.hgtags Thu Mar 19 14:30:06 2015 +0100 +++ b/.hgtags Thu Mar 19 14:31:07 2015 +0100 @@ -28,3 +28,4 @@ fa2a7a37a2487a8e40ddfa1da062ae2cb2347b93 1.0 a9184ba5ee173cc1f96666643ae71bae2d61983c 1.0 7c9475119861ebfd4c2f6ee25a5f053aa13b2af7 mockup-1.1 +9f557bd48c30c828619d12fbc4c755ac5c34a420 2.0-alpha1 diff -r 8756f7e423fb -r 39dd18124ebd app.js --- a/app.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app.js Thu Mar 19 14:31:07 2015 +0100 @@ -9,10 +9,6 @@ Ext.Loader.setConfig({ enabled: true, paths: { - 'Ext.ux.form.DateTimeField': 'resources/lib/datetime/UX_DateTimeField.js', - 'Ext.ux.DateTimeMenu': 'resources/lib/datetime/UX_DateTimeMenu.js', - 'Ext.ux.DateTimePicker': 'resources/lib/datetime/UX_DateTimePicker.js', - 'Ext.ux.form.TimePickerField': 'resources/lib/datetime/UX_TimePickerField.js', 'Ext.i18n': 'resources/lib/i18n/' } }); @@ -154,6 +150,7 @@ 'Lada.controller.Filter', 'Lada.controller.FilterResult', 'Lada.controller.form.Probe', + 'Lada.controller.form.Messung', 'Lada.controller.form.Ort', 'Lada.controller.grid.Ort', 'Lada.controller.grid.Probenzusatzwert', @@ -161,6 +158,8 @@ 'Lada.controller.grid.MKommentar', 'Lada.controller.grid.Messung', 'Lada.controller.grid.Messwert', - 'Lada.controller.grid.Status' + 'Lada.controller.grid.Status', + 'Lada.controller.Map', + 'Lada.controller.form.Location' ] }); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/Filter.js --- a/app/controller/Filter.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/Filter.js Thu Mar 19 14:31:07 2015 +0100 @@ -197,9 +197,8 @@ } searchParams[filter.getName()] = value; } - resultGrid.getStore().load({ - params: searchParams - }); + resultGrid.getStore().proxy.extraParams = searchParams; + resultGrid.getStore().load(); resultGrid.show(); }, diff -r 8756f7e423fb -r 39dd18124ebd app/controller/FilterResult.js --- a/app/controller/FilterResult.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/FilterResult.js Thu Mar 19 14:31:07 2015 +0100 @@ -42,6 +42,9 @@ }, addItem: function(button) { + var win = Ext.create('Lada.view.window.ProbeCreate'); + win.show(); + win.initData(); }, diff -r 8756f7e423fb -r 39dd18124ebd app/controller/Map.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/Map.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,35 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/** + */ +Ext.define('Lada.controller.Map', { + extend: 'Ext.app.Controller', + + requires: [ + ], + + init: function() { + this.control({ + 'maptoolbar button[action=add]': { + click: this.addLocation + } + }); + this.callParent(arguments); + }, + + addLocation: function(button) { + var mapPanel = button.up('map'); + var details = button.up('window').down('locationform'); + var newLocation = Ext.create('Lada.model.Location'); + details.setRecord(newLocation); + details.setReadOnly(false); + + mapPanel.activateDraw(newLocation); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/form/Location.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/form/Location.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,106 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.controller.form.Location', { + extend: 'Ext.app.Controller', + + init: function() { + this.control({ + 'locationform button[action=save]': { + click: this.save + }, + 'locationform button[action=discard]': { + click: this.discard + }, + 'locationform': { + dirtychange: this.dirtyForm + }, + 'locationform numberfield[name=latitude]': { + change: this.updateFeatureLatitude + }, + 'locationform numberfield[name=longitude]': { + change: this.updateFeatureLongitude, + } + }); + }, + + save: function(button) { + var formPanel = button.up('form'); + var data = formPanel.getForm().getFieldValues(true); + for (var key in data) { + formPanel.getForm().getRecord().set(key, data[key]); + } + formPanel.getForm().getRecord().save({ + success: function(record, response) { + var json = Ext.decode(response.response.responseText); + if (json) { + button.setDisabled(true); + button.up('toolbar').down('button[action=discard]') + .setDisabled(true); + formPanel.clearMessages(); + formPanel.setRecord(record); + formPanel.setMessages(json.errors, json.warnings); + button.up('window').down('map').locationRecord = null; + var orte = button.up('window').down('ortform combobox'); + orte.store.reload({ + callback: function() { + orte.setValue(record.data.id); + } + }); + } + }, + failure: function(record, response) { + button.setDisabled(true); + button.up('toolbar').down('button[action=discard]') + .setDisabled(true); + formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + var json = response.request.scope.reader.jsonData; + if (json) { + formPanel.setMessages(json.errors, json.warnings); + } + } + }); + }, + + discard: function(button) { + var formPanel = button.up('form'); + formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + button.up('window').down('map').locationRecord = null; + }, + + dirtyForm: function(form, dirty) { + if (dirty) { + form.owner.down('button[action=save]').setDisabled(false); + form.owner.down('button[action=discard]').setDisabled(false); + } + else { + form.owner.down('button[action=save]').setDisabled(true); + form.owner.down('button[action=discard]').setDisabled(true); + } + }, + + updateFeatureLatitude: function(field, nValue) { + var layer = field.up('window').down('map').selectControl.layer; + var newLocation = field.up('window').down('map').locationRecord; + if (layer && layer.selectedFeatures[0] && newLocation) { + var feature = layer.getFeatureById(layer.selectedFeatures[0].id); + feature.move(new OpenLayers.LonLat(feature.geometry.x, nValue)); + layer.refresh(); + } + }, + + updateFeatureLongitude: function(field, nValue) { + var layer = field.up('window').down('map').selectControl.layer; + var newLocation = field.up('window').down('map').locationRecord; + if (layer && layer.selectedFeatures[0] && newLocation) { + var feature = layer.getFeatureById(layer.selectedFeatures[0].id); + feature.move(new OpenLayers.LonLat(nValue, feature.geometry.y)); + layer.refresh(); + } + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/form/Messung.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/form/Messung.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,82 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.controller.form.Messung', { + extend: 'Ext.app.Controller', + + init: function() { + this.control({ + 'messungform button[action=save]': { + click: this.save + }, + 'messungform button[action=discard]': { + click: this.discard + }, + 'messungform': { + dirtychange: this.dirtyForm + } + }); + }, + + save: function(button) { + var formPanel = button.up('form'); + var data = formPanel.getForm().getFieldValues(true); + for (var key in data) { + formPanel.getForm().getRecord().set(key, data[key]); + } + formPanel.getForm().getRecord().save({ + success: function(record, response) { + var json = Ext.decode(response.response.responseText); + if (json) { + button.setDisabled(true); + button.up('toolbar').down('button[action=discard]') + .setDisabled(true); + formPanel.clearMessages(); + formPanel.setRecord(record); + formPanel.setMessages(json.errors, json.warnings); + formPanel.up('window').grid.store.reload(); + if (response.action === 'create' && json.success) { + button.up('window').close(); + var win = Ext.create('Lada.view.window.MessungEdit', { + record: record + }); + win.show(); + win.initData(); + } + } + }, + failure: function(record, response) { + button.setDisabled(true); + button.up('toolbar').down('button[action=discard]') + .setDisabled(true); + formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + var json = response.request.scope.reader.jsonData; + if (json) { + formPanel.setMessages(json.errors, json.warnings); + } + } + }); + console.log('save'); + }, + + discard: function(button) { + var formPanel = button.up('form'); + formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + }, + + dirtyForm: function(form, dirty) { + if (dirty) { + form.owner.down('button[action=save]').setDisabled(false); + form.owner.down('button[action=discard]').setDisabled(false); + } + else { + form.owner.down('button[action=save]').setDisabled(true); + form.owner.down('button[action=discard]').setDisabled(true); + } + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/form/Ort.js --- a/app/controller/form/Ort.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/form/Ort.js Thu Mar 19 14:31:07 2015 +0100 @@ -27,7 +27,7 @@ }, save: function(button) { - var formPanel = button.up('form'); + var formPanel = button.up('ortform'); var data = formPanel.getForm().getFieldValues(true); for (var key in data) { formPanel.getForm().getRecord().set(key, data[key]); @@ -35,15 +35,14 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true); formPanel.clearMessages(); formPanel.setRecord(record); formPanel.setMessages(json.errors, json.warnings); + formPanel.up('window').grid.store.reload(); } }, failure: function(record, response) { @@ -57,12 +56,16 @@ } } }); - console.log('save'); }, discard: function(button) { var formPanel = button.up('form'); formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + var win = button.up('window'); + var id = formPanel.getForm().getRecord().get('ort'); + var toLoad = Ext.data.StoreManager.get('locations').getById(id); + win.down('locationform').setRecord(toLoad); + win.down('map').selectFeature(id); }, dirtyForm: function(form, dirty) { @@ -77,20 +80,13 @@ }, updateDetails: function(combobox, record) { - console.log(record); var win = combobox.up('window'); var details = win.down('locationform'); var id = record[0].get('id'); if (details) { - Ext.ClassManager.get('Lada.model.Location').load(id, { - failure: function(record, action) { - // TODO - }, - success: function(record, response) { - win.down('locationform').setRecord(record); - }, - scope: this - }); + var toLoad = Ext.data.StoreManager.get('locations').getById(id); + win.down('locationform').setRecord(toLoad); + win.down('map').selectFeature(id); } } }); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/form/Probe.js --- a/app/controller/form/Probe.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/form/Probe.js Thu Mar 19 14:31:07 2015 +0100 @@ -32,15 +32,21 @@ formPanel.getForm().getRecord().save({ success: function(record, response) { var json = Ext.decode(response.response.responseText); - if (response.action !== 'create' && - json && - json.success) { + if (json) { button.setDisabled(true); button.up('toolbar').down('button[action=discard]') .setDisabled(true); formPanel.clearMessages(); formPanel.setRecord(record); formPanel.setMessages(json.errors, json.warnings); + if (response.action === 'create' && json.success) { + button.up('window').close(); + var win = Ext.create('Lada.view.window.ProbeEdit', { + record: record + }); + win.show(); + win.initData(); + } } }, failure: function(record, response) { diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/MKommentar.js --- a/app/controller/grid/MKommentar.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/MKommentar.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'mkommentargrid': { - edit: this.edit + edit: this.edit, + canceledit: this.cancelEdit }, 'mkommentargrid button[action=add]': { click: this.add @@ -35,6 +36,13 @@ }); }, + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + }, + add: function(button) { var record = Ext.create('Lada.model.MKommentar'); record.set('messungsId', button.up('mkommentargrid').recordId); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/Messung.js --- a/app/controller/grid/Messung.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/Messung.js Thu Mar 19 14:31:07 2015 +0100 @@ -32,15 +32,21 @@ editItem: function(grid, record) { var win = Ext.create('Lada.view.window.MessungEdit', { - record: record + record: record, + grid: grid }); win.show(); win.initData(); }, - add: function() { - // TODO - console.log('add'); + add: function(button) { + var probe = button.up('window').record; + var win = Ext.create('Lada.view.window.MessungCreate', { + record: probe, + grid: button.up('messunggrid') + }); + win.show(); + win.initData(); }, remove: function(button) { @@ -59,6 +65,7 @@ } }); } - }); + } + ); } }); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/Messwert.js --- a/app/controller/grid/Messwert.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/Messwert.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'messwertgrid': { - edit: this.gridSave + edit: this.gridSave, + canceledit: this.cancelEdit }, 'messwertgrid button[action=add]': { click: this.add @@ -35,6 +36,13 @@ }); }, + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + }, + add: function(button) { var record = Ext.create('Lada.model.Messwert', { messungsId: button.up('messwertgrid').recordId diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/Ort.js --- a/app/controller/grid/Ort.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/Ort.js Thu Mar 19 14:31:07 2015 +0100 @@ -10,7 +10,8 @@ extend: 'Ext.app.Controller', requires: [ - 'Lada.view.window.OrtEdit' + 'Lada.view.window.OrtEdit', + 'Lada.view.window.OrtCreate' ], init: function() { @@ -29,15 +30,21 @@ open: function(grid, record) { var win = Ext.create('Lada.view.window.OrtEdit', { - record: record + record: record, + grid: grid }); win.show(); win.initData(); }, - add: function() { - // todo - console.log('add'); + add: function(button) { + var probe = button.up('window').record; + var win = Ext.create('Lada.view.window.OrtCreate', { + record: probe, + grid: button.up('ortgrid') + }); + win.show(); + win.initData(); }, remove: function(button) { diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/PKommentar.js --- a/app/controller/grid/PKommentar.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/PKommentar.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'pkommentargrid': { - edit: this.edit + edit: this.edit, + canceledit: this.cancelEdit }, 'pkommentargrid button[action=add]': { click: this.add @@ -35,6 +36,13 @@ }); }, + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + }, + add: function(button) { var record = Ext.create('Lada.model.PKommentar'); record.set('probeId', button.up('pkommentargrid').recordId); diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/Probenzusatzwert.js --- a/app/controller/grid/Probenzusatzwert.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/Probenzusatzwert.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'probenzusatzwertgrid': { - edit: this.gridSave + edit: this.gridSave, + canceledit: this.cancelEdit }, 'probenzusatzwertgrid button[action=add]': { click: this.add @@ -35,6 +36,13 @@ }); }, + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + }, + add: function(button) { var record = Ext.create('Lada.model.Zusatzwert', { probeId: button.up('probenzusatzwertgrid').recordId diff -r 8756f7e423fb -r 39dd18124ebd app/controller/grid/Status.js --- a/app/controller/grid/Status.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/controller/grid/Status.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,7 +12,8 @@ init: function() { this.control({ 'statusgrid': { - edit: this.gridSave + edit: this.gridSave, + canceledit: this.cancelEdit }, 'statusgrid button[action=add]': { click: this.add @@ -35,6 +36,13 @@ }); }, + cancelEdit: function(editor, context) { + if (!context.record.get('id') || + context.record.get('id') === '') { + editor.getCmp().store.remove(context.record); + } + }, + add: function(button) { var record = Ext.create('Lada.model.Status', { messungsId: button.up('statusgrid').recordId diff -r 8756f7e423fb -r 39dd18124ebd app/model/Ort.js --- a/app/model/Ort.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/model/Ort.js Thu Mar 19 14:31:07 2015 +0100 @@ -13,11 +13,9 @@ extend: 'Ext.data.Model', fields: [{ - name: 'id', - type: 'int' + name: 'id' }, { - name: 'ort', - type: 'int' + name: 'ort' }, { name: 'probeId' }, { diff -r 8756f7e423fb -r 39dd18124ebd app/model/ProbeList.js --- a/app/model/ProbeList.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/model/ProbeList.js Thu Mar 19 14:31:07 2015 +0100 @@ -18,6 +18,7 @@ }], idProperty: 'id', + totalProperty: 'totalCount', proxy: { type: 'rest', diff -r 8756f7e423fb -r 39dd18124ebd app/store/ProbenList.js --- a/app/store/ProbenList.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/store/ProbenList.js Thu Mar 19 14:31:07 2015 +0100 @@ -11,5 +11,7 @@ */ Ext.define('Lada.store.ProbenList', { extend: 'Ext.data.Store', - model: 'Lada.model.ProbeList' + model: 'Lada.model.ProbeList', + pageSize: 5, + remoteSort: true }); diff -r 8756f7e423fb -r 39dd18124ebd app/view/form/Messung.js --- a/app/view/form/Messung.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/form/Messung.js Thu Mar 19 14:31:07 2015 +0100 @@ -14,10 +14,10 @@ alias: 'widget.messungform', requires: [ 'Lada.view.widget.Datenbasis', + 'Lada.view.widget.base.CheckBox', + 'Lada.view.widget.Messmethode', 'Lada.view.widget.base.TextField', 'Lada.view.widget.base.Datetime', - 'Lada.view.widget.base.FieldSet', - 'Lada.model.Messung' ], model: 'Lada.model.Messung', @@ -30,9 +30,87 @@ trackResetOnLoad: true, initComponent: function() { + var me = this; this.items = [{ xtype: 'fieldset', - title: 'Allgemein' + title: 'Allgemein', + items: [{ + border: 0, + margin: '0, 0, 10, 0', + layout: { + type: 'table', + columns: 2 + }, + dockedItems: [{ + xtype: 'toolbar', + dock: 'bottom', + border: '0, 1, 1, 1', + style: { + borderBottom: '1px solid #b5b8c8 !important', + borderLeft: '1px solid #b5b8c8 !important', + borderRight: '1px solid #b5b8c8 !important' + }, + items: ['->', { + text: 'Speichern', + qtip: 'Daten speichern', + icon: 'resources/img/dialog-ok-apply.png', + action: 'save', + disabled: true + }, { + text: 'Verwerfen', + qtip: 'Änderungen verwerfen', + icon: 'resources/img/dialog-cancel.png', + action: 'discard', + disabled: true + }] + }], + items: [{ + xtype: 'textfield', + name: 'nebenprobenNr', + maxLength: 10, + margin: '0, 10, 5, 0', + fieldLabel: 'Nebenprobennr.', + width: 300, + labelWidth: 100, + }, { + xtype: 'messmethode', + name: 'mmtId', + margin: '0, 10, 5, 0', + fieldLabel: 'Messmethode', + width: 300, + labelWidth: 100, + }, { + xtype: 'datetime', + name: 'messzeitpunkt', + margin: '0, 10, 5, 0', + fieldLabel: 'Messzeitpunkt', + width: 300, + labelWidth: 100, + }, { + xtype: 'numberfield', + allowDecimals: false, + minValue: 0, + name: 'messdauer', + margin: '0, 10, 5, 0', + fieldLabel: 'Messdauer', + width: 300, + labelWidth: 100, + }, { + xtype: 'chkbox', + name: 'fertig', + margin: '0, 10, 5, 0', + fieldLabel: 'Fertig', + width: 300, + labelWidth: 100, + }, { + xtype: 'chkbox', + name: 'geplant', + margin: '0, 10, 5, 0', + fieldLabel: 'Geplant', + width: 300, + labelWidth: 100, + }] + }] }]; this.callParent(arguments); }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/form/Probe.js --- a/app/view/form/Probe.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/form/Probe.js Thu Mar 19 14:31:07 2015 +0100 @@ -23,7 +23,8 @@ 'Lada.view.widget.base.TextField', 'Lada.view.widget.base.Datetime', 'Lada.view.widget.base.FieldSet', - 'Lada.model.Probe' + 'Lada.view.widget.base.DateField', + 'Lada.model.Probe', ], model: 'Lada.model.Probe', @@ -36,6 +37,7 @@ trackResetOnLoad: true, initComponent: function() { + var me = this; this.items = [{ xtype: 'fieldset', @@ -95,6 +97,7 @@ border: 0, width: '50%', minWidth: 300, + margin: '0, 1, 0, 0', items: [{ xtype: 'fset', title: 'Erweiterte Angaben', @@ -105,85 +108,50 @@ editable: false, name: 'datenbasisId', fieldLabel: 'Datenbasis', - labelWidth: 100, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + anchor: '100%', + labelWidth: 105, }, { xtype: 'betriebsart', name: 'baId', fieldLabel: 'Betriebsart', - labelWidth: 100, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + anchor: '100%', + labelWidth: 105, }, { xtype: 'testdatensatz', name: 'test', fieldLabel: 'Testdatensatz', - labelWidth: 100, + anchor: '100%', + labelWidth: 105, allowBlank: false, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } }, { xtype: 'probenart', editable: false, name: 'probenartId', fieldLabel: 'Probenart', - labelWidth: 100, + anchor: '100%', + labelWidth: 105, allowBlank: false, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } }, { xtype: 'numberfield', allowDecimals: false, name: 'probeNehmerId', fieldLabel: 'Probennehmer', - labelWidth: 100, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + anchor: '100%', + labelWidth: 105, }, { xtype: 'netzbetreiber', name: 'netzbetreiberId', editable: false, fieldLabel: 'Netzbetreiber', - labelWidth: 100, + anchor: '100%', + labelWidth: 105, allowBlank: false, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } }, { xtype: 'tfield', name: 'x11', fieldLabel: 'Datensatzerzeuger', - labelWidth: 100, - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + anchor: '100%', + labelWidth: 105, }] }] }] @@ -257,71 +225,65 @@ xtype: 'fieldset', title: 'Zeit', layout: { - type: 'hbox' + type: 'hbox', + pack: 'center', + align: 'stretch' }, items: [{ + xtype: 'fieldset', + title: 'Probenentnahme', + anchor: '100%', + width: '50%', + margin: '0, 5, 5, 5', layout: { type: 'vbox', align: 'stretch' }, - border: 0, items: [{ xtype: 'datetime', - fieldLabel: 'Probennahme Beginn', - fieldMargin: '0, 10, 5, 0', - labelWidth: 125, + fieldLabel: 'Beginn', + labelWidth: 90, + anchor: '100%', name: 'probeentnahmeBeginn', - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + format: 'd.m.Y H:i' }, { xtype: 'datetime', - fieldLabel: 'Probennahme Ende', - fieldMargin: '0, 10, 5, 0', - labelWidth: 125, + fieldLabel: 'Ende', + labelWidth: 90, + anchor: '100%', name: 'probeentnahmeEnde', - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + format: 'd.m.Y H:i' }] }, { - layout: 'vbox', - border: 0, + xtype: 'fieldset', + title: 'Sollzeitraum', + anchor: '100%', + width: '50%', + margin: '0, 5, 5, 5', + layout: { + type: 'vbox', + align: 'stretch' + }, items: [{ xtype: 'datetime', - fieldLabel: 'Sollzeit Von', - fieldMargin: '0, 10, 5, 0', + fieldLabel: 'Von', labelWidth: 90, + anchor: '100%', name: 'solldatumBeginn', - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + format: 'd.m.Y H:i' }, { xtype: 'datetime', - fieldLabel: 'Sollzeit Bis', - fieldMargin: '0, 10, 5, 0', + fieldLabel: 'Bis', labelWidth: 90, + anchor: '100%', name: 'solldatumEnde', - listeners: { - dirtychange: { - fn: this.updateOnChange, - scope: me - } - } + format: 'd.m.Y H:i' }] }] }] }] }]; + this.callParent(arguments); }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/FilterResult.js --- a/app/view/grid/FilterResult.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/FilterResult.js Thu Mar 19 14:31:07 2015 +0100 @@ -39,6 +39,11 @@ icon: 'resources/img/svn-update.png', action: 'export' }] + }, { + xtype: 'pagingtoolbar', + dock: 'bottom', + store: this.store, + displayInfo: true }]; this.columns = []; this.callParent(arguments); diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/MKommentar.js --- a/app/view/grid/MKommentar.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/MKommentar.js Thu Mar 19 14:31:07 2015 +0100 @@ -61,11 +61,13 @@ }, { header: 'Datum', dataIndex: 'datum', + xtype: 'datecolumn', + format: 'd.m.Y H:i', editor: { xtype: 'datefield', allowBlank: false, - format: 'd.m.Y', - maxValue: Ext.Date.format(new Date(), 'd.m.Y') + format: 'd.m.Y H:i', + maxValue: Ext.Date.format(new Date(), 'd.m.Y H:i') } }, { header: 'Text', diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/Messung.js --- a/app/view/grid/Messung.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/Messung.js Thu Mar 19 14:31:07 2015 +0100 @@ -65,14 +65,16 @@ }, { header: 'Messzeit', dataIndex: 'messzeitpunkt', + xtype: 'datecolumn', + format: 'd.m.Y H:i', flex: 2, editor: { xtype: 'datefield', allowBlank: false, - format: 'd.m.Y', + format: 'd.m.Y H:i', // minValue: '01.01.2001', //todo: gibt es das? // minText: 'Das Datum der Messung darf nicht vor dem 01.01.2001 liegen.', - maxValue: Ext.Date.format(new Date(), 'd.m.Y') + maxValue: Ext.Date.format(new Date(), 'd.m.Y H:i') } }, { header: 'Status', diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/Messwert.js --- a/app/view/grid/Messwert.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/Messwert.js Thu Mar 19 14:31:07 2015 +0100 @@ -72,6 +72,7 @@ }, { header: 'Messwert', dataIndex: 'messwert', + xtype: 'numbercolumn', width: 80, editor: { xtype: 'numberfield', @@ -97,15 +98,18 @@ } }, { header: '<NWG', + xtype: 'numbercolumn', width: 60, dataIndex: 'messwertNwg' }, { header: 'Nachweisgrenze', + xtype: 'numbercolumn', width: 110, dataIndex: 'nwgZuMesswert' }, { header: 'Messfehler', dataIndex: 'messfehler', + xtype: 'numbercolumn', width: 80, editor: { xtype: 'numberfield', diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/Probenzusatzwert.js --- a/app/view/grid/Probenzusatzwert.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/Probenzusatzwert.js Thu Mar 19 14:31:07 2015 +0100 @@ -49,11 +49,11 @@ this.columns = [{ header: 'PZW-ID', dataIndex: 'id', - width: 70 + flex: 1, }, { header: 'PZW-Größe', dataIndex: 'pzsId', - flex: 1, + flex: 3, renderer: function(value) { if (!value || value === '') { return ''; @@ -72,21 +72,16 @@ }, { header: 'Messwert', dataIndex: 'messwertPzs', - width: 80, - renderer: function(value, meta, record) { - var nwg = record.get('nwgZuMesswert'); - if (value < nwg) { - return '<' + value; - } - return value; - }, + xtype: 'numbercolumn', + flex: 1, editor: { + xtype: 'numberfield', allowBlank: false } }, { header: 'Maßeinheit', dataIndex: 'pzsId', - width: 80, + flex: 1, renderer: function(value) { if (!value || value === '') { return ''; @@ -100,16 +95,34 @@ }, { header: 'Nachweisgrenze', dataIndex: 'nwgZuMesswert', - width: 110, + xtype: 'numbercolumn', + format: '0', + flex: 1, editor: { + xtype: 'numberfield', allowBlank: false } }, { header: 'rel. Unsich.[%]', dataIndex: 'messfehler', + xtype: 'numbercolumn', + format: '0', + flex: 1, editor: { + xtype: 'numberfield', allowBlank: false } + }, { + header: '< NWG', + flex: 1, + renderer: function(value, meta, record) { + var nwg = record.get('nwgZuMesswert'); + var mw = record.get('messwertPzs'); + if ( mw < nwg) { + return 'MW < NWG'; + } + return ''; + } }]; this.initData(); this.callParent(arguments); diff -r 8756f7e423fb -r 39dd18124ebd app/view/grid/Status.js --- a/app/view/grid/Status.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/grid/Status.js Thu Mar 19 14:31:07 2015 +0100 @@ -94,10 +94,12 @@ }, { header: 'Datum', dataIndex: 'sdatum', + xtype: 'datecolumn', + format: 'd.m.Y H:i', editor: { xtype: 'datefield', allowBlank: false, - format: 'd.m.Y', + format: 'd.m.Y H:i', maxValue: Ext.Date.format(new Date(), 'd.m.Y') } }, { diff -r 8756f7e423fb -r 39dd18124ebd app/view/panel/Map.js --- a/app/view/panel/Map.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/panel/Map.js Thu Mar 19 14:31:07 2015 +0100 @@ -9,13 +9,16 @@ extend: 'Ext.panel.Panel', alias: 'widget.map', + record: null, + locationRecord: null, + /** * @cfg * OpenLayers map options. */ mapOptions: { maxExtent: new OpenLayers.Bounds(2.9, 42.95, 18.1, 60.6), - //scales: [1600000, 600000, 300000, 100000, 30000, 15000, 7000, 3500, 1200, 500], + scales: [5000000, 3000000, 2000000, 1000000, 500000, 250000, 100000, 25000], units: 'dd', projection: new OpenLayers.Projection('EPSG:4326') }, @@ -23,27 +26,28 @@ /** * Array of OpenLayers.Layer objects. */ - layers: [ - new OpenLayers.Layer.WMS( - 'Standard', - 'http://osm.intevation.de/cgi-bin/standard.fcgi?', - { - layers: 'OSM-WMS-Dienst', - format: 'image/png', - BGCOLOR: '0xFFFFFF' - }, { - isBaseLayer: true, - buffer: 0, - visibility: true - }) - ], /** * @private * Initialize the map panel. */ initComponent: function() { - this.map = new OpenLayers.Map('map', { + var id = this.record ? this.record.get('id') : Math.floor(Math.random() * 100); + this.layers = [ + new OpenLayers.Layer.WMS( + 'Standard' + id, + 'http://osm.intevation.de/cgi-bin/standard.fcgi?', + { + layers: 'OSM-WMS-Dienst', + format: 'image/png', + BGCOLOR: '0xFFFFFF' + }, { + isBaseLayer: true, + buffer: 0, + visibility: true + }) + ]; + this.map = new OpenLayers.Map('map_' + id, { controls: [], tileManager: null, zoomMethod: null @@ -54,7 +58,93 @@ this.map.addControl(keyControl); keyControl.activate(); this.bodyStyle = {background: '#fff'}; - this.callParent(); + this.initData(); + this.tbar = Ext.create('Lada.view.widget.MapToolbar'); + this.callParent(arguments); + }, + + initData: function() { + var me = this; + this.locationFeatures = []; + this.locationStore = Ext.data.StoreManager.get('locations'); + for (var i = 0; i < this.locationStore.count(); i++) { + this.locationFeatures.push(new OpenLayers.Feature.Vector( + new OpenLayers.Geometry.Point( + this.locationStore.getAt(i).get('longitude'), + this.locationStore.getAt(i).get('latitude') + ), + { + id: this.locationStore.getAt(i).get('id') + } + )); + } + this.featureLayer = new OpenLayers.Layer.Vector('vector_' + this.map.name, { + styleMap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style(OpenLayers.Util.applyDefaults({ + externalGraphic: 'resources/lib/OpenLayers/img/marker-green.png', + graphicOpacity: 1, + pointRadius: 10 + }, OpenLayers.Feature.Vector.style['default'])), + 'select': new OpenLayers.Style({ + externalGraphic: 'resources/lib/OpenLayers/img/marker-blue.png' + }) + }) + }); + this.featureLayer.addFeatures(this.locationFeatures); + this.map.addLayer(this.featureLayer); + this.selectControl = new OpenLayers.Control.SelectFeature(this.featureLayer, { + clickout: false, + toggle: false, + multiple: false, + hover: false, + onSelect: me.selectedFeature, + scope: me + }); + this.map.addControl(this.selectControl); + this.selectControl.activate(); + }, + + selectedFeature: function(feature) { + if (feature.attributes.id && + feature.attributes.id !== '') { + var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id); + this.up('window').down('locationform').setRecord(record); + this.up('window').down('locationform').setReadOnly(true); + this.up('window').down('ortform').down('combobox').setValue(record.id); + } + else { + this.up('window').down('locationform').setRecord(this.locationRecord); + this.up('window').down('locationform').setReadOnly(false); + } + }, + + selectFeature: function(id) { + var feature = this.featureLayer.getFeaturesByAttribute('id', id); + this.map.setCenter( + new OpenLayers.LonLat(feature[0].geometry.x, feature[0].geometry.y)); + this.map.zoomToScale(this.mapOptions.scales[5]); + this.selectControl.unselectAll(); + this.selectControl.select(feature[0]); + }, + + activateDraw: function(record) { + this.locationRecord = record; + if (!this.drawPoint) { + this.drawPoint = new OpenLayers.Control.DrawFeature(this.featureLayer, + OpenLayers.Handler.Point); + this.map.addControl(this.drawPoint); + } + this.drawPoint.activate(); + this.drawPoint.events.register('featureadded', this, this.featureAdded); + }, + + featureAdded: function(features) { + this.locationRecord.set('latitude', features.feature.geometry.y); + this.locationRecord.set('longitude', features.feature.geometry.x); + this.drawPoint.deactivate(); + this.selectControl.unselectAll(); + this.selectControl.select(features.feature); + console.log(arguments); }, /** @@ -64,10 +154,23 @@ afterRender: function() { this.superclass.afterRender.apply(this, arguments); this.map.render(this.body.dom); - this.map.zoomToExtent(this.mapOptions.Extent); this.map.addControl(new OpenLayers.Control.Navigation()); this.map.addControl(new OpenLayers.Control.PanZoomBar()); this.map.addControl(new OpenLayers.Control.ScaleLine()); + if (this.record) { + this.selectFeature(this.record.get('ort')); + } + else { + this.map.zoomToMaxExtent(); + } + }, + + beforeDestroy: function() { + if (this.map) { + this.map.destroy(); + } + delete this.map; + this.callParent(arguments); }, /** diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/MapToolbar.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/MapToolbar.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,21 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.view.widget.MapToolbar', { + extend: 'Ext.toolbar.Toolbar', + alias: 'widget.maptoolbar', + + initComponent: function() { + this.items = [{ + icon: 'resources/img/list-add.png', + tooltip: 'Neuen Ort hinzufügen', + action: 'add' + }]; + this.callParent(arguments); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/Messmethode.js --- a/app/view/widget/Messmethode.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/Messmethode.js Thu Mar 19 14:31:07 2015 +0100 @@ -22,7 +22,8 @@ triggerAction: 'all', typeAhead: true, minChars: 0, - + layout: 'hbox', + initComponent: function() { this.store = Ext.data.StoreManager.get('messmethoden'); if (!this.store) { diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/Testdatensatz.js --- a/app/view/widget/Testdatensatz.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/Testdatensatz.js Thu Mar 19 14:31:07 2015 +0100 @@ -6,16 +6,7 @@ * the documentation coming with IMIS-Labordaten-Application for details. */ -var testdatensatzStore = Ext.create('Ext.data.Store', { - fields: ['testdatensatzId', 'testdatensatz'], - data: [{ - 'testdatensatzId': true, - 'testdatensatz': 'Ja' - }, { - 'testdatensatzId': false, - 'testdatensatz': 'Nein' - }] -}); + /** * Combobox for Testdatensatz. @@ -23,15 +14,23 @@ */ Ext.define('Lada.view.widget.Testdatensatz', { extend: 'Lada.view.widget.base.ComboBox', - editable: false, alias: 'widget.testdatensatz', - store: testdatensatzStore, queryMode: 'local', displayField: 'testdatensatz', valueField: 'testdatensatzId', emptyText: 'Testdatensatz?', initComponent: function() { + this.store = Ext.create('Ext.data.Store', { + fields: ['testdatensatzId', 'testdatensatz'], + data: [{ + 'testdatensatzId': true, + 'testdatensatz': 'Ja' + }, { + 'testdatensatzId': false, + 'testdatensatz': 'Nein' + }] + }); this.callParent(arguments); } }); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/CheckBox.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/base/CheckBox.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,100 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.view.widget.base.CheckBox', { + extend: 'Ext.form.Panel', + alias: 'widget.chkbox', + + layout: 'hbox', + + border: 0, + + margin: '0, 0, 5, 0', + + initComponent: function() { + this.items = [{ + xtype: 'checkbox', + flex: 1, + name: this.name, + fieldLabel: this.fieldLabel, + labelWidth: this.labelWidth, + listeners: this.listeners, + triggerAction: this.triggerAction, + msgTarget: 'none', + tpl: this.tpl + }, { + xtype: 'image', + name: 'warnImg', + src: 'resources/img/dialog-warning.png', + width: 14, + height: 14, + hidden: true + }, { + xtype: 'image', + name: 'errorImg', + src: 'resources/img/emblem-important.png', + width: 14, + height: 14, + hidden: true + }]; + this.callParent(arguments); + }, + + showWarnings: function(warnings) { + var img = this.down('image[name=warnImg]'); + Ext.create('Ext.tip.ToolTip', { + target: img.getEl(), + html: warnings + }); + this.down('checkbox').invalidCls = 'x-lada-warning'; + this.down('checkbox').markInvalid(''); + img.show(); + var fieldset = this.up('fieldset[collapsible=true]'); + if (fieldset) { + var i18n = Lada.getApplication().bundle; + var warningText = i18n.getMsg(this.name) + ': ' + warnings; + fieldset.showWarningOrError(true, warningText); + } + }, + + showErrors: function(errors) { + var img = this.down('image[name=errorImg]'); + var warnImg = this.down('image[name=warnImg]'); + warnImg.hide(); + Ext.create('Ext.tip.ToolTip', { + target: img.getEl(), + html: errors + }); + this.down('checkbox').invalidCls = 'x-lada-error'; + this.down('checkbox').markInvalid(''); + img.show(); + var fieldset = this.up('fieldset[collapsible=true]'); + if (fieldset) { + var i18n = Lada.getApplication().bundle; + var errorText = i18n.getMsg(this.name) + ': ' + errors; + fieldset.showWarningOrError(false, '', true, errorText); + } + }, + + clearWarningOrError: function() { + this.down('image[name=errorImg]').hide(); + this.down('image[name=warnImg]').hide(); + }, + + getValue: function() { + return this.down('checkbox').getValue(); + }, + + getName: function() { + return this.name; + }, + + setReadOnly: function(value) { + this.down('checkbox').setReadOnly(value); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/ComboBox.js --- a/app/view/widget/base/ComboBox.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/base/ComboBox.js Thu Mar 19 14:31:07 2015 +0100 @@ -40,16 +40,16 @@ }, { xtype: 'image', name: 'warnImg', - src: 'resources/img/icon-warning.gif', - width: 12, - height: 12, + src: 'resources/img/dialog-warning.png', + width: 14, + height: 14, hidden: true }, { xtype: 'image', name: 'errorImg', - src: 'resources/img/icon-error.gif', - width: 12, - height: 12, + src: 'resources/img/emblem-important.png', + width: 14, + height: 14, hidden: true }]; this.callParent(arguments); @@ -66,7 +66,9 @@ img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showWarnings(warnings); + var i18n = Lada.getApplication().bundle; + var warningText = i18n.getMsg(this.name) + ': ' + warnings; + fieldset.showWarningOrError(true, warningText); } }, @@ -83,7 +85,9 @@ img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showErrors(); + var i18n = Lada.getApplication().bundle; + var errorText = i18n.getMsg(this.name) + ': ' + errors; + fieldset.showWarningOrError(false, '', true, errorText); } }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/DateField.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/base/DateField.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,105 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +Ext.define('Lada.view.widget.base.DateField', { + extend: 'Ext.form.Panel', + alias: 'widget.datef', + + requires: [ + 'Ext.form.field.Date' + ], + + layout: 'hbox', + + border: 0, + + margin: '0, 0, 5, 0', + + initComponent: function() { + this.items = [{ + xtype: 'datefield', + flex: 1, + name: this.name, + fieldLabel: this.fieldLabel, + labelWidth: this.labelWidth, + listeners: this.listeners, + triggerAction: this.triggerAction, + format: this.format, + msgTarget: 'none', + tpl: this.tpl + }, { + xtype: 'image', + name: 'warnImg', + src: 'resources/img/dialog-warning.png', + width: 14, + height: 14, + hidden: true + }, { + xtype: 'image', + name: 'errorImg', + src: 'resources/img/emblem-important.png', + width: 14, + height: 14, + hidden: true + }]; + this.callParent(arguments); + }, + + showWarnings: function(warnings) { + var img = this.down('image[name=warnImg]'); + Ext.create('Ext.tip.ToolTip', { + target: img.getEl(), + html: warnings + }); + this.down('datefield').invalidCls = 'x-lada-warning'; + this.down('datefield').markInvalid(''); + img.show(); + var fieldset = this.up('fieldset[collapsible=true]'); + if (fieldset) { + var i18n = Lada.getApplication().bundle; + var warningText = i18n.getMsg(this.name) + ': ' + warnings; + fieldset.showWarningOrError(true, warningText); + } + }, + + showErrors: function(errors) { + var img = this.down('image[name=errorImg]'); + var warnImg = this.down('image[name=warnImg]'); + warnImg.hide(); + Ext.create('Ext.tip.ToolTip', { + target: img.getEl(), + html: errors + }); + this.down('datefield').invalidCls = 'x-lada-error'; + this.down('datefield').markInvalid(''); + img.show(); + var fieldset = this.up('fieldset[collapsible=true]'); + if (fieldset) { + var i18n = Lada.getApplication().bundle; + var errorText = i18n.getMsg(this.name) + ': ' + errors; + fieldset.showWarningOrError(false, '', true, errorText); + } + }, + + clearWarningOrError: function() { + this.down('image[name=errorImg]').hide(); + this.down('image[name=warnImg]').hide(); + }, + + getValue: function() { + return this.down('datefield').getValue(); + }, + + getName: function() { + return this.name; + }, + + setReadOnly: function(value) { + this.down('datefield').setReadOnly(value); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/DateTimeField.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/base/DateTimeField.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,64 @@ +Ext.define('Lada.view.widget.base.DateTimeField', { + extend: 'Ext.form.field.Date', + alias: 'widget.datetimefield', + requires: [ + 'Lada.view.widget.base.DateTimePicker' + ], + + format: 'm/d/Y H:i', + + mimicBlur: function(e) { + var me = this, + picker = me.picker; + + // ignore mousedown events within the picker element + if (!picker || + !e.within(picker.el, false, true) + ) { + me.callParent(arguments); + } + }, + + collapseIf: function(e) { + var me = this; + + if (Ext.getVersion().major === 4 + && !me.isDestroyed + && !e.within(me.bodyEl, false, true) + && !e.within(me.picker.el, false, true) + ) { + me.collapse(); + } + }, + + createPicker: function() { + var me = this; + + return new Lada.view.widget.base.DateTimePicker({ + pickerField: me, + floating: true, + hidden: true, + focusable: true, + focusOnShow: true, + minDate: me.minValue, + maxDate: me.maxDate, + disabledDatesRE: me.disabledDatesRE, + disabledDatesText: me.disabledDatesText, + disabledDays: me.disabledDays, + disabledDatesText: me.disabledDaysText, + format: me.format, + startDay: me.startDay, + minText: Ext.String.format(me.minText, me.formatDate(me.minValue)), + maxText: Ext.String.format(me.maxText, me.formatDate(me.maxValue)), + listeners: { + scope: me, + select: me.onSelect + }, + keyNavConfig: { + esc: function() { + me.collapse(); + } + } + }); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/DateTimePicker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/widget/base/DateTimePicker.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,322 @@ +Ext.define('Lada.view.widget.base.DateTimePicker', { + extend: 'Ext.picker.Date', + alias: 'widget.datetimepicker', + requires: [ + 'Ext.picker.Date', + 'Ext.form.field.Number' + ], + + todayText: 'Jetzt', + + renderTpl: [ + '
', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '{#:this.isEndOfWeek}', + '', + '', + '', + '
', + '
{.:this.firstInitial}
', + '
', + // the href attribute is required for the :hover selector to work in IE6/7/quirks + '', + '
', + '', + '
', + { + firstInitial: function(value) { + return Ext.picker.Date.prototype.getDayInitial(value); + }, + isEndOfWeek: function(value) { + // convert from 1 based index to 0 based + // by decrementing value once. + value--; + var end = value % 7 === 0 && value !== 0; + return end ? '' : ''; + }, + renderTodayBtn: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out); + }, + renderMonthBtn: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out); + }, + renderTimeLabel: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.timeLabel.getRenderTree(), out); + }, + renderTimeHour: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.hourField.getRenderTree(), out); + }, + renderTimeMinute: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.minuteField.getRenderTree(), out); + }, + renderAcceptBtn: function(values, out) { + Ext.DomHelper.generateMarkup(values.$comp.acceptBtn.getRenderTree(), out); + } + } + ], + + beforeRender: function () { + var me = this; + me.hourField = new Ext.form.field.Spinner({ + ownerCt: me, + ownerLayout: me.getComponentLayout(), + value: 0, + maxValue: 23, + onSpinUp: function() { + var value = parseInt(this.getValue()); + if (value === 23) { + return; + } + var newValue = value + 1; + if (newValue < 10) { + this.setValue('0' + newValue); + } + else { + this.setValue(newValue); + } + }, + onSpinDown: function() { + var value = parseInt(this.getValue()); + if (value === 0) { + return; + } + var newValue = value - 1; + if (newValue < 10) { + this.setValue('0' + newValue); + } + else { + this.setValue(newValue); + } + }, + listeners: { + change: me.changeTimeValue, + scope: me + } + }); + + me.minuteField = new Ext.form.field.Spinner({ + ownerCt: me, + ownerLayout: me.getComponentLayout(), + value: 0, + maxValue: 59, + onSpinUp: function() { + var value = parseInt(this.getValue()); + if (value === 59) { + return; + } + var newValue = value + 1; + if (newValue < 10) { + this.setValue('0' + newValue); + } + else { + this.setValue(newValue); + } + }, + onSpinDown: function() { + var value = parseInt(this.getValue()); + if (value === 0) { + return; + } + var newValue = value - 1; + if (newValue < 10) { + this.setValue('0' + newValue); + } + else { + this.setValue(newValue); + } + }, + listeners: { + change: me.changeTimeValue, + scope: me + } + }); + + me.timeLabel = new Ext.form.Label({ + ownerCt: me, + ownerLayout: me.getComponentLayout(), + text: 'Zeit' + }); + me.acceptBtn = new Ext.button.Button({ + ownerCt: me, + ownerLayout: me.getComponentLayout(), + text: 'Übernehmen', + handler: me.acceptDate, + scope: me + }); + me.callParent(); + }, + + finishRenderChildren: function() { + var me = this; + me.callParent(); + me.timeLabel.finishRender(); + me.hourField.finishRender(); + me.minuteField.finishRender(); + me.acceptBtn.finishRender(); + }, + + showTimePicker: function() { + var me = this; + var el = me.el; + Ext.defer(function() { + var xPos = el.getX(); + var yPos = el.getY() + el.getHeight(); + me.timePicker.setHeight(30); + me.timePicker.setWidth(el.getWidth()); + me.timePicker.setPosition(xPos, yPos); + me.timePicker.show(); + },1); + }, + + beforeDestroy: function() { + var me = this; + if (me.rendered) { + Ext.destroy( + me.minuteField, + me.hourField + ); + } + me.callParent(); + }, + + changeTimeValue: function (field, nValue) { + var value = parseInt(nValue); + if (value > field.maxValue) { + field.setValue(field.maxValue); + } + else if (value < 10 && (nValue.indexOf('0') !== 0 || nValue.length < 2)) { + field.setValue('0' + nValue); + } + }, + + setValue: function(value) { + value.setSeconds(0); + this.value = new Date(value); + return this.update(this.value); + }, + + selectToday: function() { + var me = this; + var btn = me.todayBtn; + var handler = me.handler; + var auxDate = new Date(); + + if (btn && !btn.disabled) { + me.pickerField.setValue(new Date(auxDate.setSeconds(0))); + me.setValue(new Date(auxDate.setSeconds(0))); + if (handler) { + handler.call(me.scope || me, me, me.value); + } + me.onSelect(); + } + return me; + }, + + acceptDate: function() { + var me = this; + var hourSet = me.hourField.getValue(); + var minuteSet = me.minuteField.getValue(); + var currentDate = me.value; + currentDate.setHours(hourSet); + currentDate.setMinutes(minuteSet); + me.setValue(currentDate); + me.fireEvent('select', me, currentDate); + }, + + handleDateClick: function(e, t) { + var me = this; + var handler = me.handler; + var hourSet = me.hourField.getValue(); + var minuteSet = me.minuteField.getValue(); + var auxDate = new Date(t.dateValue); + e.stopEvent(); + if (!me.disabled && + t.dateValue && + !Ext.fly(t.parentNode).hasCls(me.disabledCellCls) + ) { + me.doCancelFocus = me.focusOnSelect === false; + auxDate.setHours(hourSet, minuteSet, 0); + me.setValue(new Date(auxDate)); + delete me.doCancelFocus; + if (handler) { + handler.call(me.scope || me, me, me.value); + } + // event handling is turned off on hide + // when we are using the picker in a field + // therefore onSelect comes AFTER the select + // event. + me.onSelect(); + } + }, + + selectedUpdate: function(date) { + var me = this; + var dateOnly = Ext.Date.clearTime(date, true); + var t = dateOnly.getTime(); + var currentDate = (me.pickerField && me.pickerField.getValue()) || new Date(); + var cells = me.cells; + var cls = me.selectedCls; + var cellItems = cells.elements; + var c; + var cLen = cellItems.length; + var cell; + + cells.removeCls(cls); + + for (c = 0; c < cLen; c++) { + cell = Ext.fly(cellItems[c]); + + if (cell.dom.firstChild.dateValue == t) { + me.fireEvent('highlightitem', me, cell); + cell.addCls(cls); + + if (me.isVisible() && !me.doCancelFocus) { + Ext.fly(cell.dom.firstChild).focus(50); + } + + break; + } + } + if (currentDate) { + me.hourField.setValue(currentDate.getHours()); + me.minuteField.setValue(currentDate.getMinutes()); + } + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/Datetime.js --- a/app/view/widget/base/Datetime.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/base/Datetime.js Thu Mar 19 14:31:07 2015 +0100 @@ -13,17 +13,18 @@ extend: 'Ext.panel.Panel', alias: 'widget.datetime', requires: [ - 'Ext.ux.form.DateTimeField' + 'Lada.view.widget.base.DateTimeField' ], layout: 'hbox', border: 0, + margin: '0, 0, 5, 0', + initComponent: function() { - this.margin = this.fieldMargin; - var dateField = Ext.create('Ext.ux.form.DateTimeField', { - format: 'd.m.Y', + var dateField = Ext.create('Lada.view.widget.base.DateTimeField', { + format: this.format || 'd.m.Y H:i', emptyText: 'Wählen Sie einen Zeitpunkt', fieldLabel: this.fieldLabel, labelWidth: this.labelWidth, @@ -35,16 +36,16 @@ this.items = [dateField, { xtype: 'image', name: 'warnImg', - src: 'resources/img/icon-warning.gif', - width: 12, - height: 12, + src: 'resources/img/dialog-warning.png', + width: 14, + height: 14, hidden: true }, { xtype: 'image', name: 'errorImg', - src: 'resources/img/icon-error.gif', - width: 12, - height: 12, + src: 'resources/img/emblem-important.png', + width: 14, + height: 14, hidden: true }]; this.callParent(arguments); @@ -61,7 +62,9 @@ img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showWarnings(warnings); + var i18n = Lada.getApplication().bundle; + var warningText = i18n.getMsg(this.name) + ': ' + warnings; + fieldset.showWarningOrError(true, warningText); } }, @@ -78,7 +81,9 @@ img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showErrors(); + var i18n = Lada.getApplication().bundle; + var errorText = i18n.getMsg(this.name) + ': ' + errors; + fieldset.showWarningOrError(false, '', true, errorText); } }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/FieldSet.js --- a/app/view/widget/base/FieldSet.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/base/FieldSet.js Thu Mar 19 14:31:07 2015 +0100 @@ -12,12 +12,22 @@ plainTitle: '', origColor: '', + errorText: '', + warningText: '', showWarningOrError: function(warning, warningText, error, errorText) { var ndx = 0; if (this.collapsible === true) { ndx = 1; } + if (this.errorText && this.errorText !== '') { + this.errorText += '\n'; + } + this.errorText += errorText; + if (this.warningText && this.warningText !== '') { + this.warningText += '\n'; + } + this.warningText += warningText; this.plainTitle = this.getEl().dom.firstChild .firstChild.firstChild .children[ndx].innerHTML; @@ -26,7 +36,7 @@ this.getEl().dom.style['border-color'] = '#FF0000'; this.getEl().dom.firstChild.firstChild.firstChild .children[ndx].innerHTML = - ' ' + + ' ' + this.plainTitle; if (errorText) { Ext.create('Ext.tip.ToolTip', { @@ -40,7 +50,7 @@ this.getEl().dom.style['border-color'] = '#FFE25D'; this.getEl().dom.firstChild.firstChild.firstChild .children[ndx].innerHTML = - ' ' + + ' ' + this.plainTitle; if (warningText) { Ext.create('Ext.tip.ToolTip', { diff -r 8756f7e423fb -r 39dd18124ebd app/view/widget/base/TextField.js --- a/app/view/widget/base/TextField.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/widget/base/TextField.js Thu Mar 19 14:31:07 2015 +0100 @@ -28,16 +28,16 @@ }, { xtype: 'image', name: 'warnImg', - src: 'resources/img/icon-warning.gif', - width: 12, - height: 12, + src: 'resources/img/dialog-warning.png', + width: 14, + height: 14, hidden: true }, { xtype: 'image', name: 'errorImg', - src: 'resources/img/icon-error.gif', - width: 12, - height: 12, + src: 'resources/img/emblem-important.png', + width: 14, + height: 14, hidden: true }]; this.callParent(arguments); @@ -54,7 +54,9 @@ this.down('textfield').markInvalid(''); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showWarnings(warnings); + var i18n = Lada.getApplication().bundle; + var warningText = i18n.getMsg(this.name) + ': ' + warnings; + fieldset.showWarningOrError(true, warningText); } }, @@ -71,7 +73,9 @@ img.show(); var fieldset = this.up('fieldset[collapsible=true]'); if (fieldset) { - fieldset.showErrors(); + var i18n = Lada.getApplication().bundle; + var errorText = i18n.getMsg(this.name) + ': ' + errors; + fieldset.showWarningOrError(false, '', true, errorText); } }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/MessungCreate.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/MessungCreate.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,63 @@ +/* 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. + */ + +/* + * Window to edit a Messung + */ +Ext.define('Lada.view.window.MessungCreate', { + extend: 'Ext.window.Window', + alias: 'widget.messungcreate', + + requires: [ + 'Lada.view.form.Messung' + ], + + collapsible: true, + maximizable: true, + autoshow: true, + autoscroll: true, + layout: 'fit', + + record: null, + grid: null, + + initComponent: function() { + this.title = 'Messung'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'messungform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + this.clearMessages(); + var messung = Ext.create('Lada.model.Messung', { + probeId: this.record.get('id') + }); + this.down('messungform').setRecord(messung); + }, + + setMessages: function(errors, warnings) { + //todo this is a stub + }, + clearMessages: function() { + //todo this is a stub + } + +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/MessungEdit.js --- a/app/view/window/MessungEdit.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/window/MessungEdit.js Thu Mar 19 14:31:07 2015 +0100 @@ -27,6 +27,7 @@ layout: 'fit', record: null, + grid: null, initComponent: function() { if (this.record === null) { @@ -48,8 +49,9 @@ autoScroll: true, items: [{ xtype: 'messungform', + margin: 5, recordId: this.record.get('id') - }, { + }, { xtype: 'fset', name: 'messwerte', title: 'Messwerte', @@ -86,6 +88,7 @@ initData: function() { this.clearMessages(); + this.down('messungform').setRecord(this.record); Ext.ClassManager.get('Lada.model.Messung').load(this.record.get('id'), { failure: function(record) { // TODO @@ -99,8 +102,7 @@ } }, scope: this - } - ); + }); }, setMessages: function(errors, warnings) { diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/OrtCreate.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/OrtCreate.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,90 @@ +/* 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. + */ + +/* + * Window to edit a Messung + */ +Ext.define('Lada.view.window.OrtCreate', { + extend: 'Ext.window.Window', + alias: 'widget.ortcreate', + + requires: [ + 'Lada.view.panel.Map', + 'Lada.view.form.Ort', + 'Lada.view.form.Location' + ], + + collapsible: true, + maximizable: true, + autoshow: true, + layout: 'border', + + record: null, + grid: null, + + initComponent: function() { + this.title = 'Ort'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 900; + this.height = 515; + this.bodyStyle = {background: '#fff'}; + + this.items = [{ + region: 'west', + border: 0, + layout: 'vbox', + items: [{ + xtype: 'ortform', + margin: 5 + }, { + xtype: 'locationform', + margin: 5 + }] + }, { + xtype: 'fset', + bodyStyle: { + background: '#fff' + }, + layout: 'border', + name: 'mapfield', + title: 'Karte', + region: 'center', + padding: '5, 5', + margin: 5, + items: [{ + xtype: 'map', + region: 'center', + layout: 'border', + bodyStyle: { + background: '#fff' + }, + name: 'map' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + var ort = Ext.create('Lada.model.Ort', { + probeId: this.record.get('id') + }); + this.down('ortform').setRecord(ort); + }, + + setMessages: function(errors, warnings) { + //todo this is a stub + }, + + clearMessages: function() { + //todo this is a stub + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/OrtEdit.js --- a/app/view/window/OrtEdit.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/window/OrtEdit.js Thu Mar 19 14:31:07 2015 +0100 @@ -25,6 +25,7 @@ layout: 'border', record: null, + grid: null, initComponent: function() { if (this.record === null) { @@ -70,6 +71,7 @@ xtype: 'map', region: 'center', layout: 'border', + record: this.record, bodyStyle: { background: '#fff' }, diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/ProbeCreate.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/window/ProbeCreate.js Thu Mar 19 14:31:07 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. + */ + +/* + * Window to edit a Probe + */ +Ext.define('Lada.view.window.ProbeCreate', { + extend: 'Ext.window.Window', + alias: 'widget.probecreate', + + requires: [ + 'Lada.view.form.Probe' + ], + + collapsible: true, + maximizable: true, + autoShow: true, + autoScroll: true, + layout: 'fit', + + record: null, + + initComponent: function() { + this.title = '§3-Probe'; + this.buttons = [{ + text: 'Schließen', + scope: this, + handler: this.close + }]; + this.width = 700; + // InitialConfig is the config object passed to the constructor on + // creation of this window. We need to pass it throuh to the form as + // we need the "modelId" param to load the correct item. + + this.items = [{ + border: 0, + autoScroll: true, + items: [{ + xtype: 'probeform' + }] + }]; + this.callParent(arguments); + }, + + initData: function() { + var record = Ext.create('Lada.model.Probe'); + this.down('probeform').setRecord(record); + }, + + setMessages: function(errors, warnings) { + this.down('probeform').setMessages(errors, warnings); + }, + + clearMessages: function() { + this.down('probeform').clearMessages(); + } +}); diff -r 8756f7e423fb -r 39dd18124ebd app/view/window/ProbeEdit.js --- a/app/view/window/ProbeEdit.js Thu Mar 19 14:30:06 2015 +0100 +++ b/app/view/window/ProbeEdit.js Thu Mar 19 14:31:07 2015 +0100 @@ -35,7 +35,8 @@ this.callParent(arguments); return; } - this.title = '§3-Probe ' + this.record.get('probeId'); + var extendedTitle = this.record.get('probeId') ? this.record.get('probeId') : ''; + this.title = '§3-Probe ' + extendedTitle; this.buttons = [{ text: 'Schließen', scope: this, diff -r 8756f7e423fb -r 39dd18124ebd index.html --- a/index.html Thu Mar 19 14:30:06 2015 +0100 +++ b/index.html Thu Mar 19 14:31:07 2015 +0100 @@ -19,7 +19,9 @@ + + diff -r 8756f7e423fb -r 39dd18124ebd resources/i18n/Lada_de-DE.properties --- a/resources/i18n/Lada_de-DE.properties Thu Mar 19 14:30:06 2015 +0100 +++ b/resources/i18n/Lada_de-DE.properties Thu Mar 19 14:31:07 2015 +0100 @@ -30,3 +30,4 @@ # Field names ## entnahmeOrt: Entnahmeort +test: Testdatensatz diff -r 8756f7e423fb -r 39dd18124ebd resources/img/dialog-warning.png Binary file resources/img/dialog-warning.png has changed diff -r 8756f7e423fb -r 39dd18124ebd resources/img/emblem-important.png Binary file resources/img/emblem-important.png has changed diff -r 8756f7e423fb -r 39dd18124ebd resources/img/icon-error.gif Binary file resources/img/icon-error.gif has changed diff -r 8756f7e423fb -r 39dd18124ebd resources/img/icon-warning.gif Binary file resources/img/icon-warning.gif has changed diff -r 8756f7e423fb -r 39dd18124ebd resources/lib/datetime/UX_DateTimeField.js --- a/resources/lib/datetime/UX_DateTimeField.js Thu Mar 19 14:30:06 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -Ext.define('Ext.ux.form.DateTimeField', { - extend: 'Ext.form.field.Date', - alias: 'widget.datetimefield', - requires: ['Ext.ux.DateTimePicker'], - - initComponent: function() { - this.format = this.format + ' ' + 'H:i:s'; - this.callParent(); - }, - // overwrite - createPicker: function() { - var me = this, - format = Ext.String.format; - - return Ext.create('Ext.ux.DateTimePicker', { - ownerCt: me.ownerCt, - renderTo: document.body, - floating: true, - hidden: true, - focusOnShow: true, - minDate: me.minValue, - maxDate: me.maxValue, - disabledDatesRE: me.disabledDatesRE, - disabledDatesText: me.disabledDatesText, - disabledDays: me.disabledDays, - disabledDaysText: me.disabledDaysText, - format: me.format, - showToday: me.showToday, - startDay: me.startDay, - minText: format(me.minText, me.formatDate(me.minValue)), - maxText: format(me.maxText, me.formatDate(me.maxValue)), - listeners: { - scope: me, - select: me.onSelect - }, - keyNavConfig: { - esc: function() { - me.collapse(); - } - } - }); - } - }); \ No newline at end of file diff -r 8756f7e423fb -r 39dd18124ebd resources/lib/datetime/UX_DateTimeMenu.js --- a/resources/lib/datetime/UX_DateTimeMenu.js Thu Mar 19 14:30:06 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -Ext.define('Ext.ux.DateTimeMenu', { - extend: 'Ext.menu.Menu', - - alias: 'widget.datetimemenu', - - requires: ['Ext.ux.DateTimePicker'], - - hideOnClick: true, - pickerId: null, - - initComponent: function() { - var me = this; - - Ext.apply(me, { - showSeparator: false, - plain: true, - border: false, - bodyPadding: 0, - items: Ext.applyIf({ - cls: Ext.baseCSSPrefix + 'menu-date-item', - id: me.pickerId, - xtype: 'datetimepicker' - }, me.initialConfig) - }); - - me.callParent(arguments); - - me.picker = me.down('datetimepicker'); - me.relayEvents(me.picker, ['select']); - - if (me.hideOnClick) { - me.on('select', me.hidePickerOnSelect, me); - } - }, - - hidePickerOnSelect: function() { - Ext.menu.Manager.hideAll(); - } - }); diff -r 8756f7e423fb -r 39dd18124ebd resources/lib/datetime/UX_DateTimePicker.js --- a/resources/lib/datetime/UX_DateTimePicker.js Thu Mar 19 14:30:06 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -Ext.define('Ext.ux.DateTimePicker', { - extend: 'Ext.picker.Date', - alias: 'widget.datetimepicker', - todayText: "Now", - timeLabel: 'Time', - requires: ['Ext.ux.form.TimePickerField'], - - initComponent: function() { - // keep time part for value - var value = this.value || new Date(); - this.callParent(); - this.value = value; - }, - onRender: function(container, position) { - if(!this.timefield) { - this.timefield = Ext.create('Ext.ux.form.TimePickerField', { - fieldLabel: this.timeLabel, - labelWidth: 40, - value: Ext.Date.format(this.value, 'H:i:s') - }); - } - this.timefield.ownerCt = this; - this.timefield.on('change', this.timeChange, this); - this.callParent(arguments); - - var table = Ext.get(Ext.DomQuery.selectNode('table', this.el.dom)); - var tfEl = Ext.core.DomHelper.insertAfter(table, { - tag: 'div', - style: 'border:0px;', - children: [{ - tag: 'div', - cls: 'x-datepicker-footer ux-timefield' - }] - }, true); - this.timefield.render(this.el.child('div div.ux-timefield')); - - var p = this.getEl().parent('div.x-layer'); - if(p) { - p.setStyle("height", p.getHeight() + 31); - } - }, - // listener 时间域修改, timefield change - timeChange: function(tf, time, rawtime) { - // if(!this.todayKeyListener) { // before render - this.value = this.fillDateTime(this.value); - // } else { - // this.setValue(this.value); - // } - }, - // @private - fillDateTime: function(value) { - if(this.timefield) { - var rawtime = this.timefield.getRawValue(); - value.setHours(rawtime.h); - value.setMinutes(rawtime.m); - value.setSeconds(rawtime.s); - } - return value; - }, - // @private - changeTimeFiledValue: function(value) { - this.timefield.un('change', this.timeChange, this); - this.timefield.setValue(this.value); - this.timefield.on('change', this.timeChange, this); - }, - - /* TODO 时间值与输入框绑定, 考虑: 创建this.timeValue 将日期和时间分开保存. */ - // overwrite - setValue: function(value) { - this.value = value; - this.changeTimeFiledValue(value); - return this.update(this.value); - }, - // overwrite - getValue: function() { - return this.fillDateTime(this.value); - }, - - // overwrite : fill time before setValue - handleDateClick: function(e, t) { - var me = this, - handler = me.handler; - - e.stopEvent(); - if(!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) { - me.doCancelFocus = me.focusOnSelect === false; - me.setValue(this.fillDateTime(new Date(t.dateValue))); // overwrite: fill time before setValue - delete me.doCancelFocus; - me.fireEvent('select', me, me.value); - if(handler) { - handler.call(me.scope || me, me, me.value); - } - me.onSelect(); - } - }, - - // overwrite : fill time before setValue - selectToday: function() { - var me = this, - btn = me.todayBtn, - handler = me.handler; - - if(btn && !btn.disabled) { - // me.setValue(Ext.Date.clearTime(new Date())); //src - me.setValue(new Date());// overwrite: fill time before setValue - me.fireEvent('select', me, me.value); - if(handler) { - handler.call(me.scope || me, me, me.value); - } - me.onSelect(); - } - return me; - } - }); diff -r 8756f7e423fb -r 39dd18124ebd resources/lib/datetime/UX_TimePickerField.js --- a/resources/lib/datetime/UX_TimePickerField.js Thu Mar 19 14:30:06 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/** - * 时间输入框, 三个整数框分别输入时,分,秒. - * @author wangzilong - * update Ext - 4.1 2012/04/27 - */ -Ext.define('Ext.ux.form.TimePickerField', { - extend: 'Ext.form.field.Base', - alias: 'widget.timepicker', - alternateClassName: 'Ext.form.field.TimePickerField', - requires: ['Ext.form.field.Number'], - - // 隐藏BaseField的输入框 , hidden basefield's input - inputType: 'hidden', - - style: 'padding:4px 0 0 0;margin-bottom:0px', - - /** - * @cfg {String} value - * initValue, format: 'H:i:s' - */ - value: null, - - /** - * @cfg {Object} spinnerCfg - * 数字输入框参数, number input config - */ - spinnerCfg: { - width: 40 - }, - - /** Override. */ - initComponent: function() { - var me = this; - - me.value = me.value || Ext.Date.format(new Date(), 'H:i:s'); - - me.callParent();// called setValue - - me.spinners = []; - var cfg = Ext.apply({}, me.spinnerCfg, { - readOnly: me.readOnly, - disabled: me.disabled, - style: 'float: left', - listeners: { - change: { - fn: me.onSpinnerChange, - scope: me - } - } - }); - - me.hoursSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { - minValue: 0, - maxValue: 23 - })); - me.minutesSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { - minValue: 0, - maxValue: 59 - })); - // TODO 使用timeformat 判断是否创建秒输入框, maybe second field is not always need. - me.secondsSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { - minValue: 0, - maxValue: 59 - })); - - me.spinners.push(me.hoursSpinner, me.minutesSpinner, me.secondsSpinner); - - }, - /** - * @private - * Override. - */ - onRender: function() { - var me = this, spinnerWrapDom, spinnerWrap; - me.callParent(arguments); - - // render to original BaseField input td - // spinnerWrap = Ext.get(Ext.DomQuery.selectNode('div', this.el.dom)); // 4.0.2 - spinnerWrapDom = Ext.dom.Query.select('td', this.getEl().dom)[1]; // 4.0 ->4.1 div->td - spinnerWrap = Ext.get(spinnerWrapDom); - me.callSpinnersFunction('render', spinnerWrap); - - Ext.core.DomHelper.append(spinnerWrap, { - tag: 'div', - cls: 'x-form-clear-left' - }); - - this.setRawValue(this.value); - }, - - _valueSplit: function(v) { - if(Ext.isDate(v)) { - v = Ext.Date.format(v, 'H:i:s'); - } - var split = v.split(':'); - return { - h: split.length > 0 ? split[0] : 0, - m: split.length > 1 ? split[1] : 0, - s: split.length > 2 ? split[2] : 0 - }; - }, - onSpinnerChange: function() { - if(!this.rendered) { - return; - } - this.fireEvent('change', this, this.getValue(), this.getRawValue()); - }, - // 依次调用各输入框函数, call each spinner's function - callSpinnersFunction: function(funName, args) { - for(var i = 0; i < this.spinners.length; i++) { - this.spinners[i][funName](args); - } - }, - // @private get time as object, - getRawValue: function() { - if(!this.rendered) { - var date = this.value || new Date(); - return this._valueSplit(date); - } else { - return { - h: this.hoursSpinner.getValue(), - m: this.minutesSpinner.getValue(), - s: this.secondsSpinner.getValue() - }; - } - }, - - // private - setRawValue: function(value) { - value = this._valueSplit(value); - if(this.hoursSpinner) { - this.hoursSpinner.setValue(value.h); - this.minutesSpinner.setValue(value.m); - this.secondsSpinner.setValue(value.s); - } - }, - // overwrite - getValue: function() { - var v = this.getRawValue(); - return Ext.String.leftPad(v.h, 2, '0') + ':' + Ext.String.leftPad(v.m, 2, '0') + ':' - + Ext.String.leftPad(v.s, 2, '0'); - }, - // overwrite - setValue: function(value) { - this.value = Ext.isDate(value) ? Ext.Date.format(value, 'H:i:s') : value; - if(!this.rendered) { - return; - } - this.setRawValue(this.value); - this.validate(); - }, - // overwrite - disable: function() { - this.callParent(arguments); - this.callSpinnersFunction('disable', arguments); - }, - // overwrite - enable: function() { - this.callParent(arguments); - this.callSpinnersFunction('enable', arguments); - }, - // overwrite - setReadOnly: function() { - this.callParent(arguments); - this.callSpinnersFunction('setReadOnly', arguments); - }, - // overwrite - clearInvalid: function() { - this.callParent(arguments); - this.callSpinnersFunction('clearInvalid', arguments); - }, - // overwrite - isValid: function(preventMark) { - return this.hoursSpinner.isValid(preventMark) && this.minutesSpinner.isValid(preventMark) - && this.secondsSpinner.isValid(preventMark); - }, - // overwrite - validate: function() { - return this.hoursSpinner.validate() && this.minutesSpinner.validate() && this.secondsSpinner.validate(); - } - }); \ No newline at end of file diff -r 8756f7e423fb -r 39dd18124ebd resources/lib/translations_de.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/resources/lib/translations_de.js Thu Mar 19 14:31:07 2015 +0100 @@ -0,0 +1,51 @@ +/* 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. + */ + +/* + * More Translations for extJS. + * Not everything is covered in the original translation. + * This file can be used to extend it. + */ + +Ext.onReady(function() { + if (Ext.grid.RowEditor) { + Ext.grid.RowEditor.prototype.saveBtnText = "Speichern"; + Ext.grid.RowEditor.prototype.cancelBtnText = "Abbrechen"; + } + +}); + +//Übersetzungsfehler +Ext.define("Ext.locale.de.toolbar.Paging", { + override: "Ext.PagingToolbar", + beforePageText: "Seite", + afterPageText: "von {0}", + firstText: "Erste Seite", + prevText: "vorherige Seite", + nextText: "nächste Seite", + lastText: "letzte Seite", + refreshText: "Aktualisieren", + displayMsg: "Zeige Eintrag {0} - {1} von {2}", // Anzeige -> Zeige + emptyMsg: "Keine Daten vorhanden" +}); + +Ext.define("Ext.locale.de.picker.Date", { + override: "Ext.picker.Date", + todayText: "Heute", + minText: "Dieses Datum liegt vor dem erstmöglichen Datum", // von -> vor + maxText: "Dieses Datum liegt nach dem letztmöglichen Datum", + disabledDaysText: "", + disabledDatesText: "", + nextText: "Nächster Monat (Strg/Control + Rechts)", + prevText: "Vorheriger Monat (Strg/Control + Links)", + monthYearText: "Monat auswählen (Strg/Control + Hoch/Runter, um ein Jahr auszuwählen)", + todayTip: "Heute ({0}) (Leertaste)", + format: "d.m.Y", + startDay: 1 +}); +