cvs: pearweb /include pear-format-html.php
| From: | Thomas V.V.Cox | Date: | Tue, 04 Sep 2001 03:08:59 +0000 |
| Subject: | cvs: pearweb /include pear-format-html.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-782@lists.php.net to get a copy of this message | ||
cox Mon Sep 3 23:08:59 2001 EDT
Modified files:
/pearweb/include pear-format-html.php
Log:
enhance navigatin bar
Index: pearweb/include/pear-format-html.php
diff -u pearweb/include/pear-format-html.php:1.11 pearweb/include/pear-format-html.php:1.12
--- pearweb/include/pear-format-html.php:1.11 Sun Sep 2 22:01:21 2001
+++ pearweb/include/pear-format-html.php Mon Sep 3 23:08:59 2001
@@ -3,13 +3,22 @@
require_once 'layout.php';
$GLOBALS['main_menu'] = array(
- "index.php" => "Home",
- "http://php.net/manual/en/pear.php" =>
"Documentation",
- "account-request.php" => "Request Account",
- "package-new.php" => "New Package",
- "admin.php" => "Administrators",
- "packages.php" => "Browse Packages",
- "release-upload.php" => "Upload Release",
+ 'index.php' => 'Home',
+ 'http://php.net/manual/en/pear.php' =>
'Documentation',
+ 'faq.php' => 'Pear FAQ',
+ 'packages.php' => 'Browse Packages',
+ 'authors.php' => 'Browse Authors',
+ 'account-request.php' => 'Request Account'
+);
+
+$GLOBALS['author_menu'] = array(
+ 'package-new.php' => 'New Package',
+ 'release-upload.php' => 'Upload Release'
+);
+
+$GLOBALS['admin_menu'] = array(
+ 'admin.php' => 'Account Requests',
+ 'category-manage.php' => 'Manage Categories'
);
$GLOBALS['_style'] = '';
@@ -42,25 +51,42 @@
$rts = rtrim($SIDEBAR_DATA);
if (substr($rts, -1) == '-') {
$SIDEBAR_DATA = substr($rts, 0, -1);
- } else {
- global $main_menu, $PHP_SELF;
- $SIDEBAR_DATA .= "<br /><br />\n";
- $me = basename($PHP_SELF);
- foreach ($main_menu as $url => $tit) {
- $tt = str_replace(" ", " ", $tit);
- if ($url == $me) {
- $SIDEBAR_DATA .= "<b>>>$tt<<</b><br
/>\n";
- } else {
- $SIDEBAR_DATA .= " <a
href=\"$url\">$tt</a><br />\n";
+ } elseif (DEVBOX) { // For now only show bar on dev boxes
+ global $main_menu, $auth_user;
+ $SIDEBAR_DATA .= draw_navigation($main_menu);
+ if (!empty($auth_user)) {
+ if (!empty($auth_user->registered)) {
+ global $author_menu;
+ $SIDEBAR_DATA .= draw_navigation($author_menu, 'Author Actions:');
+ }
+ if (!empty($auth_user->admin)) {
+ global $admin_menu;
+ $SIDEBAR_DATA .= draw_navigation($admin_menu, 'Admin Actions:');
}
}
- $SIDEBAR_DATA .= "<br /><br />\n";
}
-
commonHeader($title);
}
-
+function &draw_navigation($data, $menu_title='')
+{
+ global $PHP_SELF;
+ $html = "<br /><br />\n";
+ if (!empty($menu_title)) {
+ $html .= "<b>$menu_title</b>\n";
+ $html .= "<br /><br />\n";
+ }
+ $me = basename($PHP_SELF);
+ foreach ($data as $url => $tit) {
+ $tt = str_replace(" ", " ", $tit);
+ if ($url == $me) {
+ $html .= "<b>>>$tt<<</b><br
/>\n";
+ } else {
+ $html .= " <a
href=\"$url\">$tt</a><br />\n";
+ }
+ }
+ return $html;
+}
function response_footer($style = false)
{
@@ -186,7 +212,7 @@
$border = new HTML_Table('border="0" cellpadding="0"
cellspacing="1" '.
"width=\"{$width}\"");
$border->addRow(array($tableobj->toHtml()), 'bgcolor="#000000"');
- print $border->toHtml();
+ print $border->toHtml();
}
?>