From cd89700d892f522f5f84f70dbc9fe61b8ba57f22 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Tue, 31 Dec 2024 17:54:27 -0800 Subject: use a template for this --- inbox_settings.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'inbox_settings.php') diff --git a/inbox_settings.php b/inbox_settings.php index 55067cf..c70b38b 100644 --- a/inbox_settings.php +++ b/inbox_settings.php @@ -97,19 +97,17 @@ class inbox_settings extends rcube_plugin { $encrypt_inbox = 0; if (!empty($encryption_result) && !empty($encryption_result[0])) $encrypt_inbox = $encryption_result[0][0] ? 1 : 0; + $encryption_form = new html_table(['cols' => 2, 'class' => 'propform']); - $encryption_form->add_row(['class' => 'form-group row']); - $encryption_form->add('title col-sm-8', html::label([ - 'class' => 'col-form-label', - 'for' => 'rcmfd_encrypt_inbox' - ], rcube::Q($this->gettext('encrypt_inbox')))); + $encryption_form->add('title col-sm-8', html::label( + ['class' => 'col-form-label', 'for' => 'rcmfd_encrypt_inbox'], + rcube::Q($this->gettext('encrypt_inbox')))); $encryption_form->add('col-sm-2 offset-1', self::get_checkbox( 'rcmfd_encrypt_inbox', 'encrypt_inbox', $encrypt_inbox)); $forwarders = $this->run_query('forwarding_addresses'); $forwarding_form = new html_table(['cols' => 3, 'class' => 'propform']); foreach ($forwarders as $idx => $row) { - $forwarding_form->add_row(['class' => 'form-group row']); $forwarding_form->add('title col-sm-4', html::label( ['class' => 'col-form-label', 'for' => 'fwd_addr_' . $idx], @@ -195,13 +193,9 @@ class inbox_settings extends rcube_plugin { } function render_import_ui() { - $this->rcmail->output->add_handler('plugin.body', [$this, 'render_import_form']); $this->rcmail->output->set_pagetitle($this->gettext('key_import')); - $this->rcmail->output->send('plugin'); - } - - function render_import_form() { - return '

Not yet implemented.

'; + // TODO: save results + $this->rcmail->output->send('inbox_settings.key_import'); } function delete_selected_keys() { @@ -234,7 +228,7 @@ class inbox_settings extends rcube_plugin { . html::label(['class' => 'custom-control-label', 'for' => $id] + $attrs, '')); } - private static function get_textfield($id, $name, $value, $attrs = []) { + private static function get_textfield($id, $name, $value = '', $attrs = []) { return (new html_inputfield([ 'id' => $id, 'type' => 'text', @@ -243,6 +237,14 @@ class inbox_settings extends rcube_plugin { ] + $attrs))->show($value); } + private static function get_textarea($id, $name, $value = '', $attrs = []) { + return (new html_textarea([ + 'id' => $id, + 'rows' => 10, + 'name' => $name, + ] + $attrs))->show($value); + } + private static function get_hiddenfield($name, $value) { return (new html_inputfield(['type' => 'hidden', 'name' => $name]))->show($value); } -- cgit v1.2.3