[2] | 1 | /************************************************************************************\ |
---|
| 2 | * Expresso Administração * |
---|
| 3 | * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br) * |
---|
| 4 | * ----------------------------------------------------------------------------------* |
---|
| 5 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 6 | * under the terms of the GNU General Public License as published by the * |
---|
| 7 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 8 | * option) any later version. * |
---|
| 9 | \************************************************************************************/ |
---|
| 10 | |
---|
| 11 | function emailSuggestion_expressoadmin(use_suggestion_in_logon_script, concatenateDomain) |
---|
| 12 | { |
---|
| 13 | if (concatenateDomain == 'true') |
---|
| 14 | { |
---|
| 15 | var ldap_context = document.forms[0].ldap_context.value.toLowerCase(); |
---|
| 16 | |
---|
| 17 | organization_context = document.forms[0].context.value.toLowerCase(); |
---|
| 18 | select_orgs = document.getElementById('ea_combo_org_info'); |
---|
| 19 | for(var i=0; i<select_orgs.options.length; i++) |
---|
| 20 | { |
---|
| 21 | if(select_orgs.options[i].selected == true) |
---|
| 22 | { |
---|
| 23 | var x; |
---|
| 24 | var context = ''; |
---|
| 25 | select_context = select_orgs.options[i].value.toLowerCase(); |
---|
| 26 | organization_name = organization_context.split(","); |
---|
| 27 | |
---|
| 28 | for (x in organization_name) |
---|
| 29 | { |
---|
| 30 | tmp = organization_name[x].split("="); |
---|
| 31 | context += tmp[1] + '.'; |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | domain_name = document.forms[0].defaultDomain.value; |
---|
| 36 | |
---|
| 37 | x=context.indexOf(ldap_context,0); |
---|
| 38 | org_name_par = context.substring(0,(x-1)); |
---|
| 39 | org_name = org_name_par.split('.'); |
---|
| 40 | org_name = org_name[org_name.length-1]; |
---|
| 41 | |
---|
| 42 | if (org_name != '') |
---|
| 43 | document.forms[0].mail1.value = document.forms[0].uid.value + '@' + org_name + '.' + domain_name; |
---|
| 44 | else |
---|
| 45 | document.forms[0].mail1.value = document.forms[0].uid.value; |
---|
| 46 | } |
---|
| 47 | else |
---|
| 48 | { |
---|
| 49 | document.forms[0].mail1.value = document.forms[0].uid.value; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | if (use_suggestion_in_logon_script == 'true') |
---|
| 53 | document.forms[0].sambalogonscript.value = document.forms[0].uid.value+'.bat'; |
---|
| 54 | document.forms[0].sambahomedirectory.value = '/home/'+document.forms[0].uid.value+'/'; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | function validade_managers_data() |
---|
| 59 | { |
---|
| 60 | if(document.managers_form.manager_lid.value == '') { |
---|
| 61 | alert('Campo "Manager LID" está vazio.'); |
---|
| 62 | document.managers_form.manager_lid.focus(); |
---|
| 63 | return; |
---|
| 64 | } |
---|
| 65 | else if(document.managers_form.context.value == '') { |
---|
| 66 | alert('Contexto está vazio.'); |
---|
| 67 | document.managers_form.context.focus(); |
---|
| 68 | return; |
---|
| 69 | } |
---|
| 70 | document.managers_form.submit(); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | function FormataValor(event, campo) |
---|
| 74 | { |
---|
| 75 | separador1 = '('; |
---|
| 76 | separador2 = ')'; |
---|
| 77 | separador3 = '-'; |
---|
| 78 | |
---|
| 79 | vr = campo.value; |
---|
| 80 | tam = vr.length; |
---|
| 81 | |
---|
| 82 | if ((tam == 1) && (( event.keyCode != 8 ) || ( event.keyCode != 46 ))) |
---|
| 83 | campo.value = ''; |
---|
| 84 | |
---|
| 85 | if ((tam == 3) && (( event.keyCode != 8 ) || ( event.keyCode != 46 ))) |
---|
| 86 | campo.value = vr.substr( 0, tam - 1 ); |
---|
| 87 | |
---|
| 88 | if (( tam <= 1 ) && ( event.keyCode != 8 ) && ( event.keyCode != 46 )) |
---|
| 89 | campo.value = separador1 + vr; |
---|
| 90 | |
---|
| 91 | if (( tam == 3 ) && ( event.keyCode != 8 ) && ( event.keyCode != 46 )) |
---|
| 92 | campo.value = vr + separador2; |
---|
| 93 | |
---|
| 94 | if (( tam == 8 ) && (( event.keyCode != 8 ) && ( event.keyCode != 46 ))) |
---|
| 95 | campo.value = vr + separador3; |
---|
| 96 | |
---|
| 97 | if ((( tam == 9 ) || ( tam == 8 )) && (( event.keyCode == 8 ) || ( event.keyCode == 46 ))) |
---|
| 98 | campo.value = vr.substr( 0, tam - 1 ); |
---|
| 99 | } |
---|
| 100 | |
---|