From 3412e50b54e3daac8745234e21ab6e72be0ed165 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 04 Jun 2014 11:20:33 -0400
Subject: [PATCH] Fix attachment menu structure and aria-attributes

---
 program/steps/settings/func.inc |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 418f8b0..5da01b7 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -343,9 +343,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))) .
@@ -354,6 +355,7 @@
                                 html::span('skinlicense', $license_link ? $RCMAIL->gettext('license').':&nbsp;' . $license_link : ''))
                         );
                     }
+                    array_multisort($blocks['skin']['options'], SORT_ASC, SORT_STRING, $skinnames);
                 }
             }
 
@@ -376,13 +378,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;
@@ -1032,7 +1037,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,
@@ -1040,10 +1046,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) {
@@ -1204,7 +1210,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) {
@@ -1284,13 +1290,11 @@
 {
     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();
-    $name_utf8    = rcube_charset::convert($name, 'UTF7-IMAP');
-    $protected    = $protect_folders && in_array($name, $default_folders);
+    $storage         = $RCMAIL->get_storage();
+    $delimiter       = $storage->get_hierarchy_delimiter();
+    $name_utf8       = rcube_charset::convert($name, 'UTF7-IMAP');
+    $protected       = $protect_folders && $storage->is_special_folder($name);
 
     $foldersplit  = explode($delimiter, $storage->mod_folder($name));
     $level        = count($foldersplit) - 1;

--
Gitblit v1.9.1