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
cb6f2292
Commit
cb6f2292
authored
Mar 13, 2002
by
myk%mozilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug 97739: Confirms deletion of an attachment status in browsers with no-JS/JS-off.
Patch by Jeff Hedlund <jeff.hedlund@matrixsi.com>. r=myk,gerv
parent
496013d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
13 deletions
+66
-13
editattachstatuses.cgi
editattachstatuses.cgi
+43
-6
list.atml
template/default/attachstatus/list.atml
+23
-7
No files found.
editattachstatuses.cgi
View file @
cb6f2292
...
...
@@ -87,11 +87,16 @@ elsif ($action eq "update")
validateSortKey
();
update
();
}
elsif
(
$action
eq
"delete"
)
elsif
(
$action
eq
"
confirm
delete"
)
{
validateID
();
deleteStatus
();
confirmDelete
();
}
elsif
(
$action
eq
"delete"
)
{
validateID
();
deleteStatus
();
}
else
{
DisplayError
(
"I could not figure out what you wanted to do."
)
...
...
@@ -174,14 +179,18 @@ sub list
# Retrieve a list of attachment status flags and create an array of hashes
# in which each hash contains the data for one flag.
SendSQL
(
"SELECT id, name, description, sortkey, product
FROM attachstatusdefs ORDER BY sortkey"
);
SendSQL
(
"SELECT id, name, description, sortkey, product, count(statusid)
FROM attachstatusdefs LEFT JOIN attachstatuses
ON attachstatusdefs.id=attachstatuses.statusid
GROUP BY id
ORDER BY sortkey"
);
my
@statusdefs
;
while
(
MoreSQLData
()
)
{
my
(
$id
,
$name
,
$description
,
$sortkey
,
$product
)
=
FetchSQLData
();
my
(
$id
,
$name
,
$description
,
$sortkey
,
$product
,
$attachcount
)
=
FetchSQLData
();
push
@statusdefs
,
{
'id'
=>
$id
,
'name'
=>
$name
,
'description'
=>
$description
,
'sortkey'
=>
$sortkey
,
'product'
=>
$product
};
'sortkey'
=>
$sortkey
,
'product'
=>
$product
,
'attachcount'
=>
$attachcount
};
}
# Define the variables and functions that will be passed to the UI template.
...
...
@@ -293,6 +302,34 @@ sub update
list
(
"The attachment status has been updated."
);
}
sub
confirmDelete
{
# check if we need confirmation to delete:
SendSQL
(
"SELECT COUNT(attach_id), name
FROM attachstatusdefs LEFT JOIN attachstatuses
ON attachstatuses.statusid=attachstatusdefs.id
WHERE statusid = $::FORM{'id'}
GROUP BY attachstatuses.statusid;"
);
my
(
$attachcount
,
$name
)
=
FetchSQLData
();
if
(
$attachcount
>
0
)
{
$vars
->
{
'id'
}
=
$::FORM
{
'id'
};
$vars
->
{
'attachcount'
}
=
$attachcount
;
$vars
->
{
'name'
}
=
$name
;
print
"Content-type: text/html\n\n"
;
$template
->
process
(
"attachstatus/delete.atml"
,
$vars
)
||
DisplayError
(
"Template process failed: "
.
&
$template
->
error
())
&&
exit
;
}
else
{
deleteStatus
();
}
}
sub
deleteStatus
{
...
...
template/default/attachstatus/list.atml
View file @
cb6f2292
...
...
@@ -44,8 +44,14 @@
<td>[% statusdef.sortkey %]</td>
<td>[% statusdef.product %]</td>
<td>
<a href="editattachstatuses.cgi?action=edit&id=[% statusdef.id %]">Edit</a>
<a href="editattachstatuses.cgi?action=delete&id=[% statusdef.id %]" onclick="return confirmDelete();">Delete</a>
<a href="editattachstatuses.cgi?action=edit&id=[% statusdef.id %]">
Edit</a>
|
<a href="editattachstatuses.cgi?action=confirmdelete&id=[% statusdef.id %]"
onclick="return confirmDelete([% statusdef.attachcount %],
'[% statusdef.name FILTER js %]',
[% statusdef.id %]);">
Delete</a>
</td>
</tr>
...
...
@@ -59,13 +65,23 @@
</tr>
</table>
<script language="JavaScript">
function confirmDelete()
function confirmDelete(
attachcount, name, id
)
{
return confirm('Are you sure you want to permanently delete ' +
'this attachment status? All attachments ' +
'with this status will have it unset.');
if (attachcount > 0) {
msg = attachcount + ' attachments have the status ' +
name + '. If you delete it, those attachments ' +
'will lose this status. Do you really want to ' +
'delete this status?';
}
else {
msg = 'Are you sure you want to delete attachment status ' +
name + '?';
}
if (confirm(msg)) {
location.href = "editattachstatuses.cgi?action=delete&id=" + id;
}
return false;
}
</script>
...
...
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