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 | 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 | 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 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
193 | } |
---|
194 | else{ |
---|
195 | alert('Usuário salvo com êxito!!'); |
---|
196 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
197 | } |
---|
198 | return; |
---|
199 | } |
---|
200 | |
---|
201 | |
---|
202 | function get_sectors(organization, user_context, user_sector) |
---|
203 | { |
---|
204 | return; |
---|
205 | var handler_get_sectors = function(data) |
---|
206 | { |
---|
207 | select_sector = document.getElementById('ea_select_sectors'); |
---|
208 | //Limpa o select |
---|
209 | for(var i=0; i<select_sector.options.length; i++) |
---|
210 | { |
---|
211 | if(select_sector.options[i].selected == true) |
---|
212 | { |
---|
213 | select_sector.options[i] = null; |
---|
214 | i--; |
---|
215 | } |
---|
216 | } |
---|
217 | |
---|
218 | if (data.length > 0) |
---|
219 | { |
---|
220 | option_seleted = false; |
---|
221 | |
---|
222 | new_option = new Option('Sem Setor','',false,false); |
---|
223 | select_sector.options[0] = new_option; |
---|
224 | |
---|
225 | for (i=0; i<data.length; i++) |
---|
226 | { |
---|
227 | new_option = new Option(data[i].sector,data[i].sector,false,false); |
---|
228 | select_sector.options[i+1] = new_option; |
---|
229 | if ((user_sector == data[i].sector) && (user_context == organization)) |
---|
230 | { |
---|
231 | select_sector.options[i+1].selected = true; |
---|
232 | option_seleted = true; |
---|
233 | } |
---|
234 | } |
---|
235 | select_sector.disabled = false; |
---|
236 | if (!option_seleted) |
---|
237 | select_sector.options[0].selected = true; |
---|
238 | } |
---|
239 | else |
---|
240 | { |
---|
241 | new_option = new Option('Nenhum setor cadastrado para esta organização.','',false,false); |
---|
242 | select_sector.options[0] = new_option; |
---|
243 | select_sector.options[0].selected = true; |
---|
244 | } |
---|
245 | } |
---|
246 | cExecute ('$this.db_functions.get_sectors&organization='+organization, handler_get_sectors); |
---|
247 | } |
---|
248 | |
---|
249 | function get_available_groups(context) |
---|
250 | { |
---|
251 | var handler_get_available_groups = function(data) |
---|
252 | { |
---|
253 | select_available_groups = document.getElementById('ea_select_available_groups'); |
---|
254 | //Limpa o select |
---|
255 | for(var i=0; i<select_available_groups.options.length; i++) |
---|
256 | { |
---|
257 | select_available_groups.options[i] = null; |
---|
258 | i--; |
---|
259 | } |
---|
260 | |
---|
261 | if (data.length > 0) |
---|
262 | { |
---|
263 | for (i=0; i<data.length; i++) |
---|
264 | { |
---|
265 | new_option = new Option(data[i].cn[0],data[i].gidnumber[0],false,false); |
---|
266 | select_available_groups.options[i] = new_option; |
---|
267 | } |
---|
268 | //select_available_groups.disabled = false; |
---|
269 | select_available_groups.options[0].selected = true; |
---|
270 | select_available_groups_clone = select_available_groups.cloneNode(true); |
---|
271 | document.getElementById('ea_input_searchGroup').value = ''; |
---|
272 | |
---|
273 | } |
---|
274 | } |
---|
275 | |
---|
276 | cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups); |
---|
277 | } |
---|
278 | |
---|
279 | |
---|
280 | function add_user2group() |
---|
281 | { |
---|
282 | select_available_groups = document.getElementById('ea_select_available_groups'); |
---|
283 | select_user_groups = document.getElementById('ea_select_user_groups'); |
---|
284 | combo_primary_user_group = document.getElementById('ea_combo_primary_user_group'); |
---|
285 | |
---|
286 | for (i = 0 ; i < select_available_groups.length ; i++) |
---|
287 | { |
---|
288 | if (select_available_groups.options[i].selected) |
---|
289 | { |
---|
290 | isSelected = false; |
---|
291 | for(var j = 0;j < select_user_groups.options.length; j++) |
---|
292 | { |
---|
293 | if(select_user_groups.options[j].value == select_available_groups.options[i].value) |
---|
294 | { |
---|
295 | isSelected = true; |
---|
296 | break; |
---|
297 | } |
---|
298 | } |
---|
299 | |
---|
300 | if(!isSelected) |
---|
301 | { |
---|
302 | new_option1 = document.createElement('option'); |
---|
303 | new_option1.value =select_available_groups.options[i].value; |
---|
304 | new_option1.text = select_available_groups.options[i].text; |
---|
305 | new_option1.selected = true; |
---|
306 | select_user_groups.options[select_user_groups.options.length] = new_option1; |
---|
307 | |
---|
308 | new_option2 = document.createElement('option'); |
---|
309 | new_option2.value =select_available_groups.options[i].value; |
---|
310 | new_option2.text = select_available_groups.options[i].text; |
---|
311 | combo_primary_user_group.options[combo_primary_user_group.options.length] = new_option2; |
---|
312 | } |
---|
313 | } |
---|
314 | } |
---|
315 | |
---|
316 | for (j =0; j < select_available_groups.options.length; j++) |
---|
317 | select_available_groups.options[j].selected = false; |
---|
318 | } |
---|
319 | |
---|
320 | function remove_user2group() |
---|
321 | { |
---|
322 | select_user_groups = document.getElementById('ea_select_user_groups'); |
---|
323 | combo_primary_user_group = document.getElementById('ea_combo_primary_user_group'); |
---|
324 | |
---|
325 | var x; |
---|
326 | var j=0; |
---|
327 | var to_remove = new Array(); |
---|
328 | |
---|
329 | for(var i = 0;i < select_user_groups.options.length; i++) |
---|
330 | { |
---|
331 | if(select_user_groups.options[i].selected) |
---|
332 | { |
---|
333 | to_remove[j] = select_user_groups.options[i].value; |
---|
334 | j++; |
---|
335 | select_user_groups.options[i--] = null; |
---|
336 | } |
---|
337 | } |
---|
338 | |
---|
339 | for (x in to_remove) |
---|
340 | { |
---|
341 | for(var i=0; i<combo_primary_user_group.options.length; i++) |
---|
342 | { |
---|
343 | if (combo_primary_user_group.options[i].value == to_remove[x]) |
---|
344 | { |
---|
345 | combo_primary_user_group.options[i] = null; |
---|
346 | } |
---|
347 | } |
---|
348 | } |
---|
349 | |
---|
350 | //return; |
---|
351 | /* |
---|
352 | //Refaz combo do primary group |
---|
353 | for(var i=0; i<combo_primary_user_group.options.length; i++) |
---|
354 | { |
---|
355 | if(combo_primary_user_group.options[i].selected == true) |
---|
356 | { |
---|
357 | var user_primary_group = combo_primary_user_group.options[i].value; |
---|
358 | alert(user_primary_group); |
---|
359 | } |
---|
360 | |
---|
361 | combo_primary_user_group.options[i] = null; |
---|
362 | i--; |
---|
363 | } |
---|
364 | |
---|
365 | for(var i = 0;i < select_user_groups.options.length; i++) |
---|
366 | { |
---|
367 | new_option = document.createElement('option'); |
---|
368 | new_option.value= select_user_groups.options[i].value; |
---|
369 | new_option.text = select_user_groups.options[i].text; |
---|
370 | |
---|
371 | if (user_primary_group == select_user_groups.options[i].value) |
---|
372 | new_option.selected = true; |
---|
373 | |
---|
374 | combo_primary_user_group.options[i] = new_option; |
---|
375 | }*/ |
---|
376 | } |
---|
377 | |
---|
378 | function get_available_maillists(context) |
---|
379 | { |
---|
380 | var handler_get_available_maillists = function(data) |
---|
381 | { |
---|
382 | select_available_maillists = document.getElementById('ea_select_available_maillists'); |
---|
383 | //Limpa o select |
---|
384 | for(var i=0; i<select_available_maillists.options.length; i++) |
---|
385 | { |
---|
386 | select_available_maillists.options[i] = null; |
---|
387 | i--; |
---|
388 | } |
---|
389 | |
---|
390 | if (data.length > 0) |
---|
391 | { |
---|
392 | for (i=0; i<data.length; i++) |
---|
393 | { |
---|
394 | new_option = new Option(data[i].uid[0]+' ('+data[i].mail[0]+')', data[i].uidnumber[0], false, false); |
---|
395 | select_available_maillists.options[i] = new_option; |
---|
396 | } |
---|
397 | select_available_maillists.disabled = false; |
---|
398 | select_available_maillists.options[0].selected = true; |
---|
399 | select_available_maillists_clone = select_available_maillists.cloneNode(true); |
---|
400 | document.getElementById('ea_input_searchMailList').value = ''; |
---|
401 | } |
---|
402 | } |
---|
403 | |
---|
404 | cExecute ('$this.ldap_functions.get_available_maillists&context='+context, handler_get_available_maillists); |
---|
405 | } |
---|
406 | |
---|
407 | function add_user2maillist() |
---|
408 | { |
---|
409 | select_available_maillists = document.getElementById('ea_select_available_maillists'); |
---|
410 | select_user_maillists = document.getElementById('ea_select_user_maillists'); |
---|
411 | |
---|
412 | for (i = 0 ; i < select_available_maillists.length ; i++) |
---|
413 | { |
---|
414 | |
---|
415 | if (select_available_maillists.options[i].selected) |
---|
416 | { |
---|
417 | isSelected = false; |
---|
418 | for(var j = 0;j < select_user_maillists.options.length; j++) |
---|
419 | { |
---|
420 | if(select_user_maillists.options[j].value == select_available_maillists.options[i].value) |
---|
421 | { |
---|
422 | isSelected = true; |
---|
423 | break; |
---|
424 | } |
---|
425 | } |
---|
426 | |
---|
427 | if(!isSelected) |
---|
428 | { |
---|
429 | new_option = document.createElement('option'); |
---|
430 | new_option.value =select_available_maillists.options[i].value; |
---|
431 | new_option.text = select_available_maillists.options[i].text; |
---|
432 | new_option.selected = true; |
---|
433 | |
---|
434 | select_user_maillists.options[select_user_maillists.options.length] = new_option; |
---|
435 | } |
---|
436 | } |
---|
437 | } |
---|
438 | |
---|
439 | for (j =0; j < select_available_maillists.options.length; j++) |
---|
440 | select_available_maillists.options[j].selected = false; |
---|
441 | } |
---|
442 | |
---|
443 | function remove_user2maillist() |
---|
444 | { |
---|
445 | select_user_maillists = document.getElementById('ea_select_user_maillists'); |
---|
446 | |
---|
447 | for(var i = 0;i < select_user_maillists.options.length; i++) |
---|
448 | if(select_user_maillists.options[i].selected) |
---|
449 | select_user_maillists.options[i--] = null; |
---|
450 | } |
---|
451 | |
---|
452 | function sinc_combos_org(context) |
---|
453 | { |
---|
454 | combo_org_groups = document.getElementById('ea_combo_org_groups'); |
---|
455 | combo_org_maillists = document.getElementById('ea_combo_org_maillists'); |
---|
456 | |
---|
457 | for (i=0; i<combo_org_groups.length; i++) |
---|
458 | { |
---|
459 | if (combo_org_groups.options[i].value == context) |
---|
460 | { |
---|
461 | combo_org_groups.options[i].selected = true; |
---|
462 | combo_org_maillists.options[i].selected = true; |
---|
463 | } |
---|
464 | } |
---|
465 | } |
---|
466 | |
---|
467 | function use_samba_attrs(value) |
---|
468 | { |
---|
469 | if (value) |
---|
470 | { |
---|
471 | if (document.forms[0].sambalogonscript.value == '') |
---|
472 | { |
---|
473 | if (document.forms[0].defaultLogonScript.value == '') |
---|
474 | { |
---|
475 | document.forms[0].sambalogonscript.value = document.forms[0].uid.value + '.bat'; |
---|
476 | } |
---|
477 | else |
---|
478 | { |
---|
479 | document.forms[0].sambalogonscript.value = document.forms[0].defaultLogonScript.value; |
---|
480 | } |
---|
481 | } |
---|
482 | if (document.forms[0].sambahomedirectory.value == '') |
---|
483 | { |
---|
484 | document.forms[0].sambahomedirectory.value = '/home/'+document.forms[0].uid.value+'/'; |
---|
485 | } |
---|
486 | } |
---|
487 | |
---|
488 | document.forms[0].sambaacctflags.disabled = !value; |
---|
489 | document.forms[0].sambalogonscript.disabled = !value; |
---|
490 | document.forms[0].sambahomedirectory.disabled = !value; |
---|
491 | } |
---|
492 | |
---|
493 | function set_user_default_password() |
---|
494 | { |
---|
495 | var handler_set_user_default_password = function(data) |
---|
496 | { |
---|
497 | if (!data.status) |
---|
498 | alert(data.msg); |
---|
499 | else |
---|
500 | { |
---|
501 | alert('Senha default cadastrada com êxito!!'); |
---|
502 | //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
503 | } |
---|
504 | return; |
---|
505 | } |
---|
506 | cExecute ('$this.user.set_user_default_password&uid='+document.forms[0].uid.value, handler_set_user_default_password); |
---|
507 | } |
---|
508 | |
---|
509 | function return_user_password() |
---|
510 | { |
---|
511 | var handler_return_user_password = function(data) |
---|
512 | { |
---|
513 | if (!data.status) |
---|
514 | alert(data.msg); |
---|
515 | else |
---|
516 | { |
---|
517 | alert('Senha do usuário retornado com êxito!!'); |
---|
518 | //location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
519 | } |
---|
520 | return; |
---|
521 | } |
---|
522 | cExecute ('$this.user.return_user_password&uid='+document.forms[0].uid.value, handler_return_user_password); |
---|
523 | } |
---|
524 | |
---|
525 | function delete_user(uid, uidnumber, context) |
---|
526 | { |
---|
527 | if (confirm("Realmente deletar usuário " + uid + " ??")) |
---|
528 | { |
---|
529 | var handler_delete_user = function(data) |
---|
530 | { |
---|
531 | if (!data.status) |
---|
532 | alert(data.msg); |
---|
533 | else |
---|
534 | alert('Usuário deletado com êxito!!'); |
---|
535 | |
---|
536 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
537 | return; |
---|
538 | } |
---|
539 | cExecute ('$this.user.delete&uidnumber='+uidnumber+'&context='+context, handler_delete_user); |
---|
540 | } |
---|
541 | } |
---|
542 | |
---|
543 | function rename_user(uid, uidnumber, context) |
---|
544 | { |
---|
545 | |
---|
546 | if (document.getElementById('accounts_form_imapDelimiter').value == '/') |
---|
547 | var reUid = /^([a-zA-Z0-9_\.\-])+$/; |
---|
548 | else |
---|
549 | var reUid = /^([a-zA-Z0-9_\-])+$/; |
---|
550 | |
---|
551 | new_uid = prompt("Alterar login do usuário " + uid + " para: ", uid); |
---|
552 | |
---|
553 | if(!reUid.test(new_uid)){ |
---|
554 | alert('Campo LOGIN comtém caracteres não permitidos.'); |
---|
555 | document.forms[0].account_lid.focus(); |
---|
556 | return; |
---|
557 | } |
---|
558 | |
---|
559 | if ((new_uid) && (new_uid != uid)) |
---|
560 | { |
---|
561 | var handler_validate_fields = function(data) |
---|
562 | { |
---|
563 | if (!data.status) |
---|
564 | alert(data.msg); |
---|
565 | else |
---|
566 | cExecute ('$this.user.rename&uid='+uid+'&new_uid='+new_uid+'&context='+context, handler_rename); |
---|
567 | |
---|
568 | return; |
---|
569 | } |
---|
570 | |
---|
571 | // New uid exist? |
---|
572 | attrs_array = new Array(); |
---|
573 | attrs_array['type'] = 'rename_user'; |
---|
574 | attrs_array['uid'] = new_uid; |
---|
575 | attributes = connector.serialize(attrs_array); |
---|
576 | |
---|
577 | cExecute ('$this.ldap_functions.validate_fields&attributes='+attributes, handler_validate_fields); |
---|
578 | } |
---|
579 | } |
---|
580 | |
---|
581 | // HANDLER RENAME |
---|
582 | function handler_rename(data) |
---|
583 | { |
---|
584 | if (!data.status) |
---|
585 | alert(data.msg); |
---|
586 | else{ |
---|
587 | alert("Usuário renomeado com êxito!\n" + data.exec_return); |
---|
588 | location.href="./index.php?menuaction=expressoAdmin1_2.uiaccounts.list_users"; |
---|
589 | } |
---|
590 | return; |
---|
591 | |
---|
592 | } |
---|
593 | |
---|
594 | |
---|
595 | // Variaveis Locais |
---|
596 | var finderTimeout_maillist = ''; |
---|
597 | |
---|
598 | // Funcoes Find MailList |
---|
599 | function optionFinderTimeout_maillist(obj) |
---|
600 | { |
---|
601 | clearTimeout(finderTimeout_maillist); |
---|
602 | var oWait = document.getElementById("ea_span_searching_maillist"); |
---|
603 | oWait.innerHTML = 'Buscando...'; |
---|
604 | finderTimeout_maillist = setTimeout("optionFinder_maillist('"+obj.id+"')",500); |
---|
605 | } |
---|
606 | function optionFinder_maillist(id) { |
---|
607 | var oWait = document.getElementById("ea_span_searching_maillist"); |
---|
608 | var oText = document.getElementById(id); |
---|
609 | |
---|
610 | //Limpa todo o select |
---|
611 | for(var i = 0;i < select_available_maillists.options.length; i++) |
---|
612 | select_available_maillists.options[i--] = null; |
---|
613 | |
---|
614 | var RegExp_name = new RegExp(oText.value, "i"); |
---|
615 | |
---|
616 | //Inclui as listas começando com a pesquisa |
---|
617 | for(i = 0; i < select_available_maillists_clone.length; i++){ |
---|
618 | if (RegExp_name.test(select_available_maillists_clone[i].text)) |
---|
619 | { |
---|
620 | sel = select_available_maillists.options; |
---|
621 | option = new Option(select_available_maillists_clone[i].text,select_available_maillists_clone[i].value); |
---|
622 | sel[sel.length] = option; |
---|
623 | } |
---|
624 | } |
---|
625 | oWait.innerHTML = ' '; |
---|
626 | } |
---|
627 | |
---|
628 | // Variaveis Locais |
---|
629 | var finderTimeout_group = ''; |
---|
630 | |
---|
631 | |
---|
632 | // Funcoes Find Group |
---|
633 | function optionFinderTimeout_group(obj) |
---|
634 | { |
---|
635 | clearTimeout(finderTimeout_group); |
---|
636 | var oWait = document.getElementById("ea_span_searching_group"); |
---|
637 | oWait.innerHTML = 'Buscando...'; |
---|
638 | finderTimeout_group = setTimeout("optionFinder_group('"+obj.id+"')",500); |
---|
639 | } |
---|
640 | function optionFinder_group(id) { |
---|
641 | var oWait = document.getElementById("ea_span_searching_group"); |
---|
642 | var oText = document.getElementById(id); |
---|
643 | |
---|
644 | //Limpa todo o select |
---|
645 | for(var i = 0;i < select_available_groups.options.length; i++) |
---|
646 | select_available_groups.options[i--] = null; |
---|
647 | |
---|
648 | var RegExp_name = new RegExp(oText.value, "i"); |
---|
649 | |
---|
650 | //Inclui as listas começando com a pesquisa |
---|
651 | for(i = 0; i < select_available_groups_clone.length; i++){ |
---|
652 | if (RegExp_name.test(select_available_groups_clone[i].text)) |
---|
653 | { |
---|
654 | sel = select_available_groups.options; |
---|
655 | option = new Option(select_available_groups_clone[i].text,select_available_groups_clone[i].value); |
---|
656 | sel[sel.length] = option; |
---|
657 | } |
---|
658 | } |
---|
659 | oWait.innerHTML = ' '; |
---|
660 | } |
---|