]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Configurator/views/view.edit.php
Release 6.5.15
[Github/sugarcrm.git] / modules / Configurator / views / view.edit.php
1 <?php
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-2013 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 /*********************************************************************************
39
40  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
41  * All Rights Reserved.
42  * Contributor(s): ______________________________________..
43  ********************************************************************************/
44
45 require_once('modules/Configurator/Forms.php');
46 require_once('modules/Administration/Forms.php');
47 require_once('modules/Configurator/Configurator.php');
48 require_once('include/SugarLogger/SugarLogger.php');
49 require_once('modules/Leads/Lead.php');
50
51 class ConfiguratorViewEdit extends ViewEdit
52 {
53     /**
54      * @var Configurator
55      */
56     protected $configurator;
57
58     /**
59          * @see SugarView::preDisplay()
60          */
61         public function preDisplay()
62     {
63         if(!is_admin($GLOBALS['current_user']))
64             sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
65     }
66     
67     /**
68          * @see SugarView::_getModuleTitleParams()
69          */
70         protected function _getModuleTitleParams($browserTitle = false)
71         {
72             global $mod_strings;
73             
74         return array(
75            "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
76            $mod_strings['LBL_SYSTEM_SETTINGS']
77            );
78     }
79
80     public function __construct()
81     {
82         $this->configurator = new Configurator;
83     }
84
85     public function process()
86     {   
87         if (isset($this->errors['company_logo']))
88         {
89             $this->configurator->errors['company_logo'] = $this->errors['company_logo'];
90             unset($this->errors['company_logo']);
91         }
92
93         return parent::process();
94     }
95     
96         /**
97          * @see SugarView::display()
98          */
99         public function display()
100         {
101             global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale;
102             
103             $configurator = $this->configurator;
104         $sugarConfig = SugarConfig::getInstance();
105         $focus = new Administration();
106         $configurator->parseLoggerSettings();
107         
108         $focus->retrieveSettings();
109         if(!empty($_POST['restore'])){
110             $configurator->restoreConfig();
111         }
112         
113         $this->ss->assign('MOD', $mod_strings);
114         $this->ss->assign('APP', $app_strings);
115         $this->ss->assign('APP_LIST', $app_list_strings);
116         $this->ss->assign('config', $configurator->config);
117         $this->ss->assign('error', $configurator->errors);
118         $this->ss->assign("AUTO_REFRESH_INTERVAL_OPTIONS", get_select_options_with_id($app_list_strings['dashlet_auto_refresh_options_admin'], isset($configurator->config['dashlet_auto_refresh_min']) ? $configurator->config['dashlet_auto_refresh_min'] : 30));
119         $this->ss->assign('LANGUAGES', get_languages());
120         $this->ss->assign("JAVASCRIPT",get_set_focus_js(). get_configsettings_js());
121         $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
122         $this->ss->assign("settings", $focus->settings);
123         $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
124         if(!empty($focus->settings['proxy_on'])){
125             $this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline');
126         }else{
127             $this->ss->assign("PROXY_CONFIG_DISPLAY", 'none');
128         }
129         if(!empty($focus->settings['proxy_auth'])){
130             $this->ss->assign("PROXY_AUTH_DISPLAY", 'inline');
131         }else{
132             $this->ss->assign("PROXY_AUTH_DISPLAY", 'none');
133         }
134         if (!empty($configurator->config['logger']['level'])) {
135             $this->ss->assign('log_levels', get_select_options_with_id(  LoggerManager::getLoggerLevels(), $configurator->config['logger']['level']));
136         } else {
137             $this->ss->assign('log_levels', get_select_options_with_id(  LoggerManager::getLoggerLevels(), ''));
138         }
139         if (!empty($configurator->config['lead_conv_activity_opt'])) {
140             $this->ss->assign('lead_conv_activities', get_select_options_with_id(  Lead::getActivitiesOptions(), $configurator->config['lead_conv_activity_opt']));
141         } else {
142             $this->ss->assign('lead_conv_activities', get_select_options_with_id(  Lead::getActivitiesOptions(), ''));
143         }
144         if (!empty($configurator->config['logger']['file']['suffix'])) {
145             $this->ss->assign('filename_suffix', get_select_options_with_id(  SugarLogger::$filename_suffix,$configurator->config['logger']['file']['suffix']));
146         } else {
147             $this->ss->assign('filename_suffix', get_select_options_with_id(  SugarLogger::$filename_suffix,''));
148         }
149         if (isset($configurator->config['logger_visible'])) {
150             $this->ss->assign('logger_visible', $configurator->config['logger_visible']);
151         }
152         else {
153             $this->ss->assign('logger_visible', true);
154         }
155
156         echo $this->getModuleTitle(false);
157         
158         $this->ss->display('modules/Configurator/tpls/EditView.tpl');
159         
160         $javascript = new javascript();
161         $javascript->setFormName("ConfigureSettings");
162         $javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, "");
163         $javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, "");
164         $javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, "");
165         $javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, "");
166         $javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, "");
167         $javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, "");
168         echo $javascript->getScript();
169         }
170 }