Commit 515bc0e7 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Fixes to the activity log window for Safari and Chrome, which both

have the same problem; webkit does not allow a parent page to look
inside the docment of a child iframe. Not sue if this is a bug or a
function of new security model, but nonetheless, the trick no longer
works. Need a new trick.
parent 813e8db3
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2006-2009 University of Utah and the Flux Group.
* Copyright (c) 2006-2010 University of Utah and the Flux Group.
* All rights reserved.
*/
/*
......@@ -10,6 +10,7 @@
var user_agent = navigator.userAgent.toLowerCase();
var is_safari = false;
var is_firefox = false;
var is_chrome = false;
if (user_agent.indexOf("safari") != -1) {
is_safari = true;
......@@ -17,6 +18,10 @@ if (user_agent.indexOf("safari") != -1) {
if (user_agent.indexOf("firefox") != -1) {
is_firefox = true;
}
if (user_agent.indexOf("chrome") != -1) {
is_chrome = true;
is_safari = false;
}
/* Clear the various 'loading' indicators. */
function ClearBusyIndicators(done_msg)
......@@ -132,7 +137,8 @@ function SetupOutputArea(id, clean) {
Iframe.style.border = "2px solid";
Iframe.style.width = "98%";
Iframe.height = winheight;
Iframe.style.height = winheight + "px";
Iframe.height = winheight + "px";
Iframe.width = "98%";
Iframe.scrolling = "auto";
Iframe.frameBorder = "1";
......@@ -143,6 +149,8 @@ function HideFrame(id) {
var IframeDoc = IframeDocument(id);
Iframe.style.border = "0px none";
Iframe.style.width = 0;
Iframe.style.height = 0;
Iframe.frameBorder = 0;
Iframe.height = 0;
Iframe.width = 0;
......@@ -151,36 +159,12 @@ function HideFrame(id) {
function ShowDownLoader(id) {
var Iframe = getObjbyName(id);
var IframeDoc = IframeDocument(id);
var winheight = 0;
var yoff = 0;
// This tells us the total height of the browser window.
if (window.innerHeight) // all except Explorer
winheight = window.innerHeight;
else if (document.documentElement &&
document.documentElement.clientHeight)
// Explorer 6 Strict Mode
winheight = document.documentElement.clientHeight;
else if (document.body)
// other Explorers
winheight = document.body.clientHeight;
// Now get the Y offset of the outputframe.
yoff = Iframe.offsetTop;
if (winheight != 0) {
// Now calculate how much room is left and make the iframe
// big enough to use most of the rest of the window.
if (yoff != 0)
winheight = winheight - (yoff + 175);
else
winheight = winheight * 0.7;
}
var winheight = GetMaxHeight(id);
Iframe.style.border = "2px solid";
Iframe.height = winheight;
Iframe.style.width = "98%";
Iframe.style.height = winheight + "px";
Iframe.height = winheight + "px";
Iframe.width = "98%";
Iframe.scrolling = "auto";
Iframe.frameBorder = "1";
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2006-2008 University of Utah and the Flux Group.
* Copyright (c) 2006-2008, 2010 University of Utah and the Flux Group.
* All rights reserved.
*/
var LOG_STATE_LOADING = 1;
......@@ -174,6 +174,15 @@ function ml_getScrollHeight() {
* @param state The state of the download.
*/
function ml_handleReadyState(state) {
if (is_chrome || is_safari) {
if (state == LOG_STATE_LOADING) {
clearInterval(upInterval);
}
else if (state == LOG_STATE_LOADED) {
ml_loadFinished();
}
return;
}
var Iframe = getObjbyName('outputframe');
var idoc = IframeDocument('outputframe');
var oa = idoc.getElementById('outputarea');
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005-2008 University of Utah and the Flux Group.
# Copyright (c) 2005-2010 University of Utah and the Flux Group.
# All rights reserved.
#
require_once("Sajax.php");
......@@ -127,14 +127,20 @@ function STARTLOG($object)
src='mungelog.js'>
</script>\n";
echo "<script type='text/javascript' language='javascript'>\n";
echo "SetupOutputArea('outputframe', true);\n";
echo "if (is_chrome == false && is_safari == false) {
SetupOutputArea('outputframe', true);
}\n";
echo "</script><div>
<iframe id='downloader' name='downloader'
class='downloader' src='$url'
onload='ml_handleReadyState(LOG_STATE_LOADED);'>
</iframe></div>\n";
echo "<script type='text/javascript' language='javascript'>\n";
echo "if (is_chrome || is_safari) {
HideFrame('outputframe');
ShowDownLoader('downloader');
}\n";
echo "</script>";
}
# See if this request is to one of the above functions. Does not return
......
Supports Markdown
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