Split arch logic into separate function (thanks, cstamas!)
[grml.org.git] / download / prerelease / index.html.tt2
index 500109f..e68afa2 100644 (file)
@@ -99,13 +99,14 @@ exit;
     <h2>Options</h2>
 
     <select name="flavour" id="download_flavour" style="width:100%;">
-    <option value="full" selected="selected">grml (350MB)</option>
-    <option value="small">grml-small (150MB)</option>
+    <option value="full" selected="selected">grml-full (~350MB)</option>
+    <option value="small">grml-small (~150MB)</option>
     </select>
     <br /><br />
     <select name="arch" id="download_arch" style="width:100%;">
-    <option value="amd64" selected="selected">64-bit PC</option>
-    <option value="i386">32-bit PC</option>
+    <option value="amd64" selected="selected">64-bit PC (amd64)</option>
+    <option value="i386">32-bit PC (i586+)</option>
+    <option value="96">One for both (700MB)</option>
     </select>
     <br />
     <br />
@@ -132,22 +133,30 @@ exit;
 
     </form>
     <script type="text/javascript">
+    function update_arch() {
+        var flavour = document.getElementById('download_flavour').value;
+        if (flavour == 'small') document.getElementById('download_arch').innerHTML = '<option value="amd64">64-bit PC (amd64)</option><option value="i386">32-bit PC (i586+)</option><option value="96">One for both (300MB)</option>';
+        if (flavour == 'full') document.getElementById('download_arch').innerHTML = '<option value="amd64">64-bit PC (amd64)</option><option value="i386">32-bit PC (i586+)</option><option value="96">One for both (700MB)</option>';
+    }
+
     function update_links() {
         var current_version = "2012.05-rc1";
         var product = 'grml';
         var arch = document.getElementById('download_arch').value;
         var flavour = document.getElementById('download_flavour').value;
         if (arch == 'amd64') product = 'grml64';
-        if (flavour != 'full') product += '-' + flavour;
-        var iso = product + '_' + current_version + '.iso';
+        if (arch == 'i386') product = 'grml32';
+        if (arch == '96') product = 'grml96';
+        var iso = product + '-' + flavour + '_' + current_version + '.iso';
         var mirror_url = "http://download.grml.org/devel/";
         document.getElementById('download_link_mirror').href = mirror_url + iso;
-        document.getElementById('download_link_mirror').innerHTML = '<br />Download Now<div class="download_relinfo">' + product + ' ' + current_version + '</div>';
+        document.getElementById('download_link_mirror').innerHTML = '<br />Download Now<div class="download_relinfo">' + product + '-' + flavour + ' ' + current_version + '</div>';
         document.getElementById('download_link_bt').href = mirror_url + iso + '.torrent';
         document.getElementById('download_link_signature').href = mirror_url + iso + '.sha1.asc';
     }
+
     // hook update function
-    document.getElementById('download_flavour').onchange = update_links;
+    document.getElementById('download_flavour').onchange = update_arch;
     document.getElementById('download_arch').onchange = update_links;
     // force initial link href set
     update_links();