countFiles = 0; function validate_fields(type) { document.forms[0].uid.value = document.forms[0].uid.value.toLowerCase(); document.forms[0].old_uid.value = document.forms[0].old_uid.value.toLowerCase(); if (document.forms[0].uid.value == ''){ alert( ExpressoLivre.translate( 'login field is empty' ) + '.'); return; } if (document.forms[0].cn.value == ''){ alert( ExpressoLivre.translate( 'name field is empty' ) + '.'); return; } if (document.forms[0].restrictionsOnEmailLists.value == 'true') { uid_tmp = document.forms[0].uid.value.split("-"); if ((uid_tmp.length < 3) || (uid_tmp[0] != 'lista')){ alert( ExpressoLivre.translate( 'login field is incomplete' ) + '.\n' + ExpressoLivre.translate( 'the login field must be formed like' ) + ':\n' + ExpressoLivre.translate( 'list' ) + '-' + ExpressoLivre.translate( 'organization' ) + '-' + ExpressoLivre.translate( 'listname' ) + '.\n' + ExpressoLivre.translate( 'eg' ) + ': ' + 'lista-celepar-rh.'); return; } } if (document.forms[0].uid.value.split(" ").length > 1){ alert( ExpressoLivre.translate( 'LOGIN field contains characters not allowed' ) + '.'); document.forms[0].uid.focus(); return; } if (document.forms[0].mail.value == ''){ alert( ExpressoLivre.translate( 'EMAIL field is empty' ) + '.'); document.forms[0].mail.focus(); 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( ExpressoLivre.translate( 'Email field is not valid' ) + '.'); return false; } select_userInMaillist = document.getElementById('ea_select_usersInMaillist'); if (select_userInMaillist.options.length == 0){ alert( ExpressoLivre.translate( 'Any user is in the list' ) + '.'); return; } var handler_validate_fields = function(data) { data = expresso.connector.unserialize( data.trim( ) ); if (!data.status) alert(data.msg); else { if (type == 'create_maillist') cExecuteForm ("$this.maillist.create", document.forms[0], handler_create); else if (type == 'edit_maillist') cExecuteForm ("$this.maillist.save", document.forms[0], handler_save); } } // Needed select all options from select for(var i=0; i 0)) { // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. select_available_users.innerHTML = ' ' + data; select_available_users.outerHTML = select_available_users.outerHTML; select_available_users.disabled = false; select_available_users_clone = document.getElementById('ea_select_available_users').cloneNode(true); document.getElementById('ea_input_searchUser').value = ''; } } //Impede chamada recursiva na raiz das organizações if ((recursive) && (document.forms[0].ldap_context.value == document.getElementById('ea_combo_org_maillists').value)) { alert( ExpressoLivre.translate( 'It is not allow select all users from the root organization' ) + '.'); document.getElementById('ea_check_allUsers').checked = false; // Limpa select select_available_users = document.getElementById('ea_select_available_users'); select_available_users.innerHTML = ' '; select_available_users.outerHTML = select_available_users.outerHTML; return; } ExpressoLivre.go( { "access" : 'expressoAdmin1_2.ldap_functions.get_available_users_and_maillist&context='+escape(context)+'&recursive='+recursive+'&denied_uidnumber='+document.forms[0].uidnumber.value, "handler" : handler_get_available_users } ); } function add_user2maillist() { select_available_users = document.getElementById('ea_select_available_users'); select_usersInMaillist = document.getElementById('ea_select_usersInMaillist'); var count_available_users = select_available_users.length; var count_usersInMailList = select_usersInMaillist.options.length; var new_options = ''; for (i = 0 ; i < count_available_users ; i++) { if (select_available_users.options[i].selected) { if(document.all) { if ( (select_usersInMaillist.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) { new_options += "