2 /*********************************************************************************
3 * SugarCRM is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 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='include/javascript/sugar_grp_overlib.js'}"></script>
45 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
47 <script type="text/javascript" >
49 function change_state(radiobutton) {
51 if (radiobutton.value == '1') {
52 radiobutton.form['massemailer_tracking_entities_location'].disabled=true;
53 radiobutton.form['massemailer_tracking_entities_location'].value='{/literal}{$MOD.TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE}{literal}';
55 radiobutton.form['massemailer_tracking_entities_location'].disabled=false;
56 radiobutton.form['massemailer_tracking_entities_location'].value=null;
63 <form name="ConfigureSettings" id="EditView" method="POST" >
64 <input type="hidden" name="module" value="EmailMan">
65 <input type="hidden" name="action">
66 <input type="hidden" name="return_module" value="{$RETURN_MODULE}">
67 <input type="hidden" name="return_action" value="{$RETURN_ACTION}">
68 <input type="hidden" name="source_form" value="config" />
70 <table width="100%" cellpadding="0" cellspacing="0" border="0">
74 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
75 <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} ">
77 <td align="right" nowrap>
78 <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}
82 <table width="100%" border="1" cellspacing="0" cellpadding="0" class="edit view">
84 <table width="100%" border="0" cellspacing="0" cellpadding="0">
85 <tr><th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_EMAIL_OUTBOUND_CONFIGURATION}</h4></th>
88 <td align="left" scope="row" colspan="4">
89 {$MOD.LBL_OUTGOING_SECTION_HELP}
93 <tr class="{$OUTBOUND_TYPE_CLASS}">
94 <td width="20%" scope="row">{$MOD.LBL_MAIL_SENDTYPE}</td>
96 <select id="mail_sendtype" name="mail_sendtype" onChange="notify_setrequired(document.ConfigureSettings); SUGAR.user.showHideGmailDefaultLink(this);" tabindex="1">{$mail_sendtype_options}</select>
98 <td scope="row"> </td>
102 <td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMNAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
103 <td width="30%" > <input id='notify_fromname' name='notify_fromname' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromname}"></td>
106 <td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMADDRESS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
107 <td width="30%"><input id='notify_fromaddress' name='notify_fromaddress' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromaddress}"></td>
110 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
114 <div id="smtpButtonGroup" class="yui-buttongroup">
115 <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
116 <span class="first-child">
117 <button type="button" name="mail_smtptype" value="gmail">
118 {$APP.LBL_SMTPTYPE_GMAIL}
122 <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
123 <span class="first-child">
124 <button type="button" name="mail_smtptype" value="yahoomail">
125 {$APP.LBL_SMTPTYPE_YAHOO}
129 <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
130 <span class="first-child">
131 <button type="button" name="mail_smtptype" value="exchange">
132 {$APP.LBL_SMTPTYPE_EXCHANGE}
136 <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
137 <span class="first-child">
138 <button type="button" name="mail_smtptype" value="other">
139 {$APP.LBL_TABGROUP_OTHER}
148 <div id="smtp_settings">
149 <table width="100%" cellpadding="0" cellspacing="0">
150 <tr id="mailsettings1">
151 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
152 <td width="30%" ><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></td>
153 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
154 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
156 <tr id="mailsettings2">
157 <td scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
159 <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
160 onclick="notify_setrequired(document.ConfigureSettings);" {$mail_smtpauth_req}>
162 <td width="15%" scope="row"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
164 <select id="mail_smtpssl" name="mail_smtpssl" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
168 <td width="20%" scope="row"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
169 <td width="30%" ><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></td>
170 <td width="20%"> </td>
171 <td width="30%"> </td>
174 <td width="20%" scope="row"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
176 <input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" tabindex='1'>
177 <a href="javascript:void(0)" id='mail_smtppass_link' onClick="SUGAR.util.setEmailPasswordEdit('mail_smtppass')" style="display: none">{$APP.LBL_CHANGE_PASSWORD}</a>
179 <td width="20%"> </td>
180 <td width="30%"> </td>
182 <tr id="mail_allow_user">
183 <td width="20%" scope="row">
184 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}
185 <img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_ALLOW_DEFAULT_SELECTION_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass', WIDTH, -1, NOFOLLOW, 'ol_nofollow')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
188 <input type='hidden' name='notify_allow_default_outbound' value='0'>
189 <input name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
191 <td width="20%"> </td>
192 <td width="30%"> </td>
198 <tr><td colspan="4"> </tr>
200 <td width="15%"><input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" onclick="testOutboundSettings();"> </td>
201 <td width="15%"> </td>
202 <td width="40%"> </td>
203 <td width="40%"> </td>
208 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
211 <table width="100%" border="0" cellspacing="0" cellpadding="0">
213 <th align="left" scope="row" colspan="4">
214 <h4>{$MOD.LBL_NOTIFY_TITLE}</h4>
218 <td width="20%" scope="row" valign='top'>
219 {$MOD.LBL_NOTIFY_ON}:
220 <img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_NOTIFICATION_ON_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass', WIDTH, -1, NOFOLLOW, 'ol_nofollow')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
222 <td width="30%" valign='top'>
223 <input type='hidden' name='notify_on' value='0'><input name="notify_on" tabindex='1' value="1" class="checkbox" type="checkbox" {$notify_on}>
225 <td scope="row" width="17%"></td>
229 <td width="20%" scope="row" valign='top'>
230 {$MOD.LBL_EMAIL_DEFAULT_DELETE_ATTACHMENTS}:
232 <td width="30%" valign='top'>
233 <input type='checkbox' name='email_default_delete_attachments' value="1" {$DEFAULT_EMAIL_DELETE_ATTACHMENTS}>
235 <td scope="row" width="20%">
236 {$MOD.LBL_NOTIFY_SEND_FROM_ASSIGNING_USER}:
237 <img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_FROM_ADDRESS_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
239 <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>
242 <td colspan='4' scope="row"> </td>
247 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
249 <table width="100%" border="0" cellspacing="0" cellpadding="0">
251 <th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_SECURITY_TITLE}</h4></th>
254 <td align="left" scope="row" colspan="4">
255 {$MOD.LBL_SECURITY_DESC}
260 <td width="10%" NOWRAP scope="row" valign="top" >
261 <input type="checkbox" value="1" name="set_outlook_defaults" id="set_outlook_defaults" onclick="setOutlookDefaults();">
263 <script type="text/javascript" language="Javascript">
265 function toggleAllSecurityOptions() {
266 document.getElementById('set_outlook_defaults').checked = false;
270 if(document.getElementById('toggle_all').checked == true) {
273 document.getElementById('applet').checked = check;
274 document.getElementById('base').checked = check;
275 document.getElementById('embed').checked = check;
276 document.getElementById('form').checked = check;
277 document.getElementById('frame').checked = check;
278 document.getElementById('frameset').checked = check;
279 document.getElementById('iframe').checked = check;
280 document.getElementById('import').checked = check;
281 document.getElementById('layer').checked = check;
282 document.getElementById('link').checked = check;
283 document.getElementById('object').checked = check;
284 document.getElementById('style').checked = check;
285 document.getElementById('xmp').checked = check;
288 function setOutlookDefaults() {
289 document.getElementById('toggle_all').checked = false;
291 document.getElementById('applet').checked = true;
292 document.getElementById('base').checked = true;
293 document.getElementById('embed').checked = true;
294 document.getElementById('form').checked = true;
295 document.getElementById('frame').checked = true;
296 document.getElementById('frameset').checked = true;
297 document.getElementById('iframe').checked = true;
298 document.getElementById('import').checked = true;
299 document.getElementById('layer').checked = true;
300 document.getElementById('link').checked = true;
301 document.getElementById('object').checked = true;
302 document.getElementById('style').checked = false;
303 document.getElementById('xmp').checked = true;
309 <td valign="middle" valign="top" scope="row" colspan="3">
310 {$MOD.LBL_SECURITY_OUTLOOK_DEFAULTS}
314 <td colspan="4"> </td>
317 <td width="10%" NOWRAP scope="row" valign="top" >
318 <input type="checkbox" value="1" name="toggle_all" id="toggle_all" onclick="toggleAllSecurityOptions();">
320 <td valign="middle" valign="top" scope="row" colspan="3">
321 {$MOD.LBL_SECURITY_TOGGLE_ALL}
325 <td colspan="4"> </td>
328 <td width="10%" NOWRAP scope="row" valign="middle" >
329 <input type="checkbox" value="1" name="applet" id="applet" {$appletChecked}> <applet>
331 <td width="40%" valign="middle" scope="row">
332 {$MOD.LBL_SECURITY_APPLET}
334 <td width="10%" NOWRAP scope="row" valign="middle" >
335 <input type="checkbox" value="1" name="base" id="base" {$baseChecked}> <base>
337 <td width="40%" valign="middle" scope="row">
338 {$MOD.LBL_SECURITY_BASE}
342 <td width="10%" NOWRAP scope="row" valign="middle" >
343 <input type="checkbox" value="1" name="embed" id="embed" {$embedChecked}> <embed>
345 <td width="40%" valign="middle" scope="row">
346 {$MOD.LBL_SECURITY_EMBED}
348 <td width="10%" NOWRAP scope="row" valign="middle" >
349 <input type="checkbox" value="1" name="form" id="form" {$formChecked}> <form>
351 <td width="40%" valign="middle" scope="row">
352 {$MOD.LBL_SECURITY_FORM}
356 <td width="10%" NOWRAP scope="row" valign="middle" >
357 <input type="checkbox" value="1" name="frame" id="frame" {$frameChecked}> <frame>
359 <td width="40%" valign="middle" scope="row">
360 {$MOD.LBL_SECURITY_FRAME}
362 <td width="10%" NOWRAP scope="row" valign="middle" >
363 <input type="checkbox" value="1" name="frameset" id="frameset" {$framesetChecked}> <frameset>
365 <td width="40%" valign="middle" scope="row">
366 {$MOD.LBL_SECURITY_FRAMESET}
370 <td width="10%" NOWRAP scope="row" valign="middle" >
371 <input type="checkbox" value="1" name="iframe" id="iframe" {$iframeChecked}> <iframe>
373 <td width="40%" valign="middle" scope="row">
374 {$MOD.LBL_SECURITY_IFRAME}
376 <td width="10%" NOWRAP scope="row" valign="middle" >
377 <input type="checkbox" value="1" name="import" id="import" {$importChecked}> <import>
379 <td width="40%" valign="middle" scope="row">
380 {$MOD.LBL_SECURITY_IMPORT}
384 <td width="10%" NOWRAP scope="row" valign="middle" >
385 <input type="checkbox" value="1" name="layer" id="layer" {$layerChecked}> <layer>
387 <td width="40%" valign="middle" scope="row">
388 {$MOD.LBL_SECURITY_LAYER}
390 <td width="10%" NOWRAP scope="row" valign="middle" >
391 <input type="checkbox" value="1" name="link" id="link" {$linkChecked}> <link>
393 <td width="40%" valign="middle" scope="row">
394 {$MOD.LBL_SECURITY_LINK}
398 <td width="10%" NOWRAP scope="row" valign="middle" >
399 <input type="checkbox" value="1" name="object" id="object" {$objectChecked}> <object>
401 <td width="40%" valign="middle" scope="row">
402 {$MOD.LBL_SECURITY_OBJECT}
404 <td width="10%" NOWRAP scope="row" valign="middle" >
405 <input type="checkbox" value="1" name="style" id="style" {$styleChecked}> <style>
407 <td width="40%" valign="middle" scope="row">
408 {$MOD.LBL_SECURITY_STYLE}
412 <td width="10%" NOWRAP scope="row" valign="middle" >
413 <input type="checkbox" value="1" name="xmp" id="xmp" {$xmpChecked}> <xmp>
415 <td width="40%" valign="middle" scope="row">
416 {$MOD.LBL_SECURITY_XMP}
426 <div id="testOutboundDialog" class="yui-hidden">
427 <div id="testOutbound">
428 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
431 {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
432 <span class="required">
433 {$APP.LBL_REQUIRED_SYMBOL}
437 <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="{$CURRENT_USER_EMAIL}">
441 <td scope="row" colspan="2">
442 <input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">
443 <input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">
451 <div style="padding-top:2px;">
452 <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
453 <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} ">
459 <script type="text/javascript">
461 var loader = new YAHOO.util.YUILoader({
462 require : ["element","sugarwidgets"],
464 skin: { base: 'blank', defaultSkin: '' },
466 base: "include/javascript/yui/build/"
469 name :"sugarwidgets",
471 fullpath: "include/javascript/sugarwidgets/SugarYUIWidgets.js",
472 varName: "YAHOO.SUGAR",
473 requires: ["datatable", "dragdrop", "treeview", "tabview"]
479 function testOutboundSettings() {
480 if (document.getElementById('mail_sendtype').value == 'sendmail') {
481 testOutboundSettingsDialog();
484 var errorMessage = '';
486 var fromAddress = document.getElementById("outboundtest_from_address").value;
487 var errorMessage = '';
489 var smtpServer = document.getElementById('mail_smtpserver').value;
490 var smtpPort = document.getElementById('mail_smtpport').value;
491 var smtpssl = document.getElementById('mail_smtpssl').value;
492 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
493 if(trim(smtpServer) == '') {
495 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
497 if(trim(smtpPort) == '') {
499 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
501 if(mailsmtpauthreq.checked) {
502 if(trim(document.getElementById('mail_smtpuser').value) == '') {
504 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
508 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
512 testOutboundSettingsDialog();
516 function sendTestEmail()
518 var toAddress = document.getElementById("outboundtest_from_address").value;
519 var fromAddress = document.getElementById("notify_fromaddress").value;
520 if (trim(toAddress) == "")
522 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
525 else if (!isValidEmail(toAddress)) {
526 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
529 if (trim(fromAddress) == "")
531 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
534 else if (!isValidEmail(fromAddress)) {
535 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
538 //Hide the email address window and show a message notifying the user that the test email is being sent.
539 EmailMan.testOutboundDialog.hide();
540 overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
542 var callbackOutboundTest = {
543 success : function(o) {
545 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
548 var smtpServer = document.getElementById('mail_smtpserver').value;
549 var smtpPort = document.getElementById('mail_smtpport').value;
550 var smtpssl = document.getElementById('mail_smtpssl').value;
551 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
552 var mail_sendtype = document.getElementById('mail_sendtype').value;
553 var postDataString = 'mail_name=system&mail_sendtype=' + mail_sendtype + '&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + smtpPort + "&mail_smtpssl=" + smtpssl +
554 "&mail_smtpauth_req=" + mailsmtpauthreq.checked + "&mail_smtpuser=" + trim(document.getElementById('mail_smtpuser').value) +
555 "&mail_smtppass=" + trim(document.getElementById('mail_smtppass').value) + "&outboundtest_to_address=" + toAddress + "&outboundtest_from_address=" + fromAddress;
557 YAHOO.util.Connect.asyncRequest("POST", "index.php?action=testOutboundEmail&module=EmailMan&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
559 function testOutboundSettingsDialog() {
560 // lazy load dialogue
561 if(!EmailMan.testOutboundDialog) {
562 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
566 constraintoviewport: true,
570 EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
571 YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
574 EmailMan.testOutboundDialog.render();
575 EmailMan.testOutboundDialog.show();
578 function overlay(reqtitle, body, type) {
581 config.title = reqtitle;
583 YAHOO.SUGAR.MessageBox.show(config);
586 function hideOverlay() {
587 YAHOO.SUGAR.MessageBox.hide();
590 function notify_setrequired(f) {
592 document.getElementById("smtp_settings").style.display = (f.mail_sendtype.value == "SMTP") ? "inline" : "none";
593 document.getElementById("smtp_settings").style.visibility = (f.mail_sendtype.value == "SMTP") ? "visible" : "hidden";
594 document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
595 document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
596 document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
597 document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
598 if( document.getElementById('mail_smtpauth_req').checked)
599 YAHOO.util.Dom.removeClass('mail_allow_user', "yui-hidden");
601 YAHOO.util.Dom.addClass("mail_allow_user", "yui-hidden");
606 * If the outlook options are all set on page load then enable the outlook field so that the user has an indication
607 * that that filter has been applied.
609 function setOutlookDefault()
611 var shouldToggle = true;
612 var aCheckFields = ['applet','base', 'embed','form','frame','frameset', 'iframe','import','layer','link', 'object', 'xmp'];
614 for(var i=0;i<aCheckFields.length;i++)
616 var tmpName = aCheckFields[i];
618 if( ! document.getElementById(tmpName).checked )
620 shouldToggle = false;
625 if(shouldToggle && !document.getElementById('style').checked)
626 document.getElementById('set_outlook_defaults').checked = true;
629 YAHOO.util.Event.onDOMReady(setOutlookDefault);
630 notify_setrequired(document.ConfigureSettings);
632 function changeEmailScreenDisplay(smtptype, clear)
635 document.getElementById("mail_smtpserver").value = '';
636 document.getElementById("mail_smtpport").value = '25';
637 document.getElementById("mail_smtpauth_req").checked = true;
638 document.getElementById("mailsettings1").style.display = '';
639 document.getElementById("mailsettings2").style.display = '';
640 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
641 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
642 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
643 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
648 document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
649 document.getElementById("mail_smtpport").value = '465';
650 document.getElementById("mail_smtpauth_req").checked = true;
651 var ssl = document.getElementById("mail_smtpssl");
652 for(var j=0;j<ssl.options.length;j++) {
653 if(ssl.options[j].text == 'SSL') {
654 ssl.options[j].selected = true;
658 document.getElementById("mailsettings1").style.display = 'none';
659 document.getElementById("mailsettings2").style.display = 'none';
660 document.getElementById("mail_smtppass_label").innerHTML =
661 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
662 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
665 document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
666 document.getElementById("mail_smtpport").value = '587';
667 document.getElementById("mail_smtpauth_req").checked = true;
668 var ssl = document.getElementById("mail_smtpssl");
669 for(var j=0;j<ssl.options.length;j++) {
670 if(ssl.options[j].text == 'TLS') {
671 ssl.options[j].selected = true;
675 document.getElementById("mailsettings1").style.display = 'none';
676 document.getElementById("mailsettings2").style.display = 'none';
677 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
678 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
681 if ( document.getElementById("mail_smtpserver").value == 'plus.smtp.mail.yahoo.com'
682 || document.getElementById("mail_smtpserver").value == 'smtp.gmail.com' ) {
683 document.getElementById("mail_smtpserver").value = '';
685 //document.getElementById("mail_smtpport").value = '25';
686 //document.getElementById("mail_smtpauth_req").checked = true; bug 40998
687 document.getElementById("mailsettings1").style.display = '';
688 document.getElementById("mailsettings2").style.display = '';
689 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
690 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
691 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
692 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
695 notify_setrequired(document.ConfigureSettings);
697 var oButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
698 oButtonGroup.subscribe('checkedButtonChange', function(e)
700 changeEmailScreenDisplay(e.newValue.get('value'), true);
701 document.getElementById('smtp_settings').style.display = '';
702 document.getElementById('EditView').mail_smtptype.value = e.newValue.get('value');
704 YAHOO.widget.Button.addHiddenFieldsToForm(document.ConfigureSettings);
705 if(window.addEventListener){
706 window.addEventListener("load", function() { SUGAR.util.setEmailPasswordDisplay('mail_smtppass', {/literal}{$mail_haspass}{literal}); }, false);
708 window.attachEvent("onload", function() { SUGAR.util.setEmailPasswordDisplay('mail_smtppass', {/literal}{$mail_haspass}{literal}); });
710 {/literal}{if !empty($mail_smtptype)}{literal}
711 changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}", false);
712 {/literal}{/if}{literal}