Convert to use single template

This commit is contained in:
Miles Lott 2001-05-11 13:43:05 +00:00
parent 722a99ac33
commit eb379e5ec6
4 changed files with 99 additions and 90 deletions

View File

@ -11,87 +11,98 @@
/* $Id$ */
$phpgw_info = array();
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True);
include("../header.inc.php");
$phpgw_info = array();
$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",
"row_2" => "mainscreen_message_row_2.tpl"
));
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array('message' => 'mainscreen_message.tpl'));
$p->set_block('message','form','form');
$p->set_block('message','row','row');
$p->set_block('message','row_2','row_2');
if ($submit) {
$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>".lang("message has been updated")."</center>";
}
if (! isset($select_lang)) {
$phpgw->template->set_var("header_lang",lang("Main screen message"));
$phpgw->template->set_var("form_action",$phpgw->link("/admin/mainscreen_message.php"));
$phpgw->template->set_var("tr_color",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("value","&nbsp;");
$phpgw->template->parse("rows","row_2",True);
if ($submit)
{
$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>".lang("message has been updated")."</center>";
}
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$phpgw->template->set_var("tr_color",$tr_color);
if (! isset($select_lang))
{
$p->set_var("header_lang",lang("Main screen message"));
$p->set_var("form_action",$phpgw->link("/admin/mainscreen_message.php"));
$p->set_var("tr_color",$phpgw_info["theme"]["th_bg"]);
$p->set_var("value","&nbsp;");
$p->parse("rows","row_2",True);
$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);
$p->set_var("tr_color",$tr_color);
$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);
$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>';
$p->set_var("label",lang("Language"));
$p->set_var("value",$select_lang);
$p->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);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->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>';
$p->set_var("label",lang("Section"));
$p->set_var("value",$select_section);
$p->parse("rows","row",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");
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->set_var("tr_color",$tr_color);
$p->set_var("value",'<input type="submit" value="' . lang("Submit") . '">');
$p->parse("rows","row_2",True);
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("/admin/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">' . stripslashes($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_2",True);
}
$phpgw->template->set_var("error_message",$message);
$phpgw->template->pparse("out","form");
$phpgw->common->phpgw_footer();
}
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")
{
$p->set_var("header_lang",lang("Edit main screen message"));
}
else
{
$p->set_var("header_lang",lang("Edit login screen message"));
}
$p->set_var("form_action",$phpgw->link("/admin/mainscreen_message.php","select_lang=$select_lang&section=$section"));
$p->set_var("tr_color",$phpgw_info["theme"]["th_bg"]);
$p->set_var("value","&nbsp;");
$p->parse("rows","row_2",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->set_var("tr_color",$tr_color);
$p->set_var("value",'<textarea name="message" cols="50" rows="10" wrap="hard">' . stripslashes($current_message) . '</textarea>');
$p->parse("rows","row_2",True);
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->set_var("tr_color",$tr_color);
$p->set_var("value",'<input type="submit" name="submit" value="' . lang("Update") . '">');
$p->parse("rows","row_2",True);
}
$p->set_var("error_message",$message);
$p->pparse("out","form");
$phpgw->common->phpgw_footer();
?>

View File

@ -1,4 +1,3 @@
<!-- BEGIN form -->
<p><b>{header_lang}</b><hr>
@ -12,4 +11,16 @@
</table>
</form>
<!-- END form -->
<!-- BEGIN row -->
<tr bgcolor="{tr_color}">
<td>{label}</td>
<td align="center">{value}</td>
</tr>
<!-- END row -->
<!-- BEGIN row_2 -->
<tr bgcolor="{tr_color}">
<td colspan="2" align="center">{value}</td>
</tr>
<!-- END row_2 -->

View File

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

View File

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