encryption of InfoLog entries (EPL only)

This commit is contained in:
Ralf Becker 2015-05-28 14:40:33 +00:00
parent 876db7ca1e
commit ddbe8ccec3
9 changed files with 163 additions and 12 deletions

View File

@ -260,7 +260,12 @@ var et2_textbox = et2_inputWidget.extend([et2_IResizeable],
{ {
// apply the ratio // apply the ratio
_height = (this.options.resize_ratio != '')? _height * this.options.resize_ratio: _height; _height = (this.options.resize_ratio != '')? _height * this.options.resize_ratio: _height;
if (_height != 0) this.input.height(this.input.height() + _height); if (_height != 0)
{
this.input.height(this.input.height() + _height);
// resize parent too, so mailvelope injected into parent inherits its height
this.input.parent().height(this.input.parent().height()+_height);
}
} }
} }
}); });

View File

@ -63,6 +63,13 @@ app.classes.infolog = AppJS.extend(
case 'infolog.edit.print': case 'infolog.edit.print':
// Trigger print command if the infolog oppend for printing porpuse // Trigger print command if the infolog oppend for printing porpuse
this.infolog_print_preview_onload(); this.infolog_print_preview_onload();
break;
case 'infolog.edit':
if (this.et2.getArrayMgr('content').data.info_des.indexOf(this.begin_pgp_message) != -1)
{
this.mailvelopeAvailable(this.toggleEncrypt);
}
break;
} }
}, },
@ -610,5 +617,36 @@ app.classes.infolog = AppJS.extend(
submit_if_not_empty: function(_node, _widget) submit_if_not_empty: function(_node, _widget)
{ {
if (_widget.get_value()) this.et2._inst.submit(); if (_widget.get_value()) this.et2._inst.submit();
},
/**
* Toggle encryption
*
* @param {jQuery.Event} _event
* @param {et2_button} _widget
* @param {DOMNode} _node
*/
toggleEncrypt: function(_event, _widget, _node)
{
if (!this.egw.user('apps').stylite)
{
this.egw.message(this.egw.lang('InfoLog encryption requires EPL Subscription')+': <a href="http://www.egroupware.org/EPL">www.egroupware.org/EPL</a>');
return;
}
if (!app.stylite)
{
var self = this;
egw_LAB.script('stylite/js/infolog-encryption.js').wait(function()
{
app.stylite = new app.classes.stylite;
app.stylite.et2 = self.et2;
app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node);
});
}
else
{
app.stylite.et2 = this.et2;
app.stylite.toggleEncrypt.call(app.stylite, _event, _widget, _node);
}
} }
}); });

View File

@ -63,3 +63,12 @@ tr.dialogOperators td,.dialogFooterToolbar {
#infolog-index .egwGridView_grid .et2_hbox.et2_box_widget.infolog_CompletedClmn { #infolog-index .egwGridView_grid .et2_hbox.et2_box_widget.infolog_CompletedClmn {
white-space: normal; white-space: normal;
} }
td.infologEncrypt {
position: relative;
}
button#infolog-edit_encrypt {
position: absolute;
right: -2px;
top: 3px;
}

View File

@ -213,6 +213,9 @@
<date-time statustext="til when should the ToDo or Phonecall be finished" id="info_enddate" class="et2_fullWidth" span="4"/> <date-time statustext="til when should the ToDo or Phonecall be finished" id="info_enddate" class="et2_fullWidth" span="4"/>
<description/> <description/>
</row> </row>
<row class="et2_toolbar">
<buttononly label="Encrypt" id="encrypt" span="all" class="infologEncrypt" background_image="1" image="lock" onclick="app.infolog.toggleEncrypt"/>
</row>
<row> <row>
<tabbox id="tabs" class="et2_nowrap" span="all" width="100%" tab_height="250px"> <tabbox id="tabs" class="et2_nowrap" span="all" width="100%" tab_height="250px">
<tabs> <tabs>

View File

@ -4392,12 +4392,7 @@ app.classes.mail = AppJS.extend(
* - compose encrypted messages (mailvelopeCompose, compose_submitAction) * - compose encrypted messages (mailvelopeCompose, compose_submitAction)
* - fix autosave and save as draft to store encrypted content (saveAsDraft) * - fix autosave and save as draft to store encrypted content (saveAsDraft)
* - fix inline reply to encrypted message to clientside decrypt message and add signature (mailvelopeCompose) * - fix inline reply to encrypted message to clientside decrypt message and add signature (mailvelopeCompose)
* @todo check recipients for key available and warn user if not
* @todo lookup missing keys in addressbook, DANE DNS recored, maybe keyserver
* @todo offer user to store his public key in accounts addressbook (ask admin to make it user-editable) and DANE
*/ */
begin_pgp_message: '-----BEGIN PGP MESSAGE-----',
end_pgp_message: '-----END PGP MESSAGE-----',
/** /**
* Called on load of preview or display iframe, if mailvelope is available * Called on load of preview or display iframe, if mailvelope is available
@ -4561,8 +4556,8 @@ app.classes.mail = AppJS.extend(
{ {
// collect all recipients // collect all recipients
var recipients = this.et2.getWidgetById('to').get_value(); var recipients = this.et2.getWidgetById('to').get_value();
recipients.concat(this.et2.getWidgetById('cc').get_value()); recipients = recipients.concat(this.et2.getWidgetById('cc').get_value());
recipients.concat(this.et2.getWidgetById('bcc').get_value()); recipients = recipients.concat(this.et2.getWidgetById('bcc').get_value());
return this._super.call(this, recipients); return this._super.call(this, recipients);
}, },

View File

@ -2363,6 +2363,30 @@ abstract class egw_framework
egw_json_response::get()->data($list); egw_json_response::get()->data($list);
return $list; return $list;
} }
/**
* Get certain account-data of given account-id(s)
*
* @param string|array $_account_ids
* @param string $_field ='account_email'
* @param boolean $_resolve_groups =false true: return attribute for all members, false return attribute for group itself
* @return array account_id => data pairs
*/
public static function ajax_account_data($_account_ids, $_field, $_resolve_groups=false)
{
$list = array();
foreach((array)$_account_ids as $account_id)
{
foreach($account_id < 0 && $_resolve_groups ?
$GLOBALS['egw']->accounts->members($account_id, true) : array($account_id) as $account_id)
{
$list[$account_id] = $GLOBALS['egw']->accounts->id2name($account_id, $_field);
}
}
egw_json_response::get()->data($list);
return $list;
}
} }
// Init all static variables // Init all static variables

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

View File

@ -870,6 +870,12 @@ var AppJS = Class.extend(
} }
}, },
/**
* PGP begin and end tags
*/
begin_pgp_message: '-----BEGIN PGP MESSAGE-----',
end_pgp_message: '-----END PGP MESSAGE-----',
/** /**
* Mailvelope "egroupware" Keyring * Mailvelope "egroupware" Keyring
*/ */

View File

@ -36,6 +36,13 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
//owngroups: {} //owngroups: {}
}; };
/**
* Clientside cache for accountData calls
*/
var accountData = {
};
return { return {
/** /**
* Set data of current user * Set data of current user
@ -110,6 +117,62 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
return list; return list;
}, },
/**
* Get account-infos for given numerical _account_ids
*
* @param {int|array} _account_ids
* @param {string} _field default 'account_email'
* @param {boolean} _resolve_groups true: return attribute for all members, false: return attribute of group
* @param {function} _callback
* @param {object} _context
*/
accountData: function(_account_ids, _field, _resolve_groups, _callback, _context)
{
if (!_field) _field = 'account_email';
if (!jQuery.isArray(_account_ids)) _account_ids = [_account_ids];
// check our cache or current user first
var data = {};
for(var i=0; i < _account_ids.length; ++i)
{
var account_id = _account_ids[i];
if (account_id == userData.account_id)
{
data[account_id] = userData[_field];
}
else if (typeof accountData[account_id] != 'undefined' && typeof accountData[account_id][_field] != 'undefined' &&
(!_resolve_groups || account_id > 0)) // groups are only resolved on server for now
{
data[account_id] = accountData[account_id][_field];
}
else
{
continue;
}
_account_ids.splice(i--, 1);
}
// something not found in cache --> ask server
if (_account_ids.length)
{
egw.json('home.egw_framework.ajax_account_data.template',[_account_ids, _field, _resolve_groups],
function(_data) {
for(var account_id in _data)
{
if (typeof accountData[account_id] == 'undefined') accountData[account_id] = {};
data[account_id] = accountData[account_id][_field] = _data[account_id];
}
_callback.call(_context, data);
}
).sendRequest();
}
else
{
_callback.call(_context, data);
}
},
/** /**
* Invalidate client-side account cache * Invalidate client-side account cache
* *
@ -120,6 +183,14 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
*/ */
invalidate_account: function(_id, _type) invalidate_account: function(_id, _type)
{ {
if (_id)
{
delete accountData[_id];
}
else
{
accountData = {};
}
if (jQuery.isEmptyObject(accountStore)) return; if (jQuery.isEmptyObject(accountStore)) return;
switch(_type) switch(_type)