changeset 681:f373446325b4

a probe can not be edited when the readonly flag was sent by the server
author Dustin Demuth <dustin@intevation.de>
date Tue, 24 Mar 2015 15:33:11 +0100
parents 31fc4f94f98f
children 7b6467edfdfc
files app/view/form/Probe.js app/view/window/ProbeEdit.js
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/form/Probe.js	Tue Mar 24 12:15:39 2015 +0100
+++ b/app/view/form/Probe.js	Tue Mar 24 15:33:11 2015 +0100
@@ -35,9 +35,9 @@
     recordId: null,
 
     trackResetOnLoad: true,
+    readonly: false,
 
     initComponent: function() {
-
         var me = this;
         this.items = [{
             xtype: 'fieldset',
@@ -287,8 +287,11 @@
                 }]
             }]
         }];
+        this.callParent(arguments);
 
-        this.callParent(arguments);
+        if (this.readonly){
+            this.setReadOnly(true);
+        }
     },
 
     setRecord: function(record) {
@@ -344,7 +347,7 @@
         this.down('datetime[name=probeentnahmeEnde]').clearWarningOrError();
         this.down('datetime[name=solldatumBeginn]').clearWarningOrError();
         this.down('datetime[name=solldatumEnde]').clearWarningOrError();
-        //this.down('cbox[name=probeNehmerId]').setReadOnly(value);
+        //this.down('numberfield[name=probeNehmerId]').clearWarningOrError();
     },
 
     setReadOnly: function(value) {
@@ -363,17 +366,22 @@
         this.down('datetime[name=probeentnahmeEnde]').setReadOnly(value);
         this.down('datetime[name=solldatumBeginn]').setReadOnly(value);
         this.down('datetime[name=solldatumEnde]').setReadOnly(value);
-        //this.down('cbox[name=probeNehmerId]').setReadOnly(value);
+        this.down('numberfield[name=probeNehmerId]').setReadOnly(value);
     },
 
     buildDescriptors: function() {
         var fields = [];
+        var ro = false;
+        if (this.readonly) {
+            ro = true;
+        }
         for (var i = 0; i < 12; i++) {
             fields[i] = {
                 fieldLabel: 'S' + i,
                 name: 's' + i,
                 labelWidth: 25,
-                margin: '0, 10, 5, 0'
+                margin: '0, 10, 5, 0',
+                readOnly: ro
             };
         }
         return fields;
--- a/app/view/window/ProbeEdit.js	Tue Mar 24 12:15:39 2015 +0100
+++ b/app/view/window/ProbeEdit.js	Tue Mar 24 15:33:11 2015 +0100
@@ -53,7 +53,8 @@
             autoScroll: true,
             items: [{
                 xtype: 'probeform',
-                recordId: this.record.get('id')
+                recordId: this.record.get('id'),
+                readonly: this.record.get('readonly')
              }, {
                 xtype: 'fset',
                 name: 'messungen',

http://lada.wald.intevation.org