From 7eb0c397a5b97dd3f6b2540c891006c13f3b94d1 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Thu, 13 Jan 2011 17:13:01 +0000 Subject: properly handle empty queue; remove feedback labels; try a "score" for this list of packages --- index.php | 93 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 36 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 8a26916..b9a88bf 100644 --- a/index.php +++ b/index.php @@ -21,6 +21,7 @@ if ($g_user) { $robots = 'no' . $robots; } $tz = new DateTimeZone('UTC'); +$date_gen = date('c'); # Temporary until initial mirror is ready chdir("data"); @@ -169,6 +170,9 @@ function key2date($key) { 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; } @@ -189,9 +193,6 @@ echo sprintf( ); ######################################### -echo '', - '', - ''; $s = ''; $tmpl = << '' ); -foreach ($pkgs as $key => $p) { - $p['type'] = pkg_gettype($p); +if ($total > 0) { + foreach ($pkgs as $key => $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 .= ''; + //$s .= ''; + $s .= ''; } + // Table + echo '
Packages submitted in the past ', $max_modified * 24, ' hours.
SubmittedUserPackageTargetMediaStatus
'; + $s .= ($typelink != '') ? + sprintf('%s', $typelink, $p['type']) : + $p['type']; + + $s .= '' . sprintf($badges[$p['type']], $p['user']) . '
', + '', + '', + $s, + '
Packages submitted in the past ', $max_modified * 24, ' hours.
SubmittedUserPackageTargetMediaStatus
'; - $s .= ''; - $s .= ($typelink != '') ? - sprintf('%s', $typelink, $p['type']) : - $p['type']; + // Stats + $s = '
'; + $score = round($stats['uploaded']/$total * 100); + $s .= sprintf('

Score: %d/100

+
', + $score, $score); - $s .= ''; - $s .= '' . sprintf($badges[$p['type']], $p['user']) . ''; - $s .= ''; + $s .= ''; + foreach ($stats as $k => $v) { + $s .= sprintf('', + $k, $k, $v, round($v/$total*100)); + } + $s .= '
Stats.
StatusCount%
%s%d%d%%
'; + echo $s; } -echo $s, ''; - -$s = '
'; -foreach ($stats as $k => $v) { - $s .= sprintf('', - $k, $k, $v, round($v/$total*100)); +else +{ + echo sprintf('

No package has been submitted in the past %d hours.

', + $max_modified * 24); } -$s .= '
Stats.
StatusCount%
%s%d%d%%
'; -$s .= '
'; - -echo $s; ?> +
+
+

Generated at .

-- cgit v1.2.1