diff options
author | Simon Rettberg | 2019-01-11 16:50:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-11 16:50:35 +0100 |
commit | 67312e7b378be5fb464f0748bbe949d977a0e894 (patch) | |
tree | 6b03cf3cb39bb1efd712abbb5bdc435bbaaa2da8 /modules-available | |
parent | [locations] Show current boot menu per location, add edit button (diff) | |
download | slx-admin-67312e7b378be5fb464f0748bbe949d977a0e894.tar.gz slx-admin-67312e7b378be5fb464f0748bbe949d977a0e894.tar.xz slx-admin-67312e7b378be5fb464f0748bbe949d977a0e894.zip |
[serversetup-bwlp] Implement download page
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/serversetup-bwlp/page.inc.php | 40 | ||||
-rw-r--r-- | modules-available/serversetup-bwlp/templates/download.html | 23 |
2 files changed, 52 insertions, 11 deletions
diff --git a/modules-available/serversetup-bwlp/page.inc.php b/modules-available/serversetup-bwlp/page.inc.php index 004077dc..b9732d2b 100644 --- a/modules-available/serversetup-bwlp/page.inc.php +++ b/modules-available/serversetup-bwlp/page.inc.php @@ -176,8 +176,44 @@ class Page_ServerSetup extends Page private function showDownload() { - // TODO: Make nicer, support more variants (taskmanager-plugin) - Render::addTemplate('download'); + $list = glob('/srv/openslx/www/boot/download/*', GLOB_NOSORT); + usort($list, function ($a, $b) { + return strcmp(substr($a, -4), substr($b, -4)) * 100 + strcmp($a, $b); + }); + $files = []; + $strings = [ + 'efi' => [Dictionary::translate('dl-efi', true) => 50], + 'pcbios' => [Dictionary::translate('dl-pcbios', true) => 51], + 'usb' => [Dictionary::translate('dl-usb', true) => 80], + 'hd' => [Dictionary::translate('dl-hd', true) => 81], + 'lkrn' => [Dictionary::translate('dl-lkrn', true) => 82], + 'i386' => [Dictionary::translate('dl-i386', true) => 10], + 'x86_64' => [Dictionary::translate('dl-x86_64', true) => 11], + 'ecm' => [Dictionary::translate('dl-usbnic', true) => 60], + 'ncm' => [Dictionary::translate('dl-usbnic', true) => 61], + 'ipxe' => [Dictionary::translate('dl-pcinic', true) => 62], + 'snp' => [Dictionary::translate('dl-snp', true) => 63], + ]; + foreach ($list as $file) { + if ($file{0} === '.') + continue; + if (is_file($file)) { + $base = basename($file); + $features = []; + foreach (preg_split('/[\-\.\/]+/', $base, -1, PREG_SPLIT_NO_EMPTY) as $p) { + if (array_key_exists($p, $strings)) { + $features += $strings[$p]; + } + } + asort($features); + $files[] = [ + 'name' => $base, + 'class' => substr($base, -4) === '.usb' ? 'slx-bold' : '', + 'features' => implode(', ', array_keys($features)), + ]; + } + } + Render::addTemplate('download', ['files' => $files]); } private function showBootentryList() diff --git a/modules-available/serversetup-bwlp/templates/download.html b/modules-available/serversetup-bwlp/templates/download.html index 6752f7fc..bdb82470 100644 --- a/modules-available/serversetup-bwlp/templates/download.html +++ b/modules-available/serversetup-bwlp/templates/download.html @@ -1,12 +1,17 @@ -<div class="panel-footer"> - <div> - <div class="btn-group" role="group"> - <a class="btn btn-default" href="?do=ServerSetup&action=getimage"> - <span class="glyphicon glyphicon-download-alt"></span> - {{lang_downloadImage}} - </a> - <span class="btn btn-default" data-toggle="modal" data-target="#help-usbimg"><span class="glyphicon glyphicon-question-sign"></span></span> - </div> +<div class="panel panel-default"> + <div class="panel-heading"> + {{lang_downloadBootImage}} + </div> + <div class="panel-body"> + <ul> + {{#files}} + <li><a class="{{class}}" href="/boot/download/{{name}}">{{name}}</a> ({{features}})</li> + {{/files}} + </ul> + <span class="btn btn-default" data-toggle="modal" data-target="#help-usbimg"> + <span class="glyphicon glyphicon-question-sign"></span> + {{lang_usbImgHelpBtn}} + </span> </div> </div> |