1 | countFiles = 1; |
---|
2 | function validate_fields(type) |
---|
3 | { |
---|
4 | if (type == 'create_user') |
---|
5 | { |
---|
6 | //UID |
---|
7 | document.forms[0].uid.value = document.forms[0].uid.value.toLowerCase(); |
---|
8 | if (document.forms[0].uid.value == ''){ |
---|
9 | alert('Campo LOGIN está vazio.'); |
---|
10 | return; |
---|
11 | } |
---|
12 | else if (document.forms[0].uid.value.length < document.forms[0].minimumSizeLogin.value){ |
---|
13 | alert('Campo LOGIN deve ter mais que '+document.forms[0].minimumSizeLogin.value+' caracteres.'); |
---|
14 | return; |
---|
15 | } |
---|
16 | |
---|
17 | // Verifica se o delimitador do Cyrus permite ponto (dot.) nas mailboxes; |
---|
18 | if (document.forms[0].imapDelimiter.value == '/') |
---|
19 | var reUid = /^([a-zA-Z0-9_\.\-])+$/; |
---|
20 | else |
---|
21 | var reUid = /^([a-zA-Z0-9_\-])+$/; |
---|
22 | if(!reUid.test(document.forms[0].uid.value)){ |
---|
23 | alert('Campo LOGIN comtém caracteres não permitidos.'); |
---|
24 | document.forms[0].account_lid.focus(); |
---|
25 | return; |
---|
26 | } |
---|
27 | |
---|
28 | //PASSWORD's |
---|
29 | if (document.forms[0].password1.value == ''){ |
---|
30 | alert('Campo SENHA está vazio.'); |
---|
31 | return; |
---|
32 | } |
---|
33 | if (document.forms[0].password2.value == ''){ |
---|
34 | alert('Campo RE-SENHA está vazio.'); |
---|
35 | return; |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | if (document.forms[0].password1.value != document.forms[0].password2.value){ |
---|
40 | alert('Campo SENHA e RE-SENHA são diferentes.'); |
---|
41 | return; |
---|
42 | } |
---|
43 | |
---|
44 | //MAIL |
---|
45 | document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase(); |
---|
46 | if (document.forms[0].mail.value == ''){ |
---|
47 | alert('Campo E-MAIL está vazio.'); |
---|
48 | return; |
---|
49 | } |
---|
50 | var reEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; |
---|
51 | if(!reEmail.test(document.forms[0].mail.value)){ |
---|
52 | alert("Campo E-mail não é válido."); |
---|
53 | return false; |
---|
54 | } |
---|
55 | |
---|
56 | //FIRSTNAME |
---|
57 | if (document.forms[0].givenname.value == ''){ |
---|
58 | alert('Campo PRIMEIRO NOME está vazio.'); |
---|
59 | return; |
---|
60 | } |
---|
61 | |
---|
62 | //LASTNAME |
---|
63 | if (document.forms[0].sn.value == ''){ |
---|
64 | alert('Campo ÚLTIMO NOME está vazio.'); |
---|
65 | return; |
---|
66 | } |
---|
67 | |
---|
68 | //TELEPHONENUMBER |
---|
69 | if (document.forms[0].telephonenumber.value != '') |
---|
70 | { |
---|
71 | reg_tel = /\(\d{2}\)\d{4}-\d{4}$/; |
---|
72 | if (!reg_tel.exec(document.forms[0].telephonenumber.value)) |
---|
73 | { |
---|
74 | alert('Campo Telefone incorreto.'); |
---|
75 | return; |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | //FORWAR ONLY |
---|
80 | if ((document.forms[0].deliverymode.checked) && (document.forms[0].mailforwardingaddress.value == '')){ |
---|
81 | alert('Campo E-MAIL DE ENCAMINHAMENTO está vazio.'); |
---|
82 | return; |
---|
83 | } |
---|
84 | |
---|
85 | // Email Quota |
---|
86 | if (document.forms[0].mailquota.value == ''){ |
---|
87 | alert('Usuário sem COTA.'); |
---|
88 | return; |
---|
89 | } |
---|
90 | |
---|
91 | //GROUPS |
---|
92 | if (document.getElementById('ea_select_user_groups').length < 1){ |
---|
93 | alert('Nenhum GRUPO selecionado.'); |
---|
94 | return; |
---|
95 | } |
---|
96 | |
---|
97 | //SAMBA |
---|
98 | if (document.getElementById('tabcontent6').style.display != 'none'){ |
---|
99 | if ((document.forms[0].sambalogonscript.value == '') && (!document.forms[0].sambalogonscript.disabled)){ |
---|
100 | alert('Script de logon do usuário está vazio.'); |
---|
101 | return; |
---|
102 | } |
---|
103 | if ((document.forms[0].sambahomedirectory.value == '') && (!document.forms[0].sambahomedirectory.disabled)){ |
---|
104 | alert('Diretório Home do usuário está vazio.'); |
---|
105 | return; |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | // Uid & Mail exist? |
---|
110 | var attrs_array = new Array(); |
---|
111 | attrs_array['type'] = type; |
---|
112 | attrs_array['uid'] = document.forms[0].uid.value; |
---|
113 | attrs_array['mail'] = document.forms[0].mail.value; |
---|
114 | if (document.forms[0].mailalternateaddress.value != '') |
---|
115 | attrs_array['mailalternateaddress'] = document.forms[0].mailalternateaddress.value; |
---|
116 | var attributes = connector.serialize(attrs_array); |
---|
117 | |
---|
118 | var handler_validate_fields = function(data) |
---|
119 | { |
---|
120 | if (!data.status) |
---|
121 | alert(data.msg); |
---|
122 | else |
---|
123 | { |
---|
124 | if (type == 'create_user') |
---|
125 | { |
---|
126 | cExecuteForm ("$this.user.create", document.forms[0], handler_create); |
---|
127 | } |
---|
128 | else |
---|
129 | { |
---|
130 | //Turn enabled all checkboxes and inputs |
---|
131 | document.getElementById('changepassword').disabled = false; |
---|
132 | document.getElementById('phpgwaccountstatus').disabled = false; |
---|
133 | document.getElementById('phpgwaccountvisible').disabled = false; |
---|
134 | document.getElementById('telephonenumber').disabled = false; |
---|
135 | document.getElementById('mailforwardingaddress').disabled = false; |
---|
136 | document.getElementById('mailalternateaddress').disabled = false; |
---|
137 | document.getElementById('accountstatus').disabled = false; |
---|
138 | document.getElementById('deliverymode').disabled = false; |
---|
139 | document.getElementById('use_attrs_samba').disabled = false; |
---|
140 | |
---|
141 | table_apps = document.getElementById('ea_table_apps'); |
---|
142 | var inputs = table_apps.getElementsByTagName("input"); |
---|
143 | for (var i = 0; i < inputs.length; i++) |
---|
144 | { |
---|
145 | inputs[i].disabled = false; |
---|
146 | } |
---|
147 | cExecuteForm ("$this.user.save", document.forms[0], handler_save); |
---|
148 | } |
---|
149 | } |
---|
150 | } |
---|
151 | |
---|
152 | // Needed select all options from select |
---|
153 | select_user_maillists = document.getElementById('ea_select_user_maillists'); |
---|
154 | select_user_groups = document.getElementById('ea_select_user_groups'); |
---|
155 | for(var i=0; i<select_user_maillists.options.length; i++) |
---|
156 | select_user_maillists.options[i].selected = true; |
---|
157 | for(var i=0; i<select_user_groups.options.length; i++) |
---|
158 | select_user_groups.options[i].selected = true; |
---|
159 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
---|
160 | |
---|
161 | cExecute ('$this.ldap_functions.validate_fields&attributes='+attributes, handler_validate_fields); |
---|
162 | } |
---|
163 | |
---|
164 | // HANDLER CREATE |
---|
165 | // É necessário 2 funcões de retorno por causa do cExecuteForm. |
---|
166 | function handler_create(data) |
---|
167 | { |
---|
168 | return_handler_create(data); |
---|
169 | } |
---|
170 | function return_handler_create(data) |
---|
171 | { |
---|
172 | if (!data.status) |
---|
173 | alert(data.msg); |
---|
174 | else |
---|
175 | alert('Usuário criado com êxito!'); |
---|
176 | |
---|
177 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
178 | return; |
---|
179 | } |
---|
180 | |
---|
181 | |
---|
182 | // HANDLER SAVE |
---|
183 | // É necessário 2 funcões de retorno por causa do cExecuteForm. |
---|
184 | function handler_save(data) |
---|
185 | { |
---|
186 | return_handler_save(data); |
---|
187 | } |
---|
188 | function return_handler_save(data) |
---|
189 | { |
---|
190 | if (!data.status){ |
---|
191 | alert(data.msg); |
---|
192 | } |
---|
193 | else{ |
---|
194 | alert('Usuário salvo com êxito!!'); |
---|
195 | } |
---|
196 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
197 | return; |
---|
198 | } |
---|
199 | |
---|
200 | function get_available_groups(context) |
---|
201 | { |
---|
202 | var handler_get_available_groups = function(data) |
---|
203 | { |
---|
204 | select_available_groups = document.getElementById('ea_select_available_groups'); |
---|
205 | |
---|
206 | if ((data) && (data.length > 0)) |
---|
207 | { |
---|
208 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
209 | select_available_groups.innerHTML = '#' + data; |
---|
210 | select_available_groups.outerHTML = select_available_groups.outerHTML; |
---|
211 | select_available_groups_clone = select_available_groups.cloneNode(true); |
---|
212 | document.getElementById('ea_input_searchGroup').value = ''; |
---|
213 | } |
---|
214 | else |
---|
215 | { |
---|
216 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
217 | select_available_groups.innerHTML = '#'; |
---|
218 | select_available_groups.outerHTML = select_available_groups.outerHTML; |
---|
219 | } |
---|
220 | } |
---|
221 | |
---|
222 | cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups); |
---|
223 | } |
---|
224 | |
---|
225 | function add_user2group() |
---|
226 | { |
---|
227 | select_available_groups = document.getElementById('ea_select_available_groups'); |
---|
228 | select_user_groups = document.getElementById('ea_select_user_groups'); |
---|
229 | combo_primary_user_group = document.getElementById('ea_combo_primary_user_group'); |
---|
230 | |
---|
231 | for (i = 0 ; i < select_available_groups.length ; i++) |
---|
232 | { |
---|
233 | if (select_available_groups.options[i].selected) |
---|
234 | { |
---|
235 | isSelected = false; |
---|
236 | for(var j = 0;j < select_user_groups.options.length; j++) |
---|
237 | { |
---|
238 | if(select_user_groups.options[j].value == select_available_groups.options[i].value) |
---|
239 | { |
---|
240 | isSelected = true; |
---|
241 | break; |
---|
242 | } |
---|
243 | } |
---|
244 | |
---|
245 | if(!isSelected) |
---|
246 | { |
---|
247 | new_option1 = document.createElement('option'); |
---|
248 | new_option1.value =select_available_groups.options[i].value; |
---|
249 | new_option1.text = select_available_groups.options[i].text; |
---|
250 | new_option1.selected = true; |
---|
251 | select_user_groups.options[select_user_groups.options.length] = new_option1; |
---|
252 | |
---|
253 | new_option2 = document.createElement('option'); |
---|
254 | new_option2.value =select_available_groups.options[i].value; |
---|
255 | new_option2.text = select_available_groups.options[i].text; |
---|
256 | combo_primary_user_group.options[combo_primary_user_group.options.length] = new_option2; |
---|
257 | } |
---|
258 | } |
---|
259 | } |
---|
260 | |
---|
261 | for (j =0; j < select_available_groups.options.length; j++) |
---|
262 | select_available_groups.options[j].selected = false; |
---|
263 | } |
---|
264 | |
---|
265 | function remove_user2group() |
---|
266 | { |
---|
267 | select_user_groups = document.getElementById('ea_select_user_groups'); |
---|
268 | combo_primary_user_group = document.getElementById('ea_combo_primary_user_group'); |
---|
269 | |
---|
270 | var x; |
---|
271 | var j=0; |
---|
272 | var to_remove = new Array(); |
---|
273 | |
---|
274 | for(var i = 0;i < select_user_groups.options.length; i++) |
---|
275 | { |
---|
276 | if(select_user_groups.options[i].selected) |
---|
277 | { |
---|
278 | to_remove[j] = select_user_groups.options[i].value; |
---|
279 | j++; |
---|
280 | select_user_groups.options[i--] = null; |
---|
281 | } |
---|
282 | } |
---|
283 | |
---|
284 | for (x in to_remove) |
---|
285 | { |
---|
286 | for(var i=0; i<combo_primary_user_group.options.length; i++) |
---|
287 | { |
---|
288 | if (combo_primary_user_group.options[i].value == to_remove[x]) |
---|
289 | { |
---|
290 | combo_primary_user_group.options[i] = null; |
---|
291 | } |
---|
292 | } |
---|
293 | } |
---|
294 | } |
---|
295 | |
---|
296 | function get_available_maillists(context) |
---|
297 | { |
---|
298 | var handler_get_available_maillists = function(data) |
---|
299 | { |
---|
300 | select_available_maillists = document.getElementById('ea_select_available_maillists'); |
---|
301 | |
---|
302 | if ((data) && (data.length > 0)) |
---|
303 | { |
---|
304 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
305 | select_available_maillists.innerHTML = '#' + data; |
---|
306 | select_available_maillists.outerHTML = select_available_maillists.outerHTML; |
---|
307 | select_available_maillists_clone = select_available_maillists.cloneNode(true); |
---|
308 | document.getElementById('ea_input_searchMailList').value = ''; |
---|
309 | } |
---|
310 | else |
---|
311 | { |
---|
312 | // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. |
---|
313 | select_available_maillists.innerHTML = '#'; |
---|
314 | select_available_maillists.outerHTML = select_available_maillists.outerHTML; |
---|
315 | } |
---|
316 | } |
---|
317 | cExecute ('$this.ldap_functions.get_available_maillists&context='+context, handler_get_available_maillists); |
---|
318 | } |
---|
319 | |
---|
320 | function add_user2maillist() |
---|
321 | { |
---|
322 | select_available_maillists = document.getElementById('ea_select_available_maillists'); |
---|
323 | select_user_maillists = document.getElementById('ea_select_user_maillists'); |
---|
324 | |
---|
325 | for (i = 0 ; i < select_available_maillists.length ; i++) |
---|
326 | { |
---|
327 | |
---|
328 | if (select_available_maillists.options[i].selected) |
---|
329 | { |
---|
330 | isSelected = false; |
---|
331 | for(var j = 0;j < select_user_maillists.options.length; j++) |
---|
332 | { |
---|
333 | if(select_user_maillists.options[j].value == select_available_maillists.options[i].value) |
---|
334 | { |
---|
335 | isSelected = true; |
---|
336 | break; |
---|
337 | } |
---|
338 | } |
---|
339 | |
---|
340 | if(!isSelected) |
---|
341 | { |
---|
342 | new_option = document.createElement('option'); |
---|
343 | new_option.value =select_available_maillists.options[i].value; |
---|
344 | new_option.text = select_available_maillists.options[i].text; |
---|
345 | new_option.selected = true; |
---|
346 | |
---|
347 | select_user_maillists.options[select_user_maillists.options.length] = new_option; |
---|
348 | } |
---|
349 | } |
---|
350 | } |
---|
351 | |
---|
352 | for (j =0; j < select_available_maillists.options.length; j++) |
---|
353 | select_available_maillists.options[j].selected = false; |
---|
354 | } |
---|
355 | |
---|
356 | function remove_user2maillist() |
---|
357 | { |
---|
358 | select_user_maillists = document.getElementById('ea_select_user_maillists'); |
---|
359 | |
---|
360 | for(var i = 0;i < select_user_maillists.options.length; i++) |
---|
361 | if(select_user_maillists.options[i].selected) |
---|
362 | select_user_maillists.options[i--] = null; |
---|
363 | } |
---|
364 | |
---|
365 | function sinc_combos_org(context) |
---|
366 | { |
---|
367 | combo_org_groups = document.getElementById('ea_combo_org_groups'); |
---|
368 | combo_org_maillists = document.getElementById('ea_combo_org_maillists'); |
---|
369 | |
---|
370 | for (i=0; i<combo_org_groups.length; i++) |
---|
371 | { |
---|
372 | if (combo_org_groups.options[i].value == context) |
---|
373 | { |
---|
374 | combo_org_groups.options[i].selected = true; |
---|
375 | combo_org_maillists.options[i].selected = true; |
---|
376 | } |
---|
377 | } |
---|
378 | } |
---|
379 | |
---|
380 | function use_samba_attrs(value) |
---|
381 | { |
---|
382 | if (value) |
---|
383 | { |
---|
384 | if (document.forms[0].sambalogonscript.value == '') |
---|
385 | { |
---|
386 | if (document.forms[0].defaultLogonScript.value == '') |
---|
387 | { |
---|
388 | document.forms[0].sambalogonscript.value = document.forms[0].uid.value + '.bat'; |
---|
389 | } |
---|
390 | else |
---|
391 | { |
---|
392 | document.forms[0].sambalogonscript.value = document.forms[0].defaultLogonScript.value; |
---|
393 | } |
---|
394 | } |
---|
395 | if (document.forms[0].sambahomedirectory.value == '') |
---|
396 | { |
---|
397 | document.forms[0].sambahomedirectory.value = '/home/'+document.forms[0].uid.value+'/'; |
---|
398 | } |
---|
399 | } |
---|
400 | |
---|
401 | if (!document.forms[0].use_attrs_samba.disabled) |
---|
402 | { |
---|
403 | document.forms[0].sambaacctflags.disabled = !value; |
---|
404 | document.forms[0].sambadomain.disabled = !value; |
---|
405 | document.forms[0].sambalogonscript.disabled = !value; |
---|
406 | document.forms[0].sambahomedirectory.disabled = !value; |
---|
407 | } |
---|
408 | } |
---|
409 | |
---|
410 | function set_user_default_password() |
---|
411 | { |
---|
412 | var handler_set_user_default_password = function(data) |
---|
413 | { |
---|
414 | if (!data.status) |
---|
415 | alert(data.msg); |
---|
416 | else |
---|
417 | { |
---|
418 | alert('Senha default cadastrada com êxito!!'); |
---|
419 | //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
420 | } |
---|
421 | return; |
---|
422 | } |
---|
423 | cExecute ('$this.user.set_user_default_password&uid='+document.forms[0].uid.value, handler_set_user_default_password); |
---|
424 | } |
---|
425 | |
---|
426 | function return_user_password() |
---|
427 | { |
---|
428 | var handler_return_user_password = function(data) |
---|
429 | { |
---|
430 | if (!data.status) |
---|
431 | alert(data.msg); |
---|
432 | else |
---|
433 | { |
---|
434 | alert('Senha do usuário retornado com êxito!!'); |
---|
435 | //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
436 | } |
---|
437 | return; |
---|
438 | } |
---|
439 | cExecute ('$this.user.return_user_password&uid='+document.forms[0].uid.value, handler_return_user_password); |
---|
440 | } |
---|
441 | |
---|
442 | function delete_user(uid, uidnumber, context) |
---|
443 | { |
---|
444 | if (confirm("Realmente deletar usuário " + uid + " ??")) |
---|
445 | { |
---|
446 | var handler_delete_user = function(data) |
---|
447 | { |
---|
448 | if (!data.status) |
---|
449 | alert(data.msg); |
---|
450 | else |
---|
451 | alert('Usuário deletado com êxito!!'); |
---|
452 | |
---|
453 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
454 | return; |
---|
455 | } |
---|
456 | cExecute ('$this.user.delete&uidnumber='+uidnumber+'&context='+context, handler_delete_user); |
---|
457 | } |
---|
458 | } |
---|
459 | |
---|
460 | function rename_user(uid, uidnumber, context) |
---|
461 | { |
---|
462 | |
---|
463 | if (document.getElementById('accounts_form_imapDelimiter').value == '/') |
---|
464 | var reUid = /^([a-zA-Z0-9_\.\-])+$/; |
---|
465 | else |
---|
466 | var reUid = /^([a-zA-Z0-9_\-])+$/; |
---|
467 | |
---|
468 | new_uid = prompt("Alterar login do usuário " + uid + " para: ", uid); |
---|
469 | |
---|
470 | if(!reUid.test(new_uid)){ |
---|
471 | alert('Campo LOGIN comtém caracteres não permitidos.'); |
---|
472 | document.forms[0].account_lid.focus(); |
---|
473 | return; |
---|
474 | } |
---|
475 | |
---|
476 | if ((new_uid) && (new_uid != uid)) |
---|
477 | { |
---|
478 | var handler_validate_fields = function(data) |
---|
479 | { |
---|
480 | if (!data.status) |
---|
481 | alert(data.msg); |
---|
482 | else |
---|
483 | cExecute ('$this.user.rename&uid='+uid+'&new_uid='+new_uid+'&context='+context, handler_rename); |
---|
484 | |
---|
485 | return; |
---|
486 | } |
---|
487 | |
---|
488 | // New uid exist? |
---|
489 | attrs_array = new Array(); |
---|
490 | attrs_array['type'] = 'rename_user'; |
---|
491 | attrs_array['uid'] = new_uid; |
---|
492 | attributes = connector.serialize(attrs_array); |
---|
493 | |
---|
494 | cExecute ('$this.ldap_functions.validate_fields&attributes='+attributes, handler_validate_fields); |
---|
495 | } |
---|
496 | } |
---|
497 | |
---|
498 | // HANDLER RENAME |
---|
499 | function handler_rename(data) |
---|
500 | { |
---|
501 | if (!data.status) |
---|
502 | alert(data.msg); |
---|
503 | else{ |
---|
504 | alert("Usuário renomeado com êxito!\n" + data.exec_return); |
---|
505 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
506 | } |
---|
507 | return; |
---|
508 | |
---|
509 | } |
---|
510 | |
---|
511 | |
---|
512 | // Variaveis Locais |
---|
513 | var finderTimeout_maillist = ''; |
---|
514 | |
---|
515 | // Funcoes Find MailList |
---|
516 | function optionFinderTimeout_maillist(obj) |
---|
517 | { |
---|
518 | clearTimeout(finderTimeout_maillist); |
---|
519 | var oWait = document.getElementById("ea_span_searching_maillist"); |
---|
520 | oWait.innerHTML = 'Buscando...'; |
---|
521 | finderTimeout_maillist = setTimeout("optionFinder_maillist('"+obj.id+"')",500); |
---|
522 | } |
---|
523 | function optionFinder_maillist(id) { |
---|
524 | var oWait = document.getElementById("ea_span_searching_maillist"); |
---|
525 | var oText = document.getElementById(id); |
---|
526 | |
---|
527 | //Limpa todo o select |
---|
528 | for(var i = 0;i < select_available_maillists.options.length; i++) |
---|
529 | select_available_maillists.options[i--] = null; |
---|
530 | |
---|
531 | var RegExp_name = new RegExp(oText.value, "i"); |
---|
532 | |
---|
533 | //Inclui as listas começando com a pesquisa |
---|
534 | for(i = 0; i < select_available_maillists_clone.length; i++){ |
---|
535 | if (RegExp_name.test(select_available_maillists_clone[i].text)) |
---|
536 | { |
---|
537 | sel = select_available_maillists.options; |
---|
538 | option = new Option(select_available_maillists_clone[i].text,select_available_maillists_clone[i].value); |
---|
539 | sel[sel.length] = option; |
---|
540 | } |
---|
541 | } |
---|
542 | oWait.innerHTML = ' '; |
---|
543 | } |
---|
544 | |
---|
545 | // Variaveis Locais |
---|
546 | var finderTimeout_group = ''; |
---|
547 | |
---|
548 | |
---|
549 | // Funcoes Find Group |
---|
550 | function optionFinderTimeout_group(obj) |
---|
551 | { |
---|
552 | clearTimeout(finderTimeout_group); |
---|
553 | var oWait = document.getElementById("ea_span_searching_group"); |
---|
554 | oWait.innerHTML = 'Buscando...'; |
---|
555 | finderTimeout_group = setTimeout("optionFinder_group('"+obj.id+"')",500); |
---|
556 | } |
---|
557 | function optionFinder_group(id) { |
---|
558 | var oWait = document.getElementById("ea_span_searching_group"); |
---|
559 | var oText = document.getElementById(id); |
---|
560 | |
---|
561 | //Limpa todo o select |
---|
562 | for(var i = 0;i < select_available_groups.options.length; i++) |
---|
563 | select_available_groups.options[i--] = null; |
---|
564 | |
---|
565 | var RegExp_name = new RegExp(oText.value, "i"); |
---|
566 | |
---|
567 | //Inclui as listas começando com a pesquisa |
---|
568 | for(i = 0; i < select_available_groups_clone.length; i++){ |
---|
569 | if (RegExp_name.test(select_available_groups_clone[i].text)) |
---|
570 | { |
---|
571 | sel = select_available_groups.options; |
---|
572 | option = new Option(select_available_groups_clone[i].text,select_available_groups_clone[i].value); |
---|
573 | sel[sel.length] = option; |
---|
574 | } |
---|
575 | } |
---|
576 | oWait.innerHTML = ' '; |
---|
577 | } |
---|
578 | |
---|
579 | function get_available_sambadomains(context, type) |
---|
580 | { |
---|
581 | if ((type == 'create_user') && (document.getElementById('tabcontent6').style.display != 'none')) |
---|
582 | { |
---|
583 | var handler_get_available_sambadomains = function(data) |
---|
584 | { |
---|
585 | document.forms[0].use_attrs_samba.checked = data.status; |
---|
586 | use_samba_attrs(data.status); |
---|
587 | |
---|
588 | if (data.status) |
---|
589 | { |
---|
590 | combo_sambadomains = document.getElementById('ea_combo_sambadomains'); |
---|
591 | for (i=0; i<data.sambaDomains.length; i++) |
---|
592 | { |
---|
593 | for (j=0; j<combo_sambadomains.length; j++) |
---|
594 | { |
---|
595 | if (combo_sambadomains.options[j].text == data.sambaDomains[i]) |
---|
596 | { |
---|
597 | combo_sambadomains.options[j].selected = true; |
---|
598 | break; |
---|
599 | } |
---|
600 | } |
---|
601 | } |
---|
602 | |
---|
603 | } |
---|
604 | } |
---|
605 | cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains); |
---|
606 | } |
---|
607 | } |
---|