Commit 0043d077 authored by haemmer's avatar haemmer
Browse files

Corrected body onLoad issue so that focus now also works

parent 2cc95e41
<?php // Copyright (c) 2011, SWITCH - Serving Swiss Universities ?> <?php // Copyright (c) 2011, SWITCH - Serving Swiss Universities ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html>
<head>
<title><?php echo getLocalString('title') ?></title> <title><?php echo getLocalString('title') ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="Discovery Service, WAYF, Shibboleth"> <meta name="keywords" content="Discovery Service, WAYF, Shibboleth">
<meta name="description" content="Choose your home organization to authenticate"> <meta name="description" content="Choose your home organization to authenticate">
<style type="text/css"><!-- <script language="JavaScript" type="text/javascript">
<? printCSS() ?> <!--
-->
</style> // Prevent that WAYF is loaded in an IFRAME
</head> function preventIframeEmbedding(){
if (top != self) {
<body onLoad="preventIframeEmbedding(); setFocus();"> top.location = self.location;
<script language="JavaScript" type="text/javascript"> }
<!--
function preventIframeEmbedding(){
if (top != self) {
top.location = self.location;
} }
} // Set focus to submit button or drop down list
function setFocus(){
function setFocus(){ // Skip this if we cannot access the form elements
// Skip this if we cannot access the form elements if (
if (!document.IdPList || !document.IdPList.Select){ !document.IdPList ||
return; !document.IdPList.Select
){
return;
}
if (
document.IdPList.user_idp &&
document.IdPList.user_idp.selectedIndex == 0
){
// Set focus to select
document.IdPList.user_idp.focus();
} else {
// Set focus to submit button
document.IdPList.Select.focus();
}
} }
// Set focus to submit button unless autofocus is supported // Confirm action
if (!("autofocus" in document.createElement("input"))) { function showConfirmation(){
document.IdPList.Select.focus();
return confirm(unescape('<?php echo getLocalString('confirm_permanent_selection', 'js') ?>'));
} }
}
function showConfirmation(){
return confirm(unescape('<?php echo getLocalString('confirm_permanent_selection', 'js') ?>')); // Confirm permanent selection
} function showPermanentConfirmation(){
function showPermanentConfirmation(){ return alert(unescape('<?php echo getLocalString('permanent_cookie_note', 'js') ?>'));
}
return alert(unescape('<?php echo getLocalString('permanent_cookie_note', 'js') ?>')); // Perform input validation on WAYF form
} function checkForm(){
if(
function checkForm(){ document.IdPList.user_idp &&
if(document.IdPList.user_idp && document.IdPList.user_idp.selectedIndex == 0){ document.IdPList.user_idp.selectedIndex == 0
alert(unescape('<?php echo getLocalString('make_selection', 'js') ?>')); ){
return false; alert(unescape('<?php echo getLocalString('make_selection', 'js') ?>'));
} else { return false;
if (document.IdPList.permanent && document.IdPList.permanent.checked){
return showConfirmation();
} else { } else {
return true; if (document.IdPList.permanent && document.IdPList.permanent.checked){
return showConfirmation();
} else {
return true;
}
} }
} }
}
//Setup the dom ready event
function DomReady(func){
if(document.addEventListener){
//W3C
document.addEventListener("DOMContentLoaded", func, false);
} else {
//IE
document.onreadystatechange = function(){readyState(func)}
}
}
//IE ready execution function
function readyState(func){
//dom is ready for interaction
if(document.readyState == "interactive"){
func();
}
}
// Init WAYF
function init(){
preventIframeEmbedding();
setFocus();
}
// Add new DomReady function
window.onDomReady = DomReady;
// Attach init function
window.onDomReady(init);
-->
</script>
<style type="text/css">
<!--
<? printCSS() ?>
-->
</style>
</head>
--> <body>
</script>
<div id="container"> <div id="container">
<div class="box"> <div class="box">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment