From a92a7cc35115dba2c3a7cf98cb08a9ae0795da5a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 16 Aug 2017 18:22:12 +0200 Subject: [locationinfo] Fix davinci backend connection test, minor tweaks to web view --- .../locationinfo/inc/coursebackend/coursebackend_davinci.inc.php | 8 ++++++-- modules-available/locationinfo/install.inc.php | 6 +++++- modules-available/locationinfo/templates/page-panels.html | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php index 53617a61..fac3f296 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php @@ -25,7 +25,9 @@ class CourseBackend_Davinci extends CourseBackend if (empty($this->location)) { $this->error = "Credentials are not set"; } else { - $data = $this->fetchRoomRaw('someroomid123'); + $startDate = new DateTime('today 0:00'); + $endDate = new DateTime('+7 days 0:00'); + $data = $this->fetchRoomRaw('someroomid123', $startDate, $endDate); if ($data !== false && strpos($data, 'DAVINCI SERVER') === false) { $this->error = "Unknown reply; this doesn't seem to be a DAVINCI server."; } @@ -58,7 +60,9 @@ class CourseBackend_Davinci extends CourseBackend } /** - * @param $roomId string name of the room + * @param string $roomId unique name of the room, as used by davinci + * @param \DateTime $startDate start date to fetch + * @param \DateTime $endDate end date of range to fetch * @return array|bool if successful the arrayrepresentation of the timetable */ private function fetchRoomRaw($roomId, $startDate, $endDate) diff --git a/modules-available/locationinfo/install.inc.php b/modules-available/locationinfo/install.inc.php index 10422241..7c47ac90 100644 --- a/modules-available/locationinfo/install.inc.php +++ b/modules-available/locationinfo/install.inc.php @@ -19,7 +19,8 @@ $t2 = $res[] = tableCreate('locationinfo_coursebackend', ' `servertype` VARCHAR(100) NOT NULL, `credentials` BLOB, `error` VARCHAR(500), - PRIMARY KEY (`serverid`) + PRIMARY KEY (`serverid`), + KEY `servername` (`servername`) '); $t3 = $res[] = tableCreate('locationinfo_panel', " @@ -72,6 +73,9 @@ if ($t3 === UPDATE_NOOP) { `paneltype` ENUM('DEFAULT', 'SUMMARY', 'URL') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL"); } +// 2017-07-26 Add servername key +Database::exec("ALTER TABLE `locationinfo_coursebackend` ADD KEY `servername` (`servername`)"); + // Create response for browser if (in_array(UPDATE_RETRY, $res)) { diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html index 0c87a70b..f374e456 100644 --- a/modules-available/locationinfo/templates/page-panels.html +++ b/modules-available/locationinfo/templates/page-panels.html @@ -34,7 +34,7 @@ {{#hasRunmode}} - + {{assignedMachineCount}} -- cgit v1.2.3-55-g7522