Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<?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".
********************************************************************************/
class ViewConnectorSettings extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
$mod_strings['LBL_ADMINISTRATION_MAIN']
);
}
/**
* @see SugarView::_getModuleTab()
*/
protected function _getModuleTab()
{
return 'Administration';
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
echo $this->getModuleTitle();
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('app', $app_strings);
$this->ss->assign('IMG', 'themes/default/images/');
$this->ss->display('modules/Connectors/tpls/administration.tpl');
}
}

View File

@@ -0,0 +1,111 @@
<?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('include/MVC/View/views/view.list.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewDisplayProperties extends ViewList
{
/**
* @see SugarView::process()
*/
public function process()
{
$this->options['show_all'] = false;
$this->options['show_javascript'] = true;
$this->options['show_footer'] = false;
$this->options['show_header'] = false;
parent::process();
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
$source = $_REQUEST['source_id'];
$sources = ConnectorUtils::getConnectors();
$modules_sources = ConnectorUtils::getDisplayConfig();
//$json = getJSONobj();
$enabled_modules = array();
$disabled_modules = array();
//Find all modules this source has been enabled for
foreach($modules_sources as $module=>$mapping) {
foreach($modules_sources[$module] as $entry) {
if($entry == $source) {
$enabled_modules[$module] = $module;
}
}
}
global $moduleList, $beanList;
//Do filtering here?
$count = 0;
global $current_user;
$access = get_admin_modules_for_user($current_user);
$d = dir('modules');
while($e = $d->read()){
if(substr($e, 0, 1) == '.' || !is_dir('modules/' . $e))continue;
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
{
$disabled_modules[$e] = $e;
}
}
asort($enabled_modules);
asort($disabled_modules);
//$enabled = $json->encode($enabled_modules);
//$disabled = $json->encode($disabled_modules);
//$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
//$this->ss->assign('new_modules_sources', $modules_sources);
//$this->ss->assign('dynamic_script', $script);
$this->ss->assign('enabled_modules', $enabled_modules);
$this->ss->assign('disabled_modules', $disabled_modules);
$this->ss->assign('source_id', $source);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->ss->fetch('modules/Connectors/tpls/display_properties.tpl');
}
}

View File

@@ -0,0 +1,157 @@
<?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('include/MVC/View/views/view.list.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewMappingProperties extends ViewList
{
/**
* @see SugarView::process()
*/
public function process()
{
$this->options['show_all'] = false;
$this->options['show_javascript'] = true;
$this->options['show_footer'] = false;
$this->options['show_header'] = false;
parent::process();
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
require_once('include/connectors/sources/SourceFactory.php');
$connector_strings = ConnectorUtils::getConnectorStrings($_REQUEST['source_id']);
$sources = ConnectorUtils::getConnectors();
$source_id = $_REQUEST['source_id'];
$source = SourceFactory::getSource($source_id);
$is_enabled = ConnectorUtils::isSourceEnabled($source_id);
$script = '';
$display_data = array();
if($is_enabled) {
$mapping = $source->getMapping();
$source_defs = $source->getFieldDefs();
//Create the Javascript code to dynamically add the tables
$json = getJSONobj();
foreach($mapping['beans'] as $module=>$field_mapping) {
$mod_strings = return_module_language($GLOBALS['current_language'], $module);
$bean = loadBean($module);
if ( !is_object($bean) )
continue;
$field_defs = $bean->getFieldDefinitions();
$available_fields = array();
$labels = array();
$duplicate_labels = array();
foreach($field_defs as $id=>$def) {
//We are filtering out some fields here
if($def['type'] == 'relate' || $def['type'] == 'link' || (isset($def['dbType']) && $def['dbType'] == 'id')) {
continue;
}
if(isset($def['vname'])) {
$available_fields[$id] = !empty($mod_strings[$def['vname']]) ? $mod_strings[$def['vname']] : $id;
} else {
$available_fields[$id] = $id;
}
//Remove the ':' character in some labels
if(preg_match('/\:$/', $available_fields[$id])) {
$available_fields[$id] = substr($available_fields[$id], 0, strlen($available_fields[$id])-1);
}
if(isset($labels[$available_fields[$id]])) {
$duplicate_labels[$labels[$available_fields[$id]]] = $labels[$available_fields[$id]];
$duplicate_labels[$id] = $id;
} else {
$labels[$available_fields[$id]] = $id;
}
}
foreach($duplicate_labels as $id) {
$available_fields[$id] = $available_fields[$id] . " ({$id})";
}
asort($available_fields);
$field_keys = array();
$field_values = array();
$source_fields = array();
foreach($field_mapping as $id=>$field) {
if(!empty($source_defs[$id])) {
$source_fields[$id] = $source_defs[$id];
}
}
$source_fields = array_merge($source_fields, $source_defs);
foreach($source_fields as $id=>$def) {
if(empty($def['hidden'])){
$field_keys[strtolower($id)] = !empty($connector_strings[$source_fields[$id]['vname']]) ? $connector_strings[$source_fields[$id]['vname']] : $id;
$field_values[] = !empty($field_mapping[strtolower($id)]) ? $field_mapping[strtolower($id)] : '';
}
}
$display_data[$module] = array('field_keys' => $field_keys,
'field_values' => $field_values,
'available_fields' => $available_fields,
'field_mapping' => $field_mapping);
}
}
$this->ss->assign('display_data', $display_data);
$this->ss->assign('empty_mapping', empty($display_data) ? true : false);
$this->ss->assign('dynamic_script', $script);
$this->ss->assign('sources', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('source_id', $source_id);
$this->ss->assign('source_name', $sources[$source_id]['name']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->ss->fetch('modules/Connectors/tpls/mapping_properties.tpl');
}
}

View File

@@ -0,0 +1,81 @@
<?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('include/MVC/View/SugarView.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewModifyDisplay extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
"<a href='index.php?module=Connectors&action=ConnectorSettings'>".$mod_strings['LBL_ADMINISTRATION_MAIN']."</a>",
$mod_strings['LBL_MODIFY_DISPLAY_TITLE']
);
}
/**
* @see SugarView::_getModuleTab()
*/
protected function _getModuleTab()
{
return 'Administration';
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
$sources = ConnectorUtils::getConnectors();
$this->ss->assign('SOURCES', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_display.tpl');
}
}

View File

@@ -0,0 +1,82 @@
<?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('include/MVC/View/SugarView.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewModifyMapping extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
"<a href='index.php?module=Connectors&action=ConnectorSettings'>".$mod_strings['LBL_ADMINISTRATION_MAIN']."</a>",
$mod_strings['LBL_MODIFY_MAPPING_TITLE']
);
}
/**
* @see SugarView::_getModuleTab()
*/
protected function _getModuleTab()
{
return 'Administration';
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
require_once('include/connectors/sources/SourceFactory.php');
global $mod_strings, $app_strings;
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_mapping.tpl');
}
}

View File

@@ -0,0 +1,95 @@
<?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('include/MVC/View/SugarView.php');
class ViewModifyProperties extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
"<a href='index.php?module=Connectors&action=ConnectorSettings'>".$mod_strings['LBL_ADMINISTRATION_MAIN']."</a>",
$mod_strings['LBL_MODIFY_PROPERTIES_TITLE']
);
}
/**
* @see SugarView::_getModuleTab()
*/
protected function _getModuleTab()
{
return 'Administration';
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
require_once('include/connectors/utils/ConnectorUtils.php');
require_once('include/connectors/sources/SourceFactory.php');
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
foreach($connectors as $id=>$entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
foreach($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id]=$label;
}
break;
}
$this->ss->assign('SOURCES', $connectors);
$this->ss->assign('REQUIRED_FIELDS', $required_fields);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_properties.tpl');
}
}

View File

@@ -0,0 +1,89 @@
<?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('include/MVC/View/SugarView.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewModifySearch extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
"<a href='index.php?module=Connectors&action=ConnectorSettings'>".$mod_strings['LBL_ADMINISTRATION_MAIN']."</a>",
$mod_strings['LBL_MODIFY_SEARCH_TITLE']
);
}
/**
* @see SugarView::_getModuleTab()
*/
protected function _getModuleTab()
{
return 'Administration';
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
global $mod_strings, $app_strings;
$sugar_smarty = new Sugar_Smarty();
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors();
foreach($connectors as $id=>$source) {
$s = SourceFactory::getSource($id);
if(!$s->isEnabledInWizard()) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_search.tpl');
}
}

View File

@@ -0,0 +1,125 @@
<?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".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Contacts module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
require_once('include/connectors/sources/SourceFactory.php');
class ViewSearchProperties extends ViewList
{
/**
* @see SugarView::process()
*/
public function process()
{
$this->options['show_all'] = false;
$this->options['show_javascript'] = true;
$this->options['show_footer'] = false;
$this->options['show_header'] = false;
parent::process();
}
/**
* @see SugarView::display()
*/
public function display()
{
require_once('include/connectors/utils/ConnectorUtils.php');
require_once('include/connectors/sources/SourceFactory.php');
$source_id = $_REQUEST['source_id'];
$connector_strings = ConnectorUtils::getConnectorStrings($source_id);
$is_enabled = ConnectorUtils::isSourceEnabled($source_id);
$modules_sources = array();
$sources = ConnectorUtils::getConnectors();
$display_data = array();
if($is_enabled) {
$searchDefs = ConnectorUtils::getSearchDefs();
$searchDefs = !empty($searchDefs[$_REQUEST['source_id']]) ? $searchDefs[$_REQUEST['source_id']] : array();
$source = SourceFactory::getSource($_REQUEST['source_id']);
$field_defs = $source->getFieldDefs();
//Create the Javascript code to dynamically add the tables
$json = getJSONobj();
foreach($searchDefs as $module=>$fields) {
$disabled = array();
$enabled = array();
$enabled_fields = array_flip($fields);
$field_keys = array_keys($field_defs);
foreach($field_keys as $index=>$key) {
if(!empty($field_defs[$key]['hidden']) || empty($field_defs[$key]['search'])) {
continue;
}
if(!isset($enabled_fields[$key])) {
$disabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
} else {
$enabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
}
}
$modules_sources[$module] = array_merge($enabled, $disabled);
asort($disabled);
$display_data[$module] = array('enabled' => $enabled, 'disabled' => $disabled);
}
}
$this->ss->assign('no_searchdefs_defined', !$is_enabled);
$this->ss->assign('display_data', $display_data);
$this->ss->assign('modules_sources', $modules_sources);
$this->ss->assign('sources', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('source_id', $_REQUEST['source_id']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('connector_language', $connector_strings);
echo $this->ss->fetch('modules/Connectors/tpls/search_properties.tpl');
}
}

View File

@@ -0,0 +1,87 @@
<?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".
********************************************************************************/
/*********************************************************************************
* Description: This file is used to override the default Meta-data EditView behavior
* to provide customization specific to the Contacts module.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class ViewSourceProperties extends ViewList {
function ViewSourceProperties(){
parent::ViewList();
}
function process() {
parent::process();
}
function display() {
require_once('include/connectors/sources/SourceFactory.php');
require_once('include/connectors/utils/ConnectorUtils.php');
$source_id = $_REQUEST['source_id'];
$connector_language = ConnectorUtils::getConnectorStrings($source_id);
$source = SourceFactory::getSource($source_id);
$properties = $source->getProperties();
$required_fields = array();
$config_fields = $source->getRequiredConfigFields();
$fields = $source->getRequiredConfigFields();
foreach($fields as $field_id) {
$label = isset($connector_language[$field_id]) ? $connector_language[$field_id] : $field_id;
$required_fields[$field_id]=$label;
}
$this->ss->assign('required_properties', $required_fields);
$this->ss->assign('source_id', $source_id);
$this->ss->assign('properties', $properties);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('app', $GLOBALS['app_strings']);
$this->ss->assign('connector_language', $connector_language);
$this->ss->assign('hasTestingEnabled', $source->hasTestingEnabled());
echo $this->ss->fetch('modules/Connectors/tpls/source_properties.tpl');
}
}
?>