From b2810b89438c6a8be5c7de2342a50a5c129f6c69 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 20 Apr 2017 14:03:35 +0200 Subject: [locationinfo] Simplify getLocationInfo() queries, make dorrsign work properly for locations without config --- .../locationinfo/frontend/doorsign.html | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'modules-available/locationinfo/frontend') diff --git a/modules-available/locationinfo/frontend/doorsign.html b/modules-available/locationinfo/frontend/doorsign.html index a703cce3..6c943e03 100755 --- a/modules-available/locationinfo/frontend/doorsign.html +++ b/modules-available/locationinfo/frontend/doorsign.html @@ -1340,16 +1340,18 @@ optional: function preInitRoom(room) { $.getJSON("../../../api.php?do=locationinfo&action=locationinfo&id=" + room.id + "&coords=1", function (result) { - generateRoomLayoutDiv((100 - room.config.scale) + "%", room); - if (result[0] == null) { - return; + generateRoomLayoutDiv((100 - room.config.scale) + "%", room); + if (result && result[0] && result[0].computer) { + initRoom(result[0].computer, room); + } else { + initRoom([], room); } - initRoom(result[0].computer, room); }).error(function () { generateRoomLayoutDiv((100 - room.config.scale) + "%", room); + }) } @@ -1557,18 +1559,9 @@ optional: 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."); - return; - } - for (var i = 0; i < l; i++) { - + for (var i = 0; i < result.length; i++) { UpdatePc(result[i].computer, rooms[result[i].id]); } - }, error: function () { - } }) } -- cgit v1.2.3-55-g7522