summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-14 07:35:48 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-10-14 07:35:48 +0000
commitf3f1284d206c580e4aed4266567f019cde9abab7 (patch)
treef02de8fa2016761ff267fd1af480d5d29874bb17 /plugins
parent86ea4952cf85f2646fbe919b2c78d98a77438bd5 (diff)
- Fix set_busy() usage, add encryption menu in compose
git-svn-id: https://svn.roundcube.net/trunk@4087 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/enigma/README2
-rw-r--r--plugins/enigma/enigma.js19
-rw-r--r--plugins/enigma/enigma.php21
-rw-r--r--plugins/enigma/lib/enigma_ui.php49
-rw-r--r--plugins/enigma/localization/en_US.inc5
5 files changed, 77 insertions, 19 deletions
diff --git a/plugins/enigma/README b/plugins/enigma/README
index 71b5ea531..afb23224c 100644
--- a/plugins/enigma/README
+++ b/plugins/enigma/README
@@ -2,6 +2,8 @@
THIS IS NOT EVEN AN "ALPHA" STATE. USE ONLY FOR DEVELOPMENT!!!!!!!
------------------------------------------------------------------
+WARNING: Don't use with gnupg-2.x!
+
Enigma Plugin Status:
* DONE:
diff --git a/plugins/enigma/enigma.js b/plugins/enigma/enigma.js
index 2cd2d62e3..29c648224 100644
--- a/plugins/enigma/enigma.js
+++ b/plugins/enigma/enigma.js
@@ -96,15 +96,14 @@ rcube_webmail.prototype.enigma_search = function(props)
props = this.gui_objects.qsearchbox.value;
if (props || this.env.search_request) {
- var params = {'_a': 'keysearch', '_q': urlencode(props)};
+ var params = {'_a': 'keysearch', '_q': urlencode(props)},
+ lock = this.set_busy(true, 'searching');
// if (this.gui_objects.search_filter)
// addurl += '&_filter=' + this.gui_objects.search_filter.value;
- this.env.current_page = 1;
- this.set_busy(true, 'searching');
-
+ this.env.current_page = 1;
this.enigma_loadframe();
this.enigma_clear_list();
- this.http_post('plugin.enigma', params, true);
+ this.http_post('plugin.enigma', params, lock);
}
return false;
@@ -130,10 +129,10 @@ rcube_webmail.prototype.enigma_search_reset = function(props)
// Keys/certs listing
rcube_webmail.prototype.enigma_list = function(page)
{
- var params = {'_a': 'keylist'};
+ var params = {'_a': 'keylist'},
+ lock = this.set_busy(true, 'loading');
this.env.current_page = page ? page : 1;
- this.set_busy(true, 'loading');
if (this.env.search_request)
params._q = this.env.search_request;
@@ -141,7 +140,7 @@ rcube_webmail.prototype.enigma_list = function(page)
params._p = page;
this.enigma_clear_list();
- this.http_post('plugin.enigma', params, true);
+ this.http_post('plugin.enigma', params, lock);
}
// Change list page
@@ -198,9 +197,9 @@ rcube_webmail.prototype.enigma_add_list_row = function(r)
// Import attached keys/certs file
rcube_webmail.prototype.enigma_import_attachment = function(mime_id)
{
- this.set_busy(true, 'loading');
+ var lock = this.set_busy(true, 'loading');
this.http_post('plugin.enigmaimport', '_uid='+this.env.uid+'&_mbox='
- +urlencode(this.env.mailbox)+'&_part='+urlencode(mime_id), true);
+ +urlencode(this.env.mailbox)+'&_part='+urlencode(mime_id), lock);
return false;
};
diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php
index ad4f65a0e..fb7c98635 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -52,16 +52,22 @@ class enigma extends rcube_plugin
$this->add_hook('message_part_structure', array($this, 'parse_structure'));
$this->add_hook('message_body_prefix', array($this, 'status_message'));
- // message sending hooks
- //$this->add_hook('outgoing_message_body', array($this, 'msg_encode'));
- //$this->add_hook('outgoing_message_body', array($this, 'msg_sign'));
-
+ // message displaying
if ($rcmail->action == 'show' || $rcmail->action == 'preview') {
$this->add_hook('message_load', array($this, 'message_load'));
$this->add_hook('template_object_messagebody', array($this, 'message_output'));
+ $this->register_action('plugin.enigmaimport', array($this, 'import_file'));
+ }
+ // message composing
+ else if ($rcmail->action == 'compose') {
+ $this->load_ui();
+ $this->ui->init($section);
+ }
+ // message sending (and draft storing)
+ else if ($rcmail->action == 'sendmail') {
+ //$this->add_hook('outgoing_message_body', array($this, 'msg_encode'));
+ //$this->add_hook('outgoing_message_body', array($this, 'msg_sign'));
}
-
- $this->register_action('plugin.enigmaimport', array($this, 'import_file'));
}
else if ($this->rc->task == 'settings') {
// add hooks for Enigma settings
@@ -78,9 +84,6 @@ class enigma extends rcube_plugin
$this->load_ui();
$this->ui->init($section);
}
-
- // include main js script
-// $this->include_script('enigma.js');
}
}
diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php
index 552d865be..85eac174f 100644
--- a/plugins/enigma/lib/enigma_ui.php
+++ b/plugins/enigma/lib/enigma_ui.php
@@ -67,6 +67,10 @@ class enigma_ui
$this->key_info();
}
}
+ // Message composing UI
+ else if ($this->rc->action == 'compose') {
+ $this->compose_ui();
+ }
// Preferences UI
else { // if ($this->rc->action == 'edit-prefs') {
if ($section == 'enigmacerts') {
@@ -406,5 +410,50 @@ class enigma_ui
return $out;
}
+ private function compose_ui()
+ {
+ if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_value('_id', RCUBE_INPUT_GET))
+ return;
+
+ // Options menu button
+ // @TODO: make this work with non-default skins
+ $this->enigma->add_button(array(
+ 'name' => 'enigmamenu',
+ 'imagepas' => 'skins/default/enigma.png',
+ 'imageact' => 'skins/default/enigma.png',
+ 'onclick' => "rcmail_ui.show_popup('enigmamenu', true); return false",
+ 'title' => 'securityoptions',
+ 'domain' => 'enigma',
+ ), 'toolbar');
+
+ // Options menu contents
+ $this->enigma->add_hook('render_page', array($this, 'compose_menu'));
+ }
+
+ function compose_menu(&$p)
+ {
+ $menu = new html_table(array('cols' => 2));
+ $chbox = new html_checkbox(array('value' => 1));
+
+ $menu->add(null, html::label(array('for' => 'enigmadefaultopt'),
+ Q($this->enigma->gettext('identdefault'))));
+ $menu->add(null, $chbox->show(1, array('name' => '_enigma_default', 'id' => 'enigmadefaultopt')));
+
+ $menu->add(null, html::label(array('for' => 'enigmasignopt'),
+ Q($this->enigma->gettext('signmsg'))));
+ $menu->add(null, $chbox->show(1, array('name' => '_enigma_sign', 'id' => 'enigmasignopt')));
+
+ $menu->add(null, html::label(array('for' => 'enigmacryptopt'),
+ Q($this->enigma->gettext('encryptmsg'))));
+ $menu->add(null, $chbox->show(1, array('name' => '_enigma_crypt', 'id' => 'enigmacryptopt')));
+
+ $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'),
+ $menu->show());
+
+ $p['content'] = preg_replace('/(<form name="form"[^>]+>)/i', '\\1'."\n$menu", $p['content']);
+
+ return $p;
+
+ }
}
diff --git a/plugins/enigma/localization/en_US.inc b/plugins/enigma/localization/en_US.inc
index eb0f18d3c..e0f03d9a0 100644
--- a/plugins/enigma/localization/en_US.inc
+++ b/plugins/enigma/localization/en_US.inc
@@ -28,6 +28,11 @@ $labels['keyrevoke'] = 'Revoke key';
$labels['keysend'] = 'Send public key in a message';
$labels['keychpass'] = 'Change password';
+$labels['securityoptions'] = 'Message security options...';
+$labels['identdefault'] = 'Use settings of selected identity';
+$labels['encryptmsg'] = 'Encrypt this message';
+$labels['signmsg'] = 'Digitally sign this message';
+
$messages = array();
$messages['sigvalid'] = 'Verified signature from $sender.';
$messages['siginvalid'] = 'Invalid signature from $sender.';