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

Unified Diff: anwiki/_override/actions/action_view/action_view.tpl.php

Issue 9148089: Less hacky implementation of the language selection (Closed)
Patch Set: Created Jan. 9, 2013, 1:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: anwiki/_override/actions/action_view/action_view.tpl.php
===================================================================
--- a/anwiki/_override/actions/action_view/action_view.tpl.php
+++ b/anwiki/_override/actions/action_view/action_view.tpl.php
@@ -12,80 +12,13 @@ class AnwTemplateOverride_action_view ex
$content
</div>
EOF;
return $HTML;
}
function pageTranslations($aoTranslations)
{
- $languages = $this->getLanguages($aoTranslations);
- $currentLanguage = array_shift($languages);
- $currentLang = $currentLanguage['lang'];
- $currentText = $currentLanguage['text'];
-
- $HTML = <<<EOF
-
-{{#LANGUAGESELECTION}}
-<li id="language">
- <div id="current-language">
- <div id="flag-$currentLang" class="flag sprite"></div><span>$currentText</span>
- <span id="language-arrow" class="sprite"></span>
- </div>
- <ul id="language-selector">
-EOF;
-
- foreach ($languages as $language)
- {
- $url = $language['url'];
- $linkStyle = $language['linkStyle'];
- $lang = $language['lang'];
- $text = $language['text'];
-
- $HTML .= <<<EOF
-
- <li class="language-entry"><a href="$url" style="$linkStyle"><div id="flag-$lang" class="flag sprite"></div>$text</a></li>
-EOF;
- }
-
- $HTML .= <<<EOF
-
- </ul>
-</li>
-{{/LANGUAGESELECTION}}
-EOF;
- return $HTML;
- }
-
- private function getLanguages($aoTranslations)
- {
- $languages = array();
-
- foreach ($aoTranslations as $amInfo)
- {
- $oPage = $amInfo['page'];
- $bCurrent = $amInfo['current'];
- $sLang = $this->xQuote($oPage->getLang());
- $sLinkStyle = $amInfo['online'] ? '' : ' text-decoration:line-through;';
- $sText = $this->xText(self::g_('lang_' . $sLang, array(),
- AnwAction::getActionLang()));
-
- $entry = array("lang" => $sLang, "linkStyle" => $sLinkStyle,
- "text" => $sText);
-
- if ($bCurrent)
- array_unshift($languages, $entry);
- else
- {
- $asParams = $_GET;
- unset($asParams[AnwActionPage::GET_PAGENAME]); //avoid loop
- unset($asParams['browser']);
- $sUrl = AnwUtils::link($oPage, "view", $asParams);
- $entry['url'] = $this->xQuote($sUrl);
- array_push($languages, $entry);
- }
- }
-
- return $languages;
+ return "";
}
}
?>

Powered by Google App Engine
This is Rietveld