Skip to content
Permalink
Browse files

Fix favourites (& probably some more inherited stuff) broken by TypeS…

…cript 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.
  • Loading branch information
nathangray committed Mar 20, 2020
1 parent 7631eb8 commit 34ec346821aa3a8c3bae3f49be634023460a5bda

Some generated files are not rendered by default. Learn more.

@@ -17,7 +17,7 @@ import 'jqueryui';
import '../jsapi/egw_global';
import '../etemplate/et2_types';

import { EgwApp } from '../../api/js/jsapi/egw_app';
import {EgwApp} from '../../api/js/jsapi/egw_app';

/**
* UI for Addressbook
@@ -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');
}

/**

Some generated files are not rendered by default. Learn more.

@@ -17,7 +17,7 @@ import 'jqueryui';
import '../jsapi/egw_global';
import '../etemplate/et2_types';

import { EgwApp } from '../../api/js/jsapi/egw_app';
import {EgwApp} from '../../api/js/jsapi/egw_app';

/**
* UI for Admin
@@ -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');
}

/**

Some generated files are not rendered by default. Learn more.

@@ -124,15 +124,16 @@ 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.
// ID set server side
if(!this.egw.is_popup())
{
var sidebox = jQuery('#favorite_sidebox_'+this.appname);
var sidebox = jQuery('#favorite_sidebox_' + this.appname);
if(sidebox.length == 0 && egw_getFramework() != null)
{
var egw_fw = egw_getFramework();

Some generated files are not rendered by default. Learn more.

@@ -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,14 +157,14 @@ class CalendarApp extends EgwApp
}
*/
// call parent
super();
super('calendar');

// Scroll
jQuery(jQuery.proxy(this._scroll,this));
jQuery.extend(this.state, this.egw.preference('saved_states','calendar'));
jQuery(jQuery.proxy(this._scroll, this));
jQuery.extend(this.state, this.egw.preference('saved_states', 'calendar'));

// Set custom color for events without category
if(this.egw.preference('no_category_custom_color','calendar'))
if(this.egw.preference('no_category_custom_color', 'calendar'))
{
this.egw.css(
'.calendar_calEvent:not([class*="cat_"])',

Some generated files are not rendered by default. Learn more.

@@ -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,12 +43,12 @@ 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
let lists = etemplate2.getByApplication('home');
for(let i = 0; i < lists.length; i++)
for (let i = 0; i < lists.length; i++)
{
if(lists[i].app == 'filemanager' && lists[i].widgetContainer.getWidgetById('path'))
{
@@ -356,15 +355,21 @@ 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)
{
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;

Some generated files are not rendered by default. Learn more.

@@ -17,7 +17,7 @@ import 'jqueryui';
import '../jsapi/egw_global';
import '../etemplate/et2_types';

import { EgwApp } from '../../api/js/jsapi/egw_app';
import {EgwApp} from '../../api/js/jsapi/egw_app';

/**
* UI for Infolog
@@ -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');
}

/**

Some generated files are not rendered by default. Learn more.

@@ -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');
}

/**

0 comments on commit 34ec346

Please sign in to comment.
You can’t perform that action at this time.