forked from kkaiser1952/NCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolumnPicker.php
447 lines (377 loc) · 14.3 KB
/
columnPicker.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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!doctype html>
<?php
// This page gives a user the ability to choose which columns he sees and which he doesn't
// It also allows a user to set a time zone for viewing
// Written: 2018-12-18, timezone added 2020-02-29
ini_set('display_errors',1);
error_reporting (E_ALL ^ E_NOTICE);
require_once "dbConnectDtls.php";
//phpinfo();
$netcall = $_GET["netcall"];
echo($netcall);
// If columnViews is empty in the NetKind table then a default is set
$sql = "SELECT columnViews
FROM NetKind
WHERE `call` = '$netcall'
";
$stmt = $db_found->prepare($sql);
$stmt -> execute();
$columnViews = $stmt->fetchColumn(0);
//echo("<br>$columnViews");
if (!$columnViews) { $columnViews = '17,18,24'; }
echo("<br>$columnViews");
//for ($i=1; $i <= strlen($columnViews); $i++) {}
?>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Net Control Manager</title>
<link rel="stylesheet" type="text/css" href="css/NetManager.css" >
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="js/cookieManagement.js"></script>
<script src="js/NetManager.js"></script>
<script>
var netcall = <?php echo "'$netcall'"; ?>;
var cookieName = "columnChoices_"+netcall;
var columnViews = <?php echo "'$columnViews'"; ?>;
// Here we check if there is a cookie, if there is not we use the defaults from above in the SQL
$(document).ready(function() {
if (getCookie(cookieName)) {
getCurrent();
} else {
// Check all the boxes coming in from either the cookie or from the default
var testem = columnViews.split(','); // Split the list inot its number and run them with testem.forEach
testem.forEach(showChecked); // Show it on first pass
}
$( "#admincols").click(function() {
$('.admincolumns').removeClass('hidden');
});
});
</script>
<style>
body {
/* counter-reset: my-counter; */ /* uncomment these and those in label:before if you want numbers for each box */
}
label:before {
/* counter-increment: my-counter;
content: counter(my-counter) ". "; */
}
* {
box-sizing: border-box;
}
.row {
display: flex;
}
/* Create two equal columns that floats next to each other */
.column {
flex: 25%;
padding: 10px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* The container */
.container {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer;
font-size: 22px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Hide the browser's default checkbox */
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom checkbox */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
border: 1px solid green;
}
/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
background-color: #ccc;
}
/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
background-color: #2196F3;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
display: block;
}
/* Style the checkmark/indicator */
.container .checkmark:after {
left: 9px;
top: 5px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.red {
color:red;
}
.myButtons {
width: 80%;
}
.saveascookie {
font-size: 24pt;
font-weight: bold;
background: none !important;
color: blue;
border-radius: 15px;
border: 2px solid #999;
padding: 8px !important;
font: inherit;
cursor: pointer;
}
</style>
</head>
<body>
<h1>These options will write a cookie to your system.</h1>
<form onsubmit="setCookie(cookieName, calculate(), 365); javascript:window.close();">
<p style="font-size: 14pt; font-weight: bold;">Choose a time zone to use, the default is UTC
<label class="container">UTC (46)
<input type="radio" name="intrests[]" checked onclick="tz_adj(0);" value="46" class="46" >
<span class="checkmark"></span>
</label>
<!--
<br><br>Time zone display in local time is not ready yet. Watch for this feature.</p>
<div class="row">
<div class="column" >
<label class="container">Eastern (40)
<input type="radio" name="intrests[]" onclick="tz_adj(-300);" value="40" class="40" > <!- - -5 hr - ->
<span class="checkmark"></span>
</label>
<label class="container">Pacific (43)
<input type="radio" name="intrests[]" onclick="tz_adj(-480);" value="43" class="43" > <!- - -8 hr - ->
<span class="checkmark"></span>
</label>
</div>
<div class="column" >
<label class="container">Central (41)
<input type="radio" name="intrests[]" onclick="tz_adj(-360);" value="41" class="41" > <!- - -6 hr - ->
<span class="checkmark"></span>
</label>
<label class="container">Alaska (44)
<input type="radio" name="intrests[]" onclick="tz_adj(-540);" value="44" class="44" > <!- - -9 hr - ->
<span class="checkmark"></span>
</label>
</div>
<div class="column" >
<label class="container">Mountain (42)
<input type="radio" name="intrests[]" onclick="tz_adj(-420);" value="42" class="42" > <!- - -7 hr - ->
<span class="checkmark"></span>
</label>
<label class="container">Hawaii (45)
<input type="radio" name="intrests[]" onclick="tz_adj(-600);" value="45" class="45" > <!- - -10 hr - ->
<span class="checkmark"></span>
</label>
</div>
</div>
-->
<p style="font-size: 14pt; font-weight: bold;">Columns selected or deselected will appear on the next table refresh.</p>
<!-- WAS HERE -->
<div class="row">
<div class="column" >
<!--
<label class="container">Row Number (0)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(0)" value="0" class="0">
<span class="checkmark"></span>
</label>
-->
<!-- <label class="container red">Role (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(1)" value="1" class="1" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">Mode (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(2)" value="2" class="2" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">Status (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(3)" value="3" class="3" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">Traffic (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(4)" value="4" class="4" checked="checked">
<span class="checkmark"></span>
</label>
-->
<label class="container">tt No. (5)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(5)" value="5" class="5" >
<span class="checkmark"></span>
</label>
<!--
<label class="container red">Callsign (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(6)" value="6" class="6" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">First Name (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(7)" value="7" class="7" checked="checked">
<span class="checkmark"></span>
</label>
-->
<label class="container">Last Name (8)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(8)" value="8" class="8">
<span class="checkmark"></span>
</label>
<label class="container">Tactical (9)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(9)" value="9" class="9">
<span class="checkmark"></span>
</label>
<label class="container">Phone Number (10)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(10)" value="10" class="10">
<span class="checkmark"></span>
</label>
<label class="container">eMail Address (11)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(11)" value="11" class="11">
<span class="checkmark"></span>
</label>
<label class="container">Credentials (15)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(15)" value="15" class="15">
<span class="checkmark"></span>
</label>
<label class="container">Time On Duty (16)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(16)" value="16" class="16">
<span class="checkmark"></span>
</label>
<label class="container">Band (23)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(23)" value="23" class="23">
<span class="checkmark"></span>
</label>
</div>
<div class="column" >
<!--
<label class="container red">Time In (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(12)" value="12" class="12" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">Time Out (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(13)" value="13" class="13" checked="checked">
<span class="checkmark"></span>
</label>
<label class="container red">Time Line Comments (required)
<input type="checkbox" name="intrests[]" disabled="disabled" onclick="window.opener.toggleCol(14)" value="14" class="14" checked="checked">
<span class="checkmark"></span>
</label>
-->
<label class="container">County (17)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(17)" value="17" class="17">
<span class="checkmark"></span>
</label>
<label class="container">State (18)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(18)" value="18" class="18">
<span class="checkmark"></span>
</label>
<label class="container">District (19)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(19)" value="19" class="19">
<span class="checkmark"></span>
</label>
<label class="container">Grid (20)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(20)" value="20" class="20" >
<span class="checkmark"></span>
</label>
<label class="container">Latatitude (21)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(21)" value="21" class="21" >
<span class="checkmark"></span>
</label>
<label class="container">Longitude (22)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(22)" value="22" class="22">
<span class="checkmark"></span>
</label>
<label class="container">W3W (24)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(24)" value="24" class="24">
<span class="checkmark"></span>
</label>
<label class="container">Team (30)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(30)" value="30" class="30">
<span class="checkmark"></span>
</label>
<!-- added 2021-09-03 -->
<label class="container">APRS_CALL (31)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(31)" value="31" class="31">
<span class="checkmark"></span>
</label>
<!--
<label class="container">TRFK-OPS (50) (Custom)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(50)" value="50" class="50">
<span class="checkmark"></span>
</label>
<label class="container">Section (51) (Section)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(51)" value="51" class="51">
<span class="checkmark"></span>
</label>
-->
</div>
</div>
<div class="myButtons">
<input class="saveascookie" type="submit" value="Save as Cookie">
<input type="button" onclick="javascript:window.close()" value="Close" style="float:right; padding-left: 20px;">
<br><br>
</div>
<span></span>
<div style="color:red; font-size: 18pt;">
<p><?php echo("<br>Group selected default colums: $columnViews"); ?></p>
<p>To delete this cookie from your computer, un-click any selected columns and click the 'Save as Cookie' button.</p>
<br><br>
<input id="admincols" type="button" value="Admin"></button>
<br><br>
</div>
<div class="admincolumns hidden">
<label class="container">recordID (25)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(25)" value="25" class="25" >
<span class="checkmark"></span>
</label>
<label class="container">ID (26)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(26)" value="26" class="26" >
<span class="checkmark"></span>
</label>
<label class="container">status (27)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(27)" value="27" class="27" >
<span class="checkmark"></span>
</label>
<label class="container">home (28)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(28)" value="28" class="28" >
<span class="checkmark"></span>
</label>
<label class="container">ipaddress (29)
<input type="checkbox" name="intrests[]" onclick="window.opener.toggleCol(29)" value="29" class="29" >
<span class="checkmark"></span>
</label>
</div> <!-- End admincolumns -->
</form>
<script>
// This function controls the values of the time in and time out columns based on the time zone
function tz_adj(tz_amt) {
// alert("in it");
alert("Cookies for time display is not ready yet, come back again soon. Your selected offset is: "+tz_amt);
}
</script>
</body>
</html>