summaryrefslogtreecommitdiff
path: root/inbox_settings.php
diff options
context:
space:
mode:
authorCarson Fleming <[email protected]>2024-12-30 21:33:34 -0800
committerCarson Fleming <[email protected]>2024-12-30 21:33:34 -0800
commitf21b2d31596ab6eab0b9acbf181e95cafd795422 (patch)
treef43e13cb9a689a211945b9303a91c57c3bbac0e4 /inbox_settings.php
parenteb5b7cd2b30567381caab3d50378d0de4ce28abd (diff)
downloadrc-inbox-settings-f21b2d31596ab6eab0b9acbf181e95cafd795422.tar.gz
progress & cleanup
Diffstat (limited to 'inbox_settings.php')
-rw-r--r--inbox_settings.php89
1 files changed, 56 insertions, 33 deletions
diff --git a/inbox_settings.php b/inbox_settings.php
index 5a7658b..0df8a49 100644
--- a/inbox_settings.php
+++ b/inbox_settings.php
@@ -17,6 +17,8 @@ class inbox_settings extends rcube_plugin {
$this->register_action('plugin.inbox_settings', [$this, 'render_settings_ui']);
$this->register_action('plugin.inbox_keys', [$this, 'render_keys_ui']);
+ $this->register_action('plugin.inbox_keys_generate', [$this, 'render_generate_ui']);
+ $this->register_action('plugin.inbox_keys_import', [$this, 'render_import_ui']);
$this->register_action('plugin.inbox_keys_delete', [$this, 'delete_selected_keys']);
}
@@ -79,37 +81,6 @@ class inbox_settings extends rcube_plugin {
}
}
- function render_keys_ui() {
- $this->rcmail->output->add_handler('keyslist', [$this, 'render_keys_list']);
- $this->rcmail->output->set_pagetitle($this->gettext('inbox_keys'));
- $this->rcmail->output->send('inbox_settings.keys');
- }
-
- function render_keys_list($attrib) {
- if (empty($attrib['id']))
- $attrib['id'] = 'rcpgpkeyslist';
-
- // info the js needs access to
- $this->rcmail->output->add_gui_object('keyslist', $attrib['id']);
- $this->rcmail->output->add_label(
- 'inbox_settings.confirm_delete_key', 'inbox_settings.deleting_key');
- // the js in question
- $this->rcmail->output->include_script('list.js');
- $this->include_script('keys.js');
-
- $data = self::label_assoc_2d($this->run_query('keys', [], true));
- if (empty($data)) {
- $this->rcmail->output->command(
- 'display_message', $this->gettext('no_keys'), 'notice');
- }
-
- return rcmail_action::table_output(
- $attrib,
- $data,
- ['inbox_settings.fingerprint', 'inbox_settings.comment'],
- 'inbox_settings.id');
- }
-
function render_settings_ui() {
$this->register_handler('plugin.body', [$this, 'render_settings_form']);
$this->rcmail->output->set_pagetitle($this->gettext('inbox_settings'));
@@ -179,10 +150,62 @@ class inbox_settings extends rcube_plugin {
return $page_content;
}
+ function render_keys_ui() {
+ $this->rcmail->output->add_handler('keyslist', [$this, 'render_keys_list']);
+ $this->rcmail->output->set_pagetitle($this->gettext('inbox_keys'));
+ $this->rcmail->output->send('inbox_settings.keys');
+ }
+
+ function render_keys_list($attrib) {
+ if (empty($attrib['id']))
+ $attrib['id'] = 'rcpgpkeyslist';
+
+ // info the js needs access to
+ $this->rcmail->output->add_gui_object('keyslist', $attrib['id']);
+ $this->rcmail->output->add_label(
+ 'inbox_settings.confirm_delete_key', 'inbox_settings.deleting_key');
+ // the js in question
+ $this->rcmail->output->include_script('list.js');
+ $this->include_script('keys.js');
+
+ $data = self::label_assoc_2d($this->run_query('keys', [], true));
+ if (empty($data)) {
+ $this->rcmail->output->command(
+ 'display_message', $this->gettext('no_keys'), 'notice');
+ }
+
+ return rcmail_action::table_output(
+ $attrib,
+ $data,
+ ['inbox_settings.fingerprint', 'inbox_settings.comment'],
+ 'inbox_settings.id');
+ }
+
+ function render_generate_ui() {
+ $this->rcmail->output->add_handler('importform', [$this, 'render_generate_form']);
+ $this->rcmail->output->set_pagetitle($this->gettext('keygen'));
+ $this->rcmail->output->send('inbox_settings.key_import');
+ }
+
+ function render_generate_form() {
+ return '<p>Not yet implemented.</p>';
+ }
+
+ function render_import_ui() {
+ $this->rcmail->output->add_handler('importform', [$this, 'render_import_form']);
+ $this->rcmail->output->set_pagetitle($this->gettext('key_import'));
+ $this->rcmail->output->send('inbox_settings.key_import');
+ }
+
+ function render_import_form() {
+ return '<p>Not yet implemented.</p>';
+ }
+
function delete_selected_keys() {
$this->run_query('delete_keys', ['%k' => $_POST['keys']]);
- $this->rcmail->output->set_pagetitle($this->gettext('deleting_key'));
- $this->rcmail->output->send('plugin');
+ $this->rcmail->output->command(
+ 'display_message', $this->gettext('keys_deleted'), 'notice');
+ $this->rcmail->output->send();
}
private static function label_assoc_2d($data) {