3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
45 SUGAR.themes.currentSubpanelGroupLayoutChanged = false;
47 SUGAR.themes.currentSubpanelGroup = '{$startSubPanel}';
49 SUGAR.themes.subpanelMoreTab = '{$moreTab}';
51 SUGAR.themes.subpanelHtml = new Array();
53 SUGAR.themes.subpanelSubTabs = new Array();
54 SUGAR.themes.subpanelGroups = new Array();
55 {foreach from=$othertabs item=tab}
56 {assign var='notFirst' value='0'}
57 SUGAR.themes.subpanelGroups['{$tab.key}'] = [{foreach from=$tab.tabs item=subtab}{if $notFirst != 0}, {else}{assign var='notFirst' value='1'}{/if}'{$subtab.key}'{/foreach}{foreach from=$otherMoreSubMenu[$tab.key].tabs item=subtab}, '{$subtab.key}'{/foreach}];
58 {assign var='notFirst' value='0'}
59 SUGAR.themes.subpanelSubTabs['{$tab.key}'] = '<table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs"><tr>{foreach from=$tab.tabs item=subtab}{if $notFirst != 0}<td width="1"> | </td>{else}{assign var='notFirst' value='1'}{/if}<td nowrap="nowrap"><a href="#{$subtab.key}" class="subTabLink">{$subtab.label}</a></td>{/foreach}{if !empty($otherMoreSubMenu[$tab.key].tabs) }<td nowrap="nowrap"> | <span class="subTabMore" id="MoreSub{$tab.key}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,\'\',\'\',0);">>></span></td>{/if}<td width="100%"> </td></tr></table>';
62 SUGAR.themes.loadSubpanelFromMore = function(subpanel){ldelim}
63 //console.log('lsfm:'+subpanel);
64 SUGAR.themes.updateSubpanelMoreTab(subpanel);
65 SUGAR.themes.loadSubpanel(subpanel);
68 SUGAR.themes.updateSubpanelMoreTab = function(subpanel){ldelim}
69 //console.log('usmt:'+subpanel+' | '+SUGAR.themes.subpanelMoreTab);
72 var moreTab = document.getElementById(SUGAR.themes.subpanelMoreTab + '_sp_tab');
73 moreTab.id = subpanel + '_sp_tab';
74 moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].alt = subpanel;
75 moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].innerHTML = subpanel;
76 moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].href = "javascript:SUGAR.themes.loadSubpanel('"+subpanel+"');";
77 moreTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].getElementsByTagName('img')[0].alt = subpanel;
80 var menuLink = document.getElementById(subpanel+'_sp_mm');
81 menuLink.id = SUGAR.themes.subpanelMoreTab+'_sp_mm';
82 menuLink.href = "javascript:SUGAR.themes.loadSubpanelFromMore('"+SUGAR.themes.subpanelMoreTab+"');";
83 menuLink.innerHTML = SUGAR.themes.subpanelMoreTab;
86 SUGAR.themes.subpanelMoreTab = subpanel;
89 SUGAR.themes.loadSubpanel = function(subpanel){ldelim}
90 //console.log('lsp:'+subpanel+' | '+SUGAR.themes.currentSubpanelGroup);
91 if(SUGAR.themes.currentSubpanelGroupLayoutChanged && SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup]){ldelim}
92 SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup] = document.getElementById('subpanel_list').innerHTML;
93 SUGAR.themes.currentSubpanelGroupLayoutChanged = false;
95 if(SUGAR.themes.subpanelHtml[subpanel]){ldelim}
96 document.getElementById('subpanel_list').innerHTML = SUGAR.themes.subpanelHtml[subpanel];
97 SUGAR.themes.updateSubpanelTabs(subpanel);
99 if(!SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup]){ldelim}
100 SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup] = document.getElementById('subpanel_list').innerHTML;
102 ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING'));
103 SUGAR.util.retrieveAndFill('index.php?to_pdf=1&module=MySettings&action=LoadTabSubpanels&loadModule={$smarty.request.module}&record={$smarty.request.record}&subpanel='+subpanel,'subpanel_list', null, SUGAR.themes.updateSubpanelTabs, subpanel);
105 SUGAR.themes.setGroupCookie(subpanel);
108 SUGAR.themes.updateSubpanelTabs = function(subpanel){ldelim}
109 //console.log('ust:'+subpanel);
111 if(!SUGAR.themes.subpanelHtml[subpanel]){ldelim}
112 SUGAR.themes.subpanelHtml[subpanel] = document.getElementById('subpanel_list').innerHTML;
115 document.getElementById('subpanelSubTabs').innerHTML = SUGAR.themes.subpanelSubTabs[subpanel];
117 oldTab = document.getElementById(SUGAR.themes.currentSubpanelGroup+'_sp_tab');
119 oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].src = "{sugar_getimagepath file='Sugar/images/otherTab_left.gif'}";
120 oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].className = "otherTab";
121 oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].className = "otherTabLink";
122 oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].className = "otherTabRight";
125 mainTab = document.getElementById(subpanel+'_sp_tab');
126 mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].src = "{sugar_getimagepath file='currentTab_left.gif'}";
127 mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].className = "currentTab";
128 mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[1].getElementsByTagName('a')[0].className = "currentTabLink";
129 mainTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[2].className = "currentTabRight";
131 SUGAR.themes.updateSubpanelEventHandlers(subpanel);
133 SUGAR.themes.currentSubpanelGroup = subpanel;
134 ajaxStatus.hideStatus();
137 SUGAR.themes.updateSubpanelEventHandlers = function(subpanel){ldelim}
138 if(SubpanelInitTabNames){ldelim}
139 SubpanelInitTabNames(SUGAR.themes.subpanelGroups[subpanel]);
143 SUGAR.themes.tabCookieName = get_module_name() + '_sp_tab';
144 SUGAR.themes.setGroupCookie = function(subpanel){ldelim}
145 Set_Cookie(SUGAR.themes.tabCookieName, subpanel, 3000, false, false,false);
150 <table cellpadding="0" cellspacing="0" width='100%' style="margin-top:7px;">
151 {if !empty($sugartabs)}
153 {foreach from=$sugartabs item=tab}
155 <table border="0" cellpadding="0" cellspacing="0" width="1" id="{$tab.label}_sp_tab">
158 {capture assign="tabImage"}{$tab.type}Tab_left.gif{/capture}
159 <td width='1'><img src="{sugar_getimagepath file=$tabImage}" alt="{$tab.label}" border="0" height="25" width="5"></td>
160 <td width='1' class="{$tab.type}Tab" nowrap="nowrap"><a class="{$tab.type}TabLink" href="javascript:SUGAR.themes.loadSubpanel('{$tab.label}');">{$tab.label}</a></td>
161 <td width='1' class="{$tab.type}TabRight"><img src="{sugar_getimagepath file='blank.gif'}" alt="{$tab.label}" border="0" height="1" width="2"></td>
162 <td width='1' style="background-image: url({sugar_getimagepath file='emptyTabSpace.gif'});" valign="bottom"></td>
169 {if !empty($moreMenu)}
170 <img src='{sugar_getimagepath file='more.gif'}' alt='' align='absmiddle' id='MorePanelHandle' style=' margin-left:2px; cursor: pointer; cursor: hand;' align='absmiddle' onmouseover='tbButtonMouseOver(this.id,"","",0);'>
173 <td width='100%'> </td>
177 <td class="subTabBar" colspan="100" id="subpanelSubTabs">
178 <table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs">
181 {foreach from=$subtabs item=tab}
182 {if !empty($notFirst) && ($notFirst != 0) && ($notFirst != 1)}
183 <td width='1'> | </td>
185 {assign var='notFirst' value='2'}
188 <a href='#{$tab.key}' class='subTabLink'>{$tab.label}</a>
191 {if !empty($otherMoreSubMenu[$moreSubMenuName].tabs)}
192 <td nowrap="nowrap"> | <span class="subTabMore" id="MoreSub{$moreSubMenuName}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,'','',0);">>></span></td>
194 <td width='100%'> </td>
202 {if !empty($moreMenu)}
203 <div id="MorePanelMenu" class="menu">
204 {foreach from=$moreMenu item=tab}
205 <a href="javascript:SUGAR.themes.loadSubpanelFromMore('{$tab.label}');" class="menuItem" id="{$tab.label}_sp_mm" parentid="MorePanelMenu" onmouseover="hiliteItem(this,'yes'); closeSubMenus(this);" onmouseout="unhiliteItem(this);">{$tab.label}</a>
210 {foreach from=$otherMoreSubMenu item=group}
211 {if !empty($group.tabs)}
212 <div id="MoreSub{$group.key}PanelMenu" class="menu">
213 {foreach from=$group.tabs item=subtab}
214 <a href="#{$subtab.key}" class="menuItem" parentid="MoreSub{$group.key}PanelMenu" onmouseover="hiliteItem(this,'yes'); closeSubMenus(this);" onmouseout="unhiliteItem(this);">{$subtab.label}</a>