-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdevices.php
More file actions
277 lines (162 loc) · 6.18 KB
/
devices.php
File metadata and controls
277 lines (162 loc) · 6.18 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?php
error_reporting(E_ALL ^ E_NOTICE);
require "includes/config.php";
require "includes/sess.php";
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>xTable Device Selection</title>
<style>
#saveSuite{
float: right;
}
#continue,#saveSuite,#execCancel{
margin-top: 5px;
}
#deviceTable td{
text-align:center !important;
}
#deviceTable .ghead{
font-weight: bold;
font-size: 1.1em;
text-align:left !important;
}
</style>
<body>
<form id='deviceForm' name='deviceForm' action="<?php $_SERVER['PHP_SELF']; ?>" method="GET" />
<table id="deviceTable">
<thead>
<tr>
<th>TYPE</th>
<th>GROUP</th>
<th>NAME</th>
<th>VERSION</th>
</tr>
</thead>
<tbody>
<?php
$userloc = $_SESSION['loc'];
$er = @mysql_query("SELECT devtype_name
FROM table_device, table_devtype
WHERE device_location_id = '{$userloc}'
AND device_type_id = devtype_id
GROUP BY devtype_name
ORDER BY devtype_name") or die("UNABLE TO GET DEVICES");
while($query_row = @mysql_fetch_object($er)) {
?>
<tr>
<td class='ghead' colspan='0'>
<?php echo strtoupper($query_row->devtype_name); ?>
</td>
</tr>
<?php
$dq = mysql_query("SELECT device_id, devgroup_name, device_name, device_version
FROM table_device, table_devtype, table_devgroup
WHERE devtype_id = device_type_id
AND devgroup_id = device_group_id
AND device_location_id = '{$userloc}'
AND devtype_name = '{$query_row->devtype_name}'
GROUP BY devtype_name, devgroup_name, device_name, device_version
ORDER BY devtype_name, devgroup_name, device_name, device_version");
while ($query_row2 = @mysql_fetch_object($dq)){
?> <tr>
<td><input type='checkbox' name='<?php echo $query_row2->device_id;?>' id='' class='deviceList' /></td>
<td style='text-align:center;'><?php echo $query_row2->devgroup_name; ?></td>
<td style='text-align:center;'><?php echo $query_row2->device_name; ?></td>
<td style='text-align:center;'><?php echo $query_row2->device_version; ?></td>
</tr>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
<button id='execCancel' value='cancel'>Cancel</button>
<button id="execNow" name="execNow" value="Execute Now">Execute Now</button>
<!--<button id='saveSuite' name='saveSuite' value='saveSuite'>Save as Suite</button>-->
</form>
<script>
$(document).ready(function()
{
$('#deviceTable').fixheadertable({
caption : '',
colratio : [100, 30, 75, 480,100, 150],
height : 460,
zebra : false,
sortable : false,
sortedColId : 1,
sortType : ['string', 'string', 'string', 'string', 'string', 'string'],
dateFormat : 'm/d/Y',
pager : false,
rowsPerPage : 100,
showhide : true,
whiteSpace : 'normal',
addTitles : false,
});
$( "button, input:submit, input:reset" ).button();
////////////////////////////////////////////////////RE-SET CLASSES AND COLSPANS //////////////////////////////////////////////////////
var rows = $("#deviceTable tr");
rows.children("td:nth-child(1)").each(function() {
if( $(this).children(".parent").attr("class") == "func parent" ){
$(this).attr("class","ghead ui-widget-content");
}
$(".ghead").each(function(){
$(this).attr("colspan","4");
});
$("td:nth-child(2)").css("text-align","center");
$("td:nth-child(3)").css("text-align","center");
$("td:nth-child(5)").css("text-align","center");
$("td:nth-child(6)").css("text-align","center");
});
//////////////////////////////////////////////////// END RE-SET CLASSES AND COLSPANS //////////////////////////////////////////////////////
$("#cancel").click(function(){
$(".children:checked").each(function(){
alert( $(this).attr("name") );
});
});
$("#execCancel").click(function(){
$("#iframeContainer").dialog( "close" )
});
$("#execNow").click(function(){
deviceArray = [];
$(".deviceList:checked").each(function(){
var item = $(this).attr("name");
deviceArray.push( item );
});
if( deviceArray.length > 0 ){
$.ajax({
type: "GET",
url: "action.php",
cache: false,
data: "execute=true&testcasearray="+ testCaseArray +"&devicearray="+deviceArray+"&crypto=<?php echo session_id() . 'zLsX7795d1d5AsCsD3wFGv'; ?>",
}).done(function( msg ) {
//alert(msg);
returnedExecIds = msg;
$.ajax({
type: "GET",
url: "time.php",
cache: false,
async: false,
data: "test=test",
}).done(function( stime ){
nstime = stime;
$.ajax({
type: "GET",
url: "execute.php",
cache: false,
data: "startExecution=true&returnedExecIds=" + msg+"&stime="+nstime,
}).done(function( msgi ) {
$("#iframeContainer").html(msgi);
});
});
});///return Execution IDs
}else{ alert("Please select at least one device."); }
});
});
</script>
</body>
</html>