1 var menulist = new Array();
6 var top=100; /* (10-screen.height); */
7 var left=100; /*(10-screen.width); */
10 window.open('./aide/help.php?hid='+hid,'help','top='+top+',left='+left+',width='+largeur+',height='+hauteur+',scrollbars=yes');
14 chk=document.getElementById('checkall').checked;
15 for (var i = 0; i < document.main.elements.length; i++) {
16 if(document.main.elements[i].type == 'checkbox'){
17 document.main.elements[i].checked = chk;
23 * Function :is_valid_mail
24 * @param : interger arg, an RFC 2822 mail adress
25 * @return : true if arg really is formed like described in RFC 2822, else false
26 * FIXME: does this function is used anywhere ? if yes, remove it, see http://www.bortzmeyer.org/arreter-d-interdire-des-adresses-legales.html
28 function is_valid_mail(arg) {
29 //FIXME mail documentation doesn't expect a maximum length of the mail address : http://tools.ietf.org/html/rfc2822#section-3.4.1
30 var rgxp = /^[a-z0-9\!\#\$\%\&\'\*+/=?^_`{|}~-]{1,}((\.[a-z0-9\!\#\$\%\&\'\*+/=?^_`{|}~-]{1,13})?)+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?$/
31 if(rgxp.test(arg) == false) {
39 function menu_toggle(id) {
40 $("#"+id).toggle(200, function() {
42 // Animation complete.
43 if ($("#"+id).is(":hidden")) {
44 $("#"+id+"-img").attr("src","images/menu_plus.png");
45 tmpi[''+id] = 'hidden';
47 $("#"+id+"-img").attr("src","images/menu_moins.png");
48 tmpi[''+id] = 'visible';
50 $.post('tempovars.php', { 'key' : 'menu_toggle', 'val' : tmpi })
55 function false_if_empty(id,err_msg) {
56 if ( $("#"+id).val() == '' ) {
62 function generate_password(passwordLength, classcount) {
63 passwordLength = parseInt(passwordLength);
67 classcount = parseInt(classcount);
71 var numberChars = "0123456789";
72 var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
73 var lowerChars = "abcdefghiklmnopqrstuvwxyz";
74 var specialchars = "(!#$%&'()*+,-./:;<=>?@[\]^_";
76 if (classcount >= 4) {
77 var allChars = numberChars + upperChars + lowerChars + specialchars;
79 var allChars = numberChars + upperChars + lowerChars;
81 var randPasswordArray = Array(passwordLength);
82 randPasswordArray[0] = numberChars;
83 randPasswordArray[1] = upperChars;
84 randPasswordArray[2] = lowerChars;
85 if (classcount == 4) {
86 randPasswordArray[3] = specialchars;
87 randPasswordArray = randPasswordArray.fill(allChars, 4);
89 randPasswordArray = randPasswordArray.fill(allChars, 3);
92 return shuffleArray(randPasswordArray.map(function(x) { return x[Math.floor(Math.random() * x.length)] })).join('');
95 function shuffleArray(array) {
96 for (var i = array.length - 1; i > 0; i--) {
97 var j = Math.floor(Math.random() * (i + 1));
105 function generate_password_html(id, size, field1, field2, classcount) {
106 $("#z"+id).html("<input id='inp"+id+
107 "' type='textbox' size=8 readonly='readonly' value='"+generate_password(size, classcount)+
108 "' /> <a href='javascript:generate_password_html("+id+","+size+",\""+field1+"\",\""+field2+
109 "\");'><img src='/images/refresh.png' alt='Refresh' title='Refresh'/></a>");
110 $("#inp"+id).focus();
111 $("#inp"+id).select();
112 if (field1 != "") { $(field1).val( $("#inp"+id).val() ); }
113 if (field2 != "") { $(field2).val( $("#inp"+id).val() ); }