[Lada-commits] [PATCH 2 of 2] Fixed some js related issues (unused vars, arrays, etc.) and code style
Wald Commits
scm-commit at wald.intevation.org
Thu Nov 6 11:20:20 CET 2014
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1415269247 -3600
# Node ID ad7f574b382aae26cfa1cff7014c7e2e021576d8
# Parent 8b4ec61c5752013907ed1bf9f68ca4763707dfb8
Fixed some js related issues (unused vars, arrays, etc.) and code style.
diff -r 8b4ec61c5752 -r ad7f574b382a app/controller/Proben.js
--- a/app/controller/Proben.js Thu Nov 06 11:12:21 2014 +0100
+++ b/app/controller/Proben.js Thu Nov 06 11:20:47 2014 +0100
@@ -10,6 +10,7 @@
* Controller for Proben
*/
+// TODO: Move these functions into the controller.
function numOfErrors(proben) {
var errors = 0;
for (var key in proben) {
@@ -20,6 +21,7 @@
return errors;
}
+// TODO: Use tpl to generate the html document.
function buildImportReport(filename, msg, errors, warnings) {
var out = [];
// There is a entry for each imported proben in the errors dict (might be
diff -r 8b4ec61c5752 -r ad7f574b382a app/controller/Sql.js
--- a/app/controller/Sql.js Thu Nov 06 11:12:21 2014 +0100
+++ b/app/controller/Sql.js Thu Nov 06 11:20:47 2014 +0100
@@ -3,11 +3,9 @@
*
* This file is Free Software under the GNU GPL (v>=3)
* and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
+ * the documentation coming with IMIS-Labordaten-Application for details.
*/
-var queries = new Array('query1', 'query2');
-
/**
* Controller for the Search
* This controller handles all logic related to the search
@@ -58,7 +56,7 @@
* The function will hide/display additional element related to the
* selected search query
*/
- selectSql: function(element, record, index) {
+ selectSql: function(element, record) {
var result = Ext.getCmp('result');
var filters = Ext.getCmp('queryfilters');
var sqlquery = Ext.getCmp('sqlquery');
@@ -95,66 +93,67 @@
filters.removeAll();
var hide = true;
// 2. Iterate over all configured filters
- for (var j=0; j < filterFields.length; j++) {
+ var j;
+ for (j = 0; j < filterFields.length; j++) {
var type = filterFields[j].type;
var name = filterFields[j].dataIndex;
var label = filterFields[j].label;
var multi = filterFields[j].multiSelect;
var field = null;
- if (type == "text") {
+ if (type === 'text') {
field = Ext.create('Ext.form.field.Text', {
name: name,
fieldLabel: label
});
}
- else if (type == "number") {
+ else if (type === 'number') {
field = Ext.create('Ext.form.field.Number', {
name: name,
fieldLabel: label
});
}
- else if (type == "datetime") {
+ else if (type === 'datetime') {
field = Ext.create('Lada.view.widgets.Datetime', {
name: name,
fieldLabel: label
});
}
- else if (type == "bool") {
+ else if (type === 'bool') {
field = Ext.create('Lada.view.widgets.Testdatensatz', {
name: name,
fieldLabel: label,
emptyText: ''
});
}
- else if (type == "listmst") {
+ else if (type === 'listmst') {
field = Ext.create('Lada.view.widgets.Mst', {
name: name,
fieldLabel: label,
multiSelect: multi
});
}
- else if (type == "listumw") {
+ else if (type === 'listumw') {
field = Ext.create('Lada.view.widgets.Uwb', {
name: name,
fieldLabel: label,
multiSelect: multi
});
}
- else if (type == "listdbasis") {
+ else if (type === 'listdbasis') {
field = Ext.create('Lada.view.widgets.Datenbasis', {
name: name,
fieldLabel: label,
multiSelect: multi
});
}
- else if (type == "listver") {
+ else if (type === 'listver') {
field = Ext.create('Lada.view.widgets.Verwaltungseinheit', {
name: name,
fieldLabel: label,
multiSelect: multi
});
}
- else if (type == "listnetz") {
+ else if (type === 'listnetz') {
field = Ext.create('Lada.view.widgets.Netzbetreiber', {
name: name,
fieldLabel: label,
@@ -177,7 +176,7 @@
* Function is called when the user clicks the search button. The function
* will perform a search to the server on refreshes the result list.
*/
- search: function(element, record, index) {
+ search: function() {
var result = Ext.getCmp('result');
var filters = Ext.getCmp('queryfilters');
var search = Ext.getCmp('search');
@@ -189,7 +188,7 @@
var filter = filters.items.items[i];
var value = filter.getValue();
if (value instanceof Array) {
- value = value.join(",");
+ value = value.join(',');
}
searchParams[filter.getName()] = value;
}
@@ -199,20 +198,20 @@
result.show();
},
- reset: function(element, record, index) {
- var buttons = Ext.getCmp('SearchBtnPanel');
- var result = Ext.getCmp('result');
- //for (var i = 0; i < queries.length; ++i) {
- // var toHide = Ext.getCmp(queries[i]);
- // toHide.hide();
- //}
- //result.hide();
- //buttons.hide();
+ reset: function() {
+ // var buttons = Ext.getCmp('SearchBtnPanel');
+ // var result = Ext.getCmp('result');
+ // for (var i = 0; i < queries.length; ++i) {
+ // var toHide = Ext.getCmp(queries[i]);
+ // toHide.hide();
+ // }
+ // result.hide();
+ // buttons.hide();
},
- about: function(element, record, index) {
+ about: function() {
var info = this.getInfoStore();
- var view = Ext.widget('about', {
+ Ext.widget('about', {
info: info
});
}
diff -r 8b4ec61c5752 -r ad7f574b382a app/controller/Status.js
--- a/app/controller/Status.js Thu Nov 06 11:12:21 2014 +0100
+++ b/app/controller/Status.js Thu Nov 06 11:20:47 2014 +0100
@@ -3,7 +3,7 @@
*
* This file is Free Software under the GNU GPL (v>=3)
* and comes with ABSOLUTELY NO WARRANTY! Check out
- * the documentation coming with IMIS-Labordaten-Application for details.
+ * the documentation coming with IMIS-Labordaten-Application for details.
*/
Ext.define('Lada.controller.Status', {
@@ -50,7 +50,7 @@
var zusatzwert = Ext.create('Lada.model.Status');
zusatzwert.set('probeId', button.probeId);
zusatzwert.set('messungsId', button.parentId);
- var view = Ext.widget('statuscreate', {
+ Ext.widget('statuscreate', {
model: zusatzwert
});
},
@@ -61,18 +61,18 @@
record.getAuthInfo(this.initEditWindow, messung.get('probeId'));
},
- initEditWindow: function(record, readonly, owner) {
+ initEditWindow: function(record, readonly) {
var view = Ext.widget('statuscreate', {
model: record
});
- var ignore = Array();
+ var ignore = [];
if (readonly) {
var form = view.down('form');
form.setReadOnly(true, ignore);
}
},
- createSuccess: function(form, record, operation) {
+ createSuccess: function(form) {
// Reload store
var store = this.getStatusStore();
store.reload();
@@ -80,7 +80,7 @@
win.close();
},
- editSuccess: function(form, record, operation) {
+ editSuccess: function(form) {
// Reload store
var store = this.getStatusStore();
store.reload();
More information about the Lada-commits
mailing list