|
21 | 21 | $css_include = $base_css; |
22 | 22 | } |
23 | 23 |
|
24 | | -$links = ' |
| 24 | +/* |
| 25 | + This is a closure to build a list item containing the |
| 26 | + link to the page. The page we are on gets a CSS class |
| 27 | + of selected_view added. |
| 28 | +*/ |
| 29 | +$li_link = function ($page, $title, $text) use ($url, $urls) { |
| 30 | + $link = array_search($page, $urls); |
| 31 | + |
| 32 | + if ($link != '/') { |
| 33 | + $link = "/{$link}/"; |
| 34 | + } |
| 35 | + |
| 36 | + return '<li><a ' . ($url['path'] == $link ? 'class="selected_view" ' : '') |
| 37 | + . 'href="' . $link . '" ' |
| 38 | + . 'title="' . $title . '">' |
| 39 | + . $text . '</a></li>'; |
| 40 | +}; |
| 41 | + |
| 42 | +/* |
| 43 | + The t2t page is a legacy page without an entry in the $urls array. |
| 44 | +*/ |
| 45 | +$li_t2t = '<li><a ' . (isset($_GET['t2t']) ? 'class="selected_view" ' : '') |
| 46 | + . 'href="/?sourcelocale=' . $source_locale . '&locale=' . $locale |
| 47 | + . '&repo=' . $check['repo'] . '&t2t=t2t&recherche=' |
| 48 | + . Utils::secureText($initial_search) |
| 49 | + . '" title="Search in the Glossary">Glossary</a></li>'; |
| 50 | + |
| 51 | +$links = <<<EOT |
25 | 52 | <div class="linkscolumn"> |
26 | 53 | <h3>Main Views</h3> |
27 | 54 | <ul> |
28 | | - <li><a href="/" title="Main search">Home</a></li> |
29 | | - <li><a ' . (isset($_GET['t2t']) ? 'class="selected_view" ' : '') . 'href="/?sourcelocale=' . $source_locale . '&locale=' . $locale . '&repo=' . $check['repo'] . '&t2t=t2t&recherche=' . Utils::secureText($initial_search) . '" title="Search in the Glossary">Glossary</a></li> |
30 | | - <li><a ' . ($url['path'] == '3locales' ? 'class="selected_view" ' : '') . 'href="/3locales/" title="Search with 3 locales">3 locales</a></li> |
31 | | - <li><a ' . ($url['path'] == 'downloads' ? 'class="selected_view" ' : '') . 'href="/downloads/" title="Download TMX files">TMX Download</a></li> |
| 55 | + {$li_link('root', 'Main search', 'Home')} |
| 56 | + {$li_link('3locales', 'Search with 3 locales', '3 locales')} |
| 57 | + {$li_t2t} |
| 58 | + {$li_link('downloads', 'Download TMX files', 'TMX Download')} |
32 | 59 | </ul> |
33 | 60 | </div> |
34 | 61 | <div class="linkscolumn" id="qa_column"> |
35 | 62 | <h3>QA Views</h3> |
36 | 63 | <ul> |
37 | | - <li><a ' . ($url['path'] == 'accesskeys' ? 'class="selected_view" ' : '') . 'href="/accesskeys/" title="Check your access keys">Access Keys</a></li> |
38 | | - <li><a ' . ($url['path'] == 'variables' ? 'class="selected_view" ' : '') . 'href="/variables/" title="Check what variable differences there are from English">Check Variables</a></li> |
39 | | - <li><a ' . ($url['path'] == 'consistency' ? 'class="selected_view" ' : '') . 'href="/consistency/" title="Translation Consistency">Translation Consistency</a></li> |
40 | | - <li><a ' . ($url['path'] == 'unchanged_strings' ? 'class="selected_view" ' : '') . 'href="/unchanged/" title="Display all strings identical to English">Unchanged Strings</a></li> |
41 | | - <li><a ' . ($url['path'] == 'unlocalized_words' ? 'class="selected_view" ' : '') . 'href="/unlocalized/" title="Display common words remaining in English">Unlocalized Words</a></li> |
| 64 | + {$li_link('keys', 'Check your access keys', 'Access Keys')} |
| 65 | + {$li_link('checkvariables', 'Check what variable differences there are from English', 'Check Variables')} |
| 66 | + {$li_link('consistency', 'Translation Consistency', 'Translation Consistency')} |
| 67 | + {$li_link('unchangedstrings', 'Display all strings identical to English', 'Unchanged Strings')} |
| 68 | + {$li_link('unlocalized', 'Display common words remaining in English', 'Unlocalized Words')} |
42 | 69 | </ul> |
43 | 70 | <ul> |
44 | | - <li><a ' . ($url['path'] == 'channelcomparison' ? 'class="selected_view" ' : '') . 'href="/channelcomparison/" title="Compare strings from channel to channel">Channel Comparison</a></li> |
45 | | - <li><a ' . ($url['path'] == 'gaia' ? 'class="selected_view" ' : '') . 'href="/gaia/" title="Compare strings across Gaia channels">Gaia Comparison</a></li> |
46 | | - <li><a ' . ($url['path'] == 'showrepos' ? 'class="selected_view" ' : '') . 'href="/showrepos/" title="Check the health status of locales">Health Status Overview</a></li> |
47 | | - <li><a ' . ($url['path'] == 'productization' ? 'class="selected_view" ' : '') . 'href="/productization/" title="Show productization aspects">Productization</a></li> |
| 71 | + {$li_link('channelcomp', 'Compare strings betwen channels', 'Channel Comparison')} |
| 72 | + {$li_link('gaia', 'Compare strings across Gaia channels', 'Gaia Comparison')} |
| 73 | + {$li_link('showrepos', 'Check the health status of locales', 'Health Status Overview')} |
| 74 | + {$li_link('productization', 'Show productization aspects', 'Productization')} |
48 | 75 | </ul> |
49 | 76 | </div> |
50 | 77 | <div class="linkscolumn"> |
51 | 78 | <h3>About Transvision</h3> |
52 | 79 | <ul> |
53 | | - <li><a ' . ($url['path'] == 'credits' ? 'class="selected_view" ' : '') . 'href="/credits/" title="Transvision Credits page">Credits</a></li> |
54 | | - <li><a ' . ($url['path'] == 'news' ? 'class="selected_view" ' : '') . 'href="/news/" title="Changelog">Release Notes</a></li> |
55 | | - <li><a ' . ($url['path'] == 'stats' ? 'class="selected_view" ' : '') . 'href="/stats/" title="Light usage statistics">Statistics</a></li> |
| 80 | + {$li_link('credits', 'Transvision Credits page', 'Credits')} |
| 81 | + {$li_link('changelog', 'Release Notes', 'Release Notes')} |
| 82 | + {$li_link('stats', 'Light usage statistics', 'Statistics')} |
56 | 83 | </ul> |
57 | 84 | </div> |
58 | | -'; |
| 85 | +EOT; |
59 | 86 |
|
60 | 87 | $title_productname = BETA_VERSION ? 'Transvision Beta' : 'Transvision'; |
61 | 88 |
|
|
0 commit comments