From 866e776b192d95b2f2fa584f237a03c1d0145eb8 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Wed, 29 Jun 2016 17:14:05 +0200 Subject: [PATCH] Map view uses sensor and event objects --- resource/web/img/lightbulb.svg | 22 ++++++++++++++++++++++ resource/web/map.tmpl | 9 ++++++--- src/se/hal/page/MapHttpPage.java | 11 ++++++++++- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100755 resource/web/img/lightbulb.svg diff --git a/resource/web/img/lightbulb.svg b/resource/web/img/lightbulb.svg new file mode 100755 index 00000000..12a44ab5 --- /dev/null +++ b/resource/web/img/lightbulb.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resource/web/map.tmpl b/resource/web/map.tmpl index 01e2ba85..46f582af 100755 --- a/resource/web/map.tmpl +++ b/resource/web/map.tmpl @@ -7,11 +7,14 @@ - + {{#sensors}} + + {{/sensors}} - - + {{#events}} + + {{/events}} diff --git a/src/se/hal/page/MapHttpPage.java b/src/se/hal/page/MapHttpPage.java index 244a00dd..1a3f8f12 100755 --- a/src/se/hal/page/MapHttpPage.java +++ b/src/se/hal/page/MapHttpPage.java @@ -1,6 +1,10 @@ package se.hal.page; +import se.hal.HalContext; import se.hal.intf.HalHttpPage; +import se.hal.struct.Event; +import se.hal.struct.Sensor; +import zutil.db.DBConnection; import zutil.io.file.FileUtil; import zutil.parser.Templator; @@ -21,6 +25,11 @@ public class MapHttpPage extends HalHttpPage { @Override public Templator httpRespond(Map session, Map cookie, Map request) throws Exception { - return new Templator(FileUtil.find(TEMPLATE)); + DBConnection db = HalContext.getDB(); + Templator tmpl = new Templator(FileUtil.find(TEMPLATE)); + tmpl.set("sensors", Sensor.getLocalSensors(db)); + tmpl.set("events", Event.getLocalEvents(db)); + + return tmpl; } }