2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
41 require_once('modules/Administration/Common.php');
43 var $modules = array();
44 function getAvailableModules($lang = ''){
45 static $availableModules = array();
46 if(!empty($availableModules))return $availableModules;
47 $specifyLanguageAppListStrings = $GLOBALS['app_list_strings'];
49 $specifyLanguageAppListStrings = return_app_list_strings_language($lang);
51 foreach($GLOBALS['moduleList'] as $value){
52 $availableModules[$value] = array('label'=>$specifyLanguageAppListStrings['moduleList'][$value], 'value'=>$value);
55 if(should_hide_iframes() && isset($availableModules['iFrames'])) {
56 unset($availableModules['iFrames']);
58 return $availableModules;
62 * Takes in the request params from a save request and processes
65 * @param REQUEST params $params
67 function saveTabGroups($params){
71 //Get the selected tab group language
72 $grouptab_lang = (!empty($params['grouptab_lang'])?$params['grouptab_lang']:$_SESSION['authenticated_user_language']);
75 $selected_lang = (!empty($params['dropdown_lang'])?$params['dropdown_lang']:$_SESSION['authenticated_user_language']);
76 $slot_count = $params['slot_count'];
77 $completedIndexes = array();
78 for($count = 0; $count < $slot_count; $count++){
79 if($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])){
84 $index = $params['slot_' . $count];
85 if (isset($completedIndexes[$index]))
88 $labelID = (!empty($params['tablabelid_' . $index]))?$params['tablabelid_' . $index]: 'LBL_GROUPTAB' . $count . '_'. time();
89 $labelValue = $params['tablabel_' . $index];
90 $app_strings = return_application_language($grouptab_lang);
91 if(empty($app_strings[$labelID]) || $app_strings[$labelID] != $labelValue){
92 $contents = return_custom_app_list_strings_file_contents($grouptab_lang);
93 $new_contents = replace_or_add_app_string($labelID,$labelValue, $contents);
94 save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
96 $languages = get_languages();
97 foreach ($languages as $language => $langlabel) {
98 if($grouptab_lang == $language){
101 $app_strings = return_application_language($language);
102 if(!isset($app_strings[$labelID])){
103 $contents = return_custom_app_list_strings_file_contents($language);
104 $new_contents = replace_or_add_app_string($labelID,$labelValue, $contents);
105 save_custom_app_list_strings_contents($new_contents, $language);
109 $app_strings[$labelID] = $labelValue;
112 $tabGroups[$labelID] = array('label'=>$labelID);
113 $tabGroups[$labelID]['modules']= array();
114 for($subcount = 0; isset($params[$index.'_' . $subcount]); $subcount++){
115 $tabGroups[$labelID]['modules'][] = $params[$index.'_' . $subcount];
118 $completedIndexes[$index] = true;
121 // Force a rebuild of the app language
122 sugar_cache_clear('app_strings.'.$grouptab_lang);
123 $newFile = create_custom_directory('include/tabConfig.php');
124 write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
125 $GLOBALS['tabStructure'] = $tabGroups;