2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
43 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/JSTransaction.js'}" ></script>
45 var jstransaction = new JSTransaction();
47 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studiotabgroups.js'}"></script>
48 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/ygDDListStudio.js'}"></script>
49 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studiodd.js'}" ></script>
50 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/studio.js'}" ></script>
52 <style type='text/css'>
54 border-width:1px;border-color:#999999;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
60 border-width:1px;border-color:#006600;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
64 border-width:0;cursor:move;
73 list-style-type: none;
83 div.noBullet li, .nobullet
85 list-style-type: none;
95 border: thin solid gray;
102 <p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
104 <table cellspacing=2>
105 <button style='cursor:default' onmousedown='this.className="buttonOn";return false;'
106 onmouseup='this.className="button"' onmouseout='this.className="button"'
107 onclick='studiotabs.generateForm("edittabs");document.edittabs.submit()'>
108 {$MOD.LBL_BTN_SAVEPUBLISH}</button>
111 <form name='edittabs' id='edittabs' method='POST' action='index.php'>
112 <input type="hidden" name="slot_count" id="slot_count" value="" />
113 <table cellpadding="0" cellspacing="0" border="0" width="100%">
115 <td width="100%" class='dataLabel' colspan=2>
116 {$MOD.LBL_TABGROUP_LANGUAGE}
117 {html_options name='grouptab_lang' options=$available_languages selected=$tabGroupSelected_lang onchange=" tabLanguageChange(this)"}
118 {sugar_help text=$MOD.LBL_TAB_GROUP_LANGUAGE_HELP}
122 <table><tr><td valign='top' nowrap class="edit view" style="width: auto;">
123 <table cellpadding="0" cellspacing="0" width="100%" id='s_field_delete'>
124 <tr><td ><ul id='trash' class='listContainer'>
125 <li class='nobullet' id='trashcan'><table>
127 <td>{$recycleImage}</td>
128 <td><br />{$MOD.LBL_DELETE_MODULE}</td>
136 <div class='noBullet' style="padding-left: 20px;"><h2>{$MOD.LBL_MODULES}</h2>
137 <ul class='listContainer'>
138 {counter start=0 name="modCounter" print=false assign="modCounter"}
139 {foreach from=$availableModuleList key='key' item='value'}
142 <li id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
144 tabLabelToValue['{$value.label}'] = '{$value.value}';
145 subtabModules['modSlot{$modCounter}'] = '{$value.label}'</script>
146 {counter name="modCounter"}
150 <td valign='top' nowrap>
151 <table class='tableContainer' id='groupTable'><tr>
152 {counter start=0 name="tabCounter" print=false assign="tabCounter"}
154 {foreach from=$tabs item='tab' key='tabName'}
155 {if $tabCounter > 0 && $tabCounter % 6 == 0}
158 <td valign='top' class='tdContainer'>
159 <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>
160 {if $tab.label != $otherLabel }
161 <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
163 </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)'>
164 <ul id='ul{$tabCounter}' class='listContainer'>
165 {counter start=0 name="subtabCounter" print=false assign="subtabCounter"}
166 {foreach from=$tab.modules key='list' item='name'}
168 <li id='subslot{$tabCounter}_{$subtabCounter}' class='listStyle' name='{$list}'><span class='slotB' >{$availableModuleList[$list].label}</span></li>
169 <script>subtabModules['subslot{$tabCounter}_{$subtabCounter}'] = '{$availableModuleList[$list].label}'</script>
170 {counter name="subtabCounter"}
172 <li class='noBullet' id='noselectbottom{$tabCounter}'> </li>
173 <script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
176 <div id='slot{$tabCounter}b'>
177 <input type='hidden' name='slot_{$tabCounter}' id='slot_{$tabCounter}' value ='{$tabCounter}'>
178 <input type='hidden' name='delete_{$tabCounter}' id='delete_{$tabCounter}' value ='0'>
180 {counter name="tabCounter"}
185 <tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
193 <span class='error'>{$error}</span>
201 function tabLanguageChange(sel){
202 var partURL = window.location.href;
203 if(partURL.search(/&lang=\w*&/i) != -1){
204 partURL = partURL.replace(/&lang=\w*&/i, '&lang='+ sel.value+'&');
205 }else if(partURL.search(/&lang=\w*/i) != -1){
206 partURL = partURL.replace(/&lang=\w*/i, '&lang='+ sel.value);
208 partURL = window.location.href + '&lang='+ sel.value;
210 window.location.href = partURL;
213 function addTabGroup(){
214 var table = document.getElementById('groupTable');
215 var rowIndex = table.rows.length - 1;
216 var rowExists = false;
217 for(var i = 0; i < rowIndex;i++){
218 if(table.rows[i].cells.length < 6){
224 if(!rowExists)table.insertRow(rowIndex);
225 cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
226 cell.className='tdContainer';
228 var slotDiv = document.createElement('div');
229 slotDiv.id = 'slot'+ slotCount;
230 var header = document.createElement('h2');
231 header.id = 'handle' + slotCount;
232 headerSpan = document.createElement('span');
233 headerSpan.innerHTML = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
234 headerSpan.id = 'tabname_' + slotCount;
235 header.appendChild(headerSpan);
236 header.appendChild(document.createElement('br'));
237 headerSpan2 = document.createElement('span');
238 headerSpan2.id = 'tabother_' + slotCount;
239 subspan1 = document.createElement('span');
240 subspan1.slotCount=slotCount;
241 subspan1.innerHTML = '{/literal}{$editImage}{literal} ';
242 subspan1.onclick= function(){
243 studiotabs.editTabGroupLabel(this.slotCount, false);
245 subspan2 = document.createElement('span');
246 subspan2.slotCount=slotCount;
247 subspan2.innerHTML = '{/literal}{$deleteImage}{literal} ';
248 subspan2.onclick= function(){
249 studiotabs.deleteTabGroup(this.slotCount);
251 headerSpan2.appendChild(subspan1);
252 headerSpan2.appendChild(subspan2);
254 var editLabel = document.createElement('input');
255 editLabel.style.display = 'none';
256 editLabel.type = 'text';
257 editLabel.value = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
258 editLabel.id = 'tablabel_' + slotCount;
259 editLabel.name = 'tablabel_' + slotCount;
260 editLabel.slotCount = slotCount;
261 editLabel.onblur = function(){
262 studiotabs.editTabGroupLabel(this.slotCount, true);
265 var list = document.createElement('ul');
266 list.id = 'ul' + slotCount;
267 list.className = 'listContainer';
268 header.appendChild(headerSpan2);
269 var li = document.createElement('li');
270 li.id = 'noselectbottom' + slotCount;
271 li.className = 'noBullet';
272 li.innerHTML = '{/literal}{$TGMOD.LBL_DROP_HERE}{literal}';
273 list.appendChild(li);
275 slotDiv.appendChild(header);
276 slotDiv.appendChild(editLabel);
277 slotDiv.appendChild(list);
278 var slotB = document.createElement('div');
279 slotB.id = 'slot' + slotCount + 'b';
280 var slot = document.createElement('input');
281 slot.type = 'hidden';
282 slot.id = 'slot_' + slotCount;
283 slot.name = 'slot_' + slotCount;
284 slot.value = slotCount;
285 var deleteSlot = document.createElement('input');
286 deleteSlot.type = 'hidden';
287 deleteSlot.id = 'delete_' + slotCount;
288 deleteSlot.name = 'delete_' + slotCount;
289 deleteSlot.value = 0;
290 slotB.appendChild(slot);
291 slotB.appendChild(deleteSlot);
292 cell.appendChild(slotDiv);
293 cell.appendChild(slotB);
295 yahooSlots["slot" + slotCount] = new ygDDSlot("slot" + slotCount, "mainTabs");
296 yahooSlots["slot" + slotCount].setHandleElId("handle" + slotCount);
297 yahooSlots["noselectbottom"+ slotCount] = new ygDDListStudio("noselectbottom"+ slotCount , "subTabs", -1);
298 subtabCount[slotCount] = 0;
300 ygDDListStudio.prototype.updateTabs();
303 var slotCount = {/literal}{$tabCounter}{literal};
304 var modCount = {/literal}{$modCounter}{literal};
308 function dragDropInit(){
310 YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
312 for(mj = 0; mj <= slotCount; mj++){
313 yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
314 yahooSlots["slot" + mj].setHandleElId("handle" + mj);
316 yahooSlots["noselectbottom"+ mj] = new ygDDListStudio("noselectbottom"+ mj , "subTabs", -1);
317 for(msi = 0; msi <= subtabCount[mj]; msi++){
318 yahooSlots["subslot"+ mj + '_' + msi] = new ygDDListStudio("subslot"+ mj + '_' + msi, "subTabs", 0);
323 for(msi = 0; msi <= modCount ; msi++){
324 yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
327 var trash1 = new ygDDListStudio("trashcan" , "subTabs", 'trash');
328 ygDDListStudio.prototype.updateTabs();
332 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
333 YAHOO.util.Event.addListener(window, "load", dragDropInit);
337 <input type='hidden' name='action' value='SaveTabs'>
338 <input type='hidden' name='module' value='Studio'>