Results 1 to 4 of 4

Thread: Changing tab colors for modules

  1. #1
    enrikm is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    61

    Default Changing tab colors for modules

    Good afternoon all,

    What part of the code should I tweak if I want to change the tab colors of the modules? For example, accounts will be blue, contacts will be red, leads will be yellow and so on. This should make the life of users much easier as instead of saying "click on the accounts module", we just say, "click on the blue tab".

    Thanks for your help!

  2. #2
    pblag's Avatar
    pblag is offline Sugar Community Member
    Join Date
    Jul 2006
    Location
    Ukraine (Chernivtsy)
    Posts
    347

    Smile Re: Changing tab colors for modules

    Hi enrikm!

    It's really interesting question.

    So you have to update the file /modules/themes/Sugar/header.php

    there is code

    foreach($preListHeader as $module_name)
    {
    $color = "";

    if ($module_name == "Home") $color = "blue";
    if ($module_name == "Contacts") $color = "red";
    if ($module_name == "Accounts") $color = "#ffbbaa";

    if (!is_array($module_name)) {
    $xtpl->assign("MODULE_NAME", $app_list_strings['moduleList'][$module_name]);
    $xtpl->assign("MODULE_KEY", $module_name);


    if($module_name == $currentModule && ($module_name != 'iFrames' || empty($_REQUEST['record'])|| (!empty($_REQUEST['tab']) && $_REQUEST['tab']=='false')))
    {
    $tabClass = "currentTab";
    $otherTab = "currentTab";
    $xtpl->assign("TAB_CLASS", "currentTab");
    $xtpl->assign("OTHER_TAB", "currentTab");
    }
    else
    {
    $tabClass = "otherTab";
    $otherTab = "currentTab";
    $xtpl->assign("TAB_CLASS", "otherTab");
    $xtpl->assign("OTHER_TAB", "currentTab");
    }
    $xtpl->assign("LINK", '<span style="background-color:'.$color.';"><a class="'.$tabClass.'Link" href="index.php?module='.$module_name.'&action=ind ex">'.$app_list_strings['moduleList'][$module_name].'</A></span>');
    } else {

    $xtpl->assign("MODULE_NAME", $module_name[4]);
    $xtpl->assign("MODULE_KEY", $module_name[3]);


    if($module_name[3] == $currentModule && (!empty($_REQUEST['record']) and $_REQUEST['record']==$module_name[0] and !empty($_REQUEST['tab'])))
    {
    $tabClass = "currentTab";
    $otherTab = "currentTab";
    $xtpl->assign("TAB_CLASS", "currentTab");
    $xtpl->assign("OTHER_TAB", "currentTab");
    }
    else
    {
    $tabClass = "otherTab";
    $otherTab = "currentTab";
    $xtpl->assign("TAB_CLASS", "otherTab");
    $xtpl->assign("OTHER_TAB", "currentTab");
    }
    $xtpl->assign("LINK", '<a class="'.$tabClass.'Link" href="index.php?module='.$module_name[3].'&action=index&record='.$module_name[0].'&tab='.$module_name[2].'">'.$module_name[4].'</A>');

    }

    if ($i==$max_tabs-1 and $numb_tabs>$max_tabs) {
    $xtpl->assign("MORE_HANDLE_CLASS", 'otherTab');
    $xtpl->parse("main.moreHandle");
    }
    $xtpl->parse("main.module_tab");
    $i++;
    }


    you can find the code i've just added as bold.
    Petro Blagodir
    petro@blagodir.ua
    http://www.blagodir.com
    Blagodir Ltd.( SugarCRM - Consultations, Development and Support)

  3. #3
    enrikm is offline Sugar Community Member
    Join Date
    Dec 2006
    Posts
    61

    Default Re: Changing tab colors for modules

    Thanks pblag, you have been very helpful! Everything is working now.

  4. #4
    ryan.armstrong is offline Junior Member
    Join Date
    May 2011
    Posts
    2

    Default Re: Changing tab colors for modules

    Can anyone provide an update for this for Sugar 6.1? We need the same functionality.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Removing Activities Tab at the Top
    By rps1984 in forum Help
    Replies: 12
    Last Post: 2008-04-10, 10:24 AM
  2. Changing Module Tab Links
    By URtech in forum Help
    Replies: 1
    Last Post: 2007-06-25, 12:10 AM
  3. Changing the tab order
    By JohnnyB in forum Help
    Replies: 1
    Last Post: 2007-05-22, 08:42 PM
  4. Checkboxes under Home Tab
    By Adamcin in forum Help
    Replies: 0
    Last Post: 2005-11-16, 12:27 AM
  5. changing fields in dashboard tab
    By WilliamC in forum Help
    Replies: 0
    Last Post: 2005-06-17, 10:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •