Commit 95b84377 authored by bugreport%peshkin.net's avatar bugreport%peshkin.net

Bug 236779: Add UI for changing "linkinfooter" flag for saved searches

r=gerv,preed a=justdave
parent a8de93fc
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
{ name => "email", description => "Email settings", { name => "email", description => "Email settings",
saveable => "1" }, saveable => "1" },
{ name => "saved-searches", description => "Saved searches", { name => "saved-searches", description => "Saved searches",
saveable => "0" }, saveable => "1" },
{ name => "permissions", description => "Permissions", { name => "permissions", description => "Permissions",
saveable => "0" } ] %] saveable => "0" } ] %]
......
...@@ -22,13 +22,41 @@ ...@@ -22,13 +22,41 @@
<p>Your saved searches are as follows:</p> <p>Your saved searches are as follows:</p>
<blockquote> <blockquote>
<table cellpadding="3"> <table border="1" cellpadding="3">
<tr>
<th>
Show in <br>
Footer
</th>
<th>
Search
</th>
<th>
Run
</th>
<th>
Edit
</th>
<th>
Forget
</th>
</tr>
[% FOREACH q = queries %] [% FOREACH q = queries %]
<tr> <tr>
<td>[% q.name FILTER html %]:</td>
<td> <td>
<a href="buglist.cgi?[% q.query FILTER html %]">Run</a> | <input type="checkbox"
<a href="query.cgi?[% q.query FILTER html %]">Edit</a> | name="linkinfooter_[% q.name FILTER html %]"
value="1"
[% " checked" IF q.linkinfooter %]>
</td>
<td>[% q.name FILTER html %]</td>
<td>
<a href="buglist.cgi?[% q.query FILTER html %]">Run</a>
</td>
<td>
<a href="query.cgi?[% q.query FILTER html %]">Edit</a>
</td>
<td>
<a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd= <a href="buglist.cgi?cmdtype=dorem&amp;remaction=forget&amp;namedcmd=
[% q.name FILTER html %]">Forget</a> [% q.name FILTER html %]">Forget</a>
</td> </td>
......
...@@ -106,10 +106,12 @@ ...@@ -106,10 +106,12 @@
[% END %] [% END %]
[% FOREACH q = user.queries %] [% FOREACH q = user.queries %]
[% IF q.linkinfooter %]
[% " | " IF print_pipe %] [% " | " IF print_pipe %]
<a href="buglist.cgi?cmdtype=runnamed&amp;namedcmd=[% q.name FILTER url_quote %]"><nobr>[% q.name FILTER html %]</nobr></a> <a href="buglist.cgi?cmdtype=runnamed&amp;namedcmd=[% q.name FILTER url_quote %]"><nobr>[% q.name FILTER html %]</nobr></a>
[% print_pipe = 1 %] [% print_pipe = 1 %]
[% END %] [% END %]
[% END %]
</td> </td>
</tr> </tr>
......
...@@ -301,7 +301,21 @@ sub DoSavedSearches() { ...@@ -301,7 +301,21 @@ sub DoSavedSearches() {
$vars->{'queries'} = Bugzilla->user->queries; $vars->{'queries'} = Bugzilla->user->queries;
} }
# No SaveSavedSearches() because this panel has no changeable fields (yet). sub SaveSavedSearches() {
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
my @queries = @{Bugzilla->user->queries};
my $sth = $dbh->prepare("UPDATE namedqueries SET linkinfooter = ?
WHERE userid = ?
AND name = ?");
foreach my $q (@queries) {
my $linkinfooter =
defined($cgi->param("linkinfooter_$q->{'name'}")) ? 1 : 0;
$sth->execute($linkinfooter, $userid, $q->{'name'});
}
Bugzilla->user->flush_queries_cache;
}
############################################################################### ###############################################################################
...@@ -340,6 +354,7 @@ SWITCH: for ($current_tab_name) { ...@@ -340,6 +354,7 @@ SWITCH: for ($current_tab_name) {
last SWITCH; last SWITCH;
}; };
/^saved-searches$/ && do { /^saved-searches$/ && do {
SaveSavedSearches() if $cgi->param('dosave');
DoSavedSearches(); DoSavedSearches();
last SWITCH; last SWITCH;
}; };
......
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