Commit 69c4be2d authored by terry%mozilla.org's avatar terry%mozilla.org

Remember the previous sort order in a cookie, and make that the

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.
parent 2181b142
......@@ -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"
......
......@@ -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 {
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment