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
|
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title><?php echo strip_tags($title); ?></title>
<meta name="robots" content="<?php echo $robots; ?>">
<link rel="home" href="<?php echo $g_root_url; ?>">
<link rel="author" href="http://www.mageia.org/">
<link rel="icon" type="image/png" href="themes/mageia/favicon.png">
<link rel="stylesheet" href="themes/mageia/style.css">
<meta name="viewport" content="width=900,initial-scale=1,user-scalable=yes">
</head>
<body class="contribute">
<?php
if (!isset($_GET['package'])) {
$figures_list = array();
$separator = ', ';
// TODO should be cached.
$unmaintained_file = $g_webapp_dir . '/data/unmaintained.txt';
$unmaintained_count = file_exists($unmaintained_file) ? count(file($unmaintained_file)) : 0;
$missing_deps = sprintf('<span id="missing_deps" style="display: none"><strong id="missing_deps_count"></strong> <a rel="nofollow" href="%s">broken <abbr title="dependencies">deps.</abbr></a>' . $separator . '</span>',
'http://check.mageia.org/cauldron/dependencies.html'
);
if ($unmaintained_count > 0) {
$figures_list[] = sprintf('<strong>%d</strong> <a rel="nofollow" href="%s">unmaintained</a>',
$unmaintained_count,
'data/unmaintained.txt'
);
}
if (count($figures_list) > 0)
$figures_list[count($figures_list)-1] .= sprintf(' <a href="%s" class="action-btn" title="%s">%s</a>',
'https://wiki.mageia.org/en/Importing_packages',
'YES you can help!', 'pick one');
$figures_list[] = sprintf('<a rel="nofollow" href="%s">Some updates to validate</a>
<a href="%s" class="action-btn" title="%s">%s</a>',
'http://madb.mageia.org/tools/updates',
'https://wiki.mageia.org/en/QA_process_for_validating_updates',
'YES you can help!', 'see how'
);
$html_figures = 'Packages: ' . $missing_deps . implode($separator, $figures_list) . '.';
?>
<header id="mgnavt">
<h1><?php echo $title ?></h1>
<ul>
<li><a href="#stats">Stats</a></li>
<li><?php echo $html_figures; ?></li>
</ul>
</header>
<script type="text/javascript">
var req = new XMLHttpRequest();
var deps_url = "http://check.mageia.org/cauldron/dependencies.rss";
req.open('GET', deps_url, true);
req.onload = function () {
var missing_deps_count = req.responseText.match(/<item>/gm);
document.getElementById("missing_deps_count").innerText = missing_deps_count.length;
document.getElementById("missing_deps").style = ""; // make it visible
};
req.send();
</script>
<article>
<?php
}
?>
|