diff options
Diffstat (limited to 'modules-available/locationinfo/templates')
4 files changed, 98 insertions, 61 deletions
diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index d1ecaae8..7317f8e2 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -619,6 +619,11 @@ optional: generateProgressBar(); } + // Manually initialize mode 2, as initRoomLayout isn't called for this mode + if (room.config.mode === 2) { + queryCalendars(); + queryRooms(); + } mainUpdateLoop(); setInterval(mainUpdateLoop, 10000); setInterval(updateHeaders, globalConfig.eco ? 10000 : 1000); @@ -1116,12 +1121,11 @@ optional: * @param room Room */ function SetFreeSeats(room) { - room.$.seatsCounter.text(room.freePcs >= 0 ? room.freePcs : ''); + // if room has no allowed value, set text in the box to - + room.$.seatsCounter.text(room.freePcs >= 0 ? room.freePcs : '-'); room.$.seatsCounter.data('state', JSON.stringify(room.state)); if (room.freePcs > 0 && room.state && room.state.free) { - room.$.seatsBackground.css('background-color', '#250'); - } else if (room.freePcs === -1) { - room.$.seatsBackground.css('background-color', 'red'); + room.$.seatsBackground.css('background-color', '#250'); } else { room.$.seatsBackground.css('background-color', 'red'); } @@ -1148,7 +1152,8 @@ optional: if (!same) newText = t("closed"); } else if (tmp.state === "CalendarEvent") { if (!same) newText = tmp.title; - seats = -1; + // whilst event is running set freePcs to -, hopefully not breaking anything else with this + room.freePcs = "-"; } else if (tmp.state === "Free") { if (!same) newText = t("free"); } else if (tmp.state === "FreeNoEnd") { @@ -1496,8 +1501,14 @@ optional: for (var i = 0; i < update.length; i++) { var $div = $("#pc_" + room.id + "_" + update[i].id); // Pc free - if (update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY") { - freePcs++; + if (room.config.roomplaner === true) { + if ((update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY") && !isNaN(update[i].x) && !isNaN(update[i].y)) { + freePcs++; + } + } else { + if ((update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY")) { + freePcs++; + } } $div.removeClass('BROKEN OFFLINE IDLE OCCUPIED STANDBY'.replace(update[i].pcState, '')).addClass(update[i].pcState); diff --git a/modules-available/locationinfo/templates/frontend-summary.html b/modules-available/locationinfo/templates/frontend-summary.html index 4105dd16..0053d1ff 100644 --- a/modules-available/locationinfo/templates/frontend-summary.html +++ b/modules-available/locationinfo/templates/frontend-summary.html @@ -116,6 +116,7 @@ var startdate; var roomidsString = ""; var config = {{{config}}}; + var lastPanelUpdate = 0; $(document).ready(function () { init(); @@ -139,6 +140,7 @@ SetUpDate(time); generateLayout(config.tree); update(); + setInterval(update, 10000); } function SetUpDate(d) { @@ -165,7 +167,7 @@ */ function generateObject(json, myParent, outermost) { var obj; - if (!json.children || json.children.length == 0) { + if (!json.children || json.children.length === 0) { obj = generateChild(myParent, json.locationid, json.locationname, outermost); } else { obj = generateParent(myParent, json.locationid, json.locationname, outermost); @@ -178,59 +180,24 @@ } /** - * Helper function to generate id string used in query functions - * @param list A string, wicht contains ids or not(for now) - * @param id An ID which should be added to the list + * Main Update loop, this loop runs every 10 seconds */ - function addIdToUpdateList(list, id) { - if (list == "") { - list += id; - } else { - list += ("," + id); - } - return list; - } - - - const ROOMUPDATE_MS = 2*60*1000; - const CALUPDATE_MS = 20*60*1000; - var timeout = null; - function update() { - var calendarUpdateIds = ""; - var rommUpdateIds = ""; - var count = 0; - var nextUpdate = 15000; - var property; - // TODO: Only query a few rooms is not possible with the new api stuff ... - for (property in rooms) { - if (rooms[property].lastCalendarUpdate === null || rooms[property].lastCalendarUpdate + CALUPDATE_MS < MyDate().getTime()) { - // TODO: NOT NECESSARY ANYMORE?! - calendarUpdateIds = addIdToUpdateList(calendarUpdateIds, rooms[property].id); - count++; - rooms[property].lastCalendarUpdate = MyDate().getTime(); - } - if (rooms[property].lastRoomUpdate === null || rooms[property].lastRoomUpdate + ROOMUPDATE_MS < MyDate().getTime()) { - // TODO: NOT NECESSARY ANYMORE?! - rommUpdateIds = addIdToUpdateList(rommUpdateIds, rooms[property].id); - count++; - rooms[property].lastRoomUpdate = MyDate().getTime(); - } - // TODO if (count > 7) break; - } - if (calendarUpdateIds !== "") { - queryCalendars(); - nextUpdate = 1000; - } - if (rommUpdateIds !== "") { + var date = MyDate(); + var now = date.getTime(); + if (lastPanelUpdate + (config.panelupdate * 1000) < now) { + // Set Roomupdate Interval has passed, update. queryRooms(); - nextUpdate = 1000; - } - if (nextUpdate !== 1000) { + queryCalendars(); + lastPanelUpdate = now; + for (var property in rooms) { + rooms[property].lastCalendarUpdate = now; + rooms[property].lastRoomUpdate = now; + } + } else { + // Set Roomupdate Interval has NOT passed, check if panel was changed since last call and reload if true. queryPanelChange(); } - clearTimeout(timeout); - setTimeout(update, nextUpdate); } function cleanDate(d) { @@ -283,7 +250,6 @@ cache: false, timeout: 30000, success: function (result) { - var l = result.length; if (result[0] == null) { console.log("Error: Backend reported null back for RoomUpdate, this might happend if the room isn't" + "configurated."); @@ -331,7 +297,7 @@ function updatePcStates(json) { var l = json.length; for (var i = 0; i < l; i++) { - updateRoomUsage(json[i].id, json[i].idle, json[i].occupied, json[i].offline, json[i].broken, json[i].standby) + updateRoomUsage(json[i].id, json[i].idle, json[i].occupied, json[i].offline, json[i].broken, json[i].standby); } } @@ -428,8 +394,8 @@ /** * computes state of a room, states are: - * closed, FreeNoEnd, Free, ClaendarEvent. - * @param Room Object + * closed, FreeNoEnd, Free, CalendarEvent. + * @param room Object */ function ComputeCurrentState(room) { if (room.lastRoomUpdate === null) { @@ -479,7 +445,7 @@ /** * checks if a room is open * @param room Room object - * @returns bool for open or not + * @returns boolean for open or not */ function IsOpenNow(room) { var now = new MyDate(); diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html index f7009764..c2915298 100644 --- a/modules-available/locationinfo/templates/page-config-panel-default.html +++ b/modules-available/locationinfo/templates/page-config-panel-default.html @@ -107,6 +107,22 @@ </div> </div> </div> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="input-roomplaner">{{lang_useRoomplaner}}</label> + </div> + <div class="col-sm-7"> + <input id="input-roomplaner" type="checkbox" name="roomplaner" {{roomplaner_checked}}> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_roomplanerTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> </div> </div> </div> diff --git a/modules-available/locationinfo/templates/page-config-panel-summary.html b/modules-available/locationinfo/templates/page-config-panel-summary.html index 11f0dc65..737eef1f 100644 --- a/modules-available/locationinfo/templates/page-config-panel-summary.html +++ b/modules-available/locationinfo/templates/page-config-panel-summary.html @@ -70,6 +70,22 @@ </div> </div> </div> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="input-roomplaner">{{lang_useRoomplaner}}</label> + </div> + <div class="col-sm-7"> + <input id="input-roomplaner" type="checkbox" name="roomplaner" {{roomplaner_checked}}> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_roomplanerTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> <!-- <div class="list-group-item"> <div class="row"> @@ -91,6 +107,34 @@ </div> </div> </div> + + <div class="col-md-6"> + <div class="panel panel-default"> + <div class="panel-heading">{{lang_updateRates}}</div> + <div class="panel-body"> + <div class="list-group"> + + <div class="list-group-item"> + <div class="row"> + <div class="col-sm-3"> + <label for="form-panelupdate">{{lang_panel}}</label> + </div> + <div class="col-sm-7"> + <input class="form-control" name="panelupdate" type="number" min="15" id="form-panelupdate" + max="86400" value="{{panelupdate}}" required> + </div> + <div class="col-sm-2"> + <p class="btn btn-static helptext" title="{{lang_panelupdateTooltip}}"> + <span class="glyphicon glyphicon-question-sign"></span> + </p> + </div> + </div> + </div> + + </div> + </div> + </div> + </div> </div> <div class="modify-inputs"> |