diff options
author | filip <filip.komar@gmail.com> | 2015-06-28 22:45:38 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2015-06-28 22:45:38 +0200 |
commit | c5d0c2728c113f8e2364d501bed0e23f7748af27 (patch) | |
tree | 7811ae4d4bc3a122660a756321296983fb7f812e /en/doc | |
parent | fa8c21e1cd67ecea286f9e8bd8f652be338d61a6 (diff) | |
download | www-c5d0c2728c113f8e2364d501bed0e23f7748af27.tar www-c5d0c2728c113f8e2364d501bed0e23f7748af27.tar.gz www-c5d0c2728c113f8e2364d501bed0e23f7748af27.tar.bz2 www-c5d0c2728c113f8e2364d501bed0e23f7748af27.tar.xz www-c5d0c2728c113f8e2364d501bed0e23f7748af27.zip |
mga 5 pdf and epub documenation files added + improvements:
- more clear page
- links added only for present pdf and epub files
- function doc_list improved and cleaned
Diffstat (limited to 'en/doc')
-rw-r--r-- | en/doc/archive.php | 6 | ||||
-rw-r--r-- | en/doc/doc.php | 82 | ||||
-rw-r--r-- | en/doc/index.php | 24 |
3 files changed, 67 insertions, 45 deletions
diff --git a/en/doc/archive.php b/en/doc/archive.php index 387a4cd06..9aff8cc64 100644 --- a/en/doc/archive.php +++ b/en/doc/archive.php @@ -29,19 +29,19 @@ require 'doc.php'; <h3>Mageia 3</h3> <div style="float: left; margin: 1em; width: 24em;"> <p style="margin-left: 2em;"><?php - doc_list(_r('Installer'), 'installer', 3, '<a href="//doc.mageia.org/installer/3/%s/content/index.html">HTML</a>'); + doc_list(_r('Installer'), 'installer', 3); ?></p> </div> <div style="float: right; margin: 1em; width: 24em;"> <p style="margin-left: 2em;"><?php - doc_list(_r('Control Center'), 'control_center', 3, '<a href="//doc.mageia.org/mcc/3/%s/content/index.html">HTML</a>'); + doc_list(_r('Control Center'), 'control_center', 3); ?></p> </div> <hr style="clear: both;"> <h3>Mageia 2</h3> <div style="float: left; margin: 2em;"> <p><?php - doc_list(_r('Installer'), 'installer', 2, '<a href="//doc.mageia.org/installer/2/%s/content/index.html">HTML</a>'); + doc_list(_r('Installer'), 'installer', 2); ?></p> </div> </div> diff --git a/en/doc/doc.php b/en/doc/doc.php index 285c43dec..ddcb016a9 100644 --- a/en/doc/doc.php +++ b/en/doc/doc.php @@ -11,67 +11,105 @@ $documentation['control_center'][3] = array('en','et','fr'); $documentation['installer' ][2] = array('de','el','en','eo','fr','nl','pt_br','uk'); +$defs = parse_ini_file('../downloads/get/definitions_doc.ini', true); + +function pdf_epub_present_in_locale($doc_name, $lang, $extension) +{ + global $defs; + + $eng_file_name = sprintf('%s_en_%s', $doc_name, $extension); + if(array_key_exists($eng_file_name, $defs)) { + $langs = explode('|', $defs[$eng_file_name]['langs']); + if (in_array($lang, $langs)) { + return TRUE; + } + } + return FALSE; +} + function doc_present_in_locale($documentation_name, $version) { global $locale; global $documentation; $link_locale = locale_hyphen_underscore($locale); // create pt_br.po from pt-br and alike - if(in_array($link_locale, $documentation[$documentation_name][$version])) { + if (in_array($link_locale, $documentation[$documentation_name][$version])) { return $link_locale; } else { return 'en'; } } -function doc_list($documentation_name, $type, $version, $link, $epub_link = null, $pdf_link = null) +function doc_list($documentation_name, $type, $version) { global $locale; global $langs; global $documentation; + + if ('control_center' == $type) { + $dir = 'mcc'; + $name = 'MCC'; + $title = _r('Control Center'); + } else if ('installer' == $type) { + $dir = 'installer'; + $name = 'DrakX'; + $title = _r('Installer'); + } else { + return; // proper $type not defined ;) + } + + $doc_link = sprintf('<a href="//doc.mageia.org/%s/%s/%s/content/index.html">%s</a>', $dir, $version, '%s', '%s'); + $pdf_link = sprintf('<a rel="nofollow" href="../downloads/get/?q=Mageia%s-%s-%s-pdf&doc=yes" title="Mageia %s PDF">PDF</a>', $version, $name, '%s', $title); + $epub_link = sprintf('<a rel="nofollow" href="../downloads/get/?q=Mageia%s-%s-%s-epub&doc=yes" title="Mageia %s EPUB">EPUB</a>', $version, $name, '%s', $title); + $link_locale = locale_hyphen_underscore($locale); // create pt_br.po from pt-br and alike $your_language = ''; - $others = ''; + $others = array(); $text_others = ''; $your_language_present = FALSE; $other_languages_present = FALSE; $note_printed = FALSE; - // temporary hidding of the EPUB and PDF links - $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; foreach ($documentation[$type][$version] as $lng) { // hopefully temporary exception for pt-br as convention for lang-abbrev in /langs.inc.php is different as link in doc.mageia.org - if ($lng == 'pt_br') { - $lng_name = $langs['pt-br']; - } else { - $lng_name = $langs[$lng]; + $lng_name = $langs[locale_underscore_to_hyphen($lng)]; + + $pdf_present = pdf_epub_present_in_locale(sprintf('Mageia%s_%s', $version, $name), $lng, 'pdf'); + $epub_present = pdf_epub_present_in_locale(sprintf('Mageia%s_%s', $version, $name), $lng, 'epub'); + $pdf_epub_links = array(); + if ($pdf_present) { + $pdf_epub_links[] = sprintf($pdf_link, $lng); + } + if ($epub_present) { + $pdf_epub_links[] = sprintf($epub_link, $lng); } + $pdf_epub_links = implode(', ', $pdf_epub_links); + $lang_doc_link = sprintf($doc_link, $lng, $lng_name); if ($link_locale == $lng) { $your_language_present = TRUE; - if (is_null($epub_link) or is_null($pdf_link) or $hide_epub_pdf) { - $your_language = sprintf(_r('%s available in %s') . '<br/>%s', - '<span style="font-weight:bold">' . $documentation_name . '</span>', $lng_name, sprintf($link, $lng)); + if (!$pdf_present && !$epub_present) { + $your_language = sprintf(_r('Online manual for %s available in %s') . '<br/>', + '<span style="font-weight:bold">' . $documentation_name . '</span>', $lang_doc_link); } else { - $your_language = sprintf(_r('%s available in %s') . '<br/>%s <span style="font-size: 07pt;">('. - _r('also as') . ' %s, %s)</span>', + $your_language = sprintf(_r('Online manual for %s available in %s') . '<br/> <span style="font-size: 07pt;">('. + _r('also as file:') . ' %s)</span>', '<span style="font-weight:bold">' . $documentation_name . '</span>', - $lng_name, sprintf($link, $lng), sprintf($epub_link, $lng), sprintf($pdf_link, $lng)); + $lang_doc_link, $pdf_epub_links); } } else { $other_languages_present = TRUE; - if (is_null($epub_link) or is_null($pdf_link) or $hide_epub_pdf) { - $others[] = sprintf('%s<br/>%s', $lng_name, sprintf($link, $lng)); + if (!$pdf_present && !$epub_present) { + $others[] = $lang_doc_link; } else { if(!$note_printed) { - $note = _r('also as') . ' '; + $note = _r('also as file:', ' '); $note_printed = TRUE; } else { $note = ''; } - $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)); + $others[] = sprintf('%s <span style="font-size: 07pt;">(%s%s)</span>', + $lang_doc_link, $note, $pdf_epub_links, $lang_doc_link); } } } @@ -89,7 +127,7 @@ function doc_list($documentation_name, $type, $version, $link, $epub_link = null if($single_version < $version && in_array($link_locale, $all_languages)) { $language_present_before = "\t\t<tr><td>" . sprintf(_r('Translation was present in %s before.<br/>Maybe you can check documentation for %s in Mageia %s.'), - $langs[$locale], $documentation_name, $single_version) . "</td></tr>" . PHP_EOL; + $lng_name, $documentation_name, $single_version) . "</td></tr>" . PHP_EOL; break; } else { $language_present_before = ''; diff --git a/en/doc/index.php b/en/doc/index.php index fe7e68f22..2730d5bce 100644 --- a/en/doc/index.php +++ b/en/doc/index.php @@ -32,35 +32,19 @@ require 'doc.php'; <hr> <h3>Mageia 5</h3> <div style="float: left; margin: 1em; width: 24em;"> - <p style="margin-left: 2em;"><?php - doc_list(_r('Installer'), 'installer', 5, '<a href="//doc.mageia.org/installer/5/%s/content/index.html">HTML</a>'); -# doc_list(_r('Installer'), 'installer', 5, '<a href="//doc.mageia.org/installer/5/%s/content/index.html">HTML</a>', -# '<a rel="nofollow" href="../downloads/get/?q=Mageia5-DrakX-%s-epub&doc=yes" title="Mageia installer EPUB">EPUB</a>', -# '<a rel="nofollow" href="../downloads/get/?q=Mageia5-DrakX-%s-pdf&doc=yes" title="Mageia installer PDF">PDF</a>'); - ?></p> + <p style="margin-left: 2em;"><?php doc_list(_r('Installer'), 'installer', 5); ?></p> </div> <div style="float: right; margin: 1em; width: 24em;"> - <p style="margin-left: 2em;"><?php - doc_list(_r('Control Center'), 'control_center', 5, '<a href="//doc.mageia.org/mcc/5/%s/content/index.html">HTML</a>'); -# doc_list(_r('Control Center'), 'control_center', 5, '<a href="//doc.mageia.org/mcc/5/%s/content/index.html">HTML</a>', -# '<a rel="nofollow" href="../downloads/get/?q=Mageia5-MCC-%s-epub&doc=yes" title="Mageia MCC EPUB">EPUB</a>', -# '<a rel="nofollow" href="../downloads/get/?q=Mageia5-MCC-%s-pdf&doc=yes" title="Mageia MCC PDF">PDF</a>'); - ?></p> + <p style="margin-left: 2em;"><?php doc_list(_r('Control Center'), 'control_center', 5); ?></p> </div> <hr style="clear: both;"> <h3>Mageia 4</h3> <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 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 style="margin-left: 2em;"><?php doc_list(_r('Installer'), 'installer', 4); ?></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 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 style="margin-left: 2em;"><?php doc_list(_r('Control Center'), 'control_center', 4); ?></p> </div> </div> |