-
-
Save JustinAiken/a41115f3faa8716381ac to your computer and use it in GitHub Desktop.
devices.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Devices</title> | |
<link type="text/css" rel="Stylesheet" href="css/mystyles.css" /> | |
<script type="text/javascript" src="js/jquery.js"></script> | |
<script type="text/javascript"> | |
function refresh_dev_list() { | |
$.ajax({ | |
type:'POST', | |
url: 'dev_list.php', | |
cache: false, | |
success: function (data) { | |
$('#dev_list tbody').html(data); | |
} | |
}); | |
} | |
function show_device(id) { | |
var rowid = "#row" + id; | |
$(rowid).addClass("selected").siblings().removeClass("selected"); | |
$.ajax({ | |
type:'POST', | |
url: 'dev_detail.php', | |
//data: { id : id, prot: prot, type: type}, | |
data: { id : id}, | |
dataType: 'json', | |
cache: false, | |
success: function (dev_data) { | |
//alert(dev_data.info); | |
$('#dev_info tbody').html(dev_data.info); | |
$('#dev_attrs tbody').html(dev_data.attrs); | |
} | |
}); | |
} | |
function switchDev(nodeId, attrId, on) { | |
$.ajax({ | |
type:'POST', | |
url: 'set_dev_value.php', | |
data: { nodeId : nodeId, attrId: attrId, value: on}, | |
cache: false, | |
success: function (data) { | |
setTimeout(function(){show_device(nodeId)}, 500); | |
alert(data); | |
} | |
}); | |
} | |
function setDevValue(nodeId, attrId) { | |
var vid = "value_set" + attrId; | |
var v = document.getElementById(vid).value; | |
$.ajax({ | |
type:'POST', | |
url: 'set_dev_value.php', | |
data: { nodeId : nodeId, attrId: attrId, value: v}, | |
cache: false, | |
success: function (data) { | |
setTimeout(function(){show_device(nodeId)}, 500); | |
alert(data); | |
} | |
}); | |
} | |
$(document).ready(function(){ | |
refresh_dev_list(); | |
}); | |
</script> | |
</head> | |
<body> | |
<?php $cur_page='page_devices'; $title = 'Device List'; include("header.php"); ?> | |
<div class="text_panel panel1"> | |
<table style="width: 50%;margin:0 auto;" border="0" cellpadding="10" cellspacing="0"> | |
<tr> | |
<td valign="top"> | |
<h3>Device List:</h3> | |
<table id='dev_list' class="devices" cellspacing="0" cellpadding="0" > | |
<thead><tr> | |
<th>Id</th> | |
<th>Protocol</th> | |
<th>Type</th> | |
</tr></thead> | |
<tbody> | |
</tbody> | |
</table> | |
</td> | |
<td width="50%" valign="top"> | |
<h3>Device Detail:</h3> | |
<div class="text_panel panel1"> | |
<table id='dev_info' width='100%'> | |
<tbody> | |
</tbody> | |
</table> | |
<h4>Attributes:</h4> | |
<table class=devices id='dev_attrs' width='100%'> | |
<tbody> | |
</tbody> | |
</table> | |
</div> | |
</td> | |
</tr> | |
</table> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment