1 |
<?php |
2 |
/** |
3 |
* HTML rendering box. |
4 |
* |
5 |
* PHP version 5 |
6 |
* |
7 |
* @category Dashboard |
8 |
* @package Buildsystem |
9 |
* @author Romain d'Alverny <rda@mageia.org> |
10 |
* @license MIT License, see LICENSE.txt |
11 |
* @link http://svnweb.mageia.org/svn/soft/dashboard/ |
12 |
*/ |
13 |
|
14 |
/** |
15 |
*/ |
16 |
class Report_HTML |
17 |
{ |
18 |
/** |
19 |
* |
20 |
*/ |
21 |
function render($r) |
22 |
{ |
23 |
$ret = ''; |
24 |
$working = ''; |
25 |
foreach ($r as $r1) { |
26 |
$lis = ''; |
27 |
foreach ($r1['values'] as $v) |
28 |
$lis .= sprintf('<li class="%s">%s</li>', $v['c'], $v['t']); |
29 |
|
30 |
if ($r1['status'] >= 1) |
31 |
$status = '<span class="ok">OK</span>'; |
32 |
elseif ($r1['status'] > 0.7) |
33 |
$status = '<span class="good">GOOD</span>'; |
34 |
elseif ($r1['status'] < 0.5) |
35 |
$status = '<span class="failed">NOT READY</span>'; |
36 |
|
37 |
$links = $r1['links']; |
38 |
$ret .= <<<S |
39 |
<li class="{$working}"><h3>{$r1['title']}</h3> |
40 |
<p>Status: {$status}</p> |
41 |
<ul>{$lis}</ul> |
42 |
<p>{$links}</p> |
43 |
</li> |
44 |
S; |
45 |
$pubDate = date('r'); |
46 |
} |
47 |
$s = <<<S |
48 |
<!DOCTYPE html> |
49 |
<html lang="en"> |
50 |
<head> |
51 |
<meta charset="utf-8"> |
52 |
<meta name="robots" content="noindex,nosnippet,nocache,nofollow"> |
53 |
<title>Mageia buildsystem status overview</title> |
54 |
<style> |
55 |
body { font-size: 80%; font-family: Helvetica; background: #aaa; } |
56 |
a:link, a:visited { color: #2383C2; text-decoration: none; } |
57 |
.clear, hr { clear: both; } |
58 |
ul.boxes { margin: 0; padding: 0; /*width: 1800px;*/ } |
59 |
ul.boxes > li { padding-bottom: 2em; } |
60 |
ul.boxes > li { |
61 |
background: #fff; |
62 |
position: relative; |
63 |
list-style: none; |
64 |
display: block; |
65 |
float: left; |
66 |
padding: 0 1em 2em 1em; |
67 |
max-width: 600px; |
68 |
z-index: 1; |
69 |
margin: 12px; |
70 |
-webkit-box-shadow: 0 2px 6px #444; |
71 |
-webkit-border-radius: 6px; |
72 |
-moz-box-shadow: 0 2px 6px #444; |
73 |
-moz-border-radius: 6px; |
74 |
box-shadow: 0 2px 6px #444; |
75 |
border-radius: 6px; |
76 |
} |
77 |
ul.boxes > li:after { |
78 |
content: "\\02192"; |
79 |
display: block; |
80 |
position: absolute; |
81 |
top: 0px; |
82 |
right: -16px; |
83 |
font-size: 200%; |
84 |
font-weight: bold; |
85 |
background: #fff; |
86 |
z-index: 5; |
87 |
background: -webkit-gradient(linear, left top, right top, from(#fff), to(#aaa)); |
88 |
background: -moz-gradient(linear, left top, right top, from(#fff), to(#aaa)); |
89 |
background: gradient(linear, left top, right top, from(#fff), to(#aaa)); |
90 |
|
91 |
} |
92 |
ul.boxes > li:last-child:after { |
93 |
content: ""; |
94 |
} |
95 |
ul.boxes h3 { } |
96 |
.light { font-weight: normal; } |
97 |
ul.boxes li ul { padding-left: 1.5em; } |
98 |
li.warn { color: red; list-style-type: disc; } |
99 |
.todo { font-style: italic; color: #bbb; } |
100 |
.todo:before { content: "(";} |
101 |
.todo:after { content: ")";} |
102 |
.info { color: #222; } |
103 |
.unk, .unk a { color: #aaa; text-decoration: none; } |
104 |
.warning { color: orange; list-style-type: disc; } |
105 |
.error, .failed { color: red; list-style-type: disc; } |
106 |
.ok { color: green; } |
107 |
.isobuild td, |
108 |
.isobuild th { vertical-align: top; } |
109 |
td.build-id { text-align: right; } |
110 |
div.dnotes { color: #666; border: 1px solid #666; padding: 0.6em; font-size: 90%; } |
111 |
div.dnotes:before { content: "Design Notes"; color: #666; font-weight: bold; text-decoration: underline; } |
112 |
#warnhead { color: #fff; background: #f00; font-weight: bold; margin: 0; padding: 0.4em 0.6em; font-size: 90%; } |
113 |
</style> |
114 |
</head> |
115 |
<body> |
116 |
<p id="warnhead">Public information – Work in progress – Take with a grain of salt</p> |
117 |
<h1>Mageia dashboard draft</h1> |
118 |
<ul class="boxes">{$ret}</ul> |
119 |
<hr> |
120 |
<p>Last updated: {$pubDate}</p> |
121 |
<hr> |
122 |
<div class="dnotes"> |
123 |
<ul> |
124 |
<li>Light gray values are unchecked for now; coming soon!</li> |
125 |
<li><strong>ISO Build block is still a mockup, doesn't work for now!</strong></li> |
126 |
<li>code is in <a href="http://svnweb.mageia.org/soft/dashboard/">svnweb.mageia.org/soft/dashboard</a>; |
127 |
to get a copy of the code: <pre>$ svn checkout svn://svn.mageia.org/svn/soft/dashboard</pre> |
128 |
patches or an even better dashboard option are welcome!</li> |
129 |
</ul> |
130 |
</div> |
131 |
</body> |
132 |
</html> |
133 |
S; |
134 |
return $s; |
135 |
} |
136 |
} |