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-2011 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();
66 //$json = getJSONobj();
68 $enabled_modules = array();
69 $disabled_modules = array();
71 //Find all modules this source has been enabled for
72 foreach($modules_sources as $module=>$mapping) {
73 foreach($modules_sources[$module] as $entry) {
74 if($entry == $source) {
75 $enabled_modules[$module] = $module;
81 global $moduleList, $beanList;
85 $access = get_admin_modules_for_user($current_user);
87 while($e = $d->read()){
88 if(substr($e, 0, 1) == '.' || !is_dir('modules/' . $e))continue;
89 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
91 $disabled_modules[$e] = $e;
95 asort($enabled_modules);
96 asort($disabled_modules);
98 //$enabled = $json->encode($enabled_modules);
99 //$disabled = $json->encode($disabled_modules);
100 //$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
101 //$this->ss->assign('new_modules_sources', $modules_sources);
102 //$this->ss->assign('dynamic_script', $script);
104 $this->ss->assign('enabled_modules', $enabled_modules);
105 $this->ss->assign('disabled_modules', $disabled_modules);
106 $this->ss->assign('source_id', $source);
107 $this->ss->assign('mod', $GLOBALS['mod_strings']);
108 $this->ss->assign('APP', $GLOBALS['app_strings']);
109 $this->ss->assign('theme', $GLOBALS['theme']);
110 $this->ss->assign('external', !empty($sources[$source]['eapm']));
111 $this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
113 // We don't want to tell the user to set the properties of the connector if there aren't any
114 $s = SourceFactory::getSource($source);
115 $fields = $s->getRequiredConfigFields();
116 $this->ss->assign('externalHasProperties', !empty($fields));
118 $this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled'])?" checked":"");
119 echo $this->ss->fetch('modules/Connectors/tpls/display_properties.tpl');