[1913] | 1 | countFiles = 1; |
---|
[6018] | 2 | isValidCallback = false; |
---|
[1913] | 3 | |
---|
| 4 | function create_shared_accounts() |
---|
| 5 | { |
---|
[6018] | 6 | // select_owners = Element('ea_select_owners'); |
---|
| 7 | hidden_owners_acl = Element('owners_acls'); |
---|
| 8 | hidden_owners_calendar_acl = Element('owners_calendar_acls'); |
---|
[5589] | 9 | |
---|
[6018] | 10 | select_owners = Element('ea_select_owners'); |
---|
| 11 | for(var i = 0;i < select_owners.options.length; i++) |
---|
| 12 | select_owners.options[i].selected = true; |
---|
[5589] | 13 | |
---|
[6018] | 14 | hidden_owners_acl.value = admin_connector.serialize(sharemailbox.ownersAcl); |
---|
| 15 | hidden_owners_calendar_acl.value = admin_connector.serialize(sharemailbox.ownersCalendarAcl); |
---|
| 16 | cExecuteForm ("$this.shared_accounts.create", document.forms['shared_accounts_form'], handler_create_shared_accounts); |
---|
| 17 | hidden_owners_acl.value = ""; |
---|
| 18 | isValidCallback = true; |
---|
[1913] | 19 | } |
---|
| 20 | |
---|
| 21 | function handler_create_shared_accounts(data_return) |
---|
| 22 | { |
---|
[6018] | 23 | handler_create_shared_accounts2(data_return); |
---|
| 24 | return; |
---|
[1913] | 25 | } |
---|
| 26 | |
---|
| 27 | function handler_create_shared_accounts2(data_return) |
---|
| 28 | { |
---|
[6018] | 29 | if (data_return && !data_return.status) |
---|
| 30 | { |
---|
| 31 | write_msg(data_return.msg, 'error'); |
---|
| 32 | } |
---|
| 33 | else |
---|
| 34 | { |
---|
| 35 | if(sharemailbox.ownersExpressoCalendarAcl && isValidCallback){ |
---|
| 36 | isValidCallback = false; |
---|
| 37 | calback(); |
---|
[1913] | 38 | } |
---|
[6018] | 39 | |
---|
| 40 | close_lightbox(); |
---|
| 41 | write_msg(get_lang('Shared account successful created') + '.', 'normal'); |
---|
| 42 | } |
---|
| 43 | return; |
---|
[1913] | 44 | } |
---|
| 45 | |
---|
| 46 | function empty_inbox(uid) |
---|
| 47 | { |
---|
[6018] | 48 | var action = get_lang('Cleanned user mailbox'); |
---|
| 49 | var handler_write_log = function(){} |
---|
[1913] | 50 | |
---|
[6018] | 51 | var handler_empty_inbox = function(data) |
---|
| 52 | { |
---|
| 53 | if (!data.status) |
---|
| 54 | alert(data.msg); |
---|
| 55 | else{ |
---|
| 56 | cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log); |
---|
| 57 | alert(get_lang('Emptied') +' '+ data.inbox_size + ' ' + get_lang('MB from user inbox')); |
---|
| 58 | document.getElementById('mailquota_used').value = data.mailquota_used; |
---|
| 59 | } |
---|
[1913] | 60 | } |
---|
| 61 | cExecute ('$this.shared_accounts.empty_inbox&uid='+Element('anchor').value, handler_empty_inbox); |
---|
| 62 | } |
---|
| 63 | function set_onload() |
---|
| 64 | { |
---|
| 65 | |
---|
[5589] | 66 | if(sharemailbox.ownersAcl) |
---|
[6018] | 67 | { |
---|
| 68 | delete sharemailbox.ownersAcl; |
---|
| 69 | sharemailbox.ownersAcl = new Array(); |
---|
| 70 | } |
---|
[1913] | 71 | |
---|
[5589] | 72 | if(sharemailbox.ownersCalendarAcl) |
---|
[6018] | 73 | { |
---|
| 74 | delete sharemailbox.ownersAcl; |
---|
| 75 | sharemailbox.ownersAcl = new Array(); |
---|
| 76 | } |
---|
[5589] | 77 | |
---|
[6018] | 78 | get_associated_domain(Element('ea_combo_org').value); |
---|
[1913] | 79 | } |
---|
| 80 | |
---|
| 81 | function search_organization(key, element) |
---|
| 82 | { |
---|
[6018] | 83 | var organizations = Element(element); |
---|
| 84 | var RegExp_org = new RegExp("\\b"+key, "i"); |
---|
[1913] | 85 | |
---|
[6018] | 86 | for(i = 0; i < organizations.length; i++) |
---|
| 87 | { |
---|
| 88 | if (RegExp_org.test(organizations[i].text)) |
---|
[1913] | 89 | { |
---|
[6018] | 90 | organizations[i].selected = true; |
---|
| 91 | return; |
---|
[1913] | 92 | } |
---|
[6018] | 93 | } |
---|
[1913] | 94 | } |
---|
| 95 | |
---|
| 96 | function sinc_combos_org(context) |
---|
| 97 | { |
---|
[6018] | 98 | combo_org_available_users = Element('ea_combo_org_available_users'); |
---|
[1913] | 99 | |
---|
[6018] | 100 | for (i=0; i<combo_org_available_users.length; i++) |
---|
| 101 | { |
---|
| 102 | if (combo_org_available_users.options[i].value == context) |
---|
[1913] | 103 | { |
---|
[6018] | 104 | combo_org_available_users.options[i].selected = true; |
---|
| 105 | // get_available_users(context); |
---|
| 106 | break; |
---|
[1913] | 107 | } |
---|
[6018] | 108 | } |
---|
[1913] | 109 | } |
---|
| 110 | |
---|
[5589] | 111 | function optionFinderTimeout(obj, event) |
---|
[1913] | 112 | { |
---|
[6018] | 113 | if( event.keyCode === 13 ) |
---|
| 114 | { |
---|
| 115 | limit = 0; |
---|
| 116 | optionFinder(obj.id); |
---|
| 117 | } |
---|
[1913] | 118 | } |
---|
| 119 | function optionFinder(id) { |
---|
| 120 | |
---|
[6018] | 121 | var sentence = Element(id).value; |
---|
[1913] | 122 | |
---|
[6018] | 123 | var url = '$this.ldap_functions.get_available_users2&context=' + |
---|
| 124 | Element('ea_combo_org_available_users').value + |
---|
| 125 | ( sentence ? '&sentence=' + sentence: '' ); |
---|
[1913] | 126 | |
---|
[6018] | 127 | userFinder( sentence, 'ea_select_available_users', url, 'ea_span_searching' ); |
---|
[1913] | 128 | } |
---|
| 129 | |
---|
| 130 | function add_user() |
---|
| 131 | { |
---|
[6018] | 132 | select_available_users = Element('ea_select_available_users'); |
---|
| 133 | select_owners = Element('ea_select_owners'); |
---|
[1913] | 134 | |
---|
[6018] | 135 | var count_available_users = select_available_users.length; |
---|
| 136 | var new_options = ''; |
---|
[1913] | 137 | |
---|
[6018] | 138 | for (i = 0 ; i < count_available_users ; i++) |
---|
| 139 | { |
---|
| 140 | if (select_available_users.options[i].selected) |
---|
[1913] | 141 | { |
---|
[6018] | 142 | if(document.all) |
---|
| 143 | { |
---|
| 144 | if ( (select_owners.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) |
---|
[1913] | 145 | { |
---|
[6018] | 146 | new_options += "<option value=" |
---|
| 147 | + select_available_users.options[i].value |
---|
| 148 | + ">" |
---|
| 149 | + select_available_users.options[i].text |
---|
| 150 | + "</options>"; |
---|
[1913] | 151 | } |
---|
[6018] | 152 | } |
---|
| 153 | else |
---|
| 154 | { |
---|
| 155 | if ( (select_owners.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) |
---|
| 156 | { |
---|
| 157 | new_options += "<option value=" |
---|
| 158 | + select_available_users.options[i].value |
---|
| 159 | + ">" |
---|
| 160 | + select_available_users.options[i].text |
---|
| 161 | + "</options>"; |
---|
| 162 | } |
---|
| 163 | } |
---|
[1913] | 164 | } |
---|
[6018] | 165 | } |
---|
[1913] | 166 | |
---|
[6018] | 167 | if (new_options != '') |
---|
| 168 | { |
---|
| 169 | select_owners.innerHTML = " " + new_options + select_owners.innerHTML; |
---|
| 170 | select_owners.outerHTML = select_owners.outerHTML; |
---|
| 171 | Element('em_input_readAcl').checked = false; |
---|
| 172 | Element('em_input_deleteAcl').checked = false; |
---|
| 173 | Element('em_input_writeAcl').checked = false; |
---|
| 174 | Element('em_input_sendAcl').checked = false; |
---|
| 175 | Element('em_input_folderAcl').checked = false; |
---|
[5804] | 176 | |
---|
[6018] | 177 | Element('em_input_readCalendar').checked = false; |
---|
| 178 | Element('em_input_writeCalendar').checked = false; |
---|
| 179 | Element('em_input_editCalendar').checked = false; |
---|
| 180 | Element('em_input_deleteCalendar').checked = false; |
---|
| 181 | Element('em_input_restrictCalendar').checked = false; |
---|
[5804] | 182 | |
---|
[6018] | 183 | Element('em_input_readExpressoCalendar').checked = false; |
---|
| 184 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 185 | Element('em_input_freebusyExpressoCalendar').checked = false; |
---|
| 186 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
[5804] | 187 | |
---|
| 188 | |
---|
[6018] | 189 | Element('em_input_sendAcl').disabled = true; |
---|
| 190 | select_owners = Element('ea_select_owners'); |
---|
| 191 | select_owners.options[0].selected = true; |
---|
| 192 | } |
---|
[1913] | 193 | } |
---|
| 194 | |
---|
| 195 | function remove_user() |
---|
| 196 | { |
---|
[6018] | 197 | select_owners = Element('ea_select_owners'); |
---|
[5804] | 198 | |
---|
[6018] | 199 | var user = ''; |
---|
| 200 | for(var i = 0;i < select_owners.options.length; i++){ |
---|
| 201 | if(select_owners.options[i].selected){ |
---|
| 202 | user = select_owners.options[i].value; |
---|
| 203 | delete sharemailbox.ownersAcl[user]; |
---|
| 204 | sharemailbox.ownersCalendarAcl[user] = ''; |
---|
| 205 | |
---|
| 206 | |
---|
| 207 | if(sharemailbox.ownersExpressoCalendarAcl && sharemailbox.ownersExpressoCalendarAcl[user]){ |
---|
[5804] | 208 | |
---|
[6018] | 209 | delete sharemailbox.ownersExpressoCalendarAcl[user]; |
---|
| 210 | //sharemailbox.ownersExpressoCalendarAcl.length--; |
---|
[5804] | 211 | |
---|
[6018] | 212 | var sharedUser = DataLayer.get('user', { |
---|
| 213 | filter: ['=','mail',$('#mail').val()] |
---|
| 214 | }); |
---|
| 215 | for(var j = 0; j < sharedUser.length; j++) |
---|
| 216 | if(sharedUser[j].phpgwAccountType == 's'){ |
---|
| 217 | sharedUser = sharedUser[j]; |
---|
| 218 | break; |
---|
| 219 | } |
---|
[5804] | 220 | |
---|
[6018] | 221 | var signature = DataLayer.get('calendarSignature', { |
---|
| 222 | filter: ['=','user', sharedUser.id] |
---|
| 223 | }); |
---|
[5804] | 224 | |
---|
[6018] | 225 | if(!signature) |
---|
| 226 | return; |
---|
[5850] | 227 | |
---|
[6018] | 228 | var usuario = DataLayer.get('user', { |
---|
| 229 | filter: ['=','uid',user], |
---|
| 230 | criteria: { |
---|
| 231 | notExternal: true |
---|
| 232 | } |
---|
| 233 | }); |
---|
| 234 | var calendarPermission = DataLayer.get('calendarToPermission', { |
---|
| 235 | filter: ['AND', ['=','calendar',signature[0].calendar], ['=','user',usuario[0].id] ] |
---|
| 236 | }); |
---|
[5850] | 237 | |
---|
[6018] | 238 | var signatureUser = DataLayer.get('calendarSignature', { |
---|
| 239 | filter: ['AND', ['=','calendar', signature[0].calendar], ['=','user', usuario[0].id ] ] |
---|
| 240 | }); |
---|
[5804] | 241 | |
---|
[6018] | 242 | if(!!signatureUser && signatureUser[0].id) |
---|
| 243 | DataLayer.remove('calendarSignature', signatureUser[0].id); |
---|
[5850] | 244 | |
---|
[6018] | 245 | if(!!calendarPermission && calendarPermission[0].id) |
---|
| 246 | DataLayer.remove('calendarToPermission', calendarPermission[0].id); |
---|
[5804] | 247 | |
---|
[6018] | 248 | } |
---|
| 249 | |
---|
| 250 | select_owners.options[i] = null; |
---|
| 251 | //break; |
---|
| 252 | } |
---|
| 253 | } |
---|
| 254 | //Nova chamada a "Element" é Necessária devido a um bug do ie com select |
---|
| 255 | select_owners = Element('ea_select_owners'); |
---|
| 256 | if(select_owners.options.length > 0 ){ |
---|
| 257 | select_owners.options[0].selected = true; |
---|
| 258 | user = select_owners.options[0].value; |
---|
| 259 | sharemailbox.getaclfromuser(user); |
---|
| 260 | } |
---|
[5804] | 261 | |
---|
[1913] | 262 | } |
---|
| 263 | |
---|
[5589] | 264 | function get_shared_accounts_timeOut(input, event) |
---|
[1913] | 265 | { |
---|
[6018] | 266 | Element('shared_accounts_content').innerHTML = '<table border="0" width="90%"><tr bgcolor="#d3dce3"><td width="30%">'+get_lang("full name")+'</td><td width="30%">'+get_lang("display name")+'</td><td width="30%">'+get_lang("mail")+'</td><td width="5%" align="center">'+get_lang("remove")+'</td></tr></table>'; |
---|
[1913] | 267 | |
---|
[6018] | 268 | if (event.keyCode === 13) |
---|
| 269 | { |
---|
| 270 | get_shared_accounts( input ); |
---|
| 271 | } |
---|
[1913] | 272 | } |
---|
| 273 | |
---|
[5589] | 274 | function get_shared_accounts(input, callback) |
---|
[1913] | 275 | { |
---|
[6018] | 276 | var handler_get_shared_accounts = function(data) |
---|
| 277 | { |
---|
| 278 | if (data.status == 'true') |
---|
[1913] | 279 | { |
---|
[6018] | 280 | var table = '<table border="0" width="90%"><tr bgcolor="#d3dce3"><td width="30%">'+get_lang("full name")+'</td><td width="30%">'+get_lang("display name")+'</td><td width="30%">'+get_lang("mail")+'</td><td width="5%" align="center">'+get_lang("remove")+'</td></tr>'+data.trs+'</table>'; |
---|
| 281 | Element('shared_accounts_content').innerHTML = table; |
---|
[1913] | 282 | } |
---|
[6018] | 283 | else |
---|
| 284 | write_msg(data.msg, 'error'); |
---|
| 285 | } |
---|
| 286 | cExecute ('$this.ldap_functions.get_shared_accounts&input='+input, handler_get_shared_accounts); |
---|
[1913] | 287 | } |
---|
| 288 | |
---|
| 289 | function edit_shared_account(uid) |
---|
| 290 | { |
---|
[6018] | 291 | var handle_edit_shared_account = function(data) |
---|
| 292 | { |
---|
| 293 | if (data.status == 'true') |
---|
[1913] | 294 | { |
---|
[6018] | 295 | modal('shared_accounts_modal','save'); |
---|
[1913] | 296 | |
---|
[6018] | 297 | Element( 'lightboxCaption' ).innerHTML = get_lang( 'Edit Shared Accounts' ); |
---|
| 298 | Element('shared_accounts_modal').value = data.mailquota; |
---|
[5589] | 299 | |
---|
| 300 | |
---|
[6018] | 301 | var combo_org = Element('ea_combo_org'); |
---|
| 302 | for (i=0; i<combo_org.length; i++) |
---|
| 303 | { |
---|
| 304 | if (combo_org.options[i].value == data.user_context) |
---|
| 305 | { |
---|
| 306 | combo_org.options[i].selected = true; |
---|
| 307 | break; |
---|
| 308 | } |
---|
| 309 | } |
---|
[1913] | 310 | |
---|
[6018] | 311 | // anchor |
---|
| 312 | Element('anchor').value = "uid=" + uid + ',' + data.user_context; |
---|
[1913] | 313 | |
---|
[6018] | 314 | if (data.accountStatus != 'active') |
---|
| 315 | Element('accountStatus').checked = false; |
---|
[1913] | 316 | |
---|
[6018] | 317 | if (data.phpgwAccountVisible == '-1') |
---|
| 318 | Element('phpgwAccountVisible').checked = true; |
---|
| 319 | Element('uidnumber').value = data.uidnumber; |
---|
| 320 | Element('cn').value = data.cn; |
---|
| 321 | Element('mail').value = data.mail; |
---|
| 322 | Element('mailquota').value = data.mailquota; |
---|
| 323 | Element('mailquota_used').value = data.mailquota_used; |
---|
| 324 | Element('quota_used_field').style.display = 'inline'; |
---|
| 325 | Element('desc').value = data.description; |
---|
| 326 | //Necessario, pois o IE6 tem um bug que não exibe as novas opções se o innerHTML estava vazio |
---|
[5804] | 327 | |
---|
[6018] | 328 | if(data.owners_options){ |
---|
| 329 | Element('ea_select_owners').innerHTML = ' ' + data.owners_options; |
---|
| 330 | Element('ea_select_owners').outerHTML = Element('ea_select_owners').outerHTML; |
---|
| 331 | } |
---|
| 332 | Element('display_empty_inbox').style.display = data.display_empty_inbox; |
---|
| 333 | if( data.allow_edit_shared_account_acl == "0"){ |
---|
| 334 | Element('bt_add_user').disabled = true; |
---|
| 335 | Element('bt_remove_user').disabled = true; |
---|
| 336 | Element('em_input_readAcl').disabled = true; |
---|
| 337 | Element('em_input_deleteAcl').disabled = true; |
---|
| 338 | Element('em_input_writeAcl').disabled = true; |
---|
| 339 | Element('em_input_sendAcl').disabled = true; |
---|
| 340 | Element('em_input_folderAcl').disabled = true; |
---|
| 341 | } |
---|
[1983] | 342 | |
---|
[5589] | 343 | if( data.mailalternateaddress ) |
---|
| 344 | loadAppended( 'mailalternateaddress', data.mailalternateaddress ); |
---|
| 345 | |
---|
[6018] | 346 | sinc_combos_org(data.user_context); |
---|
| 347 | sharemailbox.ownersAcl = new Array(); |
---|
| 348 | sharemailbox.ownersCalendarAcl = new Array(); |
---|
| 349 | if( data.owners && data.owners != "undefined" && data.owners_acl != "undefined" ){ |
---|
| 350 | for (i=0; i<data.owners.length; i++){ |
---|
| 351 | sharemailbox.ownersAcl[ data.owners[i] ] = data.owners_acl[i]; |
---|
| 352 | sharemailbox.ownersCalendarAcl[ data.owners[i] ] = data.owners_calendar_acl[i]; |
---|
| 353 | } |
---|
| 354 | } |
---|
[5804] | 355 | |
---|
[6018] | 356 | //new API compatibility |
---|
| 357 | var signature = DataLayer.get('calendarSignature', { |
---|
| 358 | filter: ['=','user', data.uidnumber] |
---|
| 359 | }); |
---|
| 360 | if(!!signature){ |
---|
| 361 | sharemailbox.currentPemissions[data.uidnumber] = true; |
---|
| 362 | var calendarPermission = DataLayer.get('calendarToPermission:detail', { |
---|
| 363 | filter: ['=','calendar',signature[0].calendar], |
---|
| 364 | criteria:{ |
---|
| 365 | deepness: 2 |
---|
| 366 | } |
---|
| 367 | }); |
---|
| 368 | if(calendarPermission){ |
---|
| 369 | current = {}; |
---|
| 370 | for(var i=0; i<data.owners.length; i++) |
---|
| 371 | current[data.owners[i]] = true; |
---|
| 372 | |
---|
| 373 | for (var i=0; i < calendarPermission.length; i++){ |
---|
| 374 | sharemailbox.ownersExpressoCalendarAcl[ calendarPermission[i].user.uid ] = calendarPermission[i].aclValues; |
---|
| 375 | sharemailbox.currentPemissions[calendarPermission[i].user.uid] = calendarPermission[i].id; |
---|
| 376 | // sharemailbox.ownersExpressoCalendarAcl.length = sharemailbox.currentPemissions.length = i; |
---|
| 377 | |
---|
| 378 | if(!current[calendarPermission[i].user.uid ]){ |
---|
| 379 | Element('ea_select_owners').innerHTML = Element('ea_select_owners').innerHTML+'<option value='+ calendarPermission[i].user.uid +'>'+ calendarPermission[i].user.name +'</option>'; |
---|
| 380 | Element('ea_select_owners').outerHTML = Element('ea_select_owners').outerHTML; |
---|
| 381 | } |
---|
| 382 | |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | delete sharemailbox.currentPemissions[undefined]; |
---|
| 386 | } |
---|
[5804] | 387 | |
---|
[6018] | 388 | } |
---|
[5804] | 389 | |
---|
| 390 | |
---|
[1913] | 391 | } |
---|
[6018] | 392 | else |
---|
| 393 | write_msg(data.msg, 'error'); |
---|
| 394 | } |
---|
| 395 | cExecute ('$this.shared_accounts.get_data&uid='+uid, handle_edit_shared_account); |
---|
[1913] | 396 | } |
---|
| 397 | |
---|
| 398 | function save_shared_accounts() |
---|
| 399 | { |
---|
[6018] | 400 | if (is_ie){ |
---|
| 401 | var i = 0; |
---|
| 402 | while (document.forms(i).name != "shared_accounts_form"){ |
---|
| 403 | i++ |
---|
[1913] | 404 | } |
---|
[6018] | 405 | form = document.forms(i); |
---|
| 406 | } |
---|
| 407 | else form = document.forms["shared_accounts_form"]; |
---|
[1913] | 408 | |
---|
[6018] | 409 | hidden_owners_calendar_acl = Element('owners_calendar_acls'); |
---|
| 410 | hidden_owners_acl = Element('owners_acls'); |
---|
| 411 | select_owners = Element('ea_select_owners'); |
---|
| 412 | for(var i = 0;i < select_owners.options.length; i++){ |
---|
| 413 | var user = select_owners.options[i].value; |
---|
| 414 | select_owners.options[i].value = user; |
---|
| 415 | } |
---|
| 416 | hidden_owners_acl.value = admin_connector.serialize(sharemailbox.ownersAcl); |
---|
| 417 | hidden_owners_calendar_acl.value = admin_connector.serialize(sharemailbox.ownersCalendarAcl); |
---|
| 418 | cExecuteForm ("$this.shared_accounts.save", form, handler_save_shared_accounts); |
---|
| 419 | get_shared_accounts(Element('ea_shared_account_search').value); |
---|
[5804] | 420 | |
---|
[6018] | 421 | if(sharemailbox.ownersExpressoCalendarAcl) |
---|
| 422 | calback(); |
---|
| 423 | } |
---|
[5804] | 424 | |
---|
[6018] | 425 | function handler_save_shared_accounts(data_return) |
---|
| 426 | { |
---|
| 427 | handler_save_shared_accounts2(data_return); |
---|
| 428 | return; |
---|
| 429 | } |
---|
| 430 | function handler_save_shared_accounts2(data_return) |
---|
| 431 | { |
---|
| 432 | if(data_return){ |
---|
| 433 | if (data_return.status){ |
---|
| 434 | hidden_owners_acl.value = ""; |
---|
| 435 | close_lightbox(); |
---|
| 436 | write_msg(get_lang('Shared account successful saved') + '.', 'normal'); |
---|
| 437 | }else |
---|
| 438 | write_msg(data_return.msg , 'error'); |
---|
| 439 | } |
---|
| 440 | return; |
---|
| 441 | } |
---|
[5804] | 442 | |
---|
[6096] | 443 | function callbackDelete(sharedUser){ |
---|
| 444 | |
---|
| 445 | if(!!sharedUser && $.isArray(sharedUser)) |
---|
| 446 | for(var i = 0; i < sharedUser.length; i++) |
---|
| 447 | if(sharedUser[i].phpgwAccountType == 's'){ |
---|
| 448 | sharedUser = sharedUser[i]; |
---|
| 449 | break; |
---|
| 450 | } |
---|
| 451 | |
---|
| 452 | var signature = DataLayer.get('calendarSignature', { |
---|
| 453 | filter: ['=','user', sharedUser.id] |
---|
| 454 | }); |
---|
| 455 | |
---|
| 456 | signature = $.isArray(signature) ? signature[0] : signature; |
---|
| 457 | |
---|
| 458 | DataLayer.remove('calendarSignature', signature.id) |
---|
| 459 | DataLayer.commit(); |
---|
| 460 | } |
---|
| 461 | |
---|
[6018] | 462 | function calback(){ |
---|
| 463 | var sharedUser = DataLayer.get('user', { |
---|
| 464 | filter: ['=','mail',$('#mail').val()] |
---|
| 465 | }); |
---|
[5804] | 466 | |
---|
[6018] | 467 | if(!!sharedUser && $.isArray(sharedUser)) |
---|
| 468 | for(var i = 0; i < sharedUser.length; i++) |
---|
| 469 | if(sharedUser[i].phpgwAccountType == 's'){ |
---|
| 470 | sharedUser = sharedUser[i]; |
---|
| 471 | break; |
---|
| 472 | } |
---|
[5804] | 473 | |
---|
[6018] | 474 | if(!!!sharemailbox.currentPemissions[sharedUser.id]) |
---|
| 475 | DataLayer.put('calendarSignature', { |
---|
| 476 | user: sharedUser.id, |
---|
| 477 | calendar: { |
---|
| 478 | timezone: 'America/Sao_Paulo', |
---|
| 479 | name: $('#cn').val(), |
---|
| 480 | location : $('#sharedAccountsLocation').val() + '/' + $('#cn').val(), |
---|
| 481 | description : $('#cn').val() |
---|
| 482 | }, |
---|
| 483 | isOwner: '1', |
---|
| 484 | fontColor: '000000', |
---|
| 485 | backgroundColor: 'f1efac', |
---|
| 486 | borderColor: 'eddb21' |
---|
| 487 | }); |
---|
[5804] | 488 | |
---|
[6018] | 489 | var returns = function(data){ |
---|
[5804] | 490 | |
---|
[1913] | 491 | |
---|
[6018] | 492 | var calendar = ''; |
---|
| 493 | |
---|
| 494 | if(data){ |
---|
| 495 | for(var i in data) |
---|
| 496 | if(i.indexOf('calendar:') >= 0) |
---|
| 497 | calendar = data[i].id; |
---|
| 498 | }else{ |
---|
| 499 | calendar = DataLayer.get('calendarSignature', { |
---|
| 500 | filter: ['=','user', sharedUser.id] |
---|
| 501 | }); |
---|
| 502 | calendar = calendar[0].calendar; |
---|
[1913] | 503 | } |
---|
[6018] | 504 | |
---|
| 505 | $.each(sharemailbox.ownersExpressoCalendarAcl, function(user, acl) { |
---|
| 506 | |
---|
| 507 | var usuario = DataLayer.get('user', { |
---|
| 508 | filter: ['=','uid',user], |
---|
| 509 | criteria: { |
---|
| 510 | notExternal: true |
---|
| 511 | } |
---|
| 512 | }); |
---|
| 513 | |
---|
| 514 | if($.isArray(usuario)) |
---|
| 515 | usuario = usuario[0]; |
---|
| 516 | |
---|
| 517 | DataLayer.put('calendarToPermission', DataLayer.merge({ |
---|
| 518 | user: usuario.id, |
---|
| 519 | type: '0', |
---|
| 520 | acl: acl, |
---|
| 521 | calendar: calendar |
---|
| 522 | }, !!sharemailbox.currentPemissions[usuario.uid] ? { |
---|
| 523 | id: sharemailbox.currentPemissions[usuario.uid] |
---|
| 524 | } : {})); |
---|
| 525 | |
---|
| 526 | if(!!!sharemailbox.currentPemissions[usuario.uid]) |
---|
| 527 | DataLayer.put('calendarSignature', { |
---|
| 528 | user: usuario.id, |
---|
| 529 | calendar: calendar, |
---|
| 530 | isOwner: '0', |
---|
| 531 | fontColor: '000000', |
---|
| 532 | backgroundColor: 'f1efac', |
---|
| 533 | borderColor: 'eddb21' |
---|
| 534 | }); |
---|
| 535 | |
---|
| 536 | }) |
---|
| 537 | DataLayer.commit(); |
---|
| 538 | }; |
---|
| 539 | if(!!sharemailbox.currentPemissions[sharedUser.id]) |
---|
| 540 | returns(false); |
---|
| 541 | else |
---|
| 542 | DataLayer.commit(false, false, returns); |
---|
[1913] | 543 | } |
---|
| 544 | |
---|
[6018] | 545 | |
---|
[6096] | 546 | function delete_shared_accounts(uid, mail) |
---|
[1913] | 547 | { |
---|
[6018] | 548 | if (!confirm(get_lang('Are you sure that you want to delete this shared account') + "?")) |
---|
| 549 | return; |
---|
[1913] | 550 | |
---|
[6096] | 551 | var user = {}; |
---|
| 552 | if(sharemailbox.ownersExpressoCalendarAcl) |
---|
| 553 | user = DataLayer.get('user', { |
---|
| 554 | filter: ['=','mail',mail] |
---|
| 555 | }); |
---|
| 556 | |
---|
| 557 | |
---|
[6018] | 558 | var handle_delete_shared_account = function(data_return) |
---|
| 559 | { |
---|
| 560 | if (!data_return.status) |
---|
[1913] | 561 | { |
---|
[6018] | 562 | write_msg(data_return.msg, 'error'); |
---|
[1913] | 563 | } |
---|
[6018] | 564 | else |
---|
[1913] | 565 | { |
---|
[6096] | 566 | if(sharemailbox.ownersExpressoCalendarAcl){ |
---|
| 567 | callbackDelete(user); |
---|
| 568 | } |
---|
| 569 | |
---|
[6018] | 570 | write_msg(get_lang('Shared account successful deleted') + '.', 'normal'); |
---|
| 571 | get_shared_accounts(Element('ea_shared_account_search').value); |
---|
[1913] | 572 | } |
---|
[6018] | 573 | return; |
---|
| 574 | } |
---|
[6096] | 575 | |
---|
| 576 | |
---|
| 577 | |
---|
[6018] | 578 | cExecute ('$this.shared_accounts.delete&uid='+uid, handle_delete_shared_account); |
---|
| 579 | } |
---|
| 580 | function cShareMailbox() |
---|
| 581 | { |
---|
| 582 | this.arrayWin = new Array(); |
---|
| 583 | this.el; |
---|
| 584 | this.alert = false; |
---|
| 585 | this.ownersAcl = new Array(); |
---|
| 586 | this.ownersCalendarAcl = new Array(); |
---|
| 587 | this.ownersExpressoCalendarAcl = {}; |
---|
| 588 | this.currentPemissions = {}; |
---|
| 589 | } |
---|
[1913] | 590 | |
---|
[6018] | 591 | cShareMailbox.prototype.get_available_users = function(context) |
---|
| 592 | { |
---|
| 593 | var handler_get_available_users = function(data) |
---|
| 594 | { |
---|
| 595 | select_available_users = document.getElementById('em_select_available_users'); |
---|
| 596 | |
---|
| 597 | //Limpa o select |
---|
| 598 | for(var i=0; i<select_available_users.options.length; i++) |
---|
[1913] | 599 | { |
---|
[6018] | 600 | select_available_users.options[i] = null; |
---|
| 601 | i--; |
---|
| 602 | } |
---|
[1913] | 603 | |
---|
[6018] | 604 | if ((data) && (data.length > 0)) |
---|
| 605 | { |
---|
| 606 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
| 607 | select_available_users.innerHTML = '#' + data; |
---|
| 608 | select_available_users.outerHTML = select_available_users.outerHTML; |
---|
[1913] | 609 | |
---|
[6018] | 610 | select_available_users.disabled = false; |
---|
| 611 | select_available_users_clone = document.getElementById('em_select_available_users').cloneNode(true); |
---|
| 612 | document.getElementById('em_input_searchUser').value = ''; |
---|
[1913] | 613 | } |
---|
[6018] | 614 | } |
---|
| 615 | cExecute ("$this.ldap_functions.get_available_users2&context="+context, handler_get_available_users); |
---|
| 616 | } |
---|
[1913] | 617 | |
---|
[6018] | 618 | cShareMailbox.prototype.getaclfromuser = function(user) |
---|
| 619 | { |
---|
[1913] | 620 | |
---|
[6018] | 621 | Element('em_input_readAcl').checked = false; |
---|
| 622 | Element('em_input_deleteAcl').checked = false; |
---|
| 623 | Element('em_input_writeAcl').checked = false; |
---|
| 624 | Element('em_input_sendAcl').checked = false; |
---|
| 625 | Element('em_input_folderAcl').checked = false; |
---|
| 626 | Element('em_input_readCalendar').checked = false; |
---|
| 627 | Element('em_input_writeCalendar').checked = false; |
---|
| 628 | Element('em_input_editCalendar').checked = false; |
---|
| 629 | Element('em_input_deleteCalendar').checked = false; |
---|
| 630 | Element('em_input_restrictCalendar').checked = false; |
---|
[5589] | 631 | |
---|
[6018] | 632 | Element('em_input_readExpressoCalendar').checked = false; |
---|
| 633 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 634 | Element('em_input_freebusyExpressoCalendar').checked = false; |
---|
| 635 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
[5804] | 636 | |
---|
[6018] | 637 | Element('em_input_editCalendar').disabled = true; |
---|
| 638 | Element('em_input_deleteCalendar').disabled = true; |
---|
| 639 | Element('em_input_restrictCalendar').disabled = true; |
---|
[5804] | 640 | |
---|
| 641 | |
---|
[6018] | 642 | if(this.ownersExpressoCalendarAcl[user]) |
---|
| 643 | { |
---|
| 644 | if (this.ownersExpressoCalendarAcl[user].indexOf('r') >= 0) |
---|
| 645 | { |
---|
| 646 | Element('em_input_readExpressoCalendar').checked = true; |
---|
| 647 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 648 | Element('em_input_freebusyExpressoCalendar').checked = false; |
---|
| 649 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
[5804] | 650 | |
---|
[6018] | 651 | } |
---|
| 652 | if (this.ownersExpressoCalendarAcl[user].indexOf('w') >= 0) |
---|
| 653 | { |
---|
| 654 | Element('em_input_writeExpressoCalendar').checked = true; |
---|
| 655 | } |
---|
| 656 | if (this.ownersExpressoCalendarAcl[user].indexOf('d') >= 0) |
---|
| 657 | { |
---|
| 658 | Element('em_input_deleteExpressoCalendar').checked = true; |
---|
| 659 | } |
---|
| 660 | if (this.ownersExpressoCalendarAcl[user].indexOf('b') >= 0) |
---|
| 661 | { |
---|
| 662 | Element('em_input_freebusyExpressoCalendar').checked = true; |
---|
| 663 | } |
---|
| 664 | } |
---|
[5804] | 665 | |
---|
[1913] | 666 | |
---|
[6018] | 667 | if(this.ownersCalendarAcl[user]) |
---|
| 668 | { |
---|
| 669 | if (this.ownersCalendarAcl[user].indexOf('1-',0) >= 0) |
---|
| 670 | { |
---|
| 671 | Element('em_input_readCalendar').checked = true; |
---|
| 672 | Element('em_input_editCalendar').disabled = false; |
---|
| 673 | Element('em_input_deleteCalendar').disabled = false; |
---|
| 674 | Element('em_input_restrictCalendar').disabled = false; |
---|
[5804] | 675 | |
---|
[6018] | 676 | Element('em_input_readExpressoCalendar').checked = true; |
---|
| 677 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 678 | Element('em_input_freebusyExpressoCalendar').checked = false; |
---|
| 679 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
[5804] | 680 | |
---|
[6018] | 681 | } |
---|
| 682 | if (this.ownersCalendarAcl[user].indexOf('2-',0) >= 0) |
---|
| 683 | { |
---|
| 684 | Element('em_input_writeCalendar').checked = true; |
---|
| 685 | Element('em_input_writeExpressoCalendar').checked = true; |
---|
| 686 | } |
---|
| 687 | if (this.ownersCalendarAcl[user].indexOf('4-',0) >= 0) |
---|
| 688 | { |
---|
| 689 | Element('em_input_editCalendar').checked = true; |
---|
| 690 | Element('em_input_writeExpressoCalendar').checked = true; |
---|
| 691 | } |
---|
| 692 | if (this.ownersCalendarAcl[user].indexOf('8-',0) >= 0) |
---|
| 693 | { |
---|
| 694 | Element('em_input_deleteCalendar').checked = true; |
---|
| 695 | Element('em_input_deleteExpressoCalendar').checked = true; |
---|
| 696 | } |
---|
| 697 | if (this.ownersCalendarAcl[user].indexOf('16-',0) >= 0) |
---|
| 698 | { |
---|
| 699 | Element('em_input_restrictCalendar').checked = true; |
---|
| 700 | } |
---|
| 701 | } |
---|
[5589] | 702 | |
---|
[6018] | 703 | if(this.ownersAcl[user]) |
---|
| 704 | { |
---|
[6884] | 705 | if ( (this.ownersAcl[user].indexOf('l',0) >= 0) && |
---|
| 706 | (this.ownersAcl[user].indexOf('r',0) >= 0) && |
---|
| 707 | (this.ownersAcl[user].indexOf('s',0) >= 0) |
---|
| 708 | ) |
---|
[6018] | 709 | { |
---|
| 710 | Element('em_input_sendAcl').disabled = false; |
---|
| 711 | Element('em_input_readAcl').checked = true; |
---|
| 712 | } |
---|
| 713 | else |
---|
| 714 | Element('em_input_sendAcl').disabled = true; |
---|
[1913] | 715 | |
---|
[6884] | 716 | if ( (this.ownersAcl[user].indexOf('t',0) >= 0) && |
---|
| 717 | (this.ownersAcl[user].indexOf('e',0) >= 0) |
---|
| 718 | ) |
---|
[6018] | 719 | { |
---|
| 720 | Element('em_input_deleteAcl').checked = true; |
---|
[1913] | 721 | } |
---|
[6884] | 722 | if ( (this.ownersAcl[user].indexOf('w',0) >= 0) && |
---|
| 723 | (this.ownersAcl[user].indexOf('i',0) >= 0) |
---|
| 724 | ) |
---|
[6018] | 725 | { |
---|
| 726 | Element('em_input_writeAcl').checked = true; |
---|
| 727 | } |
---|
[6884] | 728 | if ((this.ownersAcl[user].indexOf('p',0) >= 0) && |
---|
| 729 | (this.ownersAcl[user].indexOf('a',0) >= 0) ) |
---|
[6018] | 730 | { |
---|
| 731 | Element('em_input_sendAcl').disabled = false; |
---|
| 732 | Element('em_input_sendAcl').checked = true; |
---|
[5589] | 733 | } |
---|
[6884] | 734 | if ( (this.ownersAcl[user].indexOf('k',0) >= 0) && |
---|
| 735 | (this.ownersAcl[user].indexOf('x',0) >= 0) |
---|
| 736 | ) |
---|
[6018] | 737 | { |
---|
| 738 | Element('em_input_folderAcl').checked = true; |
---|
| 739 | } |
---|
[6884] | 740 | |
---|
| 741 | |
---|
[6018] | 742 | } |
---|
[6971] | 743 | |
---|
| 744 | //$() |
---|
| 745 | var checkboxes = $(".shared-permissions input:checkbox"); |
---|
| 746 | var check = $("#em_input_readAcl").attr("checked") == undefined ? false : true; |
---|
| 747 | if(check){ |
---|
| 748 | checkboxes.removeAttr("disabled"); |
---|
| 749 | }else{ |
---|
| 750 | checkboxes.not(".shared-required").attr("disabled", "disabled"); |
---|
| 751 | checkboxes.removeAttr("checked"); |
---|
| 752 | } |
---|
[6018] | 753 | } |
---|
[1913] | 754 | |
---|
[6018] | 755 | cShareMailbox.prototype.setaclfromuser = function() |
---|
| 756 | { |
---|
| 757 | var acl = ''; |
---|
| 758 | var select = Element('ea_select_owners'); |
---|
[1913] | 759 | |
---|
[6018] | 760 | if(select.selectedIndex == "-1"){ |
---|
| 761 | alert("Selecione antes um usuario!"); |
---|
| 762 | return false; |
---|
| 763 | } |
---|
[5589] | 764 | |
---|
[6018] | 765 | for(var k = 0; k < select.options.length; k ++ ) |
---|
| 766 | { |
---|
| 767 | if(select.options[k].selected !== true ) continue; |
---|
[5589] | 768 | |
---|
| 769 | |
---|
[6018] | 770 | acl = ''; |
---|
| 771 | var user = select.options[k].value; |
---|
[1913] | 772 | |
---|
[6018] | 773 | if (Element('em_input_readAcl').checked) { |
---|
| 774 | Element('em_input_sendAcl').disabled = false; |
---|
| 775 | acl = 'lrs'; |
---|
| 776 | } |
---|
| 777 | else{ |
---|
| 778 | Element('em_input_sendAcl').disabled = true; |
---|
| 779 | Element('em_input_sendAcl').checked = false; |
---|
| 780 | } |
---|
[1913] | 781 | |
---|
[6018] | 782 | if (Element('em_input_deleteAcl').checked) |
---|
[6932] | 783 | acl += 'tea'; |
---|
[1913] | 784 | |
---|
[6018] | 785 | if (Element('em_input_writeAcl').checked) |
---|
[6932] | 786 | acl += 'wia'; |
---|
[1913] | 787 | |
---|
[6018] | 788 | if (Element('em_input_sendAcl').checked) |
---|
[6884] | 789 | acl += 'pa'; |
---|
[3356] | 790 | |
---|
[6018] | 791 | if (Element('em_input_folderAcl').checked) |
---|
[6932] | 792 | acl += 'kxa'; |
---|
[1913] | 793 | |
---|
[5589] | 794 | |
---|
[6018] | 795 | this.ownersAcl[user] = acl; |
---|
| 796 | } |
---|
| 797 | } |
---|
[5589] | 798 | |
---|
[6018] | 799 | cShareMailbox.prototype.setCalendaraclfromuser = function() |
---|
| 800 | { |
---|
| 801 | var acl = ''; |
---|
| 802 | var select = Element('ea_select_owners'); |
---|
[5804] | 803 | |
---|
[6018] | 804 | sharemailbox.ownersExpressoCalendarAcl = false; |
---|
[5589] | 805 | |
---|
[6018] | 806 | if(select.selectedIndex == "-1"){ |
---|
| 807 | alert("Selecione antes um usuario!"); |
---|
| 808 | return false; |
---|
| 809 | } |
---|
[5589] | 810 | |
---|
[6018] | 811 | for(var k = 0; k < select.options.length; k ++ ) |
---|
| 812 | { |
---|
| 813 | if(select.options[k].selected !== true ) continue; |
---|
[5589] | 814 | |
---|
[6018] | 815 | acl = ''; |
---|
| 816 | var user = select.options[k].value; |
---|
[5589] | 817 | |
---|
[6018] | 818 | if (Element('em_input_readCalendar').checked) |
---|
| 819 | { |
---|
[5589] | 820 | |
---|
[6018] | 821 | acl += '1-'; |
---|
[5589] | 822 | |
---|
[6018] | 823 | Element('em_input_editCalendar').disabled = false; |
---|
| 824 | Element('em_input_deleteCalendar').disabled = false; |
---|
| 825 | Element('em_input_restrictCalendar').disabled = false; |
---|
[5804] | 826 | |
---|
[6018] | 827 | if (Element('em_input_editCalendar').checked) |
---|
| 828 | acl += '4-'; |
---|
[5589] | 829 | |
---|
[6018] | 830 | if (Element('em_input_deleteCalendar').checked ) |
---|
| 831 | acl += '8-'; |
---|
[5589] | 832 | |
---|
[6018] | 833 | if (Element('em_input_restrictCalendar').checked) |
---|
| 834 | acl += '16-'; |
---|
| 835 | } |
---|
| 836 | else |
---|
| 837 | { |
---|
| 838 | Element('em_input_editCalendar').disabled = true; |
---|
| 839 | Element('em_input_deleteCalendar').disabled = true; |
---|
| 840 | Element('em_input_restrictCalendar').disabled = true; |
---|
| 841 | Element('em_input_editCalendar').checked = false; |
---|
| 842 | Element('em_input_deleteCalendar').checked = false; |
---|
| 843 | Element('em_input_restrictCalendar').checked = false; |
---|
[5804] | 844 | |
---|
[6018] | 845 | } |
---|
[5589] | 846 | |
---|
[6018] | 847 | if (Element('em_input_writeCalendar').checked || Element('em_input_writeExpressoCalendar').checked) |
---|
| 848 | acl += '2-'; |
---|
[5589] | 849 | |
---|
| 850 | |
---|
[6018] | 851 | this.ownersCalendarAcl[user] = acl; |
---|
| 852 | } |
---|
| 853 | } |
---|
[5804] | 854 | |
---|
[6018] | 855 | cShareMailbox.prototype.setExpressoCalendaraclfromuser = function() |
---|
| 856 | { |
---|
| 857 | var acl = ''; |
---|
| 858 | var select = Element('ea_select_owners'); |
---|
[5804] | 859 | |
---|
[6018] | 860 | sharemailbox.ownersCalendarAcl = false; |
---|
[5804] | 861 | |
---|
[6018] | 862 | if(select.selectedIndex == "-1"){ |
---|
| 863 | alert("Selecione antes um usuario!"); |
---|
| 864 | return false; |
---|
| 865 | } |
---|
[5804] | 866 | |
---|
[6018] | 867 | for(var k = 0; k < select.options.length; k ++ ) |
---|
| 868 | { |
---|
| 869 | if(select.options[k].selected !== true ) continue; |
---|
[5804] | 870 | |
---|
[6018] | 871 | acl = ''; |
---|
| 872 | var user = select.options[k].value; |
---|
[5804] | 873 | |
---|
[6018] | 874 | if(Element('em_input_freebusyExpressoCalendar').checked) |
---|
| 875 | { |
---|
| 876 | Element('em_input_writeExpressoCalendar').disabled = true; |
---|
| 877 | Element('em_input_deleteExpressoCalendar').disabled = true; |
---|
| 878 | Element('em_input_readExpressoCalendar').disabled = true; |
---|
| 879 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 880 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
| 881 | Element('em_input_readExpressoCalendar').checked = false; |
---|
[5804] | 882 | |
---|
| 883 | |
---|
[6018] | 884 | acl += 'b' |
---|
| 885 | } |
---|
| 886 | else |
---|
| 887 | { |
---|
| 888 | Element('em_input_readExpressoCalendar').disabled = false; |
---|
| 889 | if (Element('em_input_readExpressoCalendar').checked) |
---|
| 890 | { |
---|
| 891 | acl += 'r'; |
---|
[5804] | 892 | |
---|
[6018] | 893 | Element('em_input_writeExpressoCalendar').disabled = false; |
---|
| 894 | Element('em_input_deleteExpressoCalendar').disabled = false; |
---|
| 895 | //Element('em_input_freebusyExpressoCalendar').disabled = false; |
---|
[5804] | 896 | |
---|
[6018] | 897 | if (Element('em_input_writeExpressoCalendar').checked) |
---|
| 898 | acl += 'w'; |
---|
[5804] | 899 | |
---|
[6018] | 900 | if (Element('em_input_deleteExpressoCalendar').checked) |
---|
| 901 | acl += 'd'; |
---|
[5804] | 902 | |
---|
[6018] | 903 | } |
---|
| 904 | else |
---|
| 905 | { |
---|
| 906 | Element('em_input_writeExpressoCalendar').disabled = true; |
---|
| 907 | Element('em_input_deleteExpressoCalendar').disabled = true; |
---|
| 908 | //Element('em_input_freebusyExpressoCalendar').disabled = true; |
---|
| 909 | Element('em_input_writeExpressoCalendar').checked = false; |
---|
| 910 | Element('em_input_deleteExpressoCalendar').checked = false; |
---|
| 911 | // Element('em_input_freebusyExpressoCalendar').checked = false; |
---|
| 912 | } |
---|
[5804] | 913 | |
---|
[6018] | 914 | } |
---|
[5804] | 915 | |
---|
[6018] | 916 | this.ownersExpressoCalendarAcl[user] = acl; |
---|
| 917 | } |
---|
| 918 | } |
---|
[1913] | 919 | |
---|
[6018] | 920 | cShareMailbox.prototype.add_user = function() |
---|
| 921 | { |
---|
| 922 | var select_available_users = document.getElementById('em_select_available_users'); |
---|
| 923 | var select_users = document.getElementById('ea_select_owners'); |
---|
[1913] | 924 | |
---|
[6018] | 925 | var count_available_users = select_available_users.length; |
---|
| 926 | var count_users = select_users.options.length; |
---|
| 927 | var new_options = ''; |
---|
[1913] | 928 | |
---|
[6018] | 929 | for (i = 0 ; i < count_available_users ; i++) |
---|
| 930 | { |
---|
| 931 | if (select_available_users.options[i].selected) |
---|
| 932 | { |
---|
| 933 | if(document.all) |
---|
| 934 | { |
---|
| 935 | if ( (select_users.innerHTML.indexOf('value='+select_available_users.options[i].value)) == '-1' ) |
---|
[1913] | 936 | { |
---|
[6018] | 937 | new_options += '<option value=' |
---|
| 938 | + select_available_users.options[i].value |
---|
| 939 | + '>' |
---|
| 940 | + select_available_users.options[i].text |
---|
| 941 | + '</option>'; |
---|
[1913] | 942 | } |
---|
[6018] | 943 | } |
---|
| 944 | else |
---|
| 945 | { |
---|
| 946 | if ( (select_users.innerHTML.indexOf('value="'+select_available_users.options[i].value+'"')) == '-1' ) |
---|
[1913] | 947 | { |
---|
[6018] | 948 | new_options += '<option value=' |
---|
| 949 | + select_available_users.options[i].value |
---|
| 950 | + '>' |
---|
| 951 | + select_available_users.options[i].text |
---|
| 952 | + '</option>'; |
---|
[1913] | 953 | } |
---|
[6018] | 954 | } |
---|
[1913] | 955 | } |
---|
[6018] | 956 | } |
---|
[1913] | 957 | |
---|
[6018] | 958 | if (new_options != '') |
---|
| 959 | { |
---|
| 960 | select_users.innerHTML = '#' + new_options + select_users.innerHTML; |
---|
| 961 | select_users.outerHTML = select_users.outerHTML; |
---|
| 962 | |
---|
| 963 | } |
---|
| 964 | } |
---|
| 965 | |
---|
| 966 | cShareMailbox.prototype.remove_user = function() |
---|
| 967 | { |
---|
| 968 | select_users = document.getElementById('ea_select_owners'); |
---|
| 969 | |
---|
| 970 | for(var i = 0;i < select_users.options.length; i++) |
---|
| 971 | if(select_users.options[i].selected) |
---|
[1913] | 972 | { |
---|
[5589] | 973 | |
---|
[6018] | 974 | var user = select_users.options[i].value; |
---|
| 975 | this.ownersCalendarAcl[user] = ''; |
---|
| 976 | select_users.options[i--] = null; |
---|
[1913] | 977 | |
---|
[6018] | 978 | } |
---|
[5589] | 979 | |
---|
[6018] | 980 | Element('em_input_readAcl').checked = false; |
---|
| 981 | Element('em_input_deleteAcl').checked = false; |
---|
| 982 | Element('em_input_writeAcl').checked = false; |
---|
| 983 | Element('em_input_sendAcl').checked = false; |
---|
| 984 | Element('em_input_folderAcl').checked = false; |
---|
[5804] | 985 | |
---|
[6018] | 986 | Element('em_input_readCalendar').checked = false; |
---|
| 987 | Element('em_input_writeCalendar').checked = false; |
---|
| 988 | Element('em_input_editCalendar').checked = false; |
---|
| 989 | Element('em_input_deleteCalendar').checked = false; |
---|
| 990 | Element('em_input_restrictCalendar').checked = false; |
---|
[5804] | 991 | |
---|
[6018] | 992 | Element('em_input_readExpressoCalendar').disabled = true; |
---|
| 993 | Element('em_input_writeExpressoCalendar').disabled = true; |
---|
| 994 | Element('em_input_deleteExpressoCalendar').disabled = true; |
---|
| 995 | Element('em_input_readExpressoCalendar').disabled = true; |
---|
| 996 | } |
---|
[1913] | 997 | |
---|
| 998 | |
---|
| 999 | /* Build the Object */ |
---|
[6018] | 1000 | var sharemailbox; |
---|
| 1001 | sharemailbox = new cShareMailbox(); |
---|