1 /*********************************************************************************
2 * SugarCRM Community Edition is a customer relationship management program developed by
3 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Affero General Public License version 3 as published by the
7 * Free Software Foundation with the addition of the following permission added
8 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
9 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
10 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
17 * You should have received a copy of the GNU Affero General Public License along with
18 * this program; if not, see http://www.gnu.org/licenses or write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
23 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25 * The interactive user interfaces in modified source and object code versions
26 * of this program must display Appropriate Legal Notices, as required under
27 * Section 5 of the GNU Affero General Public License version 3.
29 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
30 * these Appropriate Legal Notices must retain the display of the "Powered by
31 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
32 * technical reasons, the Appropriate Legal Notices must display the words
33 * "Powered by SugarCRM".
34 ********************************************************************************/
39 var subtabModules = [];
40 var tabLabelToValue = [];
41 StudioTabGroup = function(){
42 this.lastEditTabGroupLabel = -1;
46 StudioTabGroup.prototype.editTabGroupLabel = function (id, done){
48 if(this.lastEditTabGroupLabel != -1)StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel, true);
49 document.getElementById('tabname_'+id).style.display = 'none';
50 document.getElementById('tablabel_'+id).style.display = '';
51 document.getElementById('tabother_'+id).style.display = 'none';
52 //#28274, I think this is a simple way when a element can't accept focus()
54 document.getElementById('tablabel_'+id).focus();
59 this.lastEditTabGroupLabel = id;
60 YAHOO.util.DragDropMgr.lock();
62 this.lastEditTabGroupLabel = -1;
63 document.getElementById('tabname_'+id).innerHTML = escape(document.getElementById('tablabel_'+id).value);
64 document.getElementById('tabname_'+id).style.display = '';
65 document.getElementById('tablabel_'+id).style.display = 'none';
66 document.getElementById('tabother_'+id).style.display = '';
67 YAHOO.util.DragDropMgr.unlock();
71 StudioTabGroup.prototype.generateForm = function(formname){
72 var form = document.getElementById(formname);
73 for(var j = 0; j < slotCount; j++){
74 var ul = document.getElementById('ul' + j);
75 var items = ul.getElementsByTagName('li');
76 for(var i = 0; i < items.length; i++) {
77 if(typeof(subtabModules[items[i].id]) != 'undefined'){
79 var input = document.createElement('input');
81 input.name= j + '_'+ i;
82 input.value = tabLabelToValue[subtabModules[items[i].id]];
83 form.appendChild(input);
87 //set the slotcount in the form.
88 form.slot_count.value = slotCount;
91 StudioTabGroup.prototype.generateGroupForm = function(formname){
92 var form = document.getElementById(formname);
93 for(j = 0; j < slotCount; j++){
94 var ul = document.getElementById('ul' + j);
95 items = ul.getElementsByTagName('li');
96 for(i = 0; i < items.length; i++) {
97 if(typeof(subtabModules[items[i].id]) != 'undefined'){
98 var input = document.createElement('input');
100 input.name= 'group_'+ j + '[]';
101 input.value = tabLabelToValue[subtabModules[items[i].id]];
102 form.appendChild(input);
108 StudioTabGroup.prototype.deleteTabGroup = function(id){
109 if(document.getElementById('delete_' + id).value == 0){
110 document.getElementById('ul' + id).style.display = 'none';
111 document.getElementById('tabname_'+id).style.textDecoration = 'line-through'
112 document.getElementById('delete_' + id).value = 1;
114 document.getElementById('ul' + id).style.display = '';
115 document.getElementById('tabname_'+id).style.textDecoration = 'none'
116 document.getElementById('delete_' + id).value = 0;
122 var lastRowCount = -1;
123 var undoDeleteDropDown = function(transaction){
124 deleteDropDownValue(transaction['row'], document.getElementById(transaction['id']), false);
126 jstransaction.register('deleteDropDown', undoDeleteDropDown, undoDeleteDropDown);
127 function deleteDropDownValue(rowCount, field, record){
129 jstransaction.record('deleteDropDown',{'row':rowCount, 'id': field.id });
131 //We are deleting if the value is 0
132 if(field.value == '0'){
134 document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'line-through';
137 document.getElementById('slot' + rowCount + '_value').style.textDecoration = 'none';
142 var studiotabs = new StudioTabGroup();