From f830d4695a28f372af0f5e346399157452258ee9 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Mon, 30 Dec 2024 19:39:39 -0800 Subject: fix up labels --- inbox_settings.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'inbox_settings.php') diff --git a/inbox_settings.php b/inbox_settings.php index 341ec1e..29a3586 100644 --- a/inbox_settings.php +++ b/inbox_settings.php @@ -90,17 +90,17 @@ class inbox_settings extends rcube_plugin { // info the js needs access to $this->rcmail->output->add_gui_object('keyslist', $attrib['id']); - $this->rcmail->output->include_script('keys.js'); + $this->rcmail->output->include_script('list.js'); + $this->include_script('keys.js'); - // $this->rcmail->output->add_label('inbox_settings.a', 'inbox_settings.b'); - - $data = $this->run_query('keys', [], true); + $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, ['fingerprint', 'comment'], 'id'); + return rcmail_action::table_output( + $attrib, $data, ['inbox_settings.fingerprint', 'inbox_settings.comment'], 'id'); } function render_settings_ui() { @@ -172,6 +172,18 @@ class inbox_settings extends rcube_plugin { return $page_content; } + private static function label_assoc_2d($data) { + $labeled_data = []; + foreach ($data as $row) { + $labeled_row = []; + foreach ($row as $col_name => $value) { + $labeled_row['inbox_settings.' . $col_name] = $value; + } + $labeled_data[] = $labeled_row; + } + return $labeled_data; + } + private static function get_checkbox($id, $name, $checked, $attrs = []) { return html::div(['class' => 'custom-control custom-switch'], (new html_checkbox([ -- cgit v1.2.3