From 9ab5005680149eba5de03944624685ee89cbd940 Mon Sep 17 00:00:00 2001 From: jengo Date: Tue, 28 Nov 2000 19:54:10 +0000 Subject: [PATCH] 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 --- admin/mainscreen_message.php | 91 +++++++++++++++---- .../templates/default/mainscreen_message.tpl | 17 ++-- .../default/mainscreen_message_row.tpl | 5 +- .../default/mainscreen_message_row_2.tpl | 6 ++ index.php | 7 +- login.php | 37 +++----- 6 files changed, 103 insertions(+), 60 deletions(-) create mode 100644 admin/templates/default/mainscreen_message_row_2.tpl diff --git a/admin/mainscreen_message.php b/admin/mainscreen_message.php index 93084d407d..321b0dc08f 100644 --- a/admin/mainscreen_message.php +++ b/admin/mainscreen_message.php @@ -2,9 +2,6 @@ /**************************************************************************\ * phpGroupWare - administration * * http://www.phpgroupware.org * - * Written by Joseph Engo * - * Modified by Stephen Brown * - * 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 * @@ -18,29 +15,83 @@ $phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True); include("../header.inc.php"); - $phpgw->template->set_file(array("form" => "mainscreen_message.tpl", - "row" => "mainscreen_message_row.tpl")); + $phpgw->template->set_file(array("form" => "mainscreen_message.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 = "
Message has been updated
"; } - $phpgw->template->set_var("header_lang",lang("Edit 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"]); + 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("tr_color",$phpgw_info["theme"]["th_bg"]); + $phpgw->template->set_var("value"," "); + $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",''); - $phpgw->template->parse("rows","row",True); + $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $phpgw->template->set_var("tr_color",$tr_color); - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $phpgw->template->set_var("tr_color",$tr_color); - $phpgw->template->set_var("value",''); - $phpgw->template->parse("rows","row",True); - + $select_lang = ''; + $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 = ''; + $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",''); + $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§ion=$section")); + $phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]); + $phpgw->template->set_var("value"," "); + $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",''); + $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",''); + $phpgw->template->parse("rows","row_2",True); + } + $phpgw->template->set_var("error_message",$message); $phpgw->template->pparse("out","form"); + ?> \ No newline at end of file diff --git a/admin/templates/default/mainscreen_message.tpl b/admin/templates/default/mainscreen_message.tpl index 8fecd91aba..5437f2d595 100644 --- a/admin/templates/default/mainscreen_message.tpl +++ b/admin/templates/default/mainscreen_message.tpl @@ -1,16 +1,15 @@ -

{header_lang}


+

{header_lang}


+ +{error_message}

- - - - - {rows} -
 
-
- + + {rows} + +
+ \ No newline at end of file diff --git a/admin/templates/default/mainscreen_message_row.tpl b/admin/templates/default/mainscreen_message_row.tpl index 124fa32ae7..e534ad452f 100644 --- a/admin/templates/default/mainscreen_message_row.tpl +++ b/admin/templates/default/mainscreen_message_row.tpl @@ -1,6 +1,7 @@ - - {value} + + {label} + {value} diff --git a/admin/templates/default/mainscreen_message_row_2.tpl b/admin/templates/default/mainscreen_message_row_2.tpl new file mode 100644 index 0000000000..3bd40c8795 --- /dev/null +++ b/admin/templates/default/mainscreen_message_row_2.tpl @@ -0,0 +1,6 @@ + + + + {value} + + diff --git a/index.php b/index.php index c7e4f37fba..d50b41b49b 100755 --- a/index.php +++ b/index.php @@ -46,9 +46,10 @@ . "
" . lang("It is recommend that you run setup to upgrade your tables to the current version") . ""; } - - if (isset($phpgw_info["server"]["mainscreen_message"])) { - echo "
" . $phpgw_info["server"]["mainscreen_message"] . "
"; + + $phpgw->translation->add_app("mainscreen"); + if (lang("mainscreen_message") != "mainscreen_message*") { + echo "
" . lang("mainscreen_message") . "
"; } if ((isset($phpgw_info["user"]["apps"]["admin"]) && diff --git a/login.php b/login.php index 1c0970d711..a4c6ae269a 100755 --- a/login.php +++ b/login.php @@ -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"]."
"; -// $phpgw->translation->add_app("login"); + $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("lang_message",""); } } -/* 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 = '"; - $tmpl->set_var("domain_input",$domains_select); - $tmpl->parse("domain_row_out","domain_row"); - } else { - $tmpl->set_var("domain_input",''); - $tmpl->parse("domain_row_out","domain_row"); - } - } else { - $tmpl->set_var("domain_row",""); - $tmpl->parse("null","domain_row"); - } -*/ if(!isset($cd) || !$cd) $cd="";