]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Remember the previous sort order in a cookie, and make that the
authorterry%mozilla.org <>
Sun, 23 Jan 2000 03:08:55 +0000 (03:08 +0000)
committerterry%mozilla.org <>
Sun, 23 Jan 2000 03:08:55 +0000 (03:08 +0000)
default sort order for new queries.  Add a new "show list" link to the
navigation header to return you to the list of selected bugs.

CGI.pl
buglist.cgi
query.cgi

diff --git a/CGI.pl b/CGI.pl
index ecd56860ad95ce63c97cc4dee72d21924fc76380..4ad0064f3e279c2a464a8921053e5b3d65ecbfe8 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -268,6 +268,7 @@ sub navigation_header {
        } else {
            print "<I><FONT COLOR=\#777777>Next</FONT></I>\n";
        }
+        print qq{&nbsp;&nbsp;<A HREF="buglist.cgi?regetlastlist=1">Show list</A>\n};
     }
     print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=query.cgi>Query page</A>\n";
     print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=enter_bug.cgi>Enter new bug</A>\n"
index 6f791a6dff11db26402bb228255f26012e064dbd..488944fb43a1e7dc9320345919259db3f17c6366 100755 (executable)
@@ -29,7 +29,6 @@ use Date::Parse;
 
 use vars %::MFORM,
     @::components,
-    @::db,
     @::default_column_list,
     @::keywordsbyname,
     @::legal_keywords,
@@ -45,6 +44,7 @@ use vars %::MFORM,
 
 ConnectToDatabase();
 
+# print "Content-type: text/plain\n\n";    # Handy for debugging.
 
 if (!defined $::FORM{'cmdtype'}) {
     # This can happen if there's an old bookmark to a query...
@@ -250,6 +250,23 @@ and    bugs.version = projector.value
 and    bugs.groupset & $::usergroupset = bugs.groupset
 ";
 
+if ($::FORM{'regetlastlist'}) {
+    if (!$::COOKIE{'BUGLIST'}) {
+        print qq{
+Sorry, I seem to have lost the cookie that recorded the results of your last
+query.  You will have to start over at the <A HREF="query.cgi">query page</A>.
+};
+        PutTrailer();
+        exit;
+    }
+    my @list = split(/:/, $::COOKIE{'BUGLIST'});
+    $::MFORM{'bug_id'} = \@list;
+    $::FORM{'bug_id'} = join('', $::MFORM{'bug_id'});
+    if (!$::FORM{'order'}) {
+        $::FORM{'order'} = 'reuse last sort';
+    }
+}
+
 if ((defined $::FORM{'emailcc1'} && $::FORM{'emailcc1'}) ||
     (defined $::FORM{'emailcc2'} && $::FORM{'emailcc2'})) {
 
@@ -532,7 +549,11 @@ foreach my $f ("short_desc", "long_desc", "bug_file_loc",
 
 $query .= "group by bugs.bug_id\n";
 
+
 if (defined $::FORM{'order'} && $::FORM{'order'} ne "") {
+    if ($::COOKIE{'LASTORDER'} && $::FORM{'order'} =~ /^reuse/i) {
+        $::FORM{'order'} = url_decode($::COOKIE{'LASTORDER'});
+    }
     $query .= "order by ";
     $::FORM{'order'} =~ s/votesum/bugs.votes/; # Silly backwards compatability
                                                # hack.
@@ -732,6 +753,10 @@ if ($serverpush) {
     # Note! HTML header not yet closed
 }
 my $toolong = 0;
+if ($::FORM{'order'}) {
+    my $q = url_quote($::FORM{'order'});
+    print "Set-Cookie: LASTORDER=$q ; path=/; expires=Sun, 30-Jun-2029 00:00:00 GMT\n";
+}
 if (length($buglist) < 4000) {
     print "Set-Cookie: BUGLIST=$buglist\n\n";
 } else {
index f8728e9c94fef3ed71a9e8762456b10c7229aad6..b032a28608130eba40ef769398f6c6ad7b3f3c82 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -593,10 +593,18 @@ print "
 
 <NOBR><B>Sort By:</B>
 <SELECT NAME=\"order\">
-  <OPTION>Bug Number
-  <OPTION SELECTED>\"Importance\"
-  <OPTION>Assignee
-</SELECT></NOBR>
+";
+
+my $deforder = "'Importance'";
+my @orders = ('Bug Number', $deforder, 'Assignee');
+
+if ($::COOKIE{'LASTORDER'}) {
+    $deforder = "Reuse same sort as last time";
+    unshift(@orders, $deforder);
+}
+    
+print make_options(\@orders, $deforder);
+print "</SELECT></NOBR>
 <INPUT TYPE=\"submit\" VALUE=\"Submit query\">
 <INPUT TYPE=\"reset\" VALUE=\"Reset back to the default query\">
 <INPUT TYPE=hidden name=form_name VALUE=query>