// Variaveis Globais countFiles = 0; function validate_fields(type, restrictionsOnGroup) { document.forms[0].cn.value = document.forms[0].cn.value.toLowerCase(); document.forms[0].old_cn.value = document.forms[0].old_cn.value.toLowerCase(); if (document.forms[0].cn.value == ''){ alert(get_lang('NAME field is empty') + '.'); return; } if (document.forms[0].description.value == ''){ alert(get_lang('DESCRIPTION field is empty') + '.'); return; } if (restrictionsOnGroup == 'true') { cn_tmp = document.forms[0].cn.value.split("-"); if ( (cn_tmp.length < 3) || ((cn_tmp[0] != 'grupo') && (cn_tmp[0] != 'smb')) ){ alert( get_lang('NAME field is incomplete') + '.\n' + get_lang('the name field must be formed like') + ':\n' + get_lang('group') + '-' + get_lang('organization') + '-' + get_lang('group name') + '.\n' + get_lang('eg') + ': ' + 'grupo-celepar-rh.'); return; } } var reCn = /^([a-zA-Z0-9_\-])+$/; var reDesc = /^([a-zA-Z0-9_\- .])+$/; if(!reCn.test(document.forms[0].cn.value)){ alert(get_lang('NAME field contains characters not allowed') + '.'); document.forms[0].cn.focus(); return; } if(!reDesc.test(document.forms[0].description.value)){ alert(get_lang('DESCRIPTION field contains characters not allowed') + '.'); document.forms[0].description.focus(); return; } var reEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if ( (document.forms[0].email.value != '') && (!reEmail.test(document.forms[0].email.value)) ) { alert(get_lang('EMAIL field is empty') + '.'); return false; } var handler_validate_fields = function(data) { if (!data.status) alert(data.msg); else { if (type == 'create_group') cExecuteForm ("$this.group.create", document.forms[0], handler_create); else if (type == 'edit_group') cExecuteForm ("$this.group.save", document.forms[0], handler_save); } } // Needed select all options from select select_userInGroup = document.getElementById('ea_select_usersInGroup'); 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_groups').value)) { alert(get_lang('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; } cExecute ('$this.ldap_functions.get_available_users&context='+context+'&recursive='+recursive, handler_get_available_users); } function add_user2group() { var select_available_users = document.getElementById('ea_select_available_users'); var select_usersInGroup = document.getElementById('ea_select_usersInGroup'); var count_available_users = select_available_users.length; var count_usersInGroup = select_usersInGroup.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_usersInGroup.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) { new_options += ''; } } else { if ( (select_usersInGroup.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) { new_options += ''; } } } } if (new_options != '') { select_usersInGroup.innerHTML = ' ' + new_options + select_usersInGroup.innerHTML; select_usersInGroup.outerHTML = select_usersInGroup.outerHTML; document.getElementById('ea_input_searchUser').value = ""; } } function remove_user2group() { select_usersInGroup = document.getElementById('ea_select_usersInGroup'); for(var i = 0;i < select_usersInGroup.options.length; i++) if(select_usersInGroup.options[i].selected) select_usersInGroup.options[i--] = null; } // Variaveis Locais if (document.getElementById('ea_select_available_users')) { var select_available_users = document.getElementById('ea_select_available_users'); var select_available_users_clone = select_available_users.cloneNode(true); } else { var select_available_users = ''; var select_available_users_clone = ''; } var finderTimeout = ''; // Funcoes function optionFinderTimeout(obj) { clearTimeout(finderTimeout); var oWait = document.getElementById("ea_span_searching"); oWait.innerHTML = get_lang('Searching') + '...'; var finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500); } function optionFinder(id) { var oWait = document.getElementById("ea_span_searching"); var oText = document.getElementById(id); //Limpa todo o select var select_available_users_tmp = document.getElementById('ea_select_available_users') for(var i = 0;i < select_available_users_tmp.options.length; i++) select_available_users_tmp.options[i--] = null; var RegExp_name = new RegExp("\\b"+oText.value, "i"); //Inclui usuário começando com a pesquisa for(i = 0; i < select_available_users_clone.length; i++){ if (RegExp_name.test(select_available_users_clone[i].text)) { sel = select_available_users_tmp.options; option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); sel[sel.length] = option; } } oWait.innerHTML = ' '; } function delete_group(cn, gidnumber) { if (confirm(get_lang('Do you really want delete the group') + ' ' + cn + " ??")) { var handler_delete_group = function(data) { if (!data.status) alert(data.msg); else alert(get_lang('Group success deleted') + '.'); location.href="./index.php?menuaction=expressoAdmin1_2.uigroups.list_groups"; return; } cExecute ('$this.group.delete&gidnumber='+gidnumber+'&cn='+cn, handler_delete_group); } } function use_samba_attrs(value) { document.forms[0].sambasid.disabled = !value; } function get_available_sambadomains(context, type) { if ((type == 'create_group') && (document.getElementById('ea_div_display_samba_options').style.display != 'none')) { var handler_get_available_sambadomains = function(data) { document.forms[0].use_attrs_samba.checked = data.status; use_samba_attrs(data.status); if (data.status) { combo_sambadomains = document.getElementById('ea_combo_sambadomains'); for (i=0; i 0) html += select_usersInGroup.options[i].text + '
'; } var window_group = window.open('','','width=300,height=400,resizable=yes,scrollbars=yes,left=100,top=100'); window_group.document.body.innerHTML = '

'+ document.forms[0].cn.value + '

'+html+''; window_group.document.close(); return true; }