2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
37 /*********************************************************************************
39 ********************************************************************************/
43 <script type="text/javascript" src="{sugar_getjspath file='modules/Users/User.js'}"></script>
44 <script type="text/javascript" src="{sugar_getjspath file='cache/include/javascript/sugar_grp_yui_widgets.js'}"></script>
46 <script type="text/javascript" >
48 function change_state(radiobutton) {
50 if (radiobutton.value == '1') {
51 radiobutton.form['massemailer_tracking_entities_location'].disabled=true;
52 radiobutton.form['massemailer_tracking_entities_location'].value='{/literal}{$MOD.TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE}{literal}';
54 radiobutton.form['massemailer_tracking_entities_location'].disabled=false;
55 radiobutton.form['massemailer_tracking_entities_location'].value=null;
62 <form name="ConfigureSettings" id="EditView" method="POST" >
63 <input type="hidden" name="module" value="EmailMan">
64 <input type="hidden" name="action">
65 <input type="hidden" name="return_module" value="{$RETURN_MODULE}">
66 <input type="hidden" name="return_action" value="{$RETURN_ACTION}">
67 <input type="hidden" name="source_form" value="config" />
69 <table width="100%" cellpadding="0" cellspacing="0" border="0">
73 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" id="btn_save" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
74 <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
76 <td align="right" nowrap>
77 <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}
81 <table width="100%" border="1" cellspacing="0" cellpadding="0" class="edit view">
82 <tr><th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_EMAIL_OUTBOUND_CONFIGURATION}</h4></th>
85 <td align="left" scope="row" colspan="4">
86 {$MOD.LBL_OUTGOING_SECTION_HELP}
90 <tr class="{$OUTBOUND_TYPE_CLASS}">
91 <td width="20%" scope="row">{$MOD.LBL_MAIL_SENDTYPE}</td>
93 <select id="mail_sendtype" name="mail_sendtype" onChange="notify_setrequired(document.ConfigureSettings); SUGAR.user.showHideGmailDefaultLink(this);" tabindex="1">{$mail_sendtype_options}</select>
95 <td scope="row"> </td>
99 <td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMNAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
100 <td width="30%" > <input id='notify_fromname' name='notify_fromname' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromname}"></td>
103 <td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMADDRESS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
104 <td width="30%"><input id='notify_fromaddress' name='notify_fromaddress' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromaddress}"></td>
107 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
111 <div id="smtpButtonGroup" class="yui-buttongroup">
112 <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
113 <span class="first-child">
114 <button type="button" name="mail_smtptype" value="gmail">
115 {$APP.LBL_SMTPTYPE_GMAIL}
119 <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
120 <span class="first-child">
121 <button type="button" name="mail_smtptype" value="yahoomail">
122 {$APP.LBL_SMTPTYPE_YAHOO}
126 <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
127 <span class="first-child">
128 <button type="button" name="mail_smtptype" value="exchange">
129 {$APP.LBL_SMTPTYPE_EXCHANGE}
133 <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
134 <span class="first-child">
135 <button type="button" name="mail_smtptype" value="other">
136 {$APP.LBL_SMTPTYPE_OTHER}
145 <div id="smtp_settings">
146 <table width="100%" cellpadding="0" cellspacing="0">
147 <tr id="mailsettings1">
148 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
149 <td width="30%" ><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></td>
150 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
151 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
153 <tr id="mailsettings2">
154 <td scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
156 <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
157 onclick="notify_setrequired(document.ConfigureSettings);" {$mail_smtpauth_req}>
159 <td width="15%" scope="row"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
161 <select id="mail_smtpssl" name="mail_smtpssl" tabindex="501" onchange="setDefaultSMTPPort();" >{$MAIL_SSL_OPTIONS}</select>
165 <td width="20%" scope="row"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
166 <td width="30%" ><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></td>
167 <td width="20%"> </td>
168 <td width="30%"> </td>
171 <td width="20%" scope="row"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
173 <input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" tabindex='1'>
174 <a href="javascript:void(0)" id='mail_smtppass_link' onClick="SUGAR.util.setEmailPasswordEdit('mail_smtppass')" style="display: none">{$APP.LBL_CHANGE_PASSWORD}</a>
176 <td width="20%"> </td>
177 <td width="30%"> </td>
179 <tr id="mail_allow_user">
180 <td width="20%" scope="row">
181 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}
182 <img border="0" class="inlineHelpTip" onclick="return SUGAR.util.showHelpTips(this,'{$MOD.LBL_ALLOW_DEFAULT_SELECTION_HELP}','','','dialogHelpPopup')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
185 <input type='hidden' id="notify_allow_default_outbound_hidden_input" name='notify_allow_default_outbound' value='0'>
186 <input id="notify_allow_default_outbound" name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
188 <td width="20%"> </td>
189 <td width="30%"> </td>
195 <tr><td colspan="4"> </tr>
197 <td width="15%"><input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" onclick="testOutboundSettings();"> </td>
198 <td width="15%"> </td>
199 <td width="40%"> </td>
200 <td width="40%"> </td>
203 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
205 <th align="left" scope="row" colspan="4">
206 <h4>{$MOD.LBL_NOTIFY_TITLE}</h4>
210 <td width="20%" scope="row" valign='top'>
211 {$MOD.LBL_NOTIFY_ON}:
212 <img border="0" class="inlineHelpTip" onclick="return SUGAR.util.showHelpTips(this,'{$MOD.LBL_NOTIFICATION_ON_DESC}','','','dialogHelpPopup')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
214 <td width="30%" valign='top'>
215 <input type='hidden' name='notify_on' value='0'><input name="notify_on" tabindex='1' value="1" class="checkbox" type="checkbox" {$notify_on}>
217 <td scope="row" width="17%"></td>
221 <td width="20%" scope="row" valign='top'>
222 {$MOD.LBL_EMAIL_DEFAULT_DELETE_ATTACHMENTS}:
224 <td width="30%" valign='top'>
225 <input type='checkbox' name='email_default_delete_attachments' value="1" {$DEFAULT_EMAIL_DELETE_ATTACHMENTS}>
227 <td scope="row" width="20%">
228 {$MOD.LBL_NOTIFY_SEND_FROM_ASSIGNING_USER}:
229 <img border="0" class="inlineHelpTip" onclick="return SUGAR.util.showHelpTips(this,'{$MOD.LBL_FROM_ADDRESS_HELP}','','','dialogHelpPopup')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
231 <td width="30%" valign='top'><input type='hidden' name='notify_send_from_assigning_user' value='0'><input name='notify_send_from_assigning_user' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_send_from_assigning_user}></td>
234 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
236 <th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_SECURITY_TITLE}</h4></th>
239 <td align="left" scope="row" colspan="4">
240 {$MOD.LBL_SECURITY_DESC}
244 <td valign="middle" valign="top" scope="row" colspan="3">
245 {$MOD.LBL_SECURITY_OUTLOOK_DEFAULTS}
247 <td width="10%" NOWRAP valign="top" >
248 <input type="checkbox" value="1" name="set_outlook_defaults" id="set_outlook_defaults" onclick="setOutlookDefaults();">
250 <script type="text/javascript" language="Javascript">
252 function toggleAllSecurityOptions() {
253 document.getElementById('set_outlook_defaults').checked = false;
257 if(document.getElementById('toggle_all').checked == true) {
260 document.getElementById('applet').checked = check;
261 document.getElementById('base').checked = check;
262 document.getElementById('embed').checked = check;
263 document.getElementById('form').checked = check;
264 document.getElementById('frame').checked = check;
265 document.getElementById('frameset').checked = check;
266 document.getElementById('iframe').checked = check;
267 document.getElementById('import').checked = check;
268 document.getElementById('layer').checked = check;
269 document.getElementById('link').checked = check;
270 document.getElementById('object').checked = check;
271 document.getElementById('style').checked = check;
272 document.getElementById('xmp').checked = check;
275 function setOutlookDefaults() {
276 document.getElementById('toggle_all').checked = false;
278 document.getElementById('applet').checked = true;
279 document.getElementById('base').checked = true;
280 document.getElementById('embed').checked = true;
281 document.getElementById('form').checked = true;
282 document.getElementById('frame').checked = true;
283 document.getElementById('frameset').checked = true;
284 document.getElementById('iframe').checked = true;
285 document.getElementById('import').checked = true;
286 document.getElementById('layer').checked = true;
287 document.getElementById('link').checked = true;
288 document.getElementById('object').checked = true;
289 document.getElementById('style').checked = false;
290 document.getElementById('xmp').checked = true;
298 <td valign="middle" valign="top" scope="row" colspan="3">
299 {$MOD.LBL_SECURITY_TOGGLE_ALL}
301 <td width="10%" NOWRAP valign="top" >
302 <input type="checkbox" value="1" name="toggle_all" id="toggle_all" onclick="toggleAllSecurityOptions();">
306 <td width="10%" valign="middle" scope="row">
307 {$MOD.LBL_SECURITY_APPLET}
309 <td width="40%" NOWRAP valign="middle" >
310 <input type="checkbox" value="1" name="applet" id="applet" {$appletChecked}> <applet>
312 <td width="10%" valign="middle" scope="row">
313 {$MOD.LBL_SECURITY_BASE}
315 <td width="40%" NOWRAP valign="middle" >
316 <input type="checkbox" value="1" name="base" id="base" {$baseChecked}> <base>
320 <td width="10%" valign="middle" scope="row">
321 {$MOD.LBL_SECURITY_EMBED}
323 <td width="40%" NOWRAP valign="middle" >
324 <input type="checkbox" value="1" name="embed" id="embed" {$embedChecked}> <embed>
326 <td width="10%" valign="middle" scope="row">
327 {$MOD.LBL_SECURITY_FORM}
329 <td width="40%" NOWRAP valign="middle" >
330 <input type="checkbox" value="1" name="form" id="form" {$formChecked}> <form>
334 <td width="10%" valign="middle" scope="row">
335 {$MOD.LBL_SECURITY_FRAME}
337 <td width="40%" NOWRAP valign="middle" >
338 <input type="checkbox" value="1" name="frame" id="frame" {$frameChecked}> <frame>
340 <td width="10%" valign="middle" scope="row">
341 {$MOD.LBL_SECURITY_FRAMESET}
343 <td width="40%" NOWRAP valign="middle" >
344 <input type="checkbox" value="1" name="frameset" id="frameset" {$framesetChecked}> <frameset>
348 <td width="10%" valign="middle" scope="row">
349 {$MOD.LBL_SECURITY_IFRAME}
351 <td width="40%" NOWRAP valign="middle" >
352 <input type="checkbox" value="1" name="iframe" id="iframe" {$iframeChecked}> <iframe>
354 <td width="10%" valign="middle" scope="row">
355 {$MOD.LBL_SECURITY_IMPORT}
357 <td width="40%" NOWRAP valign="middle" >
358 <input type="checkbox" value="1" name="import" id="import" {$importChecked}> <import>
362 <td width="10%" valign="middle" scope="row">
363 {$MOD.LBL_SECURITY_LAYER}
365 <td width="40%" NOWRAP valign="middle" >
366 <input type="checkbox" value="1" name="layer" id="layer" {$layerChecked}> <layer>
368 <td width="10%" valign="middle" scope="row">
369 {$MOD.LBL_SECURITY_LINK}
371 <td width="40%" NOWRAP valign="middle" >
372 <input type="checkbox" value="1" name="link" id="link" {$linkChecked}> <link>
376 <td width="10%" valign="middle" scope="row">
377 {$MOD.LBL_SECURITY_OBJECT}
379 <td width="40%" NOWRAP valign="middle" >
380 <input type="checkbox" value="1" name="object" id="object" {$objectChecked}> <object>
382 <td width="10%" valign="middle" scope="row">
383 {$MOD.LBL_SECURITY_STYLE}
385 <td width="40%" NOWRAP valign="middle" >
386 <input type="checkbox" value="1" name="style" id="style" {$styleChecked}> <style>
390 <td width="10%" valign="middle" scope="row">
391 {$MOD.LBL_SECURITY_XMP}
393 <td width="40%" NOWRAP valign="middle" >
394 <input type="checkbox" value="1" name="xmp" id="xmp" {$xmpChecked}> <xmp>
396 <td scope="row"> </td>
403 <div id="testOutboundDialog" class="yui-hidden">
404 <div id="testOutbound">
405 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
408 {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
409 <span class="required">
410 {$APP.LBL_REQUIRED_SYMBOL}
414 <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="{$CURRENT_USER_EMAIL}">
418 <td scope="row" colspan="2">
419 <input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">
420 <input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">
428 <div style="padding-top:2px;">
429 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button primary" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
430 <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
436 <script type="text/javascript">
438 var loader = new YAHOO.util.YUILoader({
439 require : ["element","sugarwidgets"],
441 skin: { base: 'blank', defaultSkin: '' },
443 base: "include/javascript/yui/build/"
446 name :"sugarwidgets",
448 fullpath: "include/javascript/sugarwidgets/SugarYUIWidgets.js",
449 varName: "YAHOO.SUGAR",
450 requires: ["datatable", "dragdrop", "treeview", "tabview"]
456 var first_load = true;
457 function testOutboundSettings() {
458 if (document.getElementById('mail_sendtype').value == 'sendmail') {
459 testOutboundSettingsDialog();
462 var errorMessage = '';
464 var fromAddress = document.getElementById("outboundtest_from_address").value;
465 var errorMessage = '';
467 var smtpServer = document.getElementById('mail_smtpserver').value;
468 var smtpPort = document.getElementById('mail_smtpport').value;
469 var smtpssl = document.getElementById('mail_smtpssl').value;
470 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
471 if(trim(smtpServer) == '') {
473 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
475 if(trim(smtpPort) == '') {
477 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
479 if(mailsmtpauthreq.checked) {
480 if(trim(document.getElementById('mail_smtpuser').value) == '') {
482 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
486 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
490 testOutboundSettingsDialog();
494 function sendTestEmail()
496 var toAddress = document.getElementById("outboundtest_from_address").value;
497 var fromAddress = document.getElementById("notify_fromaddress").value;
498 if (trim(toAddress) == "")
500 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
503 else if (!isValidEmail(toAddress)) {
504 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
507 if (trim(fromAddress) == "")
509 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
512 else if (!isValidEmail(fromAddress)) {
513 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
516 //Hide the email address window and show a message notifying the user that the test email is being sent.
517 EmailMan.testOutboundDialog.hide();
518 overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
520 var callbackOutboundTest = {
521 success : function(o) {
523 var responseObject = YAHOO.lang.JSON.parse(o.responseText);
524 if (responseObject.status)
525 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
527 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", responseObject.errorMessage, 'alert');
530 var smtpServer = document.getElementById('mail_smtpserver').value;
531 var smtpPort = document.getElementById('mail_smtpport').value;
532 var smtpssl = document.getElementById('mail_smtpssl').value;
533 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
534 var mail_sendtype = document.getElementById('mail_sendtype').value;
536 var from_name = document.getElementById('notify_fromname').value;
537 var postDataString = 'mail_type=system&mail_sendtype=' + mail_sendtype + '&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + smtpPort + "&mail_smtpssl=" + smtpssl +
538 "&mail_smtpauth_req=" + mailsmtpauthreq.checked + "&mail_smtpuser=" + trim(document.getElementById('mail_smtpuser').value) +
539 "&mail_smtppass=" + trim(document.getElementById('mail_smtppass').value) + "&outboundtest_to_address=" + encodeURIComponent(toAddress) +
540 "&outboundtest_from_address=" + fromAddress + "&mail_from_name=" + from_name;
542 YAHOO.util.Connect.asyncRequest("POST", "index.php?action=testOutboundEmail&module=EmailMan&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
544 function testOutboundSettingsDialog() {
545 // lazy load dialogue
546 if(!EmailMan.testOutboundDialog) {
547 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
551 constraintoviewport: true,
555 EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
556 YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
559 EmailMan.testOutboundDialog.render();
560 EmailMan.testOutboundDialog.show();
563 function overlay(reqtitle, body, type) {
566 config.title = reqtitle;
568 YAHOO.SUGAR.MessageBox.show(config);
571 function hideOverlay() {
572 YAHOO.SUGAR.MessageBox.hide();
575 function notify_setrequired(f) {
577 document.getElementById("smtp_settings").style.display = (f.mail_sendtype.value == "SMTP") ? "inline" : "none";
578 document.getElementById("smtp_settings").style.visibility = (f.mail_sendtype.value == "SMTP") ? "visible" : "hidden";
579 document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
580 document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
581 document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
582 document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
583 if( document.getElementById('mail_smtpauth_req').checked)
584 YAHOO.util.Dom.removeClass('mail_allow_user', "yui-hidden");
586 YAHOO.util.Dom.addClass("mail_allow_user", "yui-hidden");
591 function setDefaultSMTPPort()
595 useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
597 if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
598 document.getElementById("mail_smtpport").value = '465';
600 if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
601 document.getElementById("mail_smtpport").value = '25';
611 * If the outlook options are all set on page load then enable the outlook field so that the user has an indication
612 * that that filter has been applied.
614 function setOutlookDefault()
616 var shouldToggle = true;
617 var aCheckFields = ['applet','base', 'embed','form','frame','frameset', 'iframe','import','layer','link', 'object', 'xmp'];
619 for(var i=0;i<aCheckFields.length;i++)
621 var tmpName = aCheckFields[i];
623 if( ! document.getElementById(tmpName).checked )
625 shouldToggle = false;
630 if(shouldToggle && !document.getElementById('style').checked)
631 document.getElementById('set_outlook_defaults').checked = true;
634 YAHOO.util.Event.onDOMReady(setOutlookDefault);
635 notify_setrequired(document.ConfigureSettings);
637 function changeEmailScreenDisplay(smtptype, clear)
640 document.getElementById("mail_smtpserver").value = '';
641 document.getElementById("mail_smtpport").value = '25';
642 document.getElementById("mail_smtpauth_req").checked = true;
643 document.getElementById("mailsettings1").style.display = '';
644 document.getElementById("mailsettings2").style.display = '';
645 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
646 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
647 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
648 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
653 document.getElementById("mail_smtpserver").value = 'smtp.mail.yahoo.com';
654 document.getElementById("mail_smtpport").value = '465';
655 document.getElementById("mail_smtpauth_req").checked = true;
656 var ssl = document.getElementById("mail_smtpssl");
657 for(var j=0;j<ssl.options.length;j++) {
658 if(ssl.options[j].text == 'SSL') {
659 ssl.options[j].selected = true;
663 document.getElementById("mailsettings1").style.display = 'none';
664 document.getElementById("mailsettings2").style.display = 'none';
665 document.getElementById("mail_smtppass_label").innerHTML =
666 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
667 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
670 if(document.getElementById("mail_smtpserver").value == "" || document.getElementById("mail_smtpserver").value == 'smtp.mail.yahoo.com') {
671 document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
672 document.getElementById("mail_smtpport").value = '587';
673 document.getElementById("mail_smtpauth_req").checked = true;
674 var ssl = document.getElementById("mail_smtpssl");
675 for(var j=0;j<ssl.options.length;j++) {
676 if(ssl.options[j].text == 'TLS') {
677 ssl.options[j].selected = true;
682 //document.getElementById("mailsettings1").style.display = 'none';
683 //document.getElementById("mailsettings2").style.display = 'none';
684 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
685 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
688 if ( document.getElementById("mail_smtpserver").value == 'smtp.mail.yahoo.com'
689 || document.getElementById("mail_smtpserver").value == 'smtp.gmail.com' ) {
690 document.getElementById("mail_smtpserver").value = '';
692 //document.getElementById("mail_smtpport").value = '25';
693 //document.getElementById("mail_smtpauth_req").checked = true; bug 40998
694 document.getElementById("mailsettings1").style.display = '';
695 document.getElementById("mailsettings2").style.display = '';
696 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
697 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
698 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
699 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
702 setDefaultSMTPPort();
703 notify_setrequired(document.ConfigureSettings);
705 var oButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
706 oButtonGroup.subscribe('checkedButtonChange', function(e)
708 changeEmailScreenDisplay(e.newValue.get('value'), true);
709 document.getElementById('smtp_settings').style.display = '';
710 document.getElementById('EditView').mail_smtptype.value = e.newValue.get('value');
712 YAHOO.widget.Button.addHiddenFieldsToForm(document.ConfigureSettings);
713 if(window.addEventListener){
714 window.addEventListener("load", function() { SUGAR.util.setEmailPasswordDisplay('mail_smtppass', {/literal}{$mail_haspass}{literal}); }, false);
716 window.attachEvent("onload", function() { SUGAR.util.setEmailPasswordDisplay('mail_smtppass', {/literal}{$mail_haspass}{literal}); });
718 {/literal}{if !empty($mail_smtptype)}{literal}
719 changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}", false);
720 {/literal}{/if}{literal}