summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRefik Hadzialic2011-09-08 18:07:05 +0200
committerRefik Hadzialic2011-09-08 18:07:05 +0200
commitd12c00d651f01748e693114be4406bf646a882e7 (patch)
tree02ef0406c0df758b507ce45ee810931d4044493e
parentAdded new icons, changed the picutre, added new links(connections). (diff)
downloadgsm-selftest-d12c00d651f01748e693114be4406bf646a882e7.tar.gz
gsm-selftest-d12c00d651f01748e693114be4406bf646a882e7.tar.xz
gsm-selftest-d12c00d651f01748e693114be4406bf646a882e7.zip
Added displaying of the image on the page!
-rw-r--r--notFinishedCode/web/css/tableCSS.css15
-rw-r--r--notFinishedCode/web/delayedLoading.js228
-rw-r--r--notFinishedCode/web/mutex1.php5
-rw-r--r--notFinishedCode/web/networkResult.php2
-rw-r--r--notFinishedCode/web/wait.gifbin0 -> 2545 bytes
5 files changed, 247 insertions, 3 deletions
diff --git a/notFinishedCode/web/css/tableCSS.css b/notFinishedCode/web/css/tableCSS.css
index e9904b8..e404064 100644
--- a/notFinishedCode/web/css/tableCSS.css
+++ b/notFinishedCode/web/css/tableCSS.css
@@ -1,10 +1,23 @@
/* -------------------------------------------------------
-Author: Vitaly Friedman
+Author: Vitaly Friedman but edited by Refik Hadzialic
Theme: Green Life - A Fresh, Warm and Readable Table
URL: http://www.alvit.de/vf
-------------------------------------------------------
*/
+ html { height: 100%; }
+ body {
+ background-color: #F0F0F0;
+ font-family: verdana, verdana, ariel;
+ height: 100%;
+ }
+
+ a.pChart
+ {
+ text-decoration: none;
+ color: #6A6A6A;
+ }
+
table {
font: 11px verdana,verdana, arial;
margin: 0;
diff --git a/notFinishedCode/web/delayedLoading.js b/notFinishedCode/web/delayedLoading.js
new file mode 100644
index 0000000..b76bbe3
--- /dev/null
+++ b/notFinishedCode/web/delayedLoading.js
@@ -0,0 +1,228 @@
+ /*
+ delayedLoader - JS to delay out of sight pictures rendering
+
+ Version : 2.0.2
+ Made by : Jean-Damien POGOLOTTI
+ Last Update : 10/12/10
+
+ This file can be distributed under the license you can find at :
+
+ http://www.pchart.net/license
+
+ You can find the whole class documentation on the pChart web site.
+ */
+
+ var PictureCache = new Array();
+ var PictureCount = 0;
+ var WaitPicture = "wait.gif";
+ var DivClassName = "pChart";
+ var DefaultWidth = 70;
+ var DefaultHeight = 230;
+ var DefaultAlt = "pChart rendered picture";
+
+
+ /* Do the DOM document processing */
+ function loaderInit()
+ {
+ WindowSize = getWindowSize();
+ WindowHeight = WindowSize[1];
+ Offset = getScrollXY();
+ HeightOffset = Offset[1];
+
+ /* Enumerate the tags */
+ Links = document.getElementsByTagName("a");
+ for (i = 0; i < Links.length; i++)
+ {
+ className = Links[i].className;
+
+ if ( className == DivClassName )
+ {
+ ObjectWidth = Links[i].getAttribute("data-pchart-width");
+ ObjectHeight = Links[i].getAttribute("data-pchart-height");
+ ObjectID = Links[i].id;
+ ObjectTop = Links[i].offsetTop;
+ ObjectURL = Links[i].href;
+ ObjectAlt = Links[i].getAttribute("data-pchart-alt");
+
+ if ( ObjectWidth == null ) { ObjectWidth = DefaultWidth; }
+ if ( ObjectHeight == null ) { ObjectHeight = DefaultHeight; }
+ if ( ObjectAlt == null ) { ObjectAlt = DefaultAlt; }
+
+ if (ObjectID == "") { ObjectID = "pChart-"+i; Links[i].id = ObjectID; }
+
+ PictureCache[PictureCount] = new Array();
+ PictureCache[PictureCount][0] = ObjectID;
+ PictureCache[PictureCount][1] = ObjectTop;
+ PictureCache[PictureCount][2] = ObjectURL;
+ PictureCache[PictureCount][3] = ObjectAlt;
+ PictureCache[PictureCount][4] = ObjectWidth;
+ PictureCache[PictureCount][5] = ObjectHeight;
+
+ PictureCount++;
+ }
+ }
+
+ /* Replace the <A> tags by <DIV> ones and attach the loader */
+ for(i=0;i<PictureCount;i++)
+ {
+ ATag = document.getElementById(PictureCache[i][0]);
+ DivTag = document.createElement("div");
+ DivID = "pChart-Div"+i; PictureCache[i][0] = DivID;
+
+ DivTag.setAttribute("id", DivID);
+ DivTag.style.width = PictureCache[i][4];
+ DivTag.style.height = PictureCache[i][5];
+ DivTag.style.backgroundColor = "#E0E0E0";
+
+ DivTag2 = ATag.parentNode.replaceChild(DivTag, ATag);
+
+ DivTop = DivTag.offsetTop;
+ PictureCache[i][1] = DivTop;
+
+ changeOpac(50, i);
+ changeContent("<img src='"+WaitPicture+"' width=24 height=24 alt=''/>",i);
+
+ if ( HeightOffset + WindowHeight > PictureCache[i][1] ) { triggerVisible(i); }
+ }
+ }
+
+ /* Replace the contents of the delayed loading DIV */
+ function changeContent(html, id)
+ { DivID = PictureCache[id][0]; document.getElementById(DivID).innerHTML = html; }
+
+ /* Trigger the picture rendering when the pChart DIV became visible */
+ function triggerVisible(PictureID)
+ {
+ if ( !PictureCache[PictureID][6] == true )
+ {
+ PictureCache[PictureID][6] = true;
+ ajaxRender(PictureCache[PictureID][2],PictureID);
+ }
+ }
+
+ /* Catch the navigator window scrolling event */
+ function scrollEvent()
+ {
+ WindowSize = getWindowSize();
+ WindowHeight = WindowSize[1];
+ Offset = getScrollXY();
+ HeightOffset = Offset[1];
+
+ for(i=0;i<=PictureCount-1;i++) { if ( HeightOffset + WindowHeight > PictureCache[i][1] ) { triggerVisible(i); } }
+ }
+
+ /* Cross browser X/Y window offset gatherer */
+ function getScrollXY()
+ {
+ var scrOfX = 0, scrOfY = 0;
+
+ if( typeof( window.pageYOffset ) == 'number' )
+ { scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; }
+ else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
+ { scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; }
+ else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
+ { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; }
+
+ return [ scrOfX, scrOfY ];
+ }
+
+ /* Cross browser X/Y window size gatherer */
+ function getWindowSize()
+ {
+ var myWidth = 0, myHeight = 0;
+
+ if( typeof( window.innerWidth ) == 'number' )
+ { myWidth = window.innerWidth; myHeight = window.innerHeight; }
+ else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
+ { myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; }
+ else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
+ { myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; }
+
+ return [ myWidth, myHeight ];
+ }
+
+ /* Cross browser alpha transparency changer */
+ function changeOpac(opacity, id)
+ {
+ DivID = PictureCache[id][0];
+
+ var object = document.getElementById(DivID).style;
+ object.opacity = (opacity / 100);
+ object.MozOpacity = (opacity / 100);
+ object.KhtmlOpacity = (opacity / 100);
+ object.filter = "alpha(opacity=" + opacity + ")";
+ }
+
+ /* Shade in-out function */
+ function opacity(id, opacStart, opacEnd, millisec)
+ {
+ var speed = Math.round(millisec / 100);
+ var timer = 0;
+
+ if(opacStart > opacEnd)
+ {
+ for(i = opacStart; i >= opacEnd; i--)
+ {
+ setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
+ timer++;
+ }
+ }
+ else if(opacStart < opacEnd)
+ {
+ for(i = opacStart; i <= opacEnd; i++)
+ {
+ setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
+ timer++;
+ }
+ }
+ }
+
+ /* Start the loader */
+ function StartFade(PictureID)
+ {
+ Loader = new Image();
+ URL = PictureCache[PictureID][2];
+ Loader.src = URL;
+ setTimeout("CheckLoadingStatus("+PictureID+")", 200);
+ }
+
+ /* check the picture loading status */
+ function CheckLoadingStatus(PictureID)
+ {
+ DivID = PictureCache[PictureID][0];
+ URL = PictureCache[PictureID][2];
+ Alt = PictureCache[PictureID][3];
+
+ if ( Loader.complete == true )
+ {
+ changeOpac(0, PictureID);
+ HTMLResult = "<center><img src='" + URL + "' alt='"+Alt+"'/></center>";
+ document.getElementById(DivID).innerHTML = HTMLResult;
+
+ opacity(PictureID,0,100,100);
+ }
+ else
+ setTimeout("CheckLoadingStatus("+PictureID+")", 200);
+ }
+
+ /* Compute the pChart picture in background */
+ function ajaxRender(URL,PictureID)
+ {
+ var xmlhttp=false;
+ /*@cc_on @*/
+ /*@if (@_jscript_version >= 5)
+ try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } }
+ @end @*/
+
+ if (!xmlhttp && typeof XMLHttpRequest!='undefined')
+ { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } }
+
+ if (!xmlhttp && window.createRequest)
+ { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }
+
+ xmlhttp.open("GET", URL,true);
+
+ xmlhttp.onreadystatechange=function()
+ { if (xmlhttp.readyState==4) { StartFade(PictureID); } }
+ xmlhttp.send(null)
+ }
diff --git a/notFinishedCode/web/mutex1.php b/notFinishedCode/web/mutex1.php
index 81a73d2..11d7529 100644
--- a/notFinishedCode/web/mutex1.php
+++ b/notFinishedCode/web/mutex1.php
@@ -1,10 +1,12 @@
<html>
<head>
+<script src='delayedLoading.js' type="text/javascript"></script>
+
<!--ADD HERE ALL THE NEEDED META DATA -->
<title>Network test live results!</title>
<link rel="stylesheet" href="css/tableCSS.css" type="text/css" media="screen">
</head>
-<body>
+<body onscroll="scrollEvent();" onload="loaderInit();">
<?php
@@ -95,6 +97,7 @@ if ($locking == '1') //1 means nobody is on the website
//test finished successfully
echo '</tbody></table>';
echo 'Test successfully finished!<br>';
+ echo "<a class='pChart' href='networkResult.php' data-pchart-alt='Picture3'>Picture 3</a>";
echo str_repeat("\n",7024);
flush();
usleep(100);
diff --git a/notFinishedCode/web/networkResult.php b/notFinishedCode/web/networkResult.php
index cbf0a22..3d44263 100644
--- a/notFinishedCode/web/networkResult.php
+++ b/notFinishedCode/web/networkResult.php
@@ -24,7 +24,7 @@
$MyData = new pData();
$MyData->addPoints(array(66,100,50,39,28),"Hits");
$MyData->setAxisName(0,"Network operability");
- $MyData->addPoints(array("GSM University","GSM External","SIP","University SIP","Landline"),"Networks");
+ $MyData->addPoints(array("GSM University","GSM External","SIP","Uni.Tel.network","Landline"),"Networks");
$MyData->setSerieDescription("Networks","Networks");
$MyData->setAbscissa("Networks");
diff --git a/notFinishedCode/web/wait.gif b/notFinishedCode/web/wait.gif
new file mode 100644
index 0000000..1c72ebb
--- /dev/null
+++ b/notFinishedCode/web/wait.gif
Binary files differ