2012-03-20 22:14:18 +00:00
|
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
2012-03-21 00:03:17 +00:00
|
|
|
<!DOCTYPE html>
|
2012-03-09 22:37:26 +00:00
|
|
|
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
|
|
|
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
2012-03-21 00:03:17 +00:00
|
|
|
<html>
|
2012-03-09 22:37:26 +00:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
|
<title>WebSockets</title>
|
|
|
|
|
2012-03-15 00:03:45 +00:00
|
|
|
<link type="text/css" href="<c:url value="/resources/css/screen.css"/>" rel="stylesheet" />
|
2012-03-20 23:45:40 +00:00
|
|
|
<link type="text/css" href="<c:url value="/resources/css/styles.css"/>" rel="stylesheet" />
|
2012-03-21 21:06:16 +00:00
|
|
|
<link type="text/css" href="<c:url value="/resources/css/smoothness/jquery-ui-1.8.18.custom.css"/>" rel="stylesheet" />
|
2012-03-09 22:37:26 +00:00
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.1.min.js" />"></script>
|
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.8.18.custom.min.js" />"></script>
|
2012-03-15 00:03:45 +00:00
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/jquery.cookie.js" />"></script>
|
2012-03-20 23:45:40 +00:00
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/backbone-min.js" />"></script>
|
2012-03-21 03:19:34 +00:00
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/jquery.colorpicker.js" />"></script>
|
|
|
|
<script type="text/javascript" src="<c:url value="/resources/js/jquery.mousewheel.js" />"></script>
|
2012-03-09 22:37:26 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2012-03-22 13:53:01 +00:00
|
|
|
var rooms = [
|
|
|
|
{"roomId": 0, "roomName": "Raum 1"},
|
|
|
|
{"roomId": 1, "roomName": "Raum 2"},
|
|
|
|
{"roomId": 2, "roomName": "Raum 3"},
|
|
|
|
{"roomId": 3, "roomName": "Raum 4"}
|
2012-03-21 21:56:19 +00:00
|
|
|
];
|
2012-03-22 13:53:01 +00:00
|
|
|
var volumes = {"room1":0,"room2":0,"room3":0,"room4":0};
|
|
|
|
var devices;
|
2012-03-09 22:37:26 +00:00
|
|
|
$(document).ready(
|
2012-03-22 13:53:01 +00:00
|
|
|
function() {
|
2012-03-21 21:56:19 +00:00
|
|
|
|
2012-03-13 23:57:00 +00:00
|
|
|
|
2012-03-22 13:53:01 +00:00
|
|
|
function sendData(data) {
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: "/control/devices",
|
|
|
|
contentType: "application/json",
|
|
|
|
dataType: "json",
|
|
|
|
data: JSON.stringify(data)
|
|
|
|
});
|
|
|
|
console.log(data);
|
|
|
|
console.log(JSON.stringify(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
var senden = function sendOutAllDevices() {
|
|
|
|
var changedDevs = new Array();
|
|
|
|
for(var i=0;i<devices.length;i++) {
|
|
|
|
if(devices[i].type=="Par56Spot" && devices[i].dirty) {
|
|
|
|
delete devices[i].dirty;
|
|
|
|
var dev = {"deviceId": i, "options":{"red":devices[i].red, "green":devices[i].green, "blue":devices[i].blue}};
|
|
|
|
changedDevs.push(dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changedDevs.length > 0) {
|
|
|
|
sendData({"timeStamp": Math.round(new Date().getTime()/1000), "updates": changedDevs});
|
|
|
|
}
|
|
|
|
console.log("set new interval for sending");
|
|
|
|
|
|
|
|
};
|
|
|
|
window.setInterval(senden, 100);
|
|
|
|
|
|
|
|
$("#slider1").slider({ min: 0, max: 100, slide: function(event, ui) {
|
|
|
|
volumes.room1 = ui.value;
|
|
|
|
dataChanged = true;
|
|
|
|
} });
|
|
|
|
|
|
|
|
$("#slider2").slider({ min: 0, max: 100, slide: function(event, ui) {
|
|
|
|
volumes.room2 = ui.value;
|
|
|
|
dataChanged = true;
|
|
|
|
} });
|
|
|
|
|
|
|
|
$("#slider3").slider({ min: 0, max: 100, slide: function(event, ui) {
|
|
|
|
volumes.room3 = ui.value;
|
|
|
|
dataChanged = true;
|
|
|
|
} });
|
|
|
|
|
|
|
|
$("#slider4").slider({ min: 0, max: 100, slide: function(event, ui) {
|
|
|
|
volumes.room4 = ui.value;
|
|
|
|
dataChanged = true;
|
|
|
|
} });
|
|
|
|
$("#tabs").tabs();
|
|
|
|
$("#v-tabs").tabs().addClass('ui-tabs-vertical');
|
|
|
|
$(".lampel .circle").click(function() {
|
|
|
|
if($(this).hasClass('black')){
|
|
|
|
$(this).removeClass('black');
|
|
|
|
} else {
|
|
|
|
$(this).addClass('black');
|
|
|
|
}
|
2012-03-13 23:57:00 +00:00
|
|
|
});
|
2012-03-22 13:53:01 +00:00
|
|
|
var colorpicker_raum1 = new jQuery.ColorPicker('#colorpicker-raum1', {
|
|
|
|
imagepath: '/resources/images/colorpicker/',
|
|
|
|
change: function(hexcolor) {
|
|
|
|
var red = hexcolor.substr(1,2);
|
|
|
|
var green = hexcolor.substr(3,2);
|
|
|
|
var blue = hexcolor.substr(5,2);
|
|
|
|
$('#par56select option:selected').each(function() {
|
|
|
|
devices[$(this).attr('name')].red = parseInt(red, 16);
|
|
|
|
devices[$(this).attr('name')].green = parseInt(green, 16);
|
|
|
|
devices[$(this).attr('name')].blue = parseInt(blue, 16);
|
|
|
|
devices[$(this).attr('name')].dirty = true;
|
|
|
|
});
|
|
|
|
console.log("data changed" + hexcolor);
|
2012-03-09 22:37:26 +00:00
|
|
|
|
2012-03-21 21:35:03 +00:00
|
|
|
}
|
2012-03-22 13:53:01 +00:00
|
|
|
});
|
|
|
|
$.getJSON('/control/devices', function(data) {
|
|
|
|
devices = data;
|
|
|
|
for(var i=0;i<devices.length;i++) {
|
|
|
|
if(devices[i].type=="Par56Spot") {
|
|
|
|
$('#par56select').append("<option name=" + devices[i].deviceId + ">" + devices[i].deviceName + "</option>");
|
|
|
|
}
|
|
|
|
}
|
2012-03-15 00:03:45 +00:00
|
|
|
|
2012-03-22 13:53:01 +00:00
|
|
|
});
|
|
|
|
$('.buzzer button').click(function() {
|
|
|
|
var span = $(this).parent().find('span');
|
|
|
|
span
|
|
|
|
.toggleClass('red')
|
|
|
|
.toggleClass('green');
|
|
|
|
if(span.text() == "Auf") {
|
|
|
|
span.text("Zu");
|
|
|
|
} else {
|
|
|
|
span.text("Auf");
|
2012-03-21 02:22:28 +00:00
|
|
|
}
|
2012-03-21 21:06:16 +00:00
|
|
|
|
2012-03-22 13:53:01 +00:00
|
|
|
})
|
|
|
|
$('#par56select').change(function() {
|
|
|
|
$('#par56select option:selected').each(function() {
|
|
|
|
var red = devices[$(this).attr('name')].red.toString(16);
|
|
|
|
var green = devices[$(this).attr('name')].green.toString(16);
|
|
|
|
var blue = devices[$(this).attr('name')].blue.toString(16);
|
|
|
|
if(red.length == 1) {
|
|
|
|
red += red;
|
|
|
|
}
|
|
|
|
if(green.length == 1) {
|
|
|
|
green += green;
|
|
|
|
}
|
|
|
|
if(blue.length == 1) {
|
|
|
|
blue += blue;
|
|
|
|
}
|
|
|
|
var hexstring = '#' + red + green + blue;
|
|
|
|
console.log("lampe:" + hexstring);
|
|
|
|
colorpicker_raum1.hex(hexstring);
|
|
|
|
});
|
2012-03-21 21:56:19 +00:00
|
|
|
});
|
2012-03-22 13:53:01 +00:00
|
|
|
}
|
2012-03-13 23:57:00 +00:00
|
|
|
);
|
|
|
|
|
2012-03-09 22:37:26 +00:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2012-03-21 02:02:31 +00:00
|
|
|
<h1>CTDO Raumsteuerung</h1>
|
2012-03-09 22:37:26 +00:00
|
|
|
|
2012-03-15 00:03:45 +00:00
|
|
|
<div id="tabs">
|
|
|
|
<ul>
|
|
|
|
<li><a href="#tabs-1">Global</a></li>
|
|
|
|
<li><a href="#tabs-2">Raum 1</a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="tabs-1">
|
2012-03-21 03:19:34 +00:00
|
|
|
|
|
|
|
<div class="buzzer">
|
|
|
|
<span class="circle red">Zu</span>
|
|
|
|
<button>Buzzern</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="tabs-2">
|
2012-03-21 01:54:33 +00:00
|
|
|
<div id="v-tabs" class="inner-tabs-container">
|
|
|
|
<ul>
|
|
|
|
<li><a href="#v-tabs-1">Licht</a></li>
|
|
|
|
<li><a href="#v-tabs-2">Musik</a></li>
|
2012-03-21 02:22:28 +00:00
|
|
|
<li><a href="#v-tabs-3">Lampel</a></li>
|
2012-03-21 01:54:33 +00:00
|
|
|
</ul>
|
|
|
|
<div id="v-tabs-1">
|
2012-03-22 13:53:01 +00:00
|
|
|
<div id="colorpicker-raum1"></div>
|
|
|
|
<select multiple="multiple" id="par56select">
|
2012-03-21 03:19:34 +00:00
|
|
|
|
2012-03-22 13:53:01 +00:00
|
|
|
</select>
|
2012-03-21 01:54:33 +00:00
|
|
|
</div>
|
|
|
|
<div id="v-tabs-2">
|
2012-03-21 03:19:34 +00:00
|
|
|
<label for="slider1">Lautstärke Raum 1:</label><div id="slider1" class="slider"></div>
|
2012-03-21 01:54:33 +00:00
|
|
|
</div>
|
2012-03-21 02:22:28 +00:00
|
|
|
<div id="v-tabs-3">
|
|
|
|
<div class="lampel">
|
2012-03-21 02:48:44 +00:00
|
|
|
<span class="circle red" title="click to toggle"></span>
|
|
|
|
<span class="circle yellow" title="click to toggle"></span>
|
|
|
|
<span class="circle green" title="click to toggle"></span>
|
2012-03-21 02:22:28 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2012-03-21 01:54:33 +00:00
|
|
|
</div>
|
2012-03-15 00:03:45 +00:00
|
|
|
|
2012-03-21 03:19:34 +00:00
|
|
|
<div class="switch">
|
|
|
|
Raumlicht:<br />
|
|
|
|
<input type="radio" name="raum-1-licht">An <input type="radio" name="raum-1-licht" checked="checked">Aus
|
|
|
|
</div>
|
2012-03-15 00:03:45 +00:00
|
|
|
|
|
|
|
</div>
|
2012-03-13 23:57:00 +00:00
|
|
|
</div>
|
2012-03-09 22:37:26 +00:00
|
|
|
</body>
|
|
|
|
</html>
|