Project / Support Center
Welcome, Guest. Please login or register. June 03, 2023, 09:26: PM
Home Help Search Login Register
D-Web Web Site Creator D - Web Web Site Creator On-line HTML Editor No Programming knowledge required. Web Global Net PayPal-Cart Shopping Cart System PayPal - Kart Shopping Cart System for E-Commerce over the internet, that's easy to use. Web Global Net Newsletter Manager Newsletter Manager On-line Newsletter Creator with Email Subscriber Management.
Ring Central Discount
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  Open Source Topics  |  SugarCRM  |  Topic: How to customize menus 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Send this topic Print
Author Topic: How to customize menus  (Read 9583 times)
« on: September 07, 2006, 06:22: PM »

This is just the first step towards a fully customizable menu tree with submenus, multiple toolbars, skins, loadable menu sets (such as a "ACT!" menu set, a "Goldmine" menu set, etc). The final goal is creating a complete real-time Theme Editor. There is no user interface to customize the menus right now, but someone a little more techy can open the menudefs.php and change the menus and toolbar layout. Below, see how the menu and toolbar definitions are done and how to customize it to suit your needs.

Inside each module directory (e.g. modules/Accounts) there is a menu.php file. This file has the menu items that will appear when you are using that module. So, if you click on "Accounts" you'll get a menu with actions regarding the Accounts module.

Originally, if you are not in a certain module you cannot have access to its menu. For example, if you are in Accounts and want to create a new prospect, you must first click on "Campaigns", wait the campaign list to load and then click on Create Prospect. This theme does it differently. It loads "all" menu items, from all modules at once. So, you can be in Accounts, click on the menu "Marketing" and select "Create Prospect" without having to load unnecessary pages.

So, by the explanation above you may conclude that Sugar menus are module-oriented. Of course, it wouldn't make sense have a menu bar with a menu for each module. This would create at least 16 menus with 2 or 3 items each and wouldn't fit on the screen. So, I grouped them by "function" or "activity" thinking about users roles in a company. Anyway, there is no "right" way to do this, and you may want to do it differently.

Originally when someone talks about context-sensitive it means a "right-click" menu. This is not the case. What I mean is that depending on the context, the menu item you click may do a different thing. It works like this: every menu and toolbar action that "creates a new record" will automatically assign this record to the currently open module, if there is one. So, if you are on an Account record and click on the "Schedule Meeting" icon, it will create a meeting for that Account. If you are on a contact record and click on Create Email, it will address the email to that contact. If you are not on a detailview, the new record will not be automatically assigned.

The menu names you will see are new to Sugar. As I said, they group Sugar actions into one new menu. If you're a international user and just want to translate the menu names to your local language, simply go to "File", "Reset and Localize Menus". You will be shown with the list of menus names and the ability to edit them.

You can completely rename, remove or add menus as long as they are a group of existing Sugar menus. For example, you can create a menu called "Prospecting" that will include all menu items from Leads+Campaigns modules. But you cannot create a menu with "Export" since Export is not present in any Sugar menu. You cannot partially add Sugar menu items to the new menus (but this can be done with the toolbar).

Given the explanation above, it is very easy to define new menu sets. Just choose a name for the menu and then choose the modules from which items will be grouped together.

For example, "Customers"="Accounts"+"Contacts"+"Opportunties", "Prospecting"="Leads"+"Prospects+Campaigns", etc. A menu can have a single module or multiple modules. New modules created by third-party companies can also be used. For example, in my original implementation, ZuckerMail will be automatically added to the menu "Communication" (if you have it installed, of course).

Open the file themes/Aqua/menudefs.php. You will quickly understand how to do it. The first element of each group ("File", "Accounts", etc) is the name of the menu you will see. The items you see below (between array(..)) are the module names. You must type the module name EXACTLY how it is called by Sugar internally (consult the moduleList dropdown with the Dropdown Editor in Administration). The menu title can be anything you want, but for modules, do not type "translated" names. Use the English, original Sugar name. To delete a menu, simply delete the whole section. To include a new one, copy and change a section. To reposition the menus, move sections up and down.

$menu_defs = array(
  "File" => array(
  "Accounts" => array(
  ... etc..

The items called "Global" refer to those links you usually see on the top right of the screen. They are "My Account", "Employees", "Admin", "Logout" and "About". Treat it as if it were a module. You can move it to another menu or even delete it (in this case you'll lose access to those functions). The "Shortcuts" is the only item that MUST BE PRESENT. You can move it up or down, but do NOT delete it. It will be used to add items from new modules that you may install later and that are not referred in any other menu. It also includes the last accessed record links.

Toolbars are not present in Sugar. But they are created from Sugar menu items. So, as I mentioned earlier, you cannot add an icon for "Export" since this is not an option in any of the Sugar menus (if you know how to change the Sugar menus, go ahead, this theme will accept). The toolbars are not "groups of module menus". They are shortcut to any items you want. You can, for example, add an icon to create a project and another one to import notes. No need to have all Notes or Project menu items.

On the same file menudefs.php, you will see:
$icon_defs = array(
  0 => array(
      "module" => "Accounts",
      "menu_item" => 1,
      "icon" => "CreateAccounts",
      "module" => "Contacts",
      "menu_item" => 1,
      "icon" => "CreateContacts",
    etc ...

Notice that the sections are a little different. First, we have a section with a number. This must a sequential number and it represents "groups of icons". Each group is separated by a vertical bar. If you add all items to section numbered "0", for example, the icons will be all together without separation. It is just a question of visual effect.

Below the number, there are sections, starting with "array(". Each section represents an icon. The first element is the module name (the original Sugar module name as with the menus). The number indicates the sequential item number in the original Sugar menu. Finding the right number is easy:

Open Sugar with the "Sugar" theme. Click on a module, eg. Accounts. Look at the shortcuts menu. Choose an item and count from top to bottom, starting at 1. So, if you want the third item from the Contacts menu to become a toolbar icon, the menudefs section will have "module" => "Contacts", "menu_item" => 3. You can also check the numbers using the Aqua theme since menus items follow the Sugar original order. The last item is the icon image file that will be used. This file MUST BE on the themes/Aqua/images directory and must be a gif file. But do NOT type the extension. Just type the name, without path and extension.

That's it. Hope you all enjoy and find it useful. Of course, I'd appreciate to get some feedback of what you thought about it and how to improve it.

Provided to you by:
Marcelo Leite (aka Mr. Milk)
AnySoft Informatica
Report to moderator   Logged
Pages: [1] Go Up Send this topic Print 
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  Open Source Topics  |  SugarCRM  |  Topic: How to customize menus « previous next »
Jump to:  

Login with username, password and session length
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!