phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [18502] fix: comply with new menu system (navbar)


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] [18502] fix: comply with new menu system (navbar)
Date: Tue, 18 Mar 2008 21:38:48 +0000

Revision: 18502
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18502
Author:   maat
Date:     2008-03-18 21:38:47 +0000 (Tue, 18 Mar 2008)

Log Message:
-----------
fix: comply with new menu system (navbar)

Modified Paths:
--------------
    trunk/ged/setup/setup.inc.php

Added Paths:
-----------
    trunk/ged/inc/class.menu.inc.php

Added: trunk/ged/inc/class.menu.inc.php
===================================================================
--- trunk/ged/inc/class.menu.inc.php                            (rev 0)
+++ trunk/ged/inc/class.menu.inc.php    2008-03-18 21:38:47 UTC (rev 18502)
@@ -0,0 +1,122 @@
+<?php
+       /**
+        * ged - Menus
+        *
+        * @author Dave Hall <address@hidden>
+        * @copyright Copyright (C) 2007 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package ged 
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 3 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+/*
+//////////////////////////////////////////////////////////////////////////////////
+
+       This is an example stub menu class, you will need to read it in order
+       to understand how to use the new menu API.
+
+       Here is a quick start guide
+               * <module> is the name of your phpGW module
+               * copy this file to <module>/inc/class.menu.inc.php
+               * run find and replace :%s/ged/<module>/g
+               * edit <module>/setup/setup.inc.php and make sure it has a hook 
entry 
+                       for the menu, something like this should do it for you
+                       $setup_info['<module>']['hooks']['menu'] = 
'<module>.menu.get_menu';
+               * edit the class to suit your requirements
+               * Remove this comment block
+
+\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
+*/
+
+
+       /**
+        * Menus
+        *
+        * @package ged
+        */     
+       class ged_menu
+       {
+               /**
+                * Get the menus for the ged
+                *
+                * @return array available menus for the current user
+                */
+               function get_menu()
+               {
+                       /* The base array which holds all the menus */
+                       $menus = array();
+
+                       /*
+                               This gives you entries on the navigation bar, 
you can use multiple entries
+                               order values less than 20 are reserved for the 
API and core modules
+                       */
+                       $menus['navbar'] = array
+                       (
+                               'ged' => array
+                               (
+                                       'text'  => 
$GLOBALS['phpgw']->translation->translate('ged', array(), true),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'ged.ged_ui.browse') 
),
+                                       'image' => array('ged', 'navbar'),
+                                       'order' => 25, // must be greater than 
19
+                                       'group' => 'office' // which collection 
of apps does it belong in, if in doubt ask on the dev list
+                               )
+                       );
+
+                       /*
+                               This should be rendered as a toolbar when your 
module is being used by a user
+                       */
+                       $menus['toolbar'] = array();
+
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+                       {
+                               /*
+                                       These items are available to users with 
access to the admin module
+                                               - they are grouped by module
+                               */
+                               $menus['admin'] = array();
+                       }
+
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['preferences']) )
+                       {
+                               /*
+                                       These items are available to users with 
access to the preferences module 
+                                               - they are grouped by module
+                               */
+                               $menus['preferences'] = array();
+
+                               $menus['toolbar'][] = array
+                               (
+                                       'text'  => lang('Preferences'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname'      => 
'ged')),
+                                       'image' => array('ged', 'preferences')
+                               );
+                       }
+
+                       /*
+                               These items are used by the navigation menu, 
this is rendered differently by different template sets
+                       */
+                       $menus['navigation'] = array();
+
+                       /*
+                               OPTIONAL This is used by the folders view - not 
implemented in all template sets 
+                       */
+                       $menus['folders'] = 
phpgwapi_menu::get_categories('ged');
+
+                       return $menus;
+               }
+       }


Property changes on: trunk/ged/inc/class.menu.inc.php
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/ged/setup/setup.inc.php
===================================================================
--- trunk/ged/setup/setup.inc.php       2008-03-11 01:07:42 UTC (rev 18501)
+++ trunk/ged/setup/setup.inc.php       2008-03-18 21:38:47 UTC (rev 18502)
@@ -38,6 +38,7 @@
        $setup_info['ged']['hooks'][]='settings';
        $setup_info['ged']['hooks'][]='home';
 //     $setup_info['ged']['hooks'][]='sidebox_menu';
+               $setup_info['ged']['hooks']['menu']     = 'ged.menu.get_menu';
 
 // Tables in database
 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]