OpenPGP Key Storage (Settings) (#53)

Import, Delete, Generate, View
This commit is contained in:
RainLoop Team 2014-03-13 02:29:33 +04:00
parent 5a5c6af2c6
commit 5ece4cc0ec
47 changed files with 1333 additions and 539 deletions

View file

@ -599,7 +599,11 @@ class Http
*/
public function GetPath()
{
$sUrl = \ltrim(\substr($this->GetServer('SCRIPT_NAME', ''), 0, \strrpos($this->GetServer('SCRIPT_NAME', ''), '/')), '/');
// phpinfo();
// exit();
$sUrl = \trim(\substr($this->GetServer('REQUEST_URI', ''), 0,
\strrpos($this->GetServer('REQUEST_URI', ''), \basename($this->GetServer('SCRIPT_NAME', '')))), '/');
return '' === $sUrl ? '/' : '/'.$sUrl.'/';
}

View file

@ -989,8 +989,8 @@ class Actions
{
$sUrl = \rtrim(\trim($this->Http()->GetScheme().'://'.$this->Http()->GetHost(true, false).$this->Http()->GetPath()), '/\\');
$sUrl = \preg_replace('/index\.php(.*)$/i', '', $sUrl);
$aResult['ContactsSyncPabUrl'] = $sUrl.'/index.php/dav';
$aResult['ContactsSyncPabUrl'] = $sUrl.'/index.php/dav/';
}
else
{

View file

@ -12,7 +12,7 @@
</label>
</div>
</div>
<!-- <div class="control-group">
<div class="control-group">
<div class="controls">
<label data-bind="click: function () { openPGP(!openPGP()); }">
<i data-bind="css: openPGP() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
@ -20,7 +20,7 @@
Allow OpenPGP (unstable)
</label>
</div>
</div>-->
</div>
<div class="control-group">
<div class="controls">
<a href="#" target="_blank" class="g-ui-link" data-bind="link: phpInfoLink()">Show PHP information</a>

View file

@ -194,15 +194,15 @@
&nbsp;&nbsp;
<span class="i18n text" data-i18n-text="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
</div>
<div class="pgpSigned" data-bind="visible: message() && message().isPgpSigned(), click: receivePrivateKey">
<div class="pgpSigned" data-bind="visible: message() && message().isPgpSigned()">
<i class="icon-lock"></i>
&nbsp;&nbsp;
PGP signed (click to verify)
PGP signed
</div>
<div class="pgpEncrypted" data-bind="visible: message() && message().isPgpEncrypted(), click: receivePrivateKey">
<div class="pgpEncrypted" data-bind="visible: message() && message().isPgpEncrypted()">
<i class="icon-lock"></i>
&nbsp;&nbsp;
PGP encrypted (click to decrypt)
PGP encrypted
</div>
<div class="attachmentsPlace" data-bind="visible: message() && message().hasVisibleAttachments()">
<ul class="attachmentList" data-bind="foreach: message() ? message().attachments() : []">

View file

@ -0,0 +1,26 @@
<div class="popups">
<div class="modal hide b-open-pgp-key-add-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n-text="POPUPS_IMPORT_OPEN_PGP_KEY/TITLE_IMPORT_OPEN_PGP_KEY"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="control-group">
<textarea class="inputKey input-xxlarge" rows="14" autocomplete="off" data-bind="value: key, hasfocus: key.focus"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonAddAccount" data-bind="command: addOpenPgpKeyCommand">
<i class="icon-list-add"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_IMPORT_OPEN_PGP_KEY/BUTTON_IMPORT_OPEN_PGP_KEY"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,50 @@
<div class="popups">
<div class="modal hide b-open-pgp-key-generate-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/TITLE_GENERATE_OPEN_PGP_KEYS"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="control-group" data-bind="css: {'error': email.error}">
<label class="i18n control-label" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/LABEL_EMAIL"></label>
<div class="controls">
<input class="inputEmail input-large" type="email" autocomplete="off"
data-bind="value: email, hasfocus: email.focus" />
</div>
</div>
<div class="control-group">
<label class="i18n control-label" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/LABEL_NAME"></label>
<div class="controls">
<input class="inputName input-large" type="text" autocomplete="off"
data-bind="value: name" />
</div>
</div>
<div class="control-group">
<label class="i18n control-label" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/LABEL_PASSWORD"></label>
<div class="controls">
<input class="inputPassword input-large" type="password" autocomplete="off"
data-bind="value: password" />
</div>
</div>
<div class="control-group">
<label class="i18n control-label" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/LABEL_KEY_BIT_LENGTH"></label>
<div class="controls">
<select data-bind="value: keyBitLength, options: [1024, 2048]"></select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonHenerateOpenPgpKey" data-bind="command: generateOpenPgpKeyCommand">
<i data-bind="css: {'icon-key': !submitRequest(), 'icon-spinner animated': submitRequest()}"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_GENERATE_OPEN_PGP_KEYS/BUTTON_GENERATE_OPEN_PGP_KEYS"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,31 @@
<div class="popups">
<div class="modal hide b-open-pgp-key-view-content" data-bind="modal: modalVisibility">
<div>
<div class="modal-header g-ui-user-select-none">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n-text="POPUPS_VIEW_OPEN_PGP_KEY/TITLE_VIEW_OPEN_PGP_KEY"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="control-group">
<pre class="key-viewer" data-bind="initDom: keyDom, text: key"></pre>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonClose" data-bind="command: cancelCommand">
<i class="icon-remove"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_VIEW_OPEN_PGP_KEY/BUTTON_CLOSE"></span>
</a>
<a class="btn buttonClose" data-bind="click: selectKey">
<i class="icon-key"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="POPUPS_VIEW_OPEN_PGP_KEY/BUTTON_SELECT"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,73 @@
<div class="b-settings-open-pgp g-ui-user-select-none">
<div class="form-horizontal">
<div class="legend">
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/LEGEND_OPEN_PGP"></span>
</div>
</div>
<a class="btn" data-bind="click: addOpenPgpKey">
<i class="icon-list-add"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/BUTTON_ADD_OPEN_PGP_KEY"></span>
</a>
&nbsp;&nbsp;
<a class="btn" data-bind="click: generateOpenPgpKey">
<i class="icon-key"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/BUTTON_GENERATE_OPEN_PGP_KEYS"></span>
</a>
<br />
<br />
<br />
<table class="table table-hover list-table" data-bind="i18nUpdate: openpgpkeys">
<colgroup>
<col />
<col style="width: 1%" />
<col style="width: 1%" />
</colgroup>
<tbody>
<!-- ko foreach: openpgpkeysPrivate -->
<tr class="open-pgp-key-item">
<td>
<i class="open-pgp-key-img icon-lock i18n" data-i18n-title="SETTINGS_OPEN_PGP/TITLE_PRIVATE"></i>
<span class="open-pgp-key-user" data-bind="text: user"></span>
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-open-pgp-key" data-bind="visible: !deleteAccess(), click: function (oOpenPGP) { $root.openPgpKeyForDeletion(oOpenPGP); }">
<i class="icon-trash"></i>
</span>
</td>
<td>
<span class="view-open-pgp-key" data-bind="click: function (oOpenPgpKey) { $root.viewOpenPgpKey(oOpenPgpKey); }">
<i class="icon-eye"></i>
</span>
</td>
</tr>
<!-- /ko -->
<!-- ko foreach: openpgpkeysPublic -->
<tr class="open-pgp-key-item">
<td>
<span class="open-pgp-key-img icon-key i18n" data-i18n-title="SETTINGS_OPEN_PGP/TITLE_PUBLIC"></span>
<span class="open-pgp-key-user" data-bind="text: user"></span>
(<span class="open-pgp-key-id" data-bind="text: id"></span>)
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete" data-bind="css: {'delete-access': deleteAccess()}, click: function(oOpenPGP) { $root.deleteOpenPgpKey(oOpenPGP); }">
<span class="i18n" data-i18n-text="SETTINGS_OPEN_PGP/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-open-pgp-key" data-bind="visible: !deleteAccess(), click: function (oOpenPgpKey) { $root.openPgpKeyForDeletion(oOpenPgpKey); }">
<i class="icon-trash"></i>
</span>
</td>
<td>
<span class="view-open-pgp-key" data-bind="click: function (oOpenPgpKey) { $root.viewOpenPgpKey(oOpenPgpKey); }">
<i class="icon-eye"></i>
</span>
</td>
</tr>
<!-- /ko -->
</tbody>
</table>
</div>