Commit e128eff8 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Reflect current language in the selector on the main page (bug #838650)"

parents d994afe7 1f23fe03
......@@ -412,9 +412,7 @@ EOF;
$smarty->assign('SELECTEDSUBNAV', $SELECTEDSUBNAV);
}
else {
$smarty->assign('sitedefaultlang', get_string('sitedefault', 'admin') . ' (' .
get_string_from_language(get_config('lang'), 'thislanguage') . ')');
$smarty->assign('LANGUAGES', get_languages());
$smarty->assign('languageform', language_select_form());
}
$smarty->assign('FOOTERMENU', footer_menu());
......@@ -3267,3 +3265,42 @@ function mahara_http_request($config) {
return $result;
}
/**
* Returns a language select form
*
* @return string HTML of language select form
*/
function language_select_form() {
global $SESSION;
$languageform = '';
$languages = get_languages();
if (count($languages) > 1) {
$languages = array_merge(array('default' => get_string('sitedefault', 'admin') . ' (' .
get_string_from_language(get_config('lang'), 'thislanguage') . ')'), $languages);
require_once('pieforms/pieform.php');
$languageform = pieform(array(
'name' => 'languageselect',
'renderer' => 'oneline',
'validate' => false,
'presubmitcallback' => '',
'elements' => array(
'lang' => array(
'type' => 'select',
'title' => get_string('language') . ':',
'options' => $languages,
'defaultvalue' => $SESSION->get('lang') ? $SESSION->get('lang') : 'default',
),
'changelang' => array(
'type' => 'submit',
'value' => get_string('change'),
)
)
));
}
return $languageform;
}
\ No newline at end of file
......@@ -286,7 +286,7 @@ input.submit, input.cancel, button, .buttondk, input.button, input.select, input
#header-right {
padding: 5px 0 0 10px;
}
#language-select label {
#languageselect label {
color: #FFFFFF;
}
/* Search and language bar */
......
......@@ -254,7 +254,7 @@ span.btn a.icon, a span.icon {
display: inline;
}
/* Search and language bar */
#language-select, #usf {
#languageselect, #usf {
font-size: .8333em !important;
}
#usf_query_container input {
......
......@@ -964,11 +964,11 @@ div.rbuttons .small-logo {
display: block;
}
/* Search and language bar */
#language-select {
#languageselect {
display: inline;
margin: 0 3px 0 20px;
}
#language-select label {
#languageselect label {
color: #333;
}
#usf {
......
......@@ -54,7 +54,7 @@ legend a:hover {
color: {$data.link};
}
#language-select label {
#languageselect label {
color: {$data.backgroundfg};
}
......
......@@ -8,18 +8,9 @@
<li class="btn-logout"><a href="{$WWWROOT}?logout" accesskey="l">{str tag="logout"}</a></li>
{/if}
{/strip}
{if !$nosearch && !$LOGGEDIN && (count($LANGUAGES) > 1)}
{if !$nosearch && !$LOGGEDIN && $languageform}
<li>
<form id="language-select" method="post" action="">
<label>{str tag=language}: </label>
<select name="lang">
<option value="default" selected="selected">{$sitedefaultlang}</option>
{foreach from=$LANGUAGES key=k item=i}
<option value="{$k}">{$i}</option>
{/foreach}
</select>
<input type="submit" class="submit" name="changelang" value="{str tag=change}">
</form>
{$languageform|safe}
</li>
{/if}
{if !$LOGGEDIN && !$SIDEBARS && !$LOGINPAGE} <li><a href="{$WWWROOT}?login" accesskey="l">{str tag="login"}</a></li> {/if}
......
......@@ -269,7 +269,7 @@ span.btn a.icon, a span.icon {
padding: 25px 25px 0 0
}
/* Search and language bar */
#language-select {
#languageselect {
margin: 0;
}
#usf {
......
......@@ -266,7 +266,7 @@ span.btn a.icon, a span.icon {
padding: 25px 25px 0 0
}
/* Search and language bar */
#language-select {
#languageselect {
margin: 0;
}
#usf {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment