]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Studio/TabGroups/EditViewTabs.tpl
Release 6.4.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 <br />
44 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/JSTransaction.js'}" ></script>
45 <script>
46         var jstransaction = new JSTransaction();
47 </script>
48 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studiotabgroups.js'}"></script>
49 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/ygDDListStudio.js'}"></script>
50 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studiodd.js'}" ></script>
51 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studio.js'}" ></script>
52 {literal}
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
84 div.noBullet li, .nobullet
85 {
86     list-style-type: none;
87 }
88
89 ul#trash
90 {
91     padding: 0px;
92     margin: 0px;
93 }
94
95 .tdContainer{
96         border: thin solid gray;
97         padding: 10;
98 }
99
100 </style>
101 {/literal}
102 <h2 >{$title}</h2>
103 <p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
104 <br/>
105 <table cellspacing=2>
106 <button style='cursor:default' onmousedown='this.className="buttonOn";return false;'
107             onmouseup='this.className="button"' onmouseout='this.className="button"'
108             onclick='studiotabs.generateForm("edittabs");document.edittabs.submit()'>
109             {$MOD.LBL_BTN_SAVEPUBLISH}</button>
110 </table>
111 <p />
112 <form name='edittabs' id='edittabs' method='POST' action='index.php'>
113 <input type="hidden" name="slot_count" id="slot_count" value="" />
114 <table  cellpadding="0" cellspacing="0" border="0" width="100%">
115 <tr>
116         <td width="100%" class='dataLabel' colspan=2>
117         {$MOD.LBL_TABGROUP_LANGUAGE}&nbsp;
118         {html_options name='grouptab_lang' options=$available_languages selected=$tabGroupSelected_lang onchange=" tabLanguageChange(this)"}
119         {sugar_help text=$MOD.LBL_TAB_GROUP_LANGUAGE_HELP}
120         </td>
121 </tr>
122 </table>
123 <table><tr><td valign='top' nowrap class="edit view" style="width: auto;">
124 <table  cellpadding="0" cellspacing="0" width="100%"   id='s_field_delete'>
125                                                         <tr><td ><ul id='trash' class='listContainer'>
126 <li class='nobullet' id='trashcan'><table>
127   <tr>
128         <td>{$recycleImage}</td>
129         <td><br />{$MOD.LBL_DELETE_MODULE}</td>
130   </tr>
131   </table></li>
132
133 </ul>
134                                                 </td></tr></table>
135
136
137 <div class='noBullet' style="padding-left: 20px;"><h2>{$MOD.LBL_MODULES}</h2>
138 <ul class='listContainer'>
139 {counter start=0 name="modCounter" print=false assign="modCounter"}
140 {foreach from=$availableModuleList key='key' item='value'}
141
142
143 <li  id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
144 <script>
145 tabLabelToValue['{$value.label}'] = '{$value.value}';
146 subtabModules['modSlot{$modCounter}'] = '{$value.label}'</script>
147 {counter name="modCounter"}
148 {/foreach}
149 </ul>
150 </td>
151 <td valign='top' nowrap>
152 <table class='tableContainer' id='groupTable'><tr>
153 {counter start=0 name="tabCounter" print=false assign="tabCounter"}
154
155 {foreach from=$tabs item='tab' key='tabName'}
156 {if $tabCounter > 0 && $tabCounter % 6 == 0}
157 </tr><tr>
158 {/if}
159 <td valign='top' class='tdContainer'>
160 <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;
161 {if $tab.label != $otherLabel }
162         <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
163 {/if}
164 </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)'>
165 <ul id='ul{$tabCounter}' class='listContainer'>
166 {counter start=0 name="subtabCounter" print=false assign="subtabCounter"}
167 {foreach from=$tab.modules key='list' item='name'}
168
169 <li id='subslot{$tabCounter}_{$subtabCounter}' class='listStyle' name='{$list}'><span class='slotB' >{$availableModuleList[$list].label}</span></li>
170 <script>subtabModules['subslot{$tabCounter}_{$subtabCounter}'] = '{$availableModuleList[$list].label}'</script>
171 {counter name="subtabCounter"}
172 {/foreach}
173 <li class='noBullet' id='noselectbottom{$tabCounter}'>&nbsp;</li>
174 <script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
175 </ul>
176 </div>
177 <div id='slot{$tabCounter}b'>
178 <input type='hidden' name='slot_{$tabCounter}' id='slot_{$tabCounter}' value ='{$tabCounter}'>
179 <input type='hidden' name='delete_{$tabCounter}' id='delete_{$tabCounter}' value ='0'>
180 </div>
181 {counter name="tabCounter"}
182 </td>
183 {/foreach}
184
185 </tr>
186 <tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
187 </table>
188
189 </td>
190 </table>
191
192
193
194 <span class='error'>{$error}</span>
195
196
197
198 {literal}
199
200
201                 <script>
202                 function tabLanguageChange(sel){
203                         var partURL = window.location.href;
204                         if(partURL.search(/&lang=\w*&/i) != -1){
205                                 partURL = partURL.replace(/&lang=\w*&/i, '&lang='+ sel.value+'&');
206                         }else if(partURL.search(/&lang=\w*/i) != -1){
207                                 partURL = partURL.replace(/&lang=\w*/i, '&lang='+ sel.value);
208                         }else{
209                                 partURL = window.location.href + '&lang='+ sel.value;
210                         }
211                         window.location.href = partURL;
212                 }
213
214                 function addTabGroup(){
215                         var table = document.getElementById('groupTable');
216                         var rowIndex = table.rows.length - 1;
217                         var rowExists = false;
218                         for(var i = 0; i < rowIndex;i++){
219                                 if(table.rows[i].cells.length < 6){
220                                         rowIndex = i;
221                                         rowExists = true;
222                                 }
223                         }
224
225                         if(!rowExists)table.insertRow(rowIndex);
226                         cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
227                         cell.className='tdContainer';
228                         cell.vAlign='top';
229                         var slotDiv = document.createElement('div');
230                         slotDiv.id = 'slot'+ slotCount;
231                         var header = document.createElement('h2');
232                         header.id = 'handle' + slotCount;
233                         headerSpan = document.createElement('span');
234                         headerSpan.innerHTML = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
235                         headerSpan.id = 'tabname_' + slotCount;
236                         header.appendChild(headerSpan);
237                         header.appendChild(document.createElement('br'));
238                         headerSpan2 = document.createElement('span');
239                         headerSpan2.id = 'tabother_' + slotCount;
240                         subspan1 = document.createElement('span');
241                         subspan1.slotCount=slotCount;
242                         subspan1.innerHTML = '{/literal}{$editImage}{literal}&nbsp;';
243                         subspan1.onclick= function(){
244                                 studiotabs.editTabGroupLabel(this.slotCount, false);
245                         };
246                         subspan2 = document.createElement('span');
247                         subspan2.slotCount=slotCount;
248                         subspan2.innerHTML = '{/literal}{$deleteImage}{literal}&nbsp;';
249                         subspan2.onclick= function(){
250                                 studiotabs.deleteTabGroup(this.slotCount);
251                         };
252                         headerSpan2.appendChild(subspan1);
253                         headerSpan2.appendChild(subspan2);
254
255                         var editLabel = document.createElement('input');
256                         editLabel.style.display = 'none';
257                         editLabel.type = 'text';
258                         editLabel.value = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
259                         editLabel.id = 'tablabel_' + slotCount;
260                         editLabel.name = 'tablabel_' + slotCount;
261                         editLabel.slotCount = slotCount;
262                         editLabel.onblur = function(){
263                                 studiotabs.editTabGroupLabel(this.slotCount, true);
264                         }
265
266                         var list = document.createElement('ul');
267                         list.id = 'ul' + slotCount;
268                         list.className = 'listContainer';
269                         header.appendChild(headerSpan2);
270                         var li = document.createElement('li');
271                         li.id = 'noselectbottom' + slotCount;
272                         li.className = 'noBullet';
273                         li.innerHTML = '{/literal}{$TGMOD.LBL_DROP_HERE}{literal}';
274                         list.appendChild(li);
275
276                         slotDiv.appendChild(header);
277                         slotDiv.appendChild(editLabel);
278                         slotDiv.appendChild(list);
279                         var slotB = document.createElement('div');
280                         slotB.id = 'slot' + slotCount + 'b';
281                         var slot = document.createElement('input');
282                         slot.type = 'hidden';
283                         slot.id =  'slot_' + slotCount;
284                         slot.name =  'slot_' + slotCount;
285                         slot.value = slotCount;
286                         var deleteSlot = document.createElement('input');
287                         deleteSlot.type = 'hidden';
288                         deleteSlot.id =  'delete_' + slotCount;
289                         deleteSlot.name =  'delete_' + slotCount;
290                         deleteSlot.value = 0;
291                         slotB.appendChild(slot);
292                         slotB.appendChild(deleteSlot);
293                         cell.appendChild(slotDiv);
294                         cell.appendChild(slotB);
295
296                         yahooSlots["slot" + slotCount] = new ygDDSlot("slot" + slotCount, "mainTabs");
297                         yahooSlots["slot" + slotCount].setHandleElId("handle" + slotCount);
298                         yahooSlots["noselectbottom"+ slotCount] = new ygDDListStudio("noselectbottom"+ slotCount , "subTabs", -1);
299                         subtabCount[slotCount] = 0;
300                         slotCount++;
301                         ygDDListStudio.prototype.updateTabs();
302                 }
303
304                 var slotCount = {/literal}{$tabCounter}{literal};
305                 var modCount = {/literal}{$modCounter}{literal};
306                 var subSlots = [];
307                 var yahooSlots = [];
308
309                 function dragDropInit(){
310
311                         YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
312
313                         for(mj = 0; mj <= slotCount; mj++){
314                                 yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
315                                 yahooSlots["slot" + mj].setHandleElId("handle" + mj);
316
317                                 yahooSlots["noselectbottom"+ mj] = new ygDDListStudio("noselectbottom"+ mj , "subTabs", -1);
318                                 for(msi = 0; msi <= subtabCount[mj]; msi++){
319                                         yahooSlots["subslot"+ mj + '_' + msi] = new ygDDListStudio("subslot"+ mj + '_' + msi, "subTabs", 0);
320
321                                 }
322
323                         }
324                         for(msi = 0; msi <= modCount ; msi++){
325                                         yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
326
327                         }
328                         var trash1  = new ygDDListStudio("trashcan" , "subTabs", 'trash');
329                         ygDDListStudio.prototype.updateTabs();
330
331                 }
332
333                 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
334                 YAHOO.util.Event.addListener(window, "load", dragDropInit);
335
336 </script>
337 {/literal}
338         <input type='hidden' name='action' value='SaveTabs'>
339         <input type='hidden' name='module' value='Studio'>
340 </form>
341
342