mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
got mail app.js incl. jsapi/app_base.js working
plus marking et2 methods returning promisses as async and removing cache-buster from includeJS calls in egw_action_common.js as it causes double loads
This commit is contained in:
parent
1f4ba0156a
commit
771d6c727f
@ -399,8 +399,7 @@ egwFnct.prototype.setValue = function(_value)
|
|||||||
var self = this;
|
var self = this;
|
||||||
return new Promise(function(resolve)
|
return new Promise(function(resolve)
|
||||||
{
|
{
|
||||||
// cache for a day, better then no invalidation
|
egw.includeJS("/"+parts[1]+"/js/app.js", function ()
|
||||||
egw.includeJS("/"+parts[1]+"/js/app.js?"+((new Date()).valueOf()/86400|0).toString(), function ()
|
|
||||||
{
|
{
|
||||||
if(typeof app.classes[parts[i]] !== "undefined")
|
if(typeof app.classes[parts[i]] !== "undefined")
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,15 @@
|
|||||||
* @author Andreas Stöckel
|
* @author Andreas Stöckel
|
||||||
* @copyright EGroupware GmbH 2011-2021
|
* @copyright EGroupware GmbH 2011-2021
|
||||||
*/
|
*/
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
import { et2_baseWidget, et2_container } from "./et2_core_baseWidget";
|
import { et2_baseWidget, et2_container } from "./et2_core_baseWidget";
|
||||||
import { EgwApp } from "../jsapi/egw_app";
|
import { EgwApp } from "../jsapi/egw_app";
|
||||||
import { et2_IInput, et2_IPrint, et2_IResizeable, et2_ISubmitListener } from "./et2_core_interfaces";
|
import { et2_IInput, et2_IPrint, et2_IResizeable, et2_ISubmitListener } from "./et2_core_interfaces";
|
||||||
@ -331,6 +340,7 @@ export class etemplate2 {
|
|||||||
* @return Promise
|
* @return Promise
|
||||||
*/
|
*/
|
||||||
load(_name, _url, _data, _callback, _app, _no_et2_ready, _open_target) {
|
load(_name, _url, _data, _callback, _app, _no_et2_ready, _open_target) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let app = _app || window.app;
|
let app = _app || window.app;
|
||||||
this.name = _name; // store top-level template name to have it available in widgets
|
this.name = _name; // store top-level template name to have it available in widgets
|
||||||
// store template base url, in case initial template is loaded via webdav, to use that for further loads too
|
// store template base url, in case initial template is loaded via webdav, to use that for further loads too
|
||||||
@ -556,6 +566,7 @@ export class etemplate2 {
|
|||||||
_load.apply(this, []);
|
_load.apply(this, []);
|
||||||
}, this);
|
}, this);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Check if template contains any dirty (unsaved) content
|
* Check if template contains any dirty (unsaved) content
|
||||||
@ -967,13 +978,14 @@ export class etemplate2 {
|
|||||||
*
|
*
|
||||||
* @param _type
|
* @param _type
|
||||||
* @param _response
|
* @param _response
|
||||||
* @returns {Boolean}
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
static handle_load(_type, _response) {
|
static handle_load(_type, _response) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Check the parameters
|
// Check the parameters
|
||||||
const data = _response.data;
|
const data = _response.data;
|
||||||
// handle Api\Framework::refresh_opener()
|
// handle Api\Framework::refresh_opener()
|
||||||
if (jQuery.isArray(data['refresh-opener'])) {
|
if (Array.isArray(data['refresh-opener'])) {
|
||||||
if (window.opener) // && typeof window.opener.egw_refresh == 'function')
|
if (window.opener) // && typeof window.opener.egw_refresh == 'function')
|
||||||
{
|
{
|
||||||
var egw = window.egw(opener);
|
var egw = window.egw(opener);
|
||||||
@ -1042,6 +1054,7 @@ export class etemplate2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw ("Error while parsing et2_load response");
|
throw ("Error while parsing et2_load response");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Plugin for egw.json type "et2_validation_error"
|
* Plugin for egw.json type "et2_validation_error"
|
||||||
|
@ -504,7 +504,7 @@ export class etemplate2
|
|||||||
* @param {string} _open_target flag of string to distinguish between tab target and normal app object
|
* @param {string} _open_target flag of string to distinguish between tab target and normal app object
|
||||||
* @return Promise
|
* @return Promise
|
||||||
*/
|
*/
|
||||||
load(_name, _url, _data, _callback?, _app?, _no_et2_ready?, _open_target?)
|
async load(_name, _url, _data, _callback?, _app?, _no_et2_ready?, _open_target?)
|
||||||
{
|
{
|
||||||
let app = _app || window.app;
|
let app = _app || window.app;
|
||||||
this.name = _name; // store top-level template name to have it available in widgets
|
this.name = _name; // store top-level template name to have it available in widgets
|
||||||
@ -1324,15 +1324,15 @@ export class etemplate2
|
|||||||
*
|
*
|
||||||
* @param _type
|
* @param _type
|
||||||
* @param _response
|
* @param _response
|
||||||
* @returns {Boolean}
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
public static handle_load(_type, _response)
|
public static async handle_load(_type, _response)
|
||||||
{
|
{
|
||||||
// Check the parameters
|
// Check the parameters
|
||||||
const data = _response.data;
|
const data = _response.data;
|
||||||
|
|
||||||
// handle Api\Framework::refresh_opener()
|
// handle Api\Framework::refresh_opener()
|
||||||
if (jQuery.isArray(data['refresh-opener']))
|
if (Array.isArray(data['refresh-opener']))
|
||||||
{
|
{
|
||||||
if (window.opener)// && typeof window.opener.egw_refresh == 'function')
|
if (window.opener)// && typeof window.opener.egw_refresh == 'function')
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global jQuery, et2_dialog, Promise, et2_nextmatch, Class, etemplate2, et2_favorites, mailvelope */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EGroupware clientside Application javascript base object
|
* EGroupware clientside Application javascript base object
|
||||||
*
|
*
|
||||||
@ -8,7 +6,6 @@
|
|||||||
* @subpackage api
|
* @subpackage api
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Nathan Gray
|
* @author Nathan Gray
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*egw:uses
|
/*egw:uses
|
||||||
@ -16,6 +13,12 @@
|
|||||||
/api/js/es6-promise.min.js;
|
/api/js/es6-promise.min.js;
|
||||||
*/
|
*/
|
||||||
import './egw_inheritance.js';
|
import './egw_inheritance.js';
|
||||||
|
import {et2_createWidget} from "../etemplate/et2_core_widget";
|
||||||
|
import {etemplate2} from "../etemplate/etemplate2";
|
||||||
|
import {et2_dialog} from "../etemplate/et2_widget_dialog";
|
||||||
|
import {et2_nextmatch} from "../etemplate/et2_extension_nextmatch";
|
||||||
|
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
||||||
|
import {EgwApp} from "./egw_app";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object to collect instanciated appliction objects
|
* Object to collect instanciated appliction objects
|
||||||
@ -64,7 +67,7 @@ window.app = {classes: {}};
|
|||||||
* @class AppJS
|
* @class AppJS
|
||||||
* @augments Class
|
* @augments Class
|
||||||
*/
|
*/
|
||||||
var AppJS = (function(){ "use strict"; return Class.extend(
|
export const AppJS = (function(){ "use strict"; return Class.extend(
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Internal application name - override this
|
* Internal application name - override this
|
||||||
@ -1567,7 +1570,7 @@ var AppJS = (function(){ "use strict"; return Class.extend(
|
|||||||
},
|
},
|
||||||
self.egw.lang('Are you sure, you would like to delete the backup key?'),
|
self.egw.lang('Are you sure, you would like to delete the backup key?'),
|
||||||
self.egw.lang('Delete backup key'),
|
self.egw.lang('Delete backup key'),
|
||||||
{}, et2_dialog.BUTTONS_YES_CANCEL, et2_dialog.QUESTION_MESSAGE, undefined, self.egw);
|
{}, et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.QUESTION_MESSAGE, undefined, self.egw);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* global msg */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mail - static javaScript functions
|
* mail - static javaScript functions
|
||||||
*
|
*
|
||||||
@ -14,6 +12,15 @@
|
|||||||
/api/js/jquery/jquery.base64.js;
|
/api/js/jquery/jquery.base64.js;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {AppJS} from "../../api/js/jsapi/app_base.js";
|
||||||
|
import {et2_createWidget} from "../../api/js/etemplate/et2_core_widget";
|
||||||
|
import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog";
|
||||||
|
import {et2_button} from "../../api/js/etemplate/et2_widget_button";
|
||||||
|
import {egwIsMobile} from "../../api/js/egw_action/egw_action_common.js";
|
||||||
|
/* required dependency, commented out because no module, but egw:uses is no longer parsed
|
||||||
|
import "../../api/js/jquery/jquery.base64.js";
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for mail
|
* UI for mail
|
||||||
*
|
*
|
||||||
@ -5364,7 +5371,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
var container = iframe.parent()[0];
|
var container = iframe.parent()[0];
|
||||||
var container_selector = container.id ? '#'+container.id : 'div.mailDisplayContainer';
|
var container_selector = container.id ? '#'+container.id : 'div.mailDisplayContainer';
|
||||||
|
|
||||||
options = {
|
var options = {
|
||||||
showExternalContent: this.egw.preference('allowExternalIMGs') == 1 // "1", or "0", undefined --> true or false
|
showExternalContent: this.egw.preference('allowExternalIMGs') == 1 // "1", or "0", undefined --> true or false
|
||||||
};
|
};
|
||||||
// get sender address, so Mailvelope can check signature
|
// get sender address, so Mailvelope can check signature
|
||||||
@ -5505,7 +5512,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
},
|
},
|
||||||
this.egw.lang('You will loose current message body, unless you save it to your clipboard!'),
|
this.egw.lang('You will loose current message body, unless you save it to your clipboard!'),
|
||||||
this.egw.lang('Switch off encryption?'),
|
this.egw.lang('Switch off encryption?'),
|
||||||
{}, et2_dialog.BUTTON_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, this.egw);
|
{}, et2_dialog.BUTTONS_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, this.egw);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user