1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
<xsl:output method="html" encoding="utf-8"/>
4
<xsl:template match="/">
5
<!--page styles found in adei.css-->
6
<!--jQuery libraries hosted by google-->
7
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
8
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
9
<script type="text/javascript">
11
//standard way to initialize jQuery sliders
12
//has some problems on initial load with Firefox, needs another click of the Apply button in source tab
14
$("#page_wrapper_div").ready(function()
17
$("#start_slider").slider(
22
max:]]><xsl:value-of select="result/start_slider_max"/><![CDATA[,
25
change: function(e,ui)
27
var s = ]]><xsl:value-of select="result/start"/><![CDATA[;
31
adei.SetCustomProperties("start=" + ui.value + "&pic_id=" + (Math.floor(]]><xsl:value-of select="result/data_amount"/><![CDATA[/]]><xsl:value-of select="result/start_slider_max"/><![CDATA[) * (ui.value - 1)) + "&window=" + 0);
36
$("#zoom_slider").slider(
44
orientation:'vertical',
46
change: function(e,ui)
48
var z = ]]><xsl:value-of select="result/zoom"/><![CDATA[;
52
adei.SetCustomProperties("zoom=" + ui.value + "&window=" + 0);
59
//when the main image is clicked, we get the mouse X position
60
//and use that and the amount of data in the graph to determine what to show on the
61
//secondary image, this function won't work correctly if the window property is used to select the shown data
62
function GetMouseX(event)
64
var g_width = document.getElementById("image").width;//get the width of the whole image
66
//get the X position of the mouse pointer in relation to the edge of the main sidebar
67
var pos_x = event.pageX-document.getElementById("image").offsetLeft-document.getElementById("main_sidebar").offsetWidth;
69
pos_x = pos_x - 50;//remove from the X position the width of the graph's left margin
71
//get the amount of datapoints read by the service and the start_slider's maximum value
72
var data_amount = ]]><xsl:value-of select="result/data_amount"/><![CDATA[;
73
var start_slider_max = ]]><xsl:value-of select="result/start_slider_max"/><![CDATA[;
75
//if the user clicks outside the bounds of the graph's background image set the position at the edge of the image
76
if(pos_x < 0) pos_x = 0;
77
if(pos_x > g_width - (50 + 20)) pos_x = (g_width - (50 + 20));
79
var zoom = ]]><xsl:value-of select="result/zoom"/><![CDATA[;
81
var slice_amount = (180 - (zoom * 30));//calculate the amount of slices
82
var slice_width = (g_width - (50 + 20)) / slice_amount;//calculate the width of the slices
84
var start = ]]><xsl:value-of select="result/start"/><![CDATA[;
86
var id = Math.floor(pos_x / slice_width) + (Math.floor(data_amount/start_slider_max) * (start - 1));//determine the id of the clicked slice
88
adei.SetCustomProperties("pic_id=" + id);
92
//when the secondary image has been loaded, we adjust the slider values based on what was returned by the service as XML
93
$("#image2").ready(function ()
95
var startValue = ]]><xsl:value-of select="result/start"/><![CDATA[;
96
var zoomValue = ]]><xsl:value-of select="result/zoom"/><![CDATA[;
98
$("#start_slider").slider("option", "value", startValue);
99
$("#zoom_slider").slider("option", "value", zoomValue);
103
//function to change the service based on the calling button's value
105
function ChangeService(event)
107
var target = (event.currentTarget.value);
108
adei.SetCustomProperties("image_target=" + target);
114
<div id="page_wrapper_div">
115
<div id="upper_wrapper_div">
116
<div id="image_zoom_wrapper_div">
119
<img id="image" src="{result/image}" alt="Loading..." onmousedown="javascript:GetMouseX(event);"></img>
121
<div id="zoom_wrapper_div">
122
<div id="zoom_slider"></div>
125
<div id="start_wrapper_div">
126
<div id="start_slider"></div>
129
<div id="lower_wrapper_div">
130
<!--secondary image-->
131
<img id="image2" src="{result/image2}" alt="Loading..."></img>
133
<button value="cloud" onclick="javascript:ChangeService(event);">Clouds</button>
134
<button value="ceilo" onclick="javascript:ChangeService(event);">Ceilometer</button>
135
<button value="temp" onclick="javascript:ChangeService(event);">Temperature</button>
b'\\ No newline at end of file'