Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
23d260a3
Commit
23d260a3
authored
Aug 22, 2006
by
lpsolit%gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 344435: Let me remove bugs from saved buglists - Patch by Frédéric Buclin…
Bug 344435: Let me remove bugs from saved buglists - Patch by Frédéric Buclin <LpSolit@gmail.com> r=bkor a=myk
parent
61d670d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
30 deletions
+116
-30
buglist.cgi
buglist.cgi
+35
-14
per-bug-queries.html.tmpl
template/en/default/global/per-bug-queries.html.tmpl
+66
-15
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+15
-1
No files found.
buglist.cgi
View file @
23d260a3
...
@@ -504,28 +504,49 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) {
...
@@ -504,28 +504,49 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) {
my
$query_name
=
$cgi
->
param
(
'newqueryname'
);
my
$query_name
=
$cgi
->
param
(
'newqueryname'
);
my
$new_query
=
$cgi
->
param
(
'newquery'
);
my
$new_query
=
$cgi
->
param
(
'newquery'
);
my
$query_type
=
QUERY_LIST
;
my
$query_type
=
QUERY_LIST
;
# If add_bugids is true, we are adding individual bugs to a saved
# If list_of_bugs is true, we are adding/removing individual bugs
# search. We get the existing list of bug IDs (if any) and append
# to a saved search. We get the existing list of bug IDs (if any)
# the new ones.
# and add/remove the passed ones.
if
(
$cgi
->
param
(
'add_bugids'
))
{
if
(
$cgi
->
param
(
'list_of_bugs'
))
{
my
%
bug_ids
;
# We add or remove bugs based on the action choosen.
foreach
my
$bug_id
(
split
(
/[\s,]+/
,
$cgi
->
param
(
'bug_ids'
)))
{
my
$action
=
trim
(
$cgi
->
param
(
'action'
)
||
''
);
next
unless
$bug_id
;
$action
=~
/^(add|remove)$/
ValidateBugID
(
$bug_id
);
||
ThrowCodeError
(
'unknown_action'
,
{
'action'
=>
$action
});
$bug_ids
{
$bug_id
}
=
1
;
# If we are removing bugs, then we must have an existing
# saved search selected.
if
(
$action
eq
'remove'
)
{
$query_name
&&
ThrowUserError
(
'no_bugs_to_remove'
);
}
}
ThrowUserError
(
"no_bug_ids"
)
unless
scalar
(
keys
%
bug_ids
);
if
(
!
trim
(
$query_name
))
{
my
%
bug_ids
;
# No new query name has been given. We append new bug IDs
unless
(
$query_name
)
{
# to the existing list.
# No new query name has been given. We retrieve bug IDs
# currently set in the selected saved search.
$query_name
=
$cgi
->
param
(
'oldqueryname'
);
$query_name
=
$cgi
->
param
(
'oldqueryname'
);
my
$old_query
=
LookupNamedQuery
(
$query_name
);
my
$old_query
=
LookupNamedQuery
(
$query_name
);
foreach
my
$bug_id
(
split
(
/[\s,=]+/
,
$old_query
))
{
foreach
my
$bug_id
(
split
(
/[\s,=]+/
,
$old_query
))
{
$bug_ids
{
$bug_id
}
=
1
if
detaint_natural
(
$bug_id
);
$bug_ids
{
$bug_id
}
=
1
if
detaint_natural
(
$bug_id
);
}
}
}
}
$new_query
=
"bug_id="
.
join
(
','
,
sort
{
$a
<=>
$b
}
keys
%
bug_ids
);
my
$keep_bug
=
(
$action
eq
'add'
)
?
1
:
0
;
my
$changes
=
0
;
foreach
my
$bug_id
(
split
(
/[\s,]+/
,
$cgi
->
param
(
'bug_ids'
)))
{
next
unless
$bug_id
;
ValidateBugID
(
$bug_id
);
$bug_ids
{
$bug_id
}
=
$keep_bug
;
$changes
=
1
;
}
ThrowUserError
(
'no_bug_ids'
,
{
'action'
=>
$action
})
unless
$changes
;
# Only keep bug IDs we want to add/keep. Disregard deleted ones.
my
@bug_ids
=
grep
{
$bug_ids
{
$_
}
==
1
}
keys
%
bug_ids
;
# If the list is now empty, we could as well delete it completely.
ThrowUserError
(
'no_bugs_in_list'
,
{
'saved_search'
=>
$query_name
})
unless
scalar
(
@bug_ids
);
$new_query
=
"bug_id="
.
join
(
','
,
sort
{
$a
<=>
$b
}
@bug_ids
);
$query_type
=
LIST_OF_BUGS
;
$query_type
=
LIST_OF_BUGS
;
}
}
my
$tofooter
=
1
;
my
$tofooter
=
1
;
...
...
template/en/default/global/per-bug-queries.html.tmpl
View file @
23d260a3
...
@@ -15,28 +15,79 @@
...
@@ -15,28 +15,79 @@
#%]
#%]
[% IF user.id && user.settings.per_bug_queries.value == "on" %]
[% IF user.id && user.settings.per_bug_queries.value == "on" %]
<script type="text/javascript">
<!--
function update_text() {
// 'lob' means list_of_bugs.
var lob_action = document.getElementById('lob_action');
var action = lob_action.options[lob_action.selectedIndex].value;
var text = document.getElementById('lob_direction');
var new_query_text = document.getElementById('lob_new_query_text');
if (action == "add") {
text.innerHTML = "to";
new_query_text.style.display = 'inline';
}
else {
text.innerHTML = "from";
new_query_text.style.display = 'none';
}
}
function manage_old_lists() {
var old_lists = document.getElementById('oldqueryname');
// If there is no saved searches available, returns.
if (!old_lists) return;
var new_query = document.getElementById('newqueryname').value;
if (new_query != "") {
old_lists.disabled = true;
}
else {
old_lists.disabled = false;
}
}
//-->
</script>
[%# Get existing lists of bugs for this user %]
[% lists_of_bugs = [] %]
[% FOREACH q = user.queries %]
[% NEXT UNLESS q.query_type == constants.LIST_OF_BUGS %]
[% lists_of_bugs.push(q.name) %]
[% END %]
<div id="links-special">
<div id="links-special">
<div class="label"> </div>
<div class="label"> </div>
<div class="links">
<div class="links">
<form action="buglist.cgi" method="get">
<hr>
<form id="list_of_bugs" action="buglist.cgi" method="get">
<input type="hidden" name="cmdtype" value="doit">
<input type="hidden" name="cmdtype" value="doit">
<input type="hidden" name="remtype" value="asnamed">
<input type="hidden" name="remtype" value="asnamed">
<input type="hidden" name="add_bugids" value="1">
<input type="hidden" name="list_of_bugs" value="1">
<input type="submit" value="Add" id="add"> [% terms.bugs %]
<select id="lob_action" name="action" onchange="update_text();">
<input type="text" name="bug_ids" size="8" maxlength="80"> to
<option value="add">Add</option>
[% foundq = 0 %]
[% IF lists_of_bugs.size %]
[% FOREACH q = user.queries %]
<option value="remove">Remove</option>
[% NEXT UNLESS q.query_type == constants.LIST_OF_BUGS %]
[% IF !foundq %]
[% foundq = 1 %]
<select name="oldqueryname">
[% END %]
[% END %]
<option value="[% q.name FILTER html %]">
</select>
[% q.name FILTER html %]</option>
[%+ terms.bugs %]
<input type="text" name="bug_ids" size="12" maxlength="80">
<span id="lob_direction">to</span>
[% IF lists_of_bugs.size %]
<select id="oldqueryname" name="oldqueryname">
[% FOREACH query = lists_of_bugs %]
<option value="[% query FILTER html %]">[% query FILTER html %]</option>
[% END %]
</select>
[% END %]
[% END %]
[% "</select> or to " IF foundq %]
<span id="lob_new_query_text">
the new saved search:
[% " or to" IF lists_of_bugs.size %] the new saved search:
<input type="text" name="newqueryname" size="20" maxlength="64">
<input type="text" id="newqueryname" name="newqueryname" size="20" maxlength="64"
onkeyup="manage_old_lists();">
</span>
<input type="submit" value="Commit" id="commit_list_of_bugs">
</form>
</form>
</div>
</div>
</div>
</div>
...
...
template/en/default/global/user-error.html.tmpl
View file @
23d260a3
...
@@ -1002,7 +1002,21 @@
...
@@ -1002,7 +1002,21 @@
[% ELSIF error == "no_bug_ids" %]
[% ELSIF error == "no_bug_ids" %]
[% title = BLOCK %]No [% terms.Bugs %] Chosen[% END %]
[% title = BLOCK %]No [% terms.Bugs %] Chosen[% END %]
You didn't choose any [% terms.bugs %] to add to the saved search.
You didn't choose any [% terms.bugs %] to
[% IF action == "add" %] add to [% ELSE %] remove from [% END %]
the saved search.
[% ELSIF error == "no_bugs_in_list" %]
[% title = "Delete Saved Search?" %]
You are going to remove all [% terms.bugs %] from the '[% saved_search FILTER html %]'
saved search. This will delete this saved search completely. Click
<a href="buglist.cgi?cmdtype=dorem&remaction=forget&namedcmd=
[%- saved_search FILTER url_quote %]">here</a> if you really want to
remove it.
[% ELSIF error == "no_bugs_to_remove" %]
[% title = "No Saved Search Selected" %]
You didn't select any saved search to remove [% terms.bugs %] from.
[% ELSIF error == "no_component_change_for_multiple_products" %]
[% ELSIF error == "no_component_change_for_multiple_products" %]
[% title = "Action Not Permitted" %]
[% title = "Action Not Permitted" %]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment