]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Configurator/tpls/adminwizard.tpl
Release 6.4.0beta1
[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 {$langHeader}>
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='cache/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='cache/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 wizard">
72
73 <div class="bd">
74
75 <div id="welcome" class="screen">
76     <table width="100%" border="0" cellspacing="0" cellpadding="0">
77     <tr>
78         <td>
79             <div class="edit view">
80             <table width="100%" border="0" cellspacing="0" cellpadding="0">
81             <tr>
82                 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_WELCOME_TITLE}</h2></th>
83             </tr>
84             <tr>
85                 <td scope="row">
86               <p>{$MOD.LBL_WIZARD_WELCOME}</p>
87                                 <div class="userWizWelcome"><img src='include/images/sugar_wizard_welcome.jpg' alt='{$MOD.LBL_WELCOME}' border='0' width='765px' height='325px'></div>
88                 </td>
89             </tr>
90             </table>
91             </div>
92         </td>
93     </tr>
94     </table>
95     <div class="nav-buttons">
96         <input title="{$MOD.LBL_WIZARD_SKIP_BUTTON}"  
97             onclick="document.location.href='{$SKIP_URL}';" class="button"  
98             type="button" name="cancel" value="  {$MOD.LBL_WIZARD_SKIP_BUTTON}  " id="skip_tab" />&nbsp;
99         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
100             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
101             onclick="SugarWizard.changeScreen('system',false);" id="next_tab_system" />
102     </div>
103 </div>
104
105 <div id="system" class="screen">
106     <table width="100%" border="0" cellspacing="0" cellpadding="0">
107     <tr>
108         <td>
109             <div class="edit view">
110             <table width="100%" border="0" cellspacing="0" cellpadding="0">
111             <tr>
112                 <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_SYSTEM_TITLE}</h2></th>
113             </tr>
114             <tr>
115                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SYSTEM_DESC}</i></td>
116             </tr>
117             <tr>
118                 <td scope="row" width='15%' nowrap>{$MOD.SYSTEM_NAME_WIZARD}&nbsp;{sugar_help text=$MOD.SYSTEM_NAME_HELP}</td>
119                 <td width='35%'>
120                     <input type='text' name='system_name' value='{$settings.system_name}' />
121                 </td>
122             </tr>
123             <tr>
124                 <td scope="row" width='12%' nowrap>{$MOD.NEW_LOGO}&nbsp;{sugar_help text=$MOD.NEW_LOGO_HELP}
125                 </td>
126                 <td  width='35%'>
127                     <div id="container_upload"></div>
128                     <input type='text' id='company_logo' name='company_logo' style="display:none" />
129                 </td>
130             </tr>
131             <tr>
132                 <td scope="row" width='12%' nowrap>{$MOD.CURRENT_LOGO}&nbsp;{sugar_help text=$MOD.CURRENT_LOGO_HELP}</td>
133                 <td width='35%' >
134                     <img id="company_logo_image" alt='{$MOD.LBL_LOGO}' src='{$company_logo}' height="40" width="212" />
135                 </td>
136             </tr>
137             </table>
138             </div>
139         </td>
140     </tr>
141     </table>
142     <div class="nav-buttons">
143             <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
144                 class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
145                 onclick="SugarWizard.changeScreen('welcome',true);" id="previous_tab_welcome" />&nbsp;
146             <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
147                 class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
148                 onclick="SugarWizard.changeScreen('locale',false);" id="next_tab_locale" />
149     </div>
150 </div>
151
152 <div id="locale" class="screen">
153     <table width="100%" border="0" cellspacing="0" cellpadding="0">
154     <tr>
155         <td>
156             <div class="edit view">
157             <table width="100%" border="0" cellspacing="0" cellpadding="0">
158                 <tr>
159                     <th align="left" scope="row" colspan="4"><h2>{sugar_translate module='Administration' label='LBL_LOCALE_TITLE'}</h2></th>
160                 </tr>
161                 <tr>
162                     <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_LOCALE_DESC}</i></td>
163                 </tr>
164                 <tr>
165                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DATE_FORMAT'}: </td>
166                     <td>
167                         {html_options name='default_date_format' selected=$config.default_date_format options=$config.date_formats}
168                     </td>
169                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_TIME_FORMAT'}: </td>
170                     <td>
171                         {html_options name='default_time_format' selected=$config.default_time_format options=$config.time_formats}
172                     </td>
173                 </tr>
174                 <tr>
175                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_LANGUAGE'}: </td>
176                     <td>
177                         {html_options name='default_language' selected=$config.default_language options=$LANGUAGES}
178                     </td>
179                 </tr>
180                 <tr>
181                     <td colspan="4"><hr /></td>
182                 </tr>
183                 <tr>
184                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_NAME'}: </td>
185                     <td>
186                         <input type='text' size='15' name='default_currency_name' value='{$config.default_currency_name}' >
187                     </td>
188                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_SYMBOL'}: </td>
189                     <td>
190                         <input type='text' size='4' name='default_currency_symbol'  value='{$config.default_currency_symbol}' >
191                     </td>
192                 </tr>
193                 <tr>
194                     <td nowrap="nowrap" scope="row" width="200">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_CURRENCY_ISO4217'}: </td>
195                     <td>
196                         <input type='text' size='4' name='default_currency_iso4217' value='{$config.default_currency_iso4217}'>
197                     </td>
198                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NUMBER_GROUPING_SEP'}: </td>
199                     <td>
200                         <input type='text' size='3' maxlength='1' name='default_number_grouping_seperator' value='{$config.default_number_grouping_seperator}'>
201                     </td>
202                 </tr>
203                 <tr>
204                     <td nowrap="nowrap" scope="row">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_DECIMAL_SEP'}: </td>
205                     <td>
206                         <input type='text' size='3' maxlength='1' name='default_decimal_seperator'  value='{$config.default_decimal_seperator}'>
207                     </td>
208                     <td nowrap="nowrap" scope="row"></td>
209                     <td></td>
210                 </tr>
211                 <tr>
212                     <td colspan="4"><hr /></td>
213                 </tr>
214                 <tr>
215                     <td nowrap="nowrap" scope="row" valign="top">{sugar_translate module='Administration' label='LBL_LOCALE_DEFAULT_NAME_FORMAT'}: </td>
216                     <td>
217                         <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}">
218                         <br>
219                         {sugar_translate module='Administration' label='LBL_LOCALE_NAME_FORMAT_DESC'}
220                     </td>
221                     <td nowrap="nowrap" scope="row" valign="top">{sugar_translate module='Administration' label='LBL_LOCALE_EXAMPLE_NAME_FORMAT'}: </td>
222                     <td valign="top"><input name="no_value" id="nameTarget" style="border: none;" value="" disabled></td>
223                 </tr>
224             </table>
225             </div>
226         </td>
227     </tr>
228     </table>
229     <div class="nav-buttons">
230         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
231             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
232             onclick="SugarWizard.changeScreen('system',true);" id="previous_tab_system" />&nbsp;
233         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
234             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
235             onclick="SugarWizard.changeScreen('smtp',false); changeEmailScreenDisplay('{$mail_smtptype}'); document.getElementById('AdminWizard').mail_smtptype.value = 'gmail';" id="next_tab_smtp" />
236     </div>
237 </div>
238
239 <div id="smtp" class="screen">
240     <table width="100%" border="0" cellspacing="0" cellpadding="0">
241     <tr>
242     <td>
243         <div class="edit view">
244         <table width="100%" border="0" cellspacing="0" cellpadding="0">
245             <tr>
246                 <th align="left" scope="row" colspan="4">
247                     <h2>{$MOD.LBL_MAIL_SMTP_SETTINGS}</h2>
248                 </th>
249             </tr>
250             <tr>
251                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
252             </tr>
253              <tr>
254                 <td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
255             </tr>
256             <tr>
257                 <td colspan="4">
258                     <input type="hidden" name="mail_sendtype" value="SMTP" />
259                     <div id="smtpButtonGroup" class="yui-buttongroup">
260                         <span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
261                             <span class="first-child">
262                                 <button type="button" name="mail_smtptype" value="gmail">
263                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_GMAIL}&nbsp;&nbsp;&nbsp;&nbsp;
264                                 </button>
265                             </span>
266                         </span>
267                         <span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
268                             <span class="first-child">
269                                 <button type="button" name="mail_smtptype" value="yahoomail">
270                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_YAHOO}&nbsp;&nbsp;&nbsp;&nbsp;
271                                 </button>
272                             </span>
273                         </span>
274                         <span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
275                             <span class="first-child">
276                                 <button type="button" name="mail_smtptype" value="exchange">
277                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_EXCHANGE}&nbsp;&nbsp;&nbsp;&nbsp;
278                                 </button>
279                             </span>
280                         </span>
281                         <span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
282                             <span class="first-child">
283                                 <button type="button" name="mail_smtptype" value="other">
284                                     &nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_TABGROUP_OTHER}&nbsp;&nbsp;&nbsp;&nbsp;
285                                 </button>
286                             </span>
287                         </span>
288                     </div>
289                 </td>
290             </tr>
291             <tr>
292                 <td colspan="4">
293                     <div id="smtp_settings">
294                         <table width="100%" cellpadding="0" cellspacing="0">
295                             <tr id="mailsettings1">
296                                 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required" id="required_mail_smtpserver"></span></td>
297                                 <td width="30%" ><slot><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></slot></td>
298                                 <td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span></td>
299                                 <td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
300                             </tr>
301                             <tr id="mailsettings2">
302                                 <td width="20%" scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
303                                 <td width="30%">
304                                     <input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
305                                         onclick="notify_setrequired();" {$mail_smtpauth_req}>
306                                 </td>
307                                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
308                                 <td width="30%">
309                                 <select id="mail_smtpssl" name="mail_smtpssl" onchange="setDefaultSMTPPort()" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
310                                 </td>
311                             </tr>
312                             <tr id="smtp_auth1">
313                                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required"></span></td>
314                                 <td width="30%" ><slot><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></slot></td>
315                                 <td scope="row">&nbsp;</td>
316                                 <td >&nbsp;</td>
317                             </tr>
318                             <tr id="smtp_auth2">
319                                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required"></span></td>
320                                 <td width="30%" ><slot><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></slot></td>
321                                 <td scope="row">&nbsp;</td>
322                                 <td >&nbsp;</td>
323                             </tr>
324                             <tr>
325                                 <td width="20%" scope="row">
326                                     <span id="notify_allow_default_outbound_label">
327                                     {$MOD.LBL_ALLOW_DEFAULT_SELECTION}&nbsp;
328                                     <img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_ALLOW_DEFAULT_SELECTION_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass', WIDTH, -1, NOFOLLOW, 'ol_nofollow')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
329                                     </span>
330                                 </td>
331                                 <td width="30%">
332                                      <slot>
333                                      <input type='hidden' name='notify_allow_default_outbound' value='0'>
334                                      <input id='notify_allow_default_outbound' name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
335                                      </slot>
336                                 </td>                
337                                 <td scope="row">&nbsp;</td>
338                                 <td >&nbsp;</td>
339                             </tr>                            
340                             <tr>
341                                 <td width="50%" cellspan="2" scope="row" nowrap>
342                                     <input title="{$APP.LBL_CLEAR_BUTTON_TITLE}"
343                                         class="button" type="button" name="btn_clear" accesskey="{$APP.LBL_CLEAR_BUTTON_KEY}" value="{$APP.LBL_CLEAR_BUTTON_LABEL}"
344                                         onclick="clearEmailFields();" />&nbsp;                                    
345                                     <input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" 
346                                         onclick="testOutboundSettingsDialog();">&nbsp;
347                                 </td>
348                                 <td scope="row">&nbsp;</td>
349                                 <td >&nbsp;</td>
350                             </tr>
351                         </table>
352                      </div>
353                 </td>
354             </tr>       
355         </table>
356         </div>
357     </td>
358     </table>
359     <div class="nav-buttons">
360         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
361             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
362             onclick="SugarWizard.changeScreen('locale',true);" id="previous_tab_locale" />&nbsp;
363         <input title="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" class="button primary"
364             onclick="if(adjustEmailSettings())this.form.submit();" type="button" name="continue" value="{$MOD.LBL_WIZARD_CONTINUE_BUTTON}" id="next_tab_continue" />&nbsp;
365     </div>
366 </div>
367
368 </div>
369
370 </div>
371
372 <script>
373 addToValidate('ConfigureSettings', 'system_name', 'varchar', true,'System Name' );
374 </script>
375 </form>
376
377 <div id='upload_panel' style="display:none">
378     <form id="upload_form" name="upload_form" method="POST" action='index.php' enctype="multipart/form-data">
379         <input type="file" id="my_file_company" name="file_1" size="20" onchange="uploadCheck(false)"/>
380         {sugar_getimage name="sqsWait" ext=".gif" alt=$mod_strings.LBL_LOADING other_attributes='id="loading_img_company" style="display:none" '}
381     </form>
382 </div>
383
384 <div id="testOutboundDialog" class="yui-hidden">
385     <div id="testOutbound">
386         <form>
387         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
388             <tr>
389                 <td scope="row">
390                     {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR} 
391                     <span class="required">
392                     </span>
393                 </td>
394                 <td>
395                     <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
396                 </td>
397             </tr>
398             <tr>
399                 <td scope="row" colspan="2">
400                     <input type="button" class="button" value="   {$APP.LBL_EMAIL_SEND}   " onclick="javascript:sendTestEmail();">&nbsp;
401                     <input type="button" class="button" value="   {$APP.LBL_CANCEL_BUTTON_LABEL}   " onclick="javascript:EmailMan.testOutboundDialog.hide();">&nbsp;
402                 </td>
403             </tr>
404         </table>
405         </form>
406     </div>
407 </div>
408
409 {literal}
410 <script type='text/javascript'>
411 <!--
412 var SugarWizard = new function()
413 {
414     this.currentScreen = 'welcome';
415     
416     this.handleKeyStroke = function(e)
417     {
418         // get the key pressed
419         var key;
420         if (window.event) {
421             key = window.event.keyCode;
422         }
423         else if(e.which) {
424             key = e.which
425         }
426         
427         switch(key) {
428         case 13:
429             primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
430             primaryButton.click();
431             break;
432         }
433     }
434     
435     this.changeScreen = function(screen,skipCheck)
436     {
437         if ( !skipCheck ) {
438             clear_all_errors();
439             var form = document.getElementById('AdminWizard');
440             var isError = false;
441             
442             switch(this.currentScreen) {
443             case 'smtp':
444                 smtp_type = document.getElementById('AdminWizard').mail_smtptype.value;
445                 smtp_server_required = smtp_type == 'exchange' || smtp_type == 'other' ? true : false;
446             
447                 if(document.getElementById('mail_smtpuser').value != '' ||
448                    document.getElementById('mail_smtppass').value != '' ||
449                    document.getElementById('notify_allow_default_outbound').checked ||
450                    (smtp_server_required &&  document.getElementById('mail_smtpserver').value != '') 
451                    ) {
452                        
453                         if ( document.getElementById('mail_smtpserver').value == '' ) {
454                             add_error_style('AdminWizard',form.mail_smtpserver.name,
455                                 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPSERVER}{literal}' );
456                             isError = true;
457                         }
458                         if ( document.getElementById('mail_smtpauth_req').checked 
459                                 && document.getElementById('mail_smtpuser').value == '' ) {
460                             add_error_style('AdminWizard',form.mail_smtpuser.name,
461                                 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPUSER}{literal}' );
462                             isError = true;
463                         }
464                         
465                         if ( document.getElementById('mail_smtpauth_req').checked 
466                                 && document.getElementById('mail_smtppass').value == '' ) {
467                             add_error_style('AdminWizard',form.mail_smtppass.name,
468                                 '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_MAIL_SMTPPASS}{literal}' );
469                             isError = true;
470                         }                       
471                 }
472                 break;
473             default:
474                 document.getElementById('upload_panel').style.display="none";
475             }
476             if (isError == true)
477                 return false;
478         }
479         
480         document.getElementById(this.currentScreen).style.display = 'none';
481         document.getElementById(screen).style.display = 'block';
482         
483         this.currentScreen = screen;
484         
485         switch(screen) {
486         case 'system':
487             document.getElementById('upload_panel').style.display="inline";
488             document.getElementById('upload_panel').style.position="absolute";
489             YAHOO.util.Dom.setXY('upload_panel', YAHOO.util.Dom.getXY('container_upload'));
490             break;
491         case 'smtp':
492             if ( !SUGAR.smtpButtonGroup ) {
493                 SUGAR.smtpButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
494                 SUGAR.smtpButtonGroup.subscribe('checkedButtonChange', function(e)
495                 {
496                     changeEmailScreenDisplay(e.newValue.get('value'));
497                     document.getElementById('smtp_settings').style.display = '';
498                     document.getElementById('AdminWizard').mail_smtptype.value = e.newValue.get('value');
499                 });
500                 YAHOO.widget.Button.addHiddenFieldsToForm(document.getElementById('AdminWizard'));
501             }
502             break;
503         default:
504             document.getElementById('upload_panel').style.display="none";
505         }
506     }
507
508 SugarWizard.changeScreen('{/literal}{$START_PAGE}{literal}');
509 document.onkeypress = SugarWizard.handleKeyStroke;
510
511 function adjustEmailSettings(){
512     var server = document.getElementById('mail_smtpserver'),
513         user = document.getElementById('mail_smtpuser'),
514         pass = document.getElementById('mail_smtppass'),
515         port = document.getElementById('mail_smtpport');
516     if( !server.value || !user.value || !pass.value || !port.value)
517     {
518             server.value = ""; 
519             user.value = ""; 
520             pass.value = ""; 
521             port.value = "";
522             return true;
523     } else {
524         if (validate['AdminWizard'])
525         {
526             removeFromValidate('AdminWizard', 'mail_smtpserver');
527             removeFromValidate('AdminWizard', 'mail_smtpuser');
528             removeFromValidate('AdminWizard', 'mail_smtppass');
529             removeFromValidate('AdminWizard', 'mail_smtpport');
530         }
531         if (server.value == "smtp.gmail.com" && !isValidEmail(user.value)) {
532             addToValidate("AdminWizard", 'mail_smtpuser', 'email', false, 
533               SUGAR.language.get('Configurator','LBL_GMAIL_SMTPUSER'));
534         }
535         else if (server.value == "plus.smtp.mail.yahoo.com" && !isValidEmail(user.value)) {
536             addToValidate("AdminWizard", 'mail_smtpuser', 'email', false, 
537               SUGAR.language.get('Configurator','LBL_YAHOOMAIL_SMTPUSER'));
538         }
539         addToValidateMoreThan("AdminWizard", 'mail_smtpport', 'int', false, 
540               document.getElementById("mail_smtpport_label").innerHTML, 1);
541         return check_form("AdminWizard");
542     }
543 }
544
545 function clearEmailFields() { 
546     document.getElementById('AdminWizard').mail_smtpuser.value = '';
547     document.getElementById('AdminWizard').mail_smtppass.value = '';
548     document.getElementById('notify_allow_default_outbound').checked = false;
549     changeEmailScreenDisplay(document.getElementById('AdminWizard').mail_smtptype.value);
550 }
551
552 function changeEmailScreenDisplay(smtptype)
553 {
554     document.getElementById("mail_smtpserver").value = '';
555     document.getElementById("mail_smtpport").value = '25';
556     document.getElementById("mail_smtpauth_req").checked = true;
557     document.getElementById("mailsettings1").style.display = '';
558     document.getElementById("mailsettings2").style.display = '';
559     document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
560     document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
561     document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
562     document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
563     
564     switch (smtptype) {
565     case "yahoomail":
566         document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
567         document.getElementById("mail_smtpport").value = '465';
568         document.getElementById("mail_smtpauth_req").checked = true;
569         var ssl = document.getElementById("mail_smtpssl");
570         for(var j=0;j<ssl.options.length;j++) {
571             if(ssl.options[j].text == 'SSL') {
572                 ssl.options[j].selected = true;
573                 break;
574             }
575         }
576         document.getElementById("mailsettings1").style.display = 'none';
577         document.getElementById("mailsettings2").style.display = 'none';
578         document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
579         document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
580         break;
581     case "gmail":
582         document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
583         document.getElementById("mail_smtpport").value = '587';
584         document.getElementById("mail_smtpauth_req").checked = true;
585         var ssl = document.getElementById("mail_smtpssl");
586         for(var j=0;j<ssl.options.length;j++) {
587             if(ssl.options[j].text == 'TLS') {
588                 ssl.options[j].selected = true;
589                 break;
590             }
591         }
592         document.getElementById("mailsettings1").style.display = 'none';
593         document.getElementById("mailsettings2").style.display = 'none';
594         document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
595         document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
596         break;
597     case "exchange":
598         document.getElementById("mail_smtpserver").value = '';
599         document.getElementById("mail_smtpport").value = '25';
600         document.getElementById("mail_smtpauth_req").checked = true;
601         document.getElementById("mailsettings1").style.display = '';
602         document.getElementById("mailsettings2").style.display = '';
603         document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
604         document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
605         document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
606         document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
607         break;
608     }
609     notify_setrequired();
610     setDefaultSMTPPort();
611 }
612 //changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}");
613
614 function uploadCheck(quotes){
615     //AJAX call for checking the file size and comparing with php.ini settings.
616     var callback = {
617         upload:function(r) {
618             eval("var file_type = " + r.responseText);
619             var forQuotes = file_type['forQuotes'];
620             document.getElementById('loading_img_'+forQuotes).style.display="none";
621             switch(file_type['data']){
622                 case 'other':
623                     alert(SUGAR.language.get('Configurator','LBL_ALERT_JPG_IMAGE'));
624                     document.getElementById('my_file_' + forQuotes).value='';
625                     break;
626                 case 'size':
627                     alert(SUGAR.language.get('Configurator','LBL_ALERT_SIZE_RATIO'));
628                     document.getElementById(forQuotes + "_logo").value=file_type['path'];
629                     document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
630                     break;
631                 case 'file_error':
632                     alert(SUGAR.language.get('Configurator','ERR_ALERT_FILE_UPLOAD'));
633                     document.getElementById('my_file_' + forQuotes).value='';
634                     break;
635                 //File good
636                 case 'ok':
637                     document.getElementById(forQuotes + "_logo").value=file_type['path'];
638                     document.getElementById(forQuotes + "_logo_image").src=file_type['path'];
639                     break;
640                 //error in getimagesize because unsupported type
641                 default:
642                    alert(SUGAR.language.get('Configurator','LBL_ALERT_TYPE_IMAGE'));
643                    document.getElementById('my_file_' + forQuotes).value='';
644             }
645         },
646         failure:function(r){
647             alert(SUGAR.language.get('app_strings','LBL_AJAX_FAILURE'));
648         }
649     }
650     document.getElementById("company_logo").value='';
651     document.getElementById('loading_img_company').style.display="inline";
652     var file_name = document.getElementById('my_file_company').value;
653     postData = '&entryPoint=UploadFileCheck&forQuotes=false';
654     YAHOO.util.Connect.setForm(document.getElementById('upload_form'), true,true);
655     if(file_name){
656         if(postData.substring(0,1) == '&'){
657             postData=postData.substring(1);
658         }
659         YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, postData);
660     }
661 }
662
663 var urlStandard = 'sugar_body_only=true&to_pdf=true&module=Emails&action=EmailUIAjax';
664 UA = YAHOO.env.ua;
665
666 EmailMan = {};
667
668 function testOutboundSettings() {
669     var errorMessage = '';
670     var isError = false;
671     var fromAddress = document.getElementById("outboundtest_from_address").value;
672     var errorMessage = '';
673     var isError = false;
674     var smtpServer = document.getElementById('mail_smtpserver').value;
675     var smtpPort = document.getElementById('mail_smtpport').value;
676     var smtpssl  = document.getElementById('mail_smtpssl').value;
677     var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
678     if(trim(smtpServer) == '') {
679         isError = true;
680         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
681     }
682     if(trim(smtpPort) == '') {
683         isError = true;
684         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
685     }
686     if(mailsmtpauthreq.checked) {
687         if(trim(document.getElementById('mail_smtpuser').value) == '') {
688             isError = true;
689             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
690         }
691         if(trim(document.getElementById('mail_smtppass').value) == '') {
692             isError = true;
693             errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
694         }                
695     }
696     if(isError) {
697         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
698         return false;    
699     } 
700     
701     testOutboundSettingsDialog();
702         
703 }
704
705 function sendTestEmail()
706 {
707     var fromAddress = document.getElementById("outboundtest_from_address").value;
708     
709     if (trim(fromAddress) == "") 
710     {
711         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
712         return;
713     }
714     else if (!isValidEmail(fromAddress)) {
715         overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
716         return;
717     }
718     
719     //Hide the email address window and show a message notifying the user that the test email is being sent.
720     EmailMan.testOutboundDialog.hide();
721     overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
722     
723     var callbackOutboundTest = {
724         success : function(o) {
725             hideOverlay();
726             overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
727         }
728     };    
729     var smtpServer = document.getElementById('mail_smtpserver').value;
730     var smtpPort = document.getElementById('mail_smtpport').value;
731     var smtpssl  = document.getElementById('mail_smtpssl').value;
732     var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
733     var mail_sendtype = 'SMTP'; 
734     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;
735     YAHOO.util.Connect.asyncRequest("POST", "index.php?action=EmailUIAjax&module=Emails&emailUIAction=testOutbound&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
736 }
737 function testOutboundSettingsDialog() {
738         // lazy load dialogue
739         if(!EmailMan.testOutboundDialog) {
740             EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
741                 modal:true,
742                 visible:true,
743                 fixedcenter:true,
744                 constraintoviewport: true,
745                 width   : 600,
746                 shadow  : false
747             });
748             EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
749             YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
750         } // end lazy load
751         
752         EmailMan.testOutboundDialog.render();
753         EmailMan.testOutboundDialog.show();
754 } // fn
755
756 function overlay(reqtitle, body, type) {
757     var config = { };
758     config.type = type;
759     config.title = reqtitle;
760     config.msg = body;
761     YAHOO.SUGAR.MessageBox.show(config);
762 }
763
764 function hideOverlay() {
765     YAHOO.SUGAR.MessageBox.hide();
766 }
767
768 function notify_setrequired() {
769     document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
770     document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
771     document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
772     document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
773     return true;
774 }
775 notify_setrequired();
776
777 function setDefaultSMTPPort() 
778 {
779     useSSLPort = !document.getElementById("mail_smtpssl").options[0].selected;
780     
781     if ( useSSLPort && document.getElementById("mail_smtpport").value == '25' ) {
782         document.getElementById("mail_smtpport").value = '465';
783     }
784     if ( !useSSLPort && document.getElementById("mail_smtpport").value == '465' ) {
785         document.getElementById("mail_smtpport").value = '25';
786     }
787         
788 }
789 {/literal}
790 {$getNameJs}
791 -->
792 </script>