Converted editapplication.php over to templates

This commit is contained in:
jengo 2000-08-20 02:56:02 +00:00
parent e6d27b6166
commit 6fa81f4c59
2 changed files with 30 additions and 28 deletions

View File

@ -17,6 +17,10 @@
$phpgw_flags["currentapp"] = "admin"; $phpgw_flags["currentapp"] = "admin";
include("../header.inc.php"); include("../header.inc.php");
$t = new Template($phpgw_info["server"]["template_dir"]);
$t->set_file(array("form" => "application_form.tpl"));
if ($submit) { if ($submit) {
if (! $n_app_name || ! $n_app_title) { if (! $n_app_name || ! $n_app_title) {
$error = lang_admin("You must enter an application name and title."); $error = lang_admin("You must enter an application name and title.");
@ -37,37 +41,28 @@
$phpgw->common->navbar(); $phpgw->common->navbar();
} }
echo "<p>" . lang_admin("Edit application") . "<hr>"; $t->set_var("lang_header",lang_admin("Add new application"));
if ($error) { if ($error) {
echo "<p><center>$error</center><br>"; $t->set_var("error","<p><center>$error</center><br>");
} else {
$t->set_var("error","");
} }
$t->set_var("session_hidden_var",$phpgw->session->hidden_var()
. '<input type="hidden" name="old_app_name" value="'
. $phpgw->db->f("app_name") . '">');
?> $t->set_var("form_action","editapplication.php");
<form action="editapplication.php"> $t->set_var("lang_app_name",lang_admin("application name"));
<input type="hidden" name="old_app_name" value="<?php echo $phpgw->db->f("app_name"); ?>"> $t->set_var("lang_app_title",lang_admin("application title"));
<?php echo $phpgw->session->hidden_var(); ?> $t->set_var("lang_enabled",lang_admin("enabled"));
$t->set_var("lang_add",lang_common("add"));
<table border="0" width="35%" align="center"> $t->set_var("app_name_value",$phpgw->db->f("app_name"));
<tr> $t->set_var("app_title_value",$phpgw->db->f("app_title"));
<td><?php echo lang_admin("application name"); ?></td> $t->set_var("app_enabled_checked",($phpgw->db->f("app_enabled") == 1?" checked":""));
<td><input name="n_app_name" value="<?php echo $phpgw->db->f("app_name"); ?>"></td>
</tr>
<tr> $t->pparse("out","form");
<td><?php echo lang_admin("application title"); ?></td>
<td><input name="n_app_title" value="<?php echo $phpgw->db->f("app_title"); ?>"></td>
</tr>
<tr> include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
<td><?php echo lang_admin("enabled"); ?></td>
<td><input type="checkbox" name="n_app_enabled" value="1"<?php echo ($phpgw->db->f("app_enabled") == 1?" checked":""); ?>></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="<?php echo lang_common("Change"); ?>"></td>
</tr>
</table>
</form>
<?php
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");

View File

@ -17,8 +17,9 @@
$phpgw_flags["currentapp"] = "admin"; $phpgw_flags["currentapp"] = "admin";
include("../header.inc.php"); include("../header.inc.php");
$t = new Template($phpgw_info["server"]["template_dir"]);
$t = new Template($phpgw_info["server"]["template_dir"]);
//$t->set_unknowns("remove");
$t->set_file(array("form" => "application_form.tpl")); $t->set_file(array("form" => "application_form.tpl"));
if ($submit) { if ($submit) {
@ -45,12 +46,18 @@
} else { } else {
$t->set_var("error",""); $t->set_var("error","");
} }
$t->set_var("session_hidden_var",$phpgw->session->hidden_var()); $t->set_var("session_hidden_var",$phpgw->session->hidden_var());
$t->set_var("form_action","newapplication.php");
$t->set_var("lang_app_name",lang_admin("application name")); $t->set_var("lang_app_name",lang_admin("application name"));
$t->set_var("lang_app_title",lang_admin("application title")); $t->set_var("lang_app_title",lang_admin("application title"));
$t->set_var("lang_enabled",lang_admin("enabled")); $t->set_var("lang_enabled",lang_admin("enabled"));
$t->set_var("lang_add",lang_common("add")); $t->set_var("lang_add",lang_common("add"));
$t->set_var("app_name_value","");
$t->set_var("app_title_value","");
$t->set_var("app_enabled_checked","");
$t->pparse("out","form"); $t->pparse("out","form");
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");