added a (optional) language-select-box, eg. for demo-sites

This commit is contained in:
Ralf Becker 2004-03-21 21:20:05 +00:00
parent 3dc254c6ee
commit 1a4e00bd63
2 changed files with 32 additions and 3 deletions

View File

@ -216,6 +216,11 @@
}
else
{
if ($_POST['lang'] && preg_match('/^[a-z]{2}(-[a-z]{2}){0,1}$/',$_POST['lang']) &&
$_POST['lang'] != $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'])
{
$GLOBALS['phpgw']->preferences->add('common','lang',$_POST['lang'],'session');
}
$forward = get_var('phpgw_forward', array('GET', 'POST'), 0);
if($forward)
{
@ -369,6 +374,26 @@
$var['logo_title'] = $GLOBALS['phpgw_info']['server']['login_logo_title']?$GLOBALS['phpgw_info']['server']['login_logo_title']:'www.eGroupWare.org';
$tmpl->set_var($var);
if (@$GLOBALS['phpgw_info']['server']['login_show_language_selection'])
{
$select_lang = '<select name="lang">';
$langs = $GLOBALS['phpgw']->translation->get_installed_langs();
foreach ($langs as $key => $name) // if we have a translation use it
{
$select_lang .= "\n\t".'<option value="'.$key.'"'.($key == $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] ? ' selected="1"' : '').'>'.$name.'</option>';
}
$select_lang .= "\n</select>\n";
$tmpl->set_var(array(
'lang_language' => lang('Language'),
'select_language' => $select_lang,
));
}
else
{
$tmpl->set_block('login_form','language_select');
$tmpl->set_var('language_select','');
}
$tmpl->set_var('autocomplete', ($GLOBALS['phpgw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : ''));
$tmpl->pfp('loginout','login_form');

View File

@ -97,10 +97,14 @@
<td align="left"><input name="passwd" type="password" onChange="this.form.submit()" style="width: 100px; border: 1px solid silver;"></td>
<td>&nbsp;</td>
</tr>
<!-- BEGIN language_select -->
<tr>
<td colspan="3" align="center">
&nbsp;
</td>
<td align="right">{lang_language}:&nbsp;</td>
<td align="left" colspan="2">{select_language}</td>
</tr>
<!-- END language_select -->
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center">