diff options
author | Simon Rettberg | 2017-04-20 14:03:35 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-20 14:03:35 +0200 |
commit | b2810b89438c6a8be5c7de2342a50a5c129f6c69 (patch) | |
tree | 95b695820998068fad2776aa69d9ac83f694e03a /modules-available/locationinfo/frontend/doorsign.html | |
parent | [locationinfo] Rename tables to use module name as prefix; room -> location (diff) | |
download | slx-admin-b2810b89438c6a8be5c7de2342a50a5c129f6c69.tar.gz slx-admin-b2810b89438c6a8be5c7de2342a50a5c129f6c69.tar.xz slx-admin-b2810b89438c6a8be5c7de2342a50a5c129f6c69.zip |
[locationinfo] Simplify getLocationInfo() queries, make dorrsign work properly for locations without config
Diffstat (limited to 'modules-available/locationinfo/frontend/doorsign.html')
-rwxr-xr-x | modules-available/locationinfo/frontend/doorsign.html | 21 |
1 files changed, 7 insertions, 14 deletions
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 () { - } }) } |