]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/EmailMan/views/view.config.php
Release 6.5.0
[Github/sugarcrm.git] / modules / EmailMan / views / view.config.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-2012 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  * Description:  TODO: To be written.
41  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42  * All Rights Reserved.
43  * Contributor(s): ______________________________________..
44  ********************************************************************************/
45
46 require_once('include/MVC/View/SugarView.php');
47 require_once('modules/EmailMan/Forms.php');
48
49 class ViewConfig extends SugarView
50 {
51     /**
52          * @see SugarView::_getModuleTitleParams()
53          */
54         protected function _getModuleTitleParams($browserTitle = false)
55         {
56             global $mod_strings;
57
58         return array(
59            "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
60            translate('LBL_MASS_EMAIL_CONFIG_TITLE','Administration'),
61            );
62     }
63
64     /**
65          * @see SugarView::preDisplay()
66          */
67         public function preDisplay()
68         {
69             global $current_user;
70
71             if ( !is_admin($current_user)
72                     && !is_admin_for_module($GLOBALS['current_user'],'Emails')
73                     && !is_admin_for_module($GLOBALS['current_user'],'Campaigns') )
74                 sugar_die("Unauthorized access to administration.");
75     }
76
77     /**
78          * @see SugarView::display()
79          */
80         public function display()
81         {
82         global $mod_strings;
83         global $app_list_strings;
84         global $app_strings;
85         global $current_user;
86         global $sugar_config;
87
88         echo $this->getModuleTitle();
89         global $currentModule;
90
91         $focus = new Administration();
92         $focus->retrieveSettings(); //retrieve all admin settings.
93         $GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
94
95         $this->ss->assign("MOD", $mod_strings);
96         $this->ss->assign("APP", $app_strings);
97
98         $this->ss->assign("RETURN_MODULE", "Administration");
99         $this->ss->assign("RETURN_ACTION", "index");
100
101         $this->ss->assign("MODULE", $currentModule);
102         $this->ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
103         $this->ss->assign("HEADER", get_module_title("EmailMan", "{MOD.LBL_CONFIGURE_SETTINGS}", true));
104         $this->ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
105         $this->ss->assign("notify_send_from_assigning_user", (isset($focus->settings['notify_send_from_assigning_user']) && !empty($focus->settings['notify_send_from_assigning_user'])) ? "checked='checked'" : "");
106         $this->ss->assign("notify_on", ($focus->settings['notify_on']) ? "checked='checked'" : "");
107         $this->ss->assign("notify_fromname", $focus->settings['notify_fromname']);
108         $this->ss->assign("notify_allow_default_outbound_on", (!empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound']) ? "checked='checked'" : "");
109
110         $this->ss->assign("mail_smtptype", $focus->settings['mail_smtptype']);
111         $this->ss->assign("mail_smtpserver", $focus->settings['mail_smtpserver']);
112         $this->ss->assign("mail_smtpport", $focus->settings['mail_smtpport']);
113         $this->ss->assign("mail_smtpuser", $focus->settings['mail_smtpuser']);
114         $this->ss->assign("mail_smtpauth_req", ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : "");
115         $this->ss->assign("mail_haspass", empty($focus->settings['mail_smtppass'])?0:1);
116         $this->ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
117
118         //Assign the current users email for the test send dialogue.
119         $this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
120
121         $showSendMail = FALSE;
122         $outboundSendTypeCSSClass = "yui-hidden";
123         if(isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'])
124         {
125             $showSendMail = TRUE;
126             $app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
127             $outboundSendTypeCSSClass = "";
128         }
129
130         $this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
131         $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
132
133         ///////////////////////////////////////////////////////////////////////////////
134         ////    USER EMAIL DEFAULTS
135         // editors
136         $editors = $app_list_strings['dom_email_editor_option'];
137         $newEditors = array();
138         foreach($editors as $k => $v) {
139             if($k != "") { $newEditors[$k] = $v; }
140         }
141
142         // preserve attachments
143         $preserveAttachments = '';
144         if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
145             $preserveAttachments = 'CHECKED';
146         }
147         $this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
148         ////    END USER EMAIL DEFAULTS
149         ///////////////////////////////////////////////////////////////////////////////
150
151
152         //setting to manage.
153         //emails_per_run
154         //tracking_entities_location_type default or custom
155         //tracking_entities_location http://www.sugarcrm.com/track/
156
157         //////////////////////////////////////////////////////////////////////////////
158         ////    EMAIL SECURITY
159         if(!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
160             $sugar_config['email_xss'] = getDefaultXssTags();
161         }
162
163         foreach(unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
164             $this->ss->assign($k."Checked", 'CHECKED');
165         }
166
167         ////    END EMAIL SECURITY
168         ///////////////////////////////////////////////////////////////////////////////
169
170         require_once('modules/Emails/Email.php');
171         $email = new Email();
172         $this->ss->assign('ROLLOVER', $email->rolloverStyle);
173         $this->ss->assign('THEME', $GLOBALS['theme']);
174
175         $this->ss->assign("JAVASCRIPT",get_validate_record_js());
176         $this->ss->display('modules/EmailMan/tpls/config.tpl');
177     }
178 }