]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Rearrange alphanav to better fit 3CL
authorZach Copley <zach@status.net>
Mon, 7 Mar 2011 22:32:14 +0000 (14:32 -0800)
committerZach Copley <zach@status.net>
Mon, 7 Mar 2011 22:32:14 +0000 (14:32 -0800)
plugins/Directory/DirectoryPlugin.php
plugins/Directory/actions/userdirectory.php
plugins/Directory/lib/alphanav.php

index 50a0da7cf96af81ba6a75ae4297777bd61f68731..541ec556bf0c791e59c55a7fa7e4b610b18ca8dc 100644 (file)
@@ -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;
index 20ec5c19e327205d1bd5ea33fcdb2be9896729e3..24d91ad7725a26c4d664edde9fe1d46f9f97b5f8 100644 (file)
@@ -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
index 645cdfa601df499957610c745cb2cf2a729f2e6b..dadb58909442c65409851c4bf1f6ad986ae45ad1 100644 (file)
@@ -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'));
     }
 
     /**