[Lada-commits] [PATCH 3 of 9] Readonly was missing
Wald Commits
scm-commit at wald.intevation.org
Thu Mar 26 17:31:45 CET 2015
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1427381690 -3600
# Node ID 817524db4017f725980df4ba42ca1aa4da39a0e4
# Parent c31644b3d44533be48bb7f1d34667899ec1115a8
Readonly was missing
diff -r c31644b3d445 -r 817524db4017 app/controller/form/Messung.js
--- a/app/controller/form/Messung.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/controller/form/Messung.js Thu Mar 26 15:54:50 2015 +0100
@@ -57,11 +57,16 @@
formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
var json = response.request.scope.reader.jsonData;
if (json) {
- formPanel.setMessages(json.errors, json.warnings);
+ 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('errmsgtitle'), Lada.getApplication().bundle.getMsg(json.message));
+ }
}
}
});
- console.log('save');
},
discard: function(button) {
diff -r c31644b3d445 -r 817524db4017 app/controller/form/Probe.js
--- a/app/controller/form/Probe.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/controller/form/Probe.js Thu Mar 26 15:54:50 2015 +0100
@@ -58,11 +58,18 @@
formPanel.getForm().loadRecord(rec);
var json = response.request.scope.reader.jsonData;
if (json) {
- formPanel.setMessages(json.errors, json.warnings);
+ 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('errmsgtitle')
+ +' '+json.message,
+ Lada.getApplication().bundle.getMsg(json.message));
+ }
}
}
});
- console.log('save');
},
discard: function(button) {
diff -r c31644b3d445 -r 817524db4017 app/model/Messung.js
--- a/app/model/Messung.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/model/Messung.js Thu Mar 26 15:54:50 2015 +0100
@@ -18,6 +18,9 @@
name: 'owner',
type: 'boolean'
}, {
+ name: 'readonly',
+ type: 'boolean'
+ }, {
name: 'probeId'
}, {
name: 'mmtId'
diff -r c31644b3d445 -r 817524db4017 app/view/Viewport.js
--- a/app/view/Viewport.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/view/Viewport.js Thu Mar 26 15:54:50 2015 +0100
@@ -44,7 +44,20 @@
items: [{
text: 'About',
action: 'about'
- }]
+ }, {
+ text: 'Zeit',
+ handler: function(){
+ thetime = new Date();
+ Ext.Msg.alert("Zeit", "Laut Ihrer lokalen Systemuhr ist es\n"+
+ thetime.toString() + "\n\n" +
+ "Das entspricht der Serverzeit:\n" +
+ thetime.toUTCString() + "\n\n" +
+ "Alle Messwerte werden in GMT/UTC auf dem Server gespeichert. " +
+ "Ihr Webbrowser rechnet diese automatisch um."
+ );
+ }
+ }
+ ]
}
}, '->', {
xtype: 'box',
diff -r c31644b3d445 -r 817524db4017 app/view/window/MessungEdit.js
--- a/app/view/window/MessungEdit.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/view/window/MessungEdit.js Thu Mar 26 15:54:50 2015 +0100
@@ -96,6 +96,7 @@
initData: function() {
this.clearMessages();
+ var that = this;
Ext.ClassManager.get('Lada.model.Messung').load(this.record.get('id'), {
failure: function(record) {
// TODO
@@ -117,6 +118,7 @@
}
else {
me.record.set('treeModified', me.probe.get('treeModified'));
+ that.disableForm();
}
}
});
@@ -130,6 +132,32 @@
},
scope: this
});
+ console.log(this.record);
+ if (this.record.get('readonly') == true){
+ this.disableForm();
+ }
+ },
+
+ disableForm: function(){
+ this.down('messungform').setReadOnly(true);
+ this.disableChildren();
+ },
+
+ enableForm: function(){
+ this.down('messungform').setReadOnly(false);
+ this.enableChildren();
+ },
+
+ disableChildren: function(){
+ this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
+ this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
+ this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
+ },
+
+ enableChildren: function(){
+ this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
+ this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
+ this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
},
setMessages: function(errors, warnings) {
diff -r c31644b3d445 -r 817524db4017 app/view/window/ProbeEdit.js
--- a/app/view/window/ProbeEdit.js Thu Mar 26 14:13:47 2015 +0100
+++ b/app/view/window/ProbeEdit.js Thu Mar 26 15:54:50 2015 +0100
@@ -30,6 +30,7 @@
record: null,
+
initComponent: function() {
if (this.record === null) {
Ext.Msg.alert('Keine valide Probe ausgewählt!');
@@ -122,9 +123,18 @@
},
scope: this
});
+
+ // If the Probe is ReadOnly, disable Inputfields and grids
if (this.record.get('readonly') == true){
this.down('probeform').setReadOnly(true);
this.disableChildren();
+
+ //The Owner of a Probe is always allowed to add a Messung.
+ // ToDo ist it required to check if a Status exists?
+ if (this.record.get('owner') == true){
+ //allow to add Messungen
+ this.down('fset[name=messungen]').down('messunggrid').down('button[name=add]').enable();
+ }
}
},
diff -r c31644b3d445 -r 817524db4017 resources/i18n/Lada.properties
--- a/resources/i18n/Lada.properties Thu Mar 26 14:13:47 2015 +0100
+++ b/resources/i18n/Lada.properties Thu Mar 26 15:54:50 2015 +0100
@@ -16,6 +16,7 @@
652: Geo: Werte passen nicht zusammen
661: Date: Datum liegt in der Zukunft
662: Date: Anfang nach Ende
+697: Der zugrundeliegende Datensatz wurde in der Zwischenzeit verändert
699: Keine Berechtigung
! Import errors
diff -r c31644b3d445 -r 817524db4017 resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties Thu Mar 26 14:13:47 2015 +0100
+++ b/resources/i18n/Lada_de-DE.properties Thu Mar 26 15:54:50 2015 +0100
@@ -16,6 +16,7 @@
652: Werte passen nicht zusammen
661: Datum liegt in der Zukunft
662: Anfang nach Ende
+697: Der zugrundeliegende Datensatz wurde in der Zwischenzeit verändert
698: Kein Zugriff
699: Keine Berechtigung
@@ -31,3 +32,8 @@
##
entnahmeOrt: Entnahmeort
test: Testdatensatz
+
+##
+# Msg:
+##
+errmsgtitle: Fehler
More information about the Lada-commits
mailing list