From fc649d66441ac702ace2438f650c46d02e88fe7b Mon Sep 17 00:00:00 2001 From: seek3r Date: Wed, 20 Dec 2000 08:50:00 +0000 Subject: [PATCH] added the ability to specify an order for the apps to show up in --- phpgwapi/phpgw_common.inc.php | 21 +++++++++++++++------ preferences/index.php | 5 +---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/phpgwapi/phpgw_common.inc.php b/phpgwapi/phpgw_common.inc.php index 4567f7df1d..0d744444af 100644 --- a/phpgwapi/phpgw_common.inc.php +++ b/phpgwapi/phpgw_common.inc.php @@ -623,7 +623,6 @@ function hook($location = "", $order = ""){ global $phpgw, $phpgw_info; - if ($order == ""){$order[] = $phpgw_info["flags"]["currentapp"];} /* First include the ordered apps hook file */ reset ($order); @@ -631,16 +630,13 @@ $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; } if (file_exists($f)) {include($f);} - $processed .= '|| $appname != "'.$appname.'" '; + $completed_hooks[$appname] = True; } - $processed = 'if ($appname != "" '.$processed.'){'; -//echo "processed: ".$processed."
\n"; /* Then add the rest */ reset ($phpgw_info["user"]["app_perms"]); while (list (, $appname) = each ($phpgw_info["user"]["app_perms"])){ - //eval($processed); - if ($appname != "" ){ + if ($appname != "" && $completed_hooks[$appname] != True){ $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; } if (file_exists($f)) {include($f);} @@ -648,6 +644,19 @@ } } + function hook_count($location = ""){ + global $phpgw, $phpgw_info; + reset ($phpgw_info["user"]["app_perms"]); + $count = 0; + while (list (, $appname) = each ($phpgw_info["user"]["app_perms"])){ + $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; + if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; } + if (file_exists($f)) {++$count;} + } + return $count; + } + + function appsession($data = "##NOTHING##") { global $phpgw_info, $phpgw; diff --git a/preferences/index.php b/preferences/index.php index 510e227002..c49fadf3ec 100755 --- a/preferences/index.php +++ b/preferences/index.php @@ -37,10 +37,7 @@ echo "\n\n"; } - $order[] = "notes"; - $order[] = "email"; - $order[] = "preferences"; - $phpgw->common->hook("",$order); + $phpgw->common->hook(); $phpgw->common->phpgw_footer(); ?>