Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: anwiki/_override/contentclasses/contentclass_menu/contentclass_menu.tpl.php

Issue 9148089: Less hacky implementation of the language selection (Closed)
Left Patch Set: Created Jan. 9, 2013, 1:31 p.m.
Right Patch Set: Created Jan. 9, 2013, 1:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « anwiki/_override/actions/action_view/action_view.tpl.php ('k') | anwiki/_override/global/global/global.tpl.php » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 <?php 1 <?php
2 2
3 class AnwTemplateOverride_contentclass_menu extends AnwTemplateDefault_contentcl ass_menu 3 class AnwTemplateOverride_contentclass_menu extends AnwTemplateDefault_contentcl ass_menu
4 { 4 {
5 private $firstItem; 5 private $firstItem;
6 6
7 function openMenu() 7 function openMenu()
8 { 8 {
9 $this->firstItem = true; 9 $this->firstItem = true;
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 private function getLanguages() 80 private function getLanguages()
81 { 81 {
82 $languages = array(); 82 $languages = array();
83 83
84 $currentPageName = AnwActionPage::getCurrentPageName(); 84 $currentPageName = AnwActionPage::getCurrentPageName();
85 if (!AnwPage::isValidPageName($currentPageName)) 85 if (!AnwPage::isValidPageName($currentPageName))
86 return $languages; 86 return $languages;
87 87
88 $currentPage = new AnwPageByName($currentPageName); 88 $currentPage = new AnwPageByName($currentPageName);
89 if (!$currentPage->exists())
90 return $languages;
91
89 $pages = $currentPage->getPageGroup()->getPages(); 92 $pages = $currentPage->getPageGroup()->getPages();
90 $translationThreshold = AnwComponent::globalCfgViewUntranslatedMinpercent(); 93 $translationThreshold = AnwComponent::globalCfgViewUntranslatedMinpercent();
91 foreach ($pages as $page) 94 foreach ($pages as $page)
92 { 95 {
93 if ($page->isActionAllowed('view')) 96 if ($page->isActionAllowed('view'))
94 { 97 {
95 $current = ($page->getName() == $currentPageName); 98 $current = ($page->getName() == $currentPageName);
96 $online = ($page->getTranslatedPercent() >= $translationThreshold); 99 $online = ($page->getTranslatedPercent() >= $translationThreshold);
97 $linkStyle = ($online ? '' : ' style="text-decoration:line-through;"'); 100 $linkStyle = ($online ? '' : ' style="text-decoration:line-through;"');
98 $lang = $this->xQuote($page->getLang()); 101 $lang = $this->xQuote($page->getLang());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 function closeMenu() 170 function closeMenu()
168 { 171 {
169 $HTML = <<<EOF 172 $HTML = <<<EOF
170 </ul> 173 </ul>
171 EOF; 174 EOF;
172 return $HTML; 175 return $HTML;
173 } 176 }
174 } 177 }
175 178
176 ?> 179 ?>
LEFTRIGHT

Powered by Google App Engine
This is Rietveld