summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/frontend
diff options
context:
space:
mode:
authorMichael Scherle2017-03-03 00:14:34 +0100
committerMichael Scherle2017-03-03 00:14:34 +0100
commit66b038aa9d5442717411927b0380f0e0e7954eab (patch)
tree45feb39c4b7ffaf5487557afe3fbd5794b9e72e7 /modules-available/locationinfo/frontend
parentfrontend: added calendar support back in (diff)
downloadslx-admin-66b038aa9d5442717411927b0380f0e0e7954eab.tar.gz
slx-admin-66b038aa9d5442717411927b0380f0e0e7954eab.tar.xz
slx-admin-66b038aa9d5442717411927b0380f0e0e7954eab.zip
code reformat
Diffstat (limited to 'modules-available/locationinfo/frontend')
-rwxr-xr-xmodules-available/locationinfo/frontend/multidoorsign.html445
1 files changed, 206 insertions, 239 deletions
diff --git a/modules-available/locationinfo/frontend/multidoorsign.html b/modules-available/locationinfo/frontend/multidoorsign.html
index afe33472..953db690 100755
--- a/modules-available/locationinfo/frontend/multidoorsign.html
+++ b/modules-available/locationinfo/frontend/multidoorsign.html
@@ -40,10 +40,10 @@ optional:
font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
margin: 0;
width: 100%;
- height:100%;
+ height: 100%;
float: left;
box-sizing: border-box;
- display:flex;
+ display: flex;
background-color: #cacaca;
overflow: hidden;
@@ -51,7 +51,7 @@ optional:
.row {
background-color: #404040;
- box-shadow: 0 0.1875rem 0.375rem rgba(0,0,0,0.25);
+ box-shadow: 0 0.1875rem 0.375rem rgba(0, 0, 0, 0.25);
margin-bottom: 4px;
width: 100%;
@@ -64,7 +64,8 @@ optional:
padding: 0;
height: 8vw;
}
- .progressbar{
+
+ .progressbar {
width: 0px;
height: 2px;
position: absolute;
@@ -72,6 +73,7 @@ optional:
bottom: 0px;
z-index: 1;
}
+
.font {
display: table-cell;
vertical-align: middle;
@@ -109,16 +111,11 @@ optional:
boxSizing: border-box;
}
- .roompadding{
-
-
+ .roompadding {
}
-
-
-
- .room{
+ .room {
position: relative;
background-color: white;
width: 100%;
@@ -136,7 +133,6 @@ optional:
dboxSizing: border-box;
background: linear-gradient(#cccccc, white);
-
}
.free-busy-busy {
@@ -236,29 +232,6 @@ optional:
border-color: grey;
}
- /*
- @media (max-width: 1200px) {
- .square {
- height: 60px;
- width: 60px;
- }
-
- .FreeSeatsFont {
- font-size: 45px;
- }
-
- .font {
- font-size: 26px;
- }
-
- .header {
- height: 60px;
-
- }
- */
-
-
- }
</style>
<script type='text/javascript'>
@@ -271,8 +244,8 @@ optional:
var lastCalendarUpdateTime;
var roomIds;
//Todo change these
- var CalendarUpdateTime = 60*1000;
- var RoomUpdateTime = 60*1000;
+ var CalendarUpdateTime = 60 * 1000;
+ var RoomUpdateTime = 60 * 1000;
var date;
@@ -303,7 +276,8 @@ optional:
"closed": "Fechado",
"free": "Livre",
"shortDays": ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Se', 'Sáb'],
- "longDays": ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'],
+ "longDays": ['Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira',
+ 'Sexta-feira', 'Sábado'],
"to": "para"
}
@@ -319,7 +293,7 @@ optional:
});
// Downloads the config of a room
- function getConfig(id,room) {
+ function getConfig(id, room) {
$.ajax({
url: "../../../api.php?do=locationinfo&action=config&id=" + id,
dataType: 'json',
@@ -340,9 +314,9 @@ optional:
SetUpDate(time);
delete result.time;
- room = addRoom(id,result.room,result);
+ room = addRoom(id, result.room, result);
roomsToshow++;
- if(roomsToshow == roomIds.length){
+ if (roomsToshow == roomIds.length) {
initRooms();
@@ -363,7 +337,6 @@ optional:
}, room.config.configupdate);
-
}, error: function () {
var heading = $("#courseHeading");
heading.text("Error: couldn't get the config");
@@ -381,13 +354,13 @@ optional:
return false;
}
- roomIds = roomIds.split(',');
- if (roomIds.length > 4){
+ roomIds = roomIds.split(',');
+ if (roomIds.length > 4) {
roomIds.length = 4;
}
- for (var i = 0; i < roomIds.length; i++){
- getConfig(roomIds[i],null);
+ for (var i = 0; i < roomIds.length; i++) {
+ getConfig(roomIds[i], null);
}
@@ -400,10 +373,10 @@ optional:
function getParamerter(room) {
var lang;
- lang = room.config.lang;
+ lang = room.config.lang;
- if(room.config != null) {
+ if (room.config != null) {
room.config.switchtime = room.config.switchtime * 1000;
room.config.calupdate = room.config.calupdate * 60 * 1000;
room.config.roomupdate = room.config.roomupdate * 1000;
@@ -446,7 +419,8 @@ optional:
}
// parameter validation
- if (room.config.switchtime == null || isNaN(room.config.switchtime) || room.config.switchtime > 120 || room.config.switchtime < 1) {
+ if (room.config.switchtime == null || isNaN(room.config.switchtime) || room.config.switchtime > 120
+ || room.config.switchtime < 1) {
room.config.switchtime = 5;
}
if (room.config.scale == null || isNaN(room.config.scale) || room.config.scale > 90 || room.config.scale < 10) {
@@ -455,7 +429,8 @@ optional:
if (room.config.vertical == null) {
room.config.vertical = false;
}
- if (room.config.daystoshow == null || isNaN(room.config.daystoshow) || room.config.daystoshow > 7 || room.config.daystoshow < 1) {
+ if (room.config.daystoshow == null || isNaN(room.config.daystoshow) || room.config.daystoshow > 7
+ || room.config.daystoshow < 1) {
room.config.daystoshow = 7;
}
@@ -466,13 +441,14 @@ optional:
room.config.configupdate = 30 * 60 * 1000;
}
- if (room.config.calupdate == null || isNaN(room.config.calupdate ) || room.config.calupdate < 60 * 1000) {
- room.config.calupdate = 30 * 60 * 1000;
+ if (room.config.calupdate == null || isNaN(room.config.calupdate) || room.config.calupdate < 60 * 1000) {
+ room.config.calupdate = 30 * 60 * 1000;
}
if (room.config.mode == null || isNaN(room.config.mode) || room.config.mode > 4 || room.config.mode < 1) {
room.config.mode = 1;
}
- if (room.config.rotation == null || isNaN(room.config.rotation) || room.config.rotation < 0 || room.config.rotation > 4) {
+ if (room.config.rotation == null || isNaN(room.config.rotation) || room.config.rotation < 0
+ || room.config.rotation > 4) {
room.config.rotation = 0;
}
@@ -487,80 +463,76 @@ optional:
var width = "100%";
var height = "100%";
- if(roomsToshow == 2 || roomsToshow == 4){
+ if (roomsToshow == 2 || roomsToshow == 4) {
width = "50%";
}
- if(roomsToshow == 3){
+ if (roomsToshow == 3) {
width = "33%";
}
- if(roomsToshow == 4){
+ if (roomsToshow == 4) {
height = "50%";
}
var i = 0;
for (var property in rooms) {
- var text = "<div class='roompadding' id ='roompadding_" + rooms[property].id +"'></div>";
+ var text = "<div class='roompadding' id ='roompadding_" + rooms[property].id + "'></div>";
$("body").append(text);
-
-
var obj = document.getElementById("roompadding_" + rooms[property].id);
- console.log(obj);
- if(roomsToshow > 1){
+ if (roomsToshow > 1) {
obj.style.padding = "5px";
- if(i != 0) {
+ if (i != 0) {
obj.style.paddingLeft = "0px";
}
}
obj.style.width = width;
obj.style.height = height;
- var text = "<div class='room' id ='room_" + rooms[property].id +"'></div>";
+ text = "<div class='room' id ='room_" + rooms[property].id + "'></div>";
$("#roompadding_" + rooms[property].id).append(text);
- text = "<div id='header_"+rooms[property].id+"' class='row'>"+
- "<div class='header col-2'>"+
- "<div class='font' id='roomHeader_"+rooms[property].id+"'></div>"+
- "</div>"+
- "<div class='col-1 courseText header'>"+
- "<div class='font' id='courseHeading_"+rooms[property].id+"'></div>"+
- "</div>"+
- "<div class='square .col-2' id='square_" +rooms[property].id+"'>"+
- "<div class='FreeSeatsFont' id='freeSeatsHeader_"+rooms[property].id+"'></div>"+
- "</div>"+
+ text = "<div id='header_" + rooms[property].id + "' class='row'>" +
+ "<div class='header col-2'>" +
+ "<div class='font' id='roomHeader_" + rooms[property].id + "'></div>" +
+ "</div>" +
+ "<div class='col-1 courseText header'>" +
+ "<div class='font' id='courseHeading_" + rooms[property].id + "'></div>" +
+ "</div>" +
+ "<div class='square .col-2' id='square_" + rooms[property].id + "'>" +
+ "<div class='FreeSeatsFont' id='freeSeatsHeader_" + rooms[property].id + "'></div>" +
+ "</div>" +
"</div>";
$("#room_" + rooms[property].id).append(text);
if (rooms[property].name != null) {
- $("#roomHeader_"+rooms[property].id).text(rooms[property].name);
+ $("#roomHeader_" + rooms[property].id).text(rooms[property].name);
}
- if(roomsToshow == 2) {
- console.log($("#square_"+rooms[property].id));
- document.getElementById("square_"+rooms[property].id).style.width = "8vw";
- document.getElementById("square_"+rooms[property].id).style.height ="8vw";
- document.getElementById("roomHeader_"+rooms[property].id ).style.fontSize ="2vw" ;
- document.getElementById("freeSeatsHeader_"+rooms[property].id ).style.fontSize = "5vw";
- document.getElementById("courseHeading_"+rooms[property].id ).style.fontSize = "2vw";
+ if (roomsToshow == 2) {
+ console.log($("#square_" + rooms[property].id));
+ document.getElementById("square_" + rooms[property].id).style.width = "8vw";
+ document.getElementById("square_" + rooms[property].id).style.height = "8vw";
+ document.getElementById("roomHeader_" + rooms[property].id).style.fontSize = "2vw";
+ document.getElementById("freeSeatsHeader_" + rooms[property].id).style.fontSize = "5vw";
+ document.getElementById("courseHeading_" + rooms[property].id).style.fontSize = "2vw";
}
-
if (rooms[property].config.mode == 1) {
- setUpCalendar(rooms[property].config.scale + "%", rooms[property].config.daystoshow,rooms[property]);
+ setUpCalendar(rooms[property].config.scale + "%", rooms[property].config.daystoshow, rooms[property]);
preInitRoom(rooms[property]);
- }else if (rooms[property].config.mode == 2) {
- setUpCalendar("100%", rooms[property].config.daystoshow,rooms[property]);
+ } else if (rooms[property].config.mode == 2) {
+ setUpCalendar("100%", rooms[property].config.daystoshow, rooms[property]);
- }else if (rooms[property].config.mode == 3) {
+ } else if (rooms[property].config.mode == 3) {
preInitRoom(rooms[property]);
getOpeningTimes(rooms[property]);
- }else if (rooms[property].config.mode == 4) {
+ } else if (rooms[property].config.mode == 4) {
- setUpCalendar("100%", rooms[property].config.daystoshow,rooms[property]);
+ setUpCalendar("100%", rooms[property].config.daystoshow, rooms[property]);
preInitRoom(rooms[property]);
generateProgressBar(rooms[property].id);
}
@@ -568,18 +540,16 @@ optional:
i++;
}
- setInterval(mainUpdateLoop,1000);
+ setInterval(mainUpdateLoop, 1000);
}
-
-
// helper function: checks which rooms are in which mode
function getUpdateIdsforMode(modearray) {
var roomIdsToUpdate = "";
for (var property in rooms) {
if (rooms[property].config.mode in modearray) {
- if(roomIdsToUpdate ==""){
+ if (roomIdsToUpdate == "") {
roomIdsToUpdate = rooms[property].id;
} else {
roomIdsToUpdate = roomIdsToUpdate + "," + rooms[property].id;
@@ -591,7 +561,7 @@ optional:
// Main Update loop, this loop runs every 1 seconds and calls all
// function which should be called periodically
- function mainUpdateLoop(){
+ function mainUpdateLoop() {
//todo add config reload
@@ -599,10 +569,10 @@ optional:
//updates calendar
if (lastCalendarUpdateTime == null || lastCalendarUpdateTime + CalendarUpdateTime < MyDate().getTime()) {
- //Todo
- var roomIdsToUpdate = getUpdateIdsforMode([1,2,3,4]);
+ //Todo
+ var roomIdsToUpdate = getUpdateIdsforMode([1, 2, 3, 4]);
- if(roomIdsToUpdate != ""){
+ if (roomIdsToUpdate != "") {
// Todo update calendars
queryCalendars(roomIdsToUpdate);
}
@@ -612,11 +582,11 @@ optional:
// updates Pcs states
- if(lastRoomUpdateTime == null|| lastRoomUpdateTime + RoomUpdateTime < MyDate().getTime()) {
+ if (lastRoomUpdateTime == null || lastRoomUpdateTime + RoomUpdateTime < MyDate().getTime()) {
- var roomIdsToUpdate = getUpdateIdsforMode([1,2,3,4]);
+ var roomIdsToUpdate = getUpdateIdsforMode([1, 2, 3, 4]);
- if(roomIdsToUpdate != ""){
+ if (roomIdsToUpdate != "") {
queryRooms(roomIdsToUpdate);
}
lastRoomUpdateTime = MyDate().getTime();
@@ -625,29 +595,28 @@ optional:
// switches calendar and roomlayout in mode 4
- for (var property in rooms) {
- if (rooms[property].config.mode == 4) {
- if (rooms[property].lastSwitchTime == null || rooms[property].lastSwitchTime + rooms[property].config.switchtime*1000 < MyDate().getTime()) {
+ for (var property in rooms) {
+ if (rooms[property].config.mode == 4) {
+ if (rooms[property].lastSwitchTime == null
+ || rooms[property].lastSwitchTime + rooms[property].config.switchtime * 1000 < MyDate().getTime()) {
- switchLayout(rooms[property]);
- MoveProgressBar(rooms[property].id,rooms[property].config.switchtime);
+ switchLayout(rooms[property]);
+ MoveProgressBar(rooms[property].id, rooms[property].config.switchtime);
- if(rooms[property].lastSwitchTime == null) {
- rooms[property].lastSwitchTime = MyDate().getTime();
- } else {
- rooms[property].lastSwitchTime = rooms[property].lastSwitchTime + rooms[property].config.switchtime*1000;
- }
+ if (rooms[property].lastSwitchTime == null) {
+ rooms[property].lastSwitchTime = MyDate().getTime();
+ } else {
+ rooms[property].lastSwitchTime = rooms[property].lastSwitchTime + rooms[property].config.switchtime * 1000;
}
-
- //
}
- // Updateing All room Headers
- UpdateRoomHeader(rooms[property]);
+ //
}
+ // Updateing All room Headers
-
+ UpdateRoomHeader(rooms[property]);
+ }
// reload site at midnight
@@ -661,7 +630,7 @@ optional:
}
- function addRoom(id,name,config) {
+ function addRoom(id, name, config) {
var room = {
id: id,
name: name,
@@ -671,11 +640,11 @@ optional:
timeTilFree: null,
state: null,
openingTimes: null,
- config:config,
- currentfreePcs:0,
- layout:null,
- freePcs:0,
- resized:false,
+ config: config,
+ currentfreePcs: 0,
+ layout: null,
+ freePcs: 0,
+ resized: false,
getState: function () {
if (this.state == null) {
ComputeCurrentState(this);
@@ -692,20 +661,20 @@ optional:
}
getParamerter(room);
- rooms[id]=room;
+ rooms[id] = room;
return room;
}
- function setUpCalendar(percent, daysToShow,room) {
- generateCalendarDiv(percent,room);
- var $calendar = $("#calendar_"+room.id).weekCalendar({
+ function setUpCalendar(percent, daysToShow, room) {
+ generateCalendarDiv(percent, room);
+ var $calendar = $("#calendar_" + room.id).weekCalendar({
timeslotsPerHour: 1,
timeslotHeight: 20,
daysToShow: daysToShow,
height: function ($calendar) {
- var height = $(window).height() - document.getElementById('header_'+room.id).clientHeight - 5;
+ var height = $(window).height() - document.getElementById('header_' + room.id).clientHeight - 5;
if (room.mode == 1 && room.config.vertical) {
height = height * (room.config.scale / 100)
}
@@ -742,7 +711,7 @@ optional:
function getOpeningTimes(room) {
$.getJSON("../../../api.php?do=locationinfo&action=openingtime&id=" + room.id, function (result) {
- SetOpeningTimes(result[0].openingtime,room);
+ SetOpeningTimes(result[0].openingtime, room);
scaleCalendar(room);
})
@@ -752,9 +721,9 @@ optional:
})
}
- function generateCalendarDiv(width,room) {
+ function generateCalendarDiv(width, room) {
var div = document.createElement("div");
- div.id = "calendar_"+room.id;
+ div.id = "calendar_" + room.id;
div.className = "calendar";
if (room.config.vertical && room.config.mode == 1) {
width = 100 + "%";
@@ -762,11 +731,11 @@ optional:
}
div.style.width = width;
//document.body.appendChild(div);
- $("#room_"+room.id).append(div);
+ $("#room_" + room.id).append(div);
}
- function SetOpeningTimes(parsedOpenings,room) {
+ function SetOpeningTimes(parsedOpenings, room) {
var opening = 24;
var close = 0;
room.openingTimesCalendar = [];
@@ -805,21 +774,21 @@ optional:
close = 24;
}
room.openTimes = close - opening;
- $('#calendar_'+room.id).weekCalendar("option", "businessHours", {
+ $('#calendar_' + room.id).weekCalendar("option", "businessHours", {
start: parseInt(opening),
end: parseInt(close),
limitDisplay: true
});
}
function queryCalendars(ids) {
- var url = "../../../api.php?do=locationinfo&action=calendar&id=" + ids;
+ var url = "../../../api.php?do=locationinfo&action=calendar&id=" + ids;
// Todo reimplement Frontend methode if needed
/*
- if(!(room.config.calendarqueryurl === undefined)) {
- url = room.config.calendarqueryurl;
- }
- */
+ if(!(room.config.calendarqueryurl === undefined)) {
+ url = room.config.calendarqueryurl;
+ }
+ */
$.ajax({
url: url,
dataType: 'json',
@@ -830,11 +799,11 @@ optional:
var l = result.length;
// Todo reimplement when backend working
- for (var i = 0; i < l;i++){
+ for (var i = 0; i < l; i++) {
//todo test this
- updateCalendar(result[i].calendar,rooms[result[i].id]);
+ updateCalendar(result[i].calendar, rooms[result[i].id]);
}
@@ -845,8 +814,8 @@ optional:
}
- function updateCalendar(json,room) {
- if(json == ""){
+ function updateCalendar(json, room) {
+ if (json == "") {
console.log("Error: Calendar data was an empty string.");
return;
}
@@ -870,8 +839,8 @@ optional:
if (room.openTimes == null) {
room.openTimes = 24;
}
- var cal = $('#calendar_'+room.id);
- var columnWidth = document.getElementById("calendar_"+room.id).getElementsByClassName("wc-day-1")[0].clientWidth;
+ var cal = $('#calendar_' + room.id);
+ var columnWidth = document.getElementById("calendar_" + room.id).getElementsByClassName("wc-day-1")[0].clientWidth;
if (room.config.scaledaysauto) {
var result = (44 + cal.weekCalendar("option", "daysToShow") * columnWidth) / 100;
@@ -886,8 +855,9 @@ optional:
} else {
cal.weekCalendar("option", "useShortDayNames", false);
}
- var clientHeight = $(window).height() - document.getElementById('header_'+room.id).clientHeight - document.getElementsByClassName("wc-time-column-header")[0].clientHeight - 10;
- if(roomsToshow > 1) {
+ var clientHeight = $(window).height() - document.getElementById('header_' + room.id).clientHeight
+ - document.getElementsByClassName("wc-time-column-header")[0].clientHeight - 10;
+ if (roomsToshow > 1) {
clientHeight -= 5;
}
if (room.config.mode == 1 && room.config.vertical) {
@@ -910,7 +880,7 @@ optional:
// used for countdown
// computes the time difference between 2 Date objects
- function GetTimeDiferenceAsString(a, b,room) {
+ function GetTimeDiferenceAsString(a, b, room) {
if (a == null || b == null) {
return "";
}
@@ -953,7 +923,7 @@ optional:
closeDate.setMinutes(tmp[i].MinutesClose);
closeDate.setSeconds(0);
if (closeDate > now) {
- if (!IsOpen(new Date(closeDate.getTime() + 60000),room)) {
+ if (!IsOpen(new Date(closeDate.getTime() + 60000), room)) {
if (bestdate == null || bestdate > closeDate) {
bestdate = closeDate;
}
@@ -1000,7 +970,7 @@ optional:
/**
* @return {boolean}
*/
- function IsOpen(date,room) {
+ function IsOpen(date, room) {
if (room.openingTimes == null) {
return false;
}
@@ -1040,7 +1010,7 @@ optional:
openDate.setHours(tmp[i].HourOpen);
openDate.setMinutes(tmp[i].MinutesOpen);
if (openDate > now) {
- if (!IsOpen(new Date(openDate.getTime() - 60000),room)) {
+ if (!IsOpen(new Date(openDate.getTime() - 60000), room)) {
if (bestdate == null || bestdate > openDate) {
bestdate = openDate;
}
@@ -1059,38 +1029,37 @@ optional:
// sets Header Text of a room
- function SetFreeSeats(id,seats) {
+ function SetFreeSeats(id, seats) {
if (seats > 0) {
- $("#freeSeatsHeader_"+id).text(seats);
- $("#square_"+id).css('background-color', '#00dd10');
- } else if (seats== -1) {
- $("#freeSeatsHeader_"+id).text("");
- $("#square_"+id).css('background-color', 'red');
+ $("#freeSeatsHeader_" + id).text(seats);
+ $("#square_" + id).css('background-color', '#00dd10');
+ } else if (seats == -1) {
+ $("#freeSeatsHeader_" + id).text("");
+ $("#square_" + id).css('background-color', 'red');
} else {
- $("#freeSeatsHeader_"+id).text("0");
- $("#square_"+id).css('background-color', 'red');
+ $("#freeSeatsHeader_" + id).text("0");
+ $("#square_" + id).css('background-color', 'red');
}
}
function UpdateRoomHeader(room) {
var tmp = room.getState();
if (tmp.state == "closed") {
- $("#courseHeading_"+room.id).text(t("closed") + " " + GetTimeDiferenceAsString(tmp.end, new MyDate(),room));
- SetFreeSeats(room.id,-1);
+ $("#courseHeading_" + room.id).text(t("closed") + " " + GetTimeDiferenceAsString(tmp.end, new MyDate(), room));
+ SetFreeSeats(room.id, -1);
} else if (tmp.state == "ClaendarEvent") {
- $("#courseHeading_"+room.id).text(state.titel);
- SetFreeSeats(room.id,-1);
+ $("#courseHeading_" + room.id).text(state.titel);
+ SetFreeSeats(room.id, -1);
} else if (tmp.state == "Free") {
- $("#courseHeading_"+room.id).text(t("free") + " " + GetTimeDiferenceAsString(tmp.end, new MyDate(),room));
- SetFreeSeats(room.id,room.freePcs);
+ $("#courseHeading_" + room.id).text(t("free") + " " + GetTimeDiferenceAsString(tmp.end, new MyDate(), room));
+ SetFreeSeats(room.id, room.freePcs);
} else if (tmp.state == "FreeNoEnd") {
- $("#courseHeading_"+room.id).text(t("free"));
- SetFreeSeats(room.id,room.freePcs);
+ $("#courseHeading_" + room.id).text(t("free"));
+ SetFreeSeats(room.id, room.freePcs);
}
}
-
function ComputeCurrentState(room) {
if (!IsOpenNow(room)) {
room.state = {state: "closed", end: GetNextOpening(room), titel: "", next: ""};
@@ -1113,7 +1082,7 @@ optional:
}
// event is at the moment
- if ((closing==null||event.start.getTime() < closing.getTime()) && event.start.getTime() < new MyDate()) {
+ if ((closing == null || event.start.getTime() < closing.getTime()) && event.start.getTime() < new MyDate()) {
room.state = {state: "ClaendarEvent", end: event.end, titel: event.title, next: ""};
return;
}
@@ -1136,7 +1105,7 @@ optional:
function getNextEvent(json) {
var event;
var now = new MyDate();
- if(json == null) {
+ if (json == null) {
return;
}
for (var i = 0; i < json.length; i++) {
@@ -1175,9 +1144,9 @@ optional:
var picSizeY = 3;
- function generateRoomLayoutDiv(width,room) {
+ function generateRoomLayoutDiv(width, room) {
var div = document.createElement("div");
- div.id = "roomLayout_" +room.id;
+ div.id = "roomLayout_" + room.id;
div.className = "roomLayoutDesign";
if ((room.config.vertical && room.config.mode == 1) || (room.config.mode == 3) || (room.config.mode == 4)) {
width = 100 + "%";
@@ -1186,24 +1155,24 @@ optional:
div.style.width = width;
//document.body.appendChild(div);
- $("#room_"+room.id).append(div);
+ $("#room_" + room.id).append(div);
}
function preInitRoom(room) {
$.getJSON("../../../api.php?do=locationinfo&action=roominfo&id=" + room.id + "&coords=1", function (result) {
- if(result[0]== null){
+ if (result[0] == null) {
return;
}
- initRoom(result[0].computer, (100 - room.config.scale) + "%",room);
+ initRoom(result[0].computer, (100 - room.config.scale) + "%", room);
}).error(function () {
- generateRoomLayoutDiv((100 - room.config.scale) + "%",room);
+ generateRoomLayoutDiv((100 - room.config.scale) + "%", room);
})
}
- function initRoom(layout, scale,room) {
+ function initRoom(layout, scale, room) {
var maxX;
var maxY;
var minY;
@@ -1215,9 +1184,9 @@ optional:
if (layout == null || layout.length == 0) {
return;
}
- generateRoomLayoutDiv(scale,room);
+ generateRoomLayoutDiv(scale, room);
if (room.config.rotation != 0) {
- rotateRoom(room.config.rotation,layout);
+ rotateRoom(room.config.rotation, layout);
}
for (var i = 0; i < layout.length; i++) {
@@ -1259,21 +1228,21 @@ optional:
room.maxY = maxY;
generateOffsetAndScale(room);
- setUpRoom(room,layout);
+ setUpRoom(room, layout);
}
function generateOffsetAndScale(room) {
- var clientHeight = ($(window).height() - document.getElementById('header_'+room.id).clientHeight - 5);
- if(roomsToshow > 1) {
+ var clientHeight = ($(window).height() - document.getElementById('header_' + room.id).clientHeight - 5);
+ if (roomsToshow > 1) {
clientHeight -= 5;
}
if (room.config.vertical && room.config.mode == 1) {
clientHeight = clientHeight * (1 - (room.config.scale / 100));
}
($("#roomLayout")).height(clientHeight);
- var roomLayout = document.getElementById('roomLayout_'+room.id);
+ var roomLayout = document.getElementById('roomLayout_' + room.id);
var clientWidth = roomLayout.clientWidth;
- roomLayout.style.height = clientHeight+"px";
+ roomLayout.style.height = clientHeight + "px";
var scaleX;
if (room.xDifference != 0) {
@@ -1303,34 +1272,34 @@ optional:
room.yOffset += ((1 / 2 * (clientHeight - (((room.maxY + room.yOffset) * room.scale) + picSizeY * room.scale))) / room.scale);
}
- function setUpRoom(room,layout) {
+ function setUpRoom(room, layout) {
for (var i = 0; i < layout.length; i++) {
- if (layout[i].y != null && layout[i].x != null && !isNaN(layout[i].y)&& !isNaN(layout[i].x)) {
+ if (layout[i].y != null && layout[i].x != null && !isNaN(layout[i].y) && !isNaN(layout[i].x)) {
var img = $('<img />',
{
- id: "layout_PC_"+room.id+"_"+ layout[i].id,
+ id: "layout_PC_" + room.id + "_" + layout[i].id,
class: "pcImg"
})
- .appendTo($('#roomLayout_'+room.id));
+ .appendTo($('#roomLayout_' + room.id));
}
}
scaleRoom(room);
- UpdatePc(layout,room);
+ UpdatePc(layout, room);
}
function queryRooms(ids) {
$.ajax({
- url: "../../../api.php?do=locationinfo&action=roominfo&id=" +ids +"&coords=0",
+ url: "../../../api.php?do=locationinfo&action=roominfo&id=" + ids + "&coords=0",
dataType: 'json',
cache: false,
timeout: 30000,
success: function (result) {
var l = result.length;
- for (var i = 0; i < l;i++){
- UpdatePc(result[i].computer,rooms[result[i].id]);
+ for (var i = 0; i < l; i++) {
+ UpdatePc(result[i].computer, rooms[result[i].id]);
}
}, error: function () {
@@ -1338,7 +1307,7 @@ optional:
})
}
- function rotateRoom(r,layout) {
+ function rotateRoom(r, layout) {
for (var z = 0; z < r; z++) {
for (var i = 0; i < layout.length; i++) {
var x = parseInt(layout[i].x);
@@ -1354,9 +1323,9 @@ optional:
return;
}
for (var i = 0; i < room.layout.length; i++) {
- if (room.layout[i].y != null && room.layout[i].x != null && !isNaN(room.layout[i].y)&& !isNaN(room.layout[i].x)) {
- var tmp = document.getElementById("layout_PC_"+room.id +"_"+ room.layout[i].id);
- if(tmp != null) {
+ if (room.layout[i].y != null && room.layout[i].x != null && !isNaN(room.layout[i].y) && !isNaN(room.layout[i].x)) {
+ var tmp = document.getElementById("layout_PC_" + room.id + "_" + room.layout[i].id);
+ if (tmp != null) {
tmp.width = (picSizeX * room.scale);
tmp.height = (picSizeY * room.scale);
tmp.style.left = ((parseInt(room.layout[i].x) + room.xOffset) * room.scale) + "px";
@@ -1367,53 +1336,53 @@ optional:
}
- function UpdatePc(update,room) {
- if(update === undefined || update == null) {
+ function UpdatePc(update, room) {
+ if (update === undefined || update == null) {
return;
}
var freePcs = 0;
for (var i = 0; i < update.length; i++) {
- var imgobj = document.getElementById("layout_PC_" +room.id +"_"+update[i].id);
+ var imgobj = document.getElementById("layout_PC_" + room.id + "_" + update[i].id);
- var img;
- // Pc free
- if (update[i].pcState == "0") {
- if (supportSvg) {
- img = "img/pc_free";
- } else {
- imgobj.style.backgroundColor = "green";
- }
- freePcs++;
- // Pc in use
- } else if (update[i].pcState == "1") {
- if (supportSvg) {
- img = "img/pc_used";
- } else {
- imgobj.style.backgroundColor = "red";
- }
- // PC off
- } else if(update[i].pcState == "2"){
- if (supportSvg) {
- img = "img/pc_off";
- } else {
- imgobj.style.backgroundColor = "black";
- }
- freePcs++;
- }else {
- if (supportSvg) {
- img = "img/pc_defect";
- } else {
- imgobj.style.backgroundColor = "black";
- }
+ var img;
+ // Pc free
+ if (update[i].pcState == "0") {
+ if (supportSvg) {
+ img = "img/pc_free";
+ } else {
+ imgobj.style.backgroundColor = "green";
+ }
+ freePcs++;
+ // Pc in use
+ } else if (update[i].pcState == "1") {
+ if (supportSvg) {
+ img = "img/pc_used";
+ } else {
+ imgobj.style.backgroundColor = "red";
+ }
+ // PC off
+ } else if (update[i].pcState == "2") {
+ if (supportSvg) {
+ img = "img/pc_off";
+ } else {
+ imgobj.style.backgroundColor = "black";
+ }
+ freePcs++;
+ } else {
+ if (supportSvg) {
+ img = "img/pc_defect";
+ } else {
+ imgobj.style.backgroundColor = "black";
}
+ }
- if (imgobj != null && supportSvg) {
- if (room.config.einkmode) {
- img = img + "_eink";
- }
- imgobj.src = img + ".svg";
+ if (imgobj != null && supportSvg) {
+ if (room.config.einkmode) {
+ img = img + "_eink";
}
+ imgobj.src = img + ".svg";
+ }
}
@@ -1472,8 +1441,8 @@ optional:
}
function switchLayout(room) {
- var car = document.getElementById("calendar_"+room.id);
- var roomLayout = document.getElementById("roomLayout_"+room.id);
+ var car = document.getElementById("calendar_" + room.id);
+ var roomLayout = document.getElementById("roomLayout_" + room.id);
if (car.style.display == "none") {
roomLayout.style.display = "none";
@@ -1495,14 +1464,14 @@ optional:
function generateProgressBar(id) {
var div = document.createElement("div");
- div.id = "progressBar_"+id;
+ div.id = "progressBar_" + id;
div.classList.add("progressbar");
//document.body.appendChild(div);
- $("#room_"+id).append(div);
+ $("#room_" + id).append(div);
}
- function MoveProgressBar(roomId,time) {
- var elem = document.getElementById("progressBar_"+roomId);
+ function MoveProgressBar(roomId, time) {
+ var elem = document.getElementById("progressBar_" + roomId);
var width = 1;
var id = setInterval(frame, time * 10);
@@ -1520,7 +1489,5 @@ optional:
</script>
</head>
<body>
-
-
</body>
</html>