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 ********************************************************************************/
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} " />
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);" />
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);" />
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);" />
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>
216 <td nowrap="nowrap" scope="row" valign="top">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NAME_FORMAT'}: </td>
218 <input onkeyup="setPreview();" size='15' onkeydown="setPreview();" id="default_locale_name_format" type="text" name="default_locale_name_format" value="{$config.default_locale_name_format}">
220 {sugar_translate module='Administration' label='LBL_LOCALE_NAME_FORMAT_DESC'}
222 <td nowrap="nowrap" scope="row" valign="top">{sugar_translate module='Administration' label='LBL_LOCALE_EXAMPLE_NAME_FORMAT'}: </td>
223 <td valign="top"><input name="no_value" id="nameTarget" style="border: none;" value="" disabled></td>
230 <div class="nav-buttons">
231 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
232 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
233 onclick="SugarWizard.changeScreen('system',true);" />
234 <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
235 class="button primary" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_NEXT_BUTTON} "
236 onclick="SugarWizard.changeScreen('smtp',false); changeEmailScreenDisplay('{$mail_smtptype}'); document.getElementById('AdminWizard').mail_smtptype.value = 'gmail';" />
240 <div id="smtp" class="screen">
241 <table width="100%" border="0" cellspacing="0" cellpadding="0">
244 <div class="edit view">
245 <table width="100%" border="0" cellspacing="0" cellpadding="0">
247 <th align="left" scope="row" colspan="4">
248 <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
252 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
255 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
259 <input type="hidden" name="mail_sendtype" value="SMTP" />
260 <div id="smtpButtonGroup" class="yui-buttongroup">
261 <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
262 <span class="first-child">
263 <button type="button" name="mail_smtptype" value="gmail">
264 {$APP.LBL_SMTPTYPE_GMAIL}
268 <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
269 <span class="first-child">
270 <button type="button" name="mail_smtptype" value="yahoomail">
271 {$APP.LBL_SMTPTYPE_YAHOO}
275 <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
276 <span class="first-child">
277 <button type="button" name="mail_smtptype" value="exchange">
278 {$APP.LBL_SMTPTYPE_EXCHANGE}
282 <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
283 <span class="first-child">
284 <button type="button" name="mail_smtptype" value="other">
285 {$APP.LBL_TABGROUP_OTHER}
294 <div id="smtp_settings">
295 <table width="100%" cellpadding="0" cellspacing="0">
296 <tr id="mailsettings1">
297 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required" id="required_mail_smtpserver"></span></td>
298 <td width="30%" ><slot><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></slot></td>
299 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span></td>
300 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
302 <tr id="mailsettings2">
303 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
305 <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
306 onclick="notify_setrequired();" {$mail_smtpauth_req}>
308 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
310 <select id="mail_smtpssl" name="mail_smtpssl" onchange="setDefaultSMTPPort()" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
314 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required"></span></td>
315 <td width="30%" ><slot><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></slot></td>
316 <td scope="row"> </td>
320 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required"></span></td>
321 <td width="30%" ><slot><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></slot></td>
322 <td scope="row"> </td>
326 <td width="20%" scope="row">
327 <span id="notify_allow_default_outbound_label">
328 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}
329 <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">
334 <input type='hidden' name='notify_allow_default_outbound' value='0'>
335 <input id='notify_allow_default_outbound' name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
338 <td scope="row"> </td>
342 <td width="50%" cellspan="2" scope="row" nowrap>
343 <input title="{$APP.LBL_CLEAR_BUTTON_TITLE}"
344 class="button" type="button" name="btn_clear" accesskey="{$APP.LBL_CLEAR_BUTTON_KEY}" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"
345 onclick="clearEmailFields();" />
346 <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}"
347 onclick="testOutboundSettingsDialog();">
349 <td scope="row"> </td>
360 <div class="nav-buttons">
361 <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
362 class="button" type="button" name="next_tab1" value=" {$MOD.LBL_WIZARD_BACK_BUTTON} "
363 onclick="SugarWizard.changeScreen('locale',true);" />
364 <input title="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" class="button primary"
365 onclick="if(adjustEmailSettings())this.form.submit();" type="button" name="continue" value="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" />
369 <div class="mr"></div>
371 <div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
375 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
379 <div id='upload_panel' style="display:none">
380 <form id="upload_form" name="upload_form" method="POST" action='index.php' enctype="multipart/form-data">
381 <input type="file" id="my_file_company" name="file_1" size="20" onchange="uploadCheck(false)"/>
382 <img id="loading_img_company" alt="loading..." src="{sugar_getimagepath file='sqsWait.gif'}" style="display:none">
386 <div id="testOutboundDialog" class="yui-hidden">
387 <div id="testOutbound">
389 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
392 {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
393 <span class="required">
397 <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
401 <td scope="row" colspan="2">
402 <input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">
403 <input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">
412 <script type='text/javascript'>
414 var SugarWizard = new function()
416 this.currentScreen = 'welcome';
418 this.handleKeyStroke = function(e)
420 // get the key pressed
423 key = window.event.keyCode;
431 primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
432 primaryButton.click();
437 this.changeScreen = function(screen,skipCheck)
441 var form = document.getElementById('AdminWizard');
444 switch(this.currentScreen) {
446 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
447 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
449 if(document.getElementById('mail_smtpuser').value != '' ||
450 document.getElementById('mail_smtppass').value != '' ||
451 document.getElementById('notify_allow_default_outbound').checked ||
452 (smtp_server_required && document.getElementById('mail_smtpserver').value != '')
455 if ( document.getElementById('mail_smtpserver').value == '' ) {
456 add_error_style('AdminWizard',form.mail_smtpserver.name,
457 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPSERVER}{literal}' );
460 if ( document.getElementById('mail_smtpauth_req').checked
461 && document.getElementById('mail_smtpuser').value == '' ) {
462 add_error_style('AdminWizard',form.mail_smtpuser.name,
463 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPUSER}{literal}' );
467 if ( document.getElementById('mail_smtpauth_req').checked
468 && document.getElementById('mail_smtppass').value == '' ) {
469 add_error_style('AdminWizard',form.mail_smtppass.name,
470 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPPASS}{literal}' );
476 document.getElementById('upload_panel').style.display="none";
482 document.getElementById(this.currentScreen).style.display = 'none';
483 document.getElementById(screen).style.display = 'block';
485 this.currentScreen = screen;
489 document.getElementById('upload_panel').style.display="inline";
490 document.getElementById('upload_panel').style.position="absolute";
491 YAHOO.util.Dom.setXY('upload_panel', YAHOO.util.Dom.getXY('container_upload'));
494 if ( !SUGAR.smtpButtonGroup ) {
495 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
496 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
498 changeEmailScreenDisplay(e.newValue.get('value'));
499 document.getElementById('smtp_settings').style.display = '';
500 document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
502 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
506 document.getElementById('upload_panel').style.display="none";
510 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
511 document.onkeypress = SugarWizard.handleKeyStroke;
513 function adjustEmailSettings(){
514 var server = document.getElementById('mail_smtpserver'),
515 user = document.getElementById('mail_smtpuser'),
516 pass = document.getElementById('mail_smtppass'),
517 port = document.getElementById('mail_smtpport');
518 if( !server.value || !user.value || !pass.value || !port.value)
526 if (validate['AdminWizard'])
528 removeFromValidate('AdminWizard', 'mail_smtpserver');
529 removeFromValidate('AdminWizard', 'mail_smtpuser');
530 removeFromValidate('AdminWizard', 'mail_smtppass');
531 removeFromValidate('AdminWizard', 'mail_smtpport');
533 if (server.value == "smtp.gmail.com" && !isValidEmail(user.value)) {
534 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
535 SUGAR.language.get('Configurator','LBL_GMAIL_SMTPUSER'));
537 else if (server.value == "plus.smtp.mail.yahoo.com" && !isValidEmail(user.value)) {
538 addToValidate("AdminWizard", 'mail_smtpuser', 'email', false,
539 SUGAR.language.get('Configurator','LBL_YAHOOMAIL_SMTPUSER'));
541 addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false,
542 document.getElementById("mail_smtpport_label").innerHTML, 1);
543 return check_form("AdminWizard");
547 function clearEmailFields() {
548 document.getElementById('AdminWizard').mail_smtpuser.value = '';
549 document.getElementById('AdminWizard').mail_smtppass.value = '';
550 document.getElementById('notify_allow_default_outbound').checked = false;
551 changeEmailScreenDisplay(document.getElementById('AdminWizard').mail_smtptype.value);
554 function changeEmailScreenDisplay(smtptype)
556 document.getElementById("mail_smtpserver").value = '';
557 document.getElementById("mail_smtpport").value = '25';
558 document.getElementById("mail_smtpauth_req").checked = true;
559 document.getElementById("mailsettings1").style.display = '';
560 document.getElementById("mailsettings2").style.display = '';
561 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
562 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
563 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
564 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
568 document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
569 document.getElementById("mail_smtpport").value = '465';
570 document.getElementById("mail_smtpauth_req").checked = true;
571 var ssl = document.getElementById("mail_smtpssl");
572 for(var j=0;j<ssl.options.length;j++) {
573 if(ssl.options[j].text == 'SSL') {
574 ssl.options[j].selected = true;
578 document.getElementById("mailsettings1").style.display = 'none';
579 document.getElementById("mailsettings2").style.display = 'none';
580 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
581 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
584 document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
585 document.getElementById("mail_smtpport").value = '587';
586 document.getElementById("mail_smtpauth_req").checked = true;
587 var ssl = document.getElementById("mail_smtpssl");
588 for(var j=0;j<ssl.options.length;j++) {
589 if(ssl.options[j].text == 'TLS') {
590 ssl.options[j].selected = true;
594 document.getElementById("mailsettings1").style.display = 'none';
595 document.getElementById("mailsettings2").style.display = 'none';
596 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
597 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
600 document.getElementById("mail_smtpserver").value = '';
601 document.getElementById("mail_smtpport").value = '25';
602 document.getElementById("mail_smtpauth_req").checked = true;
603 document.getElementById("mailsettings1").style.display = '';
604 document.getElementById("mailsettings2").style.display = '';
605 document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
606 document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
607 document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
608 document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
611 notify_setrequired();
612 setDefaultSMTPPort();
614 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
616 function uploadCheck(quotes){
617 //AJAX call for checking the file size and comparing with php.ini settings.
620 eval("var file_type = " + r.responseText);
621 var forQuotes = file_type['forQuotes'];
622 document.getElementById('loading_img_'+forQuotes).style.display="none";
623 switch(file_type['data']){
625 alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
626 document.getElementById('my_file_' + forQuotes).value='';
629 alert(SUGAR.language.get('Configurator','LBL_ALERT_SIZE_RATIO'));
630 document.getElementById(forQuotes + "_logo").value=file_type['path'];
631 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
634 alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
635 document.getElementById('my_file_' + forQuotes).value='';
639 document.getElementById(forQuotes + "_logo").value=file_type['path'];
640 document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
642 //error in getimagesize because unsupported type
644 alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
645 document.getElementById('my_file_' + forQuotes).value='';
649 alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
652 document.getElementById("company_logo").value='';
653 document.getElementById('loading_img_company').style.display="inline";
654 var file_name = document.getElementById('my_file_company').value;
655 postData = '&entryPoint=UploadFileCheck&forQuotes=false';
656 YAHOO.util.Connect.setForm(document.getElementById('upload_form'), true,true);
658 if(postData.substring(0,1) == '&'){
659 postData=postData.substring(1);
661 YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
665 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
670 function testOutboundSettings() {
671 var errorMessage = '';
673 var fromAddress = document.getElementById("outboundtest_from_address").value;
674 var errorMessage = '';
676 var smtpServer = document.getElementById('mail_smtpserver').value;
677 var smtpPort = document.getElementById('mail_smtpport').value;
678 var smtpssl = document.getElementById('mail_smtpssl').value;
679 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
680 if(trim(smtpServer) == '') {
682 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
684 if(trim(smtpPort) == '') {
686 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
688 if(mailsmtpauthreq.checked) {
689 if(trim(document.getElementById('mail_smtpuser').value) == '') {
691 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
693 if(trim(document.getElementById('mail_smtppass').value) == '') {
695 errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
699 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
703 testOutboundSettingsDialog();
707 function sendTestEmail()
709 var fromAddress = document.getElementById("outboundtest_from_address").value;
711 if (trim(fromAddress) == "")
713 overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
716 else if (!isValidEmail(fromAddress)) {
717 overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
721 //Hide the email address window and show a message notifying the user that the test email is being sent.
722 EmailMan.testOutboundDialog.hide();
723 overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
725 var callbackOutboundTest = {
726 success : function(o) {
728 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
731 var smtpServer = document.getElementById('mail_smtpserver').value;
732 var smtpPort = document.getElementById('mail_smtpport').value;
733 var smtpssl = document.getElementById('mail_smtpssl').value;
734 var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
735 var mail_sendtype = 'SMTP';
736 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;
737 YAHOO.util.Connect.asyncRequest("POST", "index.php?action=EmailUIAjax&module=Emails&emailUIAction=testOutbound&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
739 function testOutboundSettingsDialog() {
740 // lazy load dialogue
741 if(!EmailMan.testOutboundDialog) {
742 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
746 constraintoviewport: true,
750 EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
751 YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
754 EmailMan.testOutboundDialog.render();
755 EmailMan.testOutboundDialog.show();
758 function overlay(reqtitle, body, type) {
761 config.title = reqtitle;
763 YAHOO.SUGAR.MessageBox.show(config);
766 function hideOverlay() {
767 YAHOO.SUGAR.MessageBox.hide();
770 function notify_setrequired() {
771 document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
772 document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
773 document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
774 document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
777 notify_setrequired();
779 function setDefaultSMTPPort()
781 useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
783 if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
784 document.getElementById("mail_smtpport").value = '465';
786 if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
787 document.getElementById("mail_smtpport").value = '25';