function resize() { if ( window.innerHeight ){ document.getElementById("Data").height=window.innerHeight-101; }else{ document.getElementById("Data").height=document.body.offsetHeight-101; } } //==== Funcoes de keepalive var KeepAliveRate=60000; var KeepAliveAbortID; var KeepAliveInterval; var KeepAliveSendID=0; var KeepAliveRetryID=0; function keepalive_start() { KeepAliveRetryID=0; KeepAliveInterval = window.setTimeout("keepalive_send()", KeepAliveRate); } function keepalive_stop() { if ( KeepAliveInterval ) clearTimeout(KeepAliveInterval); if ( KeepAliveAbortID ) clearTimeout(KeepAliveAbortID); } function keepalive_send() { KeepAliveAbortID = window.setTimeout("keepalive_dead()", 15000) window.status=""; //Keepalive.location='session/'+SessionID+'/session.php?OP=KEEPALIVE&ID='+KeepAliveSendID; Keepalive.location.replace('session/'+SessionID+'/session.php?OP=KEEPALIVE&ID='+KeepAliveSendID); KeepAliveSendID++; } function keepalive_ack() { clearTimeout(KeepAliveAbortID); keepalive_start(); } function keepalive_dead() { if ( KeepAliveRetryID++ < 4 ){ window.status="Retry "+KeepAliveRetryID; keepalive_send(); }else{ alert('Foi detectado um erro de comunicação, pelo que a sua sessão vai ser encerrada!' ); // WarnLogout=false; location='http://escolas.internet.gov.pt'; } } //====================================== var SyncLock=false; var SessionID; function abort() { var mywin; if ( !SessionID ) return; mywin=window.open('', 'mywin', 'dependent=yes,toolbar=no,location=no,directories=no,status=no,menubar=0,scrollbars=no,resizable=no,copyhistory=no,width=200,height=20,top=1,left=1'); if ( !mywin ){ alert("escolas.internet.gov.pt:\n_____________________________________________________________\n\n\nO seu browser parece estar configurado com inibição de abertura de janelas\n(Popup windows) para este site!\n\nPara evitar esta mensagem e garantir o devido encerramento de próximas\nsessões em \"escolas.internet.gov.pt\" retire esta restrição de bloqueio do\nseu browser.\n______________________\n\n"); window.location='session/'+SessionID+'/session.php?OP=ABORTREDIR'; return; } // mywin.document.open(); mywin.document.writeln('
Aguarde por favor...
'); mywin.document.writeln(''); mywin.document.writeln(''); mywin.document.close(); mywin.focus(); // alert('A sessão na qual se encontra foi encerrada!'); } var start=0; function logout_animate() { var rate=10; if ( start > 0 ){ start--; document.getElementById("Banner").style.top=parseInt(((-20/rate)*start+20))+'px';; window.setTimeout("logout_animate()", 25) }else{ if ( WinFull ) window_min(); keepalive_stop(); Keepalive.location='session/'+SessionID+'/session.php?OP=LOGOUT'; document.login.Password.value=''; document.login.User.readOnly=''; document.login.User.style.fontWeight="normal"; document.login.User.style.color="black"; // document.login.User.style.backgroundColor="rgb(240,240,240)"; // document.login.User.style.border="1px solid gray"; document.getElementById('Chave').style.visibility='visible'; SessionID=null; Data.location='/home/home.php?GO=Notícias'; if (typeof Admin != 'undefined') window.close(); } } function login_animate() { var rate=10; if ( start < rate ){ start++; document.getElementById("Banner").style.top=parseInt(((-20/rate)*start+20))+'px';; window.setTimeout("login_animate()", 25) }else{ Toolbar.location='session/'+SessionID+'/menu.php'; if (StartURL) Data.location.replace(StartURL); } } var BannerWidth, DataWidth, NewWidth, OrigWidth, step=5, StartURL, WinFull; function window_full_animate(url) { step=parseInt(1+(NewWidth-BannerWidth)/2); if ( BannerWidth+step > NewWidth ) step=1; if ( BannerWidth < NewWidth ){ BannerWidth+=step; DataWidth+=step; parent.document.getElementById('Banner').style.width=BannerWidth; parent.document.getElementById('Data').style.width=DataWidth; parent.document.getElementById('Toolbar').style.width=DataWidth; window.setTimeout("window_full_animate()", 100) }else login_animate(); } function window_min_animate() { step=parseInt(1+(BannerWidth-OrigWidth)/2); if ( BannerWidth-step < OrigWidth ) step=1; if ( BannerWidth > 800 ){ BannerWidth-=step; DataWidth-=step; parent.document.getElementById('Banner').style.width=BannerWidth; parent.document.getElementById('Data').style.width=DataWidth; parent.document.getElementById('Toolbar').style.width=DataWidth; window.setTimeout("window_min_animate()", 100) } (parent.document.getElementById('Banner')).document.getElementById('home').style.width=130; } function window_full(url) { (parent.document.getElementById('Banner')).document.getElementById('home').style.width=200; BannerWidth=parseInt(parent.document.getElementById('Banner').style.width); OrigWidth=BannerWidth; DataWidth=parseInt(parent.document.getElementById('Data').width); NewWidth=parseInt(parent.document.body.offsetWidth-40); window_full_animate(url); } function window_min() { window_min_animate(); } function login_try(form) { if ( SyncLock || SessionID ) return false; form.User.value=form.User.value.replace(/^ */g, ""); form.User.value=form.User.value.replace(/ *$/g, ""); form.User.value=form.User.value.replace(/@.*/g, ""); if (!form.User.value) { alert("Esqueceu-se de inserir o \"Utilizador\" !"); form.User.focus() return false; } form.Password.value=form.Password.value.replace(/^ */g, ""); form.Password.value=form.Password.value.replace(/ *$/g, ""); if (!form.Password.value) { alert("Esqueceu-se de inserir a \"Password\" !"); form.Password.focus() return false; } form.JavaEnabled.value=1; SyncLock=true; return true; } function logout() { if ( SyncLock || !SessionID ) return false; if ( confirm('Escolha "OK" para confirmar o encerramento da sua sessão.') ){ document.getElementById('SC_Container').style.display='none'; //top.document.getElementById('Data').style.marginLeft=0; document.getElementById('DataLeft').style.width=0; // logout_animate(); document.getElementById('Logedin').style.display='none'; /* document.getElementById('LoginForm').style.display='block'; document.getElementById('Logname').innerHTML=''; */ keepalive_stop(); Keepalive.location='session/'+SessionID+'/session.php?OP=LOGOUT'; // document.login.Password.value=''; SessionID=null; Toolbar.location='/no-toolbar.html'; Data.location='/auth.php'; } } function get_sidemenu(id) { var req = false; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); if (req.overrideMimeType) req.overrideMimeType('text/xml'); } else if (window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert('O seu browser não suporta esta função!');} } } if (!req) { alert('O seu browser não suporta esta função!'); return false; } req.onreadystatechange = function(){ if (req.readyState == 4) { switch(req.status) { case 200: document.getElementById('SMMenu').innerHTML=req.responseText; SC_setup(); break; case 404: break; default: alert('Ocorreu um erro com o pedido:'+req.status+'|'+req.responseText); break; } } }; req.open('GET', 'session/'+id+'/sidemenu.php', true); req.send(null); } function setup_session(id,user,level,winfull,url) //function setup_session(id,user,level,url) { var rate=25; SessionID=id; StartURL=url; WinFull=winfull; /* document.login.User.readOnly="readonly"; document.login.User.value=user; document.login.User.style.fontWeight="bold"; document.login.User.style.color="rgb(204, 102, 0)"; document.login.User.style.backgroundColor="white"; document.login.User.style.border="1px solid white"; document.getElementById('Chave').style.visibility='hidden'; */ // document.getElementById('LoginForm').style.display='none'; document.getElementById('Logedin').style.display='block'; document.getElementById('Logname').innerHTML=user; keepalive_start(); Toolbar.location='session/'+SessionID+'/menu.php'; if (StartURL) Data.location.replace(StartURL); get_sidemenu(id); /* if ( winfull ) window_full(); else login_animate(); if (url) Data.location=url; if ( winfull ) alert('ok'); */ } function getElementLeft(t) { var off; for (off=0; t.offsetParent; off+=t.offsetLeft, t=t.offsetParent); return off; } function getElementTop(t) { var off; for (off=0; t.offsetParent; off+=t.offsetTop, t=t.offsetParent); return off; } function menu_do(op,uri) { parent.Data.location='session/'+SessionID+'/'+uri; document.getElementById('operacao').innerHTML='::'+op+'>'; menu_hide(); } function menu_hide() { document.getElementById('MenuList').style.visibility="hidden"; } function auth_go(uri) { // Data.document.open(); // Data.document.write('Aguarde por favor...'); // Data.document.close(); Data.location=uri; } function data_go(uri) { // Data.document.open(); // Data.document.write('Aguarde por favor...'); // data.document.close(); Data.location.pathname=uri; alert(Data.location); } function show_menu(t) { var i=1,v; var menu=''; while ( (v=t.getAttribute('option'+i)) ) { menu=menu+' '+v+''; document.getElementById('MenuList').innerHTML=menu; i++; } document.getElementById('MenuList').style.top=getElementTop(t)+t.offsetHeight; document.getElementById('MenuList').style.left=getElementLeft(t)+2; // document.getElementById('MenuList').style.width=t.offsetWidth; document.getElementById('MenuList').style.visibility="visible"; }