-
Notifications
You must be signed in to change notification settings - Fork 2
/
warningnote.js.php
59 lines (55 loc) · 1.94 KB
/
warningnote.js.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
<?php
require_once('status.php');
$handle = fopen($manual_note, "r");
$warning = fread($handle, filesize($manual_note));
fclose($handle);
?>
theAlert = "<?php echo $warning; ?>";
function warningNote(warningText) {
var warningPlace = document.getElementsByTagName("prm-search-bar")[0];
var warningNote = document.createElement("div");
warningNote.id = "warningNote";
warningNote.className = "bar alert-bar layout-align-center-center layout-row";
warningNote.innerHTML = warningText;
warningPlace.parentNode.insertBefore(warningNote,warningPlace.nextSibling);
}
status_A = '<?php echo $status_A; ?>';
note_A = '<?php echo $note_A; ?>';
status_P = '<?php echo $status_P; ?>';
note_P = '<?php echo $note_P; ?>';
if (theAlert == "") {
if (status_A == "PERF" || status_A == "ERROR" || status_A == "MAINT") {
theAlert = theAlert + 'Automated note: <strong>' + '<?php echo $readable_status[$status_A]; ?>' + '</strong>';
if (status_A == "MAINT") {
theAlert = theAlert + ' in progress';
} else {
theAlert = theAlert + ' detected';
}
theAlert = theAlert + '. Some functions (eg requests, renewals, availability statuses, and/or links to full-text) may be ';
if (status_A == "PERF") {
theAlert = theAlert + 'slow';
} else {
theAlert = theAlert + 'temporarily unavailable';
}
}
if (status_P == "PERF" || status_P == "ERROR" || status_P == "MAINT") {
theAlert = theAlert + 'Automated note: <strong>' + '<?php echo $readable_status[$status_P]; ?>' + '</strong>';
if (status_P == "MAINT") {
theAlert = theAlert + ' in progress';
} else {
theAlert = theAlert + ' detected';
}
theAlert = theAlert + '. Some functions (especially search-related) may be ';
if (status_P == "PERF") {
theAlert = theAlert + 'slow';
} else {
theAlert = theAlert + 'temporarily unavailable';
}
}
if (theAlert != "") {
theAlert = theAlert + '.<br/>' + "<?php echo $auto_apology; ?>";
}
}
if (theAlert != "") {
warningNote("<p>"+theAlert+"</p>");
}