]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/EmailMan/views/view.config.php
Release 6.2.0beta4
[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($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         
89         echo $this->getModuleTitle(false);
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", getClassicModuleTitle("EmailMan", array("{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_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
122
123         //Assign the current users email for the test send dialogue.
124         $this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
125
126         $showSendMail = FALSE;
127         $outboundSendTypeCSSClass = "yui-hidden";
128         if(isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'])
129         {
130             $showSendMail = TRUE;
131             $app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
132             $outboundSendTypeCSSClass = "";
133         }
134
135         $this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
136         $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
137
138         ///////////////////////////////////////////////////////////////////////////////
139         ////    USER EMAIL DEFAULTS
140         // editors
141         $editors = $app_list_strings['dom_email_editor_option'];
142         $newEditors = array();
143         foreach($editors as $k => $v) {
144             if($k != "") { $newEditors[$k] = $v; }
145         }
146
147         // preserve attachments
148         $preserveAttachments = '';
149         if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
150             $preserveAttachments = 'CHECKED';
151         }
152         $this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
153         ////    END USER EMAIL DEFAULTS
154         ///////////////////////////////////////////////////////////////////////////////
155
156
157         //setting to manage.
158         //emails_per_run
159         //tracking_entities_location_type default or custom
160         //tracking_entities_location http://www.sugarcrm.com/track/
161
162         //////////////////////////////////////////////////////////////////////////////
163         ////    EMAIL SECURITY
164         if(!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
165             $sugar_config['email_xss'] = getDefaultXssTags();
166         }
167
168         foreach(unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
169             $this->ss->assign($k."Checked", 'CHECKED');
170         }
171
172         //clean_xss('here');
173         ////    END EMAIL SECURITY
174         ///////////////////////////////////////////////////////////////////////////////
175
176         require_once('modules/Emails/Email.php');
177         $email = new Email();
178         $this->ss->assign('ROLLOVER', $email->rolloverStyle);
179
180         $this->ss->assign("JAVASCRIPT",get_validate_record_js());
181         $this->ss->display('modules/EmailMan/tpls/config.tpl');
182     }
183 }