]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Users/tpls/wizard.tpl
Release 6.1.4
[Github/sugarcrm.git] / modules / Users / tpls / wizard.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 {literal}
45 <script type='text/javascript'>
46 function disableReturnSubmission(e) {
47    var key = window.event ? window.event.keyCode : e.which;
48    return (key != 13);
49 }
50 </script>
51 {/literal}
52 {$SUGAR_JS}
53 {$SUGAR_CSS}
54 {$CSS}
55 </head>
56 <body class="yui-skin-sam">
57 <div id="main">
58     <div id="content">
59         <table style="width:auto;height:600px;" align="center"><tr><td align="center">
60
61 <form id="UserWizard" name="UserWizard" enctype='multipart/form-data' method="POST" action="index.php" onkeypress="return disableReturnSubmission(event);">
62 <input type='hidden' name='action' value='SaveUserWizard'/>
63 <input type='hidden' name='module' value='Users'/>
64 <span class='error'>{$error.main}</span>
65 {overlib_includes}
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                 
88                 {if !$HIDE_IF_CAN_USE_DEFAULT_OUTBOUND}
89                <p> {$MOD.LBL_WIZARD_WELCOME}</p>
90                 {else}
91                <p> {$MOD.LBL_WIZARD_WELCOME_NOSMTP}</p>
92                 {/if}
93               
94                                 <div class="userWizWelcome"><img src='include/images/sugar_wizard_welcome.jpg' border='0' width='765px' height='325px'></div>
95                 </td>
96             </tr>
97             </table>
98             </div>
99         </td>
100     </tr>
101     </table>
102     <div class="nav-buttons">
103         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
104             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
105             onclick="SugarWizard.changeScreen('personalinfo',false);" />
106     </div>
107 </div>
108
109 <div id="personalinfo" class="screen">
110     <table width="100%" border="0" cellspacing="0" cellpadding="0">
111         <tr>
112             <td>
113                 <div class="edit view">
114                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
115                     <tr>
116                         <th align="left" scope="row" colspan="4"><h2><slot>{$MOD.LBL_WIZARD_PERSONALINFO}</slot></h2></th>
117                     </tr>
118                     <tr>
119                         <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_PERSONALINFO_DESC}</i></td>
120                     </tr>
121                     <tr>
122                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_FIRST_NAME}:</slot></td>
123                         <td width="33%"><slot><input id='first_name' name='first_name' tabindex='1' size='25' maxlength='25' type="text" value="{$FIRST_NAME}"></slot></td>
124                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_LAST_NAME}: <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
125                         <td width="33%"><slot><input id='last_name' name='last_name' tabindex='2' size='25' maxlength='25' type="text" value="{$LAST_NAME}"></slot></td>
126                     </tr>
127                     <tr>
128                         <td scope="row" width="17%">
129                         {$MOD.LBL_EMAIL}: {if $REQUIRED_EMAIL_ADDRESS}<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>{/if}
130                         </td>
131                         <td width="33%"><slot><input name='email1' tabindex='11' size='30' maxlength='100' value='{$EMAIL1}' id='email1' /></slot></td>
132                         <td scope="row" nowrap="nowrap"><slot>&nbsp;</slot></td>
133                         <td><slot>&nbsp;</slot></td>
134                     </tr>
135                     <tr>
136                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_OFFICE_PHONE}:</slot></td>
137                         <td width="33%" ><slot><input name='phone_work' type="text" tabindex='6' size='20' maxlength='25' value='{$PHONE_WORK}'></slot></td>
138                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_MESSENGER_TYPE}:</slot></td>
139                         <td  ><slot>{$MESSENGER_TYPE_OPTIONS}</slot></td>
140                     </tr>
141                     <tr>
142                         <td scope="row"><slot>{$MOD.LBL_MOBILE_PHONE}:</slot></td>
143                         <td  ><slot><input name='phone_mobile' type="text" tabindex='6' size='20' maxlength='25' value='{$PHONE_MOBILE}'></slot></td>
144                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_MESSENGER_ID}:</slot></td>
145                         <td  ><slot><input name='messenger_id' type="text" tabindex='6' size='30' maxlength='100' value='{$MESSENGER_ID}'></slot></td>
146                     </tr>
147                     <tr>
148                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_PRIMARY_ADDRESS}:</slot></td>
149                         <td width="33%" ><slot><textarea name='address_street' rows="2" tabindex='8' cols="30">{$ADDRESS_STREET}</textarea></slot></td>
150                         <td scope="row" nowrap="nowrap"><slot>&nbsp;</slot></td>
151                         <td><slot>&nbsp;</slot></td>
152                     </tr>
153                     <tr>
154                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_CITY}:</slot></td>
155                         <td width="33%" ><slot><input name='address_city' tabindex='8' size='15' maxlength='100' value='{$ADDRESS_CITY}'></slot></td>
156                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_STATE}:</slot></td>
157                         <td><slot><input name='address_state' tabindex='9' size='15' maxlength='100' value='{$ADDRESS_STATE}'></slot></td>
158                     </tr>
159                     <tr>
160                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_POSTAL_CODE}:</slot></td>
161                         <td><slot><input name='address_postalcode' tabindex='9' size='10' maxlength='20' value='{$ADDRESS_POSTALCODE}'></slot></td>
162                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_COUNTRY}:</slot></td>
163                         <td><slot><input name='address_country' tabindex='10' size='10' maxlength='20' value='{$ADDRESS_COUNTRY}'></slot></td>
164                     </tr>                    
165                 </table>
166                 </div>
167             </td>
168         </tr>
169     </table>
170     <div class="nav-buttons">
171         {if $SKIP_WELCOME}
172         <input title="{$MOD.LBL_BACK}"  
173             onclick="document.location.href='index.php?module=Configurator&action=AdminWizard&page=smtp';" class="button"  
174             type="button" name="cancel" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  " />&nbsp;
175         {else}
176         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
177             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
178             onclick="SugarWizard.changeScreen('welcome',true);" />&nbsp;
179         {/if}
180         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
181             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
182             onclick="SugarWizard.changeScreen('locale',false);" />
183     </div>
184 </div>
185
186 <div id="locale" class="screen">
187     <table width="100%" border="0" cellspacing="0" cellpadding="0">
188         <tr>
189             <td>
190                 <div class="edit view">
191                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
192                     <tr>
193                         <th width="100%" align="left" scope="row" colspan="4">
194                             <h2><slot>{$MOD.LBL_WIZARD_LOCALE}</slot></h2></th>
195                     </tr>
196                     <tr>
197                         <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_LOCALE_DESC}</i></td>
198                     </tr>
199                     <tr>
200                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_TIMEZONE}:</slot>&nbsp;{sugar_help text=$MOD.LBL_TIMEZONE_TEXT }</td>
201                         <td colspan="3"><slot><select tabindex='14' name='timezone'>{$TIMEZONEOPTIONS}</select></slot></td>
202                     </tr>
203                     <tr>
204                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_DATE_FORMAT}:</slot>&nbsp;{sugar_help text=$MOD.LBL_DATE_FORMAT_TEXT }</td>
205                         <td width="33%"><slot><select tabindex='14' name='dateformat'>{$DATEOPTIONS}</select></slot></td>
206                         <td scope="row" nowrap="nowrap"><slot>{$MOD.LBL_TIME_FORMAT}:</slot>&nbsp;{sugar_help text=$MOD.LBL_TIME_FORMAT_TEXT }</td>
207                         <td ><slot><select tabindex='14' name='timeformat'>{$TIMEOPTIONS}</select></slot></td>
208                         
209                     </tr>
210                     <tr>
211                         <td colspan="4"><hr /></td>
212                     </tr>
213                     <tr>
214                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_CURRENCY}:</slot>&nbsp;{sugar_help text=$MOD.LBL_CURRENCY_TEXT }</td>
215                             <td ><slot>
216                                 <select tabindex='14' id='currency_select' name='currency' onchange='setSymbolValue(this.selectedIndex);setSigDigits();'>{$CURRENCY}</select>
217                                 <input type="hidden" id="symbol" value="">
218                             </slot></td>
219                         <td width="17%" scope="row" nowrap="nowrap"></td>
220                         <td></td>
221                     </tr>
222                     <tr>
223                         <td width="17%" scope="row" nowrap="nowrap"><slot>
224                             {$MOD.LBL_CURRENCY_SIG_DIGITS}:
225                         </slot></td>
226                         <td ><slot>
227                             <select id='sigDigits' onchange='setSigDigits(this.value);' name='default_currency_significant_digits'>{$sigDigits}</select>
228                         </slot></td>
229                         <td width="17%" scope="row" nowrap="nowrap"><slot>
230                             <i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}:</i>
231                         </slot></td>
232                         <td ><slot>
233                             <input type="text" disabled id="sigDigitsExample" name="sigDigitsExample">
234                         </slot></td>
235                     </tr>
236                     <tr>
237                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_DECIMAL_SEP}:</slot>&nbsp;{sugar_help text=$MOD.LBL_DECIMAL_SEP_TEXT }</td>
238                         <td ><slot>
239                             <input tabindex='14' name='dec_sep' id='default_decimal_seperator' 
240                                 type='text' maxlength='1' size='1' value='{$DEC_SEP}'
241                                 onkeydown='setSigDigits();' onkeyup='setSigDigits();'>
242                         </slot></td>
243                         <td width="17%" scope="row" nowrap="nowrap"><slot>{$MOD.LBL_NUMBER_GROUPING_SEP}:</slot>&nbsp;{sugar_help text=$MOD.LBL_NUMBER_GROUPING_SEP_TEXT }</td>
244                         <td><input tabindex='14' name='num_grp_sep' id='default_number_grouping_seperator'
245                                     type='text' maxlength='1' size='1' value='{$NUM_GRP_SEP}' 
246                                     onkeydown='setSigDigits();' onkeyup='setSigDigits();'></td>
247                     </tr>
248                     <tr>
249                         <td colspan="4"><hr /></td>
250                     </tr>
251                     <tr>
252                         {capture name=SMARTY_LOCALE_NAME_FORMAT_DESC}&nbsp;{$MOD.LBL_LOCALE_NAME_FORMAT_DESC}<br />{$MOD.LBL_LOCALE_NAME_FORMAT_DESC_2}{/capture}
253                         <td nowrap="nowrap" scope="row" valign="top">{$MOD.LBL_LOCALE_DEFAULT_NAME_FORMAT}:&nbsp;{sugar_help text=$smarty.capture.SMARTY_LOCALE_NAME_FORMAT_DESC }</td>
254                         <td valign="top">
255                             <input onkeyup="setPreview();" onkeydown="setPreview();" id="default_locale_name_format" type="text" tabindex='14' name="default_locale_name_format" value="{$default_locale_name_format}">
256                         </td>
257                         <td nowrap="nowrap" scope="row" valign="top"><i>{$MOD.LBL_LOCALE_EXAMPLE_NAME_FORMAT}:</i> </td>
258                         <td valign="top"><input tabindex='14' name="no_value" id="nameTarget" value="" style="border: none;" disabled size="30"></td>        
259                     </tr>
260                 </table>
261                 </div>
262             </td>
263         </tr>
264     </table>
265     <div class="nav-buttons">
266         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
267             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
268             onclick="SugarWizard.changeScreen('personalinfo',true);" />&nbsp;
269         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
270             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
271             {if !$HIDE_IF_CAN_USE_DEFAULT_OUTBOUND}
272             onclick="SugarWizard.changeScreen('smtp',false);" />
273             {else}
274             onclick="SugarWizard.changeScreen('finish',false);" />
275             {/if}
276     </div>
277 </div>
278 {if !$HIDE_IF_CAN_USE_DEFAULT_OUTBOUND}
279 <div id="smtp" class="screen">
280     <table width="100%" border="0" cellspacing="0" cellpadding="0">
281     <tr>
282     <td>
283         <div class="edit view">
284         <table width="100%" border="0" cellspacing="0" cellpadding="0">
285             <tr>
286                 <th align="left" scope="row" colspan="4">
287                     <h2>{$MOD.LBL_WIZARD_SMTP}</h2>
288                 </th>
289             </tr>
290             <tr>
291                 <td align="left" scope="row" colspan="4"><i>{$MOD.LBL_WIZARD_SMTP_DESC}</i></td>
292             </tr>
293             <tr>
294                 <td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_EMAIL_PROVIDER}</span></td>
295                 <td width="30%" ><slot>{$mail_smtpdisplay}<input id='mail_smtpserver' name='mail_smtpserver' type="hidden" value='{$mail_smtpserver}' /></slot></td>
296                 <td scope="row">&nbsp;</td>
297                 <td >&nbsp;</td>
298             </tr>
299             {if !empty($mail_smtpauth_req)}
300             <tr>
301                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span></td>
302                 <td width="30%" ><slot><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></slot></td>
303                 <td scope="row">&nbsp;</td>
304                 <td >&nbsp;</td>
305             </tr>
306             <tr>
307                 <td width="20%" scope="row" nowrap="nowrap"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span></td>
308                 <td width="30%" ><slot><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></slot></td>
309                 <td scope="row">&nbsp;</td>
310                 <td >&nbsp;</td>
311             </tr>
312             {/if}
313             <tr>
314                 <td width="17%" scope="row"><input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" onclick="startOutBoundEmailSettingsTest();"></td>
315                 <td width="33%" >&nbsp;</td>
316                 <td width="17%" scope="row">&nbsp;</td>
317                 <td width="33%" >&nbsp;</td>
318             </tr>
319         </table>
320         </div>
321     </td>
322     </table>
323     <div class="nav-buttons">
324         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
325             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
326             onclick="SugarWizard.changeScreen('locale',true);" />&nbsp;
327         <input title="{$MOD.LBL_WIZARD_NEXT_BUTTON}"
328             class="button primary" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_NEXT_BUTTON}  "
329             onclick="SugarWizard.changeScreen('finish',false);" />
330     </div>
331 </div>
332 {/if}
333 <div id="finish" class="screen">
334     <table width="100%" border="0" cellspacing="0" cellpadding="0">
335         <tr>
336             <td>
337                 <div class="edit view">
338                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
339                 <tr>
340                     <th align="left" scope="row" colspan="4"><h2>{$MOD.LBL_WIZARD_FINISH_TITLE}</h2></th>
341                 </tr>
342                 <tr>
343                     <td scope="row">{$MOD.LBL_WIZARD_FINISH}</td>
344                 </tr>
345                 </table>
346                 </div>
347             </td>
348         </tr>
349     </table>
350     <div class="nav-buttons">
351         <input title="{$MOD.LBL_WIZARD_BACK_BUTTON}"
352             class="button" type="button" name="next_tab1" value="  {$MOD.LBL_WIZARD_BACK_BUTTON}  "
353             {if !$HIDE_IF_CAN_USE_DEFAULT_OUTBOUND}
354             onclick="SugarWizard.changeScreen('smtp',true);" />&nbsp;
355             {else}
356             onclick="SugarWizard.changeScreen('locale',true);" />&nbsp;
357             {/if}
358         <input title="{$MOD.LBL_WIZARD_FINISH_BUTTON}" class="button primary"
359             type="submit" name="save" value="  {$MOD.LBL_WIZARD_FINISH_BUTTON}  " />&nbsp;
360     </div>
361 </div>
362
363                         </div>
364                         <div class="mr"></div>
365
366 </div>
367 <div class="ft"><div class="bl"></div><div class="ft-center"></div><div class="br"></div></div>
368 </div>
369
370 {literal}
371 <script type='text/javascript'>
372 <!--
373 var SugarWizard = new function()
374 {
375     this.currentScreen = 'welcome';
376     
377     this.handleKeyStroke = function(e)
378     {
379         // get the key pressed
380         var key;
381         if (window.event) {
382             key = window.event.keyCode;
383         }
384         else if(e.which) {
385             key = e.which
386         }
387         
388         switch(key) {
389         case 13:
390             primaryButton = YAHOO.util.Selector.query('input.primary',SugarWizard.currentScreen,true);
391             primaryButton.click();
392             break;
393         }
394     }
395     
396     this.changeScreen = function(screen,skipCheck)
397     {
398         if ( !skipCheck ) {
399             clear_all_errors();
400             var form = document.getElementById('UserWizard');
401             var isError = false;
402             
403             switch(this.currentScreen) {
404             case 'personalinfo':
405                 if ( document.getElementById('last_name').value == '' ) {
406                     add_error_style('UserWizard',form.last_name.name,
407                         '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_LAST_NAME}{literal}' );
408                     isError = true;
409                 }
410                 {/literal}
411                 {if $REQUIRED_EMAIL_ADDRESS}
412                 {literal}
413                 if ( document.getElementById('email1').value == '' ) {
414                     add_error_style('UserWizard',form.email1.name,
415                         '{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS} {$MOD.LBL_EMAIL}{literal}' );
416                     isError = true;
417                 }
418                 {/literal}
419                 {/if}
420                 {literal}
421                 break;
422             }
423             if (isError == true)
424                 return false;
425         }
426         
427         document.getElementById(this.currentScreen).style.display = 'none';
428         document.getElementById(screen).style.display = 'block';
429         
430         this.currentScreen = screen;
431     }
432 }
433 {/literal}
434 {if $SKIP_WELCOME}
435 SugarWizard.changeScreen('personalinfo');
436 {else}
437 SugarWizard.changeScreen('welcome');
438 {/if}
439 {literal}
440 document.onkeypress = SugarWizard.handleKeyStroke;
441
442 var mail_smtpport = '{/literal}{$MAIL_SMTPPORT}{literal}';
443 var mail_smtpssl = '{/literal}{$MAIL_SMTPSSL}{literal}';
444
445 EmailMan = {};
446
447 function startOutBoundEmailSettingsTest()
448 {
449     var loader = new YAHOO.util.YUILoader({
450     require : ["element","sugarwidgets"],
451     loadOptional: true,
452     skin: { base: 'blank', defaultSkin: '' },
453     onSuccess: testOutboundSettings,
454     allowRollup: true,
455     base: "include/javascript/yui/build/"
456     });
457     loader.addModule({
458         name :"sugarwidgets",
459         type : "js",
460         fullpath: "include/javascript/sugarwidgets/SugarYUIWidgets.js",
461         varName: "YAHOO.SUGAR",
462         requires: ["datatable", "dragdrop", "treeview", "tabview"]
463     });
464     loader.insert();
465      
466 }
467
468 function testOutboundSettings() 
469
470         var errorMessage = '';
471         var isError = false;
472         var fromAddress = document.getElementById("outboundtest_from_address").value;
473     var errorMessage = '';
474     var isError = false;
475     var smtpServer = document.getElementById('mail_smtpserver').value;
476
477     var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
478     if(trim(smtpServer) == '' || trim(mail_smtpport) == '') 
479     {
480         isError = true;
481         errorMessage += "{/literal}{$MOD.LBL_MISSING_DEFAULT_OUTBOUND_SMTP_SETTINGS}{literal}" + "<br/>";
482         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
483         return false;
484     }
485     
486     if(document.getElementById('mail_smtpuser') && trim(document.getElementById('mail_smtpuser').value) == '') 
487     {
488         isError = true;
489         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
490     }
491     
492     if(document.getElementById('mail_smtppass') && trim(document.getElementById('mail_smtppass').value) == '') 
493     {
494         isError = true;
495         errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
496     }
497     
498     if(isError) {
499         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
500         return false;    
501     } 
502         
503     testOutboundSettingsDialog();
504 }
505
506 function sendTestEmail()
507 {
508     var fromAddress = document.getElementById("outboundtest_from_address").value;
509     
510     if (trim(fromAddress) == "") 
511     {
512         overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{{/literal}$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
513         return;
514     }
515     else if (!isValidEmail(fromAddress)) {
516         overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
517         return;
518     }
519     
520     //Hide the email address window and show a message notifying the user that the test email is being sent.
521     EmailMan.testOutboundDialog.hide();
522     overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
523     
524     var callbackOutboundTest = {
525         success : function(o) {
526                 hideOverlay();
527                 overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
528         }
529     };    
530     var smtpServer = document.getElementById('mail_smtpserver').value;
531     if(document.getElementById('mail_smtpuser') && document.getElementById('mail_smtppass'))
532        {
533          var postDataString = 'mail_sendtype=SMTP&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + mail_smtpport + "&mail_smtpssl=" + mail_smtpssl + "&mail_smtpauth_req=true&mail_smtpuser=" + trim(document.getElementById('mail_smtpuser').value) + "&mail_smtppass=" + trim(document.getElementById('mail_smtppass').value) + "&outboundtest_from_address=" + fromAddress;
534         }
535     else
536        {
537          var postDataString = 'mail_sendtype=SMTP&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + mail_smtpport + "&mail_smtpssl=" + mail_smtpssl + "&outboundtest_from_address=" + fromAddress;
538         }
539         YAHOO.util.Connect.asyncRequest("POST", "index.php?action=testOutboundEmail&module=EmailMan&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
540 }
541 function testOutboundSettingsDialog() {
542         // lazy load dialogue
543         if(!EmailMan.testOutboundDialog) {
544                 EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
545                 modal:true,
546                                 visible:true,
547                 fixedcenter:true,
548                 constraintoviewport: true,
549                 width   : 600,
550                 shadow  : false
551             });
552             EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
553             YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
554         } // end lazy load
555         
556         EmailMan.testOutboundDialog.render();
557         EmailMan.testOutboundDialog.show();
558 } // fn
559
560 function overlay(reqtitle, body, type) {
561     var config = { };
562     config.type = type;
563     config.title = reqtitle;
564     config.msg = body;
565     YAHOO.SUGAR.MessageBox.show(config);
566 }
567
568 function hideOverlay() {
569         YAHOO.SUGAR.MessageBox.hide();
570 }
571 -->
572 </script>
573 {/literal}
574 {$JAVASCRIPT}
575 {literal}
576 <script type="text/javascript" language="Javascript">
577 {/literal}
578 {$getNameJs}
579 {$getNumberJs}
580 {$currencySymbolJs}
581 setSymbolValue(document.getElementById('currency_select').selectedIndex);
582 setSigDigits();
583
584 {$confirmReassignJs}
585 </script>
586 </form>
587
588 <div id="testOutboundDialog" class="yui-hidden">
589     <div id="testOutbound">
590         <form>
591                 <table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
592                         <tr>
593                                 <td scope="row">
594                                         {$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR} 
595                                         <span class="required">
596                                                 {$APP.LBL_REQUIRED_SYMBOL}
597                                         </span>
598                                 </td>
599                                 <td >
600                                         <input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="">
601                                 </td>
602                         </tr>
603                         <tr>
604                                 <td scope="row" colspan="2">
605                                         <input type="button" class="button" value="   {$APP.LBL_EMAIL_SEND}   " onclick="javascript:sendTestEmail();">&nbsp;
606                                         <input type="button" class="button" value="   {$APP.LBL_CANCEL_BUTTON_LABEL}   " onclick="javascript:EmailMan.testOutboundDialog.hide();">&nbsp;
607                                 </td>
608                         </tr>
609                 </table>
610                 </form>
611         </div>
612 </div>