From ceea2cb9760e790d4652ed60966eb81d82f69891 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 31 Jan 2017 08:29:00 -0700 Subject: [PATCH] Some more code cleanup: - Remove some unexecutable code - Fix some variable declarations (to satisfy Scrutenizer) --- api/js/egw_action/egw_action_popup.js | 8 ++-- api/js/egw_json.js | 54 --------------------------- api/js/etemplate/et2_widget_grid.js | 3 +- api/js/jsapi/egw_calendar.js | 2 +- 4 files changed, 7 insertions(+), 60 deletions(-) diff --git a/api/js/egw_action/egw_action_popup.js b/api/js/egw_action/egw_action_popup.js index e7652a9ab8..c9cd4bea62 100644 --- a/api/js/egw_action/egw_action_popup.js +++ b/api/js/egw_action/egw_action_popup.js @@ -643,12 +643,12 @@ function egwPopupActionImplementation() var paste_action = mgr.getActionById('egw_paste'); // Fake UI so we can simulate the position of the drop + var ui = { + position: {top: 0, left: 0}, + offset: {top: 0, left: 0} + }; if(this._context.event) { - var ui = { - position: {top: 0, left: 0}, - offset: {top: 0, left: 0} - }; var event = this._context.event.originalEvent; ui.position = {top: event.pageY, left: event.pageX}; ui.offset = {top: event.offsetY, left: event.offsetX}; diff --git a/api/js/egw_json.js b/api/js/egw_json.js index 926bd1cd02..96fcb470c5 100644 --- a/api/js/egw_json.js +++ b/api/js/egw_json.js @@ -87,60 +87,6 @@ function egw_json_encode(input) { egw.debug("warn", "Function %s is deprecated, use egw.jsonEncode() instead", arguments.callee.name); return egw.jsonEncode(input); - if (input == null || !input && input.length == 0) return 'null'; - - var simple_res = _egw_json_encode_simple(input); - if (simple_res == null) - { - switch (input.constructor) - { - case Array: - var buf = []; - for (var k in input) - { - //Filter non numeric entries - if (!isNaN(k)) - buf.push(egw_json_encode(input[k])); - } - return '[' + buf.join(',') + ']'; - - case Object: - var buf = []; - for (var k in input) - { - buf.push(_egw_json_encode_simple(k) + ':' + egw_json_encode(input[k])); - } - return '{' + buf.join(',') + '}'; - - default: - switch(typeof input) - { - case 'array': - var buf = []; - for (var k in input) - { - //Filter non numeric entries - if (!isNaN(k)) - buf.push(egw_json_encode(input[k])); - } - return '[' + buf.join(',') + ']'; - - case 'object': - var buf = []; - for (var k in input) - { - buf.push(_egw_json_encode_simple(k) + ':' + egw_json_encode(input[k])); - } - return '{' + buf.join(',') + '}'; - - } - return 'null'; - } - } - else - { - return simple_res; - } } diff --git a/api/js/etemplate/et2_widget_grid.js b/api/js/etemplate/et2_widget_grid.js index f79922e74a..70a55d0fb4 100644 --- a/api/js/etemplate/et2_widget_grid.js +++ b/api/js/etemplate/et2_widget_grid.js @@ -245,11 +245,12 @@ var et2_grid = (function(){ "use strict"; return et2_DOMWidget.extend([et2_IDeta // Add in repeated rows // TODO: It would be nice if we could skip header (thead) & footer (tfoot) or treat them separately + var rowIndex = Infinity; if(this.getArrayMgr("content")) { var content = this.getArrayMgr("content"); var rowDataEntry = rowData[rowData.length-1]; - var rowIndex = rowData.length-1; + rowIndex = rowData.length-1; // Find out if we have any content rows, and how many var cont = true; while(cont) diff --git a/api/js/jsapi/egw_calendar.js b/api/js/jsapi/egw_calendar.js index 5e3d477a84..129c731fa0 100644 --- a/api/js/jsapi/egw_calendar.js +++ b/api/js/jsapi/egw_calendar.js @@ -261,7 +261,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) */ time: function(_input, _callback, _context) { - setupTime(this, _input, _callback, _context); + setupTime(this, _input); }, /** * transform PHP date/time-format to jQuery date/time-format