countFiles = 1; function validate_fields(type) { if (type == 'create_user') { //UID document.forms[0].uid.value = document.forms[0].uid.value.toLowerCase(); if (document.forms[0].uid.value == ''){ alert('Campo LOGIN está vazio.'); return; } else if (document.forms[0].uid.value.length < document.forms[0].minimumSizeLogin.value){ alert('Campo LOGIN deve ter mais que '+document.forms[0].minimumSizeLogin.value+' caracteres.'); return; } // Verifica se o delimitador do Cyrus permite ponto (dot.) nas mailboxes; if (document.forms[0].imapDelimiter.value == '/') var reUid = /^([a-zA-Z0-9_\.\-])+$/; else var reUid = /^([a-zA-Z0-9_\-])+$/; if(!reUid.test(document.forms[0].uid.value)){ alert('Campo LOGIN comtém caracteres năo permitidos.'); document.forms[0].account_lid.focus(); return; } //PASSWORD's if (document.forms[0].password1.value == ''){ alert('Campo SENHA está vazio.'); return; } if (document.forms[0].password2.value == ''){ alert('Campo RE-SENHA está vazio.'); return; } } //Adapatacao para impedir a escrita de uma senha com menos de 6 digitos no ldap if ((document.forms[0].password1.value.length > 0)&&(document.forms[0].password1.value.length < 6)){ alert('A senha precisa ter no minimo 6 caracteres.'); return; } if (document.forms[0].password1.value != document.forms[0].password2.value){ alert('Campo SENHA e RE-SENHA săo diferentes.'); return; } //MAIL document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase(); if (document.forms[0].mail.value == ''){ alert('Campo E-MAIL está vazio.'); return; } var reEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if(!reEmail.test(document.forms[0].mail.value)){ alert("Campo E-mail năo é válido."); return false; } //FIRSTNAME if (document.forms[0].givenname.value == ''){ alert('Campo PRIMEIRO NOME está vazio.'); return; } //LASTNAME if (document.forms[0].sn.value == ''){ alert('Campo ÚLTIMO NOME está vazio.'); return; } //TELEPHONENUMBER if (document.forms[0].telephonenumber.value != '') { reg_tel = /.{4,15}/; if (!reg_tel.exec(document.forms[0].telephonenumber.value)) { alert('Campo Telefone incorreto.'); return; } } //FORWAR ONLY if ((document.forms[0].deliverymode.checked) && (document.forms[0].mailforwardingaddress.value == '')){ alert('Campo E-MAIL DE ENCAMINHAMENTO está vazio.'); return; } // Email Quota if (document.forms[0].mailquota.value == ''){ alert('Usuário sem COTA.'); return; } //GROUPS if (document.getElementById('ea_select_user_groups').length < 1){ alert('Nenhum GRUPO selecionado.'); return; } //SAMBA if (document.getElementById('tabcontent6').style.display != 'none'){ if ((document.forms[0].sambalogonscript.value == '') && (!document.forms[0].sambalogonscript.disabled)){ alert('Script de logon do usuário está vazio.'); return; } if ((document.forms[0].sambahomedirectory.value == '') && (!document.forms[0].sambahomedirectory.disabled)){ alert('Diretório Home do usuário está vazio.'); return; } } // Uid & Mail exist? attrs_array = new Array(); attrs_array['type'] = type; attrs_array['uid'] = document.forms[0].uid.value; attrs_array['mail'] = document.forms[0].mail.value; if (document.forms[0].mailalternateaddress.value != '') attrs_array['mailalternateaddress'] = document.forms[0].mailalternateaddress.value; attributes = connector.serialize(attrs_array); var handler_validate_fields = function(data) { if (!data.status) alert(data.msg); else { if (type == 'create_user') { cExecuteForm ("$this.user.create", document.forms[0], handler_create); } else { //Turn enabled all checkboxes and inputs document.getElementById('changepassword').disabled = false; document.getElementById('phpgwaccountstatus').disabled = false; document.getElementById('phpgwaccountvisible').disabled = false; document.getElementById('telephonenumber').disabled = false; document.getElementById('mailforwardingaddress').disabled = false; document.getElementById('mailalternateaddress').disabled = false; document.getElementById('accountstatus').disabled = false; document.getElementById('deliverymode').disabled = false; document.getElementById('use_attrs_samba').disabled = false; table_apps = document.getElementById('ea_table_apps'); var inputs = table_apps.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { inputs[i].disabled = false; } cExecuteForm ("$this.user.save", document.forms[0], handler_save); } } } // Needed select all options from select select_user_maillists = document.getElementById('ea_select_user_maillists'); select_user_groups = document.getElementById('ea_select_user_groups'); for(var i=0; i 0) { option_seleted = false; new_option = new Option('Sem Setor','',false,false); select_sector.options[0] = new_option; for (i=0; i 0) { for (i=0; i 0) { for (i=0; i