diff options
author | Manuel Hiebel <leuhmanu@mageia.org> | 2018-11-30 11:49:56 +0100 |
---|---|---|
committer | Manuel Hiebel <leuhmanu@mageia.org> | 2018-11-30 11:49:56 +0100 |
commit | a4c54da3ccc6375019ba3477e890a5e3930a7034 (patch) | |
tree | 2d77ae3a33cdfc2786e38e8f0c12e9870021c815 /en/downloads | |
parent | 551b6ff449f8c99c5f074648e838436f2da35d24 (diff) | |
download | www-a4c54da3ccc6375019ba3477e890a5e3930a7034.tar www-a4c54da3ccc6375019ba3477e890a5e3930a7034.tar.gz www-a4c54da3ccc6375019ba3477e890a5e3930a7034.tar.bz2 www-a4c54da3ccc6375019ba3477e890a5e3930a7034.tar.xz www-a4c54da3ccc6375019ba3477e890a5e3930a7034.zip |
Import alternative downloads page
WIP, current default one is buggy so publishing my work
Diffstat (limited to 'en/downloads')
-rwxr-xr-x[-rw-r--r--] | en/downloads/alternative/index.php (renamed from en/downloads/alt.php) | 87 |
1 files changed, 49 insertions, 38 deletions
diff --git a/en/downloads/alt.php b/en/downloads/alternative/index.php index b90c87b84..6c3127126 100644..100755 --- a/en/downloads/alt.php +++ b/en/downloads/alternative/index.php @@ -1,11 +1,11 @@ <?php -$stableVersion = '6'; -$cauldron = '7'; +$current = '6.1'; +$cauldron = 'cauldron'; define('HLANG', true); -require '../../langs.php'; +require '../../../langs.php'; $dictionary = read_translation_file($locale, array('cauldron', 'common_footer')); ?> @@ -16,7 +16,7 @@ $dictionary = read_translation_file($locale, array('cauldron', 'common_footer')) <title><?php echo sprintf(_g('Download').' '. ' Mageia')?></title> <meta name="robots" content="index,nofollow,nosnippet"> <?php echo common_header(); ?> - <?php include '../../analytics.php'; ?> + <?php include '../../../analytics.php'; ?> </head> <body class="release downloads"> <?php echo $hsnav; ?> @@ -49,52 +49,63 @@ $dictionary = read_translation_file($locale, array('cauldron', 'common_footer')) <?php -$ini = parse_ini_file('get/definitions.ini', true); +$ini = parse_ini_file('../get/definitions.ini', true); $ini = array_reverse($ini); -function doTheTable($url, $name, $torrent, $magnet, $size){ - $table = sprintf('<tr scope="row"><td><a href="get/?q=%s">%s</a></td>',$url, $name); - $table .= sprintf('<td><a href="./get/?q=%s&torrent=1">%s</a></td>',$url , $torrent ? 'torrent': ''); - $table .= sprintf('<td><a href="%s">%s</a></td>',$magnet , $magnet ? 'magnet': ''); - $table .= sprintf('<td>%s</td></tr>'. PHP_EOL, $size); - return $table; -}; - foreach ($ini as $section => $values) { -$version = $values['name'][7]; +$release = explode("-", $section); +$release = $release[1]; $name = $values['name']; $torrent = $values['torrent']; $magnet = $values['magnet']; $size = $values['size']; -if ($version == $stableVersion){ - $tables .= doTheTable($section, $name, $torrent, $magnet, $size); -}elseif ($version == $cauldron){ - $tablec .= doTheTable($section, $name, $torrent, $magnet, $size); -}else{ - $tablea .= doTheTable($section, $name, $torrent, $magnet, $size); -} + if ($release == $current){ + $tableCurrent .= TableContent($section, $name, $torrent, $magnet, $size); + }elseif ($release == $cauldron){ + $tableCauldron .= TableContent($section, $name, $torrent, $magnet, $size); + }else{ + $tableArchives .= TableContent($section, $name, $torrent, $magnet, $size); + } }; -function allDiv($version, $table, $show){ - - $div = sprintf('<div class="card"><div class="card-header" id="heading%s">', $version); - $div .= sprintf('<button class="btn btn-outline-secondary" data-toggle="collapse" data-target="#collapse%s" aria-expanded="true" aria-controls="collapse%s">%s</button></div>'. PHP_EOL,$version, $version, $version); - $div .= sprintf('<div id="collapse%s" class="collapse %s" aria-labelledby="heading%s" data-parent="#accordion"><div class="card-body">' . PHP_EOL, $version, $show, $version); - $div .= '<table class="table table-hover table-sm">'; - $div .= sprintf('<thead><tr><th scope="col">iso</th><th>torrent</th><th>magnet</th><th>size</th></tr></thead>' . PHP_EOL); - $div .= sprintf('<tbody>%s</tbody></table>' . PHP_EOL, $table); - echo $div . '</div></div></div>'. PHP_EOL; -} - - -echo '<div id="accordion">'; +function TableContent($url, $name, $torrent, $magnet, $size){ + $table = sprintf('<tr><td><a rel="nofollow" href="../get/?q=%s">%s</a></td>',$url, $name); + $table .= $torrent ? sprintf('<td><a rel="nofollow" href="../get/?q=%s&torrent=1">torrent</a></td>', $url) : '<td></td>'; + $table .= $magnet ? sprintf('<td><a href="%s">magnet</a></td>', $magnet) : '<td></td>'; + $table .= sprintf('<td>%s</td></tr>'. PHP_EOL, $size); + return $table; +}; -allDiv('Stable', $tables, 'show'); -allDiv('Unstable', $tablec); -allDiv('Archives', $tablea); +function allDiv($release, $Trelease, $table){ + $div = sprintf("<div id=\"%s\">\n\t<h3>%s</h3>" . PHP_EOL, $release,$Trelease); + $div .= '<table class="table table-hover table-sm">'; + $div .= sprintf('<thead><tr><th >iso</th><th>torrent</th><th>magnet</th><th>size</th></tr></thead>' . PHP_EOL); + echo $div .= sprintf('<tbody>%s</tbody></table></div>' . PHP_EOL, $table); +} ?> + + +<div class="row pt-3"> + <div class="col-sm-3"> + <nav id="nav-release" class="navbar navbar-light bg-light"> + <nav class="nav nav-pills flex-column"> + <a class="nav-link" href="#Current">Current Release</a> + <?php if($tableCauldron){; + echo '<a class="nav-link" href="#Cauldron">Unstable Release</a>'; + }; ?> + <a class="nav-link" href="#Archives">Archives</a> + </nav> + </nav> + </div> + + <div class="col-sm-9" data-spy="scroll" data-target="#nav-release" data-offset="1" style="height:400px; overflow-y: scroll"> + <?php + allDiv('Current', 'Current Release', $tableCurrent); + $tableCauldron ? allDiv('Cauldron', 'Unstable Release', $tableCauldron) : '' ; + allDiv('Archives', 'Archives', $tableArchives); + ?> + </div> -?> </div> </div> <?php echo common_footer($locale); ?> |