-
Notifications
You must be signed in to change notification settings - Fork 1
/
thingbrokerpebbleconfiguration.php
63 lines (55 loc) · 2.25 KB
/
thingbrokerpebbleconfiguration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<title>Configuration for Roberto</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div data-role="page" id="main">
<div data-role="header" class="jqm-header">
<h1>Configuration options</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="thingbrokerurl">Thingbroker URL:</label>
<textarea maxlength="100" cols="10" rows="1" name="thingbrokerurl" id="thingbrokerurl"><?php echo isset($_GET['thingbrokerurl']) ? $_GET['thingbrokerurl'] : 'http://kimberly.magic.ubc.ca:8080/thingbroker'; ?></textarea>
<label for="thingbrokerurl">Thing Id:</label>
<textarea maxlength="100" cols="10" rows="1" name="thingid" id="thingid"><?php echo isset($_GET['thingid']) ? $_GET['thingid'] : 'pebble'; ?></textarea>
</div>
<div class="ui-body ui-body-b">
<fieldset class="ui-grid-a">
<div class="ui-block-a"><button type="submit" data-theme="d" id="b-cancel">Cancel</button></div>
<div class="ui-block-b"><button type="submit" data-theme="a" id="b-submit">Submit</button></div>
</fieldset>
</div>
</div>
</div>
</div>
<script>
function saveOptions() {
var options = {
'thingbrokerurl': $("#thingbrokerurl").val(),
'thingid': $("#thingid").val(),
}
return options;
}
$().ready(function() {
$("#b-cancel").click(function() {
console.log("Cancel");
document.location = "pebblejs://close";
});
$("#b-submit").click(function() {
console.log("Submit");
var location = "pebblejs://close#" + encodeURIComponent(JSON.stringify(saveOptions()));
console.log("Warping to: " + location);
console.log(location);
document.location = location;
});
});
</script>
</body>
</html>