Fix favourites (& probably some more inherited stuff) broken by TypeScript conversion

Note that any properties declared in a sub-class aren't generally available until after the super() call is done, i.e. in the super constructor they're undefined.
This commit is contained in:
nathangray 2020-03-20 11:38:38 -06:00
parent 7631eb83aa
commit 34ec346821
16 changed files with 58 additions and 71 deletions

View File

@ -43,11 +43,8 @@ var AddressbookApp = /** @class */ (function (_super) {
* @memberOf app.addressbook
*/
function AddressbookApp() {
var _this =
// call parent
_super.call(this) || this;
_this.appname = 'addressbook';
return _this;
return _super.call(this, 'addressbook') || this;
}
/**
* Destructor

View File

@ -26,8 +26,6 @@ import { EgwApp } from '../../api/js/jsapi/egw_app';
*/
class AddressbookApp extends EgwApp
{
readonly appname = 'addressbook';
/**
* Constructor
*
@ -36,7 +34,7 @@ class AddressbookApp extends EgwApp
constructor()
{
// call parent
super();
super('addressbook');
}
/**

View File

@ -45,8 +45,7 @@ var AdminApp = /** @class */ (function (_super) {
function AdminApp() {
var _this =
// call parent
_super.call(this) || this;
_this.appname = 'admin';
_super.call(this, 'admin') || this;
/**
* reference to iframe
*

View File

@ -29,7 +29,6 @@ class AdminApp extends EgwApp
* @lends app.classes.admin
*/
{
readonly appname = 'admin';
/**
* reference to iframe
@ -67,7 +66,7 @@ class AdminApp extends EgwApp
constructor()
{
// call parent
super();
super('admin');
}
/**

View File

@ -50,11 +50,12 @@ var EgwApp = /** @class */ (function () {
* Initialization and setup goes here, but the etemplate2 object
* is not yet ready.
*/
function EgwApp() {
function EgwApp(appname) {
/**
* Mailvelope "egroupware" Keyring
*/
this.mailvelope_keyring = undefined;
this.appname = appname;
this.egw = egw(this.appname, window);
// Initialize sidebox for non-popups.
// ID set server side

View File

@ -124,8 +124,9 @@ export abstract class EgwApp
* Initialization and setup goes here, but the etemplate2 object
* is not yet ready.
*/
constructor()
constructor(appname: string)
{
this.appname = appname;
this.egw = egw(this.appname, window);
// Initialize sidebox for non-popups.

View File

@ -96,11 +96,7 @@ var CalendarApp = /** @class */ (function (_super) {
}
*/
// call parent
_super.call(this) || this;
/**
* application name
*/
_this.appname = 'calendar';
_super.call(this, 'calendar') || this;
/**
* Needed for JSON callback
*/

View File

@ -55,10 +55,6 @@ import {et2_calendar_event} from "./et2_widget_event";
*/
class CalendarApp extends EgwApp
{
/**
* application name
*/
public readonly appname = 'calendar';
/**
* Needed for JSON callback
@ -161,7 +157,7 @@ class CalendarApp extends EgwApp
}
*/
// call parent
super();
super('calendar');
// Scroll
jQuery(jQuery.proxy(this._scroll, this));

View File

@ -39,7 +39,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
function filemanagerAPP() {
var _this =
// call parent
_super.call(this) || this;
_super.call(this, 'filemanager') || this;
/**
* path widget, by template
*/
@ -302,7 +302,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
*/
filemanagerAPP.prototype._upload_callback = function (_data) {
if (_data.msg || _data.uploaded)
window.egw_refresh(_data.msg, filemanagerAPP.appname);
window.egw_refresh(_data.msg, this.appname);
var that = this;
for (var file in _data.uploaded) {
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed) {
@ -513,7 +513,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
* @param _data
*/
filemanagerAPP.prototype._do_action_callback = function (_data) {
window.egw_refresh(_data.msg, filemanagerAPP.appname);
window.egw_refresh(_data.msg, this.appname);
};
/**
* Force download of a file by appending '?download' to it's download url
@ -724,7 +724,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
(dir && dir.data && dir.data.class && dir.data.class.indexOf('noEdit') === -1 || !dir)
});
// Last 10 folders
var previous_dsts = jQuery.extend([], egw.preference('drop_history', filemanagerAPP.appname));
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
var action_index = 0;
for (var i = 0; i < 10; i++) {
var path = i < previous_dsts.length ? previous_dsts[i] : '';
@ -806,10 +806,10 @@ var filemanagerAPP = /** @class */ (function (_super) {
}
}
// Remember the target for next time
var previous_dsts = jQuery.extend([], egw.preference('drop_history', filemanagerAPP.appname));
var previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
previous_dsts.unshift(dst);
previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9);
egw.set_preference(filemanagerAPP.appname, 'drop_history', previous_dsts);
egw.set_preference(this.appname, 'drop_history', previous_dsts);
// Actual action id will be something like file_drop_{move|copy|link}[_other_id],
// but we need to send move, copy or link
var action_id = _action.id.replace("file_drop_", '').split('_', 1)[0];
@ -976,7 +976,7 @@ var filemanagerAPP = /** @class */ (function (_super) {
*/
filemanagerAPP.prototype._share_link_callback = function (_data) {
if (_data.msg || _data.share_link)
window.egw_refresh(_data.msg, filemanagerAPP.appname);
window.egw_refresh(_data.msg, this.appname);
console.log("_data", _data);
var app = this;
var copy_link_to_clipboard = function (evt) {
@ -1101,7 +1101,6 @@ var filemanagerAPP = /** @class */ (function (_super) {
}
return true;
};
filemanagerAPP.appname = 'filemanager';
return filemanagerAPP;
}(egw_app_1.EgwApp));
exports.filemanagerAPP = filemanagerAPP;

View File

@ -19,7 +19,6 @@ import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
*/
export class filemanagerAPP extends EgwApp
{
static readonly appname = 'filemanager';
/**
* path widget, by template
*/
@ -44,7 +43,7 @@ export class filemanagerAPP extends EgwApp
constructor()
{
// call parent
super();
super('filemanager');
// Loading filemanager in its tab and home causes us problems with
// unwanted destruction, so we check for already existing path widgets
@ -356,7 +355,7 @@ export class filemanagerAPP extends EgwApp
*/
_upload_callback(_data)
{
if(_data.msg || _data.uploaded) window.egw_refresh(_data.msg, filemanagerAPP.appname);
if(_data.msg || _data.uploaded) window.egw_refresh(_data.msg, this.appname);
let that = this;
for (let file in _data.uploaded)
@ -364,7 +363,13 @@ export class filemanagerAPP extends EgwApp
if(_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
{
let buttons = [
{text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check'},
{
text: this.egw.lang("Yes"),
id: "overwrite",
class: "ui-priority-primary",
"default": true,
image: 'check'
},
{text: this.egw.lang("Rename"), id: "rename", image: 'edit'},
{text: this.egw.lang("Cancel"), id: "cancel"}
];
@ -615,7 +620,7 @@ export class filemanagerAPP extends EgwApp
*/
_do_action_callback(_data)
{
window.egw_refresh(_data.msg, filemanagerAPP.appname);
window.egw_refresh(_data.msg, this.appname);
}
/**
@ -877,7 +882,7 @@ export class filemanagerAPP extends EgwApp
});
// Last 10 folders
let previous_dsts = jQuery.extend([], <any><unknown>egw.preference('drop_history', filemanagerAPP.appname));
let previous_dsts = jQuery.extend([], <any><unknown>egw.preference('drop_history', this.appname));
let action_index = 0;
for (let i = 0; i < 10; i++)
{
@ -977,10 +982,10 @@ export class filemanagerAPP extends EgwApp
}
// Remember the target for next time
let previous_dsts = jQuery.extend([], egw.preference('drop_history', filemanagerAPP.appname));
let previous_dsts = jQuery.extend([], egw.preference('drop_history', this.appname));
previous_dsts.unshift(dst);
previous_dsts = Array.from(new Set(previous_dsts)).slice(0, 9);
egw.set_preference(filemanagerAPP.appname, 'drop_history', previous_dsts);
egw.set_preference(this.appname, 'drop_history', previous_dsts);
// Actual action id will be something like file_drop_{move|copy|link}[_other_id],
// but we need to send move, copy or link
@ -1183,7 +1188,7 @@ export class filemanagerAPP extends EgwApp
*/
_share_link_callback(_data)
{
if(_data.msg || _data.share_link) window.egw_refresh(_data.msg, filemanagerAPP.appname);
if(_data.msg || _data.share_link) window.egw_refresh(_data.msg, this.appname);
console.log("_data", _data);
let app = this;

View File

@ -43,11 +43,8 @@ var InfologApp = /** @class */ (function (_super) {
* @memberOf app.infolog
*/
function InfologApp() {
var _this =
// call parent
_super.call(this) || this;
_this.appname = 'infolog';
return _this;
return _super.call(this, 'infolog') || this;
}
/**
* Destructor

View File

@ -26,7 +26,6 @@ import { EgwApp } from '../../api/js/jsapi/egw_app';
*/
class InfologApp extends EgwApp
{
readonly appname = 'infolog';
/**
* Constructor
@ -36,7 +35,7 @@ class InfologApp extends EgwApp
constructor()
{
// call parent
super();
super('infolog');
}
/**

View File

@ -33,7 +33,7 @@ var resourcesApp = /** @class */ (function (_super) {
* Constructor
*/
function resourcesApp() {
return _super.call(this) || this;
return _super.call(this, 'resources') || this;
}
/**
* Destructor
@ -137,7 +137,6 @@ var resourcesApp = /** @class */ (function (_super) {
rBtn.set_value('own_src');
}
};
resourcesApp.appname = 'resources';
return resourcesApp;
}(egw_app_1.EgwApp));
app.classes.resources = resourcesApp;

View File

@ -16,14 +16,13 @@ import {EgwApp} from "../../api/js/jsapi/egw_app";
*/
class resourcesApp extends EgwApp
{
static readonly appname: string = 'resources';
/**
* Constructor
*/
constructor()
{
super();
super('resources');
}
/**

View File

@ -38,9 +38,7 @@ var egw_app_1 = require("../../api/js/jsapi/egw_app");
var TimesheetApp = /** @class */ (function (_super) {
__extends(TimesheetApp, _super);
function TimesheetApp() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.appname = 'timesheet';
return _this;
return _super.call(this, 'timesheet') || this;
}
/**
* This function is called when the etemplate2 object is loaded

View File

@ -26,7 +26,11 @@ import { EgwApp } from '../../api/js/jsapi/egw_app';
*/
class TimesheetApp extends EgwApp
{
readonly appname = 'timesheet';
constructor()
{
super('timesheet');
}
/**
* This function is called when the etemplate2 object is loaded