init
This commit is contained in:
122
modules/Studio/TabGroups/EditViewTabs.php
Normal file
122
modules/Studio/TabGroups/EditViewTabs.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
global $app_list_strings, $app_strings, $mod_strings;
|
||||
|
||||
require_once('modules/Studio/TabGroups/TabGroupHelper.php');
|
||||
require_once('modules/Studio/parsers/StudioParser.php');
|
||||
|
||||
$tabGroupSelected_lang = (!empty($_GET['lang'])?$_GET['lang']:$_SESSION['authenticated_user_language']);
|
||||
$tg = new TabGroupHelper();
|
||||
$smarty = new Sugar_Smarty();
|
||||
if(empty($GLOBALS['tabStructure'])){
|
||||
require_once('include/tabConfig.php');
|
||||
}
|
||||
$title=get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_CONFIGURE_GROUP_TABS'], true);
|
||||
|
||||
#30205
|
||||
$selectedAppLanguages = return_application_language($tabGroupSelected_lang);
|
||||
require_once('include/GroupedTabs/GroupedTabStructure.php');
|
||||
$groupedTabsClass = new GroupedTabStructure();
|
||||
$groupedTabStructure = $groupedTabsClass->get_tab_structure('', '', true,true);
|
||||
foreach($groupedTabStructure as $mainTab => $subModules){
|
||||
$groupedTabStructure[$mainTab]['label'] = $mainTab;
|
||||
$groupedTabStructure[$mainTab]['labelValue'] = $selectedAppLanguages[$mainTab];
|
||||
}
|
||||
//If there is other group in groupedTabStructure, we should add an empty array in it.
|
||||
if(!isset($groupedTabStructure['LBL_TABGROUP_OTHER'])){
|
||||
$groupedTabStructure['LBL_TABGROUP_OTHER'] = array();
|
||||
$groupedTabStructure['LBL_TABGROUP_OTHER']['modules'] = array();
|
||||
$groupedTabStructure['LBL_TABGROUP_OTHER']['label'] = 'LBL_TABGROUP_OTHER';
|
||||
$groupedTabStructure['LBL_TABGROUP_OTHER']['labelValue'] = $selectedAppLanguages['LBL_TABGROUP_OTHER'];
|
||||
}
|
||||
|
||||
$smarty->assign('tabs', $groupedTabStructure);
|
||||
#end of 30205
|
||||
$selectedLanguageModStrings = return_module_language($tabGroupSelected_lang , 'Studio');
|
||||
$smarty->assign('TGMOD', $selectedLanguageModStrings);
|
||||
$smarty->assign('MOD', $GLOBALS['mod_strings']);
|
||||
$smarty->assign('otherLabel', 'LBL_TABGROUP_OTHER');
|
||||
$selected_lang = (!empty($_REQUEST['dropdown_lang'])?$_REQUEST['dropdown_lang']:$_SESSION['authenticated_user_language']);
|
||||
if(empty($selected_lang)){
|
||||
$selected_lang = $GLOBALS['sugar_config']['default_language'];
|
||||
}
|
||||
$availableModules = $tg->getAvailableModules($tabGroupSelected_lang);
|
||||
$smarty->assign('availableModuleList',$availableModules);
|
||||
|
||||
$smarty->assign('dropdown_languages', get_languages());
|
||||
|
||||
|
||||
$imageSave = SugarThemeRegistry::current()->getImage( 'studio_save', '');
|
||||
|
||||
$buttons = array();
|
||||
$buttons [] = array ( 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'],'actionScript'=>"onclick='studiotabs.generateForm(\"edittabs\");document.edittabs.submit()'" ) ;
|
||||
$html = "" ;
|
||||
foreach ( $buttons as $button )
|
||||
{
|
||||
$html .= "<td><input type='button' valign='center' class='button' style='cursor:pointer' onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>" ;
|
||||
}
|
||||
$smarty->assign('buttons', $html);
|
||||
$smarty->assign('title', $title);
|
||||
$smarty->assign('dropdown_lang', $selected_lang);
|
||||
|
||||
$editImage = SugarThemeRegistry::current()->getImage( 'edit_inline', '');
|
||||
$smarty->assign('editImage',$editImage);
|
||||
$deleteImage = SugarThemeRegistry::current()->getImage( 'delete_inline', '');
|
||||
$recycleImage = SugarThemeRegistry::current()->getImage('icon_Delete','',48,48 );
|
||||
$smarty->assign('deleteImage',$deleteImage);
|
||||
$smarty->assign('recycleImage',$recycleImage);
|
||||
|
||||
//#30205
|
||||
global $sugar_config;
|
||||
if(isset($sugar_config['other_group_tab_displayed'])){
|
||||
if($sugar_config['other_group_tab_displayed']){
|
||||
$value = 'checked';
|
||||
}else{
|
||||
$value = null;
|
||||
}
|
||||
$smarty->assign('other_group_tab_displayed', $value);
|
||||
}else{
|
||||
$smarty->assign('other_group_tab_displayed', 'checked');
|
||||
}
|
||||
$smarty->assign('tabGroupSelected_lang', $tabGroupSelected_lang);
|
||||
|
||||
$smarty->assign('available_languages', get_languages());
|
||||
$smarty->display("modules/Studio/TabGroups/EditViewTabs.tpl");
|
||||
?>
|
||||
342
modules/Studio/TabGroups/EditViewTabs.tpl
Normal file
342
modules/Studio/TabGroups/EditViewTabs.tpl
Normal file
@@ -0,0 +1,342 @@
|
||||
{*
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
{overlib_includes}
|
||||
{literal}
|
||||
<br />
|
||||
<script type="text/javascript" src="modules/Studio/JSTransaction.js" ></script>
|
||||
<script>
|
||||
var jstransaction = new JSTransaction();
|
||||
</script>
|
||||
<script src = "include/javascript/yui/dragdrop.js" ></script>
|
||||
<script src='modules/Studio/studiotabgroups.js'></script>
|
||||
<script src = "modules/Studio/ygDDListStudio.js" ></script>
|
||||
<script type="text/javascript" src="modules/Studio/studiodd.js" ></script>
|
||||
<script type="text/javascript" src="modules/Studio/studio.js" ></script>
|
||||
<style type='text/css'>
|
||||
.slot {
|
||||
border-width:1px;border-color:#999999;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.slotSub {
|
||||
border-width:1px;border-color:#006600;border-style:solid;padding:0px 1px 0px 1px;margin:2px;cursor:move;
|
||||
|
||||
}
|
||||
.slotB {
|
||||
border-width:0;cursor:move;
|
||||
|
||||
}
|
||||
.listContainer
|
||||
{
|
||||
margin-left: 4;
|
||||
padding-left: 4;
|
||||
margin-right: 4;
|
||||
padding-right: 4;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
ul.listContainer
|
||||
{
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.tdContainer{
|
||||
border: thin solid gray;
|
||||
padding: 10;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
<h2 >{$title}</h2>
|
||||
<p>{$MOD.LBL_GROUP_TAB_WELCOME}</p>
|
||||
<br/>
|
||||
<table cellspacing=2>
|
||||
<button style='cursor:default' onmousedown='this.className="buttonOn";return false;'
|
||||
onmouseup='this.className="button"' onmouseout='this.className="button"'
|
||||
onclick='studiotabs.generateForm("edittabs");document.edittabs.submit()'>
|
||||
{$MOD.LBL_BTN_SAVEPUBLISH}</button>
|
||||
</table>
|
||||
{if isset($tabs[$otherLabel]) }
|
||||
<p />
|
||||
<form name='edittabs' id='edittabs' method='POST' action='index.php'>
|
||||
<input type="hidden" name="slot_count" id="slot_count" value="" />
|
||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="2%" class='dataLabel'>
|
||||
<input name="other_group_tab_displayed" value="1" class="checkbox" type="checkbox" {$other_group_tab_displayed} >
|
||||
</td>
|
||||
<td width="97%" class='dataLabel'>
|
||||
{$MOD.LBL_DISPLAY_OTHER_TAB}
|
||||
{sugar_help text=$MOD.LBL_DISPLAY_OTHER_TAB_HELP}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="100%" class='dataLabel' colspan=2>
|
||||
{$MOD.LBL_TABGROUP_LANGUAGE}
|
||||
{html_options name='grouptab_lang' options=$available_languages selected=$tabGroupSelected_lang onchange=" tabLanguageChange(this)"}
|
||||
{sugar_help text=$MOD.LBL_TAB_GROUP_LANGUAGE_HELP}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
<table><tr><td valign='top' nowrap class="edit view" style="width: auto;">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" id='s_field_delete'>
|
||||
<tr><td ><ul id='trash' class='listContainer'>
|
||||
<li class='nobullet' id='trashcan'><table>
|
||||
<tr>
|
||||
<td>{$recycleImage}</td>
|
||||
<td><br />{$MOD.LBL_DELETE_MODULE}</td>
|
||||
</tr>
|
||||
</table></li>
|
||||
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<div class='noBullet'><h2>{$MOD.LBL_MODULES}</h2>
|
||||
<ul class='listContainer'>
|
||||
{counter start=0 name="modCounter" print=false assign="modCounter"}
|
||||
{foreach from=$availableModuleList key='key' item='value'}
|
||||
|
||||
|
||||
<li id='modSlot{$modCounter}'><span class='slotB'>{$value.label}</span></li>
|
||||
<script>
|
||||
tabLabelToValue['{$value.label}'] = '{$value.value}';
|
||||
subtabModules['modSlot{$modCounter}'] = '{$value.label}';
|
||||
</script>
|
||||
{counter name="modCounter"}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
<td valign='top' nowrap>
|
||||
<table class='tableContainer' id='groupTable'><tr>
|
||||
{counter start=0 name="tabCounter" print=false assign="tabCounter"}
|
||||
|
||||
{foreach from=$tabs item='tab' key='tabName'}
|
||||
{if $tabCounter > 0 && $tabCounter % 6 == 0}
|
||||
</tr><tr>
|
||||
{/if}
|
||||
<td valign='top' class='tdContainer'>
|
||||
<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>
|
||||
{if $tab.label != $otherLabel }
|
||||
<span onclick='studiotabs.deleteTabGroup({$tabCounter})'>{$deleteImage}</span>
|
||||
{/if}
|
||||
</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)'>
|
||||
<ul id='ul{$tabCounter}' class='listContainer'>
|
||||
{counter start=0 name="subtabCounter" print=false assign="subtabCounter"}
|
||||
{foreach from=$tab.modules item='list' key='module_name'}
|
||||
|
||||
<li id='subslot{$tabCounter}_{$subtabCounter}' class='listStyle' name='{$list}'><span class='slotB' >{$availableModuleList[$module_name].label}</span></li>
|
||||
<script>subtabModules['subslot{$tabCounter}_{$subtabCounter}'] = '{$availableModuleList[$module_name].label}'</script>
|
||||
{counter name="subtabCounter"}
|
||||
{/foreach}
|
||||
<li class='noBullet' id='noselectbottom{$tabCounter}'> </li>
|
||||
<script>subtabCount[{$tabCounter}] = {$subtabCounter};</script>
|
||||
</ul>
|
||||
</div>
|
||||
<div id='slot{$tabCounter}b'>
|
||||
<input type='hidden' name='slot_{$tabCounter}' id='slot_{$tabCounter}' value ='{$tabCounter}'>
|
||||
<input type='hidden' name='delete_{$tabCounter}' id='delete_{$tabCounter}' value ='0'>
|
||||
</div>
|
||||
{counter name="tabCounter"}
|
||||
</td>
|
||||
{/foreach}
|
||||
|
||||
</tr>
|
||||
<tr><td><input type='button' class='button' onclick='addTabGroup()' value='{$MOD.LBL_ADD_GROUP}'></td></tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<span class='error'>{$error}</span>
|
||||
|
||||
|
||||
|
||||
{literal}
|
||||
|
||||
|
||||
<script>
|
||||
function tabLanguageChange(sel){
|
||||
var partURL = window.location.href;
|
||||
if(partURL.search(/&lang=\w*&/i) != -1){
|
||||
partURL = partURL.replace(/&lang=\w*&/i, '&lang='+ sel.value+'&');
|
||||
}else if(partURL.search(/&lang=\w*/i) != -1){
|
||||
partURL = partURL.replace(/&lang=\w*/i, '&lang='+ sel.value);
|
||||
}else{
|
||||
partURL = window.location.href + '&lang='+ sel.value;
|
||||
}
|
||||
window.location.href = partURL;
|
||||
}
|
||||
|
||||
function addTabGroup(){
|
||||
var table = document.getElementById('groupTable');
|
||||
var rowIndex = table.rows.length - 1;
|
||||
var rowExists = false;
|
||||
for(var i = 0; i < rowIndex;i++){
|
||||
if(table.rows[i].cells.length < 6){
|
||||
rowIndex = i;
|
||||
rowExists = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!rowExists)table.insertRow(rowIndex);
|
||||
cell = table.rows[rowIndex].insertCell(table.rows[rowIndex].cells.length);
|
||||
cell.className='tdContainer';
|
||||
cell.vAlign='top';
|
||||
var slotDiv = document.createElement('div');
|
||||
slotDiv.id = 'slot'+ slotCount;
|
||||
var header = document.createElement('h2');
|
||||
header.id = 'handle' + slotCount;
|
||||
headerSpan = document.createElement('span');
|
||||
headerSpan.innerHTML = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
|
||||
headerSpan.id = 'tabname_' + slotCount;
|
||||
header.appendChild(headerSpan);
|
||||
header.appendChild(document.createElement('br'));
|
||||
headerSpan2 = document.createElement('span');
|
||||
headerSpan2.id = 'tabother_' + slotCount;
|
||||
subspan1 = document.createElement('span');
|
||||
subspan1.slotCount=slotCount;
|
||||
subspan1.innerHTML = '{/literal}{$editImage}{literal} ';
|
||||
subspan1.onclick= function(){
|
||||
studiotabs.editTabGroupLabel(this.slotCount, false);
|
||||
};
|
||||
subspan2 = document.createElement('span');
|
||||
subspan2.slotCount=slotCount;
|
||||
subspan2.innerHTML = '{/literal}{$deleteImage}{literal} ';
|
||||
subspan2.onclick= function(){
|
||||
studiotabs.deleteTabGroup(this.slotCount);
|
||||
};
|
||||
headerSpan2.appendChild(subspan1);
|
||||
headerSpan2.appendChild(subspan2);
|
||||
|
||||
var editLabel = document.createElement('input');
|
||||
editLabel.style.display = 'none';
|
||||
editLabel.type = 'text';
|
||||
editLabel.value = '{/literal}{$TGMOD.LBL_NEW_GROUP}{literal}';
|
||||
editLabel.id = 'tablabel_' + slotCount;
|
||||
editLabel.name = 'tablabel_' + slotCount;
|
||||
editLabel.slotCount = slotCount;
|
||||
editLabel.onblur = function(){
|
||||
studiotabs.editTabGroupLabel(this.slotCount, true);
|
||||
}
|
||||
|
||||
var list = document.createElement('ul');
|
||||
list.id = 'ul' + slotCount;
|
||||
list.className = 'listContainer';
|
||||
header.appendChild(headerSpan2);
|
||||
var li = document.createElement('li');
|
||||
li.id = 'noselectbottom' + slotCount;
|
||||
li.className = 'noBullet';
|
||||
li.innerHTML = '{/literal}{$TGMOD.LBL_DROP_HERE}{literal}';
|
||||
list.appendChild(li);
|
||||
|
||||
slotDiv.appendChild(header);
|
||||
slotDiv.appendChild(editLabel);
|
||||
slotDiv.appendChild(list);
|
||||
var slotB = document.createElement('div');
|
||||
slotB.id = 'slot' + slotCount + 'b';
|
||||
var slot = document.createElement('input');
|
||||
slot.type = 'hidden';
|
||||
slot.id = 'slot_' + slotCount;
|
||||
slot.name = 'slot_' + slotCount;
|
||||
slot.value = slotCount;
|
||||
var deleteSlot = document.createElement('input');
|
||||
deleteSlot.type = 'hidden';
|
||||
deleteSlot.id = 'delete_' + slotCount;
|
||||
deleteSlot.name = 'delete_' + slotCount;
|
||||
deleteSlot.value = 0;
|
||||
slotB.appendChild(slot);
|
||||
slotB.appendChild(deleteSlot);
|
||||
cell.appendChild(slotDiv);
|
||||
cell.appendChild(slotB);
|
||||
|
||||
yahooSlots["slot" + slotCount] = new ygDDSlot("slot" + slotCount, "mainTabs");
|
||||
yahooSlots["slot" + slotCount].setHandleElId("handle" + slotCount);
|
||||
yahooSlots["noselectbottom"+ slotCount] = new ygDDListStudio("noselectbottom"+ slotCount , "subTabs", -1);
|
||||
subtabCount[slotCount] = 0;
|
||||
slotCount++;
|
||||
ygDDListStudio.prototype.updateTabs();
|
||||
}
|
||||
|
||||
var slotCount = {/literal}{$tabCounter}{literal};
|
||||
var modCount = {/literal}{$modCounter}{literal};
|
||||
var subSlots = [];
|
||||
var yahooSlots = [];
|
||||
|
||||
function dragDropInit(){
|
||||
|
||||
YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT;
|
||||
|
||||
for(mj = 0; mj <= slotCount; mj++){
|
||||
yahooSlots["slot" + mj] = new ygDDSlot("slot" + mj, "mainTabs");
|
||||
yahooSlots["slot" + mj].setHandleElId("handle" + mj);
|
||||
|
||||
yahooSlots["noselectbottom"+ mj] = new ygDDListStudio("noselectbottom"+ mj , "subTabs", -1);
|
||||
for(msi = 0; msi <= subtabCount[mj]; msi++){
|
||||
yahooSlots["subslot"+ mj + '_' + msi] = new ygDDListStudio("subslot"+ mj + '_' + msi, "subTabs", 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
for(msi = 0; msi <= modCount ; msi++){
|
||||
yahooSlots["modSlot"+ msi] = new ygDDListStudio("modSlot" + msi, "subTabs", 1);
|
||||
|
||||
}
|
||||
var trash1 = new ygDDListStudio("trashcan" , "subTabs", 'trash');
|
||||
ygDDListStudio.prototype.updateTabs();
|
||||
|
||||
}
|
||||
|
||||
YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
|
||||
YAHOO.util.Event.addListener(window, "load", dragDropInit);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
<input type='hidden' name='action' value='SaveTabs'>
|
||||
<input type='hidden' name='module' value='Studio'>
|
||||
</form>
|
||||
|
||||
|
||||
142
modules/Studio/TabGroups/TabGroupHelper.php
Normal file
142
modules/Studio/TabGroups/TabGroupHelper.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
|
||||
require_once('modules/Administration/Common.php');
|
||||
class TabGroupHelper{
|
||||
var $modules = array();
|
||||
|
||||
function getAvailableModules($lang = ''){
|
||||
static $availableModules = array();
|
||||
if(!empty($availableModules))return $availableModules;
|
||||
$specifyLanguageAppListStrings = $GLOBALS['app_list_strings'];
|
||||
if(!empty($lang)){
|
||||
$specifyLanguageAppListStrings = return_app_list_strings_language($lang);
|
||||
}
|
||||
foreach($GLOBALS['moduleList'] as $value){
|
||||
$availableModules[$value] = array('label'=>$specifyLanguageAppListStrings['moduleList'][$value], 'value'=>$value);
|
||||
}
|
||||
foreach($GLOBALS['modInvisListActivities'] as $value){
|
||||
$availableModules[$value] = array('label'=>$specifyLanguageAppListStrings['moduleList'][$value], 'value'=>$value);
|
||||
}
|
||||
|
||||
if(should_hide_iframes() && isset($availableModules['iFrames'])) {
|
||||
unset($availableModules['iFrames']);
|
||||
}
|
||||
return $availableModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes in the request params from a save request and processes
|
||||
* them for the save.
|
||||
*
|
||||
* @param REQUEST params $params
|
||||
*/
|
||||
function saveTabGroups($params){
|
||||
//#30205
|
||||
global $sugar_config;
|
||||
if (strcmp($params['other_group_tab_displayed'], '1') == 0) {
|
||||
$value = true;
|
||||
}else{
|
||||
$value = false;
|
||||
}
|
||||
if(!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value){
|
||||
require_once('modules/Configurator/Configurator.php');
|
||||
$cfg = new Configurator();
|
||||
$cfg->config['other_group_tab_displayed'] = $value;
|
||||
$cfg->handleOverride();
|
||||
}
|
||||
|
||||
//Get the selected tab group language
|
||||
$grouptab_lang = (!empty($params['grouptab_lang'])?$params['grouptab_lang']:$_SESSION['authenticated_user_language']);
|
||||
|
||||
$tabGroups = array();
|
||||
$selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
|
||||
$slot_count = $params['slot_count'];
|
||||
$completedIndexes = array();
|
||||
for($count = 0; $count < $slot_count; $count++){
|
||||
if($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$index = $params['slot_' . $count];
|
||||
if (isset($completedIndexes[$index]))
|
||||
continue;
|
||||
|
||||
$labelID = (!empty($params['tablabelid_' . $index]))?$params['tablabelid_' . $index]: 'LBL_GROUPTAB' . $count . '_'. time();
|
||||
$labelValue = $params['tablabel_' . $index];
|
||||
$appStirngs = return_application_language($grouptab_lang);
|
||||
if(empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue){
|
||||
$contents = return_custom_app_list_strings_file_contents($grouptab_lang);
|
||||
$new_contents = replace_or_add_app_string($labelID,$labelValue, $contents);
|
||||
save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
|
||||
|
||||
$languages = get_languages();
|
||||
foreach ($languages as $language => $langlabel) {
|
||||
if($grouptab_lang == $language){
|
||||
continue;
|
||||
}
|
||||
$appStirngs = return_application_language($language);
|
||||
if(!isset($appStirngs[$labelID])){
|
||||
$contents = return_custom_app_list_strings_file_contents($language);
|
||||
$new_contents = replace_or_add_app_string($labelID,$labelValue, $contents);
|
||||
save_custom_app_list_strings_contents($new_contents, $language);
|
||||
}
|
||||
}
|
||||
|
||||
$app_strings[$labelID] = $labelValue;
|
||||
|
||||
}
|
||||
$tabGroups[$labelID] = array('label'=>$labelID);
|
||||
$tabGroups[$labelID]['modules']= array();
|
||||
for($subcount = 0; isset($params[$index.'_' . $subcount]); $subcount++){
|
||||
$tabGroups[$labelID]['modules'][] = $params[$index.'_' . $subcount];
|
||||
}
|
||||
|
||||
$completedIndexes[$index] = true;
|
||||
|
||||
}
|
||||
sugar_cache_put('app_strings', $GLOBALS['app_strings']);
|
||||
$newFile = create_custom_directory('include/tabConfig.php');
|
||||
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
|
||||
$GLOBALS['tabStructure'] = $tabGroups;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user