From f21b2d31596ab6eab0b9acbf181e95cafd795422 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Mon, 30 Dec 2024 21:33:34 -0800 Subject: progress & cleanup --- inbox_settings.php | 89 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 33 deletions(-) (limited to 'inbox_settings.php') 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 '

Not yet implemented.

'; + } + + 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 '

Not yet implemented.

'; + } + 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) { -- cgit v1.2.3