$users = exec_query("select id,username as name,alias from users");
$hosts = exec_query("select id,hostname as name,alias from hosts");
$data["dictionaries"] = Array( "user_id" => $users, "host_id" => $hosts);
+ $data["online_refresh"] = $online_refresh;
+ $data["online_history"] = $online_history;
break;
urlbase="./api.php"
-refresh = 1000
-online_history = 60
-
graph_colors = [
"salmon", "lightcoral", "crimson", "red", "darkred", "orangered",
"gold", "orange", "yellow", "darkkhaki", "lime", "green", "greenyellow",
current_time = null
time_labels = []
-var d = new Date();
-var curr_day = d.getDate();
-var curr_month = d.getMonth() + 1;
-var curr_year = d.getFullYear();
-today = curr_year + "-" + curr_month + "-" + curr_day;
+function toDate(d) {
+ var curr_day = d.getDate();
+ if (curr_day<10) { curr_day = '0' + curr_day; }
+ var curr_month = d.getMonth() + 1;
+ if (curr_month<10) { curr_month = '0' + curr_month; }
+ var curr_year = d.getFullYear();
+ return curr_year + "-" + curr_month + "-" + curr_day
+}
+
+function Today() {
+ var dToday = new Date();
+ dToday.setHours(0,0,0,0)
+ return dToday
+}
+
+today = toDate(Today());
date_from = today
date_to = today
var logo = document.getElementById("brand");
logo.innerText = props["site-header"];
+ refresh = props["online_refresh"]
+ online_history = props["online_history"]
+
cats = props["cats"]
for (var i in res["columns"]) {
}
+function DateLeft() {
+ UpdateDates()
+ var dFrom = new Date(date_from)
+ var dTo = new Date(date_to)
+ var delta = Math.round(((dTo.getTime() - dFrom.getTime()))/(86400*1000))
+ dTo.setDate(dTo.getDate() - (1 + delta))
+ dFrom.setDate(dFrom.getDate() - (1 + delta))
+ date_from = toDate(dFrom)
+ date_to = toDate(dTo)
+ SetDates()
+}
+
+function DateRight() {
+ dToday = new Date();
+ UpdateDates()
+ var dFrom = new Date(date_from)
+ var dTo = new Date(date_to)
+ var delta = Math.round(((dTo.getTime() - dFrom.getTime()))/(86400*1000))
+ dFrom.setDate(dFrom.getDate() + 1 + delta)
+ dTo.setDate(dTo.getDate() + 1 + delta)
+ if (dTo>Today()) {
+ dTo = Today()
+ }
+ if (dFrom>Today()) {
+ dFrom = Today()
+ }
+ date_from = toDate(dFrom)
+ date_to = toDate(dTo)
+ SetDates()
+}
+
function SetFilter(name,select) {
current_filter[name] = select.value;
}