summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-30 11:11:58 +0100
committerSimon Rettberg2019-10-30 11:11:58 +0100
commit0ff7bf98b50a2057e76d252f5e044dc48908e350 (patch)
tree234b3243d4705a44115fe698798e2bd1328ef4de
parent[minilinux] Slightly better busy-wait for update check (diff)
downloadslx-admin-0ff7bf98b50a2057e76d252f5e044dc48908e350.tar.gz
slx-admin-0ff7bf98b50a2057e76d252f5e044dc48908e350.tar.xz
slx-admin-0ff7bf98b50a2057e76d252f5e044dc48908e350.zip
[minilinux] Split version list and source list into separate sub-menus
-rw-r--r--modules-available/minilinux/lang/de/module.json2
-rw-r--r--modules-available/minilinux/page.inc.php56
2 files changed, 34 insertions, 24 deletions
diff --git a/modules-available/minilinux/lang/de/module.json b/modules-available/minilinux/lang/de/module.json
index 687b4a71..3e5ed495 100644
--- a/modules-available/minilinux/lang/de/module.json
+++ b/modules-available/minilinux/lang/de/module.json
@@ -7,6 +7,8 @@
"file-size-mismatch": "Dateigr\u00f6\u00dfe stimmt nicht",
"ipxe-debug": "Debug-Ausgaben statt Bootlogo",
"ipxe-kcl-extra": "Modifikation der Kernel-Command-Line",
+ "menu-sources": "Update-Quellen",
+ "menu-versions": "Verf\u00fcgbare Versionen",
"module_name": "Netboot Grundsystem",
"not_installed_hint": "(nicht installiert)",
"page_title": "Linuxvarianten f\u00fcr Netboot verwalten"
diff --git a/modules-available/minilinux/page.inc.php b/modules-available/minilinux/page.inc.php
index 29169807..575177a8 100644
--- a/modules-available/minilinux/page.inc.php
+++ b/modules-available/minilinux/page.inc.php
@@ -25,6 +25,8 @@ class Page_MiniLinux extends Page
}
User::assertPermission('view');
+ Dashboard::addSubmenu('?do=minilinux', Dictionary::translate('menu-versions', true));
+ Dashboard::addSubmenu('?do=minilinux&show=sources', Dictionary::translate('menu-sources', true));
}
protected function doRender()
@@ -34,33 +36,39 @@ class Page_MiniLinux extends Page
if (!MiniLinux::updateCurrentBootSetting()) {
Message::addError('default-not-installed', Property::get(MiniLinux::PROPERTY_DEFAULT_BOOT));
}
- // List branches and versions
- $branches = Database::queryAll('SELECT sourceid, branchid, title, description FROM minilinux_branch ORDER BY title ASC');
- $versions = MiniLinux::queryAllVersionsByBranch();
- // Group by branch for detailed listing
- foreach ($branches as &$branch) {
- if (isset($versions[$branch['branchid']])) {
- $branch['versionlist'] = $this->renderVersionList($versions[$branch['branchid']]);
- }
- }
- unset($branch);
- Render::addTemplate('branches', ['branches' => $branches]);
- // List sources
- $res = Database::simpleQuery('SELECT sourceid, title, url, lastupdate, pubkey FROM minilinux_source ORDER BY title, sourceid');
- $data = ['list' => [], 'show_refresh' => true];
- $tooOld = strtotime('-7 days');
- $showRefresh = strtotime('-10 minutes');
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $row['lastupdate_s'] = Util::prettyTime($row['lastupdate']);
- if ($row['lastupdate'] != 0 && $row['lastupdate'] < $tooOld) {
- $row['update_class'] = 'text-danger';
+ $show = Request::get('show', 'list', 'string');
+ if ($show === 'list') {
+ // List branches and versions
+ $branches = Database::queryAll('SELECT sourceid, branchid, title, description FROM minilinux_branch ORDER BY title ASC');
+ $versions = MiniLinux::queryAllVersionsByBranch();
+ // Group by branch for detailed listing
+ foreach ($branches as &$branch) {
+ if (isset($versions[$branch['branchid']])) {
+ $branch['versionlist'] = $this->renderVersionList($versions[$branch['branchid']]);
+ }
}
- if ($row['lastupdate'] > $showRefresh) {
- $data['show_refresh'] = false;
+ unset($branch);
+ Render::addTemplate('branches', ['branches' => $branches]);
+ } elseif ($show === 'sources') {
+ // List sources
+ $res = Database::simpleQuery('SELECT sourceid, title, url, lastupdate, pubkey FROM minilinux_source ORDER BY title, sourceid');
+ $data = ['list' => [], 'show_refresh' => true];
+ $tooOld = strtotime('-7 days');
+ $showRefresh = strtotime('-10 minutes');
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $row['lastupdate_s'] = Util::prettyTime($row['lastupdate']);
+ if ($row['lastupdate'] != 0 && $row['lastupdate'] < $tooOld) {
+ $row['update_class'] = 'text-danger';
+ }
+ if ($row['lastupdate'] > $showRefresh) {
+ $data['show_refresh'] = false;
+ }
+ $data['list'][] = $row;
}
- $data['list'][] = $row;
+ Render::addTemplate('sources', $data);
+ } else {
+ Message::addError('main.invalid-action', $show);
}
- Render::addTemplate('sources', $data);
}
protected function doAjax()