2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 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 ********************************************************************************/
45 <script type="text/javascript" src="modules/Studio/JSTransaction.js" ></script>
47 var jstransaction = new JSTransaction();
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'>
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 border: thin solid gray;
91 <p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
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>
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%">
104 <td width="100%" class='dataLabel' colspan=2>
105 {$MOD.LBL_TABGROUP_LANGUAGE}
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}
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>
116 <td>{$recycleImage}</td>
117 <td><br />{$MOD.LBL_DELETE_MODULE}</td>
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'}
131 <li id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
133 tabLabelToValue['{$value.label}'] = '{$value.value}';
134 subtabModules['modSlot{$modCounter}'] = '{$value.label}'</script>
135 {counter name="modCounter"}
139 <td valign='top' nowrap>
140 <table class='tableContainer' id='groupTable'><tr>
141 {counter start=0 name="tabCounter" print=false assign="tabCounter"}
143 {foreach from=$tabs item='tab' key='tabName'}
144 {if $tabCounter > 0 && $tabCounter % 6 == 0}
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>
149 {if $tab.label != $otherLabel }
150 <span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
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'}
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"}
161 <li class='noBullet' id='noselectbottom{$tabCounter}'> </li>
162 <script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
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'>
169 {counter name="tabCounter"}
174 <tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
182 <span class='error'>{$error}</span>
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);
197 partURL = window.location.href + '&lang='+ sel.value;
199 window.location.href = partURL;
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){
213 if(!rowExists)table.insertRow(rowIndex);
214 cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
215 cell.className='tdContainer';
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} ';
231 subspan1.onclick= function(){
232 studiotabs.editTabGroupLabel(this.slotCount, false);
234 subspan2 = document.createElement('span');
235 subspan2.slotCount=slotCount;
236 subspan2.innerHTML = '{/literal}{$deleteImage}{literal} ';
237 subspan2.onclick= function(){
238 studiotabs.deleteTabGroup(this.slotCount);
240 headerSpan2.appendChild(subspan1);
241 headerSpan2.appendChild(subspan2);
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);
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);
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);
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;
289 ygDDListStudio.prototype.updateTabs();
292 var slotCount = {/literal}{$tabCounter}{literal};
293 var modCount = {/literal}{$modCounter}{literal};
297 function dragDropInit(){
299 YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
301 for(mj = 0; mj <= slotCount; mj++){
302 yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
303 yahooSlots["slot" + mj].setHandleElId("handle" + mj);
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);
312 for(msi = 0; msi <= modCount ; msi++){
313 yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
316 var trash1 = new ygDDListStudio("trashcan" , "subTabs", 'trash');
317 ygDDListStudio.prototype.updateTabs();
321 YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
322 YAHOO.util.Event.addListener(window, "load", dragDropInit);
326 <input type='hidden' name='action' value='SaveTabs'>
327 <input type='hidden' name='module' value='Studio'>