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
8a17e45f
Commit
8a17e45f
authored
Aug 12, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 746947: Determine the size of the images dynamically for graphical reports
r=dkl a=LpSolit
parent
a05220de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
72 deletions
+64
-72
report.cgi
report.cgi
+13
-16
IE-fixes.css
skins/standard/IE-fixes.css
+4
-0
reports.css
skins/standard/reports.css
+25
-0
report.html.tmpl
template/en/default/reports/report.html.tmpl
+22
-56
No files found.
report.cgi
View file @
8a17e45f
...
...
@@ -103,20 +103,18 @@ if (!($col_field || $row_field || $tbl_field)) {
ThrowUserError
(
"no_axes_defined"
);
}
my
$width
=
$cgi
->
param
(
'width'
);
my
$height
=
$cgi
->
param
(
'height'
);
# There is no UI for these parameters anymore,
# but they are still here just in case.
my
$width
=
$cgi
->
param
(
'width'
)
||
1024
;
my
$height
=
$cgi
->
param
(
'height'
)
||
600
;
if
(
defined
(
$width
))
{
(
detaint_natural
(
$width
)
&&
$width
>
0
)
||
ThrowCodeError
(
"invalid_dimensions"
);
$width
<=
2000
||
ThrowUserError
(
"chart_too_large"
);
}
(
detaint_natural
(
$width
)
&&
$width
>
0
)
||
ThrowCodeError
(
"invalid_dimensions"
);
$width
<=
2000
||
ThrowUserError
(
"chart_too_large"
);
if
(
defined
(
$height
))
{
(
detaint_natural
(
$height
)
&&
$height
>
0
)
||
ThrowCodeError
(
"invalid_dimensions"
);
$height
<=
2000
||
ThrowUserError
(
"chart_too_large"
);
}
(
detaint_natural
(
$height
)
&&
$height
>
0
)
||
ThrowCodeError
(
"invalid_dimensions"
);
$height
<=
2000
||
ThrowUserError
(
"chart_too_large"
);
# These shenanigans are necessary to make sure that both vertical and
# horizontal 1D tables convert to the correct dimension when you ask to
...
...
@@ -244,7 +242,7 @@ $vars->{'row_names'} = \@row_names;
$vars
->
{
'tbl_names'
}
=
\
@tbl_names
;
# Below a certain width, we don't see any bars, so there needs to be a minimum.
if
(
$
width
&&
$
cgi
->
param
(
'format'
)
eq
"bar"
)
{
if
(
$cgi
->
param
(
'format'
)
eq
"bar"
)
{
my
$min_width
=
(
scalar
(
@col_names
)
||
1
)
*
20
;
if
(
!
$cgi
->
param
(
'cumulate'
))
{
...
...
@@ -254,9 +252,8 @@ if ($width && $cgi->param('format') eq "bar") {
$vars
->
{
'min_width'
}
=
$min_width
;
}
$vars
->
{
'width'
}
=
$width
if
$width
;
$vars
->
{
'height'
}
=
$height
if
$height
;
$vars
->
{
'width'
}
=
$width
;
$vars
->
{
'height'
}
=
$height
;
$vars
->
{
'query'
}
=
$query
;
$vars
->
{
'saved_report_id'
}
=
$cgi
->
param
(
'saved_report_id'
);
$vars
->
{
'debug'
}
=
$cgi
->
param
(
'debug'
);
...
...
skins/standard/IE-fixes.css
View file @
8a17e45f
...
...
@@ -52,3 +52,7 @@ form#Create #comp_desc {
/* color:inherit */
color
:
expression
(
this
.
parentNode
.
currentStyle
[
'color'
]);
}
#graphical_report
{
width
:
auto
\
9
;
/* IE6-8 */
}
skins/standard/reports.css
View file @
8a17e45f
...
...
@@ -77,3 +77,28 @@
padding-bottom
:
.5em
;
color
:
#333
;
}
.t1
{
background-color
:
#ffffff
;
/* white */
}
.t2
{
background-color
:
#dfefff
;
/* light blue */
}
.t3
{
background-color
:
#dddddd
;
/* grey */
}
.t4
{
background-color
:
#c3d3ed
;
/* darker blue */
}
.ttotal
,
.ttotal
td
{
background-color
:
#cfffdf
;
/* light green */
}
#graphical_report
{
max-width
:
100%
;
height
:
auto
;
}
template/en/default/reports/report.html.tmpl
View file @
8a17e45f
...
...
@@ -21,8 +21,8 @@
# cumulate: boolean. For bar/line charts, whether to cumulate data sets.
#%]
[% DEFAULT width =
600
height =
350
[% DEFAULT width =
1024
height =
600
%]
[% IF min_width AND width < min_width %]
...
...
@@ -55,14 +55,8 @@
[% time = time FILTER time('%Y-%m-%d %H:%M:%S') FILTER html %]
[% PROCESS global/header.html.tmpl
style = "
.t1 { background-color: #ffffff } /* white */
.t2 { background-color: #dfefff } /* light blue */
.t3 { background-color: #dddddd } /* grey */
.t4 { background-color: #c3d3ed } /* darker blue */
.ttotal, .ttotal td { background-color: #cfffdf } /* light green */
"
header_addl_info = time
style_urls = ['skins/standard/reports.css']
yui = ['datatable']
%]
...
...
@@ -98,57 +92,29 @@
[% END %]
[% END %]
[% END %]
[% END %]width=[% width %]&height=[% height %]
[% END %]width=[% width %]&height=[% height %]
[% END %]
<img alt="Graphical report results" src="[% imageurl %]"
width="[% width %]" height="[% height %]">
<img id="graphical_report" alt="Graphical report results" src="[% imageurl %]">
[% END %]
<br>
[% END %]
<table>
<tr>
<td>
[% formats = [ { name => "pie", description => "Pie" },
{ name => "bar", description => "Bar" },
{ name => "line", description => "Line" },
{ name => "table", description => "Table" } ] %]
[% formaturl = "report.cgi?$switchbase&width=$width" _
"&height=$height&action=wrap" %]
[% FOREACH other_format = formats %]
[% NEXT IF other_format.name == "pie" AND row_field AND col_field %]
[% UNLESS other_format.name == format %]
<a href="[% formaturl %]&format=[% other_format.name %]">
[% END %]
[% other_format.description FILTER html %]
[% "</a>" UNLESS other_format.name == format %] |
[% END %]
<a href="[% formaturl %]&ctype=csv&format=table">CSV</a>
</td>
[% IF format != "table" %]
<td>
</td>
[% sizeurl = BLOCK %]report.cgi?
[% switchbase %]&action=wrap&format=
[% format FILTER html %][% END %]
<td align="center">
<a href="[% sizeurl %]&width=[% width %]&height=
[% height + 100 %]">Taller</a><br>
<a href="[% sizeurl %]&width=[% width - 100 %]&height=
[% height %]">Thinner</a> *
<a href="[% sizeurl %]&width=[% width + 100 %]&height=
[% height %]">Fatter</a> <br>
<a href="[% sizeurl %]&width=[% width %]&height=
[% height - 100 %]">Shorter</a><br>
</td>
[% END %]
</tr>
</table>
[% formats = [ { name => "pie", description => "Pie" },
{ name => "bar", description => "Bar" },
{ name => "line", description => "Line" },
{ name => "table", description => "Table" } ] %]
[% formaturl = "report.cgi?$switchbase&width=$width&height=$height&action=wrap" %]
[% FOREACH other_format = formats %]
[% NEXT IF other_format.name == "pie" AND row_field AND col_field %]
[% UNLESS other_format.name == format %]
<a href="[% formaturl %]&format=[% other_format.name %]">
[% END %]
[% other_format.description FILTER html %]
[% "</a>" UNLESS other_format.name == format %] |
[% END %]
<a href="[% formaturl %]&ctype=csv&format=table">CSV</a>
<table>
<tr>
...
...
@@ -161,7 +127,7 @@
Edit this report</a>
[% END %]
</td>
<td>
</td>
<td>
|
</td>
<td>
[% IF saved_report_id %]
<a href="report.cgi?action=del&saved_report_id=[% saved_report_id FILTER uri %]&token=
...
...
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