]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Studio/studiotabgroups.js
Release 6.5.0
[Github/sugarcrm.git] / modules / Studio / studiotabgroups.js
1 /*********************************************************************************
2  * SugarCRM Community Edition is a customer relationship management program developed by
3  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
4  *
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.
11  *
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
15  * details.
16  *
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
20  * 02110-1301 USA.
21  *
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.
24  *
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.
28  *
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  ********************************************************************************/
35 var subtabCount=[];var subtabModules=[];var tabLabelToValue=[];StudioTabGroup=function(){this.lastEditTabGroupLabel=-1;};StudioTabGroup.prototype.editTabGroupLabel=function(id,done){if(!done){if(this.lastEditTabGroupLabel!=-1)StudioTabGroup.prototype.editTabGroupLabel(this.lastEditTabGroupLabel,true);document.getElementById('tabname_'+id).style.display='none';document.getElementById('tablabel_'+id).style.display='';document.getElementById('tabother_'+id).style.display='none';try{document.getElementById('tablabel_'+id).focus();}
36 catch(er){}
37 this.lastEditTabGroupLabel=id;YAHOO.util.DragDropMgr.lock();}else{this.lastEditTabGroupLabel=-1;document.getElementById('tabname_'+id).innerHTML=escape(document.getElementById('tablabel_'+id).value);document.getElementById('tabname_'+id).style.display='';document.getElementById('tablabel_'+id).style.display='none';document.getElementById('tabother_'+id).style.display='';YAHOO.util.DragDropMgr.unlock();}}
38 StudioTabGroup.prototype.generateForm=function(formname){var form=document.getElementById(formname);for(var j=0;j<slotCount;j++){var ul=document.getElementById('ul'+j);var items=ul.getElementsByTagName('li');for(var i=0;i<items.length;i++){if(typeof(subtabModules[items[i].id])!='undefined'){var input=document.createElement('input');input.type='hidden';input.name=j+'_'+i;input.value=tabLabelToValue[subtabModules[items[i].id]];form.appendChild(input);}}}
39 form.slot_count.value=slotCount;};StudioTabGroup.prototype.generateGroupForm=function(formname){var form=document.getElementById(formname);for(j=0;j<slotCount;j++){var ul=document.getElementById('ul'+j);items=ul.getElementsByTagName('li');for(i=0;i<items.length;i++){if(typeof(subtabModules[items[i].id])!='undefined'){var input=document.createElement('input');input.type='hidden'
40 input.name='group_'+j+'[]';input.value=tabLabelToValue[subtabModules[items[i].id]];form.appendChild(input);}}}};StudioTabGroup.prototype.deleteTabGroup=function(id){if(document.getElementById('delete_'+id).value==0){document.getElementById('ul'+id).style.display='none';document.getElementById('tabname_'+id).style.textDecoration='line-through'
41 document.getElementById('delete_'+id).value=1;}else{document.getElementById('ul'+id).style.display='';document.getElementById('tabname_'+id).style.textDecoration='none'
42 document.getElementById('delete_'+id).value=0;}}
43 var lastField='';var lastRowCount=-1;var undoDeleteDropDown=function(transaction){deleteDropDownValue(transaction['row'],document.getElementById(transaction['id']),false);}
44 jstransaction.register('deleteDropDown',undoDeleteDropDown,undoDeleteDropDown);function deleteDropDownValue(rowCount,field,record){if(record){jstransaction.record('deleteDropDown',{'row':rowCount,'id':field.id});}
45 if(field.value=='0'){field.value='1';document.getElementById('slot'+rowCount+'_value').style.textDecoration='line-through';}else{field.value='0';document.getElementById('slot'+rowCount+'_value').style.textDecoration='none';}}
46 var studiotabs=new StudioTabGroup();