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
5b77afda
Commit
5b77afda
authored
Oct 13, 2010
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 595682: Always generate PNG images for charts
a=LpSolit
parent
4442dd8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
33 deletions
+15
-33
reports.cgi
reports.cgi
+15
-33
No files found.
reports.cgi
View file @
5b77afda
...
...
@@ -18,22 +18,15 @@
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Harrison Page <harrison@netscape.com>,
# Terry Weissman <terry@mozilla.org>,
# Dawn Endico <endico@mozilla.org>
# Bryce Nesbitt <bryce@nextbus.COM>,
# Joe Robins <jmrobins@tgix.com>,
# Gervase Markham <gerv@gerv.net> and Adam Spiers <adam@spiers.net>
# Added ability to chart any combination of resolutions/statuses.
# Derive the choice of resolutions/statuses from the -All- data file
# Removed hardcoded order of resolutions/statuses when reading from
# daily stats file, so now works independently of collectstats.pl
# version
# Added image caching by date and datasets
# Myk Melez <myk@mozilla.org>:
# Implemented form field validation and reorganized code.
# Frédéric Buclin <LpSolit@gmail.com>:
# Templatization.
# Contributor(s): Harrison Page <harrison@netscape.com>
# Terry Weissman <terry@mozilla.org>
# Dawn Endico <endico@mozilla.org>
# Bryce Nesbitt <bryce@nextbus.com>
# Joe Robins <jmrobins@tgix.com>
# Gervase Markham <gerv@gerv.net>
# Adam Spiers <adam@spiers.net>
# Myk Melez <myk@mozilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
use
strict
;
...
...
@@ -113,14 +106,12 @@ else {
my
$datasets
=
join
(
''
,
$cgi
->
param
(
'datasets'
));
my
$type
=
chart_image_type
();
my
$data_file
=
daily_stats_filename
(
$product
);
my
$image_file
=
chart_image_name
(
$data_file
,
$
type
,
$
datasets
);
my
$image_file
=
chart_image_name
(
$data_file
,
$datasets
);
my
$url_image
=
correct_urlbase
()
.
"$graph_url/$image_file"
;
if
(
!
-
e
"$graph_dir/$image_file"
)
{
generate_chart
(
"$dir/$data_file"
,
"$graph_dir/$image_file"
,
$type
,
$product
,
$datasets
);
generate_chart
(
"$dir/$data_file"
,
"$graph_dir/$image_file"
,
$product
,
$datasets
);
}
$vars
->
{
'url_image'
}
=
$url_image
;
...
...
@@ -160,17 +151,8 @@ sub daily_stats_filename {
return
$prodname
;
}
sub
chart_image_type
{
# what chart type should we be generating?
my
$testimg
=
Chart::
Lines
->
new
(
2
,
2
);
my
$type
=
$testimg
->
can
(
'gif'
)
?
"gif"
:
"png"
;
undef
$testimg
;
return
$type
;
}
sub
chart_image_name
{
my
(
$data_file
,
$
type
,
$
datasets
)
=
@_
;
my
(
$data_file
,
$datasets
)
=
@_
;
# This routine generates a filename from the requested fields. The problem
# is that we have to check the safety of doing this. We can't just require
...
...
@@ -190,11 +172,11 @@ sub chart_image_name {
# show. Charts should be deleted by collectstats.pl nightly.
my
$id
=
join
(
"_"
,
split
(
":"
,
$datasets
));
return
"${data_file}_${id}.
$type
"
;
return
"${data_file}_${id}.
png
"
;
}
sub
generate_chart
{
my
(
$data_file
,
$image_file
,
$
type
,
$
product
,
$datasets
)
=
@_
;
my
(
$data_file
,
$image_file
,
$product
,
$datasets
)
=
@_
;
if
(
!
open
FILE
,
$data_file
)
{
if
(
$product
eq
'-All-'
)
{
...
...
@@ -279,5 +261,5 @@ sub generate_chart {
);
$img
->
set
(
%
settings
);
$img
->
$type
(
$image_file
,
[
@data
{(
'DATE'
,
@labels
)}
]);
$img
->
png
(
$image_file
,
[
@data
{(
'DATE'
,
@labels
)}
]);
}
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