Skip to content

Commit

Permalink
initial display of agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharmakeerthi De Soysa committed Nov 13, 2015
1 parent b2c105f commit cc5f205
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions DigitalDisplay/resources/www/_system/current_resource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "http://localhost:8000/page12", "version": "1.0.0", "agent": "displayagent"}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions DigitalDisplay/resources/www/_system/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript">
var currentFrame = "iFrameName1";
var tempFrame = "iFrameName2";
var configJsonFile = "current_resource.json";
var startupHtmlFile = "loading.html";
var pollingInterval = 2000;
var transitionDelay = 2000;

function ajax(method, url, successCallback, errorCallback) {
var xhr;

if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xhr = new XMLHttpRequest();
} else { // code for IE6, IE5
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}

xhr.onreadystatechange = function () {
if (xhr.readyState == XMLHttpRequest.DONE) {
if (xhr.status == 200) { if(successCallback) successCallback(xhr.responseText, xhr);
return xhr.responseText; }
else {
if(errorCallback) errorCallback(xhr);
return;
}
}
};

xhr.open(method, url, true);

try {
xhr.send();
} catch ( e ) {
if ( errorCallback ) { throw e; }
}
}

function swapFrameRoles(a, b) {
var t = a;
a = b;
b = t;
}

function swapFrames(a, b){
document.getElementById(a).style.display = 'none';
document.getElementById(b).style.display = 'block';
document.getElementById(a).src = "";
swapFrameRoles(a, b);
}

function urlChange(url) {
document.getElementById(tempFrame).src = url;
}

function getCurrentUrl(currentUrl) {
var newPath = currentUrl; //setting default
var successCallback = function(data){
var path = JSON.parse(data).path;
//alert(path);
if(path && path != "" && newPath != path) {newPath = path; urlChange(newPath);}
};
ajax("GET", configJsonFile, successCallback);
setTimeout(function(){getCurrentUrl(newPath)}, pollingInterval);
}

window.onload = function () {
document.getElementById(tempFrame).onload = function () {
setTimeout(function() {swapFrames(currentFrame, tempFrame)}, transitionDelay);
};
getCurrentUrl(startupHtmlFile);
};
</script>
</head>
<body>
<!-- <div id="content">-->
<iframe id="iFrameName1" frameborder="0" src="loading.html" ></iframe>
<iframe id="iFrameName2" frameborder="0" src="" style="display: none;"></iframe>
<!-- </div> -->
</body>
</html>
15 changes: 15 additions & 0 deletions DigitalDisplay/resources/www/_system/loading.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html>
<head>
<title>WSO2 Digital Display</title>
<style type="text/css">
html {
width:100%;
height:100%;
background:url(digitaldisplay.png) center center no-repeat;
}
</style>
</head>
<body>
<!-- WSO2 Digital Display 1.0.0 Loading... -->
</body>
</html>
28 changes: 28 additions & 0 deletions DigitalDisplay/resources/www/_system/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
body {
margin: 0;
}

#content {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0px;
}
#iFrameName1{
width: 80%;
height: 100%;
border: 0;
position: absolute;
padding: 0 10%;
overflow:hidden;
}

#iFrameName2{
width: 80%;
height: 100%;
border: 0;
position: absolute;
padding: 0 10%;
overflow:hidden;
}

0 comments on commit cc5f205

Please sign in to comment.