summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2017-06-13 18:32:23 +0200
committerSimon Rettberg2017-06-13 18:32:23 +0200
commit0085d9309252fc1eec276b6eb05f271a140bee5d (patch)
tree01b36229b0b6e1a7477274ba8b62231c1b82ccbb /modules-available
parent[locationinfo] Location edit part done so far (diff)
downloadslx-admin-0085d9309252fc1eec276b6eb05f271a140bee5d.tar.gz
slx-admin-0085d9309252fc1eec276b6eb05f271a140bee5d.tar.xz
slx-admin-0085d9309252fc1eec276b6eb05f271a140bee5d.zip
[locationinfo] slxadmin part done, todo: frontend+api
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/locationinfo/api.inc.php25
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php23
-rw-r--r--modules-available/locationinfo/lang/de/messages.json14
-rw-r--r--modules-available/locationinfo/lang/de/template-tags.json37
-rw-r--r--modules-available/locationinfo/lang/en/messages.json14
-rw-r--r--modules-available/locationinfo/lang/en/template-tags.json27
-rw-r--r--modules-available/locationinfo/page.inc.php197
-rw-r--r--modules-available/locationinfo/templates/page-config-panel-default.html418
-rw-r--r--modules-available/locationinfo/templates/page-config-panel.html349
-rw-r--r--modules-available/locationinfo/templates/page-locations.html20
-rw-r--r--modules-available/locationinfo/templates/page-panels.html57
-rw-r--r--modules-available/locationinfo/templates/page-servers.html117
-rw-r--r--modules-available/locationinfo/templates/page-tabs.html6
13 files changed, 796 insertions, 508 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index 644f990b..34c2a41a 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -230,7 +230,7 @@ function getConfig($locationID)
LEFT JOIN `locationinfo_locationconfig` AS li ON (l.locationid = li.locationid)
WHERE l.locationid = :locationID", array('locationID' => $locationID));
- $config = defaultConfig();
+ $config = LocationInfo::defaultPanelConfig();
if ($dbresult !== false) {
if (!empty($dbresult['config'])) {
@@ -248,29 +248,6 @@ function getConfig($locationID)
}
/**
- * Creates and returns a default config for room that didn't saved a config yet.
- *
- * @return array Return a default config.
- */
-function defaultConfig()
-{
- return array(
- 'language' => 'en',
- 'mode' => 1,
- 'vertical' => false,
- 'eco' => false,
- 'scaledaysauto' => true,
- 'daystoshow' => 7,
- 'rotation' => 0,
- 'scale' => 50,
- 'switchtime' => 20,
- 'calupdate' => 30,
- 'roomupdate' => 5,
- 'configupdate' => 180,
- );
-}
-
-/**
* Gets the pc states of the given locations.
*
* @param int[] $idList list of the location ids.
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 6b13ad9a..fa97a0c6 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -60,4 +60,27 @@ class LocationInfo
}
}
+ /**
+ * Creates and returns a default config for room that didn't saved a config yet.
+ *
+ * @return array Return a default config.
+ */
+ public static function defaultPanelConfig()
+ {
+ return array(
+ 'language' => 'en',
+ 'mode' => 1,
+ 'vertical' => false,
+ 'eco' => false,
+ 'scaledaysauto' => true,
+ 'daystoshow' => 7,
+ 'rotation' => 0,
+ 'scale' => 50,
+ 'switchtime' => 20,
+ 'calupdate' => 30,
+ 'roomupdate' => 15,
+ 'configupdate' => 180,
+ );
+ }
+
}
diff --git a/modules-available/locationinfo/lang/de/messages.json b/modules-available/locationinfo/lang/de/messages.json
index 52a48a02..8da5bd33 100644
--- a/modules-available/locationinfo/lang/de/messages.json
+++ b/modules-available/locationinfo/lang/de/messages.json
@@ -1,8 +1,10 @@
{
- "no-days-selected": "Es wurden keine Tage ausgewählt.",
- "added-x-entries": "Eintr\u00e4ge hinzugef\u00fcgt: {{0}}",
- "deleted-x-entries": "Eintr\u00e4ge gelöscht: {{0}}",
- "openingtime-updated": "Öffnungszeiten aktualisiert.",
+ "auth-failed": "[{{0}}] {{1}} Error: {{2}}",
"config-saved": "Einstellungen erfolgreich gespeichert.",
- "auth-failed": "[{{0}}] {{1}} Error: {{2}}"
-}
+ "ignored-invalid-end": "Eintrag mit ung\u00fcltiger Endzeit ignoriert",
+ "ignored-invalid-range": "Eintrag mit ung\u00fcltiger Range ignoriert",
+ "ignored-invalid-start": "Eintrag mit ung\u00fcltiger Startzeit ignoriert",
+ "ignored-line-no-days": "Eintrag ohne ausgew\u00e4hlte Tage ignoriert",
+ "invalid-panel-id": "Ung\u00fcltige Panel-ID '{{0}}'",
+ "invalid-server-id": "Ung\u00fcltige Server-ID '{{0}}'"
+} \ No newline at end of file
diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json
index 379730e5..9b30a14a 100644
--- a/modules-available/locationinfo/lang/de/template-tags.json
+++ b/modules-available/locationinfo/lang/de/template-tags.json
@@ -1,32 +1,42 @@
{
"lang_addServer": "Server",
+ "lang_areYouSure": "Sind Sie sicher?",
"lang_autoScale": "Auto Tage",
"lang_autoscaleTooltip": "Berechnet anhand der Bildschirmbreite die optimale Anzahl an Tagen, die der Kalender anzeigt",
- "lang_buildingTable": "Geb\u00e4ude \/ Raum Liste",
+ "lang_backend": "Backend",
+ "lang_backends": "Backends",
"lang_calendar": "Kalender",
"lang_calupdateTooltip": "Zeit nachdem der Kalender aktualisiert wird (in Minuten)",
"lang_checkConnection": "Verbindung pr\u00fcfen",
"lang_closingTime": "Schlie\u00dfungszeit",
"lang_config": "Einstellungen",
"lang_configupdateTooltip": "Zeit nach der die Einstellungen aktualisiert werden (in Minuten)",
+ "lang_createPanel": "Panel anlegen",
"lang_credentials": "Anmeldung",
- "lang_customUrl": "Benutzerdefinierte URL",
- "lang_customUrlTooltip": "Diese URL \u00fcberschreibt die Einstellungen des Raumes",
"lang_day": "Tag",
"lang_daysToShow": "Tage",
"lang_daysToShowTooltip": "Legt die Anzahl an Tagen im Kalender fest, die angezeigt werden",
+ "lang_defaultPanel": "Standard-Panel",
"lang_deleteConfirmation": "Sind Sie sicher?",
"lang_display": "Anzeige",
+ "lang_displayName": "Name",
+ "lang_displayNameTooltip": "Anzeigename f\u00fcr dieses Panel",
"lang_ecoMode": "E-Ink Modus",
"lang_ecoTooltip": "Anstelle der Farb-basierten PC-Status Bilder, werden Symbol-basierte PC Bilder verwendet",
+ "lang_editDefaultPanelHints": "Hier k\u00f6nnen Sie ein Panel (z.B. digitales T\u00fcrschild) in Aussehen und Funktionsweise definieren. Um im Kalender \u00d6ffnungszeiten anzeigen zu k\u00f6nnen, m\u00fcssen Sie im Tab \"Raum-\/Ortsbezogene Einstellungen\" f\u00fcr den ausgew\u00e4hlten Raum entsprechend \u00d6ffnungszeiten eintragen. Damit im Kalender Veranstaltungen und andere Termine angezeigt werden k\u00f6nnen, muss ein funktionierendes Backend konfiguriert und den ausgew\u00e4hlten R\u00e4umen zugewiesen worden sein.",
+ "lang_editPanel": "Panel bearbeiten",
"lang_entryName": "Name",
+ "lang_error": "Fehler",
"lang_expertMode": "Expertenmodus",
+ "lang_fourLocsHint": "Hier k\u00f6nnen Sie bis zu vier Orte ausw\u00e4hlen, die in diesem Panel angezeigt werden.",
"lang_general": "Allgemein",
"lang_language": "Sprache",
"lang_languageTooltip": "Legt die Sprache der angezeigten Oberfl\u00e4che fest",
"lang_locationName": "Name",
- "lang_locationSettings": "Einstellungen",
- "lang_mainHeader": "Infoscreen",
+ "lang_locationSettings": "Raum-\/Ortsbezogene Einstellungen",
+ "lang_locations": "Orte",
+ "lang_locationsTable": "R\u00e4ume \/ Orte",
+ "lang_locationsTableHints": "Hier k\u00f6nnen Sie f\u00fcr die R\u00e4ume und Orte Ihrer Einrichtung \u00d6ffnungszeiten hinterlegen, sowie die Verkn\u00fcpfung mit Raum-IDs aus konfigurierten Backends (z.B. HISinOne) vornehmen, damit Belegungspl\u00e4ne abgerufen werden k\u00f6nnen.",
"lang_mode": "Modus",
"lang_mode1": "Kalender & Raum",
"lang_mode2": "Kalender",
@@ -35,9 +45,18 @@
"lang_modeTooltip": "Die Anzeigemodi, welche das Frontend unterst\u00fctzt",
"lang_monTilFr": "Montag - Freitag",
"lang_nameTooltip": "Legt den Namen des Servers fest",
+ "lang_noLocationsWarning": "Sie haben keine Orte f\u00fcr dieses Panel ausgew\u00e4hlt",
"lang_noServer": "<Kein Server>",
"lang_openingTime": "\u00d6ffnungszeit",
- "lang_pleaseSelect": "Bitte w\u00e4hlen...",
+ "lang_openingtimes": "\u00d6ffnungszeiten",
+ "lang_panel": "Panel",
+ "lang_panelType": "Typ",
+ "lang_panels": "Panels",
+ "lang_panelsTable": "Panels verwalten",
+ "lang_panelsTableHints": "Hier sehen Sie alle erstellen Anzeigetafeln, die per Browser an beliebiger Stelle angezeigt werden k\u00f6nnen, z.B. als digitales T\u00fcrschild.",
+ "lang_pleaseSelect": "Bitte w\u00e4hlen\u2026",
+ "lang_recursiveServerSet": "Auch f\u00fcr alle untergeordneten R\u00e4ume setzen",
+ "lang_recursiveSetTooltip": "Wenn aktiviert, wird der Backend-Server auch f\u00fcr alle untergeordneten R\u00e4ume auf den hier gew\u00e4hlten Wert gesetzt",
"lang_remoteSchedule": "Abruf Belegungsplan",
"lang_room": "Raum",
"lang_roomId": "Raum ID",
@@ -54,8 +73,9 @@
"lang_scaleTooltip": "[10-90] Legt die Kalenderbreite fest (in Prozent)",
"lang_sec": "sek",
"lang_server": "Server",
- "lang_serverTable": "Server Liste",
- "lang_serverTooltip": "Legt fest, von welchem Server die Kalenderdaten bezogen werden",
+ "lang_serverTable": "Backend-Server verwalten",
+ "lang_serverTableHints": "Liste aller definierten Backend-Server. Diese werden ben\u00f6tigt, um Belegungspl\u00e4ne f\u00fcr R\u00e4ume abzurufen.",
+ "lang_serverTooltip": "Legt fest, von welchem Backend-Server die Kalenderdaten bezogen werden",
"lang_serverType": "Typ",
"lang_shortFriday": "Fr",
"lang_shortMonday": "Mo",
@@ -64,6 +84,7 @@
"lang_shortThursday": "Do",
"lang_shortTuesday": "Di",
"lang_shortWednesday": "Mi",
+ "lang_summaryPanel": "\u00dcbersichts-Panel",
"lang_sunday": "Sonntag",
"lang_switchTime": "Wechselintervall",
"lang_switchTimeTooltip": "[1-120] Legt die Zeit fest, die vergeht bis ein Wechsel erfolgt (in Sekunden)",
diff --git a/modules-available/locationinfo/lang/en/messages.json b/modules-available/locationinfo/lang/en/messages.json
index b85b56cd..6767bfcf 100644
--- a/modules-available/locationinfo/lang/en/messages.json
+++ b/modules-available/locationinfo/lang/en/messages.json
@@ -1,8 +1,10 @@
{
- "no-days-selected": "No days selected.",
- "added-x-entries": "Entries added: {{0}}",
- "deleted-x-entries": "Entries deleted: {{0}}",
- "openingtime-updated": "Openingtime updated.",
+ "auth-failed": "[{{0}}] {{1}} Error: {{2}}",
"config-saved": "Config successfully saved.",
- "auth-failed": "[{{0}}] {{1}} Error: {{2}}"
-}
+ "ignored-invalid-end": "Ignored entry with invalid end time",
+ "ignored-invalid-range": "Ignored entry with invalid range",
+ "ignored-invalid-start": "Ignored entry with invalid start time",
+ "ignored-line-no-days": "Ignored entry with no days selected",
+ "invalid-panel-id": "Invalid panel id '{{0}}'",
+ "invalid-server-id": "Invalid server id '{{0}}'"
+} \ No newline at end of file
diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json
index 6df405c9..ae308281 100644
--- a/modules-available/locationinfo/lang/en/template-tags.json
+++ b/modules-available/locationinfo/lang/en/template-tags.json
@@ -1,32 +1,41 @@
{
+ "lang_defaultPanel": "Default panel",
"lang_addServer": "Server",
+ "lang_summaryPanel": "Summary panel",
+ "lang_areYouSure": "Are you sure?",
"lang_autoScale": "Auto Days",
"lang_autoscaleTooltip": "Calculates the optimum amount of days to show from the display width",
- "lang_buildingTable": "Building \/ Room List",
+ "lang_backend": "Backend",
+ "lang_backends": "Backends",
"lang_calendar": "Calendar",
"lang_calupdateTooltip": "Time the calender querys for updates (in minutes)",
"lang_checkConnection": "Check connection",
"lang_closingTime": "Closing time",
"lang_config": "Config",
"lang_configupdateTooltip": "Time interval the config gets updated (in minutes)",
+ "lang_createPanel": "Create panel",
"lang_credentials": "Login",
- "lang_customUrl": "Custom URL",
- "lang_customUrlTooltip": "This URL will override the config settings from the room",
"lang_day": "Day",
"lang_daysToShow": "Days",
"lang_daysToShowTooltip": "Defines the amount of days to show in the calendar",
"lang_deleteConfirmation": "Are you sure?",
"lang_display": "Display",
+ "lang_displayName": "Name",
+ "lang_displayNameTooltip": "Display name for this panel",
"lang_ecoMode": "E-Ink mode",
"lang_ecoTooltip": "Symbolic based pc state pictures are used instead of the colour based ones",
+ "lang_editPanel": "Edit panel",
"lang_entryName": "Name",
+ "lang_error": "Error",
"lang_expertMode": "Expert mode",
+ "lang_fourLocsHint": "You can pick up to four locations that will be shown in this panel.",
"lang_general": "General",
"lang_language": "Language",
"lang_languageTooltip": "The language the frontend uses",
"lang_locationName": "Name",
"lang_locationSettings": "Settings",
- "lang_mainHeader": "Infoscreen",
+ "lang_locations": "Locations",
+ "lang_locationsTable": "Rooms \/ Locations",
"lang_mode": "Mode",
"lang_mode1": "Calendar & Room",
"lang_mode2": "Calendar",
@@ -35,9 +44,17 @@
"lang_modeTooltip": "The display modes the frontend supports",
"lang_monTilFr": "Monday - Friday",
"lang_nameTooltip": "Defines the name of the server",
+ "lang_noLocationsWarning": "Please select at least one location this panel should display",
"lang_noServer": "<no server>",
"lang_openingTime": "Opening time",
+ "lang_openingtimes": "Opening times",
+ "lang_panel": "Panel",
+ "lang_panelType": "Type",
+ "lang_panels": "Panels",
+ "lang_panelsTable": "Manage panels",
"lang_pleaseSelect": "Please select...",
+ "lang_recursiveServerSet": "Also set for all child locations",
+ "lang_recursiveSetTooltip": "If checked, all direct and indirect child locations will be configured to use the backend server selected above",
"lang_remoteSchedule": "Time table retrieval",
"lang_room": "Room",
"lang_roomId": "Room ID",
@@ -54,7 +71,7 @@
"lang_scaleTooltip": "[10-90] Defines the calendar width (in percent)",
"lang_sec": "sec",
"lang_server": "Server",
- "lang_serverTable": "Server List",
+ "lang_serverTable": "Manage backend servers",
"lang_serverTooltip": "Defines from which server the room queries the calendar data",
"lang_serverType": "Type",
"lang_shortFriday": "Fri",
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index 333e5c48..996a5fa6 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -25,12 +25,16 @@ class Page_LocationInfo extends Page
$show = 'locations';
} elseif ($this->action === 'deleteServer') {
$this->deleteServer();
+ } elseif ($this->action === 'deletePanel') {
+ $this->deletePanel();
} elseif ($this->action === 'checkConnection') {
$this->checkConnection(Request::post('serverid', 0, 'int'));
+ $show = 'backends';
} elseif ($this->action === 'updateServerSettings') {
$this->updateServerSettings();
+ $show = 'backends';
} elseif (Request::isPost()) {
- Messages::addWarning('main.invalid-action', $this->action);
+ Message::addWarning('main.invalid-action', $this->action);
}
if (Request::isPost()) {
if (!empty($show)) {
@@ -45,19 +49,24 @@ class Page_LocationInfo extends Page
*/
protected function doRender()
{
+ $backends = $this->loadBackends();
$show = Request::get('show', '', 'string');
+ Render::addTemplate('page-tabs', array('class-' . $show => 'active'));
switch ($show) {
case 'locations':
$this->showLocationsTable();
break;
+ case 'backends':
+ $this->showBackendsTable($backends);
+ break;
case 'edit-panel':
- $this->showConfigPanel();
+ $this->showPanelConfig();
break;
case '':
- $this->showInfoScreenTable();
+ $this->showPanelsTable();
break;
default:
- Message::addError('main.value-invalid', 'show', $show);
+ Util::redirect('?do=locationinfo');
}
}
@@ -71,7 +80,23 @@ class Page_LocationInfo extends Page
Messages::addError('server-id-missing');
return;
}
- Database::exec("DELETE FROM `locationinfo_coursebackend` WHERE serverid=:id", array('id' => $id));
+ $res = Database::exec("DELETE FROM `locationinfo_coursebackend` WHERE serverid=:id", array('id' => $id));
+ if ($res !== 1) {
+ Message::addWarning('invalid-server-id', $id);
+ }
+ }
+
+ private function deletePanel()
+ {
+ $id = Request::post('uuid', false, 'string');
+ if ($id === false) {
+ Messages::addError('main.parameter-missing', 'uuid');
+ return;
+ }
+ $res = Database::exec("DELETE FROM `locationinfo_panel` WHERE paneluuid = :id", array('id' => $id));
+ if ($res !== 1) {
+ Message::addWarning('invalid-panel-id', $id);
+ }
}
private function getTime($str)
@@ -87,7 +112,7 @@ class Page_LocationInfo extends Page
// Check locations
$locationid = Request::post('locationid', false, 'int');
if ($locationid === false) {
- Message::addError('main.paramter-missing', 'locationid');
+ Message::addError('main.parameter-missing', 'locationid');
return false;
}
if (Location::get($locationid) === false) {
@@ -186,17 +211,18 @@ class Page_LocationInfo extends Page
private function writePanelConfig()
{
// UUID - existing or new
- $paneluuid = Request::post('paneluuid', false, 'string');
+ $paneluuid = Request::post('uuid', false, 'string');
if (($paneluuid === false || strlen($paneluuid) !== 36) && $paneluuid !== 'new') {
Message::addError('invalid-panel-id', $paneluuid);
Util::redirect('?do=locationinfo');
}
// Check locations
- $locationids = Request::post('locationids', false, 'array');
+ $locationids = Request::post('locationids', false, 'string');
if ($locationids === false) {
Message::addError('main.paramter-missing', 'locationids');
Util::redirect('?do=locationinfo');
}
+ $locationids = explode(',', $locationids);
$all = array_map(function ($item) { return $item['locationid']; }, Location::queryLocations());
$locationids = array_filter($locationids, function ($item) use ($all) { return in_array($item, $all); });
if (empty($locationids)) {
@@ -222,24 +248,28 @@ class Page_LocationInfo extends Page
'roomupdate' => Request::post('roomupdate', 30, 'int'),
'configupdate' => Request::post('configupdate', 180, 'int'),
);
- if ($conf['roomupdate'] < 30) {
- $conf['roomupdate'] = 30;
+ if ($conf['roomupdate'] < 15) {
+ $conf['roomupdate'] = 15;
}
- if ($conf['calupdate'] < 120) {
- $conf['calupdate'] = 120;
+ if ($conf['calupdate'] < 30) {
+ $conf['calupdate'] = 30;
+ }
+ if ($conf['configupdate'] < 10) {
+ $conf['configupdate'] = 10;
}
if ($paneluuid === 'new') {
$paneluuid = Util::randomUuid();
- $query = "INSERT INTO `locationinfo_panel` (paneluuid, locationids, paneltype, panelconfig)
- VALUES (:id, :locationids, :type, :config)";
+ $query = "INSERT INTO `locationinfo_panel` (paneluuid, panelname, locationids, paneltype, panelconfig)
+ VALUES (:id, :name, :locationids, :type, :config)";
} else {
$query = "UPDATE `locationinfo_panel`
- SET locationids = :locationids, paneltype = :type, panelconfig = :config
+ SET panelname = :name, locationids = :locationids, paneltype = :type, panelconfig = :config
WHERE paneluuid = :id";
}
Database::exec($query, array(
'id' => $paneluuid,
+ 'name' => Request::post('name', '-', 'string'),
'locationids' => implode(',', $locationids),
'type' => 'DEFAULT', // TODO
'config' => json_encode($conf),
@@ -317,10 +347,7 @@ class Page_LocationInfo extends Page
LocationInfo::setServerError($serverid, $serverInstance->getError());
}
- /**
- * Loads the Infoscreen page in the admin-panel and passes all needed information.
- */
- private function showInfoScreenTable()
+ private function loadBackends()
{
// Get a list of all the backend types.
$servertypes = array();
@@ -329,10 +356,9 @@ class Page_LocationInfo extends Page
$typeInstance = CourseBackend::getInstance($s);
$servertypes[$s] = $typeInstance->getDisplayName();
}
-
- // Get the Serverlist from the DB and make it mustache accessable
+ // Build list of defined backends
$serverlist = array();
- $dbquery2 = Database::simpleQuery("SELECT * FROM `locationinfo_coursebackend`");
+ $dbquery2 = Database::simpleQuery("SELECT * FROM `locationinfo_coursebackend` ORDER BY servername ASC");
while ($row = $dbquery2->fetch(PDO::FETCH_ASSOC)) {
if (isset($servertypes[$row['servertype']])) {
$row['typename'] = $servertypes[$row['servertype']];
@@ -353,7 +379,14 @@ class Page_LocationInfo extends Page
}
$serverlist[] = $row;
}
+ return $serverlist;
+ }
+ /**
+ * Show the list of backends
+ */
+ private function showBackendsTable($serverlist)
+ {
// Pass the data to the html and render it.
Render::addTemplate('page-servers', array(
'serverlist' => $serverlist,
@@ -404,6 +437,28 @@ class Page_LocationInfo extends Page
));
}
+ private function showPanelsTable()
+ {
+ $res = Database::simpleQuery('SELECT p.paneluuid, p.panelname, p.locationids,
+ p.paneltype FROM locationinfo_panel p
+ ORDER BY panelname ASC');
+ $panels = array();
+ $locations = Location::getLocationsAssoc();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $lids = explode(',', $row['locationids']);
+ $locs = array_map(function($id) use ($locations) {
+ return isset($locations[$id]) ? $locations[$id]['locationname'] : $id;
+ }, $lids);
+ $row['locations'] = implode(', ', $locs);
+ $len = mb_strlen($row['panelname']);
+ if ($len < 5) {
+ $row['panelname'] .= str_repeat('…', 5 - $len);
+ }
+ $panels[] = $row;
+ }
+ Render::addTemplate('page-panels', array('panels' => $panels));
+ }
+
/**
* AJAX
*/
@@ -632,22 +687,53 @@ class Page_LocationInfo extends Page
}
/**
- * Ajax the config of a location.
+ * Ajax the config of a panel.
*
* @param $id Location ID
*/
- private function showConfigPanel()
+ private function showPanelConfig()
{
- $id = Request::get('paneluuid', false, 'string');
- // Get Config data from db
- $panel = Database::queryFirst("SELECT locationids, paneltype, panelconfig
- FROM locationinfo_panel
- WHERE paneluuid = :id", array('id' => $id));
- if ($panel === false) {
- die("Invalid panel id: $id");
+ $id = Request::get('uuid', false, 'string');
+ if ($id === false) {
+ Message::addError('main.parameter-missing', 'uuid');
+ return;
}
+ $config = false;
+ if ($id === 'new-default') {
+ // Creating new panel
+ $panel = array(
+ 'panelname' => '',
+ 'locationids' => '',
+ 'paneltype' => 'DEFAULT',
+ );
+ $id = 'new';
+ } elseif ($id === 'new-summary') {
+ // Creating new panel
+ $panel = array(
+ 'panelname' => '',
+ 'locationids' => '',
+ 'paneltype' => 'SUMMARY',
+ );
+ $id = 'new';
+ } else {
+ // Get Config data from db
+ $panel = Database::queryFirst("SELECT panelname, locationids, paneltype, panelconfig
+ FROM locationinfo_panel
+ WHERE paneluuid = :id", array('id' => $id));
+ if ($panel === false) {
+ Message::addError('invalid-panel-id', $id);
+ return;
+ }
- $config = json_decode($panel['panelconfig'], true); // TODO: Validate we got an array, fill with defaults otherwise
+ $config = json_decode($panel['panelconfig'], true);
+ }
+
+ $def = LocationInfo::defaultPanelConfig($panel['paneltype']);
+ if (!is_array($config)) {
+ $config = $def;
+ } else {
+ $config += $def;
+ }
$langs = Dictionary::getLanguages(true);
foreach ($langs as &$lang) {
@@ -656,21 +742,38 @@ class Page_LocationInfo extends Page
}
}
- Render::addTemplate('page-config-panel', array(
- 'id' => $id,
- 'languages' => $langs,
- 'mode' => $config['mode'],
- 'vertical_checked' => $config['vertical'] ? 'checked' : '',
- 'eco_checked' => $config['eco'] ? 'checked' : '',
- 'scaledaysauto_checked' => $config['scaledaysauto'] ? 'checked' : '',
- 'daystoshow' => $config['daystoshow'],
- 'rotation' => $config['rotation'],
- 'scale' => $config['scale'],
- 'switchtime' => $config['switchtime'],
- 'calupdate' => $config['calupdate'],
- 'roomupdate' => $config['roomupdate'],
- 'configupdate' => $config['configupdate'],
- ));
+ if ($panel['paneltype'] === 'DEFAULT') {
+ Render::addTemplate('page-config-panel-default', array(
+ 'new' => $id === 'new',
+ 'uuid' => $id,
+ 'panelname' => $panel['panelname'],
+ 'languages' => $langs,
+ 'mode' => $config['mode'],
+ 'vertical_checked' => $config['vertical'] ? 'checked' : '',
+ 'eco_checked' => $config['eco'] ? 'checked' : '',
+ 'scaledaysauto_checked' => $config['scaledaysauto'] ? 'checked' : '',
+ 'daystoshow' => $config['daystoshow'],
+ 'rotation' => $config['rotation'],
+ 'scale' => $config['scale'],
+ 'switchtime' => $config['switchtime'],
+ 'calupdate' => $config['calupdate'],
+ 'roomupdate' => $config['roomupdate'],
+ 'configupdate' => $config['configupdate'],
+ 'locations' => Location::getLocations(),
+ 'locationids' => $panel['locationids'],
+ ));
+ } else { // TODO
+ Render::addTemplate('page-config-panel-summary', array(
+ 'new' => $id === 'new',
+ 'uuid' => $id,
+ 'panelname' => $panel['panelname'],
+ 'languages' => $langs,
+ 'roomupdate' => $config['roomupdate'],
+ 'configupdate' => $config['configupdate'],
+ 'locations' => Location::getLocations(),
+ 'locationids' => $panel['locationids'],
+ ));
+ }
}
}
diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html
new file mode 100644
index 00000000..450b29e9
--- /dev/null
+++ b/modules-available/locationinfo/templates/page-config-panel-default.html
@@ -0,0 +1,418 @@
+<h2>
+ {{#new}}{{lang_createPanel}}{{/new}}
+ {{^new}}{{lang_editPanel}}{{/new}}
+</h2>
+
+<p>{{lang_editDefaultPanelHints}}</p>
+
+<form method="post" action="?do=locationinfo" id="config-form">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="writePanelConfig">
+ <input type="hidden" name="uuid" value="{{uuid}}">
+
+ <div class="row">
+
+ <div class="col-md-6">
+ <div class="modify-inputs panel panel-default">
+ <div class="panel-heading">{{lang_display}}</div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="panel-title">{{lang_displayName}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input class="form-control" name="name" id="panel-title" type="text" value="{{panelname}}">
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_displayNameTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="language">{{lang_language}}</label>
+ </div>
+ <div class="col-sm-7">
+ <select class="form-control" name="language" id="language">
+ {{#languages}}
+ <option value="{{cc}}" id="lang-{{cc}}" {{selected}}>{{name}}</option>
+ {{/languages}}
+ </select>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_languageTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="mode">{{lang_mode}}</label>
+ </div>
+ <div class="col-sm-7">
+ <select class="form-control" name="mode" id="mode" onchange="modeChange()">
+ <option value="1" id="mode1">{{lang_mode1}}</option>
+ <option value="2" id="mode2">{{lang_mode2}}</option>
+ <option value="3" id="mode3">{{lang_mode3}}</option>
+ <option value="4" id="mode4">{{lang_mode4}}</option>
+ </select>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_modeTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="input-eco">{{lang_ecoMode}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input id="input-eco" type="checkbox" name="eco" {{eco_checked}}>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_ecoTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </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="input-calupdate">{{lang_calendar}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input class="form-control" name="calupdate" type="number" min="30" id="input-calupdate"
+ max="1440" value="{{calupdate}}" required>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_calupdateTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="form-roomupdate">{{lang_room}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input class="form-control" name="roomupdate" type="number" min="15" id="form-roomupdate"
+ max="86400" value="{{roomupdate}}" required>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_roomupdateTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="configupdate">{{lang_config}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input id="configupdate" class="form-control" name="configupdate" type="number" min="10"
+ max="1440" value="{{configupdate}}" required>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_configupdateTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ <div class="modify-inputs">
+ <div class="row">
+ <div class="col-md-6">
+
+ <div class="panel panel-default" id="extra-div">
+ <div class="panel-heading">{{lang_mode}}</div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ <div class="list-group-item m1-s m2-h m3-h m4-h">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="input-vertical">{{lang_vertical}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input id="input-vertical" type="checkbox" name="vertical" {{vertical_checked}}>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_verticalTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item m1-s m2-s m3-h m4-s">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="scaledaysauto">{{lang_autoScale}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input id="scaledaysauto" type="checkbox" name="scaledaysauto" {{scaledaysauto_checked}}>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_autoscaleTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item m1-s m2-s m3-h m4-s">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="daystoshow">{{lang_daysToShow}}</label>
+ </div>
+ <div class="col-sm-7">
+ <select class="form-control" id="daystoshow" name="daystoshow">
+ <option value="1">1</option>
+ <option value="2">2</option>
+ <option value="3">3</option>
+ <option value="4">4</option>
+ <option value="5">5</option>
+ <option value="6">6</option>
+ <option value="7">7</option>
+ </select>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_daysToShowTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item m1-s m2-h m3-s m4-s">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="rotation">{{lang_rotation}}</label>
+ </div>
+ <div class="col-sm-7">
+ <select class="form-control" id="rotation" name="rotation">
+ <option value="0">{{lang_rotation0}}</option>
+ <option value="3">{{lang_rotation3}}</option>
+ <option value="2">{{lang_rotation2}}</option>
+ <option value="1">{{lang_rotation1}}</option>
+ </select>
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_rotationTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item m1-s m2-h m3-h m4-h">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="input-scale">{{lang_scale}}</label>
+ </div>
+ <div class="col-sm-7">
+ <span><span class="range-display"></span>&thinsp;%</span>
+ <input id="input-scale" name="scale" type="range" step="1" min="10" max="90" value="{{scale}}">
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_scaleTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item m1-h m2-h m3-h m4-s">
+ <div class="row">
+ <div class="col-sm-3">
+ <label for="input-switchtime">{{lang_switchTime}}</label>
+ </div>
+ <div class="col-sm-7">
+ <span><span class="range-display"></span>&thinsp;{{lang_sec}}</span>
+ <input id="input-switchtime" name="switchtime" type="range" step="1" min="1" max="120" value="{{switchtime}}">
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default helptext" title="{{lang_switchTimeTooltip}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-6">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_locations}}</div>
+ <div class="panel-body">
+ <input type="hidden" name="locationids" value="{{locationids}}" id="locationids">
+ <p>{{lang_fourLocsHint}}</p>
+ <ul id="selected-locations" class="list-unstyled">
+
+ </ul>
+ <div class="dropdown pull-right">
+ <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
+ <span class="glyphicon glyphicon-plus"></span>
+ </button>
+ <ul class="dropdown-menu" id="location-list">
+ {{#locations}}
+ <li><a href="#" data-lid="{{locationid}}">{{locationpad}} <span class="name">{{locationname}}</span></a></li>
+ {{/locations}}
+ </ul>
+ </div>
+ <div class="clearfix"></div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ <button type="submit" class="btn btn-primary">{{lang_save}}</button>
+ <a href="?do=locationinfo&amp;show=panels" class="btn btn-default">{{lang_cancel}}</a>
+</form>
+
+<div class="modal fade" id="no-locations-message" tabindex="-1" role="dialog">
+ <div class="modal-dialog"> <!--style="min-width:600px;width:70%"-->
+
+ <div class="modal-content">
+ <div class="modal-header">{{lang_error}}</div>
+ <div class="modal-body">
+ {{lang_noLocationsWarning}}
+ </div>
+ <div class="modal-footer">
+ <a class="btn btn-primary pull-right" data-dismiss="modal">{{lang_close}}</a>
+ <div class="clearfix"></div>
+ </div>
+ </form>
+ </div>
+
+ </div>
+</div>
+
+<script type="text/javascript"><!--
+
+document.addEventListener("DOMContentLoaded", function () {
+ var $selLocs = $('#selected-locations');
+ var $locList = $('#location-list');
+ var $locInput = $('#locationids');
+
+ // Initialize fancy tooltips
+ $('a.helptext').tooltip();
+ // Add listener to range sliders so their label can be updated
+ $('input[type="range"]').change(function () {
+ $(this).siblings().find('.range-display').text($(this).val());
+ });
+ // Set state of input controls that aren't statically initialized server side
+ $('.modify-inputs input[type="checkbox"]')
+ .bootstrapSwitch({size: 'small'})
+ .on('switchChange.bootstrapSwitch', function () {
+ if (this.name === 'scaledaysauto') {
+ $('#daystoshow').prop('disabled', this.checked);
+ }
+ });
+
+ var lids = $locInput.val().split(',');
+ $selLocs.empty();
+ for (var i = 0; i < lids.length; ++i) {
+ var $name = $locList.find('a[data-lid="' + lids[i] + '"] .name');
+ if ($name.length === 0) continue;
+ addLocation(lids[i], $name.text());
+ }
+
+ $('#daystoshow option[value="{{daystoshow}}"]').attr("selected", "selected");
+ $('#rotation option[value="{{rotation}}"]').attr("selected", "selected");
+ $('#mode option[value="{{mode}}"]').attr("selected", "selected");
+
+ $('#daystoshow').prop('disabled', document.getElementById('scaledaysauto').checked);
+
+ $('input[type="range"]').change();
+ modeChange();
+
+ // Adding/removing locations
+ $locList.find('a').click(function(ev) {
+ ev.preventDefault();
+ var $this = $(this);
+ var name = $this.find('.name').text();
+ var id = $this.data('lid');
+ addLocation(id, name);
+ serializeLocs();
+ });
+
+ $('#config-form').submit(function(ev) {
+ if ($locInput.val().length > 0)
+ return;
+ ev.preventDefault();
+ $('#no-locations-message').modal('show');
+ });
+
+ function addLocation(id, name) {
+ $selLocs.find('li[data-lid="' + id + '"]').remove();
+ var delButton = $('<button class="btn btn-danger btn-xs" type="button">').append($('<span class="glyphicon glyphicon-remove">')).click(delParent);
+ $selLocs.append($('<li>').attr('data-lid', id).text(name).prepend(delButton));
+ }
+
+ function delParent() {
+ $(this).parent().remove();
+ serializeLocs();
+ }
+
+ function serializeLocs() {
+ var res = $selLocs.find('li[data-lid]').map( function() {
+ return $(this).data('lid');
+ }).get().join(',');
+ $locInput.val(res);
+ }
+
+});
+
+/**
+ * If the mode was changed the mode settings have to be adjusted.
+ */
+function modeChange() {
+ var value = $('#mode').val();
+ $('.m' + value + '-h').hide();
+ $('.m' + value + '-s').show();
+}
+
+//--></script>
diff --git a/modules-available/locationinfo/templates/page-config-panel.html b/modules-available/locationinfo/templates/page-config-panel.html
deleted file mode 100644
index 244b80c9..00000000
--- a/modules-available/locationinfo/templates/page-config-panel.html
+++ /dev/null
@@ -1,349 +0,0 @@
-<form method="post" action="?do=locationinfo" id="configForm">
- <input type="hidden" name="token" value="{{token}}">
- <input type="hidden" name="action" value="updateConfig">
- <input type="hidden" name="id" value="{{id}}">
-
- <div class="row">
- <div class="col-md-6">
- <div class="modify-inputs panel panel-default">
- <div class="panel-heading">{{lang_display}}</div>
- <div class="panel-body">
- <div class="list-group">
-
- <div class="list-group-item">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_language}}</label>
- </div>
- <div class="col-sm-7">
- <select class="form-control" name="language" id="language">
- {{#languages}}
- <option value="{{cc}}" id="lang-{{cc}}" {{selected}}>{{name}}</option>
- {{/languages}}
- </select>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_languageTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_mode}}</label>
- </div>
- <div class="col-sm-7">
- <select class="form-control" name="mode" id="mode" onchange="modeChange()">
- <option value="1" id="mode1">{{lang_mode1}}</option>
- <option value="2" id="mode2">{{lang_mode2}}</option>
- <option value="3" id="mode3">{{lang_mode3}}</option>
- <option value="4" id="mode4">{{lang_mode4}}</option>
- </select>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_modeTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_ecoMode}}</label>
- </div>
- <div class="col-sm-7">
- <input type="checkbox" name="eco" {{eco_checked}}>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_ecoTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="modify-inputs">
- <div class="row">
- <div class="col-md-6">
- <div class="panel panel-default" id="extra-div">
- <div class="panel-heading">{{lang_mode}}</div>
- <div class="panel-body">
- <div class="list-group">
-
- <div class="list-group-item m1-s m2-h m3-h m4-h">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_vertical}}</label>
- </div>
- <div class="col-sm-7">
- <input type="checkbox" name="vertical" {{vertical_checked}}>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_verticalTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item m1-s m2-s m3-h m4-s">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_autoScale}}</label>
- </div>
- <div class="col-sm-7">
- <input id="scaledaysauto" type="checkbox" name="scaledaysauto" {{scaledaysauto_checked}}>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_autoscaleTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item m1-s m2-s m3-h m4-s">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_daysToShow}}</label>
- </div>
- <div class="col-sm-7">
- <select class="form-control" id="daystoshow" name="daystoshow">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- <option value="5">5</option>
- <option value="6">6</option>
- <option value="7">7</option>
- </select>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_daysToShowTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item m1-s m2-h m3-s m4-s">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_rotation}}</label>
- </div>
- <div class="col-sm-7">
- <select class="form-control" id="rotation" name="rotation">
- <option value="0">{{lang_rotation0}}</option>
- <option value="3">{{lang_rotation3}}</option>
- <option value="2">{{lang_rotation2}}</option>
- <option value="1">{{lang_rotation1}}</option>
- </select>
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_rotationTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item m1-s m2-h m3-h m4-h">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_scale}}</label>
- </div>
- <div class="col-sm-7">
- <span><span class="range-display"></span>&thinsp;%</span>
- <input name="scale" type="range" step="1" min="10" max="90" value="{{scale}}">
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_scaleTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item m1-h m2-h m3-h m4-s">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_switchTime}}</label>
- </div>
- <div class="col-sm-7">
- <span><span class="range-display"></span>&thinsp;{{lang_sec}}</span>
- <input name="switchtime" type="range" step="1" min="1" max="120" value="{{switchtime}}">
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_switchTimeTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
- </div>
- </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>{{lang_calendar}}</label>
- </div>
- <div class="col-sm-7">
- <input class="form-control" name="calupdate" type="number" min="0"
- max="1440" value="{{calupdate}}">
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_calupdateTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_room}}</label>
- </div>
- <div class="col-sm-7">
- <input class="form-control" name="roomupdate" type="number" min="0"
- max="86400" value="{{roomupdate}}">
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_roomupdateTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
-
- <div class="list-group-item">
- <div class="row">
- <div class="col-sm-3">
- <label>{{lang_config}}</label>
- </div>
- <div class="col-sm-7">
- <input class="form-control" name="configupdate" type="number" min="0"
- max="1440" value="{{configupdate}}">
- </div>
- <div class="col-sm-2">
- <a class="btn btn-default helptext" title="{{lang_configupdateTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <a class="btn btn-sm btn-default helptext pull-right" title="{{lang_customUrlTooltip}}">
- <span class="glyphicon glyphicon-question-sign"></span>
- </a>
- {{lang_customUrl}}
- <div class="clearfix"></div>
- </div>
- <div class="panel-body">
- <textarea rows="5" readonly class="form-control" id="custom-url"></textarea>
- </div>
- </div>
-</form>
-
-<script type="text/javascript"><!--
- // Get list of form elements which affect the generated custom URL
- var $inputs = $('.modify-inputs input, .modify-inputs select');
- // Base for displaying the custom URL
- var customURL = window.location.protocol + "//" + window.location.hostname + "/slx-admin/modules/locationinfo/frontend/doorsign.html?id={{id}}";
- // Initialize fancy tooltips
- $('a.helptext').tooltip();
- // Add listener to range sliders so their label can be updated
- $('input[type="range"]').change(function () {
- $(this).siblings().find('.range-display').text($(this).val());
- });
- // Set state of input controls that aren't statically initialized server side
- loadValues();
- // Update the custom URL
- buildCustomUrl();
- // Add listener to all the elements affecting custom URL
- $inputs.change(function () {
- $this = $(this);
- if ($this.attr('type') === 'hidden')
- return;
- buildCustomUrl();
- });
-
- /**
- * Modifies the url preview.
- */
- function buildCustomUrl() {
- var str = Array.prototype.reduce.call($inputs, function (acc, val) {
- if (val.type && val.type === 'radio' && !val.checked)
- return acc;
- var v;
- if (val.type && val.type === 'checkbox') {
- v = val.checked ? val.value : '';
- } else {
- v = val.value;
- }
- return acc + '&' + encodeURIComponent(val.name) + '=' + encodeURIComponent(v);
- }, '');
-
- $('#custom-url').val(customURL + str);
- }
-
- /**
- * Loads the Values in the config form elements.
- */
- function loadValues() {
- $('.modify-inputs input[type="checkbox"]')
- .bootstrapSwitch({size: 'small'})
- .on('switchChange.bootstrapSwitch', function () {
- buildCustomUrl();
- if (this.name === 'scaledaysauto') {
- $('#daystoshow').prop('disabled', this.checked);
- }
- });
-
- $('#daystoshow option[value="{{daystoshow}}"]').attr("selected", "selected");
- $('#rotation option[value="{{rotation}}"]').attr("selected", "selected");
- $('#mode option[value="{{mode}}"]').attr("selected", "selected");
-
- $('#daystoshow').prop('disabled', document.getElementById('scaledaysauto').checked);
-
- $('input[type="range"]').change();
- modeChange();
- }
-
- /**
- * If the mode was changed the mode settings have to be adjusted.
- */
- function modeChange() {
- var value = $('#mode').val();
- $('.m' + value + '-h').hide();
- $('.m' + value + '-s').show();
- }
-
-//--></script>
diff --git a/modules-available/locationinfo/templates/page-locations.html b/modules-available/locationinfo/templates/page-locations.html
index 27c2d9a2..3eafa7bf 100644
--- a/modules-available/locationinfo/templates/page-locations.html
+++ b/modules-available/locationinfo/templates/page-locations.html
@@ -1,17 +1,25 @@
-<h4>{{lang_buildingTable}}</h4>
-<table class="table table-condensed table-hover" style="margin-bottom:0">
+<h2>{{lang_locationsTable}}</h2>
+<p>{{lang_locationsTableHints}}</p>
+
+<table class="table table-condensed table-hover">
+ <thead>
<tr>
<th>{{lang_locationName}}</th>
- <th>{{lang_openingTime}}</th>
- <th>{{lang_locationSettings}}</th>
+ <th>{{lang_backend}}</th>
+ <th>{{lang_openingtimes}}</th>
</tr>
+ </thead>
+ <tbody>
{{#list}}
<tr>
<td>
<div style="display:inline-block;width:{{depth}}em"></div>
- <a href="#" class="loc-name {{^depth}}slx-bold{{/depth}}" data-locationid="{{locationid}}">{{locationname}}</a>
+ <a href="#" class="loc-name {{^depth}}slx-bold{{/depth}}" data-locationid="{{locationid}}">
+ {{locationname}}
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
</td>
<td>
{{backend}}
@@ -20,8 +28,8 @@
<span class="glyphicon glyphicon-{{openingGlyph}}"></span>
</td>
</tr>
-
{{/list}}
+ </tbody>
</table>
<div class="modal fade" id="location-modal" tabindex="-1" role="dialog">
diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html
new file mode 100644
index 00000000..e4894571
--- /dev/null
+++ b/modules-available/locationinfo/templates/page-panels.html
@@ -0,0 +1,57 @@
+<h2>{{lang_panelsTable}}</h2>
+
+<p>{{lang_panelsTableHints}}</p>
+
+<table class="table table-hover">
+ <thead>
+ <tr>
+ <th>{{lang_panel}}</th>
+ <th>{{lang_panelType}}</th>
+ <th>{{lang_locations}}</th>
+ <th width="1"></th>
+ <th width="1"></th>
+ </tr>
+ </thead>
+ <tbody>
+ <form method="post" action="?do=locationinfo" onsubmit="return confirm('{{lang_areYouSure}}')">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="deletePanel">
+ {{#panels}}
+ <tr>
+ <td>
+ {{panelname}}
+ </td>
+ <td>
+ {{paneltype}}
+ </td>
+ <td>
+ {{locations}}
+ </td>
+ <td>
+ <a class="btn btn-default btn-xs" href="?do=locationinfo&amp;show=edit-panel&amp;uuid={{paneluuid}}">
+ <span class="glyphicon glyphicon-cog"></span>
+ {{lang_edit}}
+ </a>
+ </td>
+ <td>
+ <button type="submit" name="uuid" value="{{paneluuid}}" class="btn btn-danger btn-xs">
+ <span class="glyphicon glyphicon-trash"></span>
+ {{lang_delete}}
+ </button>
+ </td>
+ </tr>
+ {{/panels}}
+ </form>
+ </tbody>
+</table>
+
+<div>
+ <a class="btn btn-sm btn-success" href="?do=locationinfo&amp;show=edit-panel&amp;uuid=new-default">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_defaultPanel}}
+ </a>
+ <a class="btn btn-sm btn-success" href="?do=locationinfo&amp;show=edit-panel&amp;uuid=new-summary">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_summaryPanel}}
+ </a>
+</div> \ No newline at end of file
diff --git a/modules-available/locationinfo/templates/page-servers.html b/modules-available/locationinfo/templates/page-servers.html
index 2dfe63e1..eefb1ed5 100644
--- a/modules-available/locationinfo/templates/page-servers.html
+++ b/modules-available/locationinfo/templates/page-servers.html
@@ -1,69 +1,72 @@
-<div>
- <h1>{{lang_mainHeader}}</h1>
-
- <h4>{{lang_serverTable}}</h4>
-
- <table class="table table-hover">
+<h2>{{lang_serverTable}}</h2>
+
+<p>{{lang_serverTableHints}}</p>
+
+<table class="table table-hover">
+ <thead>
+ <tr>
+ <th width="1">{{lang_serverType}}</th>
+ <th>{{lang_locationName}}</th>
+ <th width="1"></th>
+ <th width="1"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#serverlist}}
+ <form method="post" action="?do=locationinfo">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="serverid" value="{{serverid}}">
<tr>
- <th width="1">{{lang_serverType}}</th>
- <th>{{lang_locationName}}</th>
- <th width="1"></th>
- <th width="1"></th>
+ <td nowrap>{{typename}}</td>
+ <td nowrap>{{servername}}</td>
+
+ <td align="center" nowrap>
+ <button class="btn btn-xs {{^autherror}}btn-default{{/autherror}}{{#autherror}}btn-danger{{/autherror}}"
+ data-server-edit="{{serverid}}" {{disabled}} type="button">
+ <span class="glyphicon glyphicon-cog"></span>
+ {{lang_edit}}
+ </button>
+ <button class="btn btn-xs btn-primary server-check" {{disabled}} name="action" value="checkConnection"
+ type="submit">
+ <span class="glyphicon glyphicon-refresh"></span>
+ {{lang_checkConnection}}
+ </button>
+ </td>
+ <td align="center" nowrap>
+ <button class="btn btn-xs btn-danger server-delete" type="submit" name="action" value="deleteServer">
+ <span class="glyphicon glyphicon-trash"></span>
+ {{lang_delete}}
+ </button>
+ </td>
</tr>
- {{#serverlist}}
- <form method="post" action="?do=locationinfo">
- <input type="hidden" name="token" value="{{token}}">
- <input type="hidden" name="serverid" value="{{serverid}}">
- <tr>
- <td nowrap>{{typename}}</td>
- <td nowrap>{{servername}}</td>
-
- <td align="center" nowrap>
- <button class="btn btn-sm {{^autherror}}btn-success{{/autherror}}{{#autherror}}btn-danger{{/autherror}}"
- data-server-edit="{{serverid}}" {{disabled}} type="button">
- <span style="margin-right: 5px;" class="glyphicon glyphicon-cog"></span>
- {{lang_locationSettings}}
- </button>
- <button class="btn btn-sm btn-primary server-check" {{disabled}} name="action" value="checkConnection"
- type="submit">
- <span style="margin-right: 5px;" class="glyphicon glyphicon-refresh"></span>
- {{lang_checkConnection}}
- </button>
- </td>
- <td align="center" nowrap>
- <button class="btn btn-sm btn-danger server-delete" type="submit" name="action" value="deleteServer">
- <span style="margin-right: 5px;" class="glyphicon glyphicon-remove"></span>
- {{lang_delete}}
- </button>
- </td>
- </tr>
- </form>
- {{/serverlist}}
- </table>
-
- <div>
- <button class="btn btn-sm btn-success" id="addServerButton" onclick="addServer()">
- <span style="margin-right: 5px;" class="glyphicon glyphicon-plus"></span>
- {{lang_addServer}}
- </button>
- </div>
+ </form>
+ {{/serverlist}}
+ </tbody>
+</table>
+
+<div>
+ <button class="btn btn-sm btn-success" id="addServerButton" onclick="addServer()">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_addServer}}
+ </button>
+</div>
- <div class="modal fade" id="myModal" tabindex="-1" role="dialog">
- <div class="modal-dialog">
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header" id="myModalHeader"></div>
- <div class="modal-body" id="myModalBody"></div>
- <div class="modal-footer">
- <button type="submit" id="myModalSubmitButton" class="btn btn-primary" form="">{{lang_save}}</button>
+ <div class="modal-content">
+ <div class="modal-header" id="myModalHeader"></div>
+ <div class="modal-body" id="myModalBody"></div>
+ <div class="modal-footer">
+ <button type="submit" id="myModalSubmitButton" class="btn btn-primary" form="">{{lang_save}}</button>
- <a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a>
- </div>
+ <a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a>
</div>
-
</div>
+
</div>
</div>
+
<script type="text/javascript"><!--
document.addEventListener("DOMContentLoaded", function () {
diff --git a/modules-available/locationinfo/templates/page-tabs.html b/modules-available/locationinfo/templates/page-tabs.html
new file mode 100644
index 00000000..ed3f01fd
--- /dev/null
+++ b/modules-available/locationinfo/templates/page-tabs.html
@@ -0,0 +1,6 @@
+<ul class="nav nav-tabs">
+ <li class="{{class-}}"><a href="?do=locationinfo">{{lang_panels}}</a></li>
+ <li class="{{class-locations}}"><a href="?do=locationinfo&amp;show=locations">{{lang_locationSettings}}</a></li>
+ <li class="{{class-backends}}"><a href="?do=locationinfo&amp;show=backends">{{lang_backends}}</a></li>
+</ul>
+<br> \ No newline at end of file