[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#500505: DDPO: please add a "Sections" sorting order



Package: qa.debian.org
Severity: wishlist
Tags: patch

Hello,
since one can subscribe to packages he does not maintain via the DDPO bot,
it'd be useful to patch the DDPO page, since it actually lists the subscribed
packages in separate sections, but *keeps* packages in main/contrib/non-free in
their sections, not in the subscribed ones.

I'm attaching two patches fixing this behaviour:

1) developer_top.wml.patch -- this puts the subscribed sections at the top of
the page, thus moving main/contrib/non-free at the end of the page;

2) developer_bottom.wml.patch -- this one leaves the order as-is, and thus
needs some more control on what packages are being displayed in
main/contrib/non-free (thus, it's a bigger patch).


Kindly,
David

-- 
 . ''`.  Debian maintainer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
--- developer.wml	2008-09-28 20:57:25.000000000 +0200
+++ developer_bottom.wml	2008-09-28 23:35:50.000000000 +0200
@@ -221,7 +221,7 @@
         $counter_span += 1;
         $display_data = html_b(html_em("You need to allow cookies if you want the configuration to be stored. If not, remember/bookmark the right URL that will be provided after submitting changes. "));
         $display_data .= "You can override the settings by providing an extra arg to the URL (e.g. &buildd=1 if you want to display the buildd column). These args will not change the custom settings you defined before (the cookie is not modified)." . html_br();
-        $display_data .= "The 'Name' ordering sorts by package name, 'Date' sorts by upload date (descending), and 'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections." . html_br();
+        $display_data .= "The 'Name' ordering sorts by package name, 'Date' sorts by upload date (descending), 'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections, 'Section' sorts by sections first and by name secondly." . html_br();
         $display_data = html_small($display_data);
         $display_table_th = html_th("Bugs","&bugs=");
         $display_table_th .= html_th("Version","&version=");
@@ -1162,6 +1162,10 @@
     foreach ($components as $component) {
         $packages = dba_fetch("$login:$component", $pack_db);
         if ($packages != "") {
+            if (isdisplayed('ordering') == 3) {
+                $tmp_packages = explode(" ", $packages);
+                $packages = implode(" ", array_filter($tmp_packages, is_subscribed));
+            }
             print_package_entries($component, $packages, $comaint);
             $no_packages = true;
         } elseif (! $no_packages) {
@@ -1182,6 +1186,35 @@
     }
 }
 
+function is_subscribed($package) {
+    global $prefix;
+    global $login;
+    static $subscribe_db;
+    $ret = true;
+
+    # section1:pkg1 pkg2;section2:pkg3
+    if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r-', 'db4');
+    
+    $data = dba_fetch($login, $subscribe_db);
+    if(!$data) { return; }
+
+    $sections = explode(";", $data);
+    foreach($sections as $section)
+    {
+        if (preg_match("/^(.*):(.*)/", $section, $secarray)) {
+            $packages = explode(" ", $secarray[2]);
+            if (in_array($package, $packages)) {
+                // for array_filter() in print_developer() to work, we return false when
+                // we encounter the package.
+                $ret = false;
+                break;
+            }
+        }
+    }
+    
+    return $ret;
+}
+
 # main program
 
 # open package info db
--- developer.wml	2008-09-28 20:57:25.000000000 +0200
+++ developer_top.wml	2008-09-28 23:38:18.000000000 +0200
@@ -221,7 +221,7 @@
         $counter_span += 1;
         $display_data = html_b(html_em("You need to allow cookies if you want the configuration to be stored. If not, remember/bookmark the right URL that will be provided after submitting changes. "));
         $display_data .= "You can override the settings by providing an extra arg to the URL (e.g. &buildd=1 if you want to display the buildd column). These args will not change the custom settings you defined before (the cookie is not modified)." . html_br();
-        $display_data .= "The 'Name' ordering sorts by package name, 'Date' sorts by upload date (descending), and 'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections." . html_br();
+        $display_data .= "The 'Name' ordering sorts by package name, 'Date' sorts by upload date (descending), 'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections, 'Section' sorts by sections first and by name secondly." . html_br();
         $display_data = html_small($display_data);
         $display_table_th = html_th("Bugs","&bugs=");
         $display_table_th .= html_th("Version","&version=");
@@ -1159,6 +1159,10 @@
     print_header_entries_body($key, $name, $comaint, $login);
 
     $count = 0;
+
+    if (isdisplayed('ordering') == 3)    
+        print_subscribed_packages($login, $comaint);
+
     foreach ($components as $component) {
         $packages = dba_fetch("$login:$component", $pack_db);
         if ($packages != "") {
@@ -1170,7 +1174,8 @@
         }
         $count += 1;
     }
-    print_subscribed_packages($login, $comaint);
+    if (isdisplayed('ordering') != 3)    
+        print_subscribed_packages($login, $comaint);
     if(isdisplayed('packages'))
         print_package_entries("url", isdisplayed('packages'), $comaint);
     if(isdisplayed('uploads'))

Attachment: signature.asc
Description: PGP signature


Reply to: