зеркало из https://github.com/mozilla/gecko-dev.git
Bug 150776 - Remembered query options need regrouping. Patch by gerv; r=jouni, burnus.
This commit is contained in:
Родитель
c3faec0fa4
Коммит
7f9d7087a8
|
@ -1064,18 +1064,22 @@ sub GenerateSQL {
|
|||
# Command Execution
|
||||
################################################################################
|
||||
|
||||
# Figure out if the user wanted to do anything besides just running the query
|
||||
# they defined on the query page, and take appropriate action.
|
||||
CMD: for ($::FORM{'cmdtype'}) {
|
||||
/^runnamed$/ && do {
|
||||
# Backwards-compatibility - the old interface had cmdtype="runnamed" to run
|
||||
# a named command, and we can't break this because it's in bookmarks.
|
||||
if ($::FORM{'cmdtype'} eq "runnamed") {
|
||||
$::FORM{'cmdtype'} = "dorem";
|
||||
$::FORM{'remaction'} = "run";
|
||||
}
|
||||
|
||||
# Take appropriate action based on user's request.
|
||||
if ($::FORM{'cmdtype'} eq "dorem") {
|
||||
if ($::FORM{'remaction'} eq "run") {
|
||||
$::buffer = LookupNamedQuery($::FORM{"namedcmd"});
|
||||
$vars->{'title'} = "Bug List: $::FORM{'namedcmd'}";
|
||||
ProcessFormFields($::buffer);
|
||||
$order = $::FORM{'order'} || $order;
|
||||
last CMD;
|
||||
};
|
||||
|
||||
/^editnamed$/ && do {
|
||||
}
|
||||
elsif ($::FORM{'remaction'} eq "load") {
|
||||
my $url = "query.cgi?" . LookupNamedQuery($::FORM{"namedcmd"});
|
||||
print "Refresh: 0; URL=$url\n";
|
||||
print "Content-Type: text/html\n\n";
|
||||
|
@ -1086,9 +1090,8 @@ CMD: for ($::FORM{'cmdtype'}) {
|
|||
$template->process("global/message.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
};
|
||||
|
||||
/^forgetnamed$/ && do {
|
||||
}
|
||||
elsif ($::FORM{'remaction'} eq "forget") {
|
||||
confirm_login();
|
||||
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
|
||||
my $qname = SqlQuote($::FORM{'namedcmd'});
|
||||
|
@ -1112,28 +1115,21 @@ CMD: for ($::FORM{'cmdtype'}) {
|
|||
$template->process("global/message.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
};
|
||||
|
||||
/^asdefault$/ && do {
|
||||
}
|
||||
}
|
||||
elsif ($::FORM{'cmdtype'} eq "doit") {
|
||||
if ($::FORM{'remember'} == 1 && $::FORM{'remtype'} eq "asdefault") {
|
||||
confirm_login();
|
||||
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
|
||||
my $qname = SqlQuote($::defaultqueryname);
|
||||
my $qbuffer = SqlQuote($::buffer);
|
||||
SendSQL("REPLACE INTO namedqueries (userid, name, query)
|
||||
VALUES ($userid, $qname, $qbuffer)");
|
||||
print "Content-Type: text/html\n\n";
|
||||
# Generate and return the UI (HTML page) from the appropriate template.
|
||||
$vars->{'title'} = "OK, default is set";
|
||||
$vars->{'message'} = "OK, you now have a new default query. You may
|
||||
also bookmark the result of any individual query.";
|
||||
$vars->{'url'} = "query.cgi";
|
||||
$vars->{'link'} = "Go back to the query page, using the new default.";
|
||||
$template->process("global/message.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
};
|
||||
|
||||
/^asnamed$/ && do {
|
||||
}
|
||||
elsif ($::FORM{'remember'} == 1 && $::FORM{'remtype'} eq "asnamed") {
|
||||
confirm_login();
|
||||
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
|
||||
|
||||
|
@ -1150,7 +1146,7 @@ CMD: for ($::FORM{'cmdtype'}) {
|
|||
$::buffer =~ s/[\&\?]cmdtype=[a-z]+//;
|
||||
my $qbuffer = SqlQuote($::buffer);
|
||||
|
||||
my $tofooter= $::FORM{'tofooter'} ? 1 : 0;
|
||||
my $tofooter = $::FORM{'tofooter'} ? 1 : 0;
|
||||
|
||||
SendSQL("SELECT query FROM namedqueries WHERE userid = $userid AND name = $qname");
|
||||
if (FetchOneColumn()) {
|
||||
|
@ -1172,8 +1168,6 @@ CMD: for ($::FORM{'cmdtype'}) {
|
|||
}
|
||||
}
|
||||
|
||||
print "Content-Type: text/html\n\n";
|
||||
# Generate and return the UI (HTML page) from the appropriate template.
|
||||
if ($new_in_footer) {
|
||||
my %query = (name => $name,
|
||||
query => $::buffer,
|
||||
|
@ -1181,14 +1175,8 @@ CMD: for ($::FORM{'cmdtype'}) {
|
|||
push(@{$vars->{'user'}{'queries'}}, \%query);
|
||||
}
|
||||
|
||||
$vars->{'title'} = "OK, query saved.";
|
||||
$vars->{'message'} = "OK, you have a new query named <code>$name</code>";
|
||||
$vars->{'url'} = "query.cgi";
|
||||
$vars->{'link'} = "Go back to the query page.";
|
||||
$template->process("global/message.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
};
|
||||
$vars->{'message'} = "OK, you have a new query named <code>$name</code>.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,69 +31,115 @@
|
|||
|
||||
<br>
|
||||
[% IF NOT userid %]
|
||||
<input type="hidden" name="cmdtype" value="doit">
|
||||
<input type="hidden" name="cmdtype" value="doit">
|
||||
[% ELSE %]
|
||||
<input type="radio" name="cmdtype" value="doit" checked="checked">
|
||||
Run this query
|
||||
<br>
|
||||
[% IF namedqueries.size > 0 %]
|
||||
<br>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="cmdtype" value="editnamed">
|
||||
Load my remembered query:
|
||||
</td>
|
||||
<td rowspan="3">
|
||||
<select name="namedcmd">
|
||||
[% FOREACH query = namedqueries %]
|
||||
<option value="[% query FILTER html %]">
|
||||
[% query FILTER html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="cmdtype" value="runnamed">
|
||||
Run my remembered query:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="cmdtype" value="forgetnamed">
|
||||
Forget my remembered query:
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
[% END %]
|
||||
<input type="radio" name="cmdtype" value="asdefault">
|
||||
Remember this as my default query
|
||||
<br>
|
||||
<input type="radio" name="cmdtype" value="asnamed">
|
||||
Remember this query, and name it:
|
||||
<input type="text" name="newqueryname">
|
||||
<br>
|
||||
<input type="checkbox" name="tofooter" value="1">
|
||||
and put it in my page footer
|
||||
<script> <!--
|
||||
function remCheckboxChanged() {
|
||||
if (document.queryform.remember.checked == true) {
|
||||
document.queryform.remtype[0].disabled = false;
|
||||
document.queryform.remtype[1].disabled = false;
|
||||
remTypeChanged();
|
||||
}
|
||||
else {
|
||||
document.queryform.remtype[0].disabled = true;
|
||||
document.queryform.remtype[1].disabled = true;
|
||||
document.queryform.newqueryname.disabled = true;
|
||||
document.queryform.tofooter.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
function remTypeChanged() {
|
||||
if (document.queryform.remtype[0].checked == true) {
|
||||
document.queryform.newqueryname.disabled = false;
|
||||
document.queryform.tofooter.disabled = false;
|
||||
}
|
||||
else {
|
||||
document.queryform.newqueryname.disabled = true;
|
||||
document.queryform.tofooter.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
function selectDoRem() {
|
||||
document.queryform.cmdtype[1].checked = true;
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="cmdtype" value="doit" checked="checked">
|
||||
Run this search
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top">
|
||||
|
||||
<input type="checkbox" name="remember" value="1"
|
||||
onclick="remCheckboxChanged()">
|
||||
and remember it
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" name="remtype" value="asnamed"
|
||||
onclick="remTypeChanged()">
|
||||
with this name:
|
||||
<input type="text" name="newqueryname"><br>
|
||||
|
||||
<input type="checkbox" name="tofooter" value="1">
|
||||
and put it in my page footer<br>
|
||||
<input type="radio" name="remtype" value="asdefault"
|
||||
onclick="remTypeChanged()">
|
||||
as my default options for this page<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
[% IF namedqueries.size > 0 %]
|
||||
<input type="radio" name="cmdtype" value="dorem">
|
||||
<select name="remaction" onclick="selectDoRem()">
|
||||
<option value="run">Run</option>
|
||||
<option value="load">Load</option>
|
||||
<option value="forget">Forget</option>
|
||||
</select>
|
||||
my remembered search:
|
||||
<select name="namedcmd" onclick="selectDoRem()">
|
||||
[% FOREACH query = namedqueries %]
|
||||
<option value="[% query FILTER html %]">
|
||||
[% query FILTER html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script> <!--
|
||||
remCheckboxChanged();
|
||||
remTypeChanged();
|
||||
// -->
|
||||
</script>
|
||||
[% END %]
|
||||
|
||||
<p>
|
||||
Sort results by:
|
||||
<select name="order">
|
||||
[% FOREACH order = orders %]
|
||||
<option value="[% order FILTER html %]"
|
||||
[% " selected" IF default.order.0 == order %]>
|
||||
[% ordersdesc.$order FILTER html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
<p>
|
||||
Sort results by:
|
||||
<select name="order">
|
||||
[% FOREACH order = orders %]
|
||||
<option value="[% order FILTER html %]"
|
||||
[% " selected" IF default.order.0 == order %]>
|
||||
[% ordersdesc.$order FILTER html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
|
||||
<input type="submit" value="[% button_name %]">
|
||||
|
||||
[% IF userdefaultquery %]
|
||||
<p>
|
||||
<a href="query.cgi?nukedefaultquery=1">
|
||||
Set my default query back to the system default</a>.
|
||||
</p>
|
||||
[% END %]
|
||||
</p>
|
||||
|
||||
<input type="submit" value="[% button_name %]">
|
||||
[% IF userdefaultquery %]
|
||||
<p>
|
||||
<a href="query.cgi?nukedefaultquery=1">
|
||||
Set my default query back to the system default</a>
|
||||
</p>
|
||||
[% END %]
|
||||
</p>
|
||||
|
|
Загрузка…
Ссылка в новой задаче