[1913] | 1 | countFiles = 1; |
---|
| 2 | |
---|
| 3 | function create_shared_accounts() |
---|
| 4 | { |
---|
| 5 | select_owners = Element('ea_select_owners'); |
---|
| 6 | hidden_owners_acl = Element('owners_acls'); |
---|
| 7 | for(var i = 0;i < select_owners.options.length; i++){ |
---|
| 8 | var user = select_owners.options[i].value; |
---|
| 9 | select_owners.options[i].value = user; |
---|
| 10 | } |
---|
[3354] | 11 | hidden_owners_acl.value = admin_connector.serialize(sharemailbox.ownersAcl); |
---|
[1913] | 12 | cExecuteForm ("$this.shared_accounts.create", document.forms['shared_accounts_form'], handler_create_shared_accounts); |
---|
| 13 | hidden_owners_acl.value = ""; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | function handler_create_shared_accounts(data_return) |
---|
| 17 | { |
---|
| 18 | handler_create_shared_accounts2(data_return); |
---|
| 19 | return; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | function handler_create_shared_accounts2(data_return) |
---|
| 23 | { |
---|
| 24 | if (!data_return.status) |
---|
| 25 | { |
---|
| 26 | write_msg(data_return.msg, 'error'); |
---|
| 27 | } |
---|
| 28 | else |
---|
| 29 | { |
---|
| 30 | close_lightbox(); |
---|
| 31 | write_msg(get_lang('Shared account successful created') + '.', 'normal'); |
---|
| 32 | } |
---|
| 33 | return; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | function empty_inbox(uid) |
---|
| 37 | { |
---|
| 38 | var action = get_lang('Cleanned user mailbox'); |
---|
| 39 | var handler_write_log = function(){} |
---|
| 40 | |
---|
| 41 | var handler_empty_inbox = function(data) |
---|
| 42 | { |
---|
| 43 | if (!data.status) |
---|
| 44 | alert(data.msg); |
---|
| 45 | else{ |
---|
| 46 | cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log); |
---|
| 47 | alert(get_lang('Emptied') +' '+ data.inbox_size + ' ' + get_lang('MB from user inbox')); |
---|
| 48 | document.getElementById('mailquota_used').value = data.mailquota_used; |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | cExecute ('$this.shared_accounts.empty_inbox&uid='+Element('anchor').value, handler_empty_inbox); |
---|
| 52 | } |
---|
| 53 | function set_onload() |
---|
| 54 | { |
---|
| 55 | sinc_combos_org(Element('ea_combo_org').value); |
---|
| 56 | get_available_users(Element('ea_combo_org').value); |
---|
[2350] | 57 | get_associated_domain(Element('ea_combo_org').value); |
---|
[1913] | 58 | } |
---|
| 59 | |
---|
| 60 | function get_available_users(context) |
---|
| 61 | { |
---|
| 62 | var handler_get_users = function(data) |
---|
| 63 | { |
---|
[2707] | 64 | data = data.JSON( ); |
---|
[1913] | 65 | select_available_users = Element('ea_select_available_users'); |
---|
| 66 | |
---|
| 67 | //Clean select |
---|
| 68 | for(var i=0; i<select_available_users.options.length; i++) |
---|
| 69 | { |
---|
| 70 | select_available_users.options[i] = null; |
---|
| 71 | i--; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | if ((data) && (data.length > 0)) |
---|
| 75 | { |
---|
| 76 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
| 77 | select_available_users.innerHTML = ' ' + data; |
---|
| 78 | select_available_users.outerHTML = select_available_users.outerHTML; |
---|
| 79 | |
---|
| 80 | select_available_users.disabled = false; |
---|
| 81 | select_available_users_clone = Element('ea_select_available_users').cloneNode(true); |
---|
| 82 | //document.getElementById('ea_input_searchUser').value = ''; |
---|
| 83 | } |
---|
| 84 | } |
---|
[2707] | 85 | ExpressoLivre.go( { |
---|
| 86 | "access" : 'expressoAdmin1_2.ldap_functions.get_available_users2&context='+context, |
---|
| 87 | "handler" : handler_get_users |
---|
| 88 | } ); |
---|
[1913] | 89 | } |
---|
| 90 | |
---|
| 91 | function search_organization(key, element) |
---|
| 92 | { |
---|
| 93 | var organizations = Element(element); |
---|
| 94 | var RegExp_org = new RegExp("\\b"+key, "i"); |
---|
| 95 | |
---|
| 96 | for(i = 0; i < organizations.length; i++) |
---|
| 97 | { |
---|
| 98 | if (RegExp_org.test(organizations[i].text)) |
---|
| 99 | { |
---|
| 100 | organizations[i].selected = true; |
---|
| 101 | return; |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | function sinc_combos_org(context) |
---|
| 107 | { |
---|
| 108 | combo_org_available_users = Element('ea_combo_org_available_users'); |
---|
| 109 | |
---|
| 110 | for (i=0; i<combo_org_available_users.length; i++) |
---|
| 111 | { |
---|
| 112 | if (combo_org_available_users.options[i].value == context) |
---|
| 113 | { |
---|
| 114 | combo_org_available_users.options[i].selected = true; |
---|
| 115 | get_available_users(context); |
---|
| 116 | break; |
---|
| 117 | } |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | var finderTimeout = ''; |
---|
| 122 | function optionFinderTimeout(obj) |
---|
| 123 | { |
---|
| 124 | clearTimeout(finderTimeout); |
---|
| 125 | var oWait = Element("ea_span_searching"); |
---|
| 126 | oWait.innerHTML = get_lang('searching') + '...'; |
---|
| 127 | finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500); |
---|
| 128 | } |
---|
| 129 | function optionFinder(id) { |
---|
| 130 | var oWait = Element("ea_span_searching"); |
---|
| 131 | var oText = Element(id); |
---|
| 132 | |
---|
| 133 | //Limpa todo o select |
---|
| 134 | var select_available_users_tmp = Element('ea_select_available_users') |
---|
| 135 | |
---|
| 136 | for(var i = 0;i < select_available_users_tmp.options.length; i++) |
---|
| 137 | select_available_users_tmp.options[i--] = null; |
---|
| 138 | |
---|
| 139 | var RegExp_name = new RegExp("\\b"+oText.value, "i"); |
---|
| 140 | |
---|
[2352] | 141 | //Inclui usuario comecando com a pesquisa |
---|
[1913] | 142 | for(i = 0; i < select_available_users_clone.length; i++){ |
---|
| 143 | if ( RegExp_name.test(select_available_users_clone[i].text) || (select_available_users_clone[i].value == -1) ) |
---|
| 144 | { |
---|
| 145 | sel = select_available_users_tmp.options; |
---|
| 146 | option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); |
---|
| 147 | |
---|
| 148 | if (select_available_users_clone[i].value == -1) |
---|
| 149 | option.disabled = true; |
---|
| 150 | |
---|
| 151 | sel[sel.length] = option; |
---|
| 152 | } |
---|
| 153 | } |
---|
| 154 | oWait.innerHTML = ' '; |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | function add_user() |
---|
| 158 | { |
---|
| 159 | select_available_users = Element('ea_select_available_users'); |
---|
| 160 | select_owners = Element('ea_select_owners'); |
---|
| 161 | |
---|
| 162 | var count_available_users = select_available_users.length; |
---|
| 163 | var new_options = ''; |
---|
| 164 | |
---|
| 165 | for (i = 0 ; i < count_available_users ; i++) |
---|
| 166 | { |
---|
| 167 | if (select_available_users.options[i].selected) |
---|
| 168 | { |
---|
| 169 | if(document.all) |
---|
| 170 | { |
---|
| 171 | if ( (select_owners.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) |
---|
| 172 | { |
---|
| 173 | new_options += "<option value=" |
---|
| 174 | + select_available_users.options[i].value |
---|
| 175 | + ">" |
---|
| 176 | + select_available_users.options[i].text |
---|
| 177 | + "</options>"; |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | else |
---|
| 181 | { |
---|
| 182 | if ( (select_owners.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) |
---|
| 183 | { |
---|
| 184 | new_options += "<option value=" |
---|
| 185 | + select_available_users.options[i].value |
---|
| 186 | + ">" |
---|
| 187 | + select_available_users.options[i].text |
---|
| 188 | + "</options>"; |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | if (new_options != '') |
---|
| 195 | { |
---|
| 196 | select_owners.innerHTML = " " + new_options + select_owners.innerHTML; |
---|
[1983] | 197 | select_owners.outerHTML = select_owners.outerHTML; |
---|
| 198 | Element('em_input_readAcl').checked = false; |
---|
[1913] | 199 | Element('em_input_deleteAcl').checked = false; |
---|
| 200 | Element('em_input_writeAcl').checked = false; |
---|
| 201 | Element('em_input_sendAcl').checked = false; |
---|
[3358] | 202 | Element('em_input_saveAcl').checked = false; |
---|
| 203 | Element('em_input_folderAcl').checked = false; |
---|
[1983] | 204 | Element('em_input_sendAcl').disabled = true; |
---|
| 205 | select_owners = Element('ea_select_owners'); |
---|
| 206 | select_owners.options[0].selected = true; |
---|
[1913] | 207 | } |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | function remove_user() |
---|
| 211 | { |
---|
| 212 | select_owners = Element('ea_select_owners'); |
---|
| 213 | for(var i = 0;i < select_owners.options.length; i++) |
---|
| 214 | if(select_owners.options[i].selected){ |
---|
| 215 | var user = select_owners.options[i].value; |
---|
| 216 | delete sharemailbox.ownersAcl[user]; |
---|
| 217 | select_owners.options[i--] = null; |
---|
| 218 | } |
---|
[2352] | 219 | //Nova chamada a "Element" eh Necessaria devido a um bug do ie com select |
---|
[1983] | 220 | select_owners = Element('ea_select_owners'); |
---|
| 221 | if(select_owners.options.length > 0 ){ |
---|
[1913] | 222 | select_owners.options[0].selected = true; |
---|
| 223 | var user = select_owners.options[0].value; |
---|
| 224 | sharemailbox.getaclfromuser(user); |
---|
| 225 | } |
---|
| 226 | } |
---|
| 227 | |
---|
| 228 | function get_shared_accounts_timeOut(input) |
---|
| 229 | { |
---|
| 230 | var head_table = '<table border="0" width="90%"><tr bgcolor="#d3dce3"><td width="30%">'+get_lang("full name")+'</td><td width="30%">'+get_lang("mail")+'</td><td width="5%" align="center">'+get_lang("remove")+'</td></tr></table>'; |
---|
| 231 | |
---|
| 232 | if (input.length > 4) |
---|
| 233 | { |
---|
| 234 | clearTimeout(finderTimeout); |
---|
| 235 | finderTimeout = setTimeout("get_shared_accounts('"+input+"')",500); |
---|
| 236 | } |
---|
| 237 | else |
---|
| 238 | { |
---|
| 239 | Element('shared_accounts_content').innerHTML = head_table; |
---|
| 240 | } |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | function get_shared_accounts(input) |
---|
| 244 | { |
---|
| 245 | var handler_get_shared_accounts = function(data) |
---|
| 246 | { |
---|
[2707] | 247 | data = data.JSON( ); |
---|
[1913] | 248 | if (data.status == 'true') |
---|
| 249 | { |
---|
| 250 | var table = '<table border="0" width="90%"><tr bgcolor="#d3dce3"><td width="30%">'+get_lang("full name")+'</td><td width="30%">'+get_lang("mail")+'</td><td width="5%" align="center">'+get_lang("remove")+'</td></tr>'+data.trs+'</table>'; |
---|
| 251 | Element('shared_accounts_content').innerHTML = table; |
---|
| 252 | } |
---|
| 253 | else |
---|
| 254 | write_msg(data.msg, 'error'); |
---|
| 255 | } |
---|
[2707] | 256 | ExpressoLivre.go( { |
---|
| 257 | "access" : 'expressoAdmin1_2.ldap_functions.get_shared_accounts&input='+input, |
---|
| 258 | "handler" : handler_get_shared_accounts |
---|
| 259 | } ); |
---|
[1913] | 260 | } |
---|
| 261 | |
---|
| 262 | function edit_shared_account(uid) |
---|
| 263 | { |
---|
| 264 | var handle_edit_shared_account = function(data) |
---|
| 265 | { |
---|
[2707] | 266 | data = data.JSON( ); |
---|
[1913] | 267 | if (data.status == 'true') |
---|
| 268 | { |
---|
| 269 | modal('shared_accounts_modal','save'); |
---|
| 270 | |
---|
| 271 | var combo_org = Element('ea_combo_org'); |
---|
| 272 | for (i=0; i<combo_org.length; i++) |
---|
| 273 | { |
---|
| 274 | if (combo_org.options[i].value == data.user_context) |
---|
| 275 | { |
---|
| 276 | combo_org.options[i].selected = true; |
---|
| 277 | break; |
---|
| 278 | } |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | // anchor |
---|
| 282 | Element('anchor').value = "uid=" + uid + ',' + data.user_context; |
---|
| 283 | |
---|
| 284 | if (data.accountStatus != 'active') |
---|
| 285 | Element('accountStatus').checked = false; |
---|
| 286 | |
---|
| 287 | if (data.phpgwAccountVisible == '-1') |
---|
| 288 | Element('phpgwAccountVisible').checked = true; |
---|
| 289 | |
---|
| 290 | Element('cn').value = data.cn; |
---|
| 291 | Element('mail').value = data.mail; |
---|
[1983] | 292 | Element('mailquota').value = data.mailquota; |
---|
| 293 | Element('mailquota_used').value = data.mailquota_used; |
---|
| 294 | Element('quota_used_field').style.display = 'inline'; |
---|
| 295 | Element('desc').value = data.description; |
---|
[2352] | 296 | //Necessario, pois o IE6 tem um bug que nao exibe as novas opcoes se o innerHTML estava vazio |
---|
[1983] | 297 | Element('ea_select_owners').innerHTML = ' ' + data.owners_options; |
---|
| 298 | Element('ea_select_owners').outerHTML = Element('ea_select_owners').outerHTML; |
---|
[1913] | 299 | |
---|
[1983] | 300 | Element('display_empty_inbox').style.display = data.display_empty_inbox; |
---|
| 301 | if( data.allow_edit_shared_account_acl == "0"){ |
---|
| 302 | Element('bt_add_user').disabled = true; |
---|
| 303 | Element('bt_remove_user').disabled = true; |
---|
| 304 | Element('em_input_readAcl').disabled = true; |
---|
| 305 | Element('em_input_deleteAcl').disabled = true; |
---|
| 306 | Element('em_input_writeAcl').disabled = true; |
---|
| 307 | Element('em_input_sendAcl').disabled = true; |
---|
| 308 | Element('em_input_saveAcl').disabled = true; |
---|
[3358] | 309 | Element('em_input_folderAcl').disabled = true; |
---|
[1983] | 310 | } |
---|
| 311 | |
---|
[1913] | 312 | sinc_combos_org(data.user_context); |
---|
| 313 | sharemailbox.ownersAcl = new Array(); |
---|
[2707] | 314 | if( data.owners && data.owners != "undefined" && data.owners_acl != "undefined" ){ |
---|
[1983] | 315 | for (i=0; i<data.owners.length; i++){ |
---|
| 316 | sharemailbox.ownersAcl[ data.owners[i] ] = data.owners_acl[i]; |
---|
| 317 | } |
---|
| 318 | } |
---|
[1913] | 319 | } |
---|
| 320 | else |
---|
| 321 | write_msg(data.msg, 'error'); |
---|
| 322 | } |
---|
[2707] | 323 | ExpressoLivre.go( { |
---|
| 324 | "access" : 'expressoAdmin1_2.shared_accounts.get_data&uid='+uid, |
---|
| 325 | "handler" : handle_edit_shared_account |
---|
| 326 | } ); |
---|
[1913] | 327 | } |
---|
| 328 | |
---|
| 329 | function save_shared_accounts() |
---|
| 330 | { |
---|
| 331 | if (is_ie){ |
---|
| 332 | var i = 0; |
---|
| 333 | while (document.forms(i).name != "shared_accounts_form"){i++} |
---|
| 334 | form = document.forms(i); |
---|
| 335 | } |
---|
| 336 | else form = document.forms["shared_accounts_form"]; |
---|
| 337 | |
---|
| 338 | hidden_owners_acl = Element('owners_acls'); |
---|
| 339 | select_owners = Element('ea_select_owners'); |
---|
| 340 | for(var i = 0;i < select_owners.options.length; i++){ |
---|
| 341 | var user = select_owners.options[i].value; |
---|
| 342 | select_owners.options[i].value = user; |
---|
| 343 | } |
---|
[3354] | 344 | hidden_owners_acl.value = admin_connector.serialize(sharemailbox.ownersAcl); |
---|
[1913] | 345 | cExecuteForm ("$this.shared_accounts.save", form, handler_save_shared_accounts); |
---|
| 346 | hidden_owners_acl.value = ""; |
---|
| 347 | } |
---|
| 348 | |
---|
| 349 | function handler_save_shared_accounts(data_return) |
---|
| 350 | { |
---|
| 351 | handler_save_shared_accounts2(data_return); |
---|
| 352 | return; |
---|
| 353 | } |
---|
| 354 | function handler_save_shared_accounts2(data_return) |
---|
| 355 | { |
---|
| 356 | if (!data_return.status) |
---|
| 357 | { |
---|
| 358 | write_msg(data_return.msg, 'error'); |
---|
| 359 | } |
---|
| 360 | else |
---|
| 361 | { |
---|
| 362 | get_shared_accounts(Element('ea_shared_account_search').value); |
---|
| 363 | close_lightbox(); |
---|
| 364 | write_msg(get_lang('Shared account successful saved') + '.', 'normal'); |
---|
| 365 | } |
---|
| 366 | return; |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | function delete_shared_accounts(uid) |
---|
| 370 | { |
---|
| 371 | if (!confirm(get_lang('Are you sure that you want to delete this shared account') + "?")) |
---|
| 372 | return; |
---|
| 373 | |
---|
| 374 | var handle_delete_shared_account = function(data_return) |
---|
| 375 | { |
---|
| 376 | if (!data_return.status) |
---|
| 377 | { |
---|
| 378 | write_msg(data_return.msg, 'error'); |
---|
| 379 | } |
---|
| 380 | else |
---|
| 381 | { |
---|
| 382 | write_msg(get_lang('Shared account successful deleted') + '.', 'normal'); |
---|
| 383 | get_shared_accounts(Element('ea_shared_account_search').value); |
---|
| 384 | } |
---|
| 385 | return; |
---|
| 386 | } |
---|
| 387 | cExecute ('$this.shared_accounts.delete&uid='+uid, handle_delete_shared_account); |
---|
| 388 | } function cShareMailbox() |
---|
| 389 | { |
---|
| 390 | this.arrayWin = new Array(); |
---|
| 391 | this.el; |
---|
| 392 | this.alert = false; |
---|
| 393 | this.ownersAcl = new Array(); |
---|
| 394 | } |
---|
| 395 | |
---|
| 396 | cShareMailbox.prototype.get_available_users = function(context) |
---|
| 397 | { |
---|
| 398 | var handler_get_available_users = function(data) |
---|
| 399 | { |
---|
[2707] | 400 | data = data.JSON( ); |
---|
| 401 | |
---|
[1913] | 402 | select_available_users = document.getElementById('em_select_available_users'); |
---|
| 403 | |
---|
| 404 | //Limpa o select |
---|
| 405 | for(var i=0; i<select_available_users.options.length; i++) |
---|
| 406 | { |
---|
| 407 | select_available_users.options[i] = null; |
---|
| 408 | i--; |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | if ((data) && (data.length > 0)) |
---|
| 412 | { |
---|
| 413 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
| 414 | select_available_users.innerHTML = '#' + data; |
---|
| 415 | select_available_users.outerHTML = select_available_users.outerHTML; |
---|
| 416 | |
---|
| 417 | select_available_users.disabled = false; |
---|
| 418 | select_available_users_clone = document.getElementById('em_select_available_users').cloneNode(true); |
---|
| 419 | document.getElementById('em_input_searchUser').value = ''; |
---|
| 420 | } |
---|
| 421 | } |
---|
[2707] | 422 | ExpressoLivre.go( { |
---|
| 423 | "access" : 'expressoAdmin1_2.ldap_functions.get_available_users2&context='+context, |
---|
| 424 | "handler" : handler_get_available_users |
---|
| 425 | } ); |
---|
[1913] | 426 | } |
---|
| 427 | |
---|
| 428 | cShareMailbox.prototype.getaclfromuser = function(user) |
---|
| 429 | { |
---|
| 430 | |
---|
| 431 | Element('em_input_readAcl').checked = false; |
---|
| 432 | Element('em_input_deleteAcl').checked = false; |
---|
| 433 | Element('em_input_writeAcl').checked = false; |
---|
| 434 | Element('em_input_sendAcl').checked = false; |
---|
| 435 | Element('em_input_saveAcl').checked = false; |
---|
| 436 | Element('em_input_saveAcl').disabled = true; |
---|
[3358] | 437 | Element('em_input_folderAcl').checked = false; |
---|
[1913] | 438 | |
---|
| 439 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('lrs',0) >= 0) |
---|
| 440 | { |
---|
| 441 | Element('em_input_sendAcl').disabled = false; |
---|
| 442 | Element('em_input_readAcl').checked = true; |
---|
| 443 | } |
---|
| 444 | else |
---|
| 445 | Element('em_input_sendAcl').disabled = true; |
---|
| 446 | |
---|
| 447 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('d',0) >= 0) |
---|
| 448 | { |
---|
| 449 | Element('em_input_deleteAcl').checked = true; |
---|
| 450 | } |
---|
| 451 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('wi',0) >= 0) |
---|
| 452 | { |
---|
| 453 | Element('em_input_writeAcl').checked = true; |
---|
| 454 | } |
---|
| 455 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('a',0) >= 0) |
---|
| 456 | { |
---|
| 457 | Element('em_input_sendAcl').disabled = false; |
---|
| 458 | Element('em_input_sendAcl').checked = true; |
---|
| 459 | } |
---|
| 460 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('p',0) >= 0) |
---|
| 461 | { |
---|
| 462 | Element('em_input_saveAcl').disabled = false; |
---|
| 463 | Element('em_input_saveAcl').checked = true; |
---|
| 464 | } |
---|
[3358] | 465 | if (this.ownersAcl[user] != "false" && this.ownersAcl[user].indexOf('c',0) >= 0) |
---|
| 466 | { |
---|
| 467 | Element('em_input_folderAcl').checked = true; |
---|
| 468 | } |
---|
[1913] | 469 | if( this.ownersAcl[user] != "false" && Element('em_input_writeAcl').checked && Element('em_input_sendAcl').checked ){ |
---|
| 470 | Element('em_input_saveAcl').disabled = false; |
---|
| 471 | } else Element('em_input_saveAcl').disabled = true; |
---|
| 472 | } |
---|
| 473 | |
---|
| 474 | cShareMailbox.prototype.setaclfromuser = function() |
---|
| 475 | { |
---|
| 476 | var acl = ''; |
---|
| 477 | var select = Element('ea_select_owners'); |
---|
| 478 | |
---|
| 479 | if(select.selectedIndex == "-1"){ |
---|
| 480 | alert("Selecione antes um usuario!"); |
---|
| 481 | return false; |
---|
| 482 | } |
---|
| 483 | var user = select.options[select.selectedIndex].value; |
---|
| 484 | |
---|
| 485 | if (Element('em_input_readAcl').checked) { |
---|
| 486 | Element('em_input_sendAcl').disabled = false; |
---|
| 487 | acl = 'lrs'; |
---|
| 488 | } |
---|
| 489 | else{ |
---|
| 490 | Element('em_input_sendAcl').disabled = true; |
---|
| 491 | Element('em_input_sendAcl').checked = false; |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | if (Element('em_input_deleteAcl').checked) |
---|
| 495 | acl += 'd'; |
---|
| 496 | |
---|
| 497 | if (Element('em_input_writeAcl').checked) |
---|
| 498 | acl += 'wi'; |
---|
| 499 | |
---|
| 500 | if (Element('em_input_sendAcl').checked) |
---|
| 501 | acl += 'a'; |
---|
[3358] | 502 | |
---|
| 503 | if (Element('em_input_folderAcl').checked) |
---|
| 504 | acl += 'c'; |
---|
[1913] | 505 | |
---|
| 506 | if (Element('em_input_sendAcl').checked && Element('em_input_writeAcl').checked){ |
---|
| 507 | Element('em_input_saveAcl').disabled = false; |
---|
| 508 | } else { |
---|
| 509 | Element('em_input_saveAcl').disabled = true; |
---|
| 510 | Element('em_input_saveAcl').checked = false; |
---|
| 511 | } |
---|
| 512 | if (Element('em_input_saveAcl').checked) |
---|
| 513 | acl += 'p'; |
---|
| 514 | this.ownersAcl[user] = acl; |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | cShareMailbox.prototype.add_user = function() |
---|
| 518 | { |
---|
| 519 | var select_available_users = document.getElementById('em_select_available_users'); |
---|
| 520 | var select_users = document.getElementById('ea_select_owners'); |
---|
| 521 | |
---|
| 522 | var count_available_users = select_available_users.length; |
---|
| 523 | var count_users = select_users.options.length; |
---|
| 524 | var new_options = ''; |
---|
| 525 | |
---|
| 526 | for (i = 0 ; i < count_available_users ; i++) |
---|
| 527 | { |
---|
| 528 | if (select_available_users.options[i].selected) |
---|
| 529 | { |
---|
| 530 | if(document.all) |
---|
| 531 | { |
---|
| 532 | if ( (select_users.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) |
---|
| 533 | { |
---|
| 534 | new_options += '<option value=' |
---|
| 535 | + select_available_users.options[i].value |
---|
| 536 | + '>' |
---|
| 537 | + select_available_users.options[i].text |
---|
| 538 | + '</option>'; |
---|
| 539 | } |
---|
| 540 | } |
---|
| 541 | else |
---|
| 542 | { |
---|
| 543 | if ( (select_users.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) |
---|
| 544 | { |
---|
| 545 | new_options += '<option value=' |
---|
| 546 | + select_available_users.options[i].value |
---|
| 547 | + '>' |
---|
| 548 | + select_available_users.options[i].text |
---|
| 549 | + '</option>'; |
---|
| 550 | } |
---|
| 551 | } |
---|
| 552 | } |
---|
| 553 | } |
---|
| 554 | |
---|
| 555 | if (new_options != '') |
---|
| 556 | { |
---|
| 557 | select_users.innerHTML = '#' + new_options + select_users.innerHTML; |
---|
| 558 | select_users.outerHTML = select_users.outerHTML; |
---|
| 559 | |
---|
| 560 | } |
---|
| 561 | } |
---|
| 562 | |
---|
| 563 | cShareMailbox.prototype.remove_user = function() |
---|
| 564 | { |
---|
| 565 | select_users = document.getElementById('ea_select_owners'); |
---|
| 566 | |
---|
| 567 | for(var i = 0;i < select_users.options.length; i++) |
---|
| 568 | if(select_users.options[i].selected) |
---|
| 569 | select_users.options[i--] = null; |
---|
| 570 | |
---|
| 571 | Element('em_input_readAcl').checked = false; |
---|
| 572 | Element('em_input_deleteAcl').checked = false; |
---|
| 573 | Element('em_input_writeAcl').checked = false; |
---|
| 574 | Element('em_input_sendAcl').checked = false; |
---|
[1915] | 575 | Element('em_input_saveAcl').checked = false; |
---|
[3358] | 576 | Element('em_input_folderAcl').checked = false; |
---|
[1913] | 577 | } |
---|
| 578 | |
---|
| 579 | |
---|
| 580 | /* Build the Object */ |
---|
| 581 | var sharemailbox; |
---|
| 582 | sharemailbox = new cShareMailbox(); |
---|