Convert to use single template per page

This commit is contained in:
Miles Lott 2001-05-11 13:26:46 +00:00
parent eda522570e
commit a21a733b5f
7 changed files with 51 additions and 38 deletions

View File

@ -18,11 +18,10 @@
); );
include('../header.inc.php'); include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array( $p->set_file(array('applications' => 'applications.tpl'));
'list' => 'applications.tpl', $p->set_block('applications','list','list');
'row' => 'applications_row.tpl' $p->set_block('applications','row','row');
));
if ($order) if ($order)
{ {

View File

@ -17,12 +17,14 @@
'currentapp' => 'admin' 'currentapp' => 'admin'
); );
if (! $app_name) if (!$app_name)
{ {
Header("Location: " . $phpgw->link('/admin/applications.php')); Header("Location: " . $phpgw->link('/admin/applications.php'));
} }
include('../header.inc.php'); include('../header.inc.php');
$phpgw->template->set_file(array('body' => 'delete_common.tpl'));
$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$p->set_file(array('body' => 'delete_common.tpl'));
if ($confirm) if ($confirm)
{ {
@ -35,10 +37,10 @@
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$phpgw->template->set_var('messages',lang('Are you sure you want to delete this application ?')); $p->set_var('messages',lang('Are you sure you want to delete this application ?'));
$phpgw->template->set_var('no','<a href="' . $phpgw->link("/admin/applications.php") . '">' . lang('No') . '</a>'); $p->set_var('no','<a href="' . $phpgw->link("/admin/applications.php") . '">' . lang('No') . '</a>');
$phpgw->template->set_var('yes','<a href="' . $phpgw->link("/admin/deleteapplication.php","app_name=" . urlencode($app_name) . "&confirm=True") . '">' . lang('Yes') . '</a>'); $p->set_var('yes','<a href="' . $phpgw->link("/admin/deleteapplication.php","app_name=" . urlencode($app_name) . "&confirm=True") . '">' . lang('Yes') . '</a>');
$phpgw->template->pparse('out','body'); $p->pparse('out','body');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -25,7 +25,7 @@
include('../header.inc.php'); include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
function display_row($label, $value) function display_row($label, $value)
{ {
@ -37,10 +37,9 @@
$p->parse('rows','row',True); $p->parse('rows','row',True);
} }
$p->set_file(array( $p->set_file(array('application' => 'application_form.tpl'));
'form' => 'application_form.tpl', $p->set_block('application','form','form');
'row' => 'application_form_row.tpl' $p->set_block('application','row','row');
));
if ($submit) if ($submit)
{ {

View File

@ -20,19 +20,19 @@
); );
include('../header.inc.php'); include('../header.inc.php');
$phpgw->template->set_file(array( $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
'form' => 'application_form.tpl', $p->set_file(array('application' => 'application_form.tpl'));
'row' => 'application_form_row.tpl' $p->set_block('application','form','form');
)); $p->set_block('application','row','row');
function display_row($label, $value) function display_row($label, $value)
{ {
global $phpgw; global $phpgw,$p;
$phpgw->template->set_var('tr_color',$phpgw->nextmatchs->alternate_row_color()); $p->set_var('tr_color',$phpgw->nextmatchs->alternate_row_color());
$phpgw->template->set_var('label',$label); $p->set_var('label',$label);
$phpgw->template->set_var('value',$value); $p->set_var('value',$value);
$phpgw->template->parse('rows','row',True); $p->parse('rows','row',True);
} }
if ($submit) if ($submit)
@ -84,21 +84,21 @@
} }
else else
{ {
$phpgw->template->set_var("error","<p><center>" . $phpgw->common->error_list($error) . "</center><br>"); $p->set_var("error","<p><center>" . $phpgw->common->error_list($error) . "</center><br>");
} }
} }
else else
{ // else submit { // else submit
$phpgw->template->set_var("error",""); $p->set_var("error","");
} }
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$phpgw->template->set_var("lang_header",lang("Add new application")); $p->set_var("lang_header",lang("Add new application"));
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("hidden_vars",""); $p->set_var("hidden_vars","");
$phpgw->template->set_var("form_action",$phpgw->link("/admin/newapplication.php")); $p->set_var("form_action",$phpgw->link("/admin/newapplication.php"));
display_row(lang("application name"),'<input name="n_app_name" value="' . $n_app_name . '">'); display_row(lang("application name"),'<input name="n_app_name" value="' . $n_app_name . '">');
display_row(lang("application title"),'<input name="n_app_title" value="' . $n_app_title . '">'); display_row(lang("application title"),'<input name="n_app_title" value="' . $n_app_title . '">');
@ -121,8 +121,8 @@
display_row(lang("Allow Anonymous access to this app"),'<input type="checkbox" name="n_app_anonymous" value="True">'); display_row(lang("Allow Anonymous access to this app"),'<input type="checkbox" name="n_app_anonymous" value="True">');
$phpgw->template->set_var("lang_submit_button",lang("add")); $p->set_var("lang_submit_button",lang("add"));
$phpgw->template->pparse("out","form"); $p->pparse("out","form");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -1,3 +1,4 @@
<!-- BEGIN form -->
<p><b>{lang_header}</b> <p><b>{lang_header}</b>
<hr><p> <hr><p>
{error} {error}
@ -19,3 +20,11 @@
</table> </table>
</form> </form>
<!-- END form -->
<!-- BEGIN row -->
<tr bgcolor="{tr_color}">
<td>{label}</td>
<td>{value}</td>
</tr>
<!-- END row -->

View File

@ -1,4 +0,0 @@
<tr bgcolor="{tr_color}">
<td>{label}</td>
<td>{value}</td>
</tr>

View File

@ -1,4 +1,3 @@
<!-- BEGIN list --> <!-- BEGIN list -->
<p><b>{lang_installed}</b><hr><p> <p><b>{lang_installed}</b><hr><p>
@ -28,3 +27,12 @@
</table> </table>
<!-- END list --> <!-- END list -->
<!-- BEGIN row -->
<tr bgcolor="{tr_color}">
<td>{name}</td>
<td width="5%">{edit}</td>
<td width="5%">{delete}</td>
<td width="5%">{status}</td>
</tr>
<!-- END row -->