]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Studio/TabGroups/EditViewTabs.tpl
Release 6.2.0
[Github/sugarcrm.git] / modules / Studio / TabGroups / EditViewTabs.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37
38
39
40 *}
41
42 {overlib_includes}
43 {literal}
44 <br />
45 <script type="text/javascript" src="modules/Studio/JSTransaction.js" ></script>
46 <script>
47         var jstransaction = new JSTransaction();
48 </script>
49 <script src="modules/Studio/studiotabgroups.js"></script>
50 <script src="modules/Studio/ygDDListStudio.js"></script>                                        
51 <script type="text/javascript" src="modules/Studio/studiodd.js" ></script>      
52 <script type="text/javascript" src="modules/Studio/studio.js" ></script>        
53 <style type='text/css'>
54 .slot {
55         border-width:1px;border-color:#999999;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
56
57 }
58
59
60 .slotSub {
61         border-width:1px;border-color:#006600;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
62
63 }
64 .slotB {
65         border-width:0;cursor:move;
66
67 }
68 .listContainer
69 {
70         margin-left: 4;
71         padding-left: 4;
72         margin-right: 4;
73         padding-right: 4;
74         list-style-type: none;
75 }
76
77  ul.listContainer
78 {
79         margin-left: 10px;
80         margin-right: 10px;
81         padding-left: 0;
82 }
83 .tdContainer{
84         border: thin solid gray;
85         padding: 10;
86 }
87
88 </style>
89 {/literal}
90 <h2 >{$title}</h2>
91 <p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
92 <br/>
93 <table cellspacing=2>
94 <button style='cursor:default' onmousedown='this.className="buttonOn";return false;' 
95             onmouseup='this.className="button"' onmouseout='this.className="button"' 
96             onclick='studiotabs.generateForm("edittabs");document.edittabs.submit()'>
97             {$MOD.LBL_BTN_SAVEPUBLISH}</button>
98 </table>
99 <p />
100 <form name='edittabs' id='edittabs' method='POST' action='index.php'>
101 <input type="hidden" name="slot_count" id="slot_count" value="" />  
102 <table  cellpadding="0" cellspacing="0" border="0" width="100%">
103 <tr>
104         <td width="100%" class='dataLabel' colspan=2>
105         {$MOD.LBL_TABGROUP_LANGUAGE}&nbsp;
106         {html_options name='grouptab_lang' options=$available_languages selected=$tabGroupSelected_lang onchange=" tabLanguageChange(this)"}
107         {sugar_help text=$MOD.LBL_TAB_GROUP_LANGUAGE_HELP}
108         </td>
109 </tr>
110 </table>
111 <table><tr><td valign='top' nowrap class="edit view" style="width: auto;">
112 <table  cellpadding="0" cellspacing="0" width="100%"   id='s_field_delete'>
113                                                         <tr><td ><ul id='trash' class='listContainer'>
114 <li class='nobullet' id='trashcan'><table>
115   <tr>
116         <td>{$recycleImage}</td>
117         <td><br />{$MOD.LBL_DELETE_MODULE}</td>
118   </tr>
119   </table></li>
120
121 </ul>
122                                                 </td></tr></table>
123
124
125 <div class='noBullet'><h2>{$MOD.LBL_MODULES}</h2>
126 <ul class='listContainer'>
127 {counter start=0 name="modCounter" print=false assign="modCounter"}
128 {foreach from=$availableModuleList key='key' item='value'}
129
130
131 <li  id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
132 <script>
133 tabLabelToValue['{$value.label}'] = '{$value.value}';
134 subtabModules['modSlot{$modCounter}'] = '{$value.label}'</script>
135 {counter name="modCounter"}
136 {/foreach}
137 </ul>
138 </td>
139 <td valign='top' nowrap>
140 <table class='tableContainer' id='groupTable'><tr>
141 {counter start=0 name="tabCounter" print=false assign="tabCounter"}
142
143 {foreach from=$tabs item='tab' key='tabName'}
144 {if $tabCounter > 0 && $tabCounter % 6 == 0}
145 </tr><tr>
146 {/if}
147 <td valign='top' class='tdContainer'>
148 <div id='slot{$tabCounter}' class='noBullet'><h2 id='handle{$tabCounter}' ><span id='tabname_{$tabCounter}' class='slotB'>{$tab.labelValue}</span><br><span id='tabother_{$tabCounter}'><span onclick='studiotabs.editTabGroupLabel({$tabCounter}, false)'>{$editImage}</span>&nbsp;
149 {if $tab.label != $otherLabel }
150         <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
151 {/if}
152 </span></h2><input type='hidden' name='tablabelid_{$tabCounter}' id='tablabelid_{$tabCounter}'  value='{$tab.label}'><input type='text' name='tablabel_{$tabCounter}' id='tablabel_{$tabCounter}' style='display:none' value='{$tab.labelValue}' onblur='studiotabs.editTabGroupLabel({$tabCounter}, true)'>
153 <ul id='ul{$tabCounter}' class='listContainer'>
154 {counter start=0 name="subtabCounter" print=false assign="subtabCounter"}
155 {foreach from=$tab.modules key='list' item='name'}
156
157 <li id='subslot{$tabCounter}_{$subtabCounter}' class='listStyle' name='{$list}'><span class='slotB' >{$availableModuleList[$list].label}</span></li>
158 <script>subtabModules['subslot{$tabCounter}_{$subtabCounter}'] = '{$availableModuleList[$list].label}'</script>
159 {counter name="subtabCounter"}
160 {/foreach}
161 <li class='noBullet' id='noselectbottom{$tabCounter}'>&nbsp;</li>
162 <script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
163 </ul>
164 </div>
165 <div id='slot{$tabCounter}b'>
166 <input type='hidden' name='slot_{$tabCounter}' id='slot_{$tabCounter}' value ='{$tabCounter}'>
167 <input type='hidden' name='delete_{$tabCounter}' id='delete_{$tabCounter}' value ='0'>
168 </div>
169 {counter name="tabCounter"}
170 </td>
171 {/foreach}
172
173 </tr>
174 <tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
175 </table>
176
177 </td>
178 </table>
179
180
181
182 <span class='error'>{$error}</span>
183
184
185
186 {literal}
187
188
189                 <script>
190                 function tabLanguageChange(sel){
191                         var partURL = window.location.href;
192                         if(partURL.search(/&lang=\w*&/i) != -1){
193                                 partURL = partURL.replace(/&lang=\w*&/i, '&lang='+ sel.value+'&');
194                         }else if(partURL.search(/&lang=\w*/i) != -1){
195                                 partURL = partURL.replace(/&lang=\w*/i, '&lang='+ sel.value);
196                         }else{
197                                 partURL = window.location.href + '&lang='+ sel.value;
198                         }
199                         window.location.href = partURL;
200                 }
201                 
202                 function addTabGroup(){
203                         var table = document.getElementById('groupTable');
204                         var rowIndex = table.rows.length - 1;
205                         var rowExists = false;
206                         for(var i = 0; i < rowIndex;i++){
207                                 if(table.rows[i].cells.length < 6){
208                                         rowIndex = i;
209                                         rowExists = true;
210                                 }
211                         }
212                         
213                         if(!rowExists)table.insertRow(rowIndex);
214                         cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
215                         cell.className='tdContainer';
216                         cell.vAlign='top';
217                         var slotDiv = document.createElement('div');
218                         slotDiv.id = 'slot'+ slotCount;
219                         var header = document.createElement('h2');
220                         header.id = 'handle' + slotCount;
221                         headerSpan = document.createElement('span');
222                         headerSpan.innerHTML = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
223                         headerSpan.id = 'tabname_' + slotCount;
224                         header.appendChild(headerSpan);
225                         header.appendChild(document.createElement('br'));
226                         headerSpan2 = document.createElement('span');
227                         headerSpan2.id = 'tabother_' + slotCount;
228                         subspan1 = document.createElement('span');
229                         subspan1.slotCount=slotCount;
230                         subspan1.innerHTML = '{/literal}{$editImage}{literal}&nbsp;';
231                         subspan1.onclick= function(){
232                                 studiotabs.editTabGroupLabel(this.slotCount, false);
233                         };
234                         subspan2 = document.createElement('span');
235                         subspan2.slotCount=slotCount;
236                         subspan2.innerHTML = '{/literal}{$deleteImage}{literal}&nbsp;';
237                         subspan2.onclick= function(){
238                                 studiotabs.deleteTabGroup(this.slotCount);
239                         };
240                         headerSpan2.appendChild(subspan1);
241                         headerSpan2.appendChild(subspan2);
242                         
243                         var editLabel = document.createElement('input');
244                         editLabel.style.display = 'none';
245                         editLabel.type = 'text';
246                         editLabel.value = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
247                         editLabel.id = 'tablabel_' + slotCount;
248                         editLabel.name = 'tablabel_' + slotCount;
249                         editLabel.slotCount = slotCount;
250                         editLabel.onblur = function(){
251                                 studiotabs.editTabGroupLabel(this.slotCount, true);
252                         }
253                         
254                         var list = document.createElement('ul');
255                         list.id = 'ul' + slotCount;
256                         list.className = 'listContainer';
257                         header.appendChild(headerSpan2);
258                         var li = document.createElement('li');
259                         li.id = 'noselectbottom' + slotCount;
260                         li.className = 'noBullet';
261                         li.innerHTML = '{/literal}{$TGMOD.LBL_DROP_HERE}{literal}';
262                         list.appendChild(li);
263                         
264                         slotDiv.appendChild(header);
265                         slotDiv.appendChild(editLabel);
266                         slotDiv.appendChild(list);
267                         var slotB = document.createElement('div');
268                         slotB.id = 'slot' + slotCount + 'b';
269                         var slot = document.createElement('input');
270                         slot.type = 'hidden';
271                         slot.id =  'slot_' + slotCount;
272                         slot.name =  'slot_' + slotCount; 
273                         slot.value = slotCount;
274                         var deleteSlot = document.createElement('input');
275                         deleteSlot.type = 'hidden';
276                         deleteSlot.id =  'delete_' + slotCount;
277                         deleteSlot.name =  'delete_' + slotCount; 
278                         deleteSlot.value = 0;
279                         slotB.appendChild(slot);
280                         slotB.appendChild(deleteSlot);
281                         cell.appendChild(slotDiv);
282                         cell.appendChild(slotB);
283                         
284                         yahooSlots["slot" + slotCount] = new ygDDSlot("slot" + slotCount, "mainTabs");
285                         yahooSlots["slot" + slotCount].setHandleElId("handle" + slotCount);
286                         yahooSlots["noselectbottom"+ slotCount] = new ygDDListStudio("noselectbottom"+ slotCount , "subTabs", -1);
287                         subtabCount[slotCount] = 0;
288                         slotCount++;
289                         ygDDListStudio.prototype.updateTabs();
290                 }
291                 
292                 var slotCount = {/literal}{$tabCounter}{literal};
293                 var modCount = {/literal}{$modCounter}{literal};
294                 var subSlots = [];
295                 var yahooSlots = [];
296                 
297                 function dragDropInit(){
298
299                         YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
300
301                         for(mj = 0; mj <= slotCount; mj++){
302                                 yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
303                                 yahooSlots["slot" + mj].setHandleElId("handle" + mj);
304                                 
305                                 yahooSlots["noselectbottom"+ mj] = new ygDDListStudio("noselectbottom"+ mj , "subTabs", -1);
306                                 for(msi = 0; msi <= subtabCount[mj]; msi++){
307                                         yahooSlots["subslot"+ mj + '_' + msi] = new ygDDListStudio("subslot"+ mj + '_' + msi, "subTabs", 0);
308                                         
309                                 }
310                                 
311                         }
312                         for(msi = 0; msi <= modCount ; msi++){
313                                         yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
314                                         
315                         }
316                         var trash1  = new ygDDListStudio("trashcan" , "subTabs", 'trash');
317                         ygDDListStudio.prototype.updateTabs();
318                 
319                 }
320                         
321                 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT; 
322                 YAHOO.util.Event.addListener(window, "load", dragDropInit);
323                         
324 </script>       
325 {/literal}
326         <input type='hidden' name='action' value='SaveTabs'>
327         <input type='hidden' name='module' value='Studio'>
328 </form>
329
330