Completely remove sorting from config/nls.php
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jul 2010 19:19:03 +0000 (13:19 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 15 Jul 2010 19:19:03 +0000 (13:19 -0600)
Do sorting only when we need it.

fima/data.php
horde/config/nls.php
imp/compose.php
imp/lib/Prefs/Ui.php
turba/data.php

index aa0ee84..771332b 100644 (file)
@@ -208,8 +208,9 @@ require FIMA_TEMPLATES . '/menu.inc';
 
 if ($next_step == Horde_Data::IMPORT_FILE) {
     /* Build the charset options. */
-    $charsets = Horde_Nls::$config['encodings'];
-    $all_charsets = Horde_Nls::$config['charsets'];
+    $charsets = $registry->nlsconfig['encodings'];
+    asort($charsets);
+    $all_charsets = $registry->nlsconfig['charsets'];
     natcasesort($all_charsets);
     foreach ($all_charsets as $charset) {
         if (!isset($charsets[$charset])) {
index 96373e7..0183721 100644 (file)
@@ -211,10 +211,6 @@ $horde_nls_config = array(
     )
 );
 
-/* Sort encodings. Disabled by default - encoding list is already sorted by
- * default in English. */
-//asort($horde_nls_config['encodings']);
-
 /* BSD charsets. */
 if (strpos(PHP_OS, 'BSD') !== false) {
     $horde_nls_config['charsets'] = array_merge($horde_nls_config['charsets'], array(
index 3568f92..5ba6799 100644 (file)
@@ -819,6 +819,7 @@ if ($redirect) {
         $t->set('charset_label', Horde::label('charset', _("C_harset")));
         $t->set('charset_tabindex', ++$tabindex);
         $charset_array = array();
+        asort($registry->nlsconfig['encodings']);
         foreach ($registry->nlsconfig['encodings'] as $charset => $label) {
             $charset_array[] = array('value' => $charset, 'selected' => (strtolower($charset) == strtolower($encoding)), 'label' => $label);
         }
index 8a07974..7a4c927 100644 (file)
@@ -86,6 +86,11 @@ class IMP_Prefs_Ui
             if (empty($conf['compose']['allow_receipts'])) {
                 $ui->suppress[] = 'disposition_request_read';
             }
+
+            /* Sort encodings. */
+            if (!$prefs->isLocked('sending_charset')) {
+                asort($registry->nlsconfig['encodings']);
+            }
             break;
 
         case 'delmove':
@@ -269,6 +274,11 @@ class IMP_Prefs_Ui
                 $ui->suppress[] = 'html_image_replacement';
                 $ui->suppress[] = 'html_image_addrbook';
             }
+
+            /* Sort encodings. */
+            if (!$prefs->isLocked('default_msg_charset')) {
+                asort($registry->nlsconfig['encodings']);
+            }
             break;
         }
 
index b4bed95..7a3e8a9 100644 (file)
@@ -532,8 +532,9 @@ if ($next_step == Horde_Data::IMPORT_FILE) {
     }
 
     /* Build the charset options. */
-    $charsets = Horde_Nls::$config['encodings'];
-    $all_charsets = Horde_Nls::$config['charsets'];
+    $charsets = $registry->nlsconfig['encodings'];
+    asort($charsets);
+    $all_charsets = $registry->nlsconfig['charsets'];
     natcasesort($all_charsets);
     foreach ($all_charsets as $charset) {
         if (!isset($charsets[$charset])) {