annotate app/view/window/MessprogrammOrt.js @ 821:4194f77e7bb1

added an errortext
author Dustin Demuth <dustin@intevation.de>
date Fri, 29 May 2015 11:00:49 +0200
parents 097d4edc2f00
children def27cdd0dfa
rev   line source
797
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * Window to add a Ort to a Messprogramm
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.MessprogrammOrt', {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.messprogrammort',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 requires: [
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
17 'Lada.model.Ort',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
18 'Lada.view.panel.Map',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19 'Lada.view.widget.Location',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20 'Lada.view.form.Location'
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 ],
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 collapsible: true,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 maximizable: true,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 autoshow: true,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 layout: 'border',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27 constrain: true,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29 parentWindow: null,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 record: null,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 initComponent: function() {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 var i18n = Lada.getApplication().bundle;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 this.title = i18n.getMsg('messprogrammort.window.title');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 this.buttons = [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 text: i18n.getMsg('apply'),
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 scope: this,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 handler: this.apply
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 }, {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 text: i18n.getMsg('cancel'),
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 scope: this,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 handler: function() {
818
097d4edc2f00 Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents: 797
diff changeset
44 this.close();
797
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 this.parentWindow.down('messprogrammform')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 .ortWindow = null;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 }];
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 this.width = 900;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 this.height = 515;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 this.bodyStyle = {background: '#fff'};
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 // add listeners to change the window appearence when it becomes inactive
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 this.on({
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 activate: function(){
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 this.getEl().removeCls('window-inactive');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 deactivate: function(){
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 this.getEl().addCls('window-inactive');
818
097d4edc2f00 Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents: 797
diff changeset
60 },
097d4edc2f00 Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents: 797
diff changeset
61 close: function () {
097d4edc2f00 Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents: 797
diff changeset
62 this.parentWindow.down('messprogrammform')
097d4edc2f00 Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents: 797
diff changeset
63 .ortWindow = null;
797
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 });
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 this.items = [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 region: 'west',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 border: 0,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 layout: 'vbox',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 items: [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 xtype: 'fieldset',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 title: i18n.getMsg('ortId'),
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 margin: 5,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 items: [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 border: 0,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 margin: '0, 0, 10, 0',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 items: [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 xtype: 'location',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 fieldLabel: i18n.getMsg('ortId'),
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 labelWidth: 80,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 width: 280,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
83 forceSelection: true,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 name: 'ortId',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
85 listeners: {//Update MapPanel etc...
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
86 select: this.updateDetails
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
87 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
88 }]
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 }]
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
90 }, {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
91 xtype: 'locationform',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
92 margin: 5,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
93 recordId: this.record.get('ortId')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
94 }]
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
95 }, {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
96 xtype: 'fset',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
97 bodyStyle: {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
98 background: '#fff'
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
99 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
100 layout: 'border',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
101 name: 'mapfield',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
102 title: 'Karte',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 region: 'center',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
104 padding: '5, 5',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
105 margin: 5,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
106 items: [{
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
107 xtype: 'map',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
108 region: 'center',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
109 layout: 'border',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
110 record: this.record.get('ortId') ? this.record : null,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
111 bodyStyle: {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
112 background: '#fff'
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
113 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
114 name: 'map',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
115 listeners: { //A listener which listens to the mappanels featureselected event
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
116 featureselected: this.selectedFeature
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
117 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
118 }]
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 }];
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
120 this.callParent(arguments);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 initData: function() {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 //Only do this if an OrtId exists...
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 var ortId = this.record.get('ortId');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127 if (ortId) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 Ext.ClassManager.get('Lada.model.Ort').load(ortId, {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 failure: function(record, action) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 // TODO
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 success: function(record, response) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 var me = this;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 if (record.get('treeModified') < record.get('parentModified')) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 Ext.Msg.show({
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136 title: 'Messprogramm nicht aktuell!',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
137 msg: 'Das zugehörige Messprogramm wurde verändert.\nMöchten Sie zu dem Messprogramm zurückkehren und neu laden?\nOhne das erneute Laden des Messprogrammes wird das Speichern des Ortes nicht möglich sein.',
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138 buttons: Ext.Msg.OKCANCEL,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
139 icon: Ext.Msg.WARNING,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 closable: false,
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
141 fn: function(button) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
142 if (button === 'ok') {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
143 me.close();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
144 me.parentWindow.initData();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
145 me.parentWindow.down('messprogrammform')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
146 .ortWindow = null;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
147 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
148 else {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
149 me.record.set('treeModified', me.probe.get('treeModified'));
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
150 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
151 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
152 });
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
153 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
154 this.record = record;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
155 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
156 scope: this
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
157 });
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
158 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
159 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
160
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
161 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
162 * @private
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
163 * Override to display and update the map view in the panel.
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
164 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
165 afterRender: function(){
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
166 this.superclass.afterRender.apply(this, arguments);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
167 var map = this.down('map');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
168 if (this.record.get('ortId')) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
169 map.selectFeature(this.record.get('ortId'));
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
170 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
171 else {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
172 map.map.zoomToMaxExtent();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
173 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
174 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
175
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
176 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
177 * This function is used by the MapPanel, when a Feature was selected
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
178 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
179 selectedFeature: function(context, args) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
180 var feature = args[0];
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 if (feature.attributes.id &&
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 feature.attributes.id !== '') {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
184 context.up('window').down('locationform').setRecord(record);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 context.up('window').down('locationform').setReadOnly(true);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
186 context.up('window').down('location').down('combobox').setValue(record.id);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
187 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
188 else {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
189 context.up('window').down('locationform').setRecord(this.locationRecord);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
190 context.up('window').down('locationform').setReadOnly(false);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
191 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
192 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
193
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
194 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
195 * updateDetails is used when a value is selected within the location combobox
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
196 * When this function is called, the map element within the window
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
197 * which is embedding this form is updated.
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
198 *
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
199 * Mostly the same as in Lada.controlle.form.Ort
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
200 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
201 updateDetails: function(combobox, record) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
202 var win = combobox.up('window');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
203 var details = win.down('locationform');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
204 //var id = record[0].get('id'); // We are interested in the cbox...
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
205 var id = combobox.getValue();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
206
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
207 if (details) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
208 var toLoad = Ext.data.StoreManager.get('locations').getById(id);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
209 win.down('locationform').setRecord(toLoad);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 win.down('map').selectFeature(id);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
211 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
212 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
213
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
214 /**
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
215 * Write the selected ortId into the record, and update the MessprogrammWindow.
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
216 */
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
217 apply: function(button) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
218 var win = button.up('window');
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
219 var ortId = win.down('location').down('combobox').value;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
220 if (this.parentWindow) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
221 this.parentWindow.down('messprogrammform').down('location')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
222 .down('combobox').setValue(ortId);
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
223 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
224
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
225 this.parentWindow.down('messprogrammform')
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
226 .ortWindow = null;
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
227 this.close();
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
228 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
229 setMessages: function(errors, warnings) {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
230 //todo this is a stub
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
231 },
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
232
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
233 clearMessages: function() {
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
234 //todo this is a stub
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
235 }
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
236 });
b8fd43021c29 Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
237

http://lada.wald.intevation.org