summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/property.inc.php2
-rw-r--r--lang/de/templates/minilinux/filelist.json2
-rw-r--r--lang/en/templates/minilinux/filelist.json2
-rw-r--r--modules/minilinux.inc.php48
-rw-r--r--templates/minilinux/filelist.html17
-rw-r--r--templates/page-minilinux.html23
6 files changed, 70 insertions, 24 deletions
diff --git a/inc/property.inc.php b/inc/property.inc.php
index 7c3b7d37..d5a91872 100644
--- a/inc/property.inc.php
+++ b/inc/property.inc.php
@@ -99,7 +99,7 @@ class Property
if (!isset($task['id']))
return 'Could not start list download (' . Message::asString() . ')';
if ($task['statusCode'] !== TASK_FINISHED) {
- $task = Taskmanager::waitComplete($task['id']);
+ $task = Taskmanager::waitComplete($task['id'], 4000);
}
if ($task['statusCode'] !== TASK_FINISHED || !isset($task['data']['content'])) {
return $task['data']['error'];
diff --git a/lang/de/templates/minilinux/filelist.json b/lang/de/templates/minilinux/filelist.json
index fa00b2ca..214d758a 100644
--- a/lang/de/templates/minilinux/filelist.json
+++ b/lang/de/templates/minilinux/filelist.json
@@ -3,6 +3,8 @@
"lang_canUpdate1": "Mindestens eine Komponente von",
"lang_canUpdate2": "kann aktualisiert werden. F\u00fcr einen reibungslosen Betrieb wird empfohlen, alle Komponenten auf dem aktuellen Stand zu halten.",
"lang_configurationPackageNotFound": "Keine Konfigurationspakete gefunden!",
+ "lang_desiredVersion": "Gew\u00fcnschte Version",
+ "lang_filesInVersion": "Dateien zu Version",
"lang_outdated": "Veraltet",
"lang_redownload": "Erneut herunterladen",
"lang_systemUpdated": "Das System ist auf dem aktuellen Stand.",
diff --git a/lang/en/templates/minilinux/filelist.json b/lang/en/templates/minilinux/filelist.json
index 33b6686d..89fed42b 100644
--- a/lang/en/templates/minilinux/filelist.json
+++ b/lang/en/templates/minilinux/filelist.json
@@ -3,6 +3,8 @@
"lang_canUpdate1": "At least one component of",
"lang_canUpdate2": "can be updated. For a smooth operation, it is recommended to keep all components up to date.",
"lang_configurationPackageNotFound": "Configuration package not found!",
+ "lang_desiredVersion": "Desired version",
+ "lang_filesInVersion": "Files for version",
"lang_outdated": "Outdated",
"lang_redownload": "Download again",
"lang_systemUpdated": "The system is up to date.",
diff --git a/modules/minilinux.inc.php b/modules/minilinux.inc.php
index c9d73b61..0853c0db 100644
--- a/modules/minilinux.inc.php
+++ b/modules/minilinux.inc.php
@@ -18,6 +18,9 @@ class Page_MiniLinux extends Page
Render::addTemplate('page-minilinux', array(
'listurl' => '?do=MiniLinux&async=true&action=list'
));
+ Render::addFooter('<script> $(window).load(function (e) {
+ loadSystemList(0);
+ }); // </script>');
}
protected function doAjax()
@@ -30,11 +33,31 @@ class Page_MiniLinux extends Page
return;
}
$action = Request::any('action');
+ $selectedVersion = (int)Request::any('version', 0);
switch ($action) {
case 'list':
$count = 0;
foreach ($data['systems'] as &$system) {
- foreach ($system['files'] as &$file) {
+ // Get latest version, build simple array of all version numbers
+ $versionNumbers = array();
+ $selected = false;
+ foreach ($system['versions'] as $version) {
+ if (!is_numeric($version['version']) || $version['version'] < 1)
+ continue;
+ if ($selectedVersion === 0 && ($selected === false || $selected['version'] < $version['version']))
+ $selected = $version;
+ elseif ($version['version'] == $selectedVersion)
+ $selected = $version;
+ $versionNumbers[(int)$version['version']] = array(
+ 'version' => $version['version']
+ );
+ }
+ if ($selected === false) continue; // No versions for this system!?
+ ksort($versionNumbers);
+ // Mark latest version as selected
+ $versionNumbers[(int)$selected['version']]['selected'] = true;
+ // Add status information to system and its files
+ foreach ($selected['files'] as &$file) {
$file['uid'] = 'dlid' . $count++;
$local = CONFIG_HTTP_DIR . '/' . $system['id'] . '/' . $file['name'];
if (!file_exists($local) || filesize($local) !== $file['size'] || filemtime($local) < $file['mtime']) {
@@ -52,10 +75,12 @@ class Page_MiniLinux extends Page
}
}
}
+ unset($system['versions']);
+ $system['files'] = $selected['files'];
+ $system['version'] = $selected['version'];
}
- echo Render::parse('minilinux/filelist', array(
- 'systems' => $data['systems']
- ));
+ $data['versions'] = array_values($versionNumbers);
+ echo Render::parse('minilinux/filelist', $data);
return;
case 'download':
$id = Request::post('id');
@@ -68,11 +93,14 @@ class Page_MiniLinux extends Page
$gpg = 'missing';
foreach ($data['systems'] as &$system) {
if ($system['id'] !== $id) continue;
- foreach ($system['files'] as &$f) {
- if ($f['name'] !== $name) continue;
- $file = $f;
- if (!empty($f['gpg'])) $gpg = $f['gpg'];
- break;
+ foreach ($system['versions'] as &$version) {
+ if ($version['version'] != $selectedVersion) continue;
+ foreach ($version['files'] as &$f) {
+ if ($f['name'] !== $name) continue;
+ $file = $f;
+ if (!empty($f['gpg'])) $gpg = $f['gpg'];
+ break;
+ }
}
}
if ($file === false) {
@@ -80,7 +108,7 @@ class Page_MiniLinux extends Page
return;
}
$task = Taskmanager::submit('DownloadFile', array(
- 'url' => CONFIG_REMOTE_ML . '/' . $id . '/' . $name,
+ 'url' => CONFIG_REMOTE_ML . '/' . $id . '/' . $selectedVersion . '/' . $name,
'destination' => CONFIG_HTTP_DIR . '/' . $id . '/' . $name,
'gpg' => $gpg
));
diff --git a/templates/minilinux/filelist.html b/templates/minilinux/filelist.html
index 39ed0b43..ca94f4d0 100644
--- a/templates/minilinux/filelist.html
+++ b/templates/minilinux/filelist.html
@@ -4,6 +4,19 @@
<h4>{{title}}</h4>
</div>
<div class="panel-body" id="download-{{id}}">
+ <div class="input-group pull-right" style="max-width: 400px">
+ <span class="input-group-addon slx-ga">{{lang_desiredVersion}}</span>
+ <select id="versionbox" class="form-control" onchange="loadSystemList($('#versionbox').val())">
+ {{#versions}}
+ {{#selected}}
+ <option value="{{version}}" selected>{{version}}</option>
+ {{/selected}}
+ {{^selected}}
+ <option value="{{version}}">{{version}}</option>
+ {{/selected}}
+ {{/versions}}
+ </select>
+ </div>
{{#systemChanged}}
<p>
{{lang_canUpdate1}} <b>{{title}}</b> {{lang_canUpdate2}}
@@ -13,6 +26,8 @@
{{^systemChanged}}
<p>{{lang_systemUpdated}}</p>
{{/systemChanged}}
+ <hr>
+ <p><b>{{lang_filesInVersion}} {{version}}</b></p>
<ul class="list-group">
{{#files}}
<li class="list-group-item" id="{{uid}}">
@@ -43,7 +58,7 @@ function slxUpdate(uid, id, name)
{
$('#' + uid).html('');
$('#' + uid).load('?do=MiniLinux',
- { action : "download", token : TOKEN, id : id, name : name },
+ { action : "download", token : TOKEN, id : id, name : name, version : $('#versionbox').val() },
function(response, status, xhr) {
if (status === "error") {
var msg = "Fehler beim Abruf: ";
diff --git a/templates/page-minilinux.html b/templates/page-minilinux.html
index df245ef0..dc13e6b0 100644
--- a/templates/page-minilinux.html
+++ b/templates/page-minilinux.html
@@ -1,15 +1,14 @@
<div id="systemlist">
<div class="panel panel-default">{{lang_listObtained}}</div>
- <script type="text/javascript">
- var slx_check = setInterval(function() {
- if (typeof $ === 'undefined') return;
- clearInterval(slx_check);
- $('#systemlist').load('{{{listurl}}}', function( response, status, xhr ) {
- if ( status === "error" ) {
- var msg = "{{lang_errorGetting}}";
- $( "#systemlist" ).html( msg + xhr.status + " " + xhr.statusText );
- }
- })
- }, 100);
- </script>
</div>
+
+<script type="text/javascript"><!--
+ function loadSystemList(version) {
+ $('#systemlist').load('{{{listurl}}}', { token: TOKEN, version: version }, function( response, status, xhr ) {
+ if ( status === "error" ) {
+ var msg = "{{lang_errorGetting}}";
+ $( "#systemlist" ).html( msg + xhr.status + " " + xhr.statusText );
+ }
+ });
+ }
+// --></script> \ No newline at end of file