-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindicatorsConfigs.php
700 lines (619 loc) · 28.8 KB
/
indicatorsConfigs.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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
<?php
session_start();
$indicatorsFolder = __DIR__ . "/indicators-configs/";
function print_r2($a, $out=false)
{
$outStr = "";
if ($out)
{
$outStr = "<pre>" . print_r($a, true) . "</pre>";
return $outStr;
}
echo "<pre>";
echo print_r($a, true);
echo "</pre>";
}
function getIndicatorsList()
{
global $indicatorsFolder;
if (!file_exists($indicatorsFolder))
mkdir($indicatorsFolder);
$it = new RecursiveDirectoryIterator($indicatorsFolder, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
$list = [];
foreach($files as $file)
{
$pa = pathinfo($file->getFilename());
if (!isset($pa["extension"]) || $pa["extension"] !== "json")
continue;
$run = false;
if (substr($pa["filename"], -strlen(".run")) === ".run")
{
$run = true;
$pa["filename"] = str_replace(".run", "", $pa["filename"]);
}
$list[] = [ "name" => $pa["filename"], "run" => $run ];
}
return $list;
}
function exists($indicator, $run = false)
{
global $indicatorsFolder;
$path = $indicatorsFolder.$indicator. ($run ? ".run" : "").".json";
$result = file_exists($path);
return $result;
}
function convertEaSettingsToTable($config)
{
$result = [];
foreach ($config["eaIni"]["inputs"] as $key => $value)
{
$keyVal = [ "name" => $key, "value" => $value ];
$split = explode(",", $key);
$name = $split[0];
if ( !isset($result[$name]) )
{
$result[$name] = [];
}
if (isset($split[1]))
{
switch ($split[1])
{
case 'F':
$result[$name]["optimization"] = $keyVal;
break;
case '1':
$result[$name]["start"] = $keyVal;
break;
case '2':
$result[$name]["step"] = $keyVal;
break;
case '3':
$result[$name]["stop"] = $keyVal;
break;
}
}
else
{
$result[$name]["variable"] = $keyVal;
}
}
return $result;
}
function deleteConfig($indicator, $run = false)
{
global $indicatorsFolder;
@unlink($indicatorsFolder . $indicator . ($run ? ".run" : "") . ".json");
}
function loadDefaultConfig()
{
global $indicatorsFolder;
$config = json_decode(file_get_contents($indicatorsFolder . "default"), true);
return $config;
}
function loadConfig($indicator, $run = false)
{
global $indicatorsFolder;
$config = json_decode(file_get_contents($indicatorsFolder . $indicator. ($run ? ".run" : "") . ".json"), true);
return $config;
}
function saveConfig($name, $data, $run = false)
{
global $indicatorsFolder;
$data = json_encode($data, JSON_PRETTY_PRINT);
if ($data == null)
return false;
return file_put_contents($indicatorsFolder . $name . ($run ? ".run" : "") . ".json", $data);
}
function updateConfigValues($config, $newValues)
{
foreach ($newValues["pairsToTest"] as $key => $value)
{
if ($value === "1")
{
$newValues["pairsToTest"][$key] = true;
}
}
$updated = array_replace_recursive($config, $newValues);
return $updated;
}
function setIndicatorToRun($indicator, $toRun, $isRun)
{
global $indicatorsFolder;
$oldname = $indicatorsFolder . $indicator . ($isRun ? ".run" : "") . ".json";
$newname = $indicatorsFolder . $indicator . ($toRun ? ".run" : "") . ".json";
return @rename($oldname, $newname);
}
function shutdownServer()
{
$wmi = new \COM('winmgmts://');
$processes = $wmi->ExecQuery('SELECT ExecutablePath, ProcessId FROM Win32_Process WHERE CommandLine like "%php -S localhost:8000%"');
$list = [];
if ($processes)
{
foreach ($processes as $a)
{
session_write_close();
ignore_user_abort(true);
ob_end_clean();
ob_start();
echo "Server killed, you can close this tab now.";
@ob_flush();@flush();
shell_exec('taskkill /F /PID '.$a->ProcessId);
die();
}
}
}
function getIndicator($name, $indicators)
{
$names = array_column($indicators, "name");
$keys = array_flip($names);
if (isset($keys[$name]))
return $indicators[$keys[$name]];
return null;
}
$config = [];
$eaIni = [];
$pairs = [];
$action = "list";
$indicator = "";
$indicatorsList = getIndicatorsList();
if (isset($_POST["action"]))
{
$action = $_POST["action"];
$indicator = $_POST["indicator"];
unset($_POST["action"], $_POST["indicator"]);
if ($action === "save-edit")
{
$oldIndicator = $_POST["old-indicator"];
unset($_POST["old-indicator"]);
$toRun = isset($_POST["run"]) ? true : false;
unset($_POST["run"]);
$indicatorData = getIndicator($oldIndicator, $indicatorsList);
$config = loadConfig($oldIndicator, $indicatorData["run"]);
$updated = updateConfigValues($config, $_POST);
deleteConfig($oldIndicator, $indicatorData["run"]);
saveConfig($indicator, $updated, $indicatorData["run"]);
setIndicatorToRun($indicator, $toRun, $indicatorData["run"]);
$_SESSION['message'] = ["type" => "success", "text" => "Indicator config '".$indicator."' saved!"];
header("Location: ".$_SERVER["SCRIPT_NAME"]);
die();
}
else if ($action === "save-new")
{
// indicator exists?
if (exists($indicator))
{
$_SESSION['message'] = ["type" => "danger", "text" => "Indicator config with name '".$indicator."' already exists."];
$config = loadDefaultConfig();
$config = updateConfigValues($config, $_POST);
$eaIni = convertEaSettingsToTable($config);
$action = "new";
}
else
{
$toRun = isset($_POST["run"]) ? true : false;
unset($_POST["run"]);
// new indicator
$config = loadDefaultConfig();
$updated = updateConfigValues($config, $_POST);
$configSaved = saveConfig($indicator, $updated);
setIndicatorToRun($indicator, $toRun, false);
if (!$configSaved)
$_SESSION['message'] = ["type" => "danger", "text" => "Error indicator config '".$indicator."'"];
else
$_SESSION['message'] = ["type" => "success", "text" => "New indicator config '".$indicator."' saved!"];
header("Location: ".$_SERVER["SCRIPT_NAME"]);
die();
}
}
else if (in_array($action, ["save-run", "save-dont-run"]))
{
$toRun = $action === "save-run";
$indicators = array_flip(json_decode($indicator, true));
foreach ($indicatorsList as $key => $value)
{
if (!isset($indicators[$value["name"]]))
continue;
setIndicatorToRun($value["name"], $toRun, $value["run"]);
}
$_SESSION['message'] = ["type" => "success", "text" => "Indicators configs saved to ". ($toRun ? "'run'" : "'don't run'") . "."];
header("Location: ".$_SERVER["SCRIPT_NAME"]);
die();
}
}
else if (isset($_GET["action"]))
{
$action = $_GET["action"];
$indicator = isset($_GET["indicator"]) ? base64_decode($_GET["indicator"]) : null;
if ($action === "edit")
{
$indicatorData = getIndicator($indicator, $indicatorsList);
$config = loadConfig($indicator, $indicatorData["run"]);
$config["run"] = $indicatorData["run"];
$eaIni = convertEaSettingsToTable($config);
$pairs = $config["pairsToTest"];
}
else if ($action === "new")
{
if (isset($indicator))
{
$indicatorData = getIndicator($indicator, $indicatorsList);
$config = loadConfig($indicator, $indicatorData["run"]);
$config["run"] = $indicatorData["run"];
$indicator = "DUPLICATE " . $indicator;
}
else
{
$config = loadDefaultConfig();
$config["run"] = true;
}
$eaIni = convertEaSettingsToTable($config);
$pairs = $config["pairsToTest"];
}
else if ($action === "delete")
{
$indicatorData = getIndicator($indicator, $indicatorsList);
deleteConfig($indicator, $indicatorData["run"]);
$_SESSION['message'] = ["type" => "success", "text" => "Indicator config '".$indicator."' deleted!"];
header("Location: ".$_SERVER["SCRIPT_NAME"]);
die();
}
else if ($action === "shutdown")
{
shutdownServer();
die();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Indicators Configs</title>
<meta charset="utf-8">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="assets/css/select.dataTables.min.css">
<link rel="stylesheet" href="assets/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="assets/css/glyphicons.css">
<style>
#DataTables_Table_0_info
{
float: left !important;
padding-top: 5px;
}
input[type=checkbox].bigger-checkbox
{
transform: scale(1.5);
}
.navbar-divider
{
height: 30px;
margin: 5px 5px;
width: 1px;
background-color: #ccc;
}
#table-list_paginate
{
float: right;
padding-top: 10px;
}
#table-list_paginate a
{
padding: 4px;
cursor: hand;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<div id="notifs">
<?php if (isset($_SESSION['message'])):
$message = $_SESSION['message'];
unset($_SESSION['message']);
?>
<div class="alert alert-<?php echo $message["type"]; ?> alert-dismissible fade show" role="alert">
<?php echo $message["text"]; ?>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php endif; ?>
</div>
<nav class="navbar navbar-light bg-light navbar-expand-sm">
<a href="indicatorsConfigs.php" class="navbar-brand">Indicators Configs</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" >
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-between" id="navbarTogglerDemo02">
<ul class="navbar-nav ml-auto">
<?php if ($action === "edit"): ?>
<li class="nav-item <?php echo $action === 'edit' ? 'active' : ''; ?>">
<a class="nav-link <?php echo $action === 'edit' ? 'text-warning' : ''; ?>" href="#"><i class="glyphicon glyphicon-pencil"></i> Edit</a>
</li>
<?php endif; ?>
<li class="nav-item <?php echo $action === 'list' ? 'active' : ''; ?>">
<a class="nav-link <?php echo $action === 'list' ? 'text-primary' : ''; ?>" href="?"><i class="glyphicon glyphicon-list"></i> List</a>
</li>
<li class="nav-item <?php echo $action === 'new' ? 'active' : ''; ?>">
<a class="nav-link <?php echo $action === 'new' ? 'text-success' : ''; ?>" href="?action=new"><i class="glyphicon glyphicon-plus"></i> New</a>
</li>
<li class="navbar-divider"></li>
<li class="nav-item">
<a class="nav-link" href="?action=shutdown"><i class="glyphicon glyphicon-off"></i> Shutdown</a>
</li>
</ul>
</div>
</nav>
<br>
<div class="row">
<div class="col-12">
<div class="tab-content" id="tabContent">
<?php if (!in_array($action, ["edit", "new"])): ?>
<div class="tab-pane fade <?php echo $action === 'list' ? 'show active' : ''; ?>" id="tab-content-list" role="tabpanel" aria-labelledby="list-tab">
<form method="post">
<input type="hidden" name="action" value="">
<input type="hidden" name="indicator" value="">
<h5>List <small class="text-muted">List of saved indicators configs</small></h5>
<br>
<table id="table-list" class="table table-hover">
<thead>
<tr>
<th class="bg-light" style="width: 20px;"></th>
<th class="bg-light" style="width: 10px;">Run?</th>
<th class="bg-light">Config name</th>
<th class="bg-light" style="width: 170px;">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($indicatorsList as $key => $value): ?>
<tr>
<td class="align-middle text-center">
<div class="form-check">
<input class="form-check-input bigger-checkbox run-checkbox" type="checkbox" id="run-<?php echo $key; ?>" value="1">
<label class="form-check-label" for="run-<?php echo $key; ?>"></label>
</div>
</td>
<td class="align-middle text-center">
<span class="text-<?php echo $value["run"] ? "success glyphicon glyphicon-ok" : "danger glyphicon glyphicon-remove"; ?>" style="font-size: 1.2em;">
<span style="color: transparent;"><?php echo $value["run"] ? "1": "0"; ?></span>
</span>
</td>
<td>
<?php echo $value["name"]; ?>
</td>
<td class="align-middle text-center">
<a class="btn btn-sm btn-light" title="Run" href="#" onclick="table.row(<?php echo $key; ?>).select(); buttonSaveRun(true, true)">
<span class="glyphicon glyphicon-ok text-success"></span>
</a>
<a class="btn btn-sm btn-light" title="Don't run" href="#" onclick="table.row(<?php echo $key; ?>).select(); buttonSaveRun(false, true)">
<span class="glyphicon glyphicon-remove text-danger"></span>
</a>
<a class="btn btn-sm btn-light" title="Edit" href="#" onclick="window.location='?action=edit&indicator='+encodeURIComponent('<?php echo base64_encode($value["name"]); ?>')">
<span class="glyphicon glyphicon-pencil text-warning"></span>
</a>
<a class="btn btn-sm btn-light" title="Duplicate" href="#" onclick="window.location='?action=new&indicator='+encodeURIComponent('<?php echo base64_encode($value["name"]); ?>')">
<span class="glyphicon glyphicon-duplicate text-info"></span>
</a>
<a class="btn btn-sm btn-light" title="Delete" href="#" onclick="return deleteIndicator('<?php echo base64_encode($value["name"]); ?>')">
<span class="glyphicon glyphicon-trash text-danger"></span>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</form>
</div>
<?php else: ?>
<div class="tab-pane fade <?php echo in_array($action, ["edit", "new"]) ? 'show active' : ''; ?>" id="tab-content-<?php echo $action; ?>" role="tabpanel" aria-labelledby="edit-tab">
<form method="post" <?php echo ($action === "new") ? 'onsubmit="return checkIndicatorName()"' : ''; ?>>
<input type="hidden" name="action" value="save-<?php echo $action; ?>">
<span class="h5">
<?php echo ucfirst($action); ?>
<?php if ($action === "edit"): ?>
<input type="hidden" name="old-indicator" value="<?php echo htmlentities($indicator); ?>">
<?php endif; ?>
<span>
<input style="width:300px" type="text" class="form-control form-control-sm d-inline-block"
name="indicator" placeholder="Indicator name" value="<?php echo htmlentities($indicator); ?>" required>
</span>
<div class="form-check form-check-inline h6">
<input class="form-check-input" type="checkbox" <?php echo $action !== "list" ? ($config["run"] ? "checked" : "") : ""; ?> id="run-<?php echo $action; ?>" name="run" value="1">
<label class="form-check-label" for="run-<?php echo $action; ?>">Run</label>
</div>
<span class="float-right">
<input type="submit" class="btn btn-success" onclick="window.onbeforeunload=null;" value="Save">
</span>
</span>
<br><br>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" href="#edit-ea" data-toggle="tab" role="tab">EA Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#edit-pairs" data-toggle="tab" role="tab">Pairs to test</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="edit-ea" role="tabpanel">
<br>
<table class="table table-sm table-hover">
<thead>
<tr>
<th class="bg-light">Name</th>
<th>Opt.</th>
<th>Variable</th>
<th>Start</th>
<th>Step</th>
<th>Stop</th>
</tr>
</thead>
<tbody>
<?php foreach ($eaIni as $key => $value):
$alone = !isset($value["start"]) && !isset($value["step"]) && !isset($value["stop"]);
?>
<tr>
<td class="bg-light align-middle">
<?php echo $value["variable"]["name"]; ?>
</td>
<td class="align-middle text-center">
<?php if (isset($value["optimization"]["value"])): ?>
<div class="form-check">
<input class="form-check-input bigger-checkbox" type="checkbox" id="defaultCheck-<?php echo $key; ?>"
<?php echo $value["optimization"]["value"] === '1' ? 'checked' : '' ; ?>
name="eaIni[inputs][<?php echo htmlentities($value["optimization"]["name"]); ?>]" value="1">
<label class="form-check-label" for="defaultCheck-<?php echo $key; ?>"></label>
</div>
<?php endif; ?>
</td>
<td colspan="<?php echo $alone ? '4' :''; ?>">
<input class="form-control" type="text"
value="<?php echo htmlentities($value["variable"]["value"]); ?>"
name="eaIni[inputs][<?php echo htmlentities($value["variable"]["name"]); ?>]"
<?php echo !$alone && $value["optimization"]["value"] === '1' ? 'disabled' : ''; ?>>
</td>
<?php if (!$alone): ?>
<td>
<input class="form-control" type="text"
value="<?php echo htmlentities($value["start"]["value"]); ?>"
name="eaIni[inputs][<?php echo htmlentities($value["start"]["name"]); ?>]"
<?php echo $value["optimization"]["value"] === '1' ? '' : 'disabled'; ?>>
</td>
<td>
<input class="form-control" type="text"
value="<?php echo htmlentities($value["step"]["value"]); ?>"
name="eaIni[inputs][<?php echo htmlentities($value["step"]["name"]); ?>]"
<?php echo $value["optimization"]["value"] === '1' ? '' : 'disabled'; ?>>
</td>
<td>
<input class="form-control" type="text"
value="<?php echo htmlentities($value["stop"]["value"]); ?>"
name="eaIni[inputs][<?php echo htmlentities($value["stop"]["name"]); ?>]"
<?php echo $value["optimization"]["value"] === '1' ? '' : 'disabled'; ?>>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="edit-pairs" role="tabpanel">
<br>
<div class="btn-group-toggle" data-toggle="buttons">
<?php foreach ($pairs as $key => $value): ?>
<label class="btn btn-outline-info <?php echo $value ? 'active' :'' ;?>" style="width:100px; margin-bottom: 10px; margin-right: 10px; ">
<input type="checkbox" <?php echo $value ? 'checked' :'' ;?> autocomplete="off" name="pairsToTest[<?php echo $key; ?>]" value="1"> <?php echo $key; ?>
</label>
<?php endforeach; ?>
</div>
</div>
</div>
</form>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery-3.3.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/datatables.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.select.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script>
function buttonSaveRun(run, skip)
{
if (skip === undefined)
skip = false;
var data = $("#table-list").DataTable().rows({selected: true}).data();
if (data.length === 0)
{
alert("No rows selected!");
return;
}
var func = function()
{
var indicators = [];
data.each(function(el, i)
{
indicators.push(el[2]);
});
$("[name=indicator").val(JSON.stringify(indicators));
$("[name=action").val(run ? "save-run" : "save-dont-run");
//window.location = "?action=save-run&indicator="+encodeURIComponent(indi);
$("#table-list").parents("form").submit();
return true;
};
if (skip)
{
func();
}
if (!skip && confirm("Set "+data.length+" rows to "+(run ? "" : "not ")+"run?"))
{
func();
}
return false;
}
var table = $("#table-list").DataTable({
"paging": true,
"order": [[1, "desc"], [2, "desc"]],
"pageLength": 10,
"select":
{
items: "row",
style: "multi",
selector: '.run-checkbox',
},
"buttons":
[
{
text: "Save 'run'",
action: buttonSaveRun.bind(null, true),
},
{
text: "Save 'don't run'",
action: buttonSaveRun.bind(null, false),
},
],
"dom": "Bfrtpil",
});
$(".bigger-checkbox").on("click", function(e)
{
var checked = e.currentTarget.checked;
var tr = $(e.currentTarget).parents("tr");
tr.find("td").eq(2).find("input[type=text]").prop("disabled", checked);
tr.find("td").eq(3).find("input[type=text]").prop("disabled", !checked);
tr.find("td").eq(4).find("input[type=text]").prop("disabled", !checked);
tr.find("td").eq(5).find("input[type=text]").prop("disabled", !checked);
});
<?php if ($action !== "list"): ?>
window.onbeforeunload = function()
{
return "Leaving will discard any changes! Continue?";
};
<?php endif; ?>
function deleteIndicator(indi)
{
if (confirm("Are you sure you want to delete '"+atob(indi)+"' config?"))
{
window.location = "?action=delete&indicator="+encodeURIComponent(indi);
return true;
}
return false;
}
function checkIndicatorName()
{
if ($("[name=indicator]").val().trim() === "")
{
alert("New indicator name is empty!");
return false;
}
return true;
}
</script>
</body>
</html>