summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-sysadm/2011-January/002045.html
blob: 15caa9226e99ba1940050a9c2379cd036516957b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Mageia-sysadm] [292] properly handle empty queue; remove feedback labels; try a &quot;score&quot;  for this list of packages
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B292%5D%20properly%20handle%20empty%20queue%3B%0A%20remove%20feedback%20labels%3B%20try%20a%20%22score%22%20%20for%20this%20list%20of%20packages&In-Reply-To=%3C20110113171301.8C70B42368%40valstar.mageia.org%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="002044.html">
   <LINK REL="Next"  HREF="002046.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Mageia-sysadm] [292] properly handle empty queue; remove feedback labels; try a &quot;score&quot;  for this list of packages</H1>
    <B>root at mageia.org</B> 
    <A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B292%5D%20properly%20handle%20empty%20queue%3B%0A%20remove%20feedback%20labels%3B%20try%20a%20%22score%22%20%20for%20this%20list%20of%20packages&In-Reply-To=%3C20110113171301.8C70B42368%40valstar.mageia.org%3E"
       TITLE="[Mageia-sysadm] [292] properly handle empty queue; remove feedback labels; try a &quot;score&quot;  for this list of packages">root at mageia.org
       </A><BR>
    <I>Thu Jan 13 18:13:01 CET 2011</I>
    <P><UL>
        <LI>Previous message: <A HREF="002044.html">[Mageia-sysadm] Puppet Report for rabbit.mageia.org
</A></li>
        <LI>Next message: <A HREF="002046.html">[Mageia-sysadm] [293] adjust score style
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#2045">[ date ]</a>
              <a href="thread.html#2045">[ thread ]</a>
              <a href="subject.html#2045">[ subject ]</a>
              <a href="author.html#2045">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Revision: 292
Author:   rda
Date:     2011-01-13 18:13:01 +0100 (Thu, 13 Jan 2011)
Log Message:
-----------
properly handle empty queue; remove feedback labels; try a &quot;score&quot; for this list of packages

Modified Paths:
--------------
    build_system/web/index.php

Modified: build_system/web/index.php
===================================================================
--- build_system/web/index.php	2011-01-13 15:54:31 UTC (rev 291)
+++ build_system/web/index.php	2011-01-13 17:13:01 UTC (rev 292)
@@ -21,6 +21,7 @@
     $robots = 'no' . $robots;
 }
 $tz = new DateTimeZone('UTC');
+$date_gen = date('c');
 
 # Temporary until initial mirror is ready
 chdir(&quot;data&quot;);
@@ -169,6 +170,9 @@
     tr.youri td.status-box { background: olive; }
     
     #stats { float: right; }
+    #score {}
+    #score-box { width: 200px; height: 100px; background: #faa; }
+    #score-meter { width: 200px; background: #afa; }
     &lt;/style&gt;
 &lt;/head&gt;
 &lt;body&gt;
@@ -189,9 +193,6 @@
 );
 
 #########################################
-echo '&lt;table&gt;',
-    '&lt;caption&gt;Packages submitted in the past ', $max_modified * 24, '&amp;nbsp;hours.&lt;/caption&gt;',
-    '&lt;tr&gt;&lt;th&gt;Submitted&lt;/th&gt;&lt;th&gt;User&lt;/th&gt;&lt;th&gt;Package&lt;/th&gt;&lt;th&gt;Target&lt;/th&gt;&lt;th&gt;Media&lt;/th&gt;&lt;th colspan=&quot;2&quot;&gt;Status&lt;/th&gt;&lt;/tr&gt;';
 
 $s = '';
 $tmpl = &lt;&lt;&lt;T
@@ -225,47 +226,67 @@
     'built'    =&gt; ''
 );
 
-foreach ($pkgs as $key =&gt; $p) {
-    $p['type'] = pkg_gettype($p);
+if ($total &gt; 0) {
+    foreach ($pkgs as $key =&gt; $p) {
+        $p['type'] = pkg_gettype($p);
 
-    $stats[$p['type']] += 1;
-    $s .= sprintf($tmpl,
-        $p['type'],
-        key2date($key),
-        $p['user'], $p['user'],
-        $p['package'],
-        $p['version'],
-        $p['media'], $p['section']
-    );
+        $stats[$p['type']] += 1;
+        $s .= sprintf($tmpl,
+            $p['type'],
+            key2date($key),
+            $p['user'], $p['user'],
+            $p['package'],
+            $p['version'],
+            $p['media'], $p['section']
+        );
     
-    $typelink = '';
-    if ($p['type'] == 'failure') {
-       $typelink = '/uploads/' . $p['type'] . '/' . $p['path'];
-    } elseif ($p['type'] == 'rejected') {
-       $typelink = '/uploads/' . $p['type'] . '/' . $p['path'] . '.youri';
+        $typelink = '';
+        if ($p['type'] == 'failure') {
+           $typelink = '/uploads/' . $p['type'] . '/' . $p['path'];
+        } elseif ($p['type'] == 'rejected') {
+           $typelink = '/uploads/' . $p['type'] . '/' . $p['path'] . '.youri';
+        }
+
+        $s .= '&lt;td&gt;';
+        $s .= ($typelink != '') ?
+            sprintf('&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;', $typelink, $p['type']) :
+            $p['type'];
+
+        $s .= '&lt;/td&gt;';
+        //$s .= '&lt;td&gt;' . sprintf($badges[$p['type']], $p['user']) . '&lt;/td&gt;';
+        $s .= '&lt;/tr&gt;';
     }
+    // Table
+    echo '&lt;table&gt;',
+        '&lt;caption&gt;Packages submitted in the past ', $max_modified * 24, '&amp;nbsp;hours.&lt;/caption&gt;',
+        '&lt;tr&gt;&lt;th&gt;Submitted&lt;/th&gt;&lt;th&gt;User&lt;/th&gt;&lt;th&gt;Package&lt;/th&gt;&lt;th&gt;Target&lt;/th&gt;&lt;th&gt;Media&lt;/th&gt;&lt;th colspan=&quot;2&quot;&gt;Status&lt;/th&gt;&lt;/tr&gt;',
+        $s,
+        '&lt;/table&gt;';
 
-    $s .= '&lt;td&gt;';
-    $s .= ($typelink != '') ?
-        sprintf('&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;', $typelink, $p['type']) :
-        $p['type'];
+    // Stats
+    $s = '&lt;div id=&quot;stats&quot;&gt;';
+    $score = round($stats['uploaded']/$total * 100);
+    $s .= sprintf('&lt;div id=&quot;score&quot;&gt;&lt;h3&gt;Score: %d/100&lt;/h3&gt;
+        &lt;div id=&quot;score-box&quot;&gt;&lt;div id=&quot;score-meter&quot; style=&quot;height: %dpx;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;',
+        $score, $score);
 
-    $s .= '&lt;/td&gt;';
-    $s .= '&lt;td&gt;' . sprintf($badges[$p['type']], $p['user']) . '&lt;/td&gt;';
-    $s .= '&lt;/tr&gt;';
+    $s .= '&lt;table&gt;&lt;caption&gt;Stats.&lt;/caption&gt;&lt;tr&gt;&lt;th colspan=&quot;2&quot;&gt;Status&lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;th&gt;%&lt;/th&gt;&lt;/tr&gt;';
+    foreach ($stats as $k =&gt; $v) {
+        $s .= sprintf('&lt;tr class=&quot;%s&quot;&gt;&lt;td class=&quot;status-box&quot;&gt;&lt;/td&gt;&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;%d&lt;/td&gt;&lt;td&gt;%d%%&lt;/td&gt;&lt;/tr&gt;',
+            $k, $k, $v, round($v/$total*100));
+    }
+    $s .= '&lt;/table&gt;&lt;/div&gt;';
+    echo $s;
 }
-echo $s, '&lt;/table&gt;';
-
-$s = '&lt;div id=&quot;stats&quot;&gt;&lt;table&gt;&lt;caption&gt;Stats.&lt;/caption&gt;&lt;tr&gt;&lt;th colspan=&quot;2&quot;&gt;Status&lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;th&gt;%&lt;/th&gt;&lt;/tr&gt;';
-foreach ($stats as $k =&gt; $v) {
-    $s .= sprintf('&lt;tr class=&quot;%s&quot;&gt;&lt;td class=&quot;status-box&quot;&gt;&lt;/td&gt;&lt;td&gt;%s&lt;/td&gt;&lt;td&gt;%d&lt;/td&gt;&lt;td&gt;%d%%&lt;/td&gt;&lt;/tr&gt;',
-        $k, $k, $v, round($v/$total*100));
+else
+{
+    echo sprintf('&lt;p&gt;No package has been submitted in the past %d&amp;nbsp;hours.&lt;/p&gt;',
+        $max_modified * 24);
 }
-$s .= '&lt;/table&gt;&lt;/div&gt;';
-$s .= '&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;';
 
-echo $s;
-
 ?&gt;
+    &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
+    &lt;hr /&gt;
+    &lt;p&gt;Generated at &lt;?php echo $date_gen; ?&gt;.&lt;/p&gt;
 &lt;/body&gt;
 &lt;/html&gt;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;/pipermail/mageia-sysadm/attachments/20110113/512ecd45/attachment.html&gt;
</PRE>




















<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="002044.html">[Mageia-sysadm] Puppet Report for rabbit.mageia.org
</A></li>
	<LI>Next message: <A HREF="002046.html">[Mageia-sysadm] [293] adjust score style
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#2045">[ date ]</a>
              <a href="thread.html#2045">[ thread ]</a>
              <a href="subject.html#2045">[ subject ]</a>
              <a href="author.html#2045">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>