From a21a733b5f2327c1dc0cf387300cf27013849a0c Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 11 May 2001 13:26:46 +0000 Subject: [PATCH] Convert to use single template per page --- admin/applications.php | 9 +++-- admin/deleteapplication.php | 14 ++++---- admin/editapplication.php | 9 +++-- admin/newapplication.php | 34 +++++++++---------- admin/templates/default/application_form.tpl | 9 +++++ .../default/application_form_row.tpl | 4 --- admin/templates/default/applications.tpl | 10 +++++- 7 files changed, 51 insertions(+), 38 deletions(-) delete mode 100644 admin/templates/default/application_form_row.tpl diff --git a/admin/applications.php b/admin/applications.php index 4c04856de6..5256a34a68 100644 --- a/admin/applications.php +++ b/admin/applications.php @@ -18,11 +18,10 @@ ); include('../header.inc.php'); - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); - $p->set_file(array( - 'list' => 'applications.tpl', - 'row' => 'applications_row.tpl' - )); + $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); + $p->set_file(array('applications' => 'applications.tpl')); + $p->set_block('applications','list','list'); + $p->set_block('applications','row','row'); if ($order) { diff --git a/admin/deleteapplication.php b/admin/deleteapplication.php index 62ecf0bef2..c847c0d5de 100644 --- a/admin/deleteapplication.php +++ b/admin/deleteapplication.php @@ -17,12 +17,14 @@ 'currentapp' => 'admin' ); - if (! $app_name) + if (!$app_name) { Header("Location: " . $phpgw->link('/admin/applications.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) { @@ -35,10 +37,10 @@ $phpgw->common->phpgw_header(); echo parse_navbar(); - $phpgw->template->set_var('messages',lang('Are you sure you want to delete this application ?')); - $phpgw->template->set_var('no','' . lang('No') . ''); - $phpgw->template->set_var('yes','' . lang('Yes') . ''); - $phpgw->template->pparse('out','body'); + $p->set_var('messages',lang('Are you sure you want to delete this application ?')); + $p->set_var('no','' . lang('No') . ''); + $p->set_var('yes','' . lang('Yes') . ''); + $p->pparse('out','body'); $phpgw->common->phpgw_footer(); ?> diff --git a/admin/editapplication.php b/admin/editapplication.php index cd9322b30b..0eeda7d8ab 100644 --- a/admin/editapplication.php +++ b/admin/editapplication.php @@ -25,7 +25,7 @@ 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) { @@ -37,10 +37,9 @@ $p->parse('rows','row',True); } - $p->set_file(array( - 'form' => 'application_form.tpl', - 'row' => 'application_form_row.tpl' - )); + $p->set_file(array('application' => 'application_form.tpl')); + $p->set_block('application','form','form'); + $p->set_block('application','row','row'); if ($submit) { diff --git a/admin/newapplication.php b/admin/newapplication.php index 919e9ea794..02a0065737 100644 --- a/admin/newapplication.php +++ b/admin/newapplication.php @@ -20,19 +20,19 @@ ); include('../header.inc.php'); - $phpgw->template->set_file(array( - 'form' => 'application_form.tpl', - 'row' => 'application_form_row.tpl' - )); + $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); + $p->set_file(array('application' => 'application_form.tpl')); + $p->set_block('application','form','form'); + $p->set_block('application','row','row'); function display_row($label, $value) { - global $phpgw; - $phpgw->template->set_var('tr_color',$phpgw->nextmatchs->alternate_row_color()); - $phpgw->template->set_var('label',$label); - $phpgw->template->set_var('value',$value); + global $phpgw,$p; + $p->set_var('tr_color',$phpgw->nextmatchs->alternate_row_color()); + $p->set_var('label',$label); + $p->set_var('value',$value); - $phpgw->template->parse('rows','row',True); + $p->parse('rows','row',True); } if ($submit) @@ -84,21 +84,21 @@ } else { - $phpgw->template->set_var("error","

" . $phpgw->common->error_list($error) . "

"); + $p->set_var("error","

" . $phpgw->common->error_list($error) . "

"); } } else { // else submit - $phpgw->template->set_var("error",""); + $p->set_var("error",""); } $phpgw->common->phpgw_header(); echo parse_navbar(); - $phpgw->template->set_var("lang_header",lang("Add new application")); - $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); + $p->set_var("lang_header",lang("Add new application")); + $p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - $phpgw->template->set_var("hidden_vars",""); - $phpgw->template->set_var("form_action",$phpgw->link("/admin/newapplication.php")); + $p->set_var("hidden_vars",""); + $p->set_var("form_action",$phpgw->link("/admin/newapplication.php")); display_row(lang("application name"),''); display_row(lang("application title"),''); @@ -121,8 +121,8 @@ display_row(lang("Allow Anonymous access to this app"),''); - $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(); ?> diff --git a/admin/templates/default/application_form.tpl b/admin/templates/default/application_form.tpl index e66bcef4fc..aa0768d293 100644 --- a/admin/templates/default/application_form.tpl +++ b/admin/templates/default/application_form.tpl @@ -1,3 +1,4 @@ +

{lang_header}


{error} @@ -19,3 +20,11 @@ + + + + + {label} + {value} + + diff --git a/admin/templates/default/application_form_row.tpl b/admin/templates/default/application_form_row.tpl deleted file mode 100644 index 2b707dd56e..0000000000 --- a/admin/templates/default/application_form_row.tpl +++ /dev/null @@ -1,4 +0,0 @@ - - {label} - {value} - diff --git a/admin/templates/default/applications.tpl b/admin/templates/default/applications.tpl index d31775c0c8..cfc587b3f3 100644 --- a/admin/templates/default/applications.tpl +++ b/admin/templates/default/applications.tpl @@ -1,4 +1,3 @@ -

{lang_installed}


@@ -28,3 +27,12 @@ + + + + {name} + {edit} + {delete} + {status} + +