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
*/
AddressbookApp.prototype.destroy = function () {
AddressbookApp.prototype.destroy = function (_app) {
// call parent
_super.prototype.destroy.apply(this, arguments);
_super.prototype.destroy.call(this, _app);
};
/**
* This function is called when the etemplate2 object is loaded
@ -71,7 +71,7 @@ var AddressbookApp = /** @class */ (function (_super) {
if (name.match(/^infolog|tracker\./))
return;
// call parent
_super.prototype.et2_ready.apply(this, arguments);
_super.prototype.et2_ready.call(this, et2, name);
switch (name) {
case 'addressbook.edit':
var content = this.et2.getArrayMgr('content').data;
@ -793,7 +793,7 @@ var AddressbookApp = /** @class */ (function (_super) {
*/
AddressbookApp.prototype.getState = function () {
// 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)) {
// Not in a list view. Try to find contact ID
var etemplates = etemplate2.getByApplication('addressbook');
@ -818,7 +818,7 @@ var AddressbookApp = /** @class */ (function (_super) {
*
* @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();
// State should be an object, not a string, but we'll parse
if (typeof state == "string") {
@ -836,7 +836,7 @@ var AddressbookApp = /** @class */ (function (_super) {
}
else if (jQuery.isEmptyObject(state)) {
// 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
egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search', [], function () {
framework.setWebsiteTitle('addressbook', '');
@ -881,7 +881,7 @@ var AddressbookApp = /** @class */ (function (_super) {
if (typeof state.state.advanced_search === 'undefined') {
state.state.advanced_search = false;
}
return _super.prototype.setState.apply(this, arguments);
return _super.prototype.setState.call(this, state);
};
/**
* Field changed, call server validation

View File

@ -42,10 +42,10 @@ class AddressbookApp extends EgwApp
/**
* Destructor
*/
destroy()
destroy(_app)
{
// call parent
super.destroy.apply(this, arguments);
super.destroy(_app);
}
/**
@ -64,7 +64,7 @@ class AddressbookApp extends EgwApp
if (name.match(/^infolog|tracker\./)) return;
// call parent
super.et2_ready.apply(this, arguments);
super.et2_ready(et2, name);
switch (name)
{
@ -963,7 +963,7 @@ class AddressbookApp extends EgwApp
getState()
{
// Most likely we're in the list view
var state = super.observer.apply(this, arguments);
var state = super.getState();
if(jQuery.isEmptyObject(state))
{
@ -994,7 +994,7 @@ class AddressbookApp extends EgwApp
*
* @return {boolean} false - Returns false to stop event propagation
*/
setState(state)
setState(state, template?)
{
var current_state = this.getState();
@ -1020,7 +1020,7 @@ class AddressbookApp extends EgwApp
else if (jQuery.isEmptyObject(state))
{
// 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
egw.json('addressbook.addressbook_ui.ajax_clear_advanced_search',[], function() {
@ -1076,7 +1076,7 @@ class AddressbookApp extends EgwApp
{
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
*/
AdminApp.prototype.destroy = function () {
AdminApp.prototype.destroy = function (_app) {
this.iframe = null;
this.nm = null;
this.acl_dialog = null;
this.tree = null;
// call parent
_super.prototype.destroy.apply(this, arguments);
_super.prototype.destroy.call(this, _app);
};
/**
* 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) {
// call parent
_super.prototype.et2_ready.apply(this, arguments);
_super.prototype.et2_ready.call(this, _et2, _name);
switch (_name) {
case 'admin.index':
var iframe = this.iframe = this.et2.getWidgetById('iframe');

View File

@ -73,7 +73,7 @@ class AdminApp extends EgwApp
/**
* Destructor
*/
destroy()
destroy(_app)
{
this.iframe = null;
this.nm = null;
@ -81,7 +81,7 @@ class AdminApp extends EgwApp
this.tree = null;
// call parent
super.destroy.apply(this, arguments);
super.destroy(_app);
}
/**
@ -95,7 +95,7 @@ class AdminApp extends EgwApp
et2_ready(_et2, _name)
{
// call parent
super.et2_ready.apply(this, arguments);
super.et2_ready(_et2, _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
* @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
if(typeof state == "string")
@ -445,7 +445,7 @@ export abstract class EgwApp
*
* @return {object} Application specific map representing the current state
*/
getState()
getState() : {[propName:string]: any}
{
var state = {};

View File

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

View File

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