2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 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 ********************************************************************************/
44 <script type="text/javascript" src="{sugar_getjspath file='modules/Studio/JSTransaction.js'}" ></script>
46 var jstransaction = new JSTransaction();
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>
53 <style type='text/css'>
55 border-width:1px;border-color:#999999;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
61 border-width:1px;border-color:#006600;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
65 border-width:0;cursor:move;
74 list-style-type: none;
84 div.noBullet li, .nobullet
86 list-style-type: none;
96 border: thin solid gray;
103 <p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
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>
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%">
116 <td width="100%" class='dataLabel' colspan=2>
117 {$MOD.LBL_TABGROUP_LANGUAGE}
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}
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>
128 <td>{$recycleImage}</td>
129 <td><br />{$MOD.LBL_DELETE_MODULE}</td>
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'}
143 <li id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
145 tabLabelToValue['{$value.label}'] = '{$value.value}';
146 subtabModules['modSlot{$modCounter}'] = '{$value.label}'</script>
147 {counter name="modCounter"}
151 <td valign='top' nowrap>
152 <table class='tableContainer' id='groupTable'><tr>
153 {counter start=0 name="tabCounter" print=false assign="tabCounter"}
155 {foreach from=$tabs item='tab' key='tabName'}
156 {if $tabCounter > 0 && $tabCounter % 6 == 0}
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>
161 {if $tab.label != $otherLabel }
162 <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
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'}
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"}
173 <li class='noBullet' id='noselectbottom{$tabCounter}'> </li>
174 <script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
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'>
181 {counter name="tabCounter"}
186 <tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
194 <span class='error'>{$error}</span>
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);
209 partURL = window.location.href + '&lang='+ sel.value;
211 window.location.href = partURL;
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){
225 if(!rowExists)table.insertRow(rowIndex);
226 cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
227 cell.className='tdContainer';
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} ';
243 subspan1.onclick= function(){
244 studiotabs.editTabGroupLabel(this.slotCount, false);
246 subspan2 = document.createElement('span');
247 subspan2.slotCount=slotCount;
248 subspan2.innerHTML = '{/literal}{$deleteImage}{literal} ';
249 subspan2.onclick= function(){
250 studiotabs.deleteTabGroup(this.slotCount);
252 headerSpan2.appendChild(subspan1);
253 headerSpan2.appendChild(subspan2);
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);
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);
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);
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;
301 ygDDListStudio.prototype.updateTabs();
304 var slotCount = {/literal}{$tabCounter}{literal};
305 var modCount = {/literal}{$modCounter}{literal};
309 function dragDropInit(){
311 YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
313 for(mj = 0; mj <= slotCount; mj++){
314 yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
315 yahooSlots["slot" + mj].setHandleElId("handle" + mj);
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);
324 for(msi = 0; msi <= modCount ; msi++){
325 yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
328 var trash1 = new ygDDListStudio("trashcan" , "subTabs", 'trash');
329 ygDDListStudio.prototype.updateTabs();
333 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
334 YAHOO.util.Event.addListener(window, "load", dragDropInit);
338 <input type='hidden' name='action' value='SaveTabs'>
339 <input type='hidden' name='module' value='Studio'>