Changeset 103 for trunk/admin

Show
Ignore:
Timestamp:
04/09/06 18:01:09 (3 years ago)
Author:
michiel
Message:

preparing for plugin admin stuff.
I had this idea, and before it's gone again I had to write it down.
Only the basics are here, this needs an actual implementation.
Ah well, you get the idea.

Comments welcome.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/admin/index.php

    r102 r103  
    10931093} 
    10941094 
     1095//}}}------------- 
     1096//{{{ plugin stuff 
     1097//---------------- 
     1098function load_admin_plugins() { 
     1099        /* this should become a setting */ 
     1100        $plugins = array(); 
     1101        $plugin_dir = "../plugins/"; 
     1102        if (is_dir($plugin_dir)) { 
     1103                $plug_fd = opendir($plugin_dir); 
     1104                while (false !== ($fp = readdir($plug_fd))) { 
     1105                        if (!preg_match("/^\./", $fp)) { 
     1106                                require_once($plugin_dir.$fp); 
     1107                        } 
     1108                } 
     1109        } 
     1110} 
     1111         
     1112function register_admin_plugin($name, $type) { 
     1113        echo "<!-- registering plugin: $name -->\n"; 
     1114        $GLOBALS["admin_plugins"][$type][] = $name; 
     1115} 
     1116 
     1117function getAdminPluginsByType($type) { 
     1118        if (is_array($GLOBALS["admin_plugins"][$type])) { 
     1119                foreach ($GLOBALS["admin_plugins"][$type] as $p) { 
     1120                        $plugs[] = $p; 
     1121                } 
     1122        } else { 
     1123                $plugs[] = ""; 
     1124        } 
     1125        return $plugs; 
     1126} 
     1127 
    10951128//}}}-------------------------------- 
    10961129//{{{ show the user some html code ;) 
    10971130//----------------------------------- 
    10981131html_header_admin("Admin Interface", "."); 
     1132load_admin_plugins(); 
    10991133        ?> 
    11001134        <div id="if_container"> 
     
    11021136                <div id="if_menu"> 
    11031137                        <a class="if_menu_item" href="../index.php">Site</a>&nbsp; 
    1104                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_cats") { echo "_act"; } ?>" href="./index.php?action=show_cats">categories</a>&nbsp; 
    1105                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_authors") { echo "_act"; } ?>" href="./index.php?action=show_authors">authors</a>&nbsp; 
    1106                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_posts") { echo "_act"; } ?>" href="./index.php?action=show_posts">posts</a>&nbsp; 
    1107                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_comments") { echo "_act"; } ?>" href="./index.php?action=show_comments">comments</a>&nbsp; 
    1108                         <!-- this one should move to plugins --><a class="if_menu_item<? if ($_REQUEST["action"] == "show_acro") { echo "_act"; } ?>" href="./index.php?action=show_acro">acronyms</a>&nbsp; 
    1109 <!--                    <a class="if_menu_item<? if ($_REQUEST["action"] == "show_pages") { echo "_act"; } ?>" href="./index.php?action=show_pages">&nbsp;pages</a>&nbsp; 
    1110 --> 
    1111                         <a class="if_menu_item<? if ($_REQUEST["action"] == "show_settings") { echo "_act"; } ?>" href="./index.php?action=show_settings">blogsettings</a>&nbsp; 
     1138                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_cats")      { echo "_act"; } ?>" href="./index.php?action=show_cats">categories</a>&nbsp; 
     1139                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_authors")   { echo "_act"; } ?>" href="./index.php?action=show_authors">authors</a>&nbsp; 
     1140                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_posts")     { echo "_act"; } ?>" href="./index.php?action=show_posts">posts</a>&nbsp; 
     1141                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_comments")  { echo "_act"; } ?>" href="./index.php?action=show_comments">comments</a>&nbsp; 
     1142                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_acro")      { echo "_act"; } ?>" href="./index.php?action=show_acro">acronyms</a>&nbsp; 
     1143                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_settings")  { echo "_act"; } ?>" href="./index.php?action=show_settings">blogsettings</a>&nbsp; 
    11121144                        <a class="if_menu_item<? if ($_REQUEST["action"] == "show_menuitems") { echo "_act"; } ?>" href="./index.php?action=show_menuitems">menuitems</a>&nbsp; 
    11131145                        <a class="if_menu_item" href="./login.php?action=logout">logout</a>&nbsp;