From e3c2d121720b0a1fa29f2bc51ac22e348e3a73ff Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Tue, 12 Jun 2001 17:17:23 +0000 Subject: [PATCH] Allow apps to use a hook config for using special code in config.php, preferences will be doing this --- admin/config.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/admin/config.php b/admin/config.php index a0e748d464..e4bfa20b28 100644 --- a/admin/config.php +++ b/admin/config.php @@ -20,7 +20,12 @@ ); include('../header.inc.php'); + if ($appname == 'admin') + { + $appname = 'preferences'; + } $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir($appname)); + $t->set_unknowns('keep'); $t->set_file(array( 'config' => 'config.tpl' )); @@ -28,13 +33,6 @@ $t->set_block('config','body','body'); $t->set_block('config','footer','footer'); - function nextcolor() - { - global $phpgw,$trcolor; - $trcolor = $phpgw->nextmatchs->alternate_row_color($tr_color); - echo $trcolor; - } - $c = CreateObject('phpgwapi.config',$appname); $c->read_repository(); @@ -81,6 +79,9 @@ $t->pparse('out','header'); $vars = $t->get_undefined('body'); + + $phpgw->common->hook_single('config',$appname); + while (list($null,$value) = each($vars)) { $valarray = explode('_',$value); @@ -131,13 +132,18 @@ $t->set_var($value,''); } break; + case "hook": + $newval = ereg_replace(' ','_',$newval); + $t->set_var($value,$newval($current_config)); + break; default: $t->set_var($value,''); break; } } - $t->pparse('out','body'); - $t->pparse('out','footer'); + $t->pfp('out','body'); + + $t->pfp('out','footer'); $phpgw->common->phpgw_footer(); ?>