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 | |
---|
293 | if(pClearSearch) |
---|
294 | txtSearch.value = ''; |
---|
295 | |
---|
296 | for(var i = 0;i < SelectResults.options.length; i++) |
---|
297 | SelectResults.options[i--] = null; |
---|
298 | |
---|
299 | |
---|
300 | } |
---|
301 | |
---|
302 | function findGroups(obj, numMin, event) |
---|
303 | { |
---|
304 | |
---|
305 | if( event && event.keyCode !== 13 ) |
---|
306 | return( true ); |
---|
307 | |
---|
308 | |
---|
309 | findGroupsInLdap( obj.id, numMin ); |
---|
310 | |
---|
311 | return( false ); |
---|
312 | } |
---|
313 | |
---|
314 | function findUsers(obj, numMin, event) |
---|
315 | { |
---|
316 | |
---|
317 | if( event && event.keyCode !== 13 ) |
---|
318 | return( true ); |
---|
319 | |
---|
320 | findUsersInLdap( obj.id, numMin ); |
---|
321 | |
---|
322 | return( false ); |
---|
323 | } |
---|
324 | |
---|
325 | function findUsersAndGroups(obj, numMin, event) |
---|
326 | { |
---|
327 | |
---|
328 | if( event && event.keyCode !== 13 ) |
---|
329 | return( true ); |
---|
330 | |
---|
331 | findUsersAndGroupsInLdap(obj.id, numMin); |
---|
332 | |
---|
333 | return( false ); |
---|
334 | } |
---|
335 | |
---|
336 | function findUsersAndGroupsInLdap(id, numMin) |
---|
337 | { |
---|
338 | |
---|
339 | /* var sentence = Element( id ).value; |
---|
340 | |
---|
341 | var url = 'expressoAdmin1_2.boconfiguration.searchUsersAndGroupsForSelect&context=' |
---|
342 | + Element( 'selectOrganizationsInstitutionalAccountModal' ).value |
---|
343 | + '&filter=' + sentence; |
---|
344 | |
---|
345 | var fillHandler = function( fill ){ |
---|
346 | |
---|
347 | return fillContentSelect( fill, 'selectUsersAndGroups' ); |
---|
348 | } |
---|
349 | |
---|
350 | userFinder( sentence, fillHandler, url, 'spanSearching' );*/ |
---|
351 | |
---|
352 | optionFind( id, 'selectUsersAndGroups', 'expressoAdmin1_2.boconfiguration.searchUsersAndGroupsForSelect', |
---|
353 | 'selectOrganizationsInstitutionalAccountModal', 'spanSearching' ); |
---|
354 | } |
---|
355 | |
---|
356 | function findSenders(obj, numMin, event) |
---|
357 | { |
---|
358 | |
---|
359 | if( event && event.keyCode !== 13 ) |
---|
360 | return( true ); |
---|
361 | |
---|
362 | findSendersInLdap( obj.id, numMin ); |
---|
363 | |
---|
364 | return( false ); |
---|
365 | } |
---|
366 | |
---|
367 | function findSendersInLdap(id, numMin) |
---|
368 | { |
---|
369 | // var sentence = Element( id ).value; |
---|
370 | // |
---|
371 | // var url = 'expressoAdmin1_2.boconfiguration.searchInstitutionalAccountsForSelect&context=' |
---|
372 | // + Element( 'selectOrganizationsInstitutionalAccountModal' ).value |
---|
373 | // + '&filter=' + sentence; |
---|
374 | // |
---|
375 | // var fillHandler = function( fill ){ |
---|
376 | // |
---|
377 | // return fillContentSelect( fill, 'selecSenders' ); |
---|
378 | // } |
---|
379 | // |
---|
380 | // userFinder( sentence, fillHandler, url, 'spanSearchingSender' ); |
---|
381 | |
---|
382 | optionFind( id, 'selecSenders', 'expressoAdmin1_2.boconfiguration.searchInstitutionalAccountsForSelect', |
---|
383 | 'selectOrganizationsInstitutionalAccountModal' ,'spanSearchingSender' ); |
---|
384 | } |
---|
385 | |
---|
386 | function handlerGetAvailableSenders(data) |
---|
387 | { |
---|
388 | |
---|
389 | var selectSenders = Element('selecSenders'); |
---|
390 | |
---|
391 | for(var i=0; i < selectSenders.options.length; i++) |
---|
392 | { |
---|
393 | selectSenders.options[i] = null; |
---|
394 | i--; |
---|
395 | } |
---|
396 | |
---|
397 | var options = '###'; |
---|
398 | if (data) { |
---|
399 | |
---|
400 | options += data && data.length > 0 ? data : ''; |
---|
401 | |
---|
402 | if(is_firefox_0) |
---|
403 | fixBugInnerSelect(selectSenders,options); |
---|
404 | else |
---|
405 | selectSenders.innerHTML = options; |
---|
406 | |
---|
407 | selectSenders.outerHTML = selectSenders.outerHTML; |
---|
408 | selectSenders.disabled = false; |
---|
409 | selectSendersClone = Element('selecSenders').cloneNode(true); |
---|
410 | } |
---|
411 | } |
---|
412 | |
---|
413 | function handlerGetAvailableUsersAndGroups(data) |
---|
414 | { |
---|
415 | |
---|
416 | var selectUsersAndGroups = Element('selectUsersAndGroups'); |
---|
417 | |
---|
418 | for(var i=0; i < selectUsersAndGroups.options.length; i++) |
---|
419 | { |
---|
420 | selectUsersAndGroups.options[i] = null; |
---|
421 | i--; |
---|
422 | } |
---|
423 | |
---|
424 | var options = '###'; |
---|
425 | if (data) |
---|
426 | { |
---|
427 | if(data.groups && data.groups.length > 0) { |
---|
428 | data.groups = '<option value="-1" disabled>-------------'+Element("txt_groups").value+' --------- </option>' + data.groups; |
---|
429 | } |
---|
430 | if(data.users && data.users.length > 0) { |
---|
431 | data.users = '<option value="-1" disabled>-------------'+Element("txt_users").value+' ---------</option>' + data.users; |
---|
432 | } |
---|
433 | options += data.groups && data.groups.length > 0 ? data.groups : ''; |
---|
434 | options += data.users && data.users.length > 0 ? data.users : ''; |
---|
435 | |
---|
436 | if(is_firefox_0) |
---|
437 | fixBugInnerSelect(selectUsersAndGroups,options); |
---|
438 | else |
---|
439 | selectUsersAndGroups.innerHTML = options; |
---|
440 | |
---|
441 | selectUsersAndGroups.outerHTML = selectUsersAndGroups.outerHTML; |
---|
442 | selectUsersAndGroups.disabled = false; |
---|
443 | selectUsersClone = Element('selectUsers').cloneNode(true); |
---|
444 | } |
---|
445 | |
---|
446 | } |
---|
447 | |
---|
448 | function findUsersInLdap(id, numMin) |
---|
449 | { |
---|
450 | |
---|
451 | // var sentence = Element( id ).value; |
---|
452 | // |
---|
453 | // var url = 'expressoAdmin1_2.boconfiguration.searchUsersForSelect&context=' |
---|
454 | // + Element( 'selectOrganizationsUserModal' ).value |
---|
455 | // + '&filter=' + sentence; |
---|
456 | // |
---|
457 | // var fillHandler = function( fill ){ |
---|
458 | // |
---|
459 | // return fillContentSelect( fill, 'selectUsers' ); |
---|
460 | // } |
---|
461 | // |
---|
462 | // userFinder( sentence, fillHandler, url, 'spanSearching' ); |
---|
463 | |
---|
464 | optionFind( id, 'selectUsers', 'expressoAdmin1_2.boconfiguration.searchUsersForSelect', |
---|
465 | 'selectOrganizationsUserModal', 'spanSearching' ); |
---|
466 | } |
---|
467 | |
---|
468 | function findGroupsInLdap(id, numMin) |
---|
469 | { |
---|
470 | |
---|
471 | // var sentence = Element( id ).value; |
---|
472 | // |
---|
473 | // var url = 'expressoAdmin1_2.boconfiguration.searchGroupsForSelect&context=' |
---|
474 | // + Element( 'selectOrganizationsGroupModal' ).value |
---|
475 | // + '&filter=' + sentence; |
---|
476 | // |
---|
477 | // var fillHandler = function( fill ){ |
---|
478 | // |
---|
479 | // return fillContentSelect( fill, 'selectGroups' ); |
---|
480 | // } |
---|
481 | // |
---|
482 | // userFinder( sentence, fillHandler, url, 'spanSearching' ); |
---|
483 | |
---|
484 | optionFind( id, 'selectGroups', 'expressoAdmin1_2.boconfiguration.searchGroupsForSelect', |
---|
485 | 'selectOrganizationsGroupModal', 'spanSearching' ); |
---|
486 | } |
---|
487 | |
---|
488 | function handlerGetAvailableUsers(data) |
---|
489 | { |
---|
490 | |
---|
491 | var selectUsers = Element('selectUsers'); |
---|
492 | |
---|
493 | for(var i=0; i < selectUsers.options.length; i++) |
---|
494 | { |
---|
495 | selectUsers.options[i] = null; |
---|
496 | i--; |
---|
497 | } |
---|
498 | |
---|
499 | var options = '###'; |
---|
500 | if (data) { |
---|
501 | |
---|
502 | options += data && data.length > 0 ? data : ''; |
---|
503 | |
---|
504 | if(is_firefox_0) |
---|
505 | fixBugInnerSelect(selectUsers,options); |
---|
506 | else |
---|
507 | selectUsers.innerHTML = options; |
---|
508 | |
---|
509 | selectUsers.outerHTML = selectUsers.outerHTML; |
---|
510 | selectUsers.disabled = false; |
---|
511 | selectUsersClone = Element('selectUsers').cloneNode(true); |
---|
512 | } |
---|
513 | } |
---|
514 | |
---|
515 | function handlerGetAvailableGroups(data) |
---|
516 | { |
---|
517 | |
---|
518 | var selectGroups = Element('selectGroups'); |
---|
519 | |
---|
520 | for(var i=0; i < selectGroups.options.length; i++) |
---|
521 | { |
---|
522 | selectGroups.options[i] = null; |
---|
523 | i--; |
---|
524 | } |
---|
525 | |
---|
526 | var options = '###'; |
---|
527 | if (data) { |
---|
528 | |
---|
529 | options += data && data.length > 0 ? data : ''; |
---|
530 | |
---|
531 | if(is_firefox_0) |
---|
532 | fixBugInnerSelect(selectGroups,options); |
---|
533 | else |
---|
534 | selectGroups.innerHTML = options; |
---|
535 | |
---|
536 | |
---|
537 | selectGroups.outerHTML = selectGroups.outerHTML; |
---|
538 | selectGroups.disabled = false; |
---|
539 | selectGroupsClone = Element('selectGroups').cloneNode(true); |
---|
540 | } |
---|
541 | } |
---|
542 | |
---|
543 | function addUserOrGroupsInInstitutionalAccountRule() |
---|
544 | { |
---|
545 | |
---|
546 | |
---|
547 | var selectUsersAndGroupsInRule = document.getElementById('selectUsersOrGroupsInRule'); |
---|
548 | var selectUsersAndGroups = document.getElementById('selectUsersAndGroups'); |
---|
549 | var selectUsersAndGroupsCount = selectUsersAndGroups.length; |
---|
550 | |
---|
551 | for (i = 0 ; i < selectUsersAndGroupsCount ; i++) |
---|
552 | { |
---|
553 | if (selectUsersAndGroups.options[i].selected) |
---|
554 | { |
---|
555 | //Salva em value do item selecionado |
---|
556 | var value = selectUsersAndGroups.options[i].value; |
---|
557 | var text = selectUsersAndGroups.options[i].text; |
---|
558 | //Asssume-se que ja exite no select |
---|
559 | existInSelect = true; |
---|
560 | |
---|
561 | //Verifica a existencia do usuario no select/// |
---|
562 | if(document.all) |
---|
563 | { |
---|
564 | if ( (selectUsersAndGroupsInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
565 | existInSelect = false; |
---|
566 | } |
---|
567 | else if ( (selectUsersAndGroupsInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
568 | existInSelect = false; |
---|
569 | /////////////////////////////////////////////// |
---|
570 | |
---|
571 | //Adiciona o a option no select |
---|
572 | if(existInSelect == false) |
---|
573 | selectUsersAndGroupsInRule.options[selectUsersAndGroupsInRule.length] = new Option( text, value ); |
---|
574 | |
---|
575 | } |
---|
576 | } |
---|
577 | } |
---|
578 | |
---|
579 | function addSenderInInstitutionalAccountRule() |
---|
580 | { |
---|
581 | |
---|
582 | |
---|
583 | var selectSendersInRule = document.getElementById('selecSendersInRule'); |
---|
584 | var selectSenders = document.getElementById('selecSenders'); |
---|
585 | var selectSendersCount = selectSenders.length; |
---|
586 | |
---|
587 | for (i = 0 ; i < selectSendersCount ; i++) |
---|
588 | { |
---|
589 | if (selectSenders.options[i].selected) |
---|
590 | { |
---|
591 | //Salva em value do item selecionado |
---|
592 | var value = selectSenders.options[i].value; |
---|
593 | var text = selectSenders.options[i].text; |
---|
594 | //Asssume-se que ja exite no select |
---|
595 | existInSelect = true; |
---|
596 | |
---|
597 | //Verifica a existencia do usuario no select/// |
---|
598 | if(document.all) |
---|
599 | { |
---|
600 | if ( (selectSendersInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
601 | existInSelect = false; |
---|
602 | } |
---|
603 | else if ( (selectSendersInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
604 | existInSelect = false; |
---|
605 | /////////////////////////////////////////////// |
---|
606 | |
---|
607 | //Adiciona o a option no select |
---|
608 | if(existInSelect == false) |
---|
609 | selectSendersInRule.options[selectSendersInRule.length] = new Option( text, value ); |
---|
610 | |
---|
611 | } |
---|
612 | } |
---|
613 | } |
---|
614 | |
---|
615 | function addUserInLimitSendersRule() |
---|
616 | { |
---|
617 | var selectUsersInRule = document.getElementById('selectUsersInRule'); |
---|
618 | var selectUsers = document.getElementById('selectUsers'); |
---|
619 | var selectUsersCount = selectUsers.length; |
---|
620 | |
---|
621 | for (i = 0 ; i < selectUsersCount ; i++) |
---|
622 | { |
---|
623 | if (selectUsers.options[i].selected) |
---|
624 | { |
---|
625 | //Salva em value do item selecionado |
---|
626 | var value = selectUsers.options[i].value; |
---|
627 | var text = selectUsers.options[i].text; |
---|
628 | //Asssume-se que ja exite no select |
---|
629 | existInSelect = true; |
---|
630 | |
---|
631 | //Verifica a existencia do usuario no select/// |
---|
632 | if(document.all) |
---|
633 | { |
---|
634 | if ( (selectUsersInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
635 | existInSelect = false; |
---|
636 | } |
---|
637 | else if ( (selectUsersInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
638 | existInSelect = false; |
---|
639 | /////////////////////////////////////////////// |
---|
640 | |
---|
641 | //Adiciona o a option no select |
---|
642 | if(existInSelect == false) |
---|
643 | selectUsersInRule.options[selectUsersInRule.length] = new Option( text, value ); |
---|
644 | |
---|
645 | } |
---|
646 | } |
---|
647 | } |
---|
648 | |
---|
649 | function addGroupInLimitSendersRule() |
---|
650 | { |
---|
651 | var selectGroupsInRule = document.getElementById('selectGroupsInRule'); |
---|
652 | var selectGroups = document.getElementById('selectGroups'); |
---|
653 | var selectGroupsCount = selectGroups.length; |
---|
654 | |
---|
655 | for (i = 0 ; i < selectGroupsCount ; i++) |
---|
656 | { |
---|
657 | if (selectGroups.options[i].selected) |
---|
658 | { |
---|
659 | //Salva em value do item selecionado |
---|
660 | var value = selectGroups.options[i].value; |
---|
661 | var text = selectGroups.options[i].text; |
---|
662 | //Asssume-se que ja exite no select |
---|
663 | existInSelect = true; |
---|
664 | |
---|
665 | //Verifica a existencia do usuario no select/// |
---|
666 | if(document.all) |
---|
667 | { |
---|
668 | if ( (selectGroupsInRule.innerHTML.indexOf('value='+value)) == '-1' ) |
---|
669 | existInSelect = false; |
---|
670 | } |
---|
671 | else if ( (selectGroupsInRule.innerHTML.indexOf('value="'+value+'"')) == '-1' ) |
---|
672 | existInSelect = false; |
---|
673 | /////////////////////////////////////////////// |
---|
674 | |
---|
675 | //Adiciona o a option no select |
---|
676 | if(existInSelect == false) |
---|
677 | selectGroupsInRule.options[selectGroupsInRule.length] = new Option( text, value ); |
---|
678 | |
---|
679 | } |
---|
680 | } |
---|
681 | } |
---|
682 | |
---|
683 | function removeSelectedsOptions(pSelect) |
---|
684 | { |
---|
685 | theSel = document.getElementById(pSelect); |
---|
686 | var selIndex = theSel.selectedIndex; |
---|
687 | |
---|
688 | if (selIndex != -1) |
---|
689 | { |
---|
690 | for(i=theSel.length-1; i>=0; i--) |
---|
691 | { |
---|
692 | if(theSel.options[i].selected) |
---|
693 | theSel.options[i] = null; |
---|
694 | } |
---|
695 | if (theSel.length > 0) { |
---|
696 | theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1; |
---|
697 | } |
---|
698 | } |
---|
699 | |
---|
700 | } |
---|
701 | |
---|
702 | function set_onload() |
---|
703 | { |
---|
704 | return true; |
---|
705 | } |
---|
706 | |
---|
707 | function finderRecipientInstitutionalAcounteExeption(pSearch) |
---|
708 | { |
---|
709 | |
---|
710 | if(selectRecipientsCloned == false) |
---|
711 | { |
---|
712 | selectRecipientsClone = Element('inputSelectRecipients').cloneNode(true); |
---|
713 | selectRecipientsCloned = true; |
---|
714 | } |
---|
715 | |
---|
716 | |
---|
717 | var oText = pSearch; |
---|
718 | var selectRecipientsTmp = Element('inputSelectRecipients'); |
---|
719 | for(var i = 0;i < selectRecipientsTmp.options.length; i++) |
---|
720 | selectRecipientsTmp.options[i--] = null; |
---|
721 | var RegExp_name = new RegExp("\\b"+oText.value, "i"); |
---|
722 | |
---|
723 | |
---|
724 | for(i = 0; i < selectRecipientsClone.length; i++){ |
---|
725 | if (RegExp_name.test(selectRecipientsClone[i].text) || selectRecipientsClone[i].value =="-1") |
---|
726 | { |
---|
727 | sel = selectRecipientsTmp.options; |
---|
728 | option = new Option(selectRecipientsClone[i].text,selectRecipientsClone[i].value); |
---|
729 | if( selectRecipientsClone[i].value == "-1") option.disabled = true; |
---|
730 | sel[sel.length] = option; |
---|
731 | } |
---|
732 | } |
---|
733 | } |
---|
734 | |
---|
735 | function getOptionsSendersInstitutionalAcounteExeption() |
---|
736 | { |
---|
737 | var selectRecipient = document.getElementById('inputSelectRecipients'); |
---|
738 | var selectSenders = document.getElementById('inputSelectSenders'); |
---|
739 | |
---|
740 | for(var i=0; i < selectSenders.options.length; i++) |
---|
741 | { |
---|
742 | selectSenders.options[i] = null; |
---|
743 | i--; |
---|
744 | } |
---|
745 | |
---|
746 | var index = selectRecipient.selectedIndex; |
---|
747 | var value = selectRecipient.options[index].value; |
---|
748 | |
---|
749 | cExecute ('$this.boconfiguration.getOptionsSenderInstitutionalAcounteExeption&recipient='+value, handlegetOptionsSendersInstitutionalAcounteExeption); |
---|
750 | |
---|
751 | } |
---|
752 | |
---|
753 | function handlegetOptionsSendersInstitutionalAcounteExeption(data) |
---|
754 | { |
---|
755 | |
---|
756 | if(data) |
---|
757 | { |
---|
758 | var selectSenders = document.getElementById('inputSelectSenders'); |
---|
759 | var option = data.replace('>*<', '>'+get_lang('all')+'<'); |
---|
760 | selectSenders.innerHTML = option; |
---|
761 | } |
---|
762 | |
---|
763 | return; |
---|
764 | } |
---|
765 | |
---|
766 | function saveGlobalSettings() |
---|
767 | { |
---|
768 | var handlesaveGlobalSettings = function(data) |
---|
769 | { |
---|
770 | if(data.status) |
---|
771 | { |
---|
772 | write_msg(get_lang('save sucess') + '.', 'normal'); |
---|
773 | } |
---|
774 | else |
---|
775 | write_msg(data.msg, 'error'); |
---|
776 | |
---|
777 | } |
---|
778 | |
---|
779 | var blockComunication = Element('inputCheckAllUserBlockCommunication').checked; |
---|
780 | var maximumRecipient = Element('inputTextMaximumRecipientGenerally').value; |
---|
781 | |
---|
782 | cExecute ('$this.boconfiguration.saveGlobalConfiguration&blockComunication='+blockComunication+'&maximumRecipient='+maximumRecipient, handlesaveGlobalSettings); |
---|
783 | } |
---|
784 | |
---|
785 | function fixBugInnerSelect(objeto,innerHTML){ |
---|
786 | /****** |
---|
787 | * select_innerHTML - altera o innerHTML de um select independente se é FF ou IE |
---|
788 | * Corrige o problema de não ser possível usar o innerHTML no IE corretamente |
---|
789 | * Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228 |
---|
790 | * Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email. |
---|
791 | * Versão: 1.0 - 06/04/2006 |
---|
792 | * Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br |
---|
793 | * Parametros: |
---|
794 | * objeto(tipo object): o select a ser alterado |
---|
795 | * innerHTML(tipo string): o novo valor do innerHTML |
---|
796 | *******/ |
---|
797 | objeto.innerHTML = "" |
---|
798 | var selTemp = document.createElement("micoxselect") |
---|
799 | var opt; |
---|
800 | selTemp.id="micoxselect1" |
---|
801 | document.body.appendChild(selTemp) |
---|
802 | selTemp = document.getElementById("micoxselect1") |
---|
803 | selTemp.style.display="none" |
---|
804 | if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto |
---|
805 | innerHTML = "<option>" + innerHTML + "</option>" |
---|
806 | } |
---|
807 | innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span") |
---|
808 | selTemp.innerHTML = innerHTML |
---|
809 | for(var i=0;i<selTemp.childNodes.length;i++){ |
---|
810 | if(selTemp.childNodes[i].tagName){ |
---|
811 | opt = document.createElement("OPTION") |
---|
812 | for(var j=0;j<selTemp.childNodes[i].attributes.length;j++){ |
---|
813 | opt.setAttributeNode(selTemp.childNodes[i].attributes[j].cloneNode(true)) |
---|
814 | } |
---|
815 | opt.value = selTemp.childNodes[i].getAttribute("value") |
---|
816 | opt.text = selTemp.childNodes[i].innerHTML |
---|
817 | if(document.all){ //IEca |
---|
818 | objeto.add(opt) |
---|
819 | }else{ |
---|
820 | objeto.appendChild(opt) |
---|
821 | } |
---|
822 | } |
---|
823 | } |
---|
824 | document.body.removeChild(selTemp) |
---|
825 | selTemp = null |
---|
826 | } |
---|