]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Configurator/tpls/adminwizard.tpl
Release 6.1.4
[Github/sugarcrm.git] / modules / Configurator / tpls / adminwizard.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM 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}  " />&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);" />
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);" />&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);" />
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 nowrap="nowrap" scope="row" valign="top">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NAME_FORMAT'}: </td>
217                     <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}">
219                         <br>
220                         {sugar_translate module='Administration' label='LBL_LOCALE_NAME_FORMAT_DESC'}
221                     </td>
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>
224                 </tr>
225             </table>
226             </div>
227         </td>
228     </tr>
229     </table>
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);" />&nbsp;
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';" />
237     </div>
238 </div>
239
240 <div id="smtp" class="screen">
241     <table width="100%" border="0" cellspacing="0" cellpadding="0">
242     <tr>
243     <td>
244         <div class="edit view">
245         <table width="100%" border="0" cellspacing="0" cellpadding="0">
246             <tr>
247                 <th align="left" scope="row" colspan="4">
248                     <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
249                 </th>
250             </tr>
251             <tr>
252                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
253             </tr>
254              <tr>
255                 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
256             </tr>
257             <tr>
258                 <td colspan="4">
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_GMAIL}&nbsp;&nbsp;&nbsp;&nbsp;
265                                 </button>
266                             </span>
267                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_YAHOO}&nbsp;&nbsp;&nbsp;&nbsp;
272                                 </button>
273                             </span>
274                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_EXCHANGE}&nbsp;&nbsp;&nbsp;&nbsp;
279                                 </button>
280                             </span>
281                         </span>
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                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_TABGROUP_OTHER}&nbsp;&nbsp;&nbsp;&nbsp;
286                                 </button>
287                             </span>
288                         </span>
289                     </div>
290                 </td>
291             </tr>
292             <tr>
293                 <td colspan="4">
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>
301                             </tr>
302                             <tr id="mailsettings2">
303                                 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
304                                 <td width="30%">
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}>
307                                 </td>
308                                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
309                                 <td width="30%">
310                                 <select id="mail_smtpssl" name="mail_smtpssl" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
311                                 </td>
312                             </tr>
313                             <tr id="smtp_auth1">
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">&nbsp;</td>
317                                 <td >&nbsp;</td>
318                             </tr>
319                             <tr id="smtp_auth2">
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">&nbsp;</td>
323                                 <td >&nbsp;</td>
324                             </tr>
325                                             <tr>
326                                                             <td width="20%" scope="row">
327                                                                 <span id="notify_allow_default_outbound_label">
328                                                                 {$MOD.LBL_ALLOW_DEFAULT_SELECTION}&nbsp;
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">
330                                                                         </span>
331                                                                 </td>
332                                                             <td width="30%">
333                                                                  <slot>
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}>
336                                                                          </slot>
337                                                                 </td>                
338                                                 <td scope="row">&nbsp;</td>
339                                                 <td >&nbsp;</td>
340                                             </tr>                            
341                             <tr>
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();" />&nbsp;                                    
346                                     <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" 
347                                         onclick="testOutboundSettingsDialog();">&nbsp;
348                                 </td>
349                                 <td scope="row">&nbsp;</td>
350                                 <td >&nbsp;</td>
351                             </tr>
352                         </table>
353                      </div>
354                 </td>
355             </tr>               
356         </table>
357         </div>
358     </td>
359     </table>
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);" />&nbsp;
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}" />&nbsp;
366     </div>
367 </div>
368                         </div>
369                         <div class="mr"></div>
370 </div>
371 <div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
372 </div>
373
374 <script>
375 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
376 </script>
377 </form>
378
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">
383     </form>
384 </div>
385
386 <div id="testOutboundDialog" class="yui-hidden">
387     <div id="testOutbound">
388         <form>
389                 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
390                         <tr>
391                                 <td scope="row">
392                                         {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR} 
393                                         <span class="required">
394                                         </span>
395                                 </td>
396                                 <td>
397                                         <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
398                                 </td>
399                         </tr>
400                         <tr>
401                                 <td scope="row" colspan="2">
402                                         <input type="button" class="button" value="   {$APP.LBL_EMAIL_SEND}   " onclick="javascript:sendTestEmail();">&nbsp;
403                                         <input type="button" class="button" value="   {$APP.LBL_CANCEL_BUTTON_LABEL}   " onclick="javascript:EmailMan.testOutboundDialog.hide();">&nbsp;
404                                 </td>
405                         </tr>
406                 </table>
407                 </form>
408         </div>
409 </div>
410
411 {literal}
412 <script type='text/javascript'>
413 <!--
414 var SugarWizard = new function()
415 {
416     this.currentScreen = 'welcome';
417     
418     this.handleKeyStroke = function(e)
419     {
420         // get the key pressed
421         var key;
422         if (window.event) {
423             key = window.event.keyCode;
424         }
425         else if(e.which) {
426             key = e.which
427         }
428         
429         switch(key) {
430         case 13:
431             primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
432             primaryButton.click();
433             break;
434         }
435     }
436     
437     this.changeScreen = function(screen,skipCheck)
438     {
439         if ( !skipCheck ) {
440             clear_all_errors();
441             var form = document.getElementById('AdminWizard');
442             var isError = false;
443             
444             switch(this.currentScreen) {
445             case 'smtp':
446                 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
447                 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
448             
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 != '') 
453                    ) {
454                        
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}' );
458                                     isError = true;
459                                 }
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}' );
464                                     isError = true;
465                                 }
466                                 
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}' );
471                                     isError = true;
472                                 }                               
473                 }
474                 break;
475             default:
476                 document.getElementById('upload_panel').style.display="none";
477             }
478             if (isError == true)
479                 return false;
480         }
481         
482         document.getElementById(this.currentScreen).style.display = 'none';
483         document.getElementById(screen).style.display = 'block';
484         
485         this.currentScreen = screen;
486         
487         switch(screen) {
488         case 'system':
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'));
492             break;
493         case 'smtp':
494             if ( !SUGAR.smtpButtonGroup ) {
495                 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
496                 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
497                 {
498                     changeEmailScreenDisplay(e.newValue.get('value'));
499                     document.getElementById('smtp_settings').style.display = '';
500                     document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
501                 });
502                 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
503             }
504             break;
505         default:
506             document.getElementById('upload_panel').style.display="none";
507         }
508     }
509
510 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
511 document.onkeypress = SugarWizard.handleKeyStroke;
512
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)
519         {
520                         server.value = ""; 
521                         user.value = ""; 
522                         pass.value = ""; 
523                         port.value = "";
524                         return true;
525     } else {
526                 if (validate['AdminWizard'])
527                 {
528                         removeFromValidate('AdminWizard', 'mail_smtpserver');
529                         removeFromValidate('AdminWizard', 'mail_smtpuser');
530                         removeFromValidate('AdminWizard', 'mail_smtppass');
531                         removeFromValidate('AdminWizard', 'mail_smtpport');
532                 }
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'));
536             }
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'));
540         }
541                 addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false, 
542               document.getElementById("mail_smtpport_label").innerHTML, 1);
543                 return check_form("AdminWizard");
544         }
545 }
546
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);
552 }
553
554 function changeEmailScreenDisplay(smtptype)
555 {
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}';
565     
566     switch (smtptype) {
567     case "yahoomail":
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;
575                 break;
576             }
577         }
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}';
582         break;
583     case "gmail":
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;
591                 break;
592             }
593         }
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}';
598         break;
599     case "exchange":
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}';
609         break;
610     }
611     notify_setrequired();
612 }
613 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
614
615 function uploadCheck(quotes){
616     //AJAX call for checking the file size and comparing with php.ini settings.
617     var callback = {
618         upload:function(r) {
619             eval("var file_type = " + r.responseText);
620             var forQuotes = file_type['forQuotes'];
621             document.getElementById('loading_img_'+forQuotes).style.display="none";
622             switch(file_type['data']){
623                 case 'other':
624                     alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
625                     document.getElementById('my_file_' + forQuotes).value='';
626                     break;
627                 case 'size':
628                     alert(SUGAR.language.get('Configurator','LBL_ALERT_SIZE_RATIO'));
629                     document.getElementById(forQuotes + "_logo").value=file_type['path'];
630                     document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
631                     break;
632                 case 'file_error':
633                     alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
634                     document.getElementById('my_file_' + forQuotes).value='';
635                     break;
636                 //File good
637                 case 'ok':
638                     document.getElementById(forQuotes + "_logo").value=file_type['path'];
639                     document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
640                     break;
641                 //error in getimagesize because unsupported type
642                 default:
643                    alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
644                    document.getElementById('my_file_' + forQuotes).value='';
645             }
646         },
647         failure:function(r){
648             alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
649         }
650     }
651     document.getElementById("company_logo").value='';
652     document.getElementById('loading_img_company').style.display="inline";
653     var file_name = document.getElementById('my_file_company').value;
654     postData = '&entryPoint=UploadFileCheck&forQuotes=false';
655     YAHOO.util.Connect.setForm(document.getElementById('upload_form'), true,true);
656     if(file_name){
657         if(postData.substring(0,1) == '&'){
658             postData=postData.substring(1);
659         }
660         YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
661     }
662 }
663
664 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
665 UA = YAHOO.env.ua;
666
667 EmailMan = {};
668
669 function testOutboundSettings() {
670         var errorMessage = '';
671         var isError = false;
672         var fromAddress = document.getElementById("outboundtest_from_address").value;
673     var errorMessage = '';
674     var isError = false;
675     var smtpServer = document.getElementById('mail_smtpserver').value;
676     var smtpPort = document.getElementById('mail_smtpport').value;
677     var smtpssl  = document.getElementById('mail_smtpssl').value;
678     var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
679     if(trim(smtpServer) == '') {
680         isError = true;
681         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
682     }
683     if(trim(smtpPort) == '') {
684         isError = true;
685         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
686     }
687     if(mailsmtpauthreq.checked) {
688         if(trim(document.getElementById('mail_smtpuser').value) == '') {
689             isError = true;
690             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
691         }
692         if(trim(document.getElementById('mail_smtppass').value) == '') {
693             isError = true;
694             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
695         }                
696     }
697     if(isError) {
698         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
699         return false;    
700     } 
701         
702     testOutboundSettingsDialog();
703         
704 }
705
706 function sendTestEmail()
707 {
708     var fromAddress = document.getElementById("outboundtest_from_address").value;
709     
710     if (trim(fromAddress) == "") 
711     {
712         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
713         return;
714     }
715     else if (!isValidEmail(fromAddress)) {
716         overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
717         return;
718     }
719     
720     //Hide the email address window and show a message notifying the user that the test email is being sent.
721     EmailMan.testOutboundDialog.hide();
722     overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
723     
724     var callbackOutboundTest = {
725         success : function(o) {
726                 hideOverlay();
727                 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
728         }
729     };    
730     var smtpServer = document.getElementById('mail_smtpserver').value;
731     var smtpPort = document.getElementById('mail_smtpport').value;
732     var smtpssl  = document.getElementById('mail_smtpssl').value;
733     var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
734     var mail_sendtype = 'SMTP'; 
735         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;
736         YAHOO.util.Connect.asyncRequest("POST", "index.php?action=EmailUIAjax&module=Emails&emailUIAction=testOutbound&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
737 }
738 function testOutboundSettingsDialog() {
739         // lazy load dialogue
740         if(!EmailMan.testOutboundDialog) {
741                 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
742                 modal:true,
743                                 visible:true,
744                 fixedcenter:true,
745                 constraintoviewport: true,
746                 width   : 600,
747                 shadow  : false
748             });
749             EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
750             YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
751         } // end lazy load
752         
753         EmailMan.testOutboundDialog.render();
754         EmailMan.testOutboundDialog.show();
755 } // fn
756
757 function overlay(reqtitle, body, type) {
758     var config = { };
759     config.type = type;
760     config.title = reqtitle;
761     config.msg = body;
762     YAHOO.SUGAR.MessageBox.show(config);
763 }
764
765 function hideOverlay() {
766         YAHOO.SUGAR.MessageBox.hide();
767 }
768
769 function notify_setrequired() {
770         document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
771         document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
772         document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
773         document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
774         return true;
775 }
776 notify_setrequired();
777 {/literal}
778 {$getNameJs}
779 -->
780 </script>