From: Zach Copley <zach@status.net>
Date: Mon, 7 Mar 2011 22:32:14 +0000 (-0800)
Subject: Rearrange alphanav to better fit 3CL
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b431a3b21686b67f2b8fc95feeb03f545e8e3ce3;p=quix0rs-gnu-social.git

Rearrange alphanav to better fit 3CL
---

diff --git a/plugins/Directory/DirectoryPlugin.php b/plugins/Directory/DirectoryPlugin.php
index 50a0da7cf9..541ec556bf 100644
--- a/plugins/Directory/DirectoryPlugin.php
+++ b/plugins/Directory/DirectoryPlugin.php
@@ -121,7 +121,7 @@ class DirectoryPlugin extends Plugin
         $m->connect(
             'directory/users/:filter',
             array('action' => 'userdirectory'),
-            array('filter' => '[0-9a-zA-Z_]{1,64}')
+            array('filter' => '([0-9a-zA-Z_]{1,64}|0-9)')
         );
 
         return true;
diff --git a/plugins/Directory/actions/userdirectory.php b/plugins/Directory/actions/userdirectory.php
index 20ec5c19e3..24d91ad772 100644
--- a/plugins/Directory/actions/userdirectory.php
+++ b/plugins/Directory/actions/userdirectory.php
@@ -213,7 +213,7 @@ class UserdirectoryAction extends Action
 
         $this->elementStart('div', array('id' => 'user_directory'));
 
-        $alphaNav = new AlphaNav($this, true, array('All'));
+        $alphaNav = new AlphaNav($this, false, false, array('0-9', 'All'));
         $alphaNav->show();
 
         $profile = null;
@@ -320,7 +320,16 @@ class UserdirectoryAction extends Action
             $sort   = $this->getSortKey();
             $sql    = 'SELECT profile.* FROM profile, user WHERE profile.id = user.id';
 
-            if ($this->filter != 'all') {
+            switch($this->filter)
+            {
+            case 'all':
+                // NOOP
+                break;
+            case '0-9':
+                $sql .=
+                    '  AND LEFT(profile.nickname, 1) BETWEEN \'0\' AND \'9\'';
+                break;
+            default:
                 $sql .= sprintf(
                     ' AND LEFT(LOWER(profile.nickname), 1) = \'%s\'',
                     $this->filter
diff --git a/plugins/Directory/lib/alphanav.php b/plugins/Directory/lib/alphanav.php
index 645cdfa601..dadb589094 100644
--- a/plugins/Directory/lib/alphanav.php
+++ b/plugins/Directory/lib/alphanav.php
@@ -75,11 +75,11 @@ class AlphaNav extends Widget
             $this->filters = array_merge($this->filters, range(0, 9));
         }
 
+        $this->filters = array_merge($this->filters, range('A', 'Z'));
+
         if ($append) {
             $this->filters = array_merge($this->filters, $append);
         }
-
-        $this->filters = array_merge($this->filters, range('A', 'Z'));
     }
 
     /**