blob: ec2c134acb1d7f2586b8c17e12bc46518c94c663 [file] [log] [blame]
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head><title>Loading...</title></head>
<body><div id="message" style="position:absolute;left:40%;top:40%">
Your browser does not support JavaScript.
Click <a href="$$noscriptUrl$$">here</a> to continue without JavaScript.
</div></body>
<script type="text/javascript" >
function isHtml5() {
try {
return !!localStorage.getItem;
} catch(e) {
return false;
}
}
function unstringify(serialized) {
if (JSON) {
return JSON.parse(serialized);
}
return serialized.split("|||");
}
function getOldBody() {
if (window.name.length != null) {
return localStorage.getItem(window.name + '_body');
}
}
function getOldBodyAttrs() {
if (window.name.length != null) {
return localStorage.getItem(window.name + '_bodyAttrs');
}
}
function getOldCss() {
if (window.name.length != null) {
return unstringify(localStorage.getItem(window.name + '_css'));
}
}
function addCss(url) {
var newSS = document.createElement("style");
newSS.setAttribute("rel", "stylesheet");
newSS.setAttribute("type", "text/css");
newSS.appendChild(document.createTextNode("@import url(" +url + ");"));
document.getElementsByTagName("head")[0].appendChild(newSS);
}
function loadCss(clean) {
if (!isHtml5()) { // only do this stuff on html browsers
return;
}
var oldCss = getOldCss();
if (window.name && oldCss) {
for (i=0; oldCss && i< oldCss.length; i++) {
addCss(oldCss[i]);
}
if (clean) {
localStorage.removeItem(window.name + '_css');
}
}
}
function replaceContent() {
if (!isHtml5()) { // only do this stuff on html browsers
document.getElementById('message').textContent = "Loading...";
return;
}
loadCss(false);
var oldBody = getOldBody();
if (window.name && oldBody) {
document.body.innerHTML = oldBody;
//X TODO should restore all attribs of the body tag
document.body.setAttribute("class", getOldBodyAttrs());
document.body.setAttribute("style", " cursor: wait !important;");
localStorage.removeItem(window.name + '_body');
localStorage.removeItem(window.name + '_bodyAttrs');
// overlay the doc with an un-clickable full-size div
var newDiv = document.createElement("div");
newDiv.setAttribute("style", "position:absolute; z-index:1000; background-color:transparent; top:0; left:0; width:100%; height: 100%");
newDiv.setAttribute("class", "fulldiv");
document.body.appendChild(newDiv);
} else {
document.getElementById('message').textContent = "Loading...";
}
}
function setUrlParam(baseUrl, paramName, paramValue) {
var query = baseUrl;
var vars = query.split(/&|\?/g);
var newQuery = "";
var iParam = 0;
var paramFound = false;
for (var i=0; vars != null && i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair.length == 1) {
newQuery = pair[0];
}
else {
if (pair[0] != paramName) {
var amp = iParam++ > 0 ? "&" : "?";
newQuery = newQuery + amp + pair[0] + "=" + pair[1];
} else {
paramFound = true;
var amp = iParam++ > 0 ? "&" : "?";
newQuery = newQuery + amp + paramName + "=" + paramValue;
}
}
}
if (!paramFound) {
var amp = iParam++ > 0 ? "&" : "?";
newQuery = newQuery + amp + paramName + "=" + paramValue;
}
return newQuery;
}
replaceContent();
window.onload = function() {
loadCss(true);
// this will be replaced in the phase listener
var windowId = '$$windowIdValue$$';
if (windowId == 'uninitializedWindowId') {
windowId = window.name
}
if (!windowId || windowId.length < 3) {
// request a new windowId
windowId = 'automatedEntryPoint';
}
window.name = windowId;
/* used to debug the intermediate page
if (!confirm('reload?')) { return true; }
*/
// 2 seconds expiry time
var expdt = new Date();
expdt.setTime(expdt.getTime()+(2*1000));
var expires = "; expires="+expdt.toGMTString();
var requestToken = Math.floor(Math.random()*10001);
var newUrl = setUrlParam(window.location.href, "mfRid", requestToken);
newUrl = setUrlParam(newUrl, "windowId", windowId);
document.cookie = requestToken + '-codiWindowId=' + windowId + expires;
window.location = newUrl;
}
</script>
</html>