annotate app/view/window/OrtEdit.js @ 1009:afb355cc7fb3

Merged with stammdatengrids branch.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 21 Jan 2016 08:58:35 +0100
parents def27cdd0dfa
children
rev   line source
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
9 /**
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
10 * Window to edit a Ort
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.OrtEdit', {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortedit',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.panel.Map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'Lada.view.form.Ort',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'Lada.view.form.Location'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 ],
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 collapsible: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 maximizable: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 autoshow: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 layout: 'border',
688
6a6d1b02a1a3 constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
26 constrain: true,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
28 parentWindow: null,
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
29 probe: null,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 record: null,
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 614
diff changeset
31 grid: null,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
33 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
34 * This function initialises the Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
35 */
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 initComponent: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 if (this.record === null) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 Ext.Msg.alert('Kein valider Ort ausgewählt!');
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 return;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 }
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
42 if (this.probe === null) {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
43 Ext.Msg.alert('Zu dem Ort existiert keine Probe!');
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
44 this.callParent(arguments);
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
45 return;
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
46 }
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 this.title = 'Ort';
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 this.buttons = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 text: 'Schließen',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 scope: this,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 handler: this.close
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 this.width = 900;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 this.height = 515;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 this.bodyStyle = {background: '#fff'};
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56
709
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
57 // add listeners to change the window appearence when it becomes inactive
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
58 this.on({
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
59 activate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
60 this.getEl().removeCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
61 },
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
62 deactivate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
63 this.getEl().addCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
64 }
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
65 });
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
66
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 this.items = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 region: 'west',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 border: 0,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 layout: 'vbox',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 xtype: 'ortform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 xtype: 'locationform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 xtype: 'fset',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 layout: 'border',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 name: 'mapfield',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 title: 'Karte',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 padding: '5, 5',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 xtype: 'map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 layout: 'border',
614
04e380ce4d73 Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 606
diff changeset
95 record: this.record,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 },
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
99 name: 'map',
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
100 listeners: { //A listener which listens to the mappanels featureselected event
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
101 featureselected: this.selectedFeature
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
102 }
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
108 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
109 * Initialise the Data of this Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
110 */
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 initData: function() {
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
112 Ext.ClassManager.get('Lada.model.Ort').load(this.record.get('id'), {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
113 failure: function(record, action) {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
114 // TODO
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
115 },
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
116 success: function(record, response) {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
117 var me = this;
726
6bc05ba2f6b1 Fixed tree_modified check in orte edit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 709
diff changeset
118 if (record.get('treeModified') < record.get('parentModified')) {
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
119 Ext.Msg.show({
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
120 title: 'Probe nicht aktuell!',
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
121 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.',
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
122 buttons: Ext.Msg.OKCANCEL,
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
123 icon: Ext.Msg.WARNING,
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
124 closable: false,
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
125 fn: function(button) {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
126 if (button === 'ok') {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
127 me.close();
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
128 me.parentWindow.initData();
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
129 }
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
130 else {
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
131 me.record.set('treeModified', me.probe.get('treeModified'));
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
132 }
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
133 }
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
134 });
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
135 }
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
136 this.down('ortform').setRecord(record);
853
e5f72fb491f4 Made Ortform readonly when the probe is readonly
Dustin Demuth <dustin@intevation.de>
parents: 796
diff changeset
137 if (this.probe.get('readonly')) {
e5f72fb491f4 Made Ortform readonly when the probe is readonly
Dustin Demuth <dustin@intevation.de>
parents: 796
diff changeset
138 this.down('ortform').setReadOnly(true);
e5f72fb491f4 Made Ortform readonly when the probe is readonly
Dustin Demuth <dustin@intevation.de>
parents: 796
diff changeset
139 }
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
140 this.record = record;
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
141 },
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
142 scope: this
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 688
diff changeset
143 });
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 Ext.ClassManager.get('Lada.model.Location').load(this.record.get('ort'), {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 failure: function(record, action) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 // TODO
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 success: function(record, response) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 this.down('locationform').setRecord(record);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 this.down('locationform').setReadOnly(true);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 scope: this
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 });
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155
796
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
156 /**
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
157 * @private
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
158 * Override to display and update the map view in the panel.
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
159 */
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
160 afterRender: function(){
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
161 this.superclass.afterRender.apply(this, arguments);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
162 var map = this.down('map');
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
163 if (this.record) {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
164 map.selectFeature(this.record.get('ort'));
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
165 }
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
166 else {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
167 map.map.zoomToMaxExtent();
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
168 }
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
169 },
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
170
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
171 /**
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
172 * This function is used by the MapPanel, when a Feature was selected
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
173 */
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
174 selectedFeature: function(context, args) {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
175 var feature = args[0];
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
176 if (feature.attributes.id &&
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
177 feature.attributes.id !== '') {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
178 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
179 context.up('window').down('locationform').setRecord(record);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
180 context.up('window').down('locationform').setReadOnly(true);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
181 context.up('window').down('ortform').down('combobox').setValue(record.id);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
182 }
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
183 else {
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
184 context.up('window').down('locationform').setRecord(this.locationRecord);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
185 context.up('window').down('locationform').setReadOnly(false);
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
186 }
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
187 },
7267bae1d43f made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents: 726
diff changeset
188
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
189 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
190 * Instructs the fields / forms listed in this method to set a message.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
191 * @param errors These Errors shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
192 * @param warnings These Warning shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
193 */
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 setMessages: function(errors, warnings) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
198 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
199 * Instructs the fields / forms listed in this method to clear their messages.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 853
diff changeset
200 */
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 clearMessages: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 }
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 });

http://lada.wald.intevation.org