diff --git a/core/ext/admin.ext.php b/core/ext/admin.ext.php index 573bfe5d..615177f3 100644 --- a/core/ext/admin.ext.php +++ b/core/ext/admin.ext.php @@ -51,6 +51,12 @@ class AdminPage extends Extension { if(is_a($event, 'AdminBuildingEvent')) { $this->build_page(); } + + if(is_a($event, 'UserBlockBuildingEvent')) { + if($event->user->is_admin()) { + $event->add_link("Board Admin", make_link("admin")); + } + } } // }}} // block HTML {{{ diff --git a/core/ext/setup.ext.php b/core/ext/setup.ext.php index 3c683102..ca1f9063 100644 --- a/core/ext/setup.ext.php +++ b/core/ext/setup.ext.php @@ -166,6 +166,12 @@ class Setup extends Extension { $event->config->set_string_from_post("theme"); $event->config->set_int_from_post("anon_id"); } + + if(is_a($event, 'UserBlockBuildingEvent')) { + if($event->user->is_admin()) { + $event->add_link("Board Config", make_link("setup")); + } + } } // }}} // HTML building {{{ diff --git a/core/ext/user.ext.php b/core/ext/user.ext.php index 63414571..cd957eb9 100644 --- a/core/ext/user.ext.php +++ b/core/ext/user.ext.php @@ -1,5 +1,19 @@ user = $user; + } + + public function add_link($name, $link, $position=50) { + while(isset($this->parts[$position])) $position++; + $this->parts[$position] = "$name"; + } +} + class UserPage extends Extension { // event handling {{{ public function receive_event($event) { @@ -66,6 +80,11 @@ class UserPage extends Extension { $event->config->set_bool_from_post("login_signup_enabled"); $event->config->set_string_from_post("login_tac"); } + + if(is_a($event, 'UserBlockBuildingEvent')) { + $event->add_link("User Config", make_link("user")); + $event->add_link("Log Out", make_link("user/logout")); + } } // }}} // Things done *with* the user {{{ @@ -361,14 +380,15 @@ class UserPage extends Extension { private function build_links_block() { global $user; + $ubbe = new UserBlockBuildingEvent($user); + + send_event($ubbe); + $h_name = html_escape($user->name); - $html = "Logged in as $h_name"; - if($user->is_admin()) { - $html .= "
Board Config"; - $html .= "
Admin"; - } - $html .= "
User Config"; - $html .= "
Log Out"; + $html = "Logged in as $h_name
"; + + $html .= join("\n
", $ubbe->parts); + return $html; }