summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authordeva <deva>2009-03-23 18:41:22 +0000
committerdeva <deva>2009-03-23 18:41:22 +0000
commiteec8fdf3fd36f6f8511bdb4bea0899f82bf3f6ab (patch)
treeeefac33e9ef9980c81fd6200a437f39c12e63ba8 /pages
parent93a934051be4af5f61e28d98650808fcc701ae91 (diff)
First attempt on a modularized plugin system, complete with admin, and parameters.
Diffstat (limited to 'pages')
-rw-r--r--pages/admin.php89
1 files changed, 35 insertions, 54 deletions
diff --git a/pages/admin.php b/pages/admin.php
index 5305ae2..3f924c7 100644
--- a/pages/admin.php
+++ b/pages/admin.php
@@ -1,3 +1,5 @@
+<div class="admin">
+ <div class="header">Admin</div>
<?php
if($loggedin == true) {
?>
@@ -7,66 +9,44 @@ if($loggedin == true) {
else $UID = $HTTP_COOKIE_VARS["UserID"];
$user = $users->findUser($UID);
?>
-<div class="header">
- <div class="header_admin">
- <div class="header_text">Admin</div>
- </div>
-</div>
<div class="logout">
<a href="?page=admin&amp;action=logout">Logout <em><?php echo $UID;?></em></a>
</div>
-<div class="admin_menu">
-<?php if($user->events == "on") {?>
- <a class="admin_menu_entry<?php if($module == "events") echo "_active" ?>"
- href="?page=admin&amp;module=events">Events</a>
-<?php }?>
-<?php if($user->news == "on") {?>
- <a class="admin_menu_entry<?php if($module == "news") echo "_active" ?>"
- href="?page=admin&amp;module=news">News</a>
-<?php }?>
-<?php if($user->gallery == "on") {?>
- <a class="admin_menu_entry<?php if($module == "gallery") echo "_active" ?>"
- href="?page=admin&amp;module=gallery">Gallery</a>
-<?php }?>
-<?php if($user->guestbook == "on") {?>
- <a class="admin_menu_entry<?php if($module == "guestbook") echo "_active" ?>"
- href="?page=admin&amp;module=guestbook">Guestbook</a>
-<?php }?>
-<?php if($user->newsletter == "on") {?>
- <a class="admin_menu_entry<?php if($module == "newsletter") echo "_active" ?>"
- href="?page=admin&amp;module=newsletter">Newsletter</a>
-<?php }?>
-<?php if($user->pressrelease == "on") {?>
- <a class="admin_menu_entry<?php if($module == "pressrelease") echo "_active" ?>"
- href="?page=admin&amp;module=pressrelease">Press</a>
-<?php }?>
-<?php if($user->user == "on") {?>
- <a class="admin_menu_entry<?php if($module == "user") echo "_active" ?>"
- href="?page=admin&amp;module=user">Password</a>
-<?php }?>
-<?php if($user->users == "on") {?>
- <a class="admin_menu_entry<?php if($module == "users") echo "_active" ?>"
- href="?page=admin&amp;module=users">Users</a>
-<?php }?>
+<div class="menu">
+<?php
+include_once($UTIL_DIR . "/modules.php");
+
+foreach($modules as $modulename => $module) {
+ if($m == $modulename) $admin_module = $module;
+ echo "<div class=\"entry\"><a href=\"?page=admin&amp;m=$modulename\">$module->admin_title</a></div>\n";
+}
+?>
</div>
-<div class="admin_form">
+<div class="submenu">
<?php
- if($user->events == "on" && $module == "events") include($UTIL_DIR."/admin_events.php");
- if($user->news == "on" && $module == "news") include($UTIL_DIR."/admin_news.php");
- if($user->gallery == "on" && $module == "gallery") include($UTIL_DIR."/admin_gallery.php");
- if($user->guestbook == "on" && $module == "guestbook") include($UTIL_DIR."/admin_guestbook.php");
- if($user->newsletter == "on" && $module == "newsletter") include($UTIL_DIR."/admin_newsletter.php");
- if($user->pressrelease == "on" && $module == "pressrelease") include($UTIL_DIR."/admin_pressrelease.php");
- if($user->user == "on" && $module == "user") include($UTIL_DIR."/admin_user.php");
- if($user->users == "on" && $module == "users") include($UTIL_DIR."/admin_users.php");
- if($module == "") {
- echo "Welcome <em>". $UID ."</em>. Please select administration module.";
- }
- echo "</div>\n";
-} else {
+if($admin_module) {
+ foreach($admin_module->admin_submodules as $submodulename => $submodule) {
+ if($s == $submodule) {
+ $admin_submodule = $s;
+ $admin_submodule_name = $submodulename;
+ }
+ echo "<div class=\"subentry\"><a href=\"?page=admin&amp;m=$m&amp;s=$submodule\">$submodulename</a></div>\n";
+ }
+}
?>
-<div class="admin_form">
-<div class="small_header">Login</div>
+</div>
+<div class="form">
+<?php
+if($admin_submodule) {
+ echo "<div class=\"submodule_header\">$admin_submodule_name</div>\n";
+ $admin_module->admin($admin_submodule, $a, $vars);
+}
+?>
+</div>
+<?php
+} else { // logged in?
+?>
+<div class="form">
<form action="?page=admin&amp;action=login" method="post">
<p>UserID: <input name="userid"/></p>
<p>Password: <input name="password" type="password"/></p>
@@ -76,3 +56,4 @@ if($loggedin == true) {
<?php
}
?>
+</div>