]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Configurator/tpls/adminwizard.tpl
Release 6.2.4
[Github/sugarcrm.git] / modules / Configurator / tpls / adminwizard.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
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.
12  * 
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
16  * details.
17  * 
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
21  * 02110-1301 USA.
22  * 
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.
25  * 
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.
29  * 
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  ********************************************************************************/
36
37 *}
38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
39 <html>
40 <head>
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>
44 {$SUGAR_JS}
45 {$SUGAR_CSS}
46 {$CSS}
47 {overlib_includes}
48 </head>
49 {literal}
50 <script type='text/javascript'>
51 function disableReturnSubmission(e) {
52    var key = window.event ? window.event.keyCode : e.which;
53    return (key != 13);
54 }
55 </script>
56 {/literal}
57 <body class="yui-skin-sam">
58 <div id="main">
59     <div id="content">
60         <table style="width:auto;height:600px;" align="center"><tr><td align="center">
61                 
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>
70
71 <div class="dashletPanelMenu">
72 <div class="hd"><div class="tl"></div><div class="hd-center"></div><div class="tr"></div></div>
73 <div class="bd">
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">
78     <tr>
79         <td>
80             <div class="edit view">
81             <table width="100%" border="0" cellspacing="0" cellpadding="0">
82             <tr>
83                 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_WELCOME_TITLE}</h2></th>
84             </tr>
85             <tr>
86                 <td scope="row">
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>
89                 </td>
90             </tr>
91             </table>
92             </div>
93         </td>
94     </tr>
95     </table>
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" />&nbsp;
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" />
103     </div>
104 </div>
105
106 <div id="system" class="screen">
107     <table width="100%" border="0" cellspacing="0" cellpadding="0">
108     <tr>
109         <td>
110             <div class="edit view">
111             <table width="100%" border="0" cellspacing="0" cellpadding="0">
112             <tr>
113                 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_SYSTEM_TITLE}</h2></th>
114             </tr>
115             <tr>
116                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SYSTEM_DESC}</i></td>
117             </tr>
118             <tr>
119                 <td scope="row" width='15%' nowrap>{$MOD.SYSTEM_NAME_WIZARD}&nbsp;{sugar_help text=$MOD.SYSTEM_NAME_HELP}</td>
120                 <td width='35%'>
121                     <input type='text' name='system_name' value='{$settings.system_name}' />
122                 </td>
123             </tr>
124             <tr>
125                 <td scope="row" width='12%' nowrap>{$MOD.NEW_LOGO}&nbsp;{sugar_help text=$MOD.NEW_LOGO_HELP}
126                 </td>
127                 <td  width='35%'>
128                     <div id="container_upload"></div>
129                     <input type='text' id='company_logo' name='company_logo' style="display:none" />
130                 </td>
131             </tr>
132             <tr>
133                 <td scope="row" width='12%' nowrap>{$MOD.CURRENT_LOGO}&nbsp;{sugar_help text=$MOD.CURRENT_LOGO_HELP}</td>
134                 <td width='35%' >
135                     <img id="company_logo_image" src='{$company_logo}' height="40" width="212" />
136                 </td>
137             </tr>
138             </table>
139             </div>
140         </td>
141     </tr>
142     </table>
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" />&nbsp;
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" />
150     </div>
151 </div>
152
153 <div id="locale" class="screen">
154     <table width="100%" border="0" cellspacing="0" cellpadding="0">
155     <tr>
156         <td>
157             <div class="edit view">
158             <table width="100%" border="0" cellspacing="0" cellpadding="0">
159                 <tr>
160                     <th align="left" scope="row" colspan="4"><h2>{sugar_translate module='Administration' label='LBL_LOCALE_TITLE'}</h2></th>
161                 </tr>
162                 <tr>
163                     <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_LOCALE_DESC}</i></td>
164                 </tr>
165                 <tr>
166                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DATE_FORMAT'}: </td>
167                     <td>
168                         {html_options name='default_date_format' selected=$config.default_date_format options=$config.date_formats}
169                     </td>
170                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_TIME_FORMAT'}: </td>
171                     <td>
172                         {html_options name='default_time_format' selected=$config.default_time_format options=$config.time_formats}
173                     </td>
174                 </tr>
175                 <tr>
176                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_LANGUAGE'}: </td>
177                     <td>
178                         {html_options name='default_language' selected=$config.default_language options=$LANGUAGES}
179                     </td>
180                 </tr>
181                 <tr>
182                     <td colspan="4"><hr /></td>
183                 </tr>
184                 <tr>
185                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_NAME'}: </td>
186                     <td>
187                         <input type='text' size='15' name='default_currency_name' value='{$config.default_currency_name}' >
188                     </td>
189                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_SYMBOL'}: </td>
190                     <td>
191                         <input type='text' size='4' name='default_currency_symbol'  value='{$config.default_currency_symbol}' >
192                     </td>
193                 </tr>
194                 <tr>
195                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_ISO4217'}: </td>
196                     <td>
197                         <input type='text' size='4' name='default_currency_iso4217' value='{$config.default_currency_iso4217}'>
198                     </td>
199                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NUMBER_GROUPING_SEP'}: </td>
200                     <td>
201                         <input type='text' size='3' maxlength='1' name='default_number_grouping_seperator' value='{$config.default_number_grouping_seperator}'>
202                     </td>
203                 </tr>
204                 <tr>
205                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DECIMAL_SEP'}: </td>
206                     <td>
207                         <input type='text' size='3' maxlength='1' name='default_decimal_seperator'  value='{$config.default_decimal_seperator}'>
208                     </td>
209                     <td nowrap="nowrap" scope="row"></td>
210                     <td></td>
211                 </tr>
212                 <tr>
213                     <td colspan="4"><hr /></td>
214                 </tr>
215                 <tr>
216                     <td>
217                         <input id="default_locale_name_format" type="hidden" name="default_locale_name_format" value="{$config.default_locale_name_format}">
218                     </td>
219                 </tr>
220             </table>
221             </div>
222         </td>
223     </tr>
224     </table>
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" />&nbsp;
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" />
232     </div>
233 </div>
234
235 <div id="smtp" class="screen">
236     <table width="100%" border="0" cellspacing="0" cellpadding="0">
237     <tr>
238     <td>
239         <div class="edit view">
240         <table width="100%" border="0" cellspacing="0" cellpadding="0">
241             <tr>
242                 <th align="left" scope="row" colspan="4">
243                     <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
244                 </th>
245             </tr>
246             <tr>
247                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
248             </tr>
249              <tr>
250                 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
251             </tr>
252             <tr>
253                 <td colspan="4">
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_GMAIL}&nbsp;&nbsp;&nbsp;&nbsp;
260                                 </button>
261                             </span>
262                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_YAHOO}&nbsp;&nbsp;&nbsp;&nbsp;
267                                 </button>
268                             </span>
269                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_EXCHANGE}&nbsp;&nbsp;&nbsp;&nbsp;
274                                 </button>
275                             </span>
276                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_TABGROUP_OTHER}&nbsp;&nbsp;&nbsp;&nbsp;
281                                 </button>
282                             </span>
283                         </span>
284                     </div>
285                 </td>
286             </tr>
287             <tr>
288                 <td colspan="4">
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>
296                             </tr>
297                             <tr id="mailsettings2">
298                                 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
299                                 <td width="30%">
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}>
302                                 </td>
303                                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
304                                 <td width="30%">
305                                 <select id="mail_smtpssl" name="mail_smtpssl" onchange="setDefaultSMTPPort()" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
306                                 </td>
307                             </tr>
308                             <tr id="smtp_auth1">
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">&nbsp;</td>
312                                 <td >&nbsp;</td>
313                             </tr>
314                             <tr id="smtp_auth2">
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">&nbsp;</td>
318                                 <td >&nbsp;</td>
319                             </tr>
320                                             <tr>
321                                                             <td width="20%" scope="row">
322                                                                 <span id="notify_allow_default_outbound_label">
323                                                                 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}&nbsp;
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">
325                                                                         </span>
326                                                                 </td>
327                                                             <td width="30%">
328                                                                  <slot>
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}>
331                                                                          </slot>
332                                                                 </td>                
333                                                 <td scope="row">&nbsp;</td>
334                                                 <td >&nbsp;</td>
335                                             </tr>                            
336                             <tr>
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();" />&nbsp;                                    
341                                     <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" 
342                                         onclick="testOutboundSettingsDialog();">&nbsp;
343                                 </td>
344                                 <td scope="row">&nbsp;</td>
345                                 <td >&nbsp;</td>
346                             </tr>
347                         </table>
348                      </div>
349                 </td>
350             </tr>               
351         </table>
352         </div>
353     </td>
354     </table>
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" />&nbsp;
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" />&nbsp;
361     </div>
362 </div>
363                         </div>
364                         <div class="mr"></div>
365 </div>
366 <div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
367 </div>
368
369 <script>
370 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
371 </script>
372 </form>
373
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">
378     </form>
379 </div>
380
381 <div id="testOutboundDialog" class="yui-hidden">
382     <div id="testOutbound">
383         <form>
384                 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
385                         <tr>
386                                 <td scope="row">
387                                         {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR} 
388                                         <span class="required">
389                                         </span>
390                                 </td>
391                                 <td>
392                                         <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
393                                 </td>
394                         </tr>
395                         <tr>
396                                 <td scope="row" colspan="2">
397                                         <input type="button" class="button" value="   {$APP.LBL_EMAIL_SEND}   " onclick="javascript:sendTestEmail();">&nbsp;
398                                         <input type="button" class="button" value="   {$APP.LBL_CANCEL_BUTTON_LABEL}   " onclick="javascript:EmailMan.testOutboundDialog.hide();">&nbsp;
399                                 </td>
400                         </tr>
401                 </table>
402                 </form>
403         </div>
404 </div>
405
406 {literal}
407 <script type='text/javascript'>
408 <!--
409 var SugarWizard = new function()
410 {
411     this.currentScreen = 'welcome';
412     
413     this.handleKeyStroke = function(e)
414     {
415         // get the key pressed
416         var key;
417         if (window.event) {
418             key = window.event.keyCode;
419         }
420         else if(e.which) {
421             key = e.which
422         }
423         
424         switch(key) {
425         case 13:
426             primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
427             primaryButton.click();
428             break;
429         }
430     }
431     
432     this.changeScreen = function(screen,skipCheck)
433     {
434         if ( !skipCheck ) {
435             clear_all_errors();
436             var form = document.getElementById('AdminWizard');
437             var isError = false;
438             
439             switch(this.currentScreen) {
440             case 'smtp':
441                 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
442                 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
443             
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 != '') 
448                    ) {
449                        
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}' );
453                                     isError = true;
454                                 }
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}' );
459                                     isError = true;
460                                 }
461                                 
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}' );
466                                     isError = true;
467                                 }                               
468                 }
469                 break;
470             default:
471                 document.getElementById('upload_panel').style.display="none";
472             }
473             if (isError == true)
474                 return false;
475         }
476         
477         document.getElementById(this.currentScreen).style.display = 'none';
478         document.getElementById(screen).style.display = 'block';
479         
480         this.currentScreen = screen;
481         
482         switch(screen) {
483         case 'system':
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'));
487             break;
488         case 'smtp':
489             if ( !SUGAR.smtpButtonGroup ) {
490                 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
491                 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
492                 {
493                     changeEmailScreenDisplay(e.newValue.get('value'));
494                     document.getElementById('smtp_settings').style.display = '';
495                     document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
496                 });
497                 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
498             }
499             break;
500         default:
501             document.getElementById('upload_panel').style.display="none";
502         }
503     }
504
505 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
506 document.onkeypress = SugarWizard.handleKeyStroke;
507
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)
514         {
515                         server.value = ""; 
516                         user.value = ""; 
517                         pass.value = ""; 
518                         port.value = "";
519                         return true;
520     } else {
521                 if (validate['AdminWizard'])
522                 {
523                         removeFromValidate('AdminWizard', 'mail_smtpserver');
524                         removeFromValidate('AdminWizard', 'mail_smtpuser');
525                         removeFromValidate('AdminWizard', 'mail_smtppass');
526                         removeFromValidate('AdminWizard', 'mail_smtpport');
527                 }
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'));
531             }
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'));
535         }
536                 addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false, 
537               document.getElementById("mail_smtpport_label").innerHTML, 1);
538                 return check_form("AdminWizard");
539         }
540 }
541
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);
547 }
548
549 function changeEmailScreenDisplay(smtptype)
550 {
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}';
560     
561     switch (smtptype) {
562     case "yahoomail":
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;
570                 break;
571             }
572         }
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}';
577         break;
578     case "gmail":
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;
586                 break;
587             }
588         }
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}';
593         break;
594     case "exchange":
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}';
604         break;
605     }
606     notify_setrequired();
607     setDefaultSMTPPort();
608 }
609 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
610
611 function uploadCheck(quotes){
612     //AJAX call for checking the file size and comparing with php.ini settings.
613     var callback = {
614         upload:function(r) {
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']){
619                 case 'other':
620                     alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
621                     document.getElementById('my_file_' + forQuotes).value='';
622                     break;
623                 case 'size':
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'];
627                     break;
628                 case 'file_error':
629                     alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
630                     document.getElementById('my_file_' + forQuotes).value='';
631                     break;
632                 //File good
633                 case 'ok':
634                     document.getElementById(forQuotes + "_logo").value=file_type['path'];
635                     document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
636                     break;
637                 //error in getimagesize because unsupported type
638                 default:
639                    alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
640                    document.getElementById('my_file_' + forQuotes).value='';
641             }
642         },
643         failure:function(r){
644             alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
645         }
646     }
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);
652     if(file_name){
653         if(postData.substring(0,1) == '&'){
654             postData=postData.substring(1);
655         }
656         YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
657     }
658 }
659
660 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
661 UA = YAHOO.env.ua;
662
663 EmailMan = {};
664
665 function testOutboundSettings() {
666         var errorMessage = '';
667         var isError = false;
668         var fromAddress = document.getElementById("outboundtest_from_address").value;
669     var errorMessage = '';
670     var isError = false;
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) == '') {
676         isError = true;
677         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
678     }
679     if(trim(smtpPort) == '') {
680         isError = true;
681         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
682     }
683     if(mailsmtpauthreq.checked) {
684         if(trim(document.getElementById('mail_smtpuser').value) == '') {
685             isError = true;
686             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
687         }
688         if(trim(document.getElementById('mail_smtppass').value) == '') {
689             isError = true;
690             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
691         }                
692     }
693     if(isError) {
694         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
695         return false;    
696     } 
697         
698     testOutboundSettingsDialog();
699         
700 }
701
702 function sendTestEmail()
703 {
704     var fromAddress = document.getElementById("outboundtest_from_address").value;
705     
706     if (trim(fromAddress) == "") 
707     {
708         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
709         return;
710     }
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');
713         return;
714     }
715     
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');
719     
720     var callbackOutboundTest = {
721         success : function(o) {
722                 hideOverlay();
723                 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
724         }
725     };    
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);
733 }
734 function testOutboundSettingsDialog() {
735         // lazy load dialogue
736         if(!EmailMan.testOutboundDialog) {
737                 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
738                 modal:true,
739                                 visible:true,
740                 fixedcenter:true,
741                 constraintoviewport: true,
742                 width   : 600,
743                 shadow  : false
744             });
745             EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
746             YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
747         } // end lazy load
748         
749         EmailMan.testOutboundDialog.render();
750         EmailMan.testOutboundDialog.show();
751 } // fn
752
753 function overlay(reqtitle, body, type) {
754     var config = { };
755     config.type = type;
756     config.title = reqtitle;
757     config.msg = body;
758     YAHOO.SUGAR.MessageBox.show(config);
759 }
760
761 function hideOverlay() {
762         YAHOO.SUGAR.MessageBox.hide();
763 }
764
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";
770         return true;
771 }
772 notify_setrequired();
773
774 function setDefaultSMTPPort() 
775 {
776     useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
777     
778     if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
779         document.getElementById("mail_smtpport").value = '465';
780     }
781     if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
782         document.getElementById("mail_smtpport").value = '25';
783     }
784         
785 }
786 {/literal}
787 {$getNameJs}
788 -->
789 </script>