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
c11aacea
Commit
c11aacea
authored
Sep 02, 2011
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 682822: Hide 'obsolete attachments' section when there are none to display
r=LpSolit, a=LpSolit
parent
7a9a4fdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
45 deletions
+52
-45
attachment.cgi
attachment.cgi
+41
-30
create.html.tmpl
template/en/default/attachment/create.html.tmpl
+11
-15
No files found.
attachment.cgi
View file @
c11aacea
...
...
@@ -474,40 +474,51 @@ sub viewall {
# Display a form for entering a new attachment.
sub
enter
{
# Retrieve and validate parameters
my
$bug
=
Bugzilla::
Bug
->
check
(
scalar
$cgi
->
param
(
'bugid'
));
my
$bugid
=
$bug
->
id
;
Bugzilla::
Attachment
->
_check_bug
(
$bug
);
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
# Retrieve the attachments the user can edit from the database and write
# them into an array of hashes where each hash represents one attachment.
my
$canEdit
=
""
;
if
(
!
$user
->
in_group
(
'editbugs'
,
$bug
->
product_id
))
{
$canEdit
=
"AND submitter_id = "
.
$user
->
id
;
}
my
$attach_ids
=
$dbh
->
selectcol_arrayref
(
"SELECT attach_id FROM attachments
WHERE bug_id = ? AND isobsolete = 0 $canEdit
ORDER BY attach_id"
,
undef
,
$bugid
);
# Retrieve and validate parameters
my
$bug
=
Bugzilla::
Bug
->
check
(
scalar
$cgi
->
param
(
'bugid'
));
my
$bugid
=
$bug
->
id
;
Bugzilla::
Attachment
->
_check_bug
(
$bug
);
my
$dbh
=
Bugzilla
->
dbh
;
my
$user
=
Bugzilla
->
user
;
# Define the variables and functions that will be passed to the UI template.
$vars
->
{
'bug'
}
=
$bug
;
$vars
->
{
'attachments'
}
=
Bugzilla::
Attachment
->
new_from_list
(
$attach_ids
);
# Retrieve the attachments the user can edit from the database and write
# them into an array of hashes where each hash represents one attachment.
my
(
$can_edit
,
$not_private
)
=
(
''
,
''
);
if
(
!
$user
->
in_group
(
'editbugs'
,
$bug
->
product_id
))
{
$can_edit
=
"AND submitter_id = "
.
$user
->
id
;
}
if
(
!
$user
->
is_insider
)
{
$not_private
=
"AND isprivate = 0"
;
}
my
$attach_ids
=
$dbh
->
selectcol_arrayref
(
"SELECT attach_id
FROM attachments
WHERE bug_id = ?
AND isobsolete = 0
$can_edit $not_private
ORDER BY attach_id"
,
undef
,
$bugid
);
my
$flag_types
=
Bugzilla::FlagType::
match
({
'target_type'
=>
'attachment'
,
'product_id'
=>
$bug
->
product_id
,
'component_id'
=>
$bug
->
component_id
});
$vars
->
{
'flag_types'
}
=
$flag_types
;
$vars
->
{
'any_flags_requesteeble'
}
=
grep
{
$_
->
is_requestable
&&
$_
->
is_requesteeble
}
@$flag_types
;
$vars
->
{
'token'
}
=
issue_session_token
(
'create_attachment:'
);
# Define the variables and functions that will be passed to the UI template.
$vars
->
{
'bug'
}
=
$bug
;
$vars
->
{
'attachments'
}
=
Bugzilla::
Attachment
->
new_from_list
(
$attach_ids
);
my
$flag_types
=
Bugzilla::FlagType::
match
({
'target_type'
=>
'attachment'
,
'product_id'
=>
$bug
->
product_id
,
'component_id'
=>
$bug
->
component_id
});
$vars
->
{
'flag_types'
}
=
$flag_types
;
$vars
->
{
'any_flags_requesteeble'
}
=
grep
{
$_
->
is_requestable
&&
$_
->
is_requesteeble
}
@$flag_types
;
$vars
->
{
'token'
}
=
issue_session_token
(
'create_attachment:'
);
print
$cgi
->
header
();
print
$cgi
->
header
();
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
"attachment/create.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
"attachment/create.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
}
# Insert a new attachment into the database.
...
...
template/en/default/attachment/create.html.tmpl
View file @
c11aacea
...
...
@@ -56,23 +56,19 @@ TUI_hide_default('attachment_text_field');
[% PROCESS attachment/createformcontents.html.tmpl %]
[%# Additional fields for attachments on existing bugs: %]
<tr>
<t
h>Obsoletes:</th
>
<td
>
<
em>(optional) Check each existing attachment made obsolete by your new attachment.</em><br
>
[% IF attachments.size %]
[% IF attachments.size %]
<t
r
>
<th>Obsoletes:</th
>
<
td
>
<em>(optional) Check each existing attachment made obsolete by your new attachment.</em><br>
[% FOREACH attachment = attachments %]
[% IF ((attachment.isprivate == 0) || user.is_insider) %]
<input type="checkbox" id="[% attachment.id %]"
name="obsolete" value="[% attachment.id %]">
<a href="attachment.cgi?id=[% attachment.id %]&action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
[% END %]
<input type="checkbox" id="[% attachment.id %]"
name="obsolete" value="[% attachment.id %]">
<a href="attachment.cgi?id=[% attachment.id %]&action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
[% END %]
[% ELSE %]
[no attachments can be made obsolete]
[% END %]
</td>
</tr>
</td>
</tr>
[% END %]
[% IF (user.id != bug.assigned_to.id) AND user.in_group("editbugs", bug.product_id) %]
<tr>
...
...
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