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">
72 <div class="hd"><div class="tl"></div><div class="hd-center"></div><div class="tr"></div></div>
74 <div class="ml"></div>
75 <div class="bd-center">
76 <div id="welcome" class="screen">
77 <table width="100%" border="0" cellspacing="0" cellpadding="0">
80 <div class="edit view">
81 <table width="100%" border="0" cellspacing="0" cellpadding="0">
83 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_WELCOME_TITLE}</h2></th>
87 <p>{$MOD.LBL_WIZARD_WELCOME}</p>
88 <div class="userWizWelcome"><img src='include/images/sugar_wizard_welcome.jpg' border='0' width='765px' height='325px'></div>
96 <div class="nav-buttons">
97 <input title="{$MOD.LBL_WIZARD_SKIP_BUTTON}"
98 onclick="document.location.href='{$SKIP_URL}';" class="button"
99 type="button" name="cancel" value=" {$MOD.LBL_WIZARD_SKIP_BUTTON} " id="skip_tab" />
100 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
101 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
102 onclick="SugarWizard.changeScreen('system',false);" id="next_tab_system" />
106 <div id="system" class="screen">
107 <table width="100%" border="0" cellspacing="0" cellpadding="0">
110 <div class="edit view">
111 <table width="100%" border="0" cellspacing="0" cellpadding="0">
113 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_SYSTEM_TITLE}</h2></th>
116 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SYSTEM_DESC}</i></td>
119 <td scope="row" width='15%' nowrap>{$MOD.SYSTEM_NAME_WIZARD} {sugar_help text=$MOD.SYSTEM_NAME_HELP}</td>
121 <input type='text' name='system_name' value='{$settings.system_name}' />
125 <td scope="row" width='12%' nowrap>{$MOD.NEW_LOGO} {sugar_help text=$MOD.NEW_LOGO_HELP}
128 <div id="container_upload"></div>
129 <input type='text' id='company_logo' name='company_logo' style="display:none" />
133 <td scope="row" width='12%' nowrap>{$MOD.CURRENT_LOGO} {sugar_help text=$MOD.CURRENT_LOGO_HELP}</td>
135 <img id="company_logo_image" src='{$company_logo}' height="40" width="212" />
143 <div class="nav-buttons">
144 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
145 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
146 onclick="SugarWizard.changeScreen('welcome',true);" id="previous_tab_welcome" />
147 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
148 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
149 onclick="SugarWizard.changeScreen('locale',false);" id="next_tab_locale" />
153 <div id="locale" class="screen">
154 <table width="100%" border="0" cellspacing="0" cellpadding="0">
157 <div class="edit view">
158 <table width="100%" border="0" cellspacing="0" cellpadding="0">
160 <th align="left" scope="row" colspan="4"><h2>{sugar_translate module='Administration' label='LBL_LOCALE_TITLE'}</h2></th>
163 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_LOCALE_DESC}</i></td>
166 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DATE_FORMAT'}: </td>
168 {html_options name='default_date_format' selected=$config.default_date_format options=$config.date_formats}
170 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_TIME_FORMAT'}: </td>
172 {html_options name='default_time_format' selected=$config.default_time_format options=$config.time_formats}
176 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_LANGUAGE'}: </td>
178 {html_options name='default_language' selected=$config.default_language options=$LANGUAGES}
182 <td colspan="4"><hr /></td>
185 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_NAME'}: </td>
187 <input type='text' size='15' name='default_currency_name' value='{$config.default_currency_name}' >
189 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_SYMBOL'}: </td>
191 <input type='text' size='4' name='default_currency_symbol' value='{$config.default_currency_symbol}' >
195 <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_ISO4217'}: </td>
197 <input type='text' size='4' name='default_currency_iso4217' value='{$config.default_currency_iso4217}'>
199 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NUMBER_GROUPING_SEP'}: </td>
201 <input type='text' size='3' maxlength='1' name='default_number_grouping_seperator' value='{$config.default_number_grouping_seperator}'>
205 <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DECIMAL_SEP'}: </td>
207 <input type='text' size='3' maxlength='1' name='default_decimal_seperator' value='{$config.default_decimal_seperator}'>
209 <td nowrap="nowrap" scope="row"></td>
213 <td colspan="4"><hr /></td>
217 <input id="default_locale_name_format" type="hidden" name="default_locale_name_format" value="{$config.default_locale_name_format}">
225 <div class="nav-buttons">
226 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
227 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
228 onclick="SugarWizard.changeScreen('system',true);" id="previous_tab_system" />
229 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
230 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
231 onclick="SugarWizard.changeScreen('smtp',false); changeEmailScreenDisplay('{$mail_smtptype}'); document.getElementById('AdminWizard').mail_smtptype.value = 'gmail';" id="next_tab_smtp" />
235 <div id="smtp" class="screen">
236 <table width="100%" border="0" cellspacing="0" cellpadding="0">
239 <div class="edit view">
240 <table width="100%" border="0" cellspacing="0" cellpadding="0">
242 <th align="left" scope="row" colspan="4">
243 <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
247 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
250 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
254 <input type="hidden" name="mail_sendtype" value="SMTP" />
255 <div id="smtpButtonGroup" class="yui-buttongroup">
256 <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
257 <span class="first-child">
258 <button type="button" name="mail_smtptype" value="gmail">
259 {$APP.LBL_SMTPTYPE_GMAIL}
263 <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
264 <span class="first-child">
265 <button type="button" name="mail_smtptype" value="yahoomail">
266 {$APP.LBL_SMTPTYPE_YAHOO}
270 <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
271 <span class="first-child">
272 <button type="button" name="mail_smtptype" value="exchange">
273 {$APP.LBL_SMTPTYPE_EXCHANGE}
277 <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
278 <span class="first-child">
279 <button type="button" name="mail_smtptype" value="other">
280 {$APP.LBL_TABGROUP_OTHER}
289 <div id="smtp_settings">
290 <table width="100%" cellpadding="0" cellspacing="0">
291 <tr id="mailsettings1">
292 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required" id="required_mail_smtpserver"></span></td>
293 <td width="30%" ><slot><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></slot></td>
294 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span></td>
295 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
297 <tr id="mailsettings2">
298 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
300 <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
301 onclick="notify_setrequired();" {$mail_smtpauth_req}>
303 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
305 <select id="mail_smtpssl" name="mail_smtpssl" onchange="setDefaultSMTPPort()" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
309 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required"></span></td>
310 <td width="30%" ><slot><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></slot></td>
311 <td scope="row"> </td>
315 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required"></span></td>
316 <td width="30%" ><slot><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></slot></td>
317 <td scope="row"> </td>
321 <td width="20%" scope="row">
322 <span id="notify_allow_default_outbound_label">
323 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}
324 <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">
329 <input type='hidden' name='notify_allow_default_outbound' value='0'>
330 <input id='notify_allow_default_outbound' name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
333 <td scope="row"> </td>
337 <td width="50%" cellspan="2" scope="row" nowrap>
338 <input title="{$APP.LBL_CLEAR_BUTTON_TITLE}"
339 class="button" type="button" name="btn_clear" accesskey="{$APP.LBL_CLEAR_BUTTON_KEY}" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"
340 onclick="clearEmailFields();" />
341 <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}"
342 onclick="testOutboundSettingsDialog();">
344 <td scope="row"> </td>
355 <div class="nav-buttons">
356 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
357 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
358 onclick="SugarWizard.changeScreen('locale',true);" id="previous_tab_locale" />
359 <input title="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" class="button primary"
360 onclick="if(adjustEmailSettings())this.form.submit();" type="button" name="continue" value="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" id="next_tab_continue" />
364 <div class="mr"></div>
366 <div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
370 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
374 <div id='upload_panel' style="display:none">
375 <form id="upload_form" name="upload_form" method="POST" action='index.php' enctype="multipart/form-data">
376 <input type="file" id="my_file_company" name="file_1" size="20" onchange="uploadCheck(false)"/>
377 <img id="loading_img_company" alt="loading..." src="{sugar_getimagepath file='sqsWait.gif'}" style="display:none">
381 <div id="testOutboundDialog" class="yui-hidden">
382 <div id="testOutbound">
384 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
387 {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
388 <span class="required">
392 <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
396 <td scope="row" colspan="2">
397 <input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">
398 <input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">
407 <script type='text/javascript'>
409 var SugarWizard = new function()
411 this.currentScreen = 'welcome';
413 this.handleKeyStroke = function(e)
415 // get the key pressed
418 key = window.event.keyCode;
426 primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
427 primaryButton.click();
432 this.changeScreen = function(screen,skipCheck)
436 var form = document.getElementById('AdminWizard');
439 switch(this.currentScreen) {
441 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
442 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
444 if(document.getElementById('mail_smtpuser').value != '' ||
445 document.getElementById('mail_smtppass').value != '' ||
446 document.getElementById('notify_allow_default_outbound').checked ||
447 (smtp_server_required && document.getElementById('mail_smtpserver').value != '')
450 if ( document.getElementById('mail_smtpserver').value == '' ) {
451 add_error_style('AdminWizard',form.mail_smtpserver.name,
452 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPSERVER}{literal}' );
455 if ( document.getElementById('mail_smtpauth_req').checked
456 && document.getElementById('mail_smtpuser').value == '' ) {
457 add_error_style('AdminWizard',form.mail_smtpuser.name,
458 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPUSER}{literal}' );
462 if ( document.getElementById('mail_smtpauth_req').checked
463 && document.getElementById('mail_smtppass').value == '' ) {
464 add_error_style('AdminWizard',form.mail_smtppass.name,
465 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPPASS}{literal}' );
471 document.getElementById('upload_panel').style.display="none";
477 document.getElementById(this.currentScreen).style.display = 'none';
478 document.getElementById(screen).style.display = 'block';
480 this.currentScreen = screen;
484 document.getElementById('upload_panel').style.display="inline";
485 document.getElementById('upload_panel').style.position="absolute";
486 YAHOO.util.Dom.setXY('upload_panel', YAHOO.util.Dom.getXY('container_upload'));
489 if ( !SUGAR.smtpButtonGroup ) {
490 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
491 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
493 changeEmailScreenDisplay(e.newValue.get('value'));
494 document.getElementById('smtp_settings').style.display = '';
495 document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
497 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
501 document.getElementById('upload_panel').style.display="none";
505 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
506 document.onkeypress = SugarWizard.handleKeyStroke;
508 function adjustEmailSettings(){
509 var server = document.getElementById('mail_smtpserver'),
510 user = document.getElementById('mail_smtpuser'),
511 pass = document.getElementById('mail_smtppass'),
512 port = document.getElementById('mail_smtpport');
513 if( !server.value || !user.value || !pass.value || !port.value)
521 if (validate['AdminWizard'])
523 removeFromValidate('AdminWizard', 'mail_smtpserver');
524 removeFromValidate('AdminWizard', 'mail_smtpuser');
525 removeFromValidate('AdminWizard', 'mail_smtppass');
526 removeFromValidate('AdminWizard', 'mail_smtpport');
528 if (server.value == "smtp.gmail.com" && !isValidEmail(user.value)) {
529 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
530 SUGAR.language.get('Configurator','LBL_GMAIL_SMTPUSER'));
532 else if (server.value == "plus.smtp.mail.yahoo.com" && !isValidEmail(user.value)) {
533 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
534 SUGAR.language.get('Configurator','LBL_YAHOOMAIL_SMTPUSER'));
536 addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false,
537 document.getElementById("mail_smtpport_label").innerHTML, 1);
538 return check_form("AdminWizard");
542 function clearEmailFields() {
543 document.getElementById('AdminWizard').mail_smtpuser.value = '';
544 document.getElementById('AdminWizard').mail_smtppass.value = '';
545 document.getElementById('notify_allow_default_outbound').checked = false;
546 changeEmailScreenDisplay(document.getElementById('AdminWizard').mail_smtptype.value);
549 function changeEmailScreenDisplay(smtptype)
551 document.getElementById("mail_smtpserver").value = '';
552 document.getElementById("mail_smtpport").value = '25';
553 document.getElementById("mail_smtpauth_req").checked = true;
554 document.getElementById("mailsettings1").style.display = '';
555 document.getElementById("mailsettings2").style.display = '';
556 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
557 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
558 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
559 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
563 document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
564 document.getElementById("mail_smtpport").value = '465';
565 document.getElementById("mail_smtpauth_req").checked = true;
566 var ssl = document.getElementById("mail_smtpssl");
567 for(var j=0;j<ssl.options.length;j++) {
568 if(ssl.options[j].text == 'SSL') {
569 ssl.options[j].selected = true;
573 document.getElementById("mailsettings1").style.display = 'none';
574 document.getElementById("mailsettings2").style.display = 'none';
575 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
576 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
579 document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
580 document.getElementById("mail_smtpport").value = '587';
581 document.getElementById("mail_smtpauth_req").checked = true;
582 var ssl = document.getElementById("mail_smtpssl");
583 for(var j=0;j<ssl.options.length;j++) {
584 if(ssl.options[j].text == 'TLS') {
585 ssl.options[j].selected = true;
589 document.getElementById("mailsettings1").style.display = 'none';
590 document.getElementById("mailsettings2").style.display = 'none';
591 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
592 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
595 document.getElementById("mail_smtpserver").value = '';
596 document.getElementById("mail_smtpport").value = '25';
597 document.getElementById("mail_smtpauth_req").checked = true;
598 document.getElementById("mailsettings1").style.display = '';
599 document.getElementById("mailsettings2").style.display = '';
600 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
601 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
602 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
603 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
606 notify_setrequired();
607 setDefaultSMTPPort();
609 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
611 function uploadCheck(quotes){
612 //AJAX call for checking the file size and comparing with php.ini settings.
615 eval("var file_type = " + r.responseText);
616 var forQuotes = file_type['forQuotes'];
617 document.getElementById('loading_img_'+forQuotes).style.display="none";
618 switch(file_type['data']){
620 alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
621 document.getElementById('my_file_' + forQuotes).value='';
624 alert(SUGAR.language.get('Configurator','LBL_ALERT_SIZE_RATIO'));
625 document.getElementById(forQuotes + "_logo").value=file_type['path'];
626 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
629 alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
630 document.getElementById('my_file_' + forQuotes).value='';
634 document.getElementById(forQuotes + "_logo").value=file_type['path'];
635 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
637 //error in getimagesize because unsupported type
639 alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
640 document.getElementById('my_file_' + forQuotes).value='';
644 alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
647 document.getElementById("company_logo").value='';
648 document.getElementById('loading_img_company').style.display="inline";
649 var file_name = document.getElementById('my_file_company').value;
650 postData = '&entryPoint=UploadFileCheck&forQuotes=false';
651 YAHOO.util.Connect.setForm(document.getElementById('upload_form'), true,true);
653 if(postData.substring(0,1) == '&'){
654 postData=postData.substring(1);
656 YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
660 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
665 function testOutboundSettings() {
666 var errorMessage = '';
668 var fromAddress = document.getElementById("outboundtest_from_address").value;
669 var errorMessage = '';
671 var smtpServer = document.getElementById('mail_smtpserver').value;
672 var smtpPort = document.getElementById('mail_smtpport').value;
673 var smtpssl = document.getElementById('mail_smtpssl').value;
674 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
675 if(trim(smtpServer) == '') {
677 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
679 if(trim(smtpPort) == '') {
681 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
683 if(mailsmtpauthreq.checked) {
684 if(trim(document.getElementById('mail_smtpuser').value) == '') {
686 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
688 if(trim(document.getElementById('mail_smtppass').value) == '') {
690 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
694 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
698 testOutboundSettingsDialog();
702 function sendTestEmail()
704 var fromAddress = document.getElementById("outboundtest_from_address").value;
706 if (trim(fromAddress) == "")
708 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
711 else if (!isValidEmail(fromAddress)) {
712 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
716 //Hide the email address window and show a message notifying the user that the test email is being sent.
717 EmailMan.testOutboundDialog.hide();
718 overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
720 var callbackOutboundTest = {
721 success : function(o) {
723 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
726 var smtpServer = document.getElementById('mail_smtpserver').value;
727 var smtpPort = document.getElementById('mail_smtpport').value;
728 var smtpssl = document.getElementById('mail_smtpssl').value;
729 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
730 var mail_sendtype = 'SMTP';
731 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;
732 YAHOO.util.Connect.asyncRequest("POST", "index.php?action=EmailUIAjax&module=Emails&emailUIAction=testOutbound&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
734 function testOutboundSettingsDialog() {
735 // lazy load dialogue
736 if(!EmailMan.testOutboundDialog) {
737 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
741 constraintoviewport: true,
745 EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
746 YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
749 EmailMan.testOutboundDialog.render();
750 EmailMan.testOutboundDialog.show();
753 function overlay(reqtitle, body, type) {
756 config.title = reqtitle;
758 YAHOO.SUGAR.MessageBox.show(config);
761 function hideOverlay() {
762 YAHOO.SUGAR.MessageBox.hide();
765 function notify_setrequired() {
766 document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
767 document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
768 document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
769 document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
772 notify_setrequired();
774 function setDefaultSMTPPort()
776 useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
778 if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
779 document.getElementById("mail_smtpport").value = '465';
781 if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
782 document.getElementById("mail_smtpport").value = '25';