]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/EmailMan/views/view.config.php
Release 6.1.5
[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 is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 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()
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            $mod_strings['LBL_CONFIGURE_SETTINGS'],
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
89         echo $this->getModuleTitle();
90         global $currentModule;
91
92
93
94
95
96         $focus = new Administration();
97         $focus->retrieveSettings(); //retrieve all admin settings.
98         $GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
99
100         $this->ss->assign("MOD", $mod_strings);
101         $this->ss->assign("APP", $app_strings);
102
103         $this->ss->assign("RETURN_MODULE", "Administration");
104         $this->ss->assign("RETURN_ACTION", "index");
105
106         $this->ss->assign("MODULE", $currentModule);
107         $this->ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
108         $this->ss->assign("HEADER", get_module_title("EmailMan", "{MOD.LBL_CONFIGURE_SETTINGS}", true));
109
110         $this->ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
111         $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'" : "");
112         $this->ss->assign("notify_on", ($focus->settings['notify_on']) ? "checked='checked'" : "");
113         $this->ss->assign("notify_fromname", $focus->settings['notify_fromname']);
114         $this->ss->assign("notify_allow_default_outbound_on", (!empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound']) ? "checked='checked'" : "");
115
116         $this->ss->assign("mail_smtptype", $focus->settings['mail_smtptype']);
117         $this->ss->assign("mail_smtpserver", $focus->settings['mail_smtpserver']);
118         $this->ss->assign("mail_smtpport", $focus->settings['mail_smtpport']);
119         $this->ss->assign("mail_smtpuser", $focus->settings['mail_smtpuser']);
120         $this->ss->assign("mail_smtpauth_req", ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : "");
121         $this->ss->assign("mail_haspass", empty($focus->settings['mail_smtppass'])?0:1);
122         $this->ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
123
124         //Assign the current users email for the test send dialogue.
125         $this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
126
127         $showSendMail = FALSE;
128         $outboundSendTypeCSSClass = "yui-hidden";
129         if(isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'])
130         {
131             $showSendMail = TRUE;
132             $app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
133             $outboundSendTypeCSSClass = "";
134         }
135
136         $this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
137         $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
138
139         ///////////////////////////////////////////////////////////////////////////////
140         ////    USER EMAIL DEFAULTS
141         // editors
142         $editors = $app_list_strings['dom_email_editor_option'];
143         $newEditors = array();
144         foreach($editors as $k => $v) {
145             if($k != "") { $newEditors[$k] = $v; }
146         }
147
148         // preserve attachments
149         $preserveAttachments = '';
150         if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
151             $preserveAttachments = 'CHECKED';
152         }
153         $this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
154         ////    END USER EMAIL DEFAULTS
155         ///////////////////////////////////////////////////////////////////////////////
156
157
158         //setting to manage.
159         //emails_per_run
160         //tracking_entities_location_type default or custom
161         //tracking_entities_location http://www.sugarcrm.com/track/
162
163         //////////////////////////////////////////////////////////////////////////////
164         ////    EMAIL SECURITY
165         if(!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
166             $sugar_config['email_xss'] = getDefaultXssTags();
167         }
168
169         foreach(unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
170             $this->ss->assign($k."Checked", 'CHECKED');
171         }
172
173         //clean_xss('here');
174         ////    END EMAIL SECURITY
175         ///////////////////////////////////////////////////////////////////////////////
176
177         require_once('modules/Emails/Email.php');
178         $email = new Email();
179         $this->ss->assign('ROLLOVER', $email->rolloverStyle);
180
181         $this->ss->assign("JAVASCRIPT",get_validate_record_js());
182         $this->ss->display('modules/EmailMan/tpls/config.tpl');
183     }
184 }