Offer to add contact if there's no contact found for given email in smime

addToContact dialog
This commit is contained in:
Hadi Nategh 2017-09-12 17:23:24 +02:00
parent 3cdd77e687
commit a075fae6a0
2 changed files with 15 additions and 2 deletions

View File

@ -230,7 +230,7 @@ class addressbook_bo extends Api\Contacts
} }
else else
{ {
$message = lang('%1 public keys added.', $updated); $message = !$updated ? false: lang('%1 public keys added.', $updated);
} }
return $message; return $message;
} }

View File

@ -5927,6 +5927,13 @@ app.classes.mail = AppJS.extend(
}; };
content.message2 = egw.lang('You may add this certificate into your contact, if you trust this signature.'); content.message2 = egw.lang('You may add this certificate into your contact, if you trust this signature.');
} }
var extra = {
'presets[email]': _metadata.email,
'presets[n_given]': _metadata.certDetails.subject.commonName,
'presets[pubkey]': _metadata.cert,
'presets[org_name]': _metadata.certDetails.subject.organizationName,
'presets[org_unit]': _metadata.certDetails.subject.organizationUnitName
};
et2_createWidget("dialog", et2_createWidget("dialog",
{ {
callback: function(_button_id, _value) callback: function(_button_id, _value)
@ -5934,7 +5941,13 @@ app.classes.mail = AppJS.extend(
if (_button_id == 'contact' && _value) if (_button_id == 'contact' && _value)
{ {
self.egw.json('mail.mail_ui.ajax_smimeAddCertToContact', self.egw.json('mail.mail_ui.ajax_smimeAddCertToContact',
_metadata,function(_message){egw.message(_message);}).sendRequest(true); _metadata,function(_result){
if (!_result)
{
egw.open('','addressbook','add',extra);
}
egw.message(_result);
}).sendRequest(true);
} }
}, },
title: egw.lang('Certificate info for email %1', _metadata.email), title: egw.lang('Certificate info for email %1', _metadata.email),