comparison app/view/Viewport.js @ 497:7c0653e8d9f7

Fixed some js related issues (unused vars, arrays, etc.) and code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 06 Nov 2014 10:38:17 +0100
parents 850ccfe5f3c4
children 8b4ec61c5752
comparison
equal deleted inserted replaced
496:d07e5086a64b 497:7c0653e8d9f7
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz 1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH 2 * Software engineering by Intevation GmbH
3 * 3 *
4 * This file is Free Software under the GNU GPL (v>=3) 4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 /** 9 /**
10 * Viewport for the Lada-Client 10 * Viewport for the Lada-Client
11 * 11 *
12 * The viewport initialises the graphical elements of the application. For 12 * The viewport initialises the graphical elements of the application. For
13 * debugging it is possible to initialize other components directly see the 13 * debugging it is possible to initialize other components directly see the
14 * initComponent function. 14 * initComponent function.
15 */ 15 */
16 Ext.define('Lada.view.Viewport' ,{ 16 Ext.define('Lada.view.Viewport', {
17 extend: 'Ext.container.Viewport', 17 extend: 'Ext.container.Viewport',
18 requires: [ 18 requires: [
19 'Lada.store.Info', 19 'Lada.store.Info',
20 'Lada.view.search.List', 20 'Lada.view.search.List',
21 'Lada.view.proben.List' 21 'Lada.view.proben.List'
23 layout: 'fit', 23 layout: 'fit',
24 initComponent: function() { 24 initComponent: function() {
25 console.log('Setting up Viewport'); 25 console.log('Setting up Viewport');
26 this.initSearch(); 26 this.initSearch();
27 27
28 // Development related: 28 // Development related:
29 // Disable "initSearch" call and enable one of the following init 29 // Disable "initSearch" call and enable one of the following init
30 // methods to get a dialog directly without the need to click through 30 // methods to get a dialog directly without the need to click through
31 // the whole application. 31 // the whole application.
32 //this.initProbe(); 32 // this.initProbe();
33 //this.initOrt(); 33 // this.initOrt();
34 //this.initMessung(); 34 // this.initMessung();
35 //this.initMesswert(); 35 // this.initMesswert();
36 36
37 this.setInfo(); 37 this.setInfo();
38 this.callParent(arguments); 38 this.callParent(arguments);
39 }, 39 },
40 /** 40 /**
42 * of the application window. The data will be fetched from the server. 42 * of the application window. The data will be fetched from the server.
43 */ 43 */
44 setInfo: function() { 44 setInfo: function() {
45 var store = Ext.create('Lada.store.Info'); 45 var store = Ext.create('Lada.store.Info');
46 store.load({ 46 store.load({
47 callback: function(a,b,c) { 47 callback: function() {
48 var info = store.data.items[0]; 48 var info = store.data.items[0];
49 var clientVersion = "r261 (2013-07-26)";
50 var user = info.get('user'); 49 var user = info.get('user');
51 var groups = info.get('groups'); 50 var groups = info.get('groups');
52 var groupinfo = Ext.getCmp('groupinfo'); 51 var groupinfo = Ext.getCmp('groupinfo');
53 var userinfo = Ext.getCmp('userinfo'); 52 var userinfo = Ext.getCmp('userinfo');
54 userinfo.update(user); 53 userinfo.update(user);
63 */ 62 */
64 initProbe: function() { 63 initProbe: function() {
65 var store = Ext.getStore('Proben'); 64 var store = Ext.getStore('Proben');
66 store.load({ 65 store.load({
67 params: { 66 params: {
68 probeId: "000007575943X" 67 probeId: '000007575943X'
69 }, 68 },
70 callback: function() { 69 callback: function() {
71 var mstore = Ext.getStore('Messungen'); 70 var mstore = Ext.getStore('Messungen');
72 mstore.load({ 71 mstore.load({
73 params: { 72 params: {
74 probeId: "000007575943X" 73 probeId: '000007575943X'
75 } 74 }
76 }); 75 });
77 var model = store.data.items[0]; 76 var model = store.data.items[0];
78 var win = Ext.create('Lada.view.proben.Edit', {model: model}); 77 Ext.create('Lada.view.proben.Edit', {
78 model: model
79 });
79 } 80 }
80 }); 81 });
81 }, 82 },
82 /** 83 /**
83 * Function to initialize the edit window for a priticular messwert directly 84 * Function to initialize the edit window for a priticular messwert directly
85 */ 86 */
86 initMesswert: function() { 87 initMesswert: function() {
87 var store = Ext.getStore('Messwerte'); 88 var store = Ext.getStore('Messwerte');
88 store.load({ 89 store.load({
89 params: { 90 params: {
90 probeId: "000007575853X", 91 probeId: '000007575853X',
91 messungsId: "1" 92 messungsId: '1'
92 }, 93 },
93 callback: function() { 94 callback: function() {
94 var model = store.data.items[0]; 95 var model = store.data.items[0];
95 var win = Ext.create('Lada.view.messwerte.Create', { 96 Ext.create('Lada.view.messwerte.Create', {
96 model: model 97 model: model
97 }); 98 });
98 } 99 }
99 }); 100 });
100 }, 101 },
102 * Function to initialize the edit window for a priticular ort directly 103 * Function to initialize the edit window for a priticular ort directly
103 * @private 104 * @private
104 */ 105 */
105 initOrt: function() { 106 initOrt: function() {
106 var ort = Ext.create('Lada.model.Ort'); 107 var ort = Ext.create('Lada.model.Ort');
107 var win = Ext.create('Lada.view.orte.Create', { 108 Ext.create('Lada.view.orte.Create', {
108 model: ort 109 model: ort
109 }); 110 });
110 }, 111 },
111 /** 112 /**
112 * Function to initialize the edit window for a priticular ort directly 113 * Function to initialize the edit window for a priticular ort directly
115 initMessung: function() { 116 initMessung: function() {
116 var store = Ext.getStore('Messungen'); 117 var store = Ext.getStore('Messungen');
117 var kstore = Ext.getStore('KommentareM'); 118 var kstore = Ext.getStore('KommentareM');
118 var mstore = Ext.getStore('Messwerte'); 119 var mstore = Ext.getStore('Messwerte');
119 var sstore = Ext.getStore('Status'); 120 var sstore = Ext.getStore('Status');
120 probeId = "000007578314X"; 121 var probeId = '000007578314X';
121 store.load({ 122 store.load({
122 params: { 123 params: {
123 probeId: probeId 124 probeId: probeId
124 }, 125 },
125 callback: function () { 126 callback: function() {
126 console.log(store); 127 console.log(store);
127 var messung = store.data.items[0]; 128 var messung = store.data.items[0];
128 console.log(store.data.items[0]); 129 console.log(store.data.items[0]);
129 kstore.load({ 130 kstore.load({
130 params: { 131 params: {
143 probeId: probeId, 144 probeId: probeId,
144 messungsId: messung.get('id').messungsId 145 messungsId: messung.get('id').messungsId
145 } 146 }
146 }); 147 });
147 console.log('Creating Messung window'); 148 console.log('Creating Messung window');
148 //var messung = Ext.create('Lada.model.Messung'); 149 // var messung = Ext.create('Lada.model.Messung');
149 var win = Ext.create('Lada.view.messungen.Create', {model: messung}); 150 Ext.create('Lada.view.messungen.Create', {
151 model: messung
152 });
150 } 153 }
151 }); 154 });
152 }, 155 },
153 /** 156 /**
154 * Function to initialize the search window. This is the default method 157 * Function to initialize the search window. This is the default method
155 * called by the {@link Lada.view.Viewport#initComponent initComponent} method. 158 * called by the {@link Lada.view.Viewport#initComponent initComponent}
159 * method.
156 * @private 160 * @private
157 */ 161 */
158 initSearch: function() { 162 initSearch: function() {
159 this.items = [{ 163 this.items = [{
160 xtype: 'panel', 164 xtype: 'panel',
163 layout: { 167 layout: {
164 type: 'vbox', 168 type: 'vbox',
165 align: 'stretch' 169 align: 'stretch'
166 }, 170 },
167 dockedItems: [{ 171 dockedItems: [{
168 xtype: "toolbar", 172 xtype: 'toolbar',
169 dock: "top", 173 dock: 'top',
170 items: [{ 174 items: [{
171 xtype: "splitbutton", 175 xtype: 'splitbutton',
172 text: "Info", 176 text: 'Info',
173 menu: { 177 menu: {
174 items: [{ 178 items: [{
175 id: 'AboutBtn', 179 id: 'AboutBtn',
176 text: "About" 180 text: 'About'
177 }] 181 }]
178 } 182 }
179 }, "->", { 183 }, '->', {
180 xtype: 'box', 184 xtype: 'box',
181 autoEl: { 185 autoEl: {
182 tag: 'img', 186 tag: 'img',
183 src:'gfx/user-identity.png' 187 src: 'gfx/user-identity.png'
184 } 188 }
185 }, { 189 }, {
186 xtype: "tbtext", 190 xtype: 'tbtext',
187 id:"userinfo", 191 id: 'userinfo',
188 text:"" 192 text: ''
189 }, { 193 }, {
190 xtype: 'box', 194 xtype: 'box',
191 autoEl: { 195 autoEl: {
192 tag: 'img', 196 tag: 'img',
193 src:'gfx/network-workgroup.png' 197 src: 'gfx/network-workgroup.png'
194 } 198 }
195 }, { 199 }, {
196 xtype: "tbtext", 200 xtype: 'tbtext',
197 id:"groupinfo", 201 id: 'groupinfo',
198 text:"" 202 text: ''
199 }] 203 }]
200 }], 204 }],
201 items: [{ 205 items: [{
202 // Auswahl einer Abfrage. 206 // Auswahl einer Abfrage.
203 xtype: 'queryselector', 207 xtype: 'queryselector',

http://lada.wald.intevation.org