[Lada-commits] [PATCH 1 of 3] Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme
Wald Commits
scm-commit at wald.intevation.org
Fri Jul 10 18:20:05 CEST 2015
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1436545080 -7200
# Node ID 03f39ddae5965114210a39835ff800ba61f62ac9
# Parent e44070aa45d27f02b7c187721fca657502bbb0a5
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
diff -r e44070aa45d2 -r 03f39ddae596 app/controller/FilterResult.js
--- a/app/controller/FilterResult.js Fri Jul 10 17:14:19 2015 +0200
+++ b/app/controller/FilterResult.js Fri Jul 10 18:18:00 2015 +0200
@@ -34,6 +34,9 @@
'filterresultgrid toolbar button[action=addMessprogramm]': {
click: this.addMessprogrammItem
},
+ 'filterresultgrid toolbar button[action=genProbenFromMessprogramm]': {
+ click: this.genProbenFromMessprogramm
+ },
'filterresultgrid toolbar button[action=import]': {
click: this.uploadFile
},
@@ -101,6 +104,46 @@
},
/**
+ * 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
+ });
+ }
+ },
+
+ /**
* This function opens a {@link Lada.view.window.FileUpload}
* window to upload a LAF-File
*/
diff -r e44070aa45d2 -r 03f39ddae596 app/view/grid/FilterResult.js
--- a/app/view/grid/FilterResult.js Fri Jul 10 17:14:19 2015 +0200
+++ b/app/view/grid/FilterResult.js Fri Jul 10 18:18:00 2015 +0200
@@ -42,13 +42,6 @@
action: 'addProbe',
disabled: false
}, {
- text: 'Messprogramm erstellen',
- icon: 'resources/img/list-add.png',
- action: 'addMessprogramm',
- disabled: true
- },
- '-',
- {
text: 'Proben Importieren',
icon: 'resources/img/svn-commit.png',
action: 'import',
@@ -58,8 +51,19 @@
icon: 'resources/img/svn-update.png',
action: 'export',
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);
@@ -94,6 +98,7 @@
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();
@@ -101,6 +106,7 @@
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();
diff -r e44070aa45d2 -r 03f39ddae596 app/view/window/GenProbenFromMessprogramm.js
--- a/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 17:14:19 2015 +0200
+++ b/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 18:18:00 2015 +0200
@@ -124,7 +124,9 @@
this.getEl().addCls('window-inactive');
},
close: function () {
- this.parentWindow.probenWindow = null;
+ if (this.parentWindow) {
+ this.parentWindow.probenWindow = null;
+ }
}
});
More information about the Lada-commits
mailing list