2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 /*********************************************************************************
5 * SugarCRM Community Edition is a customer relationship management program developed by
6 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Affero General Public License version 3 as published by the
10 * Free Software Foundation with the addition of the following permission added
11 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
20 * You should have received a copy of the GNU Affero General Public License along with
21 * this program; if not, see http://www.gnu.org/licenses or write to the Free
22 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
28 * The interactive user interfaces in modified source and object code versions
29 * of this program must display Appropriate Legal Notices, as required under
30 * Section 5 of the GNU Affero General Public License version 3.
32 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33 * these Appropriate Legal Notices must retain the display of the "Powered by
34 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35 * technical reasons, the Appropriate Legal Notices must display the words
36 * "Powered by SugarCRM".
37 ********************************************************************************/
40 require_once('include/MVC/View/views/view.list.php');
41 require_once('include/connectors/sources/SourceFactory.php');
43 class ViewDisplayProperties extends ViewList
46 * @see SugarView::process()
48 public function process()
50 $this->options['show_all'] = false;
51 $this->options['show_javascript'] = true;
52 $this->options['show_footer'] = false;
53 $this->options['show_header'] = false;
58 * @see SugarView::display()
60 public function display()
62 require_once('include/connectors/utils/ConnectorUtils.php');
63 $source = $_REQUEST['source_id'];
64 $sources = ConnectorUtils::getConnectors();
65 $modules_sources = ConnectorUtils::getDisplayConfig();
67 $enabled_modules = array();
68 $disabled_modules = array();
70 //Find all modules this source has been enabled for
71 foreach($modules_sources as $module=>$mapping) {
72 foreach($modules_sources[$module] as $entry) {
73 if($entry == $source) {
74 $enabled_modules[$module] = isset($GLOBALS['app_list_strings']['moduleList'][$module]) ? $GLOBALS['app_list_strings']['moduleList'][$module] : $module;
80 global $moduleList, $beanList;
84 $access = $current_user->getDeveloperModules();
86 while($e = $d->read()){
87 if(substr($e, 0, 1) == '.' || !is_dir('modules/' . $e))continue;
88 if(empty($enabled_modules[$e]) && file_exists('modules/' . $e . '/metadata/studio.php') && file_exists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS [ 'beanList' ][$e]) && (in_array($e, $access) || is_admin($current_user))) // installed modules must also exist in the beanList
90 $disabled_modules[$e] = isset($GLOBALS['app_list_strings']['moduleList'][$e]) ? $GLOBALS['app_list_strings']['moduleList'][$e] : $e;
94 $s = SourceFactory::getSource($source);
96 // Not all sources can be connected to all modules
97 $enabled_modules = $s->filterAllowedModules($enabled_modules);
98 $disabled_modules = $s->filterAllowedModules($disabled_modules);
100 asort($enabled_modules);
101 asort($disabled_modules);
103 //$enabled = $json->encode($enabled_modules);
104 //$disabled = $json->encode($disabled_modules);
105 //$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
106 //$this->ss->assign('new_modules_sources', $modules_sources);
107 //$this->ss->assign('dynamic_script', $script);
109 $this->ss->assign('enabled_modules', $enabled_modules);
110 $this->ss->assign('disabled_modules', $disabled_modules);
111 $this->ss->assign('source_id', $source);
112 $this->ss->assign('mod', $GLOBALS['mod_strings']);
113 $this->ss->assign('APP', $GLOBALS['app_strings']);
114 $this->ss->assign('theme', $GLOBALS['theme']);
115 $this->ss->assign('external', !empty($sources[$source]['eapm']));
116 $this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
118 // We don't want to tell the user to set the properties of the connector if there aren't any
119 $fields = $s->getRequiredConfigFields();
120 $this->ss->assign('externalHasProperties', !empty($fields));
122 $this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled'])?" checked":"");
123 echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/display_properties.tpl'));