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 ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<html>
<head>
<title><?php echo getLocalString('title') ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="Discovery Service, WAYF, Shibboleth">
<meta name="description" content="Choose your home organization to authenticate">
<style type="text/css"><!--
<? printCSS() ?>
-->
</style>
</head>
<body onLoad="preventIframeEmbedding(); setFocus();">
<script language="JavaScript" type="text/javascript">
<!--
<script language="JavaScript" type="text/javascript">
<!--
function preventIframeEmbedding(){
// Prevent that WAYF is loaded in an IFRAME
function preventIframeEmbedding(){
if (top != self) {
top.location = self.location;
}
}
}
function setFocus(){
// Set focus to submit button or drop down list
function setFocus(){
// Skip this if we cannot access the form elements
if (!document.IdPList || !document.IdPList.Select){
if (
!document.IdPList ||
!document.IdPList.Select
){
return;
}
// Set focus to submit button unless autofocus is supported
if (!("autofocus" in document.createElement("input"))) {
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();
}
}
}
function showConfirmation(){
// Confirm action
function showConfirmation(){
return confirm(unescape('<?php echo getLocalString('confirm_permanent_selection', 'js') ?>'));
}
}
function showPermanentConfirmation(){
// Confirm permanent selection
function showPermanentConfirmation(){
return alert(unescape('<?php echo getLocalString('permanent_cookie_note', 'js') ?>'));
}
}
function checkForm(){
if(document.IdPList.user_idp && document.IdPList.user_idp.selectedIndex == 0){
// Perform input validation on WAYF form
function checkForm(){
if(
document.IdPList.user_idp &&
document.IdPList.user_idp.selectedIndex == 0
){
alert(unescape('<?php echo getLocalString('make_selection', 'js') ?>'));
return false;
} else {
......@@ -55,10 +65,49 @@ function checkForm(){
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>
-->
</script>
<body>
<div id="container">
<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