]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/VarDefHandler/SugarTabs/tpls/singletabmenu.tpl
Add .gitignore
[Github/sugarcrm.git] / include / VarDefHandler / SugarTabs / tpls / singletabmenu.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38
39
40
41 *}
42
43
44 <script>
45         SUGAR.themes.currentSubpanelGroupLayoutChanged = false;
46         
47         SUGAR.themes.currentSubpanelGroup = '{$startSubPanel}';
48         
49         SUGAR.themes.subpanelMoreTab = '{$moreTab}';
50         
51         SUGAR.themes.subpanelHtml = new Array();
52         
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"> | &nbsp;<span class="subTabMore" id="MoreSub{$tab.key}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,\'\',\'\',0);">&gt;&gt;</span></td>{/if}<td width="100%">&nbsp;</td></tr></table>';
60 {/foreach}
61
62         SUGAR.themes.loadSubpanelFromMore = function(subpanel){ldelim}
63                 //console.log('lsfm:'+subpanel);
64                 SUGAR.themes.updateSubpanelMoreTab(subpanel);
65                 SUGAR.themes.loadSubpanel(subpanel);
66         {rdelim};
67         
68         SUGAR.themes.updateSubpanelMoreTab = function(subpanel){ldelim}
69                 //console.log('usmt:'+subpanel+' | '+SUGAR.themes.subpanelMoreTab);
70                 
71                 // Update Tab
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;
78                 
79                 // Update Menu
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;
84                 
85                 
86                 SUGAR.themes.subpanelMoreTab = subpanel;
87         {rdelim};
88         
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;
94                 {rdelim}
95                 if(SUGAR.themes.subpanelHtml[subpanel]){ldelim}
96                         document.getElementById('subpanel_list').innerHTML = SUGAR.themes.subpanelHtml[subpanel];
97                         SUGAR.themes.updateSubpanelTabs(subpanel);
98                 {rdelim}else{ldelim}
99                         if(!SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup]){ldelim}
100                                 SUGAR.themes.subpanelHtml[SUGAR.themes.currentSubpanelGroup] = document.getElementById('subpanel_list').innerHTML;
101                         {rdelim}
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);
104                 {rdelim}
105                 SUGAR.themes.setGroupCookie(subpanel);
106         {rdelim};
107         
108         SUGAR.themes.updateSubpanelTabs = function(subpanel){ldelim}
109                 //console.log('ust:'+subpanel);
110                 
111                 if(!SUGAR.themes.subpanelHtml[subpanel]){ldelim}
112                                 SUGAR.themes.subpanelHtml[subpanel] = document.getElementById('subpanel_list').innerHTML;
113                 {rdelim}
114                 
115                 document.getElementById('subpanelSubTabs').innerHTML = SUGAR.themes.subpanelSubTabs[subpanel];
116                 
117                 oldTab = document.getElementById(SUGAR.themes.currentSubpanelGroup+'_sp_tab');
118                 if(oldTab){ldelim}
119                         oldTab.getElementsByTagName('tr')[0].getElementsByTagName('td')[0].getElementsByTagName('img')[0].src = "{sugar_getimagepath file='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";
123                 {rdelim}
124                 
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";
130                 
131                 SUGAR.themes.updateSubpanelEventHandlers(subpanel);
132                 
133                 SUGAR.themes.currentSubpanelGroup = subpanel;
134                 ajaxStatus.hideStatus();
135         {rdelim};
136         
137         SUGAR.themes.updateSubpanelEventHandlers = function(subpanel){ldelim}
138                 if(SubpanelInitTabNames){ldelim}
139                         SubpanelInitTabNames(SUGAR.themes.subpanelGroups[subpanel]);
140                 {rdelim}
141         {rdelim};
142         
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);
146         {rdelim};
147 </script>
148
149
150 <table cellpadding="0" cellspacing="0" width='100%' style="margin-top:7px;">
151         {if !empty($sugartabs)}
152         <tr>
153                 {foreach from=$sugartabs item=tab}
154                 <td width='1%'>
155                     <table border="0" cellpadding="0" cellspacing="0" width="1" id="{$tab.label}_sp_tab">
156                                 <tbody>
157                                 <tr height="25">
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>
163                                 </tr>
164                                 </tbody>
165                         </table>
166                 </td>
167                 {/foreach}
168                 <td width='1%'>
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);'>
171                 {/if}
172                 </td>
173                 <td width='100%'>&nbsp;</td>
174         </tr>
175         {/if}
176         <tr height="20">
177                 <td class="subTabBar" colspan="100" id="subpanelSubTabs">
178                         <table border="0" cellpadding="0" cellspacing="0" height="20" width="100%" class="subTabs">
179                                 <tbody>
180                                 <tr>
181                             {foreach from=$subtabs item=tab}
182                               {if !empty($notFirst) && ($notFirst != 0) && ($notFirst != 1)}
183                                 <td width='1'> | </td>
184                               {else}
185                                         {assign var='notFirst' value='2'}
186                               {/if}
187                                     <td nowrap="nowrap">
188                                         <a href='#{$tab.key}' class='subTabLink'>{$tab.label}</a>
189                                         </td>
190                                 {/foreach}
191                                 {if !empty($otherMoreSubMenu[$moreSubMenuName].tabs)}
192                                         <td nowrap="nowrap"> | &nbsp;<span class="subTabMore" id="MoreSub{$moreSubMenuName}PanelHandle" style="margin-left:2px; cursor: pointer; cursor: hand;" align="absmiddle" onmouseover="tbButtonMouseOver(this.id,'','',0);">&gt;&gt;</span></td>
193                                 {/if}
194                                         <td width='100%'>&nbsp;</td>
195                                 </tr>
196                                 </tbody>
197                         </table>
198                 </td>
199         </tr>
200 </table>
201
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>
206 {/foreach}
207 </div>
208 {/if}
209
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>
215 {/foreach}
216 </div>
217 {/if}
218 {/foreach}
219
220