|
@@ -32,6 +32,14 @@ if ($account['Level'] != 'guest') {
|
|
|
muoribene("Non hai i permessi per vedere questa pagina", true);
|
|
|
}
|
|
|
|
|
|
+$filtordon = false;
|
|
|
+if ($filtordon) {
|
|
|
+ $filtordimgoff = 'imgs/cerca_act_off.svg';
|
|
|
+ $filtordimgon = 'imgs/cerca_act_on.svg';
|
|
|
+} else {
|
|
|
+ $filtordimgoff = 'imgs/cerca_off.svg';
|
|
|
+ $filtordimgon = 'imgs/cerca_on.svg';
|
|
|
+}
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE HTML>
|
|
@@ -52,241 +60,24 @@ if ($account['Level'] != 'guest') {
|
|
|
<script language="JavaScript">
|
|
|
<!--
|
|
|
<?php if ($account['Level'] != 'guest') require('js/notifs.js.php'); ?>
|
|
|
- function deselect(selid) {
|
|
|
- var sel = document.getElementById(selid);
|
|
|
- sel.selectedIndex = -1;
|
|
|
- }
|
|
|
-
|
|
|
- function getselarr(selid) {
|
|
|
- var sel = document.getElementById(selid), selc = sel.length, i, arr = [];
|
|
|
- for (i = 0; i < selc; i++)
|
|
|
- arr.push([sel.options[i].text, sel.options[i].value, sel.options[i].selected]);
|
|
|
- return arr;
|
|
|
- }
|
|
|
-
|
|
|
- function updselarr(selid, selarr) {
|
|
|
- var sel = document.getElementById(selid), selc = sel.length, selarrc = selarr.length, i, ii;
|
|
|
- sel = sel.options;
|
|
|
- ii = 0;
|
|
|
- for (i = 0; i < selc; i++) {
|
|
|
- while (ii < selarrc) {
|
|
|
- if (selarr[ii][1] == sel[i].value) {
|
|
|
- (sel[i].selected) ? selarr[ii][2] = true : selarr[ii][2] = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- ii++;
|
|
|
- }
|
|
|
- }
|
|
|
- return selarr;
|
|
|
- }
|
|
|
-
|
|
|
- function filtsel(selarr, filt, selid, recbid, inpid, ocol, ecol) {
|
|
|
- var sel = document.getElementById(selid), selarrc = selarr.length, i, ii, go = true;
|
|
|
- if (!document.getElementById(recbid).checked) {
|
|
|
- filt = filt.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
|
|
|
- } else {
|
|
|
- try {
|
|
|
- (RegExp(filt));
|
|
|
- } catch (e) {
|
|
|
- go = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (go) {
|
|
|
- sel.length = 0;
|
|
|
- for (i = 0; i < selarrc; i++) {
|
|
|
- if (RegExp(filt, 'i').test(selarr[i][0]))
|
|
|
- sel.options.add(new Option(selarr[i][0], selarr[i][1], false, selarr[i][2]));
|
|
|
- }
|
|
|
- if (ocol != null)
|
|
|
- document.getElementById(inpid).style.backgroundColor = ocol;
|
|
|
- } else if (ecol != null) {
|
|
|
- document.getElementById(inpid).style.backgroundColor = ecol;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function selup(selid) {
|
|
|
- var sel = document.getElementById(selid), len = sel.length, i, prevopt, curopt;
|
|
|
- if (sel.selectedIndex > 0) {
|
|
|
- for (i = 0; i < len; i++) {
|
|
|
- if (sel.options[i].selected) {
|
|
|
- prevopt = sel.options[i - 1];
|
|
|
- curopt = sel.options[i];
|
|
|
- sel.remove(i - 1);
|
|
|
- sel.remove(i - 1);
|
|
|
- sel.add(curopt, i - 1);
|
|
|
- sel.add(prevopt, i);
|
|
|
- }
|
|
|
+ function toggleState(check) {
|
|
|
+ let checkboxes = document.querySelectorAll("div#notifs-list > div > input.seen-checkbox");
|
|
|
+ checkboxes.forEach(function (box) {
|
|
|
+ box.checked = check.checked;
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function readAllSelected() {
|
|
|
+ let notifs = document.querySelectorAll("div#notifs-list > div");
|
|
|
+ notifs.forEach(function (notif) {
|
|
|
+ let checkbox = notif.querySelector("input.seen-checkbox");
|
|
|
+ if (checkbox.checked) {
|
|
|
+ markread(notif);
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- function seltop(selid) {
|
|
|
- var sel = document.getElementById(selid);
|
|
|
- while (sel.selectedIndex > 0)
|
|
|
- selup(selid);
|
|
|
- }
|
|
|
-
|
|
|
- function seldown(selid) {
|
|
|
- var sel = document.getElementById(selid), len = sel.length, i, nextopt, curopt;
|
|
|
- if (!sel.options[len - 1].selected) {
|
|
|
- for (i = len - 1; i > -1; i--) {
|
|
|
- if (sel.options[i].selected) {
|
|
|
- curopt = sel.options[i];
|
|
|
- nextopt = sel.options[i + 1];
|
|
|
- sel.remove(i);
|
|
|
- sel.remove(i);
|
|
|
- sel.add(curopt, i);
|
|
|
- sel.add(nextopt, i);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function selbot(selid) {
|
|
|
- var sel = document.getElementById(selid), len = sel.length;
|
|
|
- if (sel.selectedIndex >= 0) {
|
|
|
- while (!sel.options[len - 1].selected)
|
|
|
- seldown(selid);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function selonebyval(refarr, val) {
|
|
|
- var len = refarr.length, i;
|
|
|
- for (i = len - 1; i > -1; i--)
|
|
|
- (refarr[i][1] == val) ? refarr[i][2] = true : refarr[i][2] = false;
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- function rmelbyval(refarr, val) {
|
|
|
- var len = refarr.length, i;
|
|
|
- for (i = len - 1; i > -1; i--) {
|
|
|
- if (refarr[i][1] == val) {
|
|
|
- refarr.splice(i, 1);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- // usato da edinsth.php
|
|
|
- function cheltxtbyval(refarr, val, ntxt) {
|
|
|
- var len = refarr.length, i;
|
|
|
- for (i = len - 1; i > -1; i--) {
|
|
|
- if (refarr[i][1] == val) {
|
|
|
- refarr[i][0] = ntxt;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- // usato da edinsth.php
|
|
|
- function chelvalbyval(refarr, val, nval) {
|
|
|
- var len = refarr.length, i;
|
|
|
- for (i = len - 1; i > -1; i--) {
|
|
|
- if (refarr[i][1] == val) {
|
|
|
- refarr[i][1] = nval;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- function seladd(fromselid, toselid, refarr) {
|
|
|
- var fromsel = document.getElementById(fromselid), fslen = fromsel.length,
|
|
|
- tosel = document.getElementById(toselid), i;
|
|
|
-// farlo a scalare invece che a crescere inverte nella select di destinazione l'ordine delle opzioni scelte in quella di origine, perciò lo faccio a crescere
|
|
|
- for (i = 0; i < fslen; i++) {
|
|
|
- if (fromsel.options[i].selected) {
|
|
|
- refarr = rmelbyval(refarr, fromsel.options[i].value);
|
|
|
- tosel.add(fromsel.options[i]);
|
|
|
- fslen--;
|
|
|
- i--;
|
|
|
- }
|
|
|
- }
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- function sortByKey(array, key) {
|
|
|
- return array.sort(function (a, b) {
|
|
|
- var x = a[key].toLowerCase();
|
|
|
- var y = b[key].toLowerCase();
|
|
|
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function selrem(fromselid, toselid, refarr, searchid, regexcbid) {
|
|
|
- var fromsel = document.getElementById(fromselid), fslen = fromsel.length,
|
|
|
- tosel = document.getElementById(toselid), i;
|
|
|
- for (i = fslen - 1; i > -1; i--) {
|
|
|
- if (fromsel.options[i].selected) {
|
|
|
- refarr.push([fromsel.options[i].text, fromsel.options[i].value, true]);
|
|
|
- fromsel.remove(i);
|
|
|
- }
|
|
|
- }
|
|
|
- refarr = sortByKey(refarr, 0);
|
|
|
- filtsel(refarr, document.getElementById(searchid).value, toselid, regexcbid, searchid, 'white', '#ff8080');
|
|
|
- return refarr;
|
|
|
- }
|
|
|
-
|
|
|
- function selordalf(selid) {
|
|
|
- var sel = document.getElementById(selid), len = sel.length, arr = [], i;
|
|
|
- for (i = 0; i < len; i++)
|
|
|
- arr.push([sel.options[i].text, sel.options[i].value, sel.options[i].selected]);
|
|
|
- arr = sortByKey(arr, 0);
|
|
|
- sel.length = 0;
|
|
|
- for (i = 0; i < len; i++)
|
|
|
- sel.add(new Option(arr[i][0], arr[i][1], false, arr[i][2]));
|
|
|
- }
|
|
|
-
|
|
|
- function selordinv(selid) {
|
|
|
- var sel = document.getElementById(selid), len = sel.length, arr = [], i;
|
|
|
- for (i = 0; i < len; i++)
|
|
|
- arr.push([sel.options[i].text, sel.options[i].value, sel.options[i].selected]);
|
|
|
- arr = arr.reverse();
|
|
|
- sel.length = 0;
|
|
|
- for (i = 0; i < len; i++)
|
|
|
- sel.add(new Option(arr[i][0], arr[i][1], false, arr[i][2]));
|
|
|
- }
|
|
|
-
|
|
|
- function closeinpup() {
|
|
|
- document.getElementById('inpopup').innerHTML = '<div id="popupcont">...</div>';
|
|
|
- document.getElementById('popup').style.display = 'none';
|
|
|
- }
|
|
|
-
|
|
|
- function edit(selid, what, mode) {
|
|
|
- var act = '', id = 0;
|
|
|
- if (mode == 'edit')
|
|
|
- act = {0: 'Editing', 1: 'edit'};
|
|
|
- else if (mode == 'add')
|
|
|
- act = {0: 'Adding', 1: 'add'};
|
|
|
- else if (mode == 'remove')
|
|
|
- act = {0: 'Removing', 1: 'remove'};
|
|
|
- var sel = document.getElementById(selid);
|
|
|
- if ((mode == 'edit' || mode == 'remove') && sel.selectedIndex < 0) {
|
|
|
- alerta('Error', '<p>You have to select an entry to ' + act[1] + ' ;-)</p>');
|
|
|
- } else {
|
|
|
- if (mode == 'edit' || mode == 'remove')
|
|
|
- id = sel.options[sel.selectedIndex].value;
|
|
|
- document.getElementById('inpopup').innerHTML = '<div class="hiftit"><img src="imgs/p.png" style="float:left;width:24px;height:24px">' + act[0] + ' «' + what + '» entry<img src="imgs/close.svg" class="imgbut" style="float:right;" onclick="closeinpup()"></div><iframe src="edinsth.php?w=' + selid + '&i=' + id + '&m=' + mode + '" class="hiframe"></iframe>';
|
|
|
- document.getElementById('popup').style.display = 'table';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function ckf() {
|
|
|
- // questo qua sotto resetta eventuale filtro su LocalityID in modo che se c'è valore selezionato ma non mostrato viene passato
|
|
|
- filtsel(locselarr, '', 'LocalityID', 'locselre', 'locsearch', 'white', '#ff8080');
|
|
|
- var selids = ['ChosenLangs[]', 'ChosenFinModes[]', 'ChosenPolicies[]', 'ChosenTags[]'], len = selids.length,
|
|
|
- i, sel, ii;
|
|
|
- for (i = 0; i < len; i++) {
|
|
|
- sel = document.getElementById(selids[i]).options;
|
|
|
- for (ii = 0; ii < sel.length; ii++)
|
|
|
- sel[ii].selected = true;
|
|
|
- }
|
|
|
- document.getElementById('f').submit();
|
|
|
- }
|
|
|
-
|
|
|
- //-->
|
|
|
+ // -->
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
|
@@ -308,9 +99,16 @@ if ($account['Level'] != 'guest') {
|
|
|
|
|
|
<div id="fullscreen">
|
|
|
<div id="middlerow">
|
|
|
+ <div id="notifs-list-controls">
|
|
|
+ <input id="global-selector" type="checkbox" onclick="toggleState(this)">
|
|
|
+ <button onclick="readAllSelected()">Segna tutti come letto</button>
|
|
|
+ </div>
|
|
|
<div id="notifs-list">
|
|
|
<?php
|
|
|
if ($account['Level'] != 'guest') {
|
|
|
+ // Questi valori sono un po' a naso,
|
|
|
+ // dovrebbero avere senso ma non ho
|
|
|
+ // indagato troppo
|
|
|
$sev_classes = array(
|
|
|
1 => "sev-normal",
|
|
|
2 => "sev-warning",
|
|
@@ -323,12 +121,14 @@ if ($account['Level'] != 'guest') {
|
|
|
foreach ($notifs['notifs'] as $n) {
|
|
|
echo("<div id=\"notif-" . $n["ID"] .
|
|
|
"\" class=\"" . $sev_classes[$n["Severity"]] . " " . $seen_class[$n["Seen"]] . "\">" .
|
|
|
+ "<input type=\"checkbox\" class=\"seen-checkbox\">" .
|
|
|
$n["Notification"] .
|
|
|
"<button type='button' onclick='markread(this.parentElement)'>✕</button>" .
|
|
|
"</div>\n");
|
|
|
}
|
|
|
} ?>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|