diff options
author | filip <filip.komar@gmail.com> | 2015-05-02 16:13:53 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2015-05-02 16:13:53 +0200 |
commit | e31ec4507c495254239f11841d81c865e80e41a9 (patch) | |
tree | e0c62b5c7cc2e0564e7ae13d6ce8e82a6058da78 /en | |
parent | c2158bebcc570b4f1a573122a546310268434e9e (diff) | |
download | www-e31ec4507c495254239f11841d81c865e80e41a9.tar www-e31ec4507c495254239f11841d81c865e80e41a9.tar.gz www-e31ec4507c495254239f11841d81c865e80e41a9.tar.bz2 www-e31ec4507c495254239f11841d81c865e80e41a9.tar.xz www-e31ec4507c495254239f11841d81c865e80e41a9.zip |
adding download of pdf and epub file infrastructure
Diffstat (limited to 'en')
-rw-r--r-- | en/doc/doc.php | 8 | ||||
-rw-r--r-- | en/doc/index.php | 12 | ||||
-rw-r--r-- | en/downloads/get/definitions_doc.ini | 29 | ||||
-rw-r--r-- | en/downloads/get/index.php | 22 | ||||
-rw-r--r-- | en/downloads/get/lib.php | 5 |
5 files changed, 62 insertions, 14 deletions
diff --git a/en/doc/doc.php b/en/doc/doc.php index 0be4aa318..9015b3626 100644 --- a/en/doc/doc.php +++ b/en/doc/doc.php @@ -33,7 +33,7 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null $other_languages_present = FALSE; $note_printed = FALSE; // temporary hidding of the EPUB and PDF links - $hide_epub_pdf = TRUE; + $hide_epub_pdf = FALSE; $table = PHP_EOL . '<table class="dlt2 dlinfo" style="font-size: 10pt;">' . PHP_EOL; // $table .= '<thead><tr><th></th></tr></thead>'; $table .= "\t<tbody>" . PHP_EOL; @@ -52,7 +52,7 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null '<span style="font-weight:bold">' . $documentation_name . '</span>', $lng_name, sprintf($link, $lng)); } else { $your_language = sprintf(_r('%s available in %s') . '<br/>%s <span style="font-size: 07pt;">('. - _r('also as') . '%s , %s)</span>', + _r('also as') . ' %s, %s)</span>', '<span style="font-weight:bold">' . $documentation_name . '</span>', $lng_name, sprintf($link, $lng), sprintf($epub_link, $lng), sprintf($pdf_link, $lng)); } @@ -62,12 +62,12 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null $others[] = sprintf('%s<br/>%s', $lng_name, sprintf($link, $lng)); } else { if(!$note_printed) { - $note = _r('also as'); + $note = _r('also as') . ' '; $note_printed = TRUE; } else { $note = ''; } - $others[] = sprintf('%s<br/>%s <span style="font-size: 07pt;">(%s%s , %s)</span>', + $others[] = sprintf('%s<br/>%s <span style="font-size: 07pt;">(%s%s, %s)</span>', $lng_name, sprintf($link, $lng), $note, sprintf($epub_link, $lng), sprintf($pdf_link, $lng), sprintf($link, $lng)); } } diff --git a/en/doc/index.php b/en/doc/index.php index 54ff6d964..157f834c1 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -34,16 +34,16 @@ require 'doc.php'; <div style="float: left; margin: 1em; width: 24em;"> <p style="margin-left: 2em;"><?php doc_list(_r('Installer'), 'installer', 4, '<a href="//doc.mageia.org/installer/4/%s/content/index.html">HTML</a>', - '<a href="//doc.mageia.org/installer/4/%s/content/index.html">EPUB</a>', - '<a href="//doc.mageia.org/installer/4/%s/content/index.html">PDF</a>'); - ?></p> + '<a rel="nofollow" href="../downloads/get/?q=Mageia4_DrakX_%s_epub&doc=yes" title="Mageia installer EPUB">EPUB</a>', + '<a rel="nofollow" href="../downloads/get/?q=Mageia4_DrakX_%s_pdf&doc=yes" title="Mageia installer PDF">PDF</a>'); + ?></p> </div> <div style="float: right; margin: 1em; width: 24em;"> <p style="margin-left: 2em;"><?php doc_list(_r('Control Center'), 'control_center', 4, '<a href="//doc.mageia.org/mcc/4/%s/content/index.html">HTML</a>', - '<a href="//doc.mageia.org/mcc/4/%s/content/index.html">EPUB</a>', - '<a href="//doc.mageia.org/mcc/4/%s/content/index.html">PDF</a>'); - ?></p> + '<a rel="nofollow" href="../downloads/get/?q=Mageia4_MCC_%s_epub&doc=yes" title="Mageia MCC EPUB">EPUB</a>', + '<a rel="nofollow" href="../downloads/get/?q=Mageia4_MCC_%s_pdf&doc=yes" title="Mageia MCC PDF">PDF</a>'); + ?></p> </div> </div> </div> diff --git a/en/downloads/get/definitions_doc.ini b/en/downloads/get/definitions_doc.ini new file mode 100644 index 000000000..4acfa8b17 --- /dev/null +++ b/en/downloads/get/definitions_doc.ini @@ -0,0 +1,29 @@ +; Downloads definitions file. +; This is a whitelist for what can be downloaded from mageia.org +; through the download redirector (to official Mageia mirrors). +; + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;; Mageia documentation +;;;;;;;;;;;;;;;;;;;;; + +[Mageia4_DrakX_en_epub] +size = around 2 MB +path = people/marcom/doc/mga4/epub/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" ; it epub is currently missing + +[Mageia4_DrakX_en_pdf] +size = around 2 MB +path = people/marcom/doc/mga4/pdf/installer +langs = "ca|cs|de|el|en|eo|es|et|eu|fr|id|it|nl|pl|pt_br|ro|ru|sq|sv|tr|uk" + +[Mageia4_MCC_en_epub] +size = around 10 MB +path = people/marcom/doc/mga4/epub/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" + +[Mageia4_MCC_en_pdf] +size = around 10 MB +path = people/marcom/doc/mga4/pdf/mcc +langs = "de|en|et|fr|ro|ru|tr|uk" diff --git a/en/downloads/get/index.php b/en/downloads/get/index.php index 0678b9f0a..fc4497f98 100644 --- a/en/downloads/get/index.php +++ b/en/downloads/get/index.php @@ -37,6 +37,7 @@ require 'lib.php'; // request $product = get('q'); +$doc = get('doc'); $debug = get('d'); if (isset($_GET['torrent'])) { $torrent = strip_tags(trim($_GET['torrent'])); @@ -58,14 +59,31 @@ session_start(); $download = null; $js_redirect = null; $reason = null; +if ($doc == 'yes') { + $def_file = 'definitions_doc.ini'; + list($release, $type, $lang, $extension) = explode('_', $product); // 'Mageia4_DrakX_en_epub' + $product = implode('_', array($release, $type, 'en', $extension)); + $documentation = true; +} else { + $def_file = 'definitions.ini'; + $documentation = false; +} try { // TODO simplify and wrap all this in a single interface: // list(dl_template, mirrors) = get_download_options_for(product) // Step 1. include '../../../lib/Downloads.php'; - $product = get_info_for_product($product); - $all_mirrors = get_mirrors_for($product['file'], 'en', get('country')); + $product = get_info_for_product($product, $def_file); + if ($doc == 'yes') { + $langs = explode('|', $product['langs']); + if (!in_array($lang, $langs)) { + $lang = 'en'; // fallback language + } + $product['file'] = $release . '-' . $type . '-' . $lang . '.' . $extension; + $product['name'] = $product['file']; + } + $all_mirrors = get_mirrors_for($product['file'], 'en', get('country'), true, $documentation); $one_mirror = $all_mirrors[0]; $alt_mirrors = $all_mirrors[1]; $download_tmpl = get_download_link($product, $torrent); diff --git a/en/downloads/get/lib.php b/en/downloads/get/lib.php index 35bbe985c..b730b767d 100644 --- a/en/downloads/get/lib.php +++ b/en/downloads/get/lib.php @@ -22,6 +22,7 @@ $countries = array( 'CN' => '中国', // China 'CZ' => 'Česko', // Czechia 'DE' => 'Deutschland', + 'EC' => 'Ecuador', 'ES' => 'España', 'FR' => 'France', 'GB' => 'Great Britain', @@ -125,11 +126,11 @@ function get_info_for_product($product, $def_file = null) * speed * link */ -function get_mirrors_for($file, $locale = null, $country = null) +function get_mirrors_for($file, $locale = null, $country = null, $prod = true, $documentation = false) { //include '../../../lib/Downloads.php'; - $mirrors = Downloads::get_all_mirrors(); + $mirrors = Downloads::get_all_mirrors($prod, $documentation); $wsd = new Downloads(); $one = $wsd->prepare_download(true, $country); |