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
21b50cba
Commit
21b50cba
authored
Jan 02, 2013
by
Gervase Markham
Committed by
Gervase Markham
Jan 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 413851 - add CSV output option to request lists. r=LpSolit.
parent
db29480b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
31 deletions
+99
-31
CGI.pm
Bugzilla/CGI.pm
+25
-0
buglist.cgi
buglist.cgi
+11
-20
report.cgi
report.cgi
+2
-5
request.cgi
request.cgi
+11
-4
queue.csv.tmpl
template/en/default/request/queue.csv.tmpl
+46
-0
queue.html.tmpl
template/en/default/request/queue.html.tmpl
+4
-2
No files found.
Bugzilla/CGI.pm
View file @
21b50cba
...
...
@@ -281,6 +281,10 @@ sub header {
unshift
(
@_
,
'-type'
=>
shift
(
@_
));
}
if
(
$self
->
{
'_content_disp'
})
{
unshift
(
@_
,
'-content_disposition'
=>
$self
->
{
'_content_disp'
});
}
# Add the cookies in if we have any
if
(
scalar
(
@
{
$self
->
{
Bugzilla_cookie_list
}}))
{
unshift
(
@_
,
'-cookie'
=>
$self
->
{
Bugzilla_cookie_list
});
...
...
@@ -528,6 +532,22 @@ sub url_is_attachment_base {
return
(
$self
->
self_url
=~
$regex
)
?
1
:
0
;
}
sub
set_dated_content_disp
{
my
(
$self
,
$type
,
$prefix
,
$ext
)
=
@_
;
my
@time
=
localtime
(
time
());
my
$date
=
sprintf
"%04d-%02d-%02d"
,
1900
+
$time
[
5
],
$time
[
4
]
+
1
,
$time
[
3
];
my
$filename
=
"$prefix-$date.$ext"
;
$filename
=~
s/\s/_/g
;
# Remove whitespace to avoid HTTP header tampering
$filename
=~
s/\\/_/g
;
# Remove backslashes as well
$filename
=~
s/"/\\"/g
;
# escape quotes
my
$disposition
=
"$type; filename=\"$filename\""
;
$self
->
{
'_content_disp'
}
=
$disposition
;
}
##########################
# Vars TIEHASH Interface #
##########################
...
...
@@ -635,6 +655,11 @@ instead of calling this directly.
Redirects from the current URL to one prefixed by the urlbase parameter.
=item C<set_dated_content_disp>
Sets an appropriate date-dependent value for the Content Disposition header
for a downloadable resource.
=back
=head1 SEE ALSO
...
...
buglist.cgi
View file @
21b50cba
...
...
@@ -281,18 +281,17 @@ sub GetGroups {
}
sub
_close_standby_message
{
my
(
$contenttype
,
$disp
osit
ion
,
$serverpush
)
=
@_
;
my
(
$contenttype
,
$disp
,
$disp_prefix
,
$extens
ion
,
$serverpush
)
=
@_
;
my
$cgi
=
Bugzilla
->
cgi
;
$cgi
->
set_dated_content_disp
(
$disp
,
$disp_prefix
,
$extension
);
# Close the "please wait" page, then open the buglist page
if
(
$serverpush
)
{
print
$cgi
->
multipart_end
();
print
$cgi
->
multipart_start
(
-
type
=>
$contenttype
,
-
content_disposition
=>
$disposition
);
print
$cgi
->
multipart_start
(
-
type
=>
$contenttype
);
}
else
{
print
$cgi
->
header
(
-
type
=>
$contenttype
,
-
content_disposition
=>
$disposition
);
print
$cgi
->
header
(
$contenttype
);
}
}
...
...
@@ -324,17 +323,10 @@ $params ||= new Bugzilla::CGI($cgi);
# if available. We have to do this now, even though we return HTTP headers
# at the end, because the fact that there is a remembered query gets
# forgotten in the process of retrieving it.
my
@time
=
localtime
(
time
());
my
$date
=
sprintf
"%04d-%02d-%02d"
,
1900
+
$time
[
5
],
$time
[
4
]
+
1
,
$time
[
3
];
my
$filename
=
"bugs-$date.$format->{extension}"
;
my
$disp_prefix
=
"bugs"
;
if
(
$cmdtype
eq
"dorem"
&&
$remaction
=~
/^run/
)
{
$filename
=
$cgi
->
param
(
'namedcmd'
)
.
"-$date.$format->{extension}"
;
# Remove white-space from the filename so the user cannot tamper
# with the HTTP headers.
$filename
=~
s/\s/_/g
;
$disp_prefix
=
$cgi
->
param
(
'namedcmd'
);
}
$filename
=~
s/\\/\\\\/g
;
# escape backslashes
$filename
=~
s/"/\\"/g
;
# escape quotes
# Take appropriate action based on user's request.
if
(
$cmdtype
eq
"dorem"
)
{
...
...
@@ -935,7 +927,8 @@ if ($one_product && $user->can_enter_product($one_product)) {
# The following variables are used when the user is making changes to multiple bugs.
if
(
$dotweak
&&
scalar
@bugs
)
{
if
(
!
$vars
->
{
'caneditbugs'
})
{
_close_standby_message
(
'text/html'
,
'inline'
,
$serverpush
);
_close_standby_message
(
'text/html'
,
'inline'
,
"error"
,
"html"
,
$serverpush
);
ThrowUserError
(
'auth_failure'
,
{
group
=>
'editbugs'
,
action
=>
'modify'
,
object
=>
'multiple_bugs'
});
...
...
@@ -1042,10 +1035,8 @@ if ($format->{'extension'} eq "csv") {
$vars
->
{
'human'
}
=
$cgi
->
param
(
'human'
);
}
# Suggest a name for the bug list if the user wants to save it as a file.
$disposition
.=
"; filename=\"$filename\""
;
_close_standby_message
(
$contenttype
,
$disposition
,
$serverpush
);
_close_standby_message
(
$contenttype
,
$disposition
,
$disp_prefix
,
$format
->
{
'extension'
},
$serverpush
);
################################################################################
# Content Generation
...
...
report.cgi
View file @
21b50cba
...
...
@@ -309,11 +309,8 @@ my $format = $template->get_format("reports/report", $formatparam,
# set debug=1 to always get an HTML content-type, and view the error.
$format
->
{
'ctype'
}
=
"text/html"
if
$cgi
->
param
(
'debug'
);
my
@time
=
localtime
(
time
());
my
$date
=
sprintf
"%04d-%02d-%02d"
,
1900
+
$time
[
5
],
$time
[
4
]
+
1
,
$time
[
3
];
my
$filename
=
"report-$date.$format->{extension}"
;
print
$cgi
->
header
(
-
type
=>
$format
->
{
'ctype'
},
-
content_disposition
=>
"inline; filename=$filename"
);
$cgi
->
set_dated_content_disp
(
"inline"
,
"report"
,
$format
->
{
extension
});
print
$cgi
->
header
(
$format
->
{
'ctype'
});
# Problems with this CGI are often due to malformed data. Setting debug=1
# prints out both data structures.
...
...
request.cgi
View file @
21b50cba
...
...
@@ -26,8 +26,12 @@ my $cgi = Bugzilla->cgi;
Bugzilla
->
switch_to_shadow_db
;
my
$template
=
Bugzilla
->
template
;
my
$action
=
$cgi
->
param
(
'action'
)
||
''
;
my
$format
=
$template
->
get_format
(
'request/queue'
,
scalar
(
$cgi
->
param
(
'format'
)),
scalar
(
$cgi
->
param
(
'ctype'
)));
print
$cgi
->
header
();
$cgi
->
set_dated_content_disp
(
"inline"
,
"requests"
,
$format
->
{
extension
});
print
$cgi
->
header
(
$format
->
{
'ctype'
});
my
$fields
;
$fields
->
{
'requester'
}
->
{
'type'
}
=
'single'
;
...
...
@@ -42,7 +46,7 @@ unless (defined $cgi->param('requestee')
Bugzilla::User::
match_field
(
$fields
);
if
(
$action
eq
'queue'
)
{
queue
();
queue
(
$format
);
}
else
{
my
$flagtypes
=
get_flag_types
();
...
...
@@ -60,7 +64,7 @@ else {
}
$vars
->
{
'components'
}
=
[
sort
{
$a
cmp
$b
}
keys
%
components
];
$template
->
process
(
'request/queue.html.tmpl'
,
$vars
)
$template
->
process
(
$format
->
{
'template'
}
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
}
exit
;
...
...
@@ -70,6 +74,7 @@ exit;
################################################################################
sub
queue
{
my
$format
=
shift
;
my
$cgi
=
Bugzilla
->
cgi
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$template
=
Bugzilla
->
template
;
...
...
@@ -295,8 +300,10 @@ sub queue {
}
$vars
->
{
'components'
}
=
[
sort
{
$a
cmp
$b
}
keys
%
components
];
$vars
->
{
'urlquerypart'
}
=
$cgi
->
canonicalise_query
(
'ctype'
);
# Generate and return the UI (HTML page) from the appropriate template.
$template
->
process
(
"request/queue.html.tmpl"
,
$vars
)
$template
->
process
(
$format
->
{
'template'
}
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
}
...
...
template/en/default/request/queue.csv.tmpl
0 → 100644
View file @
21b50cba
[%# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0. #%]
[% PROCESS "global/field-descs.none.tmpl" %]
[% column_headers = {
"type" => "Flag",
"status" => field_descs.bug_status,
"bug_summary" => field_descs.short_desc,
"bug_id" => field_descs.bug_id,
"attach_summary" => "Attachment Description",
"attach_id" => "Attachment ID",
"requester" => "Requester",
"requestee" => "Requestee",
"created" => "Created",
"category" => field_descs.product _ ": " _ field_descs.component,
} %]
[% display_columns = ["requester", "requestee", "type", "status",
"bug_id", "bug_summary", "attach_id",
"attach_summary", "created", "category"] %]
[% IF requests.size == 0 %]
No requests.
[% ELSE %]
[% FOREACH column = display_columns %]
[% column_headers.$column FILTER csv %][% ',' IF NOT loop.last() %]
[% END %]
[% FOREACH request = requests %]
[% FOREACH column = display_columns %]
[% IF column == 'created' %]
[% request.$column FILTER time FILTER csv %]
[% ELSIF column.match('^requeste') %]
[% request.$column FILTER email FILTER csv %]
[% ELSE %]
[% request.$column FILTER csv %]
[% END %][% ',' IF NOT loop.last() %]
[% END %]
[% END %]
[% END %]
template/en/default/request/queue.html.tmpl
View file @
21b50cba
...
...
@@ -207,6 +207,8 @@ to some group are shown by default.
</tr>
[% END %]
[% PROCESS display_buglist %]
<br><br>
<a href="request.cgi?[% urlquerypart FILTER html %]&ctype=csv">View entire list as CSV</a>
[% END %]
[% PROCESS global/footer.html.tmpl %]
...
...
@@ -264,6 +266,6 @@ to some group are shown by default.
</table>
[% NEXT UNLESS buglist.keys.size %]
<a href="buglist.cgi?bug_id=
[%- buglist.keys.nsort.join(",") FILTER html %]">
(v
iew as
[%+ terms.bug %] list
)
</a>
[%- buglist.keys.nsort.join(",") FILTER html %]">
V
iew as
[%+ terms.bug %] list</a>
[% END %]
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