forked from howardjones/network-weathermap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newpicker.html
133 lines (100 loc) · 3.25 KB
/
newpicker.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Data Source Picker Test</title>
<script type="text/javascript"
src="editor-resources/jquery-1.10.1.min.js"></script>
<script type="text/javascript"
src="editor-resources/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
href="editor-resources/bootstrap/css/bootstrap.min.css" />
<style>
#currentlist {
height: 200px;
overflow-x: hidden;
overflow-y: auto;
border-top: 1px solid gray;
border-bottom: 1px solid gray;
}
#currentlist li:hover { background: #def; }
</style>
</head>
<body>
<div class="container">
<h1>Testing new picker</h1>
<form class="form-horizontal col-md-4" role="form">
<label for="target">Target</label>
<div class="input-group">
<input type="text" id="target" name="target" class="form-control">
<span class="input-group-btn">
<button class="btn btn-primary" id="target_picker" type="button">Pick</button>
</span>
</div>
</form>
</div>
<div class="modal fade" id="pickermodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 id="datatitle" class="modal-title"></h2>
</div>
<div class="modal-body">
<ol id="levelslist" class="breadcrumb">
</ol>
<ul id="pickedlist" class="list-group">
</ul>
<ul id="currentlist" class="list-group compact">
<li>poop</li>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Apply</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function prepare_pick_source() {
$('#levelslist').hide();
$('#pickedlist').hide();
$.getJSON("newpickerserver.php", { "act": "metameta" }, function(data) {
$('#datatitle').text("Select Data Source");
$.each(data.sources, function(key, val) {
$('#currentlist').append("<li class='wm-ds list-group-item'><large>" + val[0] + "</large></li>");
});
$(".wm-ds").click(wm_populate_breadcrumbs);
});
}
function wm_populate_breadcrumbs () {
$('#levelslist').show();
$('#pickedlist').show();
$.getJSON("newpickerserver.php", { "act": "meta", "source":"cacti_rrddata" }, function(data) {
$('#currentlist').find('li').remove();
$('#datatitle').text(data.name);
$.each(data.headings, function(key, val) {
$('#levelslist').append("<li>" + val + "</li>");
});
});
$.getJSON("newpickerserver.php", { "act": "list", "source":"cacti_rrddata","keys":[22,33]}, wm_populate_picklist);
}
function wm_populate_picklist(data) {
$.each(data, function(key, val) {
$('#currentlist').append(
"<li class='list-group-item'>" + val[1]
+ " <small><em>" + val[2]
+ "</em></small></li>");
});
}
function wm_initJS() {
$('#target_picker').click( function () {
// $('#cur').find('li'list li').remove();
$('#pickermodal').modal( );
prepare_pick_source();
});
}
$(document).ready(wm_initJS);
</script>
</body>
</html>