comparison app/view/window/OrtEdit.js @ 690:e88381fb3bdb

Use treeModiefied timestamp to determine if working with 'old' objects.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 25 Mar 2015 16:46:48 +0100
parents 6a6d1b02a1a3
children 6f6d2df00130
comparison
equal deleted inserted replaced
689:c07419f07a0c 690:e88381fb3bdb
23 maximizable: true, 23 maximizable: true,
24 autoshow: true, 24 autoshow: true,
25 layout: 'border', 25 layout: 'border',
26 constrain: true, 26 constrain: true,
27 27
28 parentWindow: null,
29 probe: null,
28 record: null, 30 record: null,
29 grid: null, 31 grid: null,
30 32
31 initComponent: function() { 33 initComponent: function() {
32 if (this.record === null) { 34 if (this.record === null) {
33 Ext.Msg.alert('Kein valider Ort ausgewählt!'); 35 Ext.Msg.alert('Kein valider Ort ausgewählt!');
36 this.callParent(arguments);
37 return;
38 }
39 if (this.probe === null) {
40 Ext.Msg.alert('Zu dem Ort existiert keine Probe!');
34 this.callParent(arguments); 41 this.callParent(arguments);
35 return; 42 return;
36 } 43 }
37 this.title = 'Ort'; 44 this.title = 'Ort';
38 this.buttons = [{ 45 this.buttons = [{
81 }]; 88 }];
82 this.callParent(arguments); 89 this.callParent(arguments);
83 }, 90 },
84 91
85 initData: function() { 92 initData: function() {
86 this.down('ortform').setRecord(this.record); 93 Ext.ClassManager.get('Lada.model.Ort').load(this.record.get('id'), {
94 failure: function(record, action) {
95 // TODO
96 },
97 success: function(record, response) {
98 var me = this;
99 if (this.probe.get('treeModified') < record.get('treeModified')) {
100 Ext.Msg.show({
101 title: 'Probe nicht aktuell!',
102 msg: 'Die zugehörige Probe wurde verändert.\nMöchten Sie zu der Probe zurückkehren und neu laden?\nOhne das erneute Laden der Probe wird das Speichern des Ortes nicht möglich sein.',
103 buttons: Ext.Msg.OKCANCEL,
104 icon: Ext.Msg.WARNING,
105 closable: false,
106 fn: function(button) {
107 if (button === 'ok') {
108 me.close();
109 me.parentWindow.initData();
110 }
111 else {
112 me.record.set('treeModified', me.probe.get('treeModified'));
113 }
114 }
115 });
116 }
117 this.down('ortform').setRecord(record);
118 this.record = record;
119 },
120 scope: this
121 });
87 Ext.ClassManager.get('Lada.model.Location').load(this.record.get('ort'), { 122 Ext.ClassManager.get('Lada.model.Location').load(this.record.get('ort'), {
88 failure: function(record, action) { 123 failure: function(record, action) {
89 // TODO 124 // TODO
90 }, 125 },
91 success: function(record, response) { 126 success: function(record, response) {

http://lada.wald.intevation.org