function cShareMailbox() { this.arrayWin = new Array(); this.el; this.alert = false; } cShareMailbox.prototype.get_available_users = function(context) { var _hand_getavluser = function(data) { select_available_users = document.getElementById('em_select_available_users'); //Limpa o 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('em_select_available_users').cloneNode(true); document.getElementById('em_input_searchUser').value = ''; } } cExecute ("expressoMail1_2.ldap_functions.get_available_users2&context="+context, _hand_getavluser); } cShareMailbox.prototype.getaclfromuser = function(user) { var handler_getaclfromuser = function(data) { Element('em_input_readAcl').checked = false; Element('em_input_deleteAcl').checked = false; Element('em_input_writeAcl').checked = false; Element('em_input_sendAcl').checked = false; Element('em_input_saveAcl').checked = false; Element('em_input_saveAcl').disabled = true; if (data[user].indexOf('lrs',0) >= 0) { Element('em_input_sendAcl').disabled = false; Element('em_input_readAcl').checked = true; } else Element('em_input_sendAcl').disabled = true; if (data[user].indexOf('d',0) >= 0) { Element('em_input_deleteAcl').checked = true; } if (data[user].indexOf('wi',0) >= 0) { Element('em_input_writeAcl').checked = true; } if (data[user] != "false" && data[user].indexOf('a',0) >= 0) { Element('em_input_sendAcl').disabled = false; Element('em_input_sendAcl').checked = true; } if (data[user] != "false" && data[user].indexOf('p',0) >= 0) { Element('em_input_saveAcl').disabled = false; Element('em_input_saveAcl').checked = true; } if( data[user] != "false" && Element('em_input_writeAcl').checked && Element('em_input_sendAcl').checked ){ Element('em_input_saveAcl').disabled = false; } else Element('em_input_saveAcl').disabled = true; } cExecute ("expressoMail1_2.imap_functions.getaclfromuser&user="+user, handler_getaclfromuser); } cShareMailbox.prototype.setaclfromuser = function() { var acl = ''; var select = Element('em_select_sharefolders_users'); if(select.selectedIndex == "-1"){ alert("Selecione antes um usuário!"); return false; } var user = select.options[select.selectedIndex].value; if (Element('em_input_readAcl').checked) { Element('em_input_sendAcl').disabled = false; acl = 'lrs'; } else{ Element('em_input_sendAcl').disabled = true; Element('em_input_sendAcl').checked = false; } if (Element('em_input_deleteAcl').checked) acl += 'd'; if (Element('em_input_writeAcl').checked) { acl += 'wi'; } if (Element('em_input_sendAcl').checked){ acl += 'a'; } if (Element('em_input_sendAcl').checked && Element('em_input_writeAcl').checked){ Element('em_input_saveAcl').disabled = false; } else { Element('em_input_saveAcl').disabled = true; Element('em_input_saveAcl').checked = false; } if (Element('em_input_saveAcl').checked) acl += 'p'; var handler_setaclfromuser = function(data) { if (!data) alert(data); return true; } cExecute ("expressoMail1_2.imap_functions.setaclfromuser&user="+user+"&acl="+acl, handler_setaclfromuser); } cShareMailbox.prototype.makeWindow = function(options) { _this = this; var el = document.createElement("DIV"); el.style.visibility = "hidden"; el.style.position = "absolute"; el.style.left = "0px"; el.style.top = "0px"; el.style.width = "0px"; el.style.height = "0px"; el.id = 'dJSWin_sharefolders'; document.body.appendChild(el); if (Element('em_select_sharefolders_users')) { var select_users = Element('em_select_sharefolders_users'); select_users.innerHTML = '#' + options; select_users.outerHTML = select_users.outerHTML; Element('em_input_readAcl').checked = false; Element('em_input_deleteAcl').checked = false; Element('em_input_writeAcl').checked = false; Element('em_input_sendAcl').checked = false; Element('em_input_saveAcl').checked = false; } else { el.innerHTML = ""+ ""+ ""+ ""+ ''+ ''+ "
"+ ''+ get_lang('Note: This sharing will take action on all of your folders and messages.')+ '

'+ '
'+ get_lang('Your mailbox is shared with') +":

"+ ""+ "
"+ '





'+ '' + '

'+ '' + "

"+ get_lang('Organization')+": " + ""+ "

"+get_lang('Search user')+":
" + '
'+ ' 
'+ "
'+ ''+ ''+ ''+ ''+ ''+ '
'+ get_lang('Access right')+':'+ '
'+get_lang('Read')+':
'+get_lang('Exclusion')+':
'+get_lang('Write')+':
'+get_lang('Send')+':
'+get_lang('Save')+':
'+ '
"; } var handler_organizations = function(data){ var user_organization = Element('user_organization').value; for(i = 0; i < data.length; i++) { Element('em_combo_org').options[i] = new Option(data[i].ou,data[i].dn); if(user_organization.toUpperCase() == data[i].ou.toUpperCase()) { Element('em_combo_org').options[i].selected = true; _this.get_available_users(data[i].dn); } } } cExecute ("expressoMail1_2.ldap_functions.get_organizations2&referral=false", handler_organizations); var butt = Element('dJSWin_wfolders_bok') if (!butt){ butt = document.createElement('INPUT'); butt.id = 'dJSWin_wfolders_bok'; butt.type = 'button'; butt.value = get_lang('Save'); el.appendChild(butt); } butt.onclick = function () { // Needed select all options from select var users_setacl = new Array(); select_users = Element('em_select_sharefolders_users'); for(var i=0; i' + select_available_users.options[i].text + ''; } } else { if ( (select_users.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) { new_options += ''; } } } } if (new_options != '') { select_users.innerHTML = '#' + new_options + select_users.innerHTML; select_users.outerHTML = select_users.outerHTML; } } cShareMailbox.prototype.remove_user = function() { select_users = document.getElementById('em_select_sharefolders_users'); for(var i = 0;i < select_users.options.length; i++) if(select_users.options[i].selected) select_users.options[i--] = null; Element('em_input_readAcl').checked = false; Element('em_input_deleteAcl').checked = false; Element('em_input_writeAcl').checked = false; Element('em_input_sendAcl').checked = false; Element('em_input_saveAcl').checked = false; } /* Build the Object */ var sharemailbox; sharemailbox = new cShareMailbox();