function tryLogin() { if (document.frmLogin.tbLogin.value.length==0) { window.alert('Indique por favor o seu nome de utilizador!'); document.frmLogin.tbLogin.focus(); } else if (document.frmLogin.tbPwd.value.length==0) { window.alert('Indique por favor a sua senha secreta!'); document.frmLogin.tbPwd.focus(); } else document.frmLogin.submit(); } function goTo(x) { document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=x; document.frmParameters.submit(); } function setTask(task) { document.frmParameters.task.value=task; document.frmParameters.submit(); } function setId(id, pageIndex) { document.frmParameters.task.value='goto'; document.frmParameters.id.value=id; document.frmParameters.pageIndex.value=pageIndex; document.frmParameters.submit(); } function openWindow(url, width, height, wndName, scroll, resize, menu, toolbar) { var x, y, wnd; x=(window.screen.width-width)/2; y=(window.screen.height-height)/2; if (wndName==null) wndName='myChildWindow'; if (scroll==null) scroll=0; if (resize==null) resize=0; if (menu==null) menu=0; if (toolbar==null) toolbar=0; wnd=window.open(url, wndName, 'left=' + x + ', top=' + y + ', width=' + width + ', height=' + height + ', status=0, toolbar=' + toolbar + ', menubar=' + menu + ', scrollbars=' + scroll + ', resizable=' + resize + ', location=0'); wnd.focus(); } function setCombinedClass(x) { document.frmClass.combinedClass.value=x; document.frmClass.submit(); } function showCalendar() { openWindow('calendar.php', 300, 220, 'wndCal', true, true); } function setDate(day, month, year) { window.opener.document.frmCalendar.Day.value=day; window.opener.document.frmCalendar.Month.value=month; window.opener.document.frmCalendar.Year.value=year; window.opener.document.frmCalendar.submit(); window.close(); } function setMainDate(day, month, year) { document.frmCalendar.Day.value=day; document.frmCalendar.Month.value=month; document.frmCalendar.Year.value=year; document.frmCalendar.submit(); } function showStudentAbsences(idStd, idDis) { document.frmParameters.idStd.value=idStd; document.frmParameters.idDis.value=idDis; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=250; document.frmParameters.submit(); } function showStudentAbsencesMap(idStd, mode) { document.frmParameters.idStd.value=idStd; document.frmParameters.task.value='goto'; if (mode==1) document.frmParameters.pageIndex.value=260; else if (mode==2) document.frmParameters.pageIndex.value=261; document.frmParameters.submit(); } function showNewsFile(id) { document.frmParameters.id.value=id; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=1; document.frmParameters.submit(); } function validateInt(ctrl, min, max) { x=parseInt(ctrl.value); ctrl.value=(((x>=min) && (x<=max))? x:''); } function validateFloat(ctrl, min, max) { x=parseFloat(ctrl.value); ctrl.value=(((x>=min) && (x<=max))? x:''); } function validateChar(ctrl) { ctrl.value=((((ctrl.value>='a') && (ctrl.value<='z')) || ((ctrl.value>='A') && (ctrl.value<='Z')))? ctrl.value:''); } function valPWD() { if(document.frmProfile.pwd1.value != "" && document.frmProfile.pwd1.value == form.pwd2.value) { if(document.frmProfile.pwd1.value.length < 7) { alert("Erro: A senha tem de conter pelo menos sete caracteres!"); document.frmProfile.pwd1.focus(); return false; } re = /[0-9]/; if(!re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos um algarismo (0-9)!"); document.frmProfile.pwd1.focus(); return false; } re = /[a-z]/; if(!re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos uma letra minúscula (a-z)!"); document.frmProfile.pwd1.focus(); return false; } re = /[A-Z]/; if(!re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos uma letra maiúscula (A-Z)!"); document.frmProfile.pwd1.focus(); return false; } } else { alert("Erro: P.f. verifique de digitou a senha e a reconfirmou!"); document.frmProfile.pwd1.focus(); return false; } } function submitProfile() { if ((document.frmProfile.emailLogin) && (((document.frmProfile.emailLogin.value!='') && (document.frmProfile.emailDomain.value=='')) || ((document.frmProfile.emailLogin.value=='') && (document.frmProfile.emailDomain.value!='')))){ window.alert('Erro: Email invalido - corrija, por favor!'); return false; } if (document.frmProfile.pwd1.value!=document.frmProfile.pwd2.value){ window.alert('Erro: P.f. verifique se digitou a senha e a reconfirmou!'); return false; } if(document.frmProfile.pwd1.value.length > 0 && document.frmProfile.pwd1.value.length < 7) { alert("Erro: A senha tem de conter pelo menos sete caracteres!"); document.frmProfile.pwd1.focus(); return false; /* }else if(document.frmProfile.pwd1.value == document.frmProfile.username.value) { alert("Erro: A senha tem de ser diferente do nome de utilizador!"); document.frmProfile.pwd1.focus(); return false; */ } re = /[0-9]/; if(document.frmProfile.pwd1.value.length > 6 && !re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos um algarismo (0-9)!"); document.frmProfile.pwd1.focus(); return false; } re = /[a-z]/; if(document.frmProfile.pwd1.value.length > 6 && !re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos uma letra minúscula (a-z)!"); document.frmProfile.pwd1.focus(); return false; } re = /[A-Z]/; if(document.frmProfile.pwd1.value.length > 6 && !re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos uma letra maiúscula (A-Z)!"); document.frmProfile.pwd1.focus(); return false; } re = /[^A-Za-z0-9]/; if(document.frmProfile.pwd1.value.length > 6 && !re.test(document.frmProfile.pwd1.value)) { alert("Erro: A senha tem de conter pelo menos um caracter não alfa-numérico (<>.:,;-_'?=)(#!|«»)!"); document.frmProfile.pwd1.focus(); return false; } document.frmProfile.submit(); } /*pnsilva*/ function showTeacherAbsencesMap(arg, act, mode) { document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; if (mode==1) document.frmTeacher.pageIndex.value=670; else if (mode==2) document.frmTeacher.pageIndex.value=680; else if (mode==3) document.frmTeacher.pageIndex.value=690; else if (mode==4) document.frmTeacher.pageIndex.value=695; document.frmTeacher.submit(); } function showTeacherAbsences(arg, act) { document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; document.frmTeacher.pageIndex.value=1610; document.frmTeacher.submit(); } function setSumaryIdDis(x) { document.frmQuery.idDis.value=x; document.frmQuery.task.value='goto'; document.frmQuery.pageIndex.value=690; document.frmQuery.submit(); } /*pnsilva*/ // fmartins 070928 function AulaExtra(arg, act){ document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=280; document.frmParameters.submit(); } // FIM fmartins 070928 // pnsilva 071009 function AulaSubs(arg, act){ document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=290; document.frmParameters.submit(); } // FIM pnsilva 071009 // fmartins 110914 function IAS(arg, act){ //IAS--> Instruções para as Aulas de Substituição document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=295; document.frmParameters.submit(); } // FIM fmartins 110914 function classAction(argument, action) { document.frmParameters.Argument.value=argument; document.frmParameters.Action.value=action; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=270; document.frmParameters.submit(); } //pnsilva 20090828 function AulaExtra_cargos(arg, act){ document.frmParameters.Argument.value=arg; document.frmParameters.Action.value=act; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=1820; document.frmParameters.submit(); } function classAction_cargos(argument, action) { document.frmParameters.Argument.value=argument; document.frmParameters.Action.value=action; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=1810; document.frmParameters.submit(); } //FIM pnsilva 20090828 function testNewCommentForm() { if (document.frmNewComment.caption.value.length>0) { if (document.frmNewComment.comment.value.length>0) document.frmNewComment.submit(); else window.alert('Por favor escreva o seu comentario.'); } else window.alert('Por favor declare um titulo para o seu comentario.'); } function testEditCommentForm() { if (document.frmComment.caption.value.length>0) { if (document.frmComment.comment.value.length>0) document.frmComment.submit(); else window.alert('Por favor escreva o texto do comentario.'); } else window.alert('Por favor declare um titulo para o seu comentario.'); } function showGrades(showAll) { document.frmParameters.Argument.value=showAll; document.frmParameters.pageIndex.value=500; document.frmParameters.submit(); } function showGradesBoard(id) { document.frmParameters.id.value=id; document.frmParameters.task.value='goto'; document.frmParameters.pageIndex.value=510; document.frmParameters.submit(); } function printGradesBoard(id) { openWindow('listagens/board_temp.php?id=' + id, 1000, 700, 'wndBoard', 1, 1, 1, 1); } function testLockerForm() { var frm=document.frmLocker; if (frm.cbStatus.value=='null') window.alert('Por favor indique o novo estado do cacifo.'); else if ((frm.cbStatus.value==2) && (frm.cbStudent.value=='null')) window.alert('Por favor indique o novo propeitario do cacifo.'); else if (frm.tbValue.value=='') window.alert('Por favor indique o valor do aluguer do cacifo este ano lectivo.'); else frm.submit(); } function showPrint(path) { openWindow(path, 1000, 700, 'wndPrint', 1, 1, 1, 1); } function testNewTaskForm() { if (document.frmNewTask.name.value.length==0) { window.alert('Indique por favor o nome da nova tarefa.'); document.frmNewTask.name.focus(); } else if (document.frmNewTask.day.value.length==0) { window.alert('Indique por favor o dia da nova tarefa.'); document.frmNewTask.day.focus(); } else if (document.frmNewTask.month.value.length==0) { window.alert('Indique por favor o mes da nova tarefa.'); document.frmNewTask.month.focus(); } else if (document.frmNewTask.year.value.length==0) { window.alert('Indique por favor o ano da nova tarefa.'); document.frmNewTask.year.focus(); } else if (document.frmNewTask.hour.value.length==0) { window.alert('Indique por favor a hora da nova tarefa.'); document.frmNewTask.hour.focus(); } else if (document.frmNewTask.minute.value.length==0) { window.alert('Indique por favor os minutos da nova tarefa.'); document.frmNewTask.minute.focus(); } else document.frmNewTask.submit(); } function testEditTaskForm() { if (document.frmEditTask.name.value.length==0) { window.alert('Indique por favor o nome da tarefa.'); document.frmEditTask.name.focus(); } else if (document.frmEditTask.day.value.length==0) { window.alert('Indique por favor o dia da tarefa.'); document.frmEditTask.day.focus(); } else if (document.frmEditTask.month.value.length==0) { window.alert('Indique por favor o mes da tarefa.'); document.frmEditTask.month.focus(); } else if (document.frmEditTask.year.value.length==0) { window.alert('Indique por favor o ano da tarefa.'); document.frmEditTask.year.focus(); } else if (document.frmEditTask.hour.value.length==0) { window.alert('Indique por favor a hora da tarefa.'); document.frmEditTask.hour.focus(); } else if (document.frmEditTask.minute.value.length==0) { window.alert('Indique por favor os minutos da tarefa.'); document.frmEditTask.minute.focus(); } else document.frmEditTask.submit(); } //XXXXXXXXXXXXXXXXXXXXXXxxxxx //XXXXXXXXXXXXXXXXXXXXXxxxxxxxxx function registerClass() { var cnt=0; var n; //alert(document.frmClassEditor.elements['chkTeacher[]'].length); //quando superuser =260 (nº total de professores) if (document.frmClassEditor.elements['chkTeacher[]'].length>0) { if(document.frmClassEditor.elements['chkTeacher[]'].selectedIndex>0) cnt++; for (n=0; n