countFiles = 0; function Element(id){ return document.getElementById( id ); } 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(get_lang('login field is empty') + '.'); return; } if (document.forms[0].cn.value == ''){ alert(get_lang('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( get_lang('login field is incomplete') + '.\n' + get_lang('the login field must be formed like') + ':\n' + get_lang('list') + '-' + get_lang('organization') + '-' + get_lang('listname') + '.\n' + get_lang('eg') + ': ' + 'lista-celepar-rh.'); return; } } if (document.forms[0].uid.value.split(" ").length > 1){ alert(get_lang('LOGIN field contains characters not allowed') + '.'); document.forms[0].uid.focus(); return; } if (document.forms[0].mail.value == ''){ alert(get_lang('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(get_lang('Email field is not valid') + '.'); return false; } select_userInMaillist = document.getElementById('ea_select_usersInMaillist'); if (select_userInMaillist.options.length == 0){ alert(get_lang('Any user is in the list') + '.'); return; } var handler_validate_fields = function(data) { 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" + select_available_users.options[i].text + ""; } } else { if ( (select_usersInMaillist.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) { new_options += "