diff options
Diffstat (limited to 'program/steps/settings/func.inc')
-rw-r--r-- | program/steps/settings/func.inc | 104 |
1 files changed, 86 insertions, 18 deletions
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 39a925e0e..3b599c0e5 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -158,6 +158,7 @@ function rcmail_user_prefs($current = null) 'main' => array('name' => Q(rcube_label('mainoptions'))), 'skin' => array('name' => Q(rcube_label('skin'))), 'browser' => array('name' => Q(rcube_label('browseroptions'))), + 'advanced'=> array('name' => Q(rcube_label('advancedoptions'))), ); // language selection @@ -367,6 +368,7 @@ function rcmail_user_prefs($current = null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), 'new_message' => array('name' => Q(rcube_label('newmessage'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show config parameter for preview pane @@ -488,6 +490,7 @@ function rcmail_user_prefs($current = null) case 'mailview': $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show checkbox to open message view in new window @@ -543,7 +546,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_default_charset'; - $blocks['main']['options']['default_charset'] = array( + $blocks['advanced']['options']['default_charset'] = array( 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))), 'content' => $RCMAIL->output->charset_selector(array( 'id' => $field_id, 'name' => '_default_charset', 'selected' => $config['default_charset'] @@ -605,6 +608,7 @@ function rcmail_user_prefs($current = null) 'main' => array('name' => Q(rcube_label('mainoptions'))), 'sig' => array('name' => Q(rcube_label('signatureoptions'))), 'spellcheck' => array('name' => Q(rcube_label('spellcheckoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); // show checkbox to compose messages in a new window @@ -673,8 +677,7 @@ function rcmail_user_prefs($current = null) $select->add(rcube_label('miscfolding'), 1); $select->add(rcube_label('2047folding'), 2); - $blocks['main']['options']['mime_param_folding'] = array( - 'advanced' => true, + $blocks['advanced']['options']['mime_param_folding'] = array( 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), 'content' => $select->show($config['mime_param_folding']), ); @@ -688,8 +691,7 @@ function rcmail_user_prefs($current = null) $field_id = 'rcmfd_force_7bit'; $input = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1)); - $blocks['main']['options']['force_7bit'] = array( - 'advanced' => true, + $blocks['advanced']['options']['force_7bit'] = array( 'title' => html::label($field_id, Q(rcube_label('force7bit'))), 'content' => $input->show($config['force_7bit']?1:0), ); @@ -837,28 +839,34 @@ function rcmail_user_prefs($current = null) ); } - if (!isset($no_override['default_font'])) { + if (!isset($no_override['default_font']) || !isset($no_override['default_font_size'])) { if (!$current) { continue 2; } + // Default font size + $field_id = 'rcmfd_default_font_size'; + $select_default_font_size = new html_select(array('name' => '_default_font_size', 'id' => $field_id)); + + $fontsizes = array('', '8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); + foreach ($fontsizes as $size) { + $select_default_font_size->add($size, $size); + } + + // Default font $field_id = 'rcmfd_default_font'; - $fonts = rcube_fontdefs(); - $selected = $config['default_font']; + $select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); + $select_default_font->add('', ''); - $select = '<select name="_default_font" id="'.$field_id.'">'; - $select .= '<option value=""' . (!$selected ? ' selected="selected"' : '') . '>---</option>'; + $fonts = rcube_fontdefs(); foreach ($fonts as $fname => $font) { - $select .= '<option value="'.$fname.'"' - . ($fname == $selected ? ' selected="selected"' : '') - . ' style=\'font-family: ' . $font . '\'>' - . Q($fname) . '</option>'; + $select_default_font->add($fname, $fname); } - $select .= '</select>'; $blocks['main']['options']['default_font'] = array( 'title' => html::label($field_id, Q(rcube_label('defaultfont'))), - 'content' => $select + 'content' => $select_default_font->show($RCMAIL->config->get('default_font', 1)) . + $select_default_font_size->show($RCMAIL->config->get('default_font_size', 1)) ); } break; @@ -866,7 +874,8 @@ function rcmail_user_prefs($current = null) // Addressbook config case 'addressbook': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['default_addressbook']) @@ -962,7 +971,8 @@ function rcmail_user_prefs($current = null) // Special IMAP folders case 'folders': $blocks = array( - 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'main' => array('name' => Q(rcube_label('mainoptions'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['show_real_foldernames'])) { @@ -1043,6 +1053,7 @@ function rcmail_user_prefs($current = null) $blocks = array( 'main' => array('name' => Q(rcube_label('mainoptions'))), 'maintenance' => array('name' => Q(rcube_label('maintenance'))), + 'advanced' => array('name' => Q(rcube_label('advancedoptions'))), ); if (!isset($no_override['read_when_deleted'])) { @@ -1235,9 +1246,66 @@ function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class $name_utf8, $display_name, $protected, $class_name); } +/** + * Render the list of settings sections (AKA tabs) + */ +function rcmail_settings_tabs($attrib) +{ + global $RCMAIL, $OUTPUT; + + // add default attributes + $attrib += array('tagname' => 'span', 'idprefix' => 'settingstab', 'selclass' => 'selected'); + + $default_actions = array( + array('command' => 'preferences', 'type' => 'link', 'label' => 'preferences', 'title' => 'editpreferences'), + array('command' => 'folders', 'type' => 'link', 'label' => 'folders', 'title' => 'managefolders'), + array('command' => 'identities', 'type' => 'link', 'label' => 'identities', 'title' => 'manageidentities'), + ); + + // get all identites from DB and define list of cols to be displayed + $plugin = $RCMAIL->plugins->exec_hook('settings_actions', array( + 'actions' => $default_actions, + 'attrib' => $attrib, + )); + + $attrib = $plugin['attrib']; + $tagname = $attrib['tagname']; + $tabs = array(); + + foreach ($plugin['actions'] as $k => $action) { + if (!$action['command'] && !$action['href'] && $action['action']) { + $action['href'] = $RCMAIL->url(array('_action' => $action['action'])); + } + + $button = $OUTPUT->button($action); + $attr = $attrib; + + $cmd = $action['action'] ? $action['action'] : $action['command']; + $id = $action['id'] ? $action['id'] : $cmd; + if (!empty($id)) { + $attr['id'] = preg_replace('/[^a-z0-9]/i', '', $attrib['idprefix'] . $id); + } + $classnames = array($attrib['class']); + if (!empty($action['class'])) { + $classnames[] = $action['class']; + } + else if (!empty($cmd)) { + $classnames[] = $cmd; + } + if ($RCMAIL->action == $cmd) { + $classnames[] = $attrib['selclass']; + } + $attr['class'] = join(' ', $classnames); + $tabs[] = html::tag($tagname, $attr, $button, html::$common_attrib); + } + + return join('', $tabs); +} + // register UI objects $OUTPUT->add_handlers(array( + 'settingstabs' => 'rcmail_settings_tabs', 'prefsframe' => 'rcmail_preferences_frame', 'sectionslist' => 'rcmail_sections_list', 'identitieslist' => 'rcmail_identities_list', |