From 3ebac0167bf20104fb7a2a55934765117760264c Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 18 Aug 2014 03:53:18 -0400
Subject: [PATCH] Only add zen-mode text labels in compose step

---
 program/steps/settings/func.inc |  123 +++++++++++++++++++++++-----------------
 1 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index c504e6c..619710f 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -5,7 +5,7 @@
  | program/steps/settings/func.inc                                       |
  |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
- | Copyright (C) 2005-2012, The Roundcube Dev Team                       |
+ | Copyright (C) 2005-2013, The Roundcube Dev Team                       |
  |                                                                       |
  | Licensed under the GNU General Public License version 3 or            |
  | any later version with exceptions for skins & plugins.                |
@@ -22,6 +22,32 @@
 if (!$OUTPUT->ajax_call) {
     $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
 }
+
+// register UI objects
+$OUTPUT->add_handlers(array(
+    'settingstabs'   => 'rcmail_settings_tabs',
+    'prefsframe'     => 'rcmail_preferences_frame',
+    'sectionslist'   => 'rcmail_sections_list',
+    'identitieslist' => 'rcmail_identities_list',
+));
+
+// register action aliases
+$RCMAIL->register_action_map(array(
+    'folders'       => 'folders.inc',
+    'rename-folder' => 'folders.inc',
+    'delete-folder' => 'folders.inc',
+    'subscribe'     => 'folders.inc',
+    'unsubscribe'   => 'folders.inc',
+    'purge'         => 'folders.inc',
+    'folder-size'   => 'folders.inc',
+    'add-identity'  => 'edit_identity.inc',
+    'add-response'  => 'edit_response.inc',
+    'save-response' => 'edit_response.inc',
+    'delete-response' => 'responses.inc',
+    'delete-identity' => 'identities.inc',
+    'upload-display'  => 'upload.inc',
+));
+
 
 // similar function as /steps/settings/identities.inc::rcmail_identity_frame()
 function rcmail_preferences_frame($attrib)
@@ -319,9 +345,10 @@
                         if (is_array($meta) && $meta['name']) {
                             $skinname     = $meta['name'];
                             $author_link  = $meta['url'] ? html::a(array('href' => $meta['url'], 'target' => '_blank'), rcube::Q($meta['author'])) : rcube::Q($meta['author']);
-                            $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank'), rcube::Q($meta['license'])) : rcube::Q($meta['license']);
+                            $license_link = $meta['license-url'] ? html::a(array('href' => $meta['license-url'], 'target' => '_blank', 'tabindex' => '-1'), rcube::Q($meta['license'])) : rcube::Q($meta['license']);
                         }
 
+                        $skinnames[] = mb_strtolower($skinname);
                         $blocks['skin']['options'][$skin]['content'] = html::label(array('class' => 'skinselection'),
                             html::span('skinitem', $input->show($config['skin'], array('value' => $skin, 'id' => $field_id.$skin))) .
                             html::span('skinitem', html::img(array('src' => $thumbnail, 'class' => 'skinthumbnail', 'alt' => $skin, 'width' => 64, 'height' => 64))) .
@@ -330,6 +357,7 @@
                                 html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').':&nbsp;' . $license_link : ''))
                         );
                     }
+                    array_multisort($blocks['skin']['options'], SORT_ASC, SORT_STRING, $skinnames);
                 }
             }
 
@@ -352,13 +380,16 @@
             if ($current) {
                 $product_name = $RCMAIL->config->get('product_name', 'Roundcube Webmail');
                 $RCMAIL->output->add_script(sprintf("%s.check_protocol_handler('%s', '#mailtoprotohandler');",
-                    rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'foot');
+                    rcmail_output::JS_OBJECT_NAME, rcube::JQ($product_name)), 'docready');
             }
 
             $blocks['browser']['options']['mailtoprotohandler'] = array(
                 'content' => html::a(array(
-                'href'    => '#',
-                'id'      => 'mailtoprotohandler'), rcube::Q($RCMAIL->gettext('mailtoprotohandler'))),
+                    'href'    => '#',
+                    'id'      => 'mailtoprotohandler'
+                ),
+                rcube::Q($RCMAIL->gettext('mailtoprotohandler'))) .
+                html::span('mailtoprotohandler-status', ''),
             );
 
         break;
@@ -1008,7 +1039,8 @@
             }
 
             // Configure special folders
-            if (!isset($no_override['default_folders']) && $current) {
+            $set = array('drafts_mbox', 'sent_mbox', 'junk_mbox', 'trash_mbox');
+            if ($current && count(array_intersect($no_override, $set)) < 4) {
                 $select = $RCMAIL->folder_selector(array(
                     'noselection'   => '---',
                     'realnames'     => true,
@@ -1016,10 +1048,10 @@
                     'folder_filter' => 'mail',
                     'folder_rights' => 'w',
                 ));
-            }
 
-            // #1486114, #1488279, #1489219
-            $onchange = "if ($(this).val() == 'INBOX') $(this).val('')";
+                // #1486114, #1488279, #1489219
+                $onchange = "if ($(this).val() == 'INBOX') $(this).val('')";
+            }
 
             if (!isset($no_override['drafts_mbox'])) {
                 if (!$current) {
@@ -1180,7 +1212,7 @@
         $data  = $RCMAIL->plugins->exec_hook('preferences_list',
             array('section' => $sect['id'], 'blocks' => $blocks, 'current' => $current));
 
-        $advanced_prefs = $config['advanced_prefs'];
+        $advanced_prefs = (array) $RCMAIL->config->get('advanced_prefs');
 
         // create output
         foreach ($data['blocks'] as $key => $block) {
@@ -1209,6 +1241,13 @@
             unset($sections[$idx]);
         else
             $sections[$idx]['blocks'] = $data['blocks'];
+    }
+
+    $data = $RCMAIL->plugins->exec_hook('preferences_section_header',
+        array('section' => $sect['id'], 'header' => '', 'current' => $current));
+
+    if(!empty($data['header'])) {
+        $sections[$idx]['header'] = $data['header'];
     }
 
     return array($sections, $plugin['cols']);
@@ -1260,25 +1299,24 @@
 {
     global $RCMAIL, $OUTPUT;
 
-    $default_folders = (array) $RCMAIL->config->get('default_folders');
     $protect_folders = $RCMAIL->config->get('protect_default_folders');
+    $storage         = $RCMAIL->get_storage();
+    $delimiter       = $storage->get_hierarchy_delimiter();
 
-    $storage      = $RCMAIL->get_storage();
-    $delimiter    = $storage->get_hierarchy_delimiter();
     $name_utf8    = rcube_charset::convert($name, 'UTF7-IMAP');
-    $protected    = $protect_folders && in_array($name, $default_folders);
-
+    $protected    = $protect_folders && $storage->is_special_folder($name);
     $foldersplit  = explode($delimiter, $storage->mod_folder($name));
     $level        = count($foldersplit) - 1;
-    $display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
-        . rcube::Q($protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP'));
+    $display_name = $protected ? $RCMAIL->localize_foldername($name) : rcube_charset::convert($foldersplit[$level], 'UTF7-IMAP');
+    $class_name   = trim($class_name . ' mailbox');
 
-    if ($oldname === null)
-        $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe,
-            false, $class_name);
-    else
-        $OUTPUT->command('replace_folder_row', rcube_charset::convert($oldname, 'UTF7-IMAP'),
-            $name_utf8, $display_name, $protected, $class_name);
+    if ($oldname === null) {
+        $OUTPUT->command('add_folder_row', $name, $name_utf8, $display_name, $protected, $subscribe,
+            $class_name);
+    }
+    else {
+        $OUTPUT->command('replace_folder_row', $oldname, $name, $name_utf8, $display_name, $protected, $class_name);
+    }
 }
 
 /**
@@ -1295,18 +1333,18 @@
         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'),
-        array('command' => 'responses',   'type' => 'link', 'label' => 'responses',  'title' => 'editresponses'),
+        array('command' => 'responses',   'type' => 'link', 'label' => 'responses',   'title' => 'manageresponses'),
     );
 
     // 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'  => $attrib,
     ));
 
-    $attrib = $plugin['attrib'];
+    $attrib  = $plugin['attrib'];
     $tagname = $attrib['tagname'];
-    $tabs = array();
+    $tabs    = array();
 
     foreach ($plugin['actions'] as $k => $action) {
         if (!$action['command'] && !$action['href'] && $action['action']) {
@@ -1314,13 +1352,15 @@
         }
 
         $button = $OUTPUT->button($action);
-        $attr = $attrib;
+        $attr   = $attrib;
 
         $cmd = $action['action'] ? $action['action'] : $action['command'];
-        $id = $action['id'] ? $action['id'] : $cmd;
+        $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'];
@@ -1331,33 +1371,10 @@
         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',
-));
-
-// register action aliases
-$RCMAIL->register_action_map(array(
-    'folders'       => 'folders.inc',
-    'rename-folder' => 'folders.inc',
-    'delete-folder' => 'folders.inc',
-    'subscribe'     => 'folders.inc',
-    'unsubscribe'   => 'folders.inc',
-    'purge'         => 'folders.inc',
-    'folder-size'   => 'folders.inc',
-    'add-identity'  => 'edit_identity.inc',
-    'add-response'  => 'edit_response.inc',
-    'save-response' => 'edit_response.inc',
-    'delete-response' => 'responses.inc',
-));

--
Gitblit v1.9.1