comparison app/controller/Base.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 * Base Controller 10 * Base Controller
11 * 11 *
29 models: [], 29 models: [],
30 init: function() { 30 init: function() {
31 this.addListeners(); 31 this.addListeners();
32 }, 32 },
33 /** 33 /**
34 * Function to add listeners for various events in UI items. The UI Items are selected 34 * Function to add listeners for various events in UI items. The UI Items
35 * with a CSS like selector.See ComponentQuery documentation for more 35 * are selected with a CSS like selector.See ComponentQuery documentation
36 * details. The function is called while initializing the controller. 36 * for more details.
37 * The function is called while initializing the controller.
37 * 38 *
38 * The function should be overwritten by a specfic implementation. 39 * The function should be overwritten by a specfic implementation.
39 */ 40 */
40 addListeners: function() { 41 addListeners: function() {
41 this.control({}); 42 this.control({});
52 /** 53 /**
53 * Method to open a window to enter the values for a new kommentar. 54 * Method to open a window to enter the values for a new kommentar.
54 * The method is called when the user clicks on the "Add" button in the 55 * The method is called when the user clicks on the "Add" button in the
55 * grid toolbar. 56 * grid toolbar.
56 */ 57 */
57 addItem: function(button) {}, 58 addItem: function() {
59 return;
60 },
58 /** 61 /**
59 * Method to open a window to edit the values for an existing kommentar. 62 * Method to open a window to edit the values for an existing kommentar.
60 * The method is called when the user doubleclicks on the item in the 63 * The method is called when the user doubleclicks on the item in the
61 * grid. 64 * grid.
62 */ 65 */
63 editItem: function(grid, record) {}, 66 editItem: function() {
67 return;
68 },
64 /** 69 /**
65 * Method to delete a kommentar. This will trigger the display of a 70 * Method to delete a kommentar. This will trigger the display of a
66 * Confirmation dialog. After the deletion the related store will be 71 * Confirmation dialog. After the deletion the related store will be
67 * refreshed. 72 * refreshed.
68 * The method is called when the user selects the item in the grid and 73 * The method is called when the user selects the item in the grid and
76 var store = grid.getStore(); 81 var store = grid.getStore();
77 var deleteUrl = selection.getProxy().url + selection.getId(); 82 var deleteUrl = selection.getProxy().url + selection.getId();
78 Ext.Ajax.request({ 83 Ext.Ajax.request({
79 url: deleteUrl, 84 url: deleteUrl,
80 method: 'DELETE', 85 method: 'DELETE',
81 success: function(response, opts) { 86 success: function() {
82 store.reload(); 87 store.reload();
83 } 88 }
84 }); 89 });
85 console.log('Deleting ' + selection); 90 console.log('Deleting ' + selection);
86 } else { 91 }
92 else {
87 console.log('Cancel Deleting ' + selection); 93 console.log('Cancel Deleting ' + selection);
88 } 94 }
89 }); 95 });
90 }, 96 },
91 /** 97 /**
92 * Method to trigger the action after successfull save (create). 98 * Method to trigger the action after successfull save (create).
93 * In this case the related store is refreshed and the window is closed. 99 * In this case the related store is refreshed and the window is closed.
94 */ 100 */
95 createSuccess: function(form, record, operation) {}, 101 createSuccess: function() {
102 return;
103 },
96 /** 104 /**
97 * Method to trigger the action after save (create) fails. 105 * Method to trigger the action after save (create) fails.
98 * In this case a Message Boss with a general error is shown. 106 * In this case a Message Boss with a general error is shown.
99 */ 107 */
100 createFailure: function(form, record, operation) { 108 createFailure: function(form) {
101 Ext.MessageBox.show({ 109 Ext.MessageBox.show({
102 title: 'Fehler beim Speichern', 110 title: 'Fehler beim Speichern',
103 msg: form.message, 111 msg: form.message,
104 icon: Ext.MessageBox.ERROR, 112 icon: Ext.MessageBox.ERROR,
105 buttons: Ext.Msg.OK 113 buttons: Ext.Msg.OK
107 }, 115 },
108 /** 116 /**
109 * Method to trigger the action after successfull save (edit). 117 * Method to trigger the action after successfull save (edit).
110 * In this case the related store is refreshed and the window is closed. 118 * In this case the related store is refreshed and the window is closed.
111 */ 119 */
112 editSuccess: function(form, record, operation) {}, 120 editSuccess: function() {
121 return;
122 },
113 /** 123 /**
114 * Method to trigger the action after save ( edit) fails. 124 * Method to trigger the action after save ( edit) fails.
115 * In this case a Message Boss with a general error is shown. 125 * In this case a Message Boss with a general error is shown.
116 */ 126 */
117 editFailure: function(form, record, operation) { 127 editFailure: function(form) {
118 Ext.MessageBox.show({ 128 Ext.MessageBox.show({
119 title: 'Fehler beim Speichern', 129 title: 'Fehler beim Speichern',
120 msg: form.message, 130 msg: form.message,
121 icon: Ext.MessageBox.ERROR, 131 icon: Ext.MessageBox.ERROR,
122 buttons: Ext.Msg.OK 132 buttons: Ext.Msg.OK

http://lada.wald.intevation.org