use super.<name>(<arguments>) instead of super.<name>.apply(this, arguments)

This commit is contained in:
Ralf Becker 2020-02-11 17:40:17 +01:00
parent 13cc7f09cd
commit 5f804dd661
7 changed files with 50 additions and 45 deletions

View File

@ -52,9 +52,9 @@ var AddressbookApp = /** @class */ (function (_super) {
/** /**
* Destructor * Destructor
*/ */
AddressbookApp.prototype.destroy = function () { AddressbookApp.prototype.destroy = function (_app) {
// call parent // call parent
_super.prototype.destroy.apply(this, arguments); _super.prototype.destroy.call(this, _app);
}; };
/** /**
* This function is called when the etemplate2 object is loaded * This function is called when the etemplate2 object is loaded
@ -71,7 +71,7 @@ var AddressbookApp = /** @class */ (function (_super) {
if (name.match(/^infolog|tracker\./)) if (name.match(/^infolog|tracker\./))
return; return;
// call parent // call parent
_super.prototype.et2_ready.apply(this, arguments); _super.prototype.et2_ready.call(this, et2, name);
switch (name) { switch (name) {
case 'addressbook.edit': case 'addressbook.edit':
var content = this.et2.getArrayMgr('content').data; var content = this.et2.getArrayMgr('content').data;
@ -793,7 +793,7 @@ var AddressbookApp = /** @class */ (function (_super) {
*/ */
AddressbookApp.prototype.getState = function () { AddressbookApp.prototype.getState = function () {
// Most likely we're in the list view // Most likely we're in the list view
var state = _super.prototype.observer.apply(this, arguments); var state = _super.prototype.getState.call(this);
if (jQuery.isEmptyObject(state)) { if (jQuery.isEmptyObject(state)) {
// Not in a list view. Try to find contact ID // Not in a list view. Try to find contact ID
var etemplates = etemplate2.getByApplication('addressbook'); var etemplates = etemplate2.getByApplication('addressbook');
@ -818,7 +818,7 @@ var AddressbookApp = /** @class */ (function (_super) {
* *
* @return {boolean} false - Returns false to stop event propagation * @return {boolean} false - Returns false to stop event propagation
*/ */
AddressbookApp.prototype.setState = function (state) { AddressbookApp.prototype.setState = function (state, template) {
var current_state = this.getState(); var current_state = this.getState();
// State should be an object, not a string, but we'll parse // State should be an object, not a string, but we'll parse
if (typeof state == "string") { if (typeof state == "string") {
@ -836,7 +836,7 @@ var AddressbookApp = /** @class */ (function (_super) {
} }
else if (jQuery.isEmptyObject(state)) { else if (jQuery.isEmptyObject(state)) {
// Regular handling first to clear everything but advanced search // Regular handling first to clear everything but advanced search
_super.prototype.setState.apply(this, arguments); _super.prototype.setState.call(this, state);
// Clear advanced search, which is in session and etemplate // Clear advanced search, which is in session and etemplate
egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search', [], function () { egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search', [], function () {
framework.setWebsiteTitle('addressbook', ''); framework.setWebsiteTitle('addressbook', '');
@ -881,7 +881,7 @@ var AddressbookApp = /** @class */ (function (_super) {
if (typeof state.state.advanced_search === 'undefined') { if (typeof state.state.advanced_search === 'undefined') {
state.state.advanced_search = false; state.state.advanced_search = false;
} }
return _super.prototype.setState.apply(this, arguments); return _super.prototype.setState.call(this, state);
}; };
/** /**
* Field changed, call server validation * Field changed, call server validation

View File

@ -42,10 +42,10 @@ class AddressbookApp extends EgwApp
/** /**
* Destructor * Destructor
*/ */
destroy() destroy(_app)
{ {
// call parent // call parent
super.destroy.apply(this, arguments); super.destroy(_app);
} }
/** /**
@ -64,7 +64,7 @@ class AddressbookApp extends EgwApp
if (name.match(/^infolog|tracker\./)) return; if (name.match(/^infolog|tracker\./)) return;
// call parent // call parent
super.et2_ready.apply(this, arguments); super.et2_ready(et2, name);
switch (name) switch (name)
{ {
@ -963,7 +963,7 @@ class AddressbookApp extends EgwApp
getState() getState()
{ {
// Most likely we're in the list view // Most likely we're in the list view
var state = super.observer.apply(this, arguments); var state = super.getState();
if(jQuery.isEmptyObject(state)) if(jQuery.isEmptyObject(state))
{ {
@ -994,7 +994,7 @@ class AddressbookApp extends EgwApp
* *
* @return {boolean} false - Returns false to stop event propagation * @return {boolean} false - Returns false to stop event propagation
*/ */
setState(state) setState(state, template?)
{ {
var current_state = this.getState(); var current_state = this.getState();
@ -1020,7 +1020,7 @@ class AddressbookApp extends EgwApp
else if (jQuery.isEmptyObject(state)) else if (jQuery.isEmptyObject(state))
{ {
// Regular handling first to clear everything but advanced search // Regular handling first to clear everything but advanced search
super.setState.apply(this, arguments); super.setState(state);
// Clear advanced search, which is in session and etemplate // Clear advanced search, which is in session and etemplate
egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search',[], function() { egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search',[], function() {
@ -1076,7 +1076,7 @@ class AddressbookApp extends EgwApp
{ {
state.state.advanced_search = false; state.state.advanced_search = false;
} }
return super.setState.apply(this, arguments); return super.setState(state);
} }
/** /**

View File

@ -95,13 +95,13 @@ var AdminApp = /** @class */ (function (_super) {
/** /**
* Destructor * Destructor
*/ */
AdminApp.prototype.destroy = function () { AdminApp.prototype.destroy = function (_app) {
this.iframe = null; this.iframe = null;
this.nm = null; this.nm = null;
this.acl_dialog = null; this.acl_dialog = null;
this.tree = null; this.tree = null;
// call parent // call parent
_super.prototype.destroy.apply(this, arguments); _super.prototype.destroy.call(this, _app);
}; };
/** /**
* This function is called when the etemplate2 object is loaded * This function is called when the etemplate2 object is loaded
@ -113,7 +113,7 @@ var AdminApp = /** @class */ (function (_super) {
*/ */
AdminApp.prototype.et2_ready = function (_et2, _name) { AdminApp.prototype.et2_ready = function (_et2, _name) {
// call parent // call parent
_super.prototype.et2_ready.apply(this, arguments); _super.prototype.et2_ready.call(this, _et2, _name);
switch (_name) { switch (_name) {
case 'admin.index': case 'admin.index':
var iframe = this.iframe = this.et2.getWidgetById('iframe'); var iframe = this.iframe = this.et2.getWidgetById('iframe');

View File

@ -73,7 +73,7 @@ class AdminApp extends EgwApp
/** /**
* Destructor * Destructor
*/ */
destroy() destroy(_app)
{ {
this.iframe = null; this.iframe = null;
this.nm = null; this.nm = null;
@ -81,7 +81,7 @@ class AdminApp extends EgwApp
this.tree = null; this.tree = null;
// call parent // call parent
super.destroy.apply(this, arguments); super.destroy(_app);
} }
/** /**
@ -95,7 +95,7 @@ class AdminApp extends EgwApp
et2_ready(_et2, _name) et2_ready(_et2, _name)
{ {
// call parent // call parent
super.et2_ready.apply(this, arguments); super.et2_ready(_et2, _name);
switch(_name) switch(_name)
{ {

View File

@ -364,7 +364,7 @@ export abstract class EgwApp
* @param {string} template template name to check, instead of trying all templates of current app * @param {string} template template name to check, instead of trying all templates of current app
* @return {boolean} false - Returns false to stop event propagation * @return {boolean} false - Returns false to stop event propagation
*/ */
setState(state, template? : string) setState(state, template? : string) : string|false|void
{ {
// State should be an object, not a string, but we'll parse // State should be an object, not a string, but we'll parse
if(typeof state == "string") if(typeof state == "string")
@ -445,7 +445,7 @@ export abstract class EgwApp
* *
* @return {object} Application specific map representing the current state * @return {object} Application specific map representing the current state
*/ */
getState() getState() : {[propName:string]: any}
{ {
var state = {}; var state = {};

View File

@ -43,15 +43,18 @@ var InfologApp = /** @class */ (function (_super) {
* @memberOf app.infolog * @memberOf app.infolog
*/ */
function InfologApp() { function InfologApp() {
var _this =
// call parent // call parent
return _super.call(this) || this; _super.call(this) || this;
_this.appname = 'infolog';
return _this;
} }
/** /**
* Destructor * Destructor
*/ */
InfologApp.prototype.destroy = function () { InfologApp.prototype.destroy = function (_app) {
// call parent // call parent
_super.prototype.destroy.apply(this, arguments); _super.prototype.destroy.call(this, _app);
}; };
/** /**
* This function is called when the etemplate2 object is loaded * This function is called when the etemplate2 object is loaded
@ -63,7 +66,7 @@ var InfologApp = /** @class */ (function (_super) {
*/ */
InfologApp.prototype.et2_ready = function (_et2, _name) { InfologApp.prototype.et2_ready = function (_et2, _name) {
// call parent // call parent
_super.prototype.et2_ready.apply(this, arguments); _super.prototype.et2_ready.call(this, _et2, _name);
switch (_name) { switch (_name) {
case 'infolog.index': case 'infolog.index':
this.filter_change(); this.filter_change();
@ -153,7 +156,7 @@ var InfologApp = /** @class */ (function (_super) {
*/ */
InfologApp.prototype.getState = function () { InfologApp.prototype.getState = function () {
// call parent // call parent
var state = _super.prototype.observer.apply(this, arguments); var state = _super.prototype.getState.call(this);
var nm = {}; var nm = {};
// Get index etemplate // Get index etemplate
var et2 = etemplate2.getById('infolog-index'); var et2 = etemplate2.getById('infolog-index');
@ -185,7 +188,7 @@ var InfologApp = /** @class */ (function (_super) {
if (typeof state.state[name] == 'undefined') if (typeof state.state[name] == 'undefined')
state.state[name] = to_set[name]; state.state[name] = to_set[name];
} }
return _super.prototype.setState.apply(this, arguments); return _super.prototype.setState.call(this, state);
}; };
/** /**
* Enable or disable the date filter * Enable or disable the date filter
@ -333,6 +336,7 @@ var InfologApp = /** @class */ (function (_super) {
if (i < ab.options.length) { if (i < ab.options.length) {
cc.value += (cc.value ? ', ' : '') + ab.options[i].text.replace(/^.* <(.*)>$/, '$1'); cc.value += (cc.value ? ', ' : '') + ab.options[i].text.replace(/^.* <(.*)>$/, '$1');
ab.value = ''; ab.value = '';
// @ts-ignore
ab.onchange(); ab.onchange();
jQuery("tr.hiddenRow").css("display", "none"); jQuery("tr.hiddenRow").css("display", "none");
} }
@ -362,23 +366,24 @@ var InfologApp = /** @class */ (function (_super) {
case status_id: case status_id:
completed = status.value == 'done' || status.value == 'billed'; completed = status.value == 'done' || status.value == 'billed';
if (completed || status.value == 'not-started' || if (completed || status.value == 'not-started' ||
(status.value == 'ongoing') != (percent.value > 0 && percent.value < 100)) { (status.value == 'ongoing') != (parseFloat(percent.value) > 0 && parseFloat(percent.value) < 100)) {
if (completed) { if (completed) {
percent.value = 100; percent.value = '100';
} }
else if (status.value == 'not-started') { else if (status.value == 'not-started') {
percent.value = 0; percent.value = '0';
} }
else if (!completed && (percent.value == 0 || percent.value == 100)) { else if (!completed && (parseInt(percent.value) == 0 || parseInt(percent.value) == 100)) {
percent.value = 10; percent.value = '10';
} }
} }
break; break;
case percent_id: case percent_id:
completed = percent.value == 100; completed = parseInt(percent.value) == 100;
if (completed != (status.value == 'done' || status.value == 'billed') || if (completed != (status.value == 'done' || status.value == 'billed') ||
(status.value == 'not-started') != (percent.value == 0)) { (status.value == 'not-started') != (parseInt(percent.value) == 0)) {
status.value = percent.value == 0 ? (jQuery('[value="not-started"]', status).length ? 'not-started' : 'ongoing') : (percent.value == 100 ? 'done' : 'ongoing'); status.value = parseInt(percent.value) == 0 ? (jQuery('[value="not-started"]', status).length ?
'not-started' : 'ongoing') : (parseInt(percent.value) == 100 ? 'done' : 'ongoing');
} }
break; break;
case datecompleted_id + '[str]': case datecompleted_id + '[str]':
@ -387,8 +392,8 @@ var InfologApp = /** @class */ (function (_super) {
if (completed != (status.value == 'done' || status.value == 'billed')) { if (completed != (status.value == 'done' || status.value == 'billed')) {
status.value = completed ? 'done' : 'not-started'; status.value = completed ? 'done' : 'not-started';
} }
if (completed != (percent.value == 100)) { if (completed != (parseInt(percent.value) == 100)) {
percent.value = completed ? 100 : 0; percent.value = completed ? '100' : '0';
} }
break; break;
} }
@ -416,7 +421,7 @@ var InfologApp = /** @class */ (function (_super) {
if (template.isDirty()) { if (template.isDirty()) {
template.submit(); template.submit();
} }
egw_open(id, 'infolog', 'edit', { print: 1 }); egw.open(id, 'infolog', 'edit', { print: 1 });
break; break;
case 'ical': case 'ical':
template.postSubmit(); template.postSubmit();
@ -434,7 +439,7 @@ var InfologApp = /** @class */ (function (_super) {
*/ */
InfologApp.prototype.infolog_menu_print = function (_action, _selected) { InfologApp.prototype.infolog_menu_print = function (_action, _selected) {
var id = _selected[0].id.replace(/^infolog::/g, ''); var id = _selected[0].id.replace(/^infolog::/g, '');
egw_open(id, 'infolog', 'edit', { print: 1 }); egw.open(id, 'infolog', 'edit', { print: 1 });
}; };
/** /**
* Trigger print() onload window * Trigger print() onload window

View File

@ -42,10 +42,10 @@ class InfologApp extends EgwApp
/** /**
* Destructor * Destructor
*/ */
destroy() destroy(_app)
{ {
// call parent // call parent
super.destroy.apply(this, arguments); super.destroy(_app);
} }
/** /**
@ -59,7 +59,7 @@ class InfologApp extends EgwApp
et2_ready(_et2, _name) et2_ready(_et2, _name)
{ {
// call parent // call parent
super.et2_ready.apply(this, arguments); super.et2_ready(_et2, _name);
switch(_name) switch(_name)
{ {
@ -163,7 +163,7 @@ class InfologApp extends EgwApp
getState() getState()
{ {
// call parent // call parent
var state = super.observer.apply(this, arguments); var state = super.getState();
var nm : any = {}; var nm : any = {};
// Get index etemplate // Get index etemplate
@ -200,7 +200,7 @@ class InfologApp extends EgwApp
{ {
if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name]; if (typeof state.state[name] == 'undefined') state.state[name] = to_set[name];
} }
return super.setState.apply(this, arguments); return super.setState(state);
} }
/** /**