[Lada-commits] [PATCH 4 of 4] Issue56: Changed way how to set the form and window to readonly. Now all dialogs should

Wald Commits scm-commit at wald.intevation.org
Thu Aug 15 14:09:10 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1376568455 -7200
# Node ID 6a7a9267e00fa72568f8a248d327968668c69253
# Parent  8a3991b5c200015ad296cc5bf2bbd395c0e89d9f
Issue56: Changed way how to set the form and window to readonly. Now all dialogs should
habe proper readonly settings. Now the Save and Cancel button are displayed as
needed.

diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Kommentare.js
--- a/app/controller/Kommentare.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Kommentare.js	Thu Aug 15 14:07:35 2013 +0200
@@ -44,8 +44,16 @@
     },
     editItem: function(grid, record) {
         console.log('Editing Kommentar');
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('kommentarecreate', {model: record});
-        console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID
+        var ignore = Array();
+        if (readonly) {
+            var form = view.down('form');
+            form.setReadOnly(true, ignore);
+        }
     },
     createSuccess: function(form, record, operation) {
         var store = this.getKommentareStore();
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/MKommentare.js
--- a/app/controller/MKommentare.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/MKommentare.js	Thu Aug 15 14:07:35 2013 +0200
@@ -45,8 +45,16 @@
     },
     editItem: function(grid, record) {
         console.log('Editing Kommentar');
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('mkommentarecreate', {model: record});
-        console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID
+        var ignore = Array();
+        if (readonly) {
+            var form = view.down('form');
+            form.setReadOnly(true, ignore);
+        }
     },
     createSuccess: function(form, record, operation) {
         // Reload store
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Messungen.js
--- a/app/controller/Messungen.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Messungen.js	Thu Aug 15 14:07:35 2013 +0200
@@ -80,18 +80,19 @@
                 messungsId: record.get('messungsId')
             }
         });
-        var probe = this.getProbenStore().getById(record.get('probeId'));
+        record.getAuthInfo(this.initEditWindow);
+        console.log("Loaded Messung with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('messungenedit', {model: record});
-        if (probe.get('readonly') === true) {
+        var ignore = Array();
+        if (owner) {
+                ignore.push('fertig');
+        }
+        if (readonly) {
             var form = view.down('form');
-            // TODO: Field "fertig" must be editable (issue51). So we need to remove the
-            // readonly status if the user would be allowed to edit the probe
-            // if the "fertig" flag has not been set. (ti) <2013-08-08 10:24> 
-            var ignore = Array();
-            ignore.push('fertig');
             form.setReadOnly(true, ignore);
         }
-        console.log("Loaded Messung with ID " + record.getId()); //outputs ID
     },
     deleteItem: function(button) {
         // Get selected item in grid
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Messwert.js
--- a/app/controller/Messwert.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Messwert.js	Thu Aug 15 14:07:35 2013 +0200
@@ -51,14 +51,16 @@
     },
     editItem: function(grid, record) {
         console.log('Editing Messwert');
-        var probe = this.getProbenStore().getById(record.get('probeId'));
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('messwertecreate', {model: record});
-        if (probe.get('readonly') === true) {
+        var ignore = Array();
+        if (readonly) {
             var form = view.down('form');
-            form.setReadOnly(true);
+            form.setReadOnly(true, ignore);
         }
-
-        console.log("Loaded Messwert with ID " + record.getId()); //outputs ID
     },
     deleteItem: function(button) {
         var grid = button.up('grid');
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Orte.js
--- a/app/controller/Orte.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Orte.js	Thu Aug 15 14:07:35 2013 +0200
@@ -96,8 +96,16 @@
     },
     editItem: function(grid, record) {
         console.log('Editing Ort');
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded Ort with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('ortecreate', {model: record});
-        console.log("Loaded Ort with ID " + record.getId()); //outputs ID
+        var ignore = Array();
+        if (readonly) {
+            var form = view.down('form');
+            form.setReadOnly(true, ignore);
+        }
     },
     createSuccess: function(form, record, operation) {
         // Reload store
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Proben.js
--- a/app/controller/Proben.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Proben.js	Thu Aug 15 14:07:35 2013 +0200
@@ -88,8 +88,6 @@
     editItem: function(grid, record) {
         console.log('Editing Probe');
         var id = record.get('probeId');
-        var view = Ext.widget('probenedit', {modelId: id});
-
         // Load Zusatzwerte
         var pstore = this.getProbenzusatzwerteStore();
         pstore.load();
@@ -120,6 +118,7 @@
                 probeId: id
             }
         });
+        var view = Ext.widget('probenedit', {modelId: id});
         console.log("Loaded Probe with ID " + record.getId()); //outputs ID
     },
     createSuccess: function(form, record, response) {
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Status.js
--- a/app/controller/Status.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Status.js	Thu Aug 15 14:07:35 2013 +0200
@@ -43,8 +43,16 @@
     },
     editItem: function(grid, record) {
         console.log('Editing Status');
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded Status with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('statuscreate', {model: record});
-        console.log("Loaded Status with ID " + record.getId()); //outputs ID
+        var ignore = Array();
+        if (readonly) {
+            var form = view.down('form');
+            form.setReadOnly(true, ignore);
+        }
     },
     createSuccess: function(form, record, operation) {
         // Reload store
diff -r 8a3991b5c200 -r 6a7a9267e00f app/controller/Zusatzwerte.js
--- a/app/controller/Zusatzwerte.js	Thu Aug 15 14:05:08 2013 +0200
+++ b/app/controller/Zusatzwerte.js	Thu Aug 15 14:07:35 2013 +0200
@@ -44,10 +44,18 @@
     },
     editZusatzwert: function(grid, record) {
         console.log('Editing Zusatzwert');
+        record.getAuthInfo(this.initEditWindow)
+        console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID
+    },
+    initEditWindow: function(record, readonly, owner) {
         var view = Ext.widget('zusatzwertecreate', {model: record});
         // Mark PZW Selection readonly.
         view.down('probenzusatzwert').disabled = true;
-        console.log("Loaded Zusatzwert with ID " + record.getId()); //outputs ID
+        var ignore = Array();
+        if (readonly) {
+            var form = view.down('form');
+            form.setReadOnly(true, ignore);
+        }
     },
     createSuccess: function(form, record, operation) {
         // Reload store


More information about the Lada-commits mailing list