From a3644638aaf0418598196a870204e0b632a4c8ad Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Fri, 17 Apr 2015 06:28:40 -0400 Subject: [PATCH] Allow preference sections to define CSS class names --- program/steps/settings/func.inc | 34 ++++++++++++++++++++++++++++------ 1 files changed, 28 insertions(+), 6 deletions(-) diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 486e679..a136d38 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -73,6 +73,13 @@ list($list, $cols) = rcmail_user_prefs(); + // add section keys as class name to the primary col + array_walk($list, function(&$item, $key) use ($attrib) { + if (!isset($item['section_class'])) { + $item['section_class'] = trim($attrib['classprefix'] . $key); + } + }); + // create XHTML table $out = $RCMAIL->table_output($attrib, $list, $cols, 'id'); @@ -220,7 +227,7 @@ foreach (DateTimeZone::listIdentifiers() as $i => $tzs) { try { $tz = new DateTimeZone($tzs); - $date = new DateTime('2012-12-21', $tz); + $date = new DateTime(date('Y') . '-12-21', $tz); $offset = $date->format('Z') + 45000; $sortkey = sprintf('%06d.%s', $offset, $tzs); $zones[$sortkey] = array($tzs, $date->format('P')); @@ -845,6 +852,20 @@ ); } + if (!isset($no_override['sig_below'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_sig_below'; + $input = new html_checkbox(array('name' => '_sig_below', 'id' => $field_id, 'value' => 1)); + + $blocks['sig']['options']['sig_below'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigbelow'))), + 'content' => $input->show($RCMAIL->config->get('sig_below') ? 1 : 0), + ); + } + if (!isset($no_override['strip_existing_sig'])) { if (!$current) { continue 2; @@ -1261,13 +1282,14 @@ unset($sections[$idx]); else $sections[$idx]['blocks'] = $data['blocks']; - } - $data = $RCMAIL->plugins->exec_hook('preferences_section_header', - array('section' => $sect['id'], 'header' => '', 'current' => $current)); + // allow plugins to add a header to each section + $data = $RCMAIL->plugins->exec_hook('preferences_section_header', + array('section' => $sect['id'], 'header' => '', 'current' => $current)); - if(!empty($data['header'])) { - $sections[$idx]['header'] = $data['header']; + if(!empty($data['header'])) { + $sections[$idx]['header'] = $data['header']; + } } return array($sections, $plugin['cols']); -- Gitblit v1.9.1