diff options
Diffstat (limited to 'themes/mageia/page_header.php')
-rw-r--r-- | themes/mageia/page_header.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/themes/mageia/page_header.php b/themes/mageia/page_header.php index 5cb0885..eb0f835 100644 --- a/themes/mageia/page_header.php +++ b/themes/mageia/page_header.php @@ -13,21 +13,17 @@ <body class="contribute"> <?php -$figures_list = array(); - if (!isset($_GET['package'])) { + $figures_list = array(); + $separator = ', '; // TODO should be cached. - $missing_deps_count = preg_match_all("/<item>/m", file_get_contents("http://check.mageia.org/cauldron/dependencies.rss"), $matches); $unmaintained_file = $g_webapp_dir . '/data/unmaintained.txt'; $unmaintained_count = file_exists($unmaintained_file) ? count(file($unmaintained_file)) : 0; - if ($missing_deps_count > 0) { - $figures_list[] = sprintf('<strong>%d</strong> <a rel="nofollow" href="%s">broken <abbr title="dependencies">deps.</abbr></a>', - $missing_deps_count, + $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>', @@ -48,10 +44,7 @@ if (!isset($_GET['package'])) { 'YES you can help!', 'see how' ); - $html_figures = null; - if (count($figures_list) > 0) { - $html_figures = 'Packages: ' . implode(', ', $figures_list) . '.'; - } + $html_figures = 'Packages: ' . $missing_deps . implode($separator, $figures_list) . '.'; ?> <header id="mgnavt"> @@ -61,6 +54,17 @@ if (!isset($_GET['package'])) { <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 } |