Added in optional login screen message that admins can set. Cleaned up mainscreen message and loginscreen message to allow support from differenet languagues

.  Fixed login.php not using multilang support
This commit is contained in:
jengo 2000-11-28 19:54:10 +00:00
parent 3f2b17c2db
commit 9ab5005680
6 changed files with 103 additions and 60 deletions

View File

@ -2,9 +2,6 @@
/**************************************************************************\
* phpGroupWare - administration *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* Modified by Stephen Brown <steve@dataclarity.net> *
* to distribute admin across the application directories *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@ -19,28 +16,82 @@
include("../header.inc.php");
$phpgw->template->set_file(array("form" => "mainscreen_message.tpl",
"row" => "mainscreen_message_row.tpl"));
"row" => "mainscreen_message_row.tpl",
"row_2" => "mainscreen_message_row_2.tpl"
));
if ($submit) {
$phpgw->db->query("delete from config where config_name='mainscreen_message'",__LINE__,__FILE__);
$phpgw->db->query("insert into config values ('mainscreen_message','" . addslashes($message)
. "')",__LINE__,__FILE__);
$phpgw->db->query("delete from lang where message_id='$section" . "_message' and app_name='"
. "$section' and lang='$select_lang'",__LINE__,__FILE__);
$phpgw->db->query("insert into lang values ('$section" . "_message','$section','$select_lang','"
. addslashes($message) . "')",__LINE__,__FILE__);
$message = "<center>Message has been updated</center>";
}
$phpgw->template->set_var("header_lang",lang("Edit main screen message"));
if (! isset($select_lang)) {
$phpgw->template->set_var("header_lang",lang("Main screen message"));
$phpgw->template->set_var("form_action",$phpgw->link("mainscreen_message.php"));
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("value","&nbsp;");
$phpgw->template->parse("rows","row_2",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
$phpgw->template->set_var("value",'<textarea name="message" cols="50" rows="10" wrap="hard">' . $phpgw_info["server"]["mainscreen_message"] . '</textarea>');
$select_lang = '<select name="select_lang">';
$phpgw->db->query("select lang,languages.lang_name,languages.lang_id from lang,languages where "
. "lang.lang=languages.lang_id group by lang,languages.lang_name,"
. "languages.lang_id order by lang");
while ($phpgw->db->next_record()) {
$select_lang .= '<option value="' . $phpgw->db->f("lang") . '">' . $phpgw->db->f("lang_id")
. ' - ' . $phpgw->db->f("lang_name") . '</option>';
}
$select_lang .= '</select>';
$phpgw->template->set_var("label",lang("Language"));
$phpgw->template->set_var("value",$select_lang);
$phpgw->template->parse("rows","row",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
$select_section = '<select name="section"><option value="mainscreen">' . lang("Main screen")
. '</option><option value="loginscreen">' . lang("Login screen") . '</option>'
. '</select>';
$phpgw->template->set_var("label",lang("Section"));
$phpgw->template->set_var("value",$select_section);
$phpgw->template->parse("rows","row",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
$phpgw->template->set_var("value",'<input type="submit" value="' . lang("Submit") . '">');
$phpgw->template->parse("rows","row_2",True);
} else {
$phpgw->db->query("select content from lang where lang='$select_lang' and message_id='$section"
. "_message'");
$phpgw->db->next_record();
$current_message = $phpgw->db->f("content");
if ($section == "mainscreen") {
$phpgw->template->set_var("header_lang",lang("Edit main screen message"));
} else {
$phpgw->template->set_var("header_lang",lang("Edit login screen message"));
}
$phpgw->template->set_var("form_action",$phpgw->link("mainscreen_message.php","select_lang=$select_lang&section=$section"));
$phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("value","&nbsp;");
$phpgw->template->parse("rows","row_2",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
$phpgw->template->set_var("value",'<textarea name="message" cols="50" rows="10" wrap="hard">' . $current_message . '</textarea>');
$phpgw->template->parse("rows","row_2",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
$phpgw->template->set_var("value",'<input type="submit" name="submit" value="' . lang("Update") . '">');
$phpgw->template->parse("rows","row",True);
$phpgw->template->parse("rows","row_2",True);
}
$phpgw->template->set_var("error_message",$message);
$phpgw->template->pparse("out","form");
?>

View File

@ -1,16 +1,15 @@
<!-- BEGIN form -->
<p><b>{header_lang}</b><hr><p>
<p><b>{header_lang}</b><hr>
{error_message}<p>
<form method="POST" action="{form_action}">
<table border="0" align="center">
<tr>
<td bgcolor="{th_bg}">&nbsp;</td>
</tr>
<table border="0" align="center" width="60%">
{rows}
</table>
</form>
<!-- END form -->

View File

@ -1,6 +1,7 @@
<!-- BEGIN row -->
<tr>
<td align="center" bgcolor="{tr_color}">{value}</td>
<tr bgcolor="{tr_color}">
<td>{label}</td>
<td align="center">{value}</td>
</tr>
<!-- END row -->

View File

@ -0,0 +1,6 @@
<!-- BEGIN row_2 -->
<tr bgcolor="{tr_color}">
<td colspan="2" align="center">{value}</td>
</tr>
<!-- END row_2 -->

View File

@ -47,8 +47,9 @@
. "</b>";
}
if (isset($phpgw_info["server"]["mainscreen_message"])) {
echo "<center>" . $phpgw_info["server"]["mainscreen_message"] . "</center>";
$phpgw->translation->add_app("mainscreen");
if (lang("mainscreen_message") != "mainscreen_message*") {
echo "<center>" . lang("mainscreen_message") . "</center>";
}
if ((isset($phpgw_info["user"]["apps"]["admin"]) &&

View File

@ -94,36 +94,21 @@
}
} else {
// !!! DONT CHANGE THESE LINES !!!
// If there is something wrong with this code TELL ME!
// Commenting out the code will not fix it. (jengo)
if (isset($last_loginid)) {
// $phpgw->preferences->read_preferences("common",$last_loginid);
$phpgw->preferences->read_preferences("common",$last_loginid);
#print "LANG:".$phpgw_info["user"]["preferences"]["common"]["lang"]."<br>";
// $phpgw->translation->add_app("login");
}
}
/* This has been put on hold until 0.9.4pre1, we have a different method of doing it (jengo)
if ($phpgw_info["server"]["multiable_domains"]) {
$tmpl->set_var("lang_domain","Domain");
if ($phpgw_info["server"]["multiable_domains_use_select_box"]) {
$domains_select = '<select name="domain">';
$phpgw->db->query("select domain_id,domain_name from domains where domain_status='Active' "
. "order by domain_name");
while ($phpgw->db->next_record()) {
$domains_select .= '<option value="' . $phpgw->db->f("domain_id") . '">'
. $phpgw->db->f("domain_name") . '</option>';
}
$domains_select .= "</select>";
$tmpl->set_var("domain_input",$domains_select);
$tmpl->parse("domain_row_out","domain_row");
} else {
$tmpl->set_var("domain_input",'<input name="domain">');
$tmpl->parse("domain_row_out","domain_row");
$phpgw->translation->add_app("login");
$phpgw->translation->add_app("loginscreen");
if (lang("loginscreen_message") != "loginscreen_message*") {
$tmpl->set_var("lang_message",lang("loginscreen_message"));
}
} else {
$tmpl->set_var("domain_row","");
$tmpl->parse("null","domain_row");
$tmpl->set_var("lang_message","");
}
}
*/
if(!isset($cd) || !$cd) $cd="";