Просмотр исходного кода

Add access keys to main options page

pdontthink 16 лет назад
Родитель
Сommit
ad6bc15789
4 измененных файлов с 114 добавлено и 41 удалено
  1. 9 0
      include/load_prefs.php
  2. 55 8
      include/options/accessibility.php
  3. 44 28
      src/options.php
  4. 6 5
      templates/default/option_groups.tpl

+ 9 - 0
include/load_prefs.php

@@ -396,6 +396,15 @@ $accesskey_folders_purge_trash = getPref($data_dir, $username, 'accesskey_folder
 $accesskey_folders_inbox = getPref($data_dir, $username, 'accesskey_folders_inbox', 'i');
 
 
+$accesskey_options_personal = getPref($data_dir, $username, 'accesskey_options_personal', 'p');
+$accesskey_options_display = getPref($data_dir, $username, 'accesskey_options_display', 'd');
+$accesskey_options_highlighting = getPref($data_dir, $username, 'accesskey_options_highlighting', 'h');
+$accesskey_options_folders = getPref($data_dir, $username, 'accesskey_options_folders', 'f');
+$accesskey_options_index_order = getPref($data_dir, $username, 'accesskey_options_index_order', 'x');
+$accesskey_options_compose = getPref($data_dir, $username, 'accesskey_options_compose', 'e');
+$accesskey_options_accessibility = getPref($data_dir, $username, 'accesskey_options_accessibility', 'a');
+
+
 /**
  * Height of iframe that displays html formated emails
  * @since 1.5.1

+ 55 - 8
include/options/accessibility.php

@@ -363,14 +363,61 @@ function load_optpage_data_accessibility() {
     $optgrps[SMOPT_GRP_ACCESSKEYS_OPTIONS] = _("Access Keys For Options Screen");
     $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS] = array();
 
-//FIXME -- TODO...
-//    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
-//        'name'    => 'accesskey_options_XXXXXXXXXXXXXXXXXXXXXXX',
-//        'caption' => _("XXXXXXXXXXXXXXX"),
-//        'type'    => SMOPT_TYPE_STRLIST,
-//        'refresh' => SMOPT_REFRESH_NONE,
-//        'posvals' => $my_a_to_z,
-//    );
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_personal',
+        'caption' => _("Personal Information"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_display',
+        'caption' => _("Display Preferences"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_highlighting',
+        'caption' => _("Message Highlighting"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_folders',
+        'caption' => _("Folder Preferences"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_index_order',
+        'caption' => _("Index Order"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_compose',
+        'caption' => _("Compose Preferences"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
+
+    $optvals[SMOPT_GRP_ACCESSKEYS_OPTIONS][] = array(
+        'name'    => 'accesskey_options_accessibility',
+        'caption' => _("Accessibility Preferences"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => $my_a_to_z,
+    );
 
 
     /* Assemble all this together and return it as our result. */

+ 44 - 28
src/options.php

@@ -323,60 +323,73 @@ if ($optpage == SMOPT_PAGE_MAIN) {
     /******************************************/
     $optpage_blocks = array();
 
+    // access keys...
+    global $accesskey_options_personal, $accesskey_options_display,
+           $accesskey_options_highlighting, $accesskey_options_folders,
+           $accesskey_options_index_order, $accesskey_options_compose,
+           $accesskey_options_accessibility;
+
     /* Build a section for Personal Options. */
     $optpage_blocks[] = array(
-        'name' => _("Personal Information"),
-        'url'  => 'options.php?optpage=' . SMOPT_PAGE_PERSONAL,
-        'desc' => _("This contains personal information about yourself such as your name, your email address, etc."),
-        'js'   => false
+        'name'      => _("Personal Information"),
+        'url'       => 'options.php?optpage=' . SMOPT_PAGE_PERSONAL,
+        'desc'      => _("This contains personal information about yourself such as your name, your email address, etc."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_personal,
     );
 
     /* Build a section for Display Options. */
     $optpage_blocks[] = array(
-        'name' => _("Display Preferences"),
-        'url'  => 'options.php?optpage=' . SMOPT_PAGE_DISPLAY,
-        'desc' => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."),
-        'js'   => false
+        'name'      => _("Display Preferences"),
+        'url'       => 'options.php?optpage=' . SMOPT_PAGE_DISPLAY,
+        'desc'      => _("You can change the way that SquirrelMail looks and displays information to you, such as the colors, the language, and other settings."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_display,
     );
 
     /* Build a section for Message Highlighting Options. */
     $optpage_blocks[] = array(
-        'name' =>_("Message Highlighting"),
-        'url'  => 'options_highlight.php',
-        'desc' =>_("Based upon given criteria, incoming messages can have different background colors in the message list. This helps to easily distinguish who the messages are from, especially for mailing lists."),
-        'js'   => false
+        'name'      =>_("Message Highlighting"),
+        'url'       => 'options_highlight.php',
+        'desc'      =>_("Based upon given criteria, incoming messages can have different background colors in the message list. This helps to easily distinguish who the messages are from, especially for mailing lists."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_highlighting,
     );
 
     /* Build a section for Folder Options. */
     $optpage_blocks[] = array(
-        'name' => _("Folder Preferences"),
-        'url'  => 'options.php?optpage=' . SMOPT_PAGE_FOLDER,
-        'desc' => _("These settings change the way your folders are displayed and manipulated."),
-        'js'   => false
+        'name'      => _("Folder Preferences"),
+        'url'       => 'options.php?optpage=' . SMOPT_PAGE_FOLDER,
+        'desc'      => _("These settings change the way your folders are displayed and manipulated."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_folders,
     );
 
     /* Build a section for Index Order Options. */
     $optpage_blocks[] = array(
-        'name' => _("Index Order"),
-        'url'  => 'options_order.php',
-        'desc' => _("The order of the message index can be rearranged and changed to contain the headers in any order you want."),
-        'js'   => false
+        'name'      => _("Index Order"),
+        'url'       => 'options_order.php',
+        'desc'      => _("The order of the message index can be rearranged and changed to contain the headers in any order you want."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_index_order,
     );
 
     /* Build a section for Compose Options. */
     $optpage_blocks[] = array(
-        'name' => _("Compose Preferences"),
-        'url'  => 'options.php?optpage=' . SMOPT_PAGE_COMPOSE,
-        'desc' => _("Control the behaviour and layout of writing new mail messages, replying to and forwarding messages."),
-        'js'   => false
+        'name'      => _("Compose Preferences"),
+        'url'       => 'options.php?optpage=' . SMOPT_PAGE_COMPOSE,
+        'desc'      => _("Control the behaviour and layout of writing new mail messages, replying to and forwarding messages."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_compose,
     );
 
     /* Build a section for Accessibility Options. */
     $optpage_blocks[] = array(
-        'name' => _("Accessibility Preferences"),
-        'url'  => 'options.php?optpage=' . SMOPT_PAGE_ACCESSIBILITY,
-        'desc' => _("You can configure features that improve interface usability."),
-        'js'   => false
+        'name'      => _("Accessibility Preferences"),
+        'url'       => 'options.php?optpage=' . SMOPT_PAGE_ACCESSIBILITY,
+        'desc'      => _("You can configure features that improve interface usability."),
+        'js'        => false,
+        'accesskey' => $accesskey_options_accessibility,
     );
 
     /* Build a section for plugins wanting to register an optionpage. */
@@ -388,6 +401,9 @@ if ($optpage == SMOPT_PAGE_MAIN) {
     $js_optpage_blocks = array();
     $reg_optpage_blocks = array();
     foreach ($optpage_blocks as $cur_optpage) {
+        if (!isset($cur_optpage['accesskey'])) {
+            $cur_optpage['accesskey'] = 'NONE';
+        }
         if (!isset($cur_optpage['js']) || !$cur_optpage['js']) {
             $reg_optpage_blocks[] = $cur_optpage;
         } else if (checkForJavascript()) {

+ 6 - 5
templates/default/option_groups.tpl

@@ -8,10 +8,11 @@
  *      $page_title - string containing the title element for this page
  *      $options    - array containing option blocks to be displayed.  Each
  *                    element in the array will contain the following fields:
- *          $el['url']  - The URL of the link to display that option page
- *          $el['name'] - The name of the option page
- *          $el['desc'] - string containing the description of that option block
- *          $el['js']   - boolean TRUE if the element requires javascript being enabled. 
+ *          $el['url']       - The URL of the link to display that option page
+ *          $el['name']      - The name of the option page
+ *          $el['desc']      - string containing the description of that option block
+ *          $el['js']        - boolean TRUE if the element requires javascript being enabled. 
+ *          $el['accesskey'] - an access key, if one exists (if not, it will be "NONE")
  *
  * @copyright © 2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -38,7 +39,7 @@ extract($t);
    <table cellspacing="0">
     <tr>
      <td class="optionName">
-      <a href=<?php echo '"'.$option['url'].'"'; ?>><?php echo $option['name']; ?></a>
+      <a href=<?php echo '"'.$option['url'].'"'; if ($option['accesskey'] != 'NONE') echo ' accesskey="' . $option['accesskey'] . '"'; ?>><?php echo $option['name']; ?></a>
      </td>
     </tr>
     <tr>