]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Updating multiple plugins to no longer register admin menus with an event hook.
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 24 May 2010 21:44:07 +0000 (21:44 +0000)
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 24 May 2010 21:44:07 +0000 (21:44 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6191 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/logbrowser/index.php
mod/logbrowser/start.php
mod/profile/start.php
mod/reportedcontent/start.php
mod/sitepages/start.php

index 3629b94d58166b656c10ad919d6f5bce18960b67..c72e9fc23131e80f63f421a321488925b24fbf6d 100644 (file)
@@ -59,6 +59,6 @@
        set_context('admin');
                
 // Display main admin menu
-       page_draw(elgg_echo('logbrowser'),elgg_view_layout("one_column_with_sidebar", $title . $form . $result));
+       page_draw(elgg_echo('logbrowser'),elgg_view_layout('administration', $title . $form . $result));
 
 ?>
index 86c75c7c5e102e660d9c42555af670d1417e91b6..c8c830f00ce7f6815e8a84f84b1685ba21bdef61 100644 (file)
@@ -1,61 +1,51 @@
 <?php
-       /**
       * Elgg log browser.
       
       * @package ElggLogBrowser
       * @author Curverider Ltd
       * @link http://elgg.com/
       */
+/**
+ * Elgg log browser.
+ * 
+ * @package ElggLogBrowser
+ * @author Curverider Ltd
+ * @link http://elgg.com/
+ */
 
-       /**
-        * Initialise the log browser and set up the menus.
-        *
-        */
-       function logbrowser_init()
-       {
-               global $CONFIG;
-               
-               // Register a page handler, so we can have nice URLs
-               register_page_handler('logbrowser','logbrowser_page_handler');
-               
-               // Extend CSS
-               elgg_extend_view('css','logbrowser/css');
-               
-               // Extend context menu with admin logbrowsre link
-                       if (isadminloggedin())
-                       {
-                                elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
-                       }
-       }
+/**
+ * Initialise the log browser and set up the menus.
+ *
+ */
+function logbrowser_init()
+{
+       global $CONFIG;
        
-       /**
-        * Adding the log browser to the admin menu
-        *
-        */
-       function logbrowser_pagesetup()
-       {
-               if (get_context() == 'admin' && isadminloggedin()) {
-                       global $CONFIG;
-                       add_submenu_item(elgg_echo('logbrowser'), $CONFIG->wwwroot . 'pg/logbrowser/');
-               }
-       }
+       // Register a page handler, so we can have nice URLs
+       register_page_handler('logbrowser','logbrowser_page_handler');
        
-       /**
-        * Log browser page handler
-        *
-        * @param array $page Array of page elements, forwarded by the page handling mechanism
-        */
-       function logbrowser_page_handler($page) 
-       {
-               global $CONFIG;
-               
-               // only interested in one page for now
-               include($CONFIG->pluginspath . "logbrowser/index.php"); 
-       }
+       // Extend CSS
+       elgg_extend_view('css','logbrowser/css');
        
+       // Extend context menu with admin logbrowsre link
+       if (isadminloggedin()) {
+               elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
+       }
        
+       elgg_add_submenu_item(array(
+               'text' => elgg_echo('logbrowser'),
+               'href' => "{$CONFIG->wwwroot}pg/logbrowser",
+               'parent_id' => 'overview',
+       ), 'admin', 'default');
+}
+
+/**
+ * Log browser page handler
+ *
+ * @param array $page Array of page elements, forwarded by the page handling mechanism
+ */
+function logbrowser_page_handler($page) 
+{
+       global $CONFIG;
        
-       // Initialise log browser
-       register_elgg_event_handler('init','system','logbrowser_init');
-       register_elgg_event_handler('pagesetup','system','logbrowser_pagesetup');
-?>
\ No newline at end of file
+       // only interested in one page for now
+       include($CONFIG->pluginspath . "logbrowser/index.php"); 
+}
+
+
+// Initialise log browser
+register_elgg_event_handler('init','system','logbrowser_init');
index f83f108694b0efbc1d7601afa6a5505019fdc35f..6263f4a540c72fe0e54dab05f033ff870f6d3b9d 100644 (file)
@@ -51,7 +51,12 @@ function profile_init() {
 
        // Now override icons
        register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
-
+       
+       elgg_add_submenu_item(array(
+               'text' => elgg_echo('profile:edit:default'),
+               'href' => "{$CONFIG->wwwroot}pg/defaultprofile/edit",
+               'parent_id' => 'appearance',
+       ), 'admin', 'default');
 }
 
 /**
@@ -189,9 +194,6 @@ function profileedit_page_handler($page) {
 function profile_pagesetup()
 {
        global $CONFIG;
-       if (get_context() == 'admin' && isadminloggedin()) {
-               add_submenu_item(elgg_echo('profile:edit:default'), $CONFIG->wwwroot . 'pg/defaultprofile/edit/');
-       }
 
        //add submenu options
        if (get_context() == "profile") {
index ad75f06f01af643b042dde543048d3778b2553de..22d93dbe150b6f70709acdbea2ceda6637ea84eb 100644 (file)
@@ -27,17 +27,12 @@ function reportedcontent_init() {
            elgg_extend_view('profile/menu/links', 'reportedcontent/user_report');
                elgg_extend_view('footer/links', 'reportedcontent/footer_link');
        }
-}
-
-/**
- * Adding the reported content to the admin menu
- *
- */
-function reportedcontent_pagesetup() {
-       if (get_context() == 'admin' && isadminloggedin()) {
-               global $CONFIG;
-               add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/');
-       }
+       
+       elgg_add_submenu_item(array(
+               'text' => elgg_echo('reportedcontent'),
+               'href' => "{$CONFIG->wwwroot}pg/reportedcontent",
+               'parent_id' => 'overview',
+       ), 'admin', 'default');
 }
 
 /**
@@ -54,7 +49,6 @@ function reportedcontent_page_handler($page) {
 
 // Initialise Reported Content
 register_elgg_event_handler('init','system','reportedcontent_init');
-register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup');
 
 //register action
 register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php");
index 457ed583c8dc0aac382de39cace24a9f4953416c..180739cca1cde7f258d26c36ae6374d8d381bf3c 100644 (file)
@@ -57,6 +57,11 @@ function sitepages_init() {
        register_action("sitepages/edit", FALSE, $CONFIG->pluginspath . "sitepages/actions/edit.php");
        register_action("sitepages/delete", FALSE, $CONFIG->pluginspath . "sitepages/actions/delete.php");
 
+       elgg_add_submenu_item(array(
+               'text' => elgg_echo('sitepages'),
+               'href' => "{$CONFIG->wwwroot}pg/sitepages/edit/front",
+               'parent_id' => 'site',
+       ), 'admin', 'default');
 }
 
 /**
@@ -96,16 +101,6 @@ function sitepages_custom_index() {
        return true;
 }
 
-/**
- * Page setup. Adds admin controls to the admin panel.
- */
-function sitepages_pagesetup(){
-       if (get_context() == 'admin' && isadminloggedin()) {
-               global $CONFIG;
-               add_submenu_item(elgg_echo('sitepages'), $CONFIG->wwwroot . 'pg/sitepages/edit/front');
-       }
-}
-
 /**
  *
  * @param unknown_type $expage
@@ -234,4 +229,3 @@ function sitepages_public_pages($hook, $type, $return_value, $params) {
 }
 
 register_elgg_event_handler('init', 'system', 'sitepages_init');
-register_elgg_event_handler('pagesetup', 'system', 'sitepages_pagesetup');
\ No newline at end of file