2 /*********************************************************************************
3 * SugarCRM Community Edition 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 ********************************************************************************/
38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
41 <link rel="SHORTCUT ICON" href="{$FAVICON_URL}">
42 <meta http-equiv="Content-Type" content="text/html; charset={$APP.LBL_CHARSET}">
43 <title>{$MOD.LBL_WIZARD_TITLE}</title>
50 <script type='text/javascript'>
51 function disableReturnSubmission(e) {
52 var key = window.event ? window.event.keyCode : e.which;
57 <body class="yui-skin-sam">
60 <table style="width:auto;height:600px;" align="center"><tr><td align="center">
62 <form name="AdminWizard" id="AdminWizard" enctype='multipart/form-data' method="POST" action="index.php" onkeypress="return disableReturnSubmission(event);">
63 <input type='hidden' name='action' value='SaveAdminWizard'/>
64 <input type='hidden' name='module' value='Configurator'/>
65 <span class='error'>{$error.main}</span>
66 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
67 <script type="text/javascript" src="{sugar_getjspath file='modules/Emails/javascript/vars.js'}"></script>
68 <script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_emails.js'}"></script>
69 <script type="text/javascript" src="{sugar_getjspath file='modules/Users/User.js'}"></script>
71 <div class="dashletPanelMenu wizard">
75 <div id="welcome" class="screen">
76 <table width="100%" border="0" cellspacing="0" cellpadding="0">
79 <div class="edit view">
80 <table width="100%" border="0" cellspacing="0" cellpadding="0">
82 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_WELCOME_TITLE}</h2></th>
86 <p>{$MOD.LBL_WIZARD_WELCOME}</p>
87 <div class="userWizWelcome"><img src='include/images/sugar_wizard_welcome.jpg' border='0' width='765px' height='325px'></div>
95 <div class="nav-buttons">
96 <input title="{$MOD.LBL_WIZARD_SKIP_BUTTON}"
97 onclick="document.location.href='{$SKIP_URL}';" class="button"
98 type="button" name="cancel" value=" {$MOD.LBL_WIZARD_SKIP_BUTTON} " id="skip_tab" />
99 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
100 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
101 onclick="SugarWizard.changeScreen('system',false);" id="next_tab_system" />
105 <div id="system" class="screen">
106 <table width="100%" border="0" cellspacing="0" cellpadding="0">
109 <div class="edit view">
110 <table width="100%" border="0" cellspacing="0" cellpadding="0">
112 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_SYSTEM_TITLE}</h2></th>
115 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SYSTEM_DESC}</i></td>
118 <td scope="row" width='15%' nowrap>{$MOD.SYSTEM_NAME_WIZARD} {sugar_help text=$MOD.SYSTEM_NAME_HELP}</td>
120 <input type='text' name='system_name' value='{$settings.system_name}' />
124 <td scope="row" width='12%' nowrap>{$MOD.NEW_LOGO} {sugar_help text=$MOD.NEW_LOGO_HELP}
127 <div id="container_upload"></div>
128 <input type='text' id='company_logo' name='company_logo' style="display:none" />
132 <td scope="row" width='12%' nowrap>{$MOD.CURRENT_LOGO} {sugar_help text=$MOD.CURRENT_LOGO_HELP}</td>
134 <img id="company_logo_image" src='{$company_logo}' height="40" width="212" />
142 <div class="nav-buttons">
143 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
144 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
145 onclick="SugarWizard.changeScreen('welcome',true);" id="previous_tab_welcome" />
146 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
147 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
148 onclick="SugarWizard.changeScreen('locale',false);" id="next_tab_locale" />
152 <div id="locale" class="screen">
153 <table width="100%" border="0" cellspacing="0" cellpadding="0">
156 <div class="edit view">
157 <table width="100%" border="0" cellspacing="0" cellpadding="0">
159 <th align="left" scope="row" colspan="4"><h2>{sugar_translate module='Administration' label='LBL_LOCALE_TITLE'}</h2></th>
162 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_LOCALE_DESC}</i></td>
165 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DATE_FORMAT'}: </td>
167 {html_options name='default_date_format' selected=$config.default_date_format options=$config.date_formats}
169 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_TIME_FORMAT'}: </td>
171 {html_options name='default_time_format' selected=$config.default_time_format options=$config.time_formats}
175 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_LANGUAGE'}: </td>
177 {html_options name='default_language' selected=$config.default_language options=$LANGUAGES}
181 <td colspan="4"><hr /></td>
184 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_NAME'}: </td>
186 <input type='text' size='15' name='default_currency_name' value='{$config.default_currency_name}' >
188 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_SYMBOL'}: </td>
190 <input type='text' size='4' name='default_currency_symbol' value='{$config.default_currency_symbol}' >
194 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_ISO4217'}: </td>
196 <input type='text' size='4' name='default_currency_iso4217' value='{$config.default_currency_iso4217}'>
198 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NUMBER_GROUPING_SEP'}: </td>
200 <input type='text' size='3' maxlength='1' name='default_number_grouping_seperator' value='{$config.default_number_grouping_seperator}'>
204 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DECIMAL_SEP'}: </td>
206 <input type='text' size='3' maxlength='1' name='default_decimal_seperator' value='{$config.default_decimal_seperator}'>
208 <td nowrap="nowrap" scope="row"></td>
212 <td colspan="4"><hr /></td>
216 <input id="default_locale_name_format" type="hidden" name="default_locale_name_format" value="{$config.default_locale_name_format}">
224 <div class="nav-buttons">
225 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
226 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
227 onclick="SugarWizard.changeScreen('system',true);" id="previous_tab_system" />
228 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
229 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
230 onclick="SugarWizard.changeScreen('smtp',false); changeEmailScreenDisplay('{$mail_smtptype}'); document.getElementById('AdminWizard').mail_smtptype.value = 'gmail';" id="next_tab_smtp" />
234 <div id="smtp" class="screen">
235 <table width="100%" border="0" cellspacing="0" cellpadding="0">
238 <div class="edit view">
239 <table width="100%" border="0" cellspacing="0" cellpadding="0">
241 <th align="left" scope="row" colspan="4">
242 <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
246 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
249 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
253 <input type="hidden" name="mail_sendtype" value="SMTP" />
254 <div id="smtpButtonGroup" class="yui-buttongroup">
255 <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
256 <span class="first-child">
257 <button type="button" name="mail_smtptype" value="gmail">
258 {$APP.LBL_SMTPTYPE_GMAIL}
262 <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
263 <span class="first-child">
264 <button type="button" name="mail_smtptype" value="yahoomail">
265 {$APP.LBL_SMTPTYPE_YAHOO}
269 <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
270 <span class="first-child">
271 <button type="button" name="mail_smtptype" value="exchange">
272 {$APP.LBL_SMTPTYPE_EXCHANGE}
276 <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
277 <span class="first-child">
278 <button type="button" name="mail_smtptype" value="other">
279 {$APP.LBL_TABGROUP_OTHER}
288 <div id="smtp_settings">
289 <table width="100%" cellpadding="0" cellspacing="0">
290 <tr id="mailsettings1">
291 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required" id="required_mail_smtpserver"></span></td>
292 <td width="30%" ><slot><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></slot></td>
293 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span></td>
294 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
296 <tr id="mailsettings2">
297 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
299 <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
300 onclick="notify_setrequired();" {$mail_smtpauth_req}>
302 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
304 <select id="mail_smtpssl" name="mail_smtpssl" onchange="setDefaultSMTPPort()" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
308 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required"></span></td>
309 <td width="30%" ><slot><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></slot></td>
310 <td scope="row"> </td>
314 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required"></span></td>
315 <td width="30%" ><slot><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></slot></td>
316 <td scope="row"> </td>
320 <td width="20%" scope="row">
321 <span id="notify_allow_default_outbound_label">
322 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}
323 <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">
328 <input type='hidden' name='notify_allow_default_outbound' value='0'>
329 <input id='notify_allow_default_outbound' name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
332 <td scope="row"> </td>
336 <td width="50%" cellspan="2" scope="row" nowrap>
337 <input title="{$APP.LBL_CLEAR_BUTTON_TITLE}"
338 class="button" type="button" name="btn_clear" accesskey="{$APP.LBL_CLEAR_BUTTON_KEY}" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"
339 onclick="clearEmailFields();" />
340 <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}"
341 onclick="testOutboundSettingsDialog();">
343 <td scope="row"> </td>
354 <div class="nav-buttons">
355 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
356 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
357 onclick="SugarWizard.changeScreen('locale',true);" id="previous_tab_locale" />
358 <input title="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" class="button primary"
359 onclick="if(adjustEmailSettings())this.form.submit();" type="button" name="continue" value="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" id="next_tab_continue" />
368 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
372 <div id='upload_panel' style="display:none">
373 <form id="upload_form" name="upload_form" method="POST" action='index.php' enctype="multipart/form-data">
374 <input type="file" id="my_file_company" name="file_1" size="20" onchange="uploadCheck(false)"/>
375 <img id="loading_img_company" alt="loading..." src="{sugar_getimagepath file='sqsWait.gif'}" style="display:none">
379 <div id="testOutboundDialog" class="yui-hidden">
380 <div id="testOutbound">
382 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
385 {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
386 <span class="required">
390 <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
394 <td scope="row" colspan="2">
395 <input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">
396 <input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">
405 <script type='text/javascript'>
407 var SugarWizard = new function()
409 this.currentScreen = 'welcome';
411 this.handleKeyStroke = function(e)
413 // get the key pressed
416 key = window.event.keyCode;
424 primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
425 primaryButton.click();
430 this.changeScreen = function(screen,skipCheck)
434 var form = document.getElementById('AdminWizard');
437 switch(this.currentScreen) {
439 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
440 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
442 if(document.getElementById('mail_smtpuser').value != '' ||
443 document.getElementById('mail_smtppass').value != '' ||
444 document.getElementById('notify_allow_default_outbound').checked ||
445 (smtp_server_required && document.getElementById('mail_smtpserver').value != '')
448 if ( document.getElementById('mail_smtpserver').value == '' ) {
449 add_error_style('AdminWizard',form.mail_smtpserver.name,
450 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPSERVER}{literal}' );
453 if ( document.getElementById('mail_smtpauth_req').checked
454 && document.getElementById('mail_smtpuser').value == '' ) {
455 add_error_style('AdminWizard',form.mail_smtpuser.name,
456 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPUSER}{literal}' );
460 if ( document.getElementById('mail_smtpauth_req').checked
461 && document.getElementById('mail_smtppass').value == '' ) {
462 add_error_style('AdminWizard',form.mail_smtppass.name,
463 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPPASS}{literal}' );
469 document.getElementById('upload_panel').style.display="none";
475 document.getElementById(this.currentScreen).style.display = 'none';
476 document.getElementById(screen).style.display = 'block';
478 this.currentScreen = screen;
482 document.getElementById('upload_panel').style.display="inline";
483 document.getElementById('upload_panel').style.position="absolute";
484 YAHOO.util.Dom.setXY('upload_panel', YAHOO.util.Dom.getXY('container_upload'));
487 if ( !SUGAR.smtpButtonGroup ) {
488 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
489 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
491 changeEmailScreenDisplay(e.newValue.get('value'));
492 document.getElementById('smtp_settings').style.display = '';
493 document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
495 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
499 document.getElementById('upload_panel').style.display="none";
503 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
504 document.onkeypress = SugarWizard.handleKeyStroke;
506 function adjustEmailSettings(){
507 var server = document.getElementById('mail_smtpserver'),
508 user = document.getElementById('mail_smtpuser'),
509 pass = document.getElementById('mail_smtppass'),
510 port = document.getElementById('mail_smtpport');
511 if( !server.value || !user.value || !pass.value || !port.value)
519 if (validate['AdminWizard'])
521 removeFromValidate('AdminWizard', 'mail_smtpserver');
522 removeFromValidate('AdminWizard', 'mail_smtpuser');
523 removeFromValidate('AdminWizard', 'mail_smtppass');
524 removeFromValidate('AdminWizard', 'mail_smtpport');
526 if (server.value == "smtp.gmail.com" && !isValidEmail(user.value)) {
527 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
528 SUGAR.language.get('Configurator','LBL_GMAIL_SMTPUSER'));
530 else if (server.value == "plus.smtp.mail.yahoo.com" && !isValidEmail(user.value)) {
531 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
532 SUGAR.language.get('Configurator','LBL_YAHOOMAIL_SMTPUSER'));
534 addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false,
535 document.getElementById("mail_smtpport_label").innerHTML, 1);
536 return check_form("AdminWizard");
540 function clearEmailFields() {
541 document.getElementById('AdminWizard').mail_smtpuser.value = '';
542 document.getElementById('AdminWizard').mail_smtppass.value = '';
543 document.getElementById('notify_allow_default_outbound').checked = false;
544 changeEmailScreenDisplay(document.getElementById('AdminWizard').mail_smtptype.value);
547 function changeEmailScreenDisplay(smtptype)
549 document.getElementById("mail_smtpserver").value = '';
550 document.getElementById("mail_smtpport").value = '25';
551 document.getElementById("mail_smtpauth_req").checked = true;
552 document.getElementById("mailsettings1").style.display = '';
553 document.getElementById("mailsettings2").style.display = '';
554 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
555 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
556 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
557 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
561 document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
562 document.getElementById("mail_smtpport").value = '465';
563 document.getElementById("mail_smtpauth_req").checked = true;
564 var ssl = document.getElementById("mail_smtpssl");
565 for(var j=0;j<ssl.options.length;j++) {
566 if(ssl.options[j].text == 'SSL') {
567 ssl.options[j].selected = true;
571 document.getElementById("mailsettings1").style.display = 'none';
572 document.getElementById("mailsettings2").style.display = 'none';
573 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
574 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
577 document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
578 document.getElementById("mail_smtpport").value = '587';
579 document.getElementById("mail_smtpauth_req").checked = true;
580 var ssl = document.getElementById("mail_smtpssl");
581 for(var j=0;j<ssl.options.length;j++) {
582 if(ssl.options[j].text == 'TLS') {
583 ssl.options[j].selected = true;
587 document.getElementById("mailsettings1").style.display = 'none';
588 document.getElementById("mailsettings2").style.display = 'none';
589 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
590 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
593 document.getElementById("mail_smtpserver").value = '';
594 document.getElementById("mail_smtpport").value = '25';
595 document.getElementById("mail_smtpauth_req").checked = true;
596 document.getElementById("mailsettings1").style.display = '';
597 document.getElementById("mailsettings2").style.display = '';
598 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
599 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
600 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
601 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
604 notify_setrequired();
605 setDefaultSMTPPort();
607 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
609 function uploadCheck(quotes){
610 //AJAX call for checking the file size and comparing with php.ini settings.
613 eval("var file_type = " + r.responseText);
614 var forQuotes = file_type['forQuotes'];
615 document.getElementById('loading_img_'+forQuotes).style.display="none";
616 switch(file_type['data']){
618 alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
619 document.getElementById('my_file_' + forQuotes).value='';
622 alert(SUGAR.language.get('Configurator','LBL_ALERT_SIZE_RATIO'));
623 document.getElementById(forQuotes + "_logo").value=file_type['path'];
624 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
627 alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
628 document.getElementById('my_file_' + forQuotes).value='';
632 document.getElementById(forQuotes + "_logo").value=file_type['path'];
633 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
635 //error in getimagesize because unsupported type
637 alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
638 document.getElementById('my_file_' + forQuotes).value='';
642 alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
645 document.getElementById("company_logo").value='';
646 document.getElementById('loading_img_company').style.display="inline";
647 var file_name = document.getElementById('my_file_company').value;
648 postData = '&entryPoint=UploadFileCheck&forQuotes=false';
649 YAHOO.util.Connect.setForm(document.getElementById('upload_form'), true,true);
651 if(postData.substring(0,1) == '&'){
652 postData=postData.substring(1);
654 YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
658 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
663 function testOutboundSettings() {
664 var errorMessage = '';
666 var fromAddress = document.getElementById("outboundtest_from_address").value;
667 var errorMessage = '';
669 var smtpServer = document.getElementById('mail_smtpserver').value;
670 var smtpPort = document.getElementById('mail_smtpport').value;
671 var smtpssl = document.getElementById('mail_smtpssl').value;
672 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
673 if(trim(smtpServer) == '') {
675 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
677 if(trim(smtpPort) == '') {
679 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
681 if(mailsmtpauthreq.checked) {
682 if(trim(document.getElementById('mail_smtpuser').value) == '') {
684 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
686 if(trim(document.getElementById('mail_smtppass').value) == '') {
688 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
692 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
696 testOutboundSettingsDialog();
700 function sendTestEmail()
702 var fromAddress = document.getElementById("outboundtest_from_address").value;
704 if (trim(fromAddress) == "")
706 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
709 else if (!isValidEmail(fromAddress)) {
710 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
714 //Hide the email address window and show a message notifying the user that the test email is being sent.
715 EmailMan.testOutboundDialog.hide();
716 overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
718 var callbackOutboundTest = {
719 success : function(o) {
721 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
724 var smtpServer = document.getElementById('mail_smtpserver').value;
725 var smtpPort = document.getElementById('mail_smtpport').value;
726 var smtpssl = document.getElementById('mail_smtpssl').value;
727 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
728 var mail_sendtype = 'SMTP';
729 var postDataString = 'mail_sendtype=' + mail_sendtype + '&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + smtpPort + "&mail_smtpssl=" + smtpssl + "&mail_smtpauth_req=" + mailsmtpauthreq.checked + "&mail_smtpuser=" + trim(document.getElementById('mail_smtpuser').value) + "&mail_smtppass=" + trim(document.getElementById('mail_smtppass').value) + "&outboundtest_from_address=" + fromAddress;
730 YAHOO.util.Connect.asyncRequest("POST", "index.php?action=EmailUIAjax&module=Emails&emailUIAction=testOutbound&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
732 function testOutboundSettingsDialog() {
733 // lazy load dialogue
734 if(!EmailMan.testOutboundDialog) {
735 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
739 constraintoviewport: true,
743 EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
744 YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
747 EmailMan.testOutboundDialog.render();
748 EmailMan.testOutboundDialog.show();
751 function overlay(reqtitle, body, type) {
754 config.title = reqtitle;
756 YAHOO.SUGAR.MessageBox.show(config);
759 function hideOverlay() {
760 YAHOO.SUGAR.MessageBox.hide();
763 function notify_setrequired() {
764 document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
765 document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
766 document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
767 document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
770 notify_setrequired();
772 function setDefaultSMTPPort()
774 useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
776 if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
777 document.getElementById("mail_smtpport").value = '465';
779 if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
780 document.getElementById("mail_smtpport").value = '25';