diff options
author | jeff <jeff> | 2010-01-08 16:05:04 +0000 |
---|---|---|
committer | jeff <jeff> | 2010-01-08 16:05:04 +0000 |
commit | 43e42a04ae37ca7a84c05d9ff8b94d9f8cde6dcf (patch) | |
tree | de3a12b93ad38d24bc15511d87e65ff5a6d3b9cd /httemplate/elements/logout.html | |
parent | 20b563c398c5c9264a998d31ae0d3d95454d526e (diff) |
add a logout link (RT 1330 & 5518)
Diffstat (limited to 'httemplate/elements/logout.html')
-rw-r--r-- | httemplate/elements/logout.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/httemplate/elements/logout.html b/httemplate/elements/logout.html new file mode 100644 index 000000000..313dbfaf1 --- /dev/null +++ b/httemplate/elements/logout.html @@ -0,0 +1,44 @@ +<%doc> + +Example: + + include( '/elements/logout.html'); + This is the <a href="javascript:void()" onClick="logout();">logout</a> link. + +</%doc> +<SCRIPT TYPE="text/javascript"> + + function logout() { + // count args; build URL + var url = "<% $fsurl. 'loginout/logout.html' %>"; + + var xmlhttp = rs_init_object(); + xmlhttp.open("GET", url, false, "magic", "notyet"); + xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); + xmlhttp.send(null); + + if (xmlhttp.readyState != 4) { + alert("Logout failed: readyState is " + xmlhttp.readyState); + return; + } + + if (xmlhttp.status != 200) { + alert("Logout failed: status is " + xmlhttp.status); + } else { + var data = xmlhttp.responseText; + // alert('received response: ' + data); + if ( data.indexOf("<b>System error</b>") > -1 ) { + var w; + if ( w = window.open("about:blank") ) { + w.document.write(data); + } else { + // popup blocking? should use an overlib popup instead + alert("Error popup disabled; try disabling popup blocking to see"); + } + } else { + window.location = "<% $fsurl. 'loginout/logout.html' %>"; + } + } + } + +</SCRIPT> |