[5144] | 1 | ///Define countFiles para a função cExecuteForm; |
---|
| 2 | countFiles = false; |
---|
| 3 | //////////////////////////////////////////////// |
---|
| 4 | |
---|
| 5 | // Verifica versão do Firefox |
---|
| 6 | var agt = navigator.userAgent.toLowerCase(); |
---|
| 7 | var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false; |
---|
| 8 | var finderTimeout = ''; |
---|
| 9 | var selectRecipientsCloned = false; |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | function createLimitRecipientsByUser() |
---|
| 13 | { |
---|
| 14 | var selectUsersInRule = Element('selectUsersInRule'); |
---|
| 15 | for(i = 0; i < selectUsersInRule.length; i++) |
---|
| 16 | selectUsersInRule[i].selected = true; |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | cExecuteForm("$this.boconfiguration.createLimitRecipientsByUser",document.getElementById('formLimitByUserModal'),handlerCreateLimitRecipientByUser); |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | function handlerCreateLimitRecipientByUser(data) |
---|
| 23 | { |
---|
| 24 | handlerCreateLimitRecipientByUser2(data); |
---|
| 25 | return; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | function handlerCreateLimitRecipientByUser2(data) |
---|
| 29 | { |
---|
| 30 | if (!data.status) |
---|
| 31 | { |
---|
| 32 | write_msg(get_lang(data.msg), 'error'); |
---|
| 33 | } |
---|
| 34 | else |
---|
| 35 | { |
---|
| 36 | close_lightbox(); |
---|
| 37 | tableLimitRecipientByUserReload(); |
---|
| 38 | write_msg(get_lang('rule created or update successfully') + '.', 'normal'); |
---|
| 39 | } |
---|
| 40 | return; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | function createBlockEmailForInstitutionalAcounteExeption() |
---|
| 44 | { |
---|
| 45 | var selectSendersInRule = Element('selecSendersInRule'); |
---|
| 46 | for(i = 0; i < selectSendersInRule.length; i++) |
---|
| 47 | selectSendersInRule[i].selected = true; |
---|
| 48 | |
---|
| 49 | var selectUsersOrGroupsInRule = Element('selectUsersOrGroupsInRule'); |
---|
| 50 | for(i = 0; i < selectUsersOrGroupsInRule.length; i++) |
---|
| 51 | selectUsersOrGroupsInRule[i].selected = true; |
---|
| 52 | |
---|
| 53 | cExecuteForm("$this.boconfiguration.createBlockEmailForInstitutionalAcounteExeption",document.getElementById('formblockEmailForInstitutionalAccount'),handlerCreateBlockEmailForInstitutionalAcounteExeption); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | function handlerCreateBlockEmailForInstitutionalAcounteExeption(data) |
---|
| 57 | { |
---|
| 58 | handlerCreateBlockEmailForInstitutionalAcounteExeption2(data); |
---|
| 59 | return; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | function handlerCreateBlockEmailForInstitutionalAcounteExeption2(data) |
---|
| 63 | { |
---|
| 64 | if (!data.status) |
---|
| 65 | { |
---|
| 66 | write_msg(get_lang(data.msg), 'error'); |
---|
| 67 | } |
---|
| 68 | else |
---|
| 69 | { |
---|
| 70 | close_lightbox(); |
---|
| 71 | tableLimitRecipientByUserReload(); |
---|
| 72 | write_msg(get_lang('rule created or update successfully') + '.', 'normal'); |
---|
| 73 | } |
---|
| 74 | return; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | function tableLimitRecipientByUserReload() |
---|
| 78 | { |
---|
| 79 | document.location.reload(); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | function tableLimitRecipientByGroupReload() |
---|
| 83 | { |
---|
| 84 | document.location.reload(); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | function createLimitRecipientsByGroup() |
---|
| 88 | { |
---|
| 89 | var selectUsersInRule = Element('selectGroupsInRule'); |
---|
| 90 | for(i = 0; i < selectUsersInRule.length; i++) |
---|
| 91 | selectUsersInRule[i].selected = true; |
---|
| 92 | |
---|
| 93 | cExecuteForm("$this.boconfiguration.createLimitRecipientsByGroup",document.getElementById('formLimitByGroupModal'),handlerCreateLimitRecipientsByGroup); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | function handlerCreateLimitRecipientsByGroup(data) |
---|
| 97 | { |
---|
| 98 | handlerCreateLimitRecipientsByGroup2(data); |
---|
| 99 | return; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | function handlerCreateLimitRecipientsByGroup2(data) |
---|
| 103 | { |
---|
| 104 | if (!data.status) |
---|
| 105 | { |
---|
| 106 | write_msg(get_lang(data.msg), 'error'); |
---|
| 107 | } |
---|
| 108 | else |
---|
| 109 | { |
---|
| 110 | close_lightbox(); |
---|
| 111 | tableLimitRecipientByGroupReload(); |
---|
| 112 | write_msg(get_lang('rule created or update successfully') + '.', 'normal'); |
---|
| 113 | |
---|
| 114 | } |
---|
| 115 | return; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | function editLimitRecipientesByUser(pid) |
---|
| 119 | { |
---|
| 120 | var handleEditLimitSendersByUser = function(data) |
---|
| 121 | { |
---|
| 122 | if(data.status) |
---|
| 123 | { |
---|
| 124 | modal('limitByUserModal','save'); |
---|
| 125 | |
---|
| 126 | Element('inputTextMaximumRecipientsUserModal').value = data.email_max_recipient; |
---|
| 127 | Element('selectUsersInRule').options[Element('selectUsersInRule').length] = new Option( data.userCn, data.email_user ); |
---|
| 128 | } |
---|
| 129 | else |
---|
| 130 | write_msg(data.msg, 'error'); |
---|
| 131 | |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | cExecute ('$this.boconfiguration.editLimitRecipientesByUser&id='+pid, handleEditLimitSendersByUser); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | function editBlockInstitutionalAccountExeption() |
---|
| 138 | { |
---|
| 139 | var handleeditBlockInstitutionalAccountExeption = function(data) |
---|
| 140 | { |
---|
| 141 | if(data.status) |
---|
| 142 | { |
---|
| 143 | modal('blockEmailForInstitutionalAccountModal','save'); |
---|
| 144 | |
---|
| 145 | var recipientIndex = document.getElementById('inputSelectRecipients').selectedIndex; |
---|
| 146 | var recipientValue = document.getElementById('inputSelectRecipients').options[recipientIndex].value; |
---|
| 147 | var recipientText = document.getElementById('inputSelectRecipients').options[recipientIndex].text; |
---|
| 148 | |
---|
| 149 | if(recipientValue == '*') |
---|
| 150 | document.getElementById('inputCheckAllRecipientsInstitutionalAccountRule').checked = true; |
---|
| 151 | else |
---|
| 152 | Element('selectUsersOrGroupsInRule').options[Element('selectUsersOrGroupsInRule').length] = new Option(recipientText, recipientValue ); |
---|
| 153 | |
---|
| 154 | if(data.allSender) |
---|
| 155 | { |
---|
| 156 | document.getElementById('inputCheckAllSendersInstitutionalAccountRule').checked = true; |
---|
| 157 | } |
---|
| 158 | else |
---|
| 159 | { |
---|
| 160 | var selectSenders = document.getElementById('selecSendersInRule'); |
---|
| 161 | selectSenders.innerHTML = data.options; |
---|
| 162 | } |
---|
| 163 | } |
---|
| 164 | else |
---|
| 165 | write_msg(data.msg, 'error'); |
---|
| 166 | |
---|
| 167 | } |
---|
| 168 | var selectRecipient = document.getElementById('inputSelectRecipients'); |
---|
| 169 | |
---|
| 170 | var index = selectRecipient.selectedIndex; |
---|
| 171 | var value = selectRecipient.options[index].value; |
---|
| 172 | |
---|
| 173 | cExecute ('$this.boconfiguration.getRecipientsInstitutionalAcounteExeption&recipient='+value, handleeditBlockInstitutionalAccountExeption); |
---|
| 174 | } |
---|
| 175 | |
---|
| 176 | function editLimitRecipientesByGroup(pid) |
---|
| 177 | { |
---|
| 178 | var handleEditLimitSendersByGroup = function(data) |
---|
| 179 | { |
---|
| 180 | if(data.status) |
---|
| 181 | { |
---|
| 182 | modal('limitByGroupModal','save'); |
---|
| 183 | |
---|
| 184 | Element('inputTextMaximumRecipientsGroupModal').value = data.email_max_recipient; |
---|
| 185 | Element('selectGroupsInRule').options[Element('selectGroupsInRule').length] = new Option( data.groupCn, data.email_user ); |
---|
| 186 | } |
---|
| 187 | else |
---|
| 188 | write_msg(data.msg, 'error'); |
---|
| 189 | |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | cExecute ('$this.boconfiguration.editLimitRecipientesByGroup&id='+pid, handleEditLimitSendersByGroup); |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | function removeLimitRecipientsByUser(pId) |
---|
| 196 | { |
---|
| 197 | if (!confirm(get_lang('Are you sure that you want to delete this Rule') + "?")) |
---|
| 198 | return; |
---|
| 199 | |
---|
| 200 | var handleRemoveLimitSendersByUser = function(data_return) |
---|
| 201 | { |
---|
| 202 | if (!data_return.status) |
---|
| 203 | { |
---|
| 204 | write_msg(data_return.msg, 'error'); |
---|
| 205 | } |
---|
| 206 | else |
---|
| 207 | { |
---|
| 208 | write_msg(get_lang('Rule successful deleted') + '.', 'normal'); |
---|
| 209 | document.location.reload(); |
---|
| 210 | } |
---|
| 211 | return; |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | cExecute ('$this.boconfiguration.removeLimitRecipientsByUser&id='+pId,handleRemoveLimitSendersByUser); |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | function removeBlockInstitutionalAccountExeption() |
---|
| 218 | { |
---|
| 219 | if (!confirm(get_lang('Are you sure that you want to delete this Rule') + "?")) |
---|
| 220 | return; |
---|
| 221 | |
---|
| 222 | var recipientIndex = document.getElementById('inputSelectRecipients').selectedIndex; |
---|
| 223 | var recipientValue = document.getElementById('inputSelectRecipients').options[recipientIndex].value; |
---|
| 224 | |
---|
| 225 | var handleRemoveBlockInstitutionalAccountExeption = function(data_return) |
---|
| 226 | { |
---|
| 227 | if (!data_return.status) |
---|
| 228 | { |
---|
| 229 | write_msg(data_return.msg, 'error'); |
---|
| 230 | } |
---|
| 231 | else |
---|
| 232 | { |
---|
| 233 | write_msg(get_lang('Rule successful deleted') + '.', 'normal'); |
---|
| 234 | document.location.reload(); |
---|
| 235 | } |
---|
| 236 | return; |
---|
| 237 | } |
---|
| 238 | |
---|
| 239 | cExecute ('$this.boconfiguration.removeBlockEmailForInstitutionalAcounteExeption&recipient='+recipientValue,handleRemoveBlockInstitutionalAccountExeption); |
---|
| 240 | } |
---|
| 241 | |
---|
| 242 | function removeLimitRecipientsByGroup(pId) |
---|
| 243 | { |
---|
| 244 | if (!confirm(get_lang('Are you sure that you want to delete this Rule') + "?")) |
---|
| 245 | return; |
---|
| 246 | |
---|
| 247 | var handleRemoveLimitSendersByGroup = function(data_return) |
---|
| 248 | { |
---|
| 249 | if (!data_return.status) |
---|
| 250 | { |
---|
| 251 | write_msg(data_return.msg, 'error'); |
---|
| 252 | } |
---|
| 253 | else |
---|
| 254 | { |
---|
| 255 | write_msg(get_lang('Rule successful deleted') + '.', 'normal'); |
---|
| 256 | document.location.reload(); |
---|
| 257 | } |
---|
| 258 | return; |
---|
| 259 | } |
---|
| 260 | |
---|
| 261 | cExecute ('$this.boconfiguration.removeLimitRecipientsByGroup&id='+pId,handleRemoveLimitSendersByGroup); |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | function searchOrganization(input, select ,pInputSearch ,pSelectResult) |
---|
| 265 | { |
---|
| 266 | |
---|
| 267 | var organizations = Element(select); |
---|
| 268 | var RegExp_org = new RegExp("\\b"+input, "i"); |
---|
| 269 | var selected = organizations.selectedIndex; |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | for(i = 0; i < organizations.length; i++) |
---|
| 273 | { |
---|
| 274 | if (RegExp_org.test(organizations[i].text)) |
---|
| 275 | { |
---|
| 276 | if(selected != i) |
---|
| 277 | { |
---|
| 278 | organizations[i].selected = true; |
---|
| 279 | if(pInputSearch || pSelectResult) |
---|
| 280 | organizationChange(pInputSearch,pSelectResult,false) |
---|
| 281 | } |
---|
| 282 | return; |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | function organizationChange(pInputSearch,pSelectResult,pClearSearch) |
---|
| 289 | { |
---|
| 290 | var txtSearch = document.getElementById(pInputSearch); |
---|
| 291 | var SelectResults = document.getElementById(pSelectResult); |
---|
| 292 | |
---|
[6082] | 293 | if(pClearSearch){ |
---|
| 294 | if(txtSearch) |
---|
| 295 | txtSearch.value = ''; |
---|
| 296 | } |
---|
| 297 | |
---|
[5144] | 298 | for(var i = 0;i < SelectResults.options.length; i++) |
---|
| 299 | SelectResults.options[i--] = null; |
---|
| 300 | |
---|
| 301 | |
---|
| 302 | } |
---|
| 303 | |
---|
| 304 | function findGroups(obj, numMin, event) |
---|
| 305 | { |
---|
| 306 | |
---|
| 307 | if( event && event.keyCode !== 13 ) |
---|
| 308 | return( true ); |
---|
| 309 | |
---|
| 310 | |
---|
| 311 | findGroupsInLdap( obj.id, numMin ); |
---|
| 312 | |
---|
| 313 | return( false ); |
---|
| 314 | } |
---|
| 315 | |
---|
| 316 | function findUsers(obj, numMin, event) |
---|
| 317 | { |
---|
| 318 | |
---|
| 319 | if( event && event.keyCode !== 13 ) |
---|
[6082] | 320 | return true; |
---|
[5144] | 321 | |
---|
| 322 | findUsersInLdap( obj.id, numMin ); |
---|
| 323 | |
---|
[6082] | 324 | return false; |
---|
[5144] | 325 | } |
---|
| 326 | |
---|
| 327 | function findUsersAndGroups(obj, numMin, event) |
---|
| 328 | { |
---|
| 329 | |
---|
| 330 | if( event && event.keyCode !== 13 ) |
---|
| 331 | return( true ); |
---|
| 332 | |
---|
| 333 | findUsersAndGroupsInLdap(obj.id, numMin); |
---|
| 334 | |
---|
| 335 | return( false ); |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | function findUsersAndGroupsInLdap(id, numMin) |
---|
| 339 | { |
---|
| 340 | |
---|
| 341 | /* var sentence = Element( id ).value; |
---|
| 342 | |
---|
| 343 | var url = 'expressoAdmin1_2.boconfiguration.searchUsersAndGroupsForSelect&context=' |
---|
| 344 | + Element( 'selectOrganizationsInstitutionalAccountModal' ).value |
---|
| 345 | + '&filter=' + sentence; |
---|
| 346 | |
---|
| 347 | var fillHandler = function( fill ){ |
---|
| 348 | |
---|
| 349 | return fillContentSelect( fill, 'selectUsersAndGroups' ); |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | userFinder( sentence, fillHandler, url, 'spanSearching' );*/ |
---|
| 353 | |
---|
| 354 | optionFind( id, 'selectUsersAndGroups', 'expressoAdmin1_2.boconfiguration.searchUsersAndGroupsForSelect', |
---|
| 355 | 'selectOrganizationsInstitutionalAccountModal', 'spanSearching' ); |
---|
| 356 | } |
---|
| 357 | |
---|
| 358 | function findSenders(obj, numMin, event) |
---|
| 359 | { |
---|
| 360 | |
---|
| 361 | if( event && event.keyCode !== 13 ) |
---|
| 362 | return( true ); |
---|
| 363 | |
---|
| 364 | findSendersInLdap( obj.id, numMin ); |
---|
| 365 | |
---|
| 366 | return( false ); |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | function findSendersInLdap(id, numMin) |
---|
| 370 | { |
---|
| 371 | // var sentence = Element( id ).value; |
---|
| 372 | // |
---|
| 373 | // var url = 'expressoAdmin1_2.boconfiguration.searchInstitutionalAccountsForSelect&context=' |
---|
| 374 | // + Element( 'selectOrganizationsInstitutionalAccountModal' ).value |
---|
| 375 | // + '&filter=' + sentence; |
---|
| 376 | // |
---|
| 377 | // var fillHandler = function( fill ){ |
---|
| 378 | // |
---|
| 379 | // return fillContentSelect( fill, 'selecSenders' ); |
---|
| 380 | // } |
---|
| 381 | // |
---|
| 382 | // userFinder( sentence, fillHandler, url, 'spanSearchingSender' ); |
---|
| 383 | |
---|
| 384 | optionFind( id, 'selecSenders', 'expressoAdmin1_2.boconfiguration.searchInstitutionalAccountsForSelect', |
---|
| 385 | 'selectOrganizationsInstitutionalAccountModal' ,'spanSearchingSender' ); |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | function handlerGetAvailableSenders(data) |
---|
| 389 | { |
---|
| 390 | |
---|
| 391 | var selectSenders = Element('selecSenders'); |
---|
| 392 | |
---|
| 393 | for(var i=0; i < selectSenders.options.length; i++) |
---|
| 394 | { |
---|
| 395 | selectSenders.options[i] = null; |
---|
| 396 | i--; |
---|
| 397 | } |
---|
| 398 | |
---|
| 399 | var options = '###'; |
---|
| 400 | if (data) { |
---|
| 401 | |
---|
| 402 | options += data && data.length > 0 ? data : ''; |
---|
| 403 | |
---|
| 404 | if(is_firefox_0) |
---|
| 405 | fixBugInnerSelect(selectSenders,options); |
---|
| 406 | else |
---|
| 407 | selectSenders.innerHTML = options; |
---|
| 408 | |
---|
| 409 | selectSenders.outerHTML = selectSenders.outerHTML; |
---|
| 410 | selectSenders.disabled = false; |
---|
| 411 | selectSendersClone = Element('selecSenders').cloneNode(true); |
---|
| 412 | } |
---|
| 413 | } |
---|
| 414 | |
---|
| 415 | function handlerGetAvailableUsersAndGroups(data) |
---|
| 416 | { |
---|
| 417 | |
---|
| 418 | var selectUsersAndGroups = Element('selectUsersAndGroups'); |
---|
| 419 | |
---|
| 420 | for(var i=0; i < selectUsersAndGroups.options.length; i++) |
---|
| 421 | { |
---|
| 422 | selectUsersAndGroups.options[i] = null; |
---|
| 423 | i--; |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | var options = '###'; |
---|
| 427 | if (data) |
---|
| 428 | { |
---|
| 429 | if(data.groups && data.groups.length > 0) { |
---|
| 430 | data.groups = '<option value="-1" disabled>-------------'+Element("txt_groups").value+' --------- </option>' + data.groups; |
---|
| 431 | } |
---|
| 432 | if(data.users && data.users.length > 0) { |
---|
| 433 | data.users = '<option value="-1" disabled>-------------'+Element("txt_users").value+' ---------</option>' + data.users; |
---|
| 434 | } |
---|
| 435 | options += data.groups && data.groups.length > 0 ? data.groups : ''; |
---|
| 436 | options += data.users && data.users.length > 0 ? data.users : ''; |
---|
| 437 | |
---|
| 438 | if(is_firefox_0) |
---|
| 439 | fixBugInnerSelect(selectUsersAndGroups,options); |
---|
| 440 | else |
---|
| 441 | selectUsersAndGroups.innerHTML = options; |
---|
| 442 | |
---|
| 443 | selectUsersAndGroups.outerHTML = selectUsersAndGroups.outerHTML; |
---|
| 444 | selectUsersAndGroups.disabled = false; |
---|
| 445 | selectUsersClone = Element('selectUsers').cloneNode(true); |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | } |
---|
| 449 | |
---|
| 450 | function findUsersInLdap(id, numMin) |
---|
| 451 | { |
---|
| 452 | |
---|
| 453 | // var sentence = Element( id ).value; |
---|
| 454 | // |
---|
| 455 | // var url = 'expressoAdmin1_2.boconfiguration.searchUsersForSelect&context=' |
---|
| 456 | // + Element( 'selectOrganizationsUserModal' ).value |
---|
| 457 | // + '&filter=' + sentence; |
---|
| 458 | // |
---|
| 459 | // var fillHandler = function( fill ){ |
---|
| 460 | // |
---|
| 461 | // return fillContentSelect( fill, 'selectUsers' ); |
---|
| 462 | // } |
---|
| 463 | // |
---|
| 464 | // userFinder( sentence, fillHandler, url, 'spanSearching' ); |
---|
| 465 | |
---|
| 466 | optionFind( id, 'selectUsers', 'expressoAdmin1_2.boconfiguration.searchUsersForSelect', |
---|
| 467 | 'selectOrganizationsUserModal', 'spanSearching' ); |
---|
| 468 | } |
---|
| 469 | |
---|
| 470 | function findGroupsInLdap(id, numMin) |
---|
| 471 | { |
---|
| 472 | |
---|
| 473 | // var sentence = Element( id ).value; |
---|
| 474 | // |
---|
| 475 | // var url = 'expressoAdmin1_2.boconfiguration.searchGroupsForSelect&context=' |
---|
| 476 | // + Element( 'selectOrganizationsGroupModal' ).value |
---|
| 477 | // + '&filter=' + sentence; |
---|
| 478 | // |
---|
| 479 | // var fillHandler = function( fill ){ |
---|
| 480 | // |
---|
| 481 | // return fillContentSelect( fill, 'selectGroups' ); |
---|
| 482 | // } |
---|
| 483 | // |
---|
| 484 | // userFinder( sentence, fillHandler, url, 'spanSearching' ); |
---|
| 485 | |
---|
| 486 | optionFind( id, 'selectGroups', 'expressoAdmin1_2.boconfiguration.searchGroupsForSelect', |
---|
| 487 | 'selectOrganizationsGroupModal', 'spanSearching' ); |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | function handlerGetAvailableUsers(data) |
---|
| 491 | { |
---|
| 492 | |
---|
| 493 | var selectUsers = Element('selectUsers'); |
---|
| 494 | |
---|
| 495 | for(var i=0; i < selectUsers.options.length; i++) |
---|
| 496 | { |
---|
| 497 | selectUsers.options[i] = null; |
---|
| 498 | i--; |
---|
| 499 | } |
---|
| 500 | |
---|
| 501 | var options = '###'; |
---|
| 502 | if (data) { |
---|
| 503 | |
---|
| 504 | options += data && data.length > 0 ? data : ''; |
---|
| 505 | |
---|
| 506 | if(is_firefox_0) |
---|
| 507 | fixBugInnerSelect(selectUsers,options); |
---|
| 508 | else |
---|
| 509 | selectUsers.innerHTML = options; |
---|
| 510 | |
---|
| 511 | selectUsers.outerHTML = selectUsers.outerHTML; |
---|
| 512 | selectUsers.disabled = false; |
---|
| 513 | selectUsersClone = Element('selectUsers').cloneNode(true); |
---|
| 514 | } |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | function handlerGetAvailableGroups(data) |
---|
| 518 | { |
---|
| 519 | |
---|
| 520 | var selectGroups = Element('selectGroups'); |
---|
| 521 | |
---|
| 522 | for(var i=0; i < selectGroups.options.length; i++) |
---|
| 523 | { |
---|
| 524 | selectGroups.options[i] = null; |
---|
| 525 | i--; |
---|
| 526 | } |
---|
| 527 | |
---|
| 528 | var options = '###'; |
---|
| 529 | if (data) { |
---|
| 530 | |
---|
| 531 | options += data && data.length > 0 ? data : ''; |
---|
| 532 | |
---|
| 533 | if(is_firefox_0) |
---|
| 534 | fixBugInnerSelect(selectGroups,options); |
---|
| 535 | else |
---|
| 536 | selectGroups.innerHTML = options; |
---|
| 537 | |
---|
| 538 | |
---|
| 539 | selectGroups.outerHTML = selectGroups.outerHTML; |
---|
| 540 | selectGroups.disabled = false; |
---|
| 541 | selectGroupsClone = Element('selectGroups').cloneNode(true); |
---|
| 542 | } |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | function addUserOrGroupsInInstitutionalAccountRule() |
---|
| 546 | { |
---|
| 547 | |
---|
| 548 | |
---|
| 549 | var selectUsersAndGroupsInRule = document.getElementById('selectUsersOrGroupsInRule'); |
---|
| 550 | var selectUsersAndGroups = document.getElementById('selectUsersAndGroups'); |
---|
| 551 | var selectUsersAndGroupsCount = selectUsersAndGroups.length; |
---|
| 552 | |
---|
| 553 | for (i = 0 ; i < selectUsersAndGroupsCount ; i++) |
---|
| 554 | { |
---|
| 555 | if (selectUsersAndGroups.options[i].selected) |
---|
| 556 | { |
---|
| 557 | //Salva em value do item selecionado |
---|
| 558 | var value = selectUsersAndGroups.options[i].value; |
---|
| 559 | var text = selectUsersAndGroups.options[i].text; |
---|
| 560 | //Asssume-se que ja exite no select |
---|
| 561 | existInSelect = true; |
---|
| 562 | |
---|
| 563 | //Verifica a existencia do usuario no select/// |
---|
| 564 | if(document.all) |
---|
| 565 | { |
---|
| 566 | if ( (selectUsersAndGroupsInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
| 567 | existInSelect = false; |
---|
| 568 | } |
---|
| 569 | else if ( (selectUsersAndGroupsInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
| 570 | existInSelect = false; |
---|
| 571 | /////////////////////////////////////////////// |
---|
| 572 | |
---|
| 573 | //Adiciona o a option no select |
---|
| 574 | if(existInSelect == false) |
---|
| 575 | selectUsersAndGroupsInRule.options[selectUsersAndGroupsInRule.length] = new Option( text, value ); |
---|
| 576 | |
---|
| 577 | } |
---|
| 578 | } |
---|
| 579 | } |
---|
| 580 | |
---|
| 581 | function addSenderInInstitutionalAccountRule() |
---|
| 582 | { |
---|
| 583 | |
---|
| 584 | |
---|
| 585 | var selectSendersInRule = document.getElementById('selecSendersInRule'); |
---|
| 586 | var selectSenders = document.getElementById('selecSenders'); |
---|
| 587 | var selectSendersCount = selectSenders.length; |
---|
| 588 | |
---|
| 589 | for (i = 0 ; i < selectSendersCount ; i++) |
---|
| 590 | { |
---|
| 591 | if (selectSenders.options[i].selected) |
---|
| 592 | { |
---|
| 593 | //Salva em value do item selecionado |
---|
| 594 | var value = selectSenders.options[i].value; |
---|
| 595 | var text = selectSenders.options[i].text; |
---|
| 596 | //Asssume-se que ja exite no select |
---|
| 597 | existInSelect = true; |
---|
| 598 | |
---|
| 599 | //Verifica a existencia do usuario no select/// |
---|
| 600 | if(document.all) |
---|
| 601 | { |
---|
| 602 | if ( (selectSendersInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
| 603 | existInSelect = false; |
---|
| 604 | } |
---|
| 605 | else if ( (selectSendersInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
| 606 | existInSelect = false; |
---|
| 607 | /////////////////////////////////////////////// |
---|
| 608 | |
---|
| 609 | //Adiciona o a option no select |
---|
| 610 | if(existInSelect == false) |
---|
| 611 | selectSendersInRule.options[selectSendersInRule.length] = new Option( text, value ); |
---|
| 612 | |
---|
| 613 | } |
---|
| 614 | } |
---|
| 615 | } |
---|
| 616 | |
---|
| 617 | function addUserInLimitSendersRule() |
---|
| 618 | { |
---|
| 619 | var selectUsersInRule = document.getElementById('selectUsersInRule'); |
---|
| 620 | var selectUsers = document.getElementById('selectUsers'); |
---|
| 621 | var selectUsersCount = selectUsers.length; |
---|
| 622 | |
---|
| 623 | for (i = 0 ; i < selectUsersCount ; i++) |
---|
| 624 | { |
---|
| 625 | if (selectUsers.options[i].selected) |
---|
| 626 | { |
---|
| 627 | //Salva em value do item selecionado |
---|
| 628 | var value = selectUsers.options[i].value; |
---|
| 629 | var text = selectUsers.options[i].text; |
---|
| 630 | //Asssume-se que ja exite no select |
---|
| 631 | existInSelect = true; |
---|
| 632 | |
---|
| 633 | //Verifica a existencia do usuario no select/// |
---|
| 634 | if(document.all) |
---|
| 635 | { |
---|
| 636 | if ( (selectUsersInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
| 637 | existInSelect = false; |
---|
| 638 | } |
---|
| 639 | else if ( (selectUsersInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
| 640 | existInSelect = false; |
---|
| 641 | /////////////////////////////////////////////// |
---|
| 642 | |
---|
| 643 | //Adiciona o a option no select |
---|
| 644 | if(existInSelect == false) |
---|
| 645 | selectUsersInRule.options[selectUsersInRule.length] = new Option( text, value ); |
---|
| 646 | |
---|
| 647 | } |
---|
| 648 | } |
---|
| 649 | } |
---|
| 650 | |
---|
| 651 | function addGroupInLimitSendersRule() |
---|
| 652 | { |
---|
| 653 | var selectGroupsInRule = document.getElementById('selectGroupsInRule'); |
---|
| 654 | var selectGroups = document.getElementById('selectGroups'); |
---|
| 655 | var selectGroupsCount = selectGroups.length; |
---|
| 656 | |
---|
| 657 | for (i = 0 ; i < selectGroupsCount ; i++) |
---|
| 658 | { |
---|
| 659 | if (selectGroups.options[i].selected) |
---|
| 660 | { |
---|
| 661 | //Salva em value do item selecionado |
---|
| 662 | var value = selectGroups.options[i].value; |
---|
| 663 | var text = selectGroups.options[i].text; |
---|
| 664 | //Asssume-se que ja exite no select |
---|
| 665 | existInSelect = true; |
---|
| 666 | |
---|
| 667 | //Verifica a existencia do usuario no select/// |
---|
| 668 | if(document.all) |
---|
| 669 | { |
---|
| 670 | if ( (selectGroupsInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
| 671 | existInSelect = false; |
---|
| 672 | } |
---|
| 673 | else if ( (selectGroupsInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
| 674 | existInSelect = false; |
---|
| 675 | /////////////////////////////////////////////// |
---|
| 676 | |
---|
| 677 | //Adiciona o a option no select |
---|
| 678 | if(existInSelect == false) |
---|
| 679 | selectGroupsInRule.options[selectGroupsInRule.length] = new Option( text, value ); |
---|
| 680 | |
---|
| 681 | } |
---|
| 682 | } |
---|
| 683 | } |
---|
| 684 | |
---|
| 685 | function removeSelectedsOptions(pSelect) |
---|
| 686 | { |
---|
| 687 | theSel = document.getElementById(pSelect); |
---|
| 688 | var selIndex = theSel.selectedIndex; |
---|
| 689 | |
---|
| 690 | if (selIndex != -1) |
---|
| 691 | { |
---|
| 692 | for(i=theSel.length-1; i>=0; i--) |
---|
| 693 | { |
---|
| 694 | if(theSel.options[i].selected) |
---|
| 695 | theSel.options[i] = null; |
---|
| 696 | } |
---|
| 697 | if (theSel.length > 0) { |
---|
| 698 | theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1; |
---|
| 699 | } |
---|
| 700 | } |
---|
| 701 | |
---|
| 702 | } |
---|
| 703 | |
---|
| 704 | function set_onload() |
---|
| 705 | { |
---|
| 706 | return true; |
---|
| 707 | } |
---|
| 708 | |
---|
| 709 | function finderRecipientInstitutionalAcounteExeption(pSearch) |
---|
| 710 | { |
---|
| 711 | |
---|
| 712 | if(selectRecipientsCloned == false) |
---|
| 713 | { |
---|
| 714 | selectRecipientsClone = Element('inputSelectRecipients').cloneNode(true); |
---|
| 715 | selectRecipientsCloned = true; |
---|
| 716 | } |
---|
| 717 | |
---|
| 718 | |
---|
| 719 | var oText = pSearch; |
---|
| 720 | var selectRecipientsTmp = Element('inputSelectRecipients'); |
---|
| 721 | for(var i = 0;i < selectRecipientsTmp.options.length; i++) |
---|
| 722 | selectRecipientsTmp.options[i--] = null; |
---|
| 723 | var RegExp_name = new RegExp("\\b"+oText.value, "i"); |
---|
| 724 | |
---|
| 725 | |
---|
| 726 | for(i = 0; i < selectRecipientsClone.length; i++){ |
---|
| 727 | if (RegExp_name.test(selectRecipientsClone[i].text) || selectRecipientsClone[i].value =="-1") |
---|
| 728 | { |
---|
| 729 | sel = selectRecipientsTmp.options; |
---|
| 730 | option = new Option(selectRecipientsClone[i].text,selectRecipientsClone[i].value); |
---|
| 731 | if( selectRecipientsClone[i].value == "-1") option.disabled = true; |
---|
| 732 | sel[sel.length] = option; |
---|
| 733 | } |
---|
| 734 | } |
---|
| 735 | } |
---|
| 736 | |
---|
| 737 | function getOptionsSendersInstitutionalAcounteExeption() |
---|
| 738 | { |
---|
| 739 | var selectRecipient = document.getElementById('inputSelectRecipients'); |
---|
| 740 | var selectSenders = document.getElementById('inputSelectSenders'); |
---|
| 741 | |
---|
| 742 | for(var i=0; i < selectSenders.options.length; i++) |
---|
| 743 | { |
---|
| 744 | selectSenders.options[i] = null; |
---|
| 745 | i--; |
---|
| 746 | } |
---|
| 747 | |
---|
| 748 | var index = selectRecipient.selectedIndex; |
---|
| 749 | var value = selectRecipient.options[index].value; |
---|
| 750 | |
---|
| 751 | cExecute ('$this.boconfiguration.getOptionsSenderInstitutionalAcounteExeption&recipient='+value, handlegetOptionsSendersInstitutionalAcounteExeption); |
---|
| 752 | |
---|
| 753 | } |
---|
| 754 | |
---|
| 755 | function handlegetOptionsSendersInstitutionalAcounteExeption(data) |
---|
| 756 | { |
---|
| 757 | |
---|
| 758 | if(data) |
---|
| 759 | { |
---|
| 760 | var selectSenders = document.getElementById('inputSelectSenders'); |
---|
| 761 | var option = data.replace('>*<', '>'+get_lang('all')+'<'); |
---|
| 762 | selectSenders.innerHTML = option; |
---|
| 763 | } |
---|
| 764 | |
---|
| 765 | return; |
---|
| 766 | } |
---|
| 767 | |
---|
| 768 | function saveGlobalSettings() |
---|
| 769 | { |
---|
| 770 | var handlesaveGlobalSettings = function(data) |
---|
| 771 | { |
---|
| 772 | if(data.status) |
---|
| 773 | { |
---|
| 774 | write_msg(get_lang('save sucess') + '.', 'normal'); |
---|
| 775 | } |
---|
| 776 | else |
---|
| 777 | write_msg(data.msg, 'error'); |
---|
| 778 | |
---|
| 779 | } |
---|
| 780 | |
---|
| 781 | var blockComunication = Element('inputCheckAllUserBlockCommunication').checked; |
---|
| 782 | var maximumRecipient = Element('inputTextMaximumRecipientGenerally').value; |
---|
| 783 | |
---|
| 784 | cExecute ('$this.boconfiguration.saveGlobalConfiguration&blockComunication='+blockComunication+'&maximumRecipient='+maximumRecipient, handlesaveGlobalSettings); |
---|
| 785 | } |
---|
| 786 | |
---|
| 787 | function fixBugInnerSelect(objeto,innerHTML){ |
---|
| 788 | /****** |
---|
| 789 | * select_innerHTML - altera o innerHTML de um select independente se é FF ou IE |
---|
| 790 | * Corrige o problema de não ser possível usar o innerHTML no IE corretamente |
---|
| 791 | * Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228 |
---|
| 792 | * Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email. |
---|
| 793 | * Versão: 1.0 - 06/04/2006 |
---|
| 794 | * Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br |
---|
| 795 | * Parametros: |
---|
| 796 | * objeto(tipo object): o select a ser alterado |
---|
| 797 | * innerHTML(tipo string): o novo valor do innerHTML |
---|
| 798 | *******/ |
---|
| 799 | objeto.innerHTML = "" |
---|
| 800 | var selTemp = document.createElement("micoxselect") |
---|
| 801 | var opt; |
---|
| 802 | selTemp.id="micoxselect1" |
---|
| 803 | document.body.appendChild(selTemp) |
---|
| 804 | selTemp = document.getElementById("micoxselect1") |
---|
| 805 | selTemp.style.display="none" |
---|
| 806 | if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto |
---|
| 807 | innerHTML = "<option>" + innerHTML + "</option>" |
---|
| 808 | } |
---|
| 809 | innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span") |
---|
| 810 | selTemp.innerHTML = innerHTML |
---|
| 811 | for(var i=0;i<selTemp.childNodes.length;i++){ |
---|
| 812 | if(selTemp.childNodes[i].tagName){ |
---|
| 813 | opt = document.createElement("OPTION") |
---|
| 814 | for(var j=0;j<selTemp.childNodes[i].attributes.length;j++){ |
---|
| 815 | opt.setAttributeNode(selTemp.childNodes[i].attributes[j].cloneNode(true)) |
---|
| 816 | } |
---|
| 817 | opt.value = selTemp.childNodes[i].getAttribute("value") |
---|
| 818 | opt.text = selTemp.childNodes[i].innerHTML |
---|
| 819 | if(document.all){ //IEca |
---|
| 820 | objeto.add(opt) |
---|
| 821 | }else{ |
---|
| 822 | objeto.appendChild(opt) |
---|
| 823 | } |
---|
| 824 | } |
---|
| 825 | } |
---|
| 826 | document.body.removeChild(selTemp) |
---|
| 827 | selTemp = null |
---|
| 828 | } |
---|