forked from extern/egroupware
Fix missing calendar participant + button
set_readonly() was missing, getWindowTitle() was using .options.value instead of get_value()
This commit is contained in:
parent
057c5bf6f7
commit
50f4b5cd47
@ -71,11 +71,13 @@ const Et2InputWidgetMixin = (superclass) =>
|
|||||||
super(...args);
|
super(...args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback()
|
connectedCallback()
|
||||||
{
|
{
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
this.node = this.getInputNode();
|
this.node = this.getInputNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
set_value(new_value)
|
set_value(new_value)
|
||||||
{
|
{
|
||||||
this.value = new_value;
|
this.value = new_value;
|
||||||
@ -86,6 +88,11 @@ const Et2InputWidgetMixin = (superclass) =>
|
|||||||
return this.getValue();
|
return this.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_readonly(new_value)
|
||||||
|
{
|
||||||
|
this.readonly = this.readOnly = new_value;
|
||||||
|
}
|
||||||
|
|
||||||
getValue()
|
getValue()
|
||||||
{
|
{
|
||||||
return typeof this.serializedValue !== "undefined" ? this.serializedValue : this.modalValue;
|
return typeof this.serializedValue !== "undefined" ? this.serializedValue : this.modalValue;
|
||||||
|
@ -18,6 +18,7 @@ import {et2_createWidget} from "../etemplate/et2_core_widget";
|
|||||||
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
||||||
import type {IegwAppLocal} from "./egw_global";
|
import type {IegwAppLocal} from "./egw_global";
|
||||||
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||||
|
import {et2_valueWidget} from "../etemplate/et2_core_valueWidget";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type for push-message
|
* Type for push-message
|
||||||
@ -273,7 +274,10 @@ export abstract class EgwApp
|
|||||||
push(pushData : PushData)
|
push(pushData : PushData)
|
||||||
{
|
{
|
||||||
// don't care about other apps data, reimplement if your app does care eg. calendar
|
// don't care about other apps data, reimplement if your app does care eg. calendar
|
||||||
if (pushData.app !== this.appname) return;
|
if(pushData.app !== this.appname)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// handle delete, for simple case of uid === "$app::$id"
|
// handle delete, for simple case of uid === "$app::$id"
|
||||||
if(pushData.type === 'delete' && egw.dataHasUID(this.uid(pushData)))
|
if(pushData.type === 'delete' && egw.dataHasUID(this.uid(pushData)))
|
||||||
@ -333,7 +337,10 @@ export abstract class EgwApp
|
|||||||
let grants = egw.grants(appname || this.appname);
|
let grants = egw.grants(appname || this.appname);
|
||||||
|
|
||||||
// No grants known
|
// No grants known
|
||||||
if(!grants) return true;
|
if(!grants)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// check user has a grant from owner or something
|
// check user has a grant from owner or something
|
||||||
for(let i = 0; i < grant_fields.length; i++)
|
for(let i = 0; i < grant_fields.length; i++)
|
||||||
@ -344,7 +351,8 @@ export abstract class EgwApp
|
|||||||
// ACL access
|
// ACL access
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(!Object.keys(grants).filter(function(grant_account) {
|
else if(!Object.keys(grants).filter(function(grant_account)
|
||||||
|
{
|
||||||
return grant_field.indexOf(grant_account) >= 0 ||
|
return grant_field.indexOf(grant_account) >= 0 ||
|
||||||
grant_field.indexOf(parseInt(grant_account)).length
|
grant_field.indexOf(parseInt(grant_account)).length
|
||||||
}))
|
}))
|
||||||
@ -437,7 +445,8 @@ export abstract class EgwApp
|
|||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
open(_action, _senders) {
|
open(_action, _senders)
|
||||||
|
{
|
||||||
var id_app = _senders[0].id.split('::');
|
var id_app = _senders[0].id.split('::');
|
||||||
egw.open(id_app[1], this.appname);
|
egw.open(id_app[1], this.appname);
|
||||||
}
|
}
|
||||||
@ -546,7 +555,8 @@ export abstract class EgwApp
|
|||||||
var et2 = template ? etemplate2.getByTemplate(template) : etemplate2.getByApplication(this.appname);
|
var et2 = template ? etemplate2.getByTemplate(template) : etemplate2.getByApplication(this.appname);
|
||||||
for(var i = 0; i < et2.length; i++)
|
for(var i = 0; i < et2.length; i++)
|
||||||
{
|
{
|
||||||
et2[i].widgetContainer.iterateOver(function(_widget) {
|
et2[i].widgetContainer.iterateOver(function(_widget)
|
||||||
|
{
|
||||||
// Firefox has trouble with spaces in search
|
// Firefox has trouble with spaces in search
|
||||||
if(state.state && state.state.search) state.state.search = unescape(state.state.search);
|
if(state.state && state.state.search) state.state.search = unescape(state.state.search);
|
||||||
|
|
||||||
@ -609,7 +619,8 @@ export abstract class EgwApp
|
|||||||
var et2 = etemplate2.getByApplication(this.appname);
|
var et2 = etemplate2.getByApplication(this.appname);
|
||||||
for(var i = 0; i < et2.length; i++)
|
for(var i = 0; i < et2.length; i++)
|
||||||
{
|
{
|
||||||
et2[i].widgetContainer.iterateOver(function(_widget) {
|
et2[i].widgetContainer.iterateOver(function(_widget)
|
||||||
|
{
|
||||||
state = _widget.getValue();
|
state = _widget.getValue();
|
||||||
}, this, et2_nextmatch);
|
}, this, et2_nextmatch);
|
||||||
}
|
}
|
||||||
@ -638,7 +649,8 @@ export abstract class EgwApp
|
|||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (id){
|
if(id)
|
||||||
|
{
|
||||||
var parts = id.split('::');
|
var parts = id.split('::');
|
||||||
rowID = parts[1];
|
rowID = parts[1];
|
||||||
content = egw.dataGetUIDdata(id);
|
content = egw.dataGetUIDdata(id);
|
||||||
@ -649,7 +661,8 @@ export abstract class EgwApp
|
|||||||
var app = {classes: window.app.classes};
|
var app = {classes: window.app.classes};
|
||||||
|
|
||||||
/* destroy generated etemplate for view mode in DOM*/
|
/* destroy generated etemplate for view mode in DOM*/
|
||||||
var destroy = function(){
|
var destroy = function()
|
||||||
|
{
|
||||||
self.viewContainer.remove();
|
self.viewContainer.remove();
|
||||||
delete self.viewTemplate;
|
delete self.viewTemplate;
|
||||||
delete self.viewContainer;
|
delete self.viewContainer;
|
||||||
@ -683,7 +696,8 @@ export abstract class EgwApp
|
|||||||
// close button
|
// close button
|
||||||
var close = jQuery(document.createElement('span'))
|
var close = jQuery(document.createElement('span'))
|
||||||
.addClass('egw_fw_mobile_popup_close loaded')
|
.addClass('egw_fw_mobile_popup_close loaded')
|
||||||
.click(function(){
|
.click(function()
|
||||||
|
{
|
||||||
destroy.call(app[self.appname]);
|
destroy.call(app[self.appname]);
|
||||||
//disable selected actions after close
|
//disable selected actions after close
|
||||||
egw_globalObjectManager.setAllSelected(false);
|
egw_globalObjectManager.setAllSelected(false);
|
||||||
@ -694,7 +708,8 @@ export abstract class EgwApp
|
|||||||
// edit button
|
// edit button
|
||||||
var edit = jQuery(document.createElement('span'))
|
var edit = jQuery(document.createElement('span'))
|
||||||
.addClass('mobile-view-editBtn')
|
.addClass('mobile-view-editBtn')
|
||||||
.click(function(){
|
.click(function()
|
||||||
|
{
|
||||||
egw.open(rowID, self.appname);
|
egw.open(rowID, self.appname);
|
||||||
})
|
})
|
||||||
.appendTo(this.viewContainer);
|
.appendTo(this.viewContainer);
|
||||||
@ -809,7 +824,8 @@ export abstract class EgwApp
|
|||||||
// removed .on("mouse(enter|leave)" (wrapping trash icon), as it stalls delete in IE11
|
// removed .on("mouse(enter|leave)" (wrapping trash icon), as it stalls delete in IE11
|
||||||
.on("click.sidebox", "div.ui-icon-trash", this, this.delete_favorite)
|
.on("click.sidebox", "div.ui-icon-trash", this, this.delete_favorite)
|
||||||
// need to install a favorite handler, as we switch original one off with .off()
|
// need to install a favorite handler, as we switch original one off with .off()
|
||||||
.on('click.sidebox','li[data-id]', this, function(event) {
|
.on('click.sidebox', 'li[data-id]', this, function(event)
|
||||||
|
{
|
||||||
var li = jQuery(this);
|
var li = jQuery(this);
|
||||||
li.siblings().removeClass('ui-state-highlight');
|
li.siblings().removeClass('ui-state-highlight');
|
||||||
|
|
||||||
@ -837,7 +853,8 @@ export abstract class EgwApp
|
|||||||
draggable: 'li:not([data-id$="add"])',
|
draggable: 'li:not([data-id$="add"])',
|
||||||
delay: 25,
|
delay: 25,
|
||||||
dataIdAttr: 'data-id',
|
dataIdAttr: 'data-id',
|
||||||
onSort: function(event){
|
onSort: function(event)
|
||||||
|
{
|
||||||
let favSortedList = sortablejs.toArray();
|
let favSortedList = sortablejs.toArray();
|
||||||
self.egw.set_preference(self.appname, 'fav_sort_pref', favSortedList);
|
self.egw.set_preference(self.appname, 'fav_sort_pref', favSortedList);
|
||||||
self._refresh_fav_nm();
|
self._refresh_fav_nm();
|
||||||
@ -852,7 +869,8 @@ export abstract class EgwApp
|
|||||||
{
|
{
|
||||||
jQuery(egw_fw.applications[this.appname].browser.baseDiv)
|
jQuery(egw_fw.applications[this.appname].browser.baseDiv)
|
||||||
.off('.sidebox')
|
.off('.sidebox')
|
||||||
.on('change.sidebox', function() {
|
.on('change.sidebox', function()
|
||||||
|
{
|
||||||
self.highlight_favorite();
|
self.highlight_favorite();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -905,9 +923,11 @@ export abstract class EgwApp
|
|||||||
|
|
||||||
// Update popup with current set filters (more for debug than user)
|
// Update popup with current set filters (more for debug than user)
|
||||||
var filter_list = [];
|
var filter_list = [];
|
||||||
var add_to_popup = function(arr) {
|
var add_to_popup = function(arr)
|
||||||
|
{
|
||||||
filter_list.push("<ul>");
|
filter_list.push("<ul>");
|
||||||
jQuery.each(arr, function(index, filter) {
|
jQuery.each(arr, function(index, filter)
|
||||||
|
{
|
||||||
filter_list.push("<li id='index'><span class='filter_id'>" + index.toString() + "</span>" +
|
filter_list.push("<li id='index'><span class='filter_id'>" + index.toString() + "</span>" +
|
||||||
(typeof filter != "object" ? "<span class='filter_value'>" + filter + "</span>" : "")
|
(typeof filter != "object" ? "<span class='filter_value'>" + filter + "</span>" : "")
|
||||||
);
|
);
|
||||||
@ -947,7 +967,8 @@ export abstract class EgwApp
|
|||||||
var et2 = etemplate2.getByApplication(self.appname);
|
var et2 = etemplate2.getByApplication(self.appname);
|
||||||
for(var i = 0; i < et2.length; i++)
|
for(var i = 0; i < et2.length; i++)
|
||||||
{
|
{
|
||||||
et2[i].widgetContainer.iterateOver(function(_widget) {
|
et2[i].widgetContainer.iterateOver(function(_widget)
|
||||||
|
{
|
||||||
_widget.stored_filters = _widget.load_favorites(self.appname);
|
_widget.stored_filters = _widget.load_favorites(self.appname);
|
||||||
_widget.init_filters(_widget);
|
_widget.init_filters(_widget);
|
||||||
}, self, et2_favorites);
|
}, self, et2_favorites);
|
||||||
@ -990,7 +1011,8 @@ export abstract class EgwApp
|
|||||||
).appendTo(this.et2 ? this.et2.getDOMNode() : jQuery('body'));
|
).appendTo(this.et2 ? this.et2.getDOMNode() : jQuery('body'));
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
jQuery(".ui-icon-circle-plus",this.favorite_popup).prev().andSelf().click(function() {
|
jQuery(".ui-icon-circle-plus", this.favorite_popup).prev().andSelf().click(function()
|
||||||
|
{
|
||||||
var details = jQuery("#" + self.appname + "_favorites_popup_state", self.favorite_popup)
|
var details = jQuery("#" + self.appname + "_favorites_popup_state", self.favorite_popup)
|
||||||
.slideToggle()
|
.slideToggle()
|
||||||
.siblings(".ui-icon-circle-plus")
|
.siblings(".ui-icon-circle-plus")
|
||||||
@ -1017,7 +1039,8 @@ export abstract class EgwApp
|
|||||||
text: this.egw.lang('save'),
|
text: this.egw.lang('save'),
|
||||||
default: true,
|
default: true,
|
||||||
style: 'background-image: url(' + this.egw.image('save') + ')',
|
style: 'background-image: url(' + this.egw.image('save') + ')',
|
||||||
click: function() {
|
click: function()
|
||||||
|
{
|
||||||
// Add a new favorite
|
// Add a new favorite
|
||||||
var name = jQuery("#name", this);
|
var name = jQuery("#name", this);
|
||||||
|
|
||||||
@ -1088,7 +1111,8 @@ export abstract class EgwApp
|
|||||||
buttons['cancel'] = {
|
buttons['cancel'] = {
|
||||||
text: this.egw.lang("cancel"),
|
text: this.egw.lang("cancel"),
|
||||||
style: 'background-image: url(' + this.egw.image('cancel') + ')',
|
style: 'background-image: url(' + this.egw.image('cancel') + ')',
|
||||||
click: function() {
|
click: function()
|
||||||
|
{
|
||||||
if(typeof self.favorite_popup.group !== 'undefined' && self.favorite_popup.group.set_value)
|
if(typeof self.favorite_popup.group !== 'undefined' && self.favorite_popup.group.set_value)
|
||||||
{
|
{
|
||||||
self.favorite_popup.group.set_value(null);
|
self.favorite_popup.group.set_value(null);
|
||||||
@ -1101,12 +1125,14 @@ export abstract class EgwApp
|
|||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
close: function() {
|
close: function()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bind handler for enter keypress
|
// Bind handler for enter keypress
|
||||||
this.favorite_popup.off('keydown').on('keydown', jQuery.proxy(function(e) {
|
this.favorite_popup.off('keydown').on('keydown', jQuery.proxy(function(e)
|
||||||
|
{
|
||||||
var tagName = e.target.tagName.toLowerCase();
|
var tagName = e.target.tagName.toLowerCase();
|
||||||
tagName = (tagName === 'input' && e.target.type === 'button') ? 'button' : tagName;
|
tagName = (tagName === 'input' && e.target.type === 'button') ? 'button' : tagName;
|
||||||
|
|
||||||
@ -1155,7 +1181,8 @@ export abstract class EgwApp
|
|||||||
// Delete preference server side
|
// Delete preference server side
|
||||||
var request = egw.json("EGroupware\\Api\\Framework::ajax_set_favorite",
|
var request = egw.json("EGroupware\\Api\\Framework::ajax_set_favorite",
|
||||||
[app.appname, id, "delete", group, ''],
|
[app.appname, id, "delete", group, ''],
|
||||||
function(result) {
|
function(result)
|
||||||
|
{
|
||||||
// Got the full response from callback, which we don't want
|
// Got the full response from callback, which we don't want
|
||||||
if(result.type) return;
|
if(result.type) return;
|
||||||
|
|
||||||
@ -1190,7 +1217,8 @@ export abstract class EgwApp
|
|||||||
* Closest matching takes into account not set values, so we pick the favorite
|
* Closest matching takes into account not set values, so we pick the favorite
|
||||||
* with the most matching values without a value that differs.
|
* with the most matching values without a value that differs.
|
||||||
*/
|
*/
|
||||||
highlight_favorite() {
|
highlight_favorite()
|
||||||
|
{
|
||||||
if(!this.sidebox) return;
|
if(!this.sidebox) return;
|
||||||
|
|
||||||
var state = this.getState();
|
var state = this.getState();
|
||||||
@ -1200,7 +1228,8 @@ export abstract class EgwApp
|
|||||||
|
|
||||||
jQuery('li[data-id]', this.sidebox).removeClass('ui-state-highlight');
|
jQuery('li[data-id]', this.sidebox).removeClass('ui-state-highlight');
|
||||||
|
|
||||||
jQuery('li[data-id]',this.sidebox).each(function(i,href) {
|
jQuery('li[data-id]', this.sidebox).each(function(i, href)
|
||||||
|
{
|
||||||
var favorite : any = {};
|
var favorite : any = {};
|
||||||
if(this.dataset.id && egw.preference('favorite_' + this.dataset.id, self.appname))
|
if(this.dataset.id && egw.preference('favorite_' + this.dataset.id, self.appname))
|
||||||
{
|
{
|
||||||
@ -1314,7 +1343,8 @@ export abstract class EgwApp
|
|||||||
.css({
|
.css({
|
||||||
'height': jQuery(this.parentNode).height(),
|
'height': jQuery(this.parentNode).height(),
|
||||||
'width': jQuery(this.parentNode).width(),
|
'width': jQuery(this.parentNode).width(),
|
||||||
'overflow' : 'scroll'});
|
'overflow': 'scroll'
|
||||||
|
});
|
||||||
while(body.firstChild)
|
while(body.firstChild)
|
||||||
{
|
{
|
||||||
div.append(body.firstChild);
|
div.append(body.firstChild);
|
||||||
@ -1346,10 +1376,10 @@ export abstract class EgwApp
|
|||||||
*/
|
*/
|
||||||
getWindowTitle()
|
getWindowTitle()
|
||||||
{
|
{
|
||||||
var titleWidget = this.et2.getWidgetById('title');
|
var titleWidget = <et2_valueWidget>this.et2.getWidgetById('title');
|
||||||
if(titleWidget)
|
if(titleWidget)
|
||||||
{
|
{
|
||||||
return titleWidget.options.value;
|
return titleWidget.get_value();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1397,7 +1427,8 @@ export abstract class EgwApp
|
|||||||
if(mail_ids.length)
|
if(mail_ids.length)
|
||||||
{
|
{
|
||||||
egw.message(egw.lang("Please wait..."));
|
egw.message(egw.lang("Please wait..."));
|
||||||
this.egw.json('filemanager.filemanager_ui.ajax_action',['mail',mail_ids, vfs_path],function(data){
|
this.egw.json('filemanager.filemanager_ui.ajax_action', ['mail', mail_ids, vfs_path], function(data)
|
||||||
|
{
|
||||||
// Trigger an update (minimal, no sorting changes) to display the new link
|
// Trigger an update (minimal, no sorting changes) to display the new link
|
||||||
egw.refresh(data.msg || '', ids[0], ids[1], 'update');
|
egw.refresh(data.msg || '', ids[0], ids[1], 'update');
|
||||||
}).sendRequest(true);
|
}).sendRequest(true);
|
||||||
@ -1409,15 +1440,18 @@ export abstract class EgwApp
|
|||||||
*
|
*
|
||||||
* @return {Promise, object} return Promise, json object as resolved result and error message in case of failure
|
* @return {Promise, object} return Promise, json object as resolved result and error message in case of failure
|
||||||
*/
|
*/
|
||||||
egwTutorialGetData(){
|
egwTutorialGetData()
|
||||||
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
return new Promise(function(_resolve, _reject)
|
return new Promise(function(_resolve, _reject)
|
||||||
{
|
{
|
||||||
var resolve = _resolve;
|
var resolve = _resolve;
|
||||||
var reject = _reject;
|
var reject = _reject;
|
||||||
// delay the execution and let the rendering catches up. Seems only FF problem
|
// delay the execution and let the rendering catches up. Seems only FF problem
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function()
|
||||||
self.egw.json('EGroupware\\Api\\Framework\\Tutorial::ajax_data', [self.egw.app_name()], function(_data){
|
{
|
||||||
|
self.egw.json('EGroupware\\Api\\Framework\\Tutorial::ajax_data', [self.egw.app_name()], function(_data)
|
||||||
|
{
|
||||||
resolve(_data);
|
resolve(_data);
|
||||||
}).sendRequest();
|
}).sendRequest();
|
||||||
}, 0);
|
}, 0);
|
||||||
@ -1463,7 +1497,8 @@ export abstract class EgwApp
|
|||||||
var etemplate = new etemplate2(div, '');
|
var etemplate = new etemplate2(div, '');
|
||||||
var template = egw.webserverUrl + '/api/templates/default/egw_tutorial.xet?1';
|
var template = egw.webserverUrl + '/api/templates/default/egw_tutorial.xet?1';
|
||||||
|
|
||||||
this.egwTutorialGetData().then(function(_data){
|
this.egwTutorialGetData().then(function(_data)
|
||||||
|
{
|
||||||
var lang = egw.preference('lang');
|
var lang = egw.preference('lang');
|
||||||
var content = {content: {list: []}};
|
var content = {content: {list: []}};
|
||||||
if(_data && _data[egw.app_name()])
|
if(_data && _data[egw.app_name()])
|
||||||
@ -1490,7 +1525,8 @@ export abstract class EgwApp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(_err){
|
function(_err)
|
||||||
|
{
|
||||||
console.log(_err);
|
console.log(_err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1602,17 +1638,20 @@ export abstract class EgwApp
|
|||||||
*/
|
*/
|
||||||
backup: function(_backup)
|
backup: function(_backup)
|
||||||
{
|
{
|
||||||
return new Promise(function(_resolve,_reject){
|
return new Promise(function(_resolve, _reject)
|
||||||
|
{
|
||||||
// Store backup sync packet into .PGP-Key-Backup file in user directory
|
// Store backup sync packet into .PGP-Key-Backup file in user directory
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PGP-Key-Backup',
|
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PGP-Key-Backup',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: JSON.stringify(_backup),
|
data: JSON.stringify(_backup),
|
||||||
success:function(){
|
success: function()
|
||||||
|
{
|
||||||
_resolve(_backup);
|
_resolve(_backup);
|
||||||
},
|
},
|
||||||
error: function(_err){
|
error: function(_err)
|
||||||
|
{
|
||||||
_reject(_err);
|
_reject(_err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1627,28 +1666,33 @@ export abstract class EgwApp
|
|||||||
*/
|
*/
|
||||||
restore: function()
|
restore: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(_resolve,_reject){
|
return new Promise(function(_resolve, _reject)
|
||||||
|
{
|
||||||
var resolve = _resolve;
|
var resolve = _resolve;
|
||||||
var reject = _reject;
|
var reject = _reject;
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PGP-Key-Backup',
|
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PGP-Key-Backup',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function(_backup){
|
success: function(_backup)
|
||||||
|
{
|
||||||
resolve(JSON.parse(_backup));
|
resolve(JSON.parse(_backup));
|
||||||
egw.message('Your key has been restored successfully.');
|
egw.message('Your key has been restored successfully.');
|
||||||
},
|
},
|
||||||
error: function(_err){
|
error: function(_err)
|
||||||
|
{
|
||||||
//Try with old back file name
|
//Try with old back file name
|
||||||
if(_err.status == 404)
|
if(_err.status == 404)
|
||||||
{
|
{
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PK_PGP',
|
url: egw.webserverUrl + '/webdav.php/home/' + egw.user('account_lid') + '/.PK_PGP',
|
||||||
success: function(_backup){
|
success: function(_backup)
|
||||||
|
{
|
||||||
resolve(JSON.parse(_backup));
|
resolve(JSON.parse(_backup));
|
||||||
egw.message('Your key has been restored successfully.');
|
egw.message('Your key has been restored successfully.');
|
||||||
},
|
},
|
||||||
error: function(_err){
|
error: function(_err)
|
||||||
|
{
|
||||||
_reject(_err);
|
_reject(_err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1729,16 +1773,19 @@ export abstract class EgwApp
|
|||||||
var options = {
|
var options = {
|
||||||
initialSetup: initSetup
|
initialSetup: initSetup
|
||||||
};
|
};
|
||||||
_keyring.createKeyBackupContainer(selector, options).then(function(_popupId){
|
_keyring.createKeyBackupContainer(selector, options).then(function(_popupId)
|
||||||
|
{
|
||||||
var $backup_selector = jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]');
|
var $backup_selector = jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]');
|
||||||
$backup_selector.css({position: 'absolute', "z-index": 1});
|
$backup_selector.css({position: 'absolute', "z-index": 1});
|
||||||
_popupId.isReady().then(function(result){
|
_popupId.isReady().then(function(result)
|
||||||
|
{
|
||||||
egw.message('Your key has been backedup into .PGP-Key-Backup successfully.');
|
egw.message('Your key has been backedup into .PGP-Key-Backup successfully.');
|
||||||
jQuery(selector).empty();
|
jQuery(selector).empty();
|
||||||
});
|
});
|
||||||
resolve(_popupId);
|
resolve(_popupId);
|
||||||
},
|
},
|
||||||
function(_err){
|
function(_err)
|
||||||
|
{
|
||||||
reject(_err);
|
reject(_err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1759,9 +1806,11 @@ export abstract class EgwApp
|
|||||||
{
|
{
|
||||||
if(_button_id == et2_dialog.YES_BUTTON)
|
if(_button_id == et2_dialog.YES_BUTTON)
|
||||||
{
|
{
|
||||||
self._mailvelopeBackupFileOperator(undefined, 'DELETE', function(){
|
self._mailvelopeBackupFileOperator(undefined, 'DELETE', function()
|
||||||
|
{
|
||||||
self.egw.message(self.egw.lang('The backup key has been deleted.'));
|
self.egw.message(self.egw.lang('The backup key has been deleted.'));
|
||||||
}, function(_err){
|
}, function(_err)
|
||||||
|
{
|
||||||
self.egw.message(self.egw.lang('Was not able to delete the backup key because %1', _err));
|
self.egw.message(self.egw.lang('Was not able to delete the backup key because %1', _err));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1785,7 +1834,8 @@ export abstract class EgwApp
|
|||||||
var selector = _selector || 'body';
|
var selector = _selector || 'body';
|
||||||
//Clear the
|
//Clear the
|
||||||
jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]').remove();
|
jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]').remove();
|
||||||
return new Promise(function(_resolve, _reject){
|
return new Promise(function(_resolve, _reject)
|
||||||
|
{
|
||||||
var resolve = _resolve;
|
var resolve = _resolve;
|
||||||
var reject = _reject;
|
var reject = _reject;
|
||||||
|
|
||||||
@ -1796,12 +1846,14 @@ export abstract class EgwApp
|
|||||||
var options = {
|
var options = {
|
||||||
restorePassword: restorePassword
|
restorePassword: restorePassword
|
||||||
};
|
};
|
||||||
_keyring.restoreBackupContainer(selector, options).then(function(_restoreId){
|
_keyring.restoreBackupContainer(selector, options).then(function(_restoreId)
|
||||||
|
{
|
||||||
var $restore_selector = jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]');
|
var $restore_selector = jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]');
|
||||||
$restore_selector.css({position: 'absolute', "z-index": 1});
|
$restore_selector.css({position: 'absolute', "z-index": 1});
|
||||||
resolve(_restoreId);
|
resolve(_restoreId);
|
||||||
},
|
},
|
||||||
function(_err){
|
function(_err)
|
||||||
|
{
|
||||||
reject(_err);
|
reject(_err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1825,26 +1877,45 @@ export abstract class EgwApp
|
|||||||
// Header row should be empty item 0
|
// Header row should be empty item 0
|
||||||
{},
|
{},
|
||||||
// Restore Keyring item 1
|
// Restore Keyring item 1
|
||||||
{label:"Restore key" ,image:"lock", onclick:"app."+appname+".mailvelopeCreateRestoreDialog('#_mvelo')"},
|
{
|
||||||
|
label: "Restore key",
|
||||||
|
image: "lock",
|
||||||
|
onclick: "app." + appname + ".mailvelopeCreateRestoreDialog('#_mvelo')"
|
||||||
|
},
|
||||||
// Restore pass phrase item 2
|
// Restore pass phrase item 2
|
||||||
{label:"Restore password",image:"password", onclick:"app."+appname+".mailvelopeCreateRestoreDialog('#_mvelo', true)"},
|
{
|
||||||
|
label: "Restore password",
|
||||||
|
image: "password",
|
||||||
|
onclick: "app." + appname + ".mailvelopeCreateRestoreDialog('#_mvelo', true)"
|
||||||
|
},
|
||||||
// Delete backup Key item 3
|
// Delete backup Key item 3
|
||||||
{label: "Delete backup", image: "delete", onclick: "app." + appname + ".mailvelopeDeleteBackup"},
|
{label: "Delete backup", image: "delete", onclick: "app." + appname + ".mailvelopeDeleteBackup"},
|
||||||
// Backup Key item 4
|
// Backup Key item 4
|
||||||
{label:"Backup Key", image:"save", onclick:"app."+appname+".mailvelopeCreateBackupDialog('#_mvelo', false)"}
|
{
|
||||||
|
label: "Backup Key",
|
||||||
|
image: "save",
|
||||||
|
onclick: "app." + appname + ".mailvelopeCreateBackupDialog('#_mvelo', false)"
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var dialog = function(_content, _callback?)
|
var dialog = function(_content, _callback?)
|
||||||
{
|
{
|
||||||
return et2_createWidget("dialog", {
|
return et2_createWidget("dialog", {
|
||||||
callback: function(_button_id, _value) {
|
callback: function(_button_id, _value)
|
||||||
|
{
|
||||||
if(typeof _callback == "function")
|
if(typeof _callback == "function")
|
||||||
{
|
{
|
||||||
_callback.call(this, _button_id, _value.value);
|
_callback.call(this, _button_id, _value.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: egw.lang('Backup/Restore'),
|
title: egw.lang('Backup/Restore'),
|
||||||
buttons:[{"button_id": 'close',"text": egw.lang('Close'), id: 'dialog[close]', image: 'cancelled', "default":true}],
|
buttons: [{
|
||||||
|
"button_id": 'close',
|
||||||
|
"text": egw.lang('Close'),
|
||||||
|
id: 'dialog[close]',
|
||||||
|
image: 'cancelled',
|
||||||
|
"default": true
|
||||||
|
}],
|
||||||
value: {
|
value: {
|
||||||
content: {
|
content: {
|
||||||
menu: _content
|
menu: _content
|
||||||
@ -1859,17 +1930,20 @@ export abstract class EgwApp
|
|||||||
{
|
{
|
||||||
mailvelope.getKeyring('egroupware').then(function(_keyring)
|
mailvelope.getKeyring('egroupware').then(function(_keyring)
|
||||||
{
|
{
|
||||||
self._mailvelopeBackupFileOperator(undefined, 'GET', function(_data){
|
self._mailvelopeBackupFileOperator(undefined, 'GET', function(_data)
|
||||||
|
{
|
||||||
dialog(menu);
|
dialog(menu);
|
||||||
},
|
},
|
||||||
function(){
|
function()
|
||||||
|
{
|
||||||
// Remove delete item
|
// Remove delete item
|
||||||
menu.splice(3, 1);
|
menu.splice(3, 1);
|
||||||
menu[3]['onclick'] = "app." + appname + ".mailvelopeCreateBackupDialog('#_mvelo', true)";
|
menu[3]['onclick'] = "app." + appname + ".mailvelopeCreateBackupDialog('#_mvelo', true)";
|
||||||
dialog(menu);
|
dialog(menu);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(){
|
function()
|
||||||
|
{
|
||||||
mailvelope.createKeyring('egroupware').then(function() {dialog(menu);});
|
mailvelope.createKeyring('egroupware').then(function() {dialog(menu);});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1892,7 +1966,8 @@ export abstract class EgwApp
|
|||||||
var dialog = function(_content, _callback)
|
var dialog = function(_content, _callback)
|
||||||
{
|
{
|
||||||
return et2_createWidget("dialog", {
|
return et2_createWidget("dialog", {
|
||||||
callback: function(_button_id, _value) {
|
callback: function(_button_id, _value)
|
||||||
|
{
|
||||||
if(typeof _callback == "function")
|
if(typeof _callback == "function")
|
||||||
{
|
{
|
||||||
_callback.call(this, _button_id, _value.value);
|
_callback.call(this, _button_id, _value.value);
|
||||||
@ -1913,11 +1988,14 @@ export abstract class EgwApp
|
|||||||
var content = [
|
var content = [
|
||||||
// Header row should be empty item 0
|
// Header row should be empty item 0
|
||||||
{},
|
{},
|
||||||
{domain:this.egw.lang('Add your domain as "%1" in options to list of email providers and enable API.',
|
{
|
||||||
'*.'+this._mailvelopeDomain()), video:"test", control:"true"}
|
domain: this.egw.lang('Add your domain as "%1" in options to list of email providers and enable API.',
|
||||||
|
'*.' + this._mailvelopeDomain()), video: "test", control: "true"
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
dialog(content, function(_button){
|
dialog(content, function(_button)
|
||||||
|
{
|
||||||
if(_button == 'install')
|
if(_button == 'install')
|
||||||
{
|
{
|
||||||
if(typeof chrome != 'undefined')
|
if(typeof chrome != 'undefined')
|
||||||
@ -1931,7 +2009,8 @@ export abstract class EgwApp
|
|||||||
else if(typeof InstallTrigger != 'undefined' && InstallTrigger.enabled())
|
else if(typeof InstallTrigger != 'undefined' && InstallTrigger.enabled())
|
||||||
{
|
{
|
||||||
InstallTrigger.install({mailvelope: "https://download.mailvelope.com/releases/latest/mailvelope.firefox.xpi"},
|
InstallTrigger.install({mailvelope: "https://download.mailvelope.com/releases/latest/mailvelope.firefox.xpi"},
|
||||||
function(_url, _status){
|
function(_url, _status)
|
||||||
|
{
|
||||||
if(_status == 0)
|
if(_status == 0)
|
||||||
{
|
{
|
||||||
et2_dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.'));
|
et2_dialog.alert(egw.lang('Mailvelope addon installation succeded. Now you may configure the options.'));
|
||||||
@ -2009,29 +2088,44 @@ export abstract class EgwApp
|
|||||||
self.mailvelope_keyring.exportOwnPublicKey(self.egw.user('account_email')).then(function(_pubKey)
|
self.mailvelope_keyring.exportOwnPublicKey(self.egw.user('account_email')).then(function(_pubKey)
|
||||||
{
|
{
|
||||||
// CreateBackupDialog
|
// CreateBackupDialog
|
||||||
self.mailvelopeCreateBackupDialog().then(function(_popupId){
|
self.mailvelopeCreateBackupDialog().then(function(_popupId)
|
||||||
jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]').css({position:'absolute', "z-index":1});
|
{
|
||||||
|
jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]').css({
|
||||||
|
position: 'absolute',
|
||||||
|
"z-index": 1
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function(_err){
|
function(_err)
|
||||||
|
{
|
||||||
egw.message(_err);
|
egw.message(_err);
|
||||||
});
|
});
|
||||||
|
|
||||||
// if yes, hide settings dialog
|
// if yes, hide settings dialog
|
||||||
jQuery(mvelo_settings_selector).each(function(index,item : any){
|
jQuery(mvelo_settings_selector).each(function(index, item : any)
|
||||||
|
{
|
||||||
if (!item.src.match(/keyBackupDialog.html/,'ig')) item.remove();
|
if (!item.src.match(/keyBackupDialog.html/,'ig')) item.remove();
|
||||||
});
|
});
|
||||||
jQuery('button#mailvelope_close_settings').remove();
|
jQuery('button#mailvelope_close_settings').remove();
|
||||||
|
|
||||||
// offer user to store his public key to AB for other users to find
|
// offer user to store his public key to AB for other users to find
|
||||||
var buttons = [
|
var buttons = [
|
||||||
{button_id: 2, text: 'Yes', id: 'dialog[yes]', image: 'check', default: true},
|
{
|
||||||
|
button_id: 2,
|
||||||
|
text: 'Yes',
|
||||||
|
id: 'dialog[yes]',
|
||||||
|
image: 'check',
|
||||||
|
default: true
|
||||||
|
},
|
||||||
{button_id: 3, text: 'No', id: 'dialog[no]', image: 'cancelled'}
|
{button_id: 3, text: 'No', id: 'dialog[no]', image: 'cancelled'}
|
||||||
];
|
];
|
||||||
if(egw.user('apps').admin)
|
if(egw.user('apps').admin)
|
||||||
{
|
{
|
||||||
buttons.unshift({
|
buttons.unshift({
|
||||||
button_id: 5, text: 'Yes and allow non-admin users to do that too (recommended)',
|
button_id: 5,
|
||||||
id: 'dialog[yes_allow]', image: 'check', default: true
|
text: 'Yes and allow non-admin users to do that too (recommended)',
|
||||||
|
id: 'dialog[yes_allow]',
|
||||||
|
image: 'check',
|
||||||
|
default: true
|
||||||
});
|
});
|
||||||
delete buttons[1].default;
|
delete buttons[1].default;
|
||||||
}
|
}
|
||||||
@ -2053,7 +2147,8 @@ export abstract class EgwApp
|
|||||||
self.egw.lang('Store your public key in Addressbook?'),
|
self.egw.lang('Store your public key in Addressbook?'),
|
||||||
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, self.egw);
|
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, self.egw);
|
||||||
},
|
},
|
||||||
function(_err){
|
function(_err)
|
||||||
|
{
|
||||||
self.egw.message(_err.message + "\n\n" +
|
self.egw.message(_err.message + "\n\n" +
|
||||||
self.egw.lang("You will NOT be able to send or receive encrypted mails before completing that step!"), 'error');
|
self.egw.lang("You will NOT be able to send or receive encrypted mails before completing that step!"), 'error');
|
||||||
});
|
});
|
||||||
@ -2169,6 +2264,7 @@ export abstract class EgwApp
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a share-link for the given entry
|
* create a share-link for the given entry
|
||||||
*
|
*
|
||||||
@ -2181,7 +2277,8 @@ export abstract class EgwApp
|
|||||||
* @param {Object} _extra Additional (app-specific or special) parameters
|
* @param {Object} _extra Additional (app-specific or special) parameters
|
||||||
* @returns {Boolean} returns false if not successful
|
* @returns {Boolean} returns false if not successful
|
||||||
*/
|
*/
|
||||||
share_link(_action, _senders, _target, _writable?, _files?, _callback?, _extra?){
|
share_link(_action, _senders, _target, _writable?, _files?, _callback?, _extra?)
|
||||||
|
{
|
||||||
var path = _senders[0].id;
|
var path = _senders[0].id;
|
||||||
if(!path)
|
if(!path)
|
||||||
{
|
{
|
||||||
@ -2229,14 +2326,16 @@ export abstract class EgwApp
|
|||||||
var promises = [];
|
var promises = [];
|
||||||
for(var i = 0; i < _senders.length; i++)
|
for(var i = 0; i < _senders.length; i++)
|
||||||
{
|
{
|
||||||
promises.push(new Promise(function(resolve, reject) {
|
promises.push(new Promise(function(resolve, reject)
|
||||||
|
{
|
||||||
this.share_link(_action, [_senders[i]], _target, _writable, _files, resolve);
|
this.share_link(_action, [_senders[i]], _target, _writable, _files, resolve);
|
||||||
}.bind(this)));
|
}.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// But merge into email can handle several
|
// But merge into email can handle several
|
||||||
Promise.all(promises.map(function(p) {p.catch(function(e) {console.log(e)})}))
|
Promise.all(promises.map(function(p) {p.catch(function(e) {console.log(e)})}))
|
||||||
.then(function(values) {
|
.then(function(values)
|
||||||
|
{
|
||||||
// Process document after all shares created
|
// Process document after all shares created
|
||||||
return nm_action(_action, _senders, _target);
|
return nm_action(_action, _senders, _target);
|
||||||
});
|
});
|
||||||
@ -2246,13 +2345,16 @@ export abstract class EgwApp
|
|||||||
* Share-link callback
|
* Share-link callback
|
||||||
* @param {object} _data
|
* @param {object} _data
|
||||||
*/
|
*/
|
||||||
_share_link_callback(_data) {
|
_share_link_callback(_data)
|
||||||
|
{
|
||||||
if (_data.msg || _data.share_link) window.egw_refresh(_data.msg, this.appname);
|
if (_data.msg || _data.share_link) window.egw_refresh(_data.msg, this.appname);
|
||||||
|
|
||||||
var copy_link_to_clipboard = function(evt){
|
var copy_link_to_clipboard = function(evt)
|
||||||
|
{
|
||||||
var $target = jQuery(evt.target);
|
var $target = jQuery(evt.target);
|
||||||
$target.select();
|
$target.select();
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
var successful = document.execCommand('copy');
|
var successful = document.execCommand('copy');
|
||||||
if(successful)
|
if(successful)
|
||||||
{
|
{
|
||||||
@ -2260,12 +2362,15 @@ export abstract class EgwApp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch(e)
|
||||||
|
{
|
||||||
|
}
|
||||||
egw.message('Failed to copy the link!');
|
egw.message('Failed to copy the link!');
|
||||||
};
|
};
|
||||||
jQuery("body").on("click", "[name=share_link]", copy_link_to_clipboard);
|
jQuery("body").on("click", "[name=share_link]", copy_link_to_clipboard);
|
||||||
et2_createWidget("dialog", {
|
et2_createWidget("dialog", {
|
||||||
callback: function( button_id, value) {
|
callback: function(button_id, value)
|
||||||
|
{
|
||||||
jQuery("body").off("click", "[name=share_link]", copy_link_to_clipboard);
|
jQuery("body").off("click", "[name=share_link]", copy_link_to_clipboard);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -2302,5 +2407,6 @@ export abstract class EgwApp
|
|||||||
return EgwApp._instances[Symbol.iterator]();
|
return EgwApp._instances[Symbol.iterator]();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EgwApp need to be global on window, as it's used to iterate through all EgwApp instances
|
// EgwApp need to be global on window, as it's used to iterate through all EgwApp instances
|
||||||
window.EgwApp = EgwApp;
|
window.EgwApp = EgwApp;
|
Loading…
Reference in New Issue
Block a user