From 609b257e89aecf4c382146ffa2cb4f8eb1e8d168 Mon Sep 17 00:00:00 2001
From: Christian Hofmaier
Date: Tue, 26 Mar 2019 17:18:35 +0100
Subject: [locationinfo] UI rework - add Icons to Buttons - override config for
specific room - change roomplanner switch with dropdown menu - new texts for
roomplanner dropdown - when roomplanner is empty show empty green box instead
of red 0
---
.../locationinfo/templates/frontend-default.html | 33 +++--
.../templates/page-config-panel-default.html | 155 ++++++++++++++++++++-
.../templates/page-config-panel-summary.html | 10 +-
.../templates/page-config-panel-url.html | 5 +-
4 files changed, 179 insertions(+), 24 deletions(-)
(limited to 'modules-available/locationinfo/templates')
diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html
index d4e8109a..7cd52094 100755
--- a/modules-available/locationinfo/templates/frontend-default.html
+++ b/modules-available/locationinfo/templates/frontend-default.html
@@ -592,7 +592,6 @@ optional:
room.$.header = $header;
$loc.append($header);
$header.append('
');
-
if (room.name !== null) {
room.$.locationName.text(room.name);
}
@@ -606,6 +605,15 @@ optional:
if (room.config.mode === 4) {
hasMode4 = true;
}
+ // Manually initialize mode 2, as initRoomLayout isn't called for this mode
+ if (room.config.mode === 2) {
+ var date = MyDate();
+ var now = date.getTime();
+ queryCalendars();
+ queryRooms();
+ lastCalendarUpdate = now;
+ lastRoomUpdate = now;
+ }
SetOpeningTimes(room);
UpdateRoomHeader(room);
@@ -620,15 +628,6 @@ optional:
generateProgressBar();
}
- // Manually initialize mode 2, as initRoomLayout isn't called for this mode
- if (room.config.mode === 2) {
- var date = MyDate();
- var now = date.getTime();
- queryCalendars();
- queryRooms();
- lastCalendarUpdate = now;
- lastRoomUpdate = now;
- }
mainUpdateLoop();
setInterval(mainUpdateLoop, 10000);
setInterval(updateHeaders, globalConfig.eco ? 10000 : 1000);
@@ -1150,10 +1149,11 @@ optional:
* @param room Room
*/
function SetFreeSeats(room) {
- // if room has no allowed value, set text in the box to -
if (!room.numPcs) {
+ // If room has no PCs, empty the counter-box
room.$.seatsCounter.text('\u00A0');
} else if (!room.state.free) {
+ // If room has ongoing event, box text is "-"
room.$.seatsCounter.text('\u2013');
} else {
room.$.seatsCounter.text(room.freePcs);
@@ -1525,14 +1525,19 @@ optional:
return;
}
var freePcs = 0;
+ var numPcs = 0;
for (var i = 0; i < update.length; i++) {
var $div = $("#pc_" + room.id + "_" + update[i].id);
// Pc free
if (room.config.roomplanner === true) {
- if ((update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY") && !isNaN(update[i].x) && !isNaN(update[i].y)) {
- freePcs++;
+ if (!isNaN(update[i].x) && !isNaN(update[i].y)) {
+ numPcs++;
+ if ((update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY")) {
+ freePcs++;
+ }
}
} else {
+ numPcs++;
if ((update[i].pcState === "IDLE" || update[i].pcState === "OFFLINE" || update[i].pcState === "STANDBY")) {
freePcs++;
}
@@ -1541,7 +1546,7 @@ optional:
$div.removeClass('BROKEN OFFLINE IDLE OCCUPIED STANDBY'.replace(update[i].pcState, '')).addClass(update[i].pcState);
}
room.freePcs = freePcs;
- room.numPcs = update.length;
+ room.numPcs = numPcs;
UpdateRoomHeader(room);
}
diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html
index 116c2e11..9470efbb 100644
--- a/modules-available/locationinfo/templates/page-config-panel-default.html
+++ b/modules-available/locationinfo/templates/page-config-panel-default.html
@@ -91,7 +91,7 @@
-
+
+
+
+
+
+
+
+
{{lang_cancel}}
-
+
@@ -355,11 +368,14 @@ document.addEventListener("DOMContentLoaded", function () {
var $locList = $('#location-list');
var $locInput = $('#locationids');
var $addLocDbBtn = $('#addLocDdBtn');
+ var $owPanels = $('#overrideRoomConfigs');
+ var overrides = {{{overrides}}}
// Initialize fancy tooltips
$('p.helptext').tooltip();
// Add listener to range sliders so their label can be updated
- $('input[type="range"]').change(function () {
+ var $range = $('input[type="range"]');
+ $range.change(function () {
$(this).siblings().find('.range-display').text($(this).val());
});
// Set state of input controls that aren't statically initialized server side
@@ -371,6 +387,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
+
var lids = $locInput.val().split(',');
$selLocs.empty();
for (var i = 0; i < lids.length; ++i) {
@@ -382,10 +399,11 @@ document.addEventListener("DOMContentLoaded", function () {
$('#daystoshow option[value="{{daystoshow}}"]').attr("selected", "selected");
$('#rotation option[value="{{rotation}}"]').attr("selected", "selected");
$('#mode option[value="{{mode}}"]').attr("selected", "selected");
+ $('#input-roomplanner option[value="{{roomplanner}}"]').attr("selected", "selected");
$('#daystoshow').prop('disabled', document.getElementById('scaledaysauto').checked);
- $('input[type="range"]').change();
+ $range.change();
modeChange();
// Adding/removing locations
@@ -400,8 +418,9 @@ document.addEventListener("DOMContentLoaded", function () {
});
$('#config-form').submit(function(ev) {
- if ($locInput.val().length > 0)
+ if ($locInput.val().length > 0) {
return;
+ }
ev.preventDefault();
$('#no-locations-message').modal('show');
});
@@ -418,9 +437,124 @@ document.addEventListener("DOMContentLoaded", function () {
$addLocBtnParent.removeClass('open');
}
}
+
+ // Add Panel for overwriting room specific config
+ $owPanels.find('#overrideRoom' + id).remove();
+ $owPanels.append('');
+
+
+ // Load content into panel
+ var overrideSelect = $('#override' + id);
+ overrideSelect
+ .bootstrapSwitch({size: 'small'})
+ .on('switchChange.bootstrapSwitch', function () {
+ if (this.checked) {
+ loadOverrideContent(id);
+ } else {
+ unloadOverrideContent(id);
+ }
+ });
+
+ if (overrides !== null && overrides[id] !== undefined) {
+ overrideSelect.bootstrapSwitch('state', true);
+ }
+ }
+
+ function loadOverrideContent(id) {
+ // 1. Build Content
+ // $content.append($(''));
+ var $content = $('');
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
' +
+ '
' +
+ '
'));
+ $content.append($('' +
+ '
' +
+ '
%
' +
+ '
' +
+ '
'));
+
+ // 2. Load Content into Panel
+ var $panelBody = $('#overrideRoom' + id).find('div.panel-body');
+ $panelBody.append($content);
+
+ $('.modify-inputs #overrideRoom' + id + ' input[type="checkbox"]')
+ .bootstrapSwitch({size: 'small'})
+ .on('switchChange.bootstrapSwitch', function () {
+ if (this.id === 'override' + id + 'scaledaysauto') {
+ $('#override' + id + 'daystoshow').prop('disabled', this.checked);
+ }
+ });
+
+ // 3. Init parameters: Given parameters or global parameters if none given
+ var scale = $('#override' + id + 'scale');
+ if (overrides !== null && overrides[id] !== undefined) {
+ $('#override' + id + 'mode').val(overrides[id].mode);
+ $('#override' + id + 'roomplanner').val(overrides[id].roomplanner);
+ if (overrides[id].vertical) $('#override' + id + 'vertical').bootstrapSwitch('state', true);
+ if (overrides[id].scaledaysauto) $('#override' + id + 'scaledaysauto').bootstrapSwitch('state', true);
+ $('#override' + id + 'daystoshow').val(overrides[id].daystoshow);
+ $('#override' + id + 'rotation').val(overrides[id].rotation);
+ scale.val(overrides[id].scale);
+ } else {
+ $('#override' + id + 'mode').val($('#mode').val());
+ $('#override' + id + 'roomplanner').val($('#input-roomplanner').val());
+ if ($('#input-vertical').bootstrapSwitch('state')) $('#override' + id + 'vertical').bootstrapSwitch('state', true);
+ if ($('#scaledaysauto').bootstrapSwitch('state')) $('#override' + id + 'scaledaysauto').bootstrapSwitch('state', true);
+ $('#override' + id + 'daystoshow').val($('#daystoshow').val());
+ $('#override' + id + 'rotation').val($('#rotation').val());
+ scale.val($('#input-scale').val());
+ }
+
+ scale.change(function () {
+ $(this).siblings().find('.range-display').text($(this).val());
+ });
+
+ scale.change();
+ modeChangeOverride('override' + id + 'mode');
+ }
+
+ function unloadOverrideContent(id) {
+ var $panelBody = $('#overrideRoom' + id).find('div.panel-body');
+ $panelBody.find('div.list-group').remove();
+ delete overrides[id]
}
function delParent() {
+ var $id = $(this).parent().attr("data-lid");;
+ $('#overrideRoom' + $id).remove();
$(this).parent().remove();
serializeLocs();
if ($selLocs.find('li').length < 4) {
@@ -434,7 +568,6 @@ document.addEventListener("DOMContentLoaded", function () {
}).get().join(',');
$locInput.val(res);
}
-
});
/**
@@ -446,4 +579,12 @@ function modeChange() {
$('.m' + value + '-s').show();
}
+function modeChangeOverride(id) {
+ id = id.replace('override', '');
+ id = id.replace('mode', '');
+ var value = $('#override' + id + 'mode').val();
+ $('#overrideRoom' + id + ' .om' + value + '-h').hide();
+ $('#overrideRoom' + id + ' .om' + value + '-s').show();
+}
+
//-->
diff --git a/modules-available/locationinfo/templates/page-config-panel-summary.html b/modules-available/locationinfo/templates/page-config-panel-summary.html
index 5ddcc904..2dc556ce 100644
--- a/modules-available/locationinfo/templates/page-config-panel-summary.html
+++ b/modules-available/locationinfo/templates/page-config-panel-summary.html
@@ -77,7 +77,10 @@
-
+
{{lang_cancel}}
-
+
diff --git a/modules-available/locationinfo/templates/page-config-panel-url.html b/modules-available/locationinfo/templates/page-config-panel-url.html
index dbf50fb6..57b518ce 100644
--- a/modules-available/locationinfo/templates/page-config-panel-url.html
+++ b/modules-available/locationinfo/templates/page-config-panel-url.html
@@ -113,7 +113,10 @@
{{lang_cancel}}
-
+
--
cgit v1.2.3-55-g7522