[FFmpeg-devel] [FATESERVER/PATCH 7/8] index: lsort(): add support for sorting with '//'

Timothy Gu timothygu99 at gmail.com
Wed Jun 11 03:07:53 CEST 2014


Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---
 index.cgi | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/index.cgi b/index.cgi
index 6603fda..7204591 100755
--- a/index.cgi
+++ b/index.cgi
@@ -111,14 +111,23 @@ sub lsort {
     $params .= '&' if $params;
     my ($text, $key) = @_;
 
-    if ($sort eq $key) {                           # $sort = $key
-        if ($key =~ /^desc/) {                     # $sort = desc*
-            $key =~ s/^desc//;
-        } else {                                   # $sort = *
-            $key = "desc$key";
+    my $newkey = '';
+    if ($sort eq $key) {                           # $key     = $sort
+        for my $thiskey (split /\/\//, $key) {
+            if ($thiskey =~ /^desc/) {             # $thiskey = desc*
+                $thiskey =~ s/^desc//;
+            } else {                               # $thiskey = *
+                $thiskey = "desc$thiskey";
+            }
+            if ($newkey eq '') {
+                $newkey = $thiskey;
+            } else {
+                $newkey .= "//$thiskey";
+            }
         }
     }
 
+    $key = $newkey if $newkey ne '';
     anchor $text, href => "$uri?${params}sort=$key";
 }
 
-- 
1.9.1



More information about the ffmpeg-devel mailing list