diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /modules/luci-mod-freifunk/luasrc/view/freifunk-map | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-freifunk/luasrc/view/freifunk-map')
-rw-r--r-- | modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm | 29 | ||||
-rw-r--r-- | modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm | 118 |
2 files changed, 147 insertions, 0 deletions
diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm new file mode 100644 index 0000000000..b2e168363f --- /dev/null +++ b/modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm @@ -0,0 +1,29 @@ +<%+header%> + +<% + local has_latlon = false + local uci = require "luci.model.uci".cursor() + uci:foreach("olsrd", "LoadPlugin", function(s) + if s.library == "olsrd_nameservice.so.0.3" and s.latlon_file then + has_latlon = true + end + end) +%> + +<% if has_latlon then %> + <iframe style="width:100%; height:640px; border:none" src="<%=luci.dispatcher.build_url("freifunk/map/content")%>"></iframe> + <h3><%:Legend%>:</h3> + <ul> + <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (ETX < 2)%></li> + <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (2 < ETX < 4)%></li> + <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li> + <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li> + </ul> + +<% else %> + <h2><%:Map Error%></h2> + <p><%_The OLSRd service is not configured to capture position data from the network.<br /> + Please make sure that the nameservice plugin is properly configured and that the <em>latlon_file</em> option is enabled.%></p> +<% end %> +<%+footer%> + diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm new file mode 100644 index 0000000000..c3951f9c63 --- /dev/null +++ b/modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm @@ -0,0 +1,118 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <title>Map</title> + </head> + + <body style="margin:0"> + <script src="//dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1&s=1" type="text/javascript"></script> + <script type="text/javascript"> + var alias = new Array; + var points = new Array; + var unkpos = new Array; + var lineid = 0; + onload=new Function("if(null!=window.ffmapinit)ffmapinit();"); + + function Mid(mainip,aliasip) + { + alias[aliasip]=mainip; + } + + function Node(mainip,lat,lon,ishna,hnaip,name) + { + points[mainip] = new VELatLong(lat, lon); + map.AddPushpin(new VEPushpin(mainip, points[mainip], + '<%=luci.config.main.resourcebase%>/freifunk-map/'+(ishna?'hna':'node')+'.gif', 'Node:'+name, + '<br><img src="<%=luci.config.main.resourcebase%>/freifunk-map/'+(ishna?'hna':'node')+'.gif">'+ + '<br>IP:'+mainip+'<br>DefGW:'+hnaip)); + } + + function Self(mainip,lat,lon,ishna,hnaip,name) + { + //map.SetDashboardSize(VEDashboardSize.Small); + map.LoadMap(new VELatLong(lat, lon), 15, VEMapStyle.Hybrid); + map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers); + map.ShowMiniMap(14, 474); + Node(mainip,lat,lon,ishna,hnaip,name); + } + + function Link(fromip,toip,lq,nlq,etx) + { + if (0==lineid && null!=window.ffmapstatic) ffmapstatic(); + if (null != alias[toip]) toip = alias[toip]; + if (null != alias[fromip]) fromip = alias[fromip]; + if (null != points[fromip] && null != points[toip]) + { + var color; + var red = 240; + var green = 0; + var blue = 0; + var w = 1 + + if (etx < 100) {red=252;green=102;blue=0;w=2}; + if (etx < 10) {red=255;green=203;blue=5;w=3}; + if (etx < 4) {red=240;green=255;blue=0;w=4}; + if (etx < 2) {red=0;green=204;blue=0;w=5}; + if (etx < 1) {red=80;green=0;blue=0;w=1}; + + map.AddPolyline(new VEPolyline('id'+lineid, [points[fromip], points[toip]], + new VEColor(red, green, blue, 0.5), w)); + + + } + else + { + if (null == points[toip]) unkpos[toip] = ''; + if (null == points[fromip]) unkpos[fromip] = ''; + } + lineid++; + } + + function PLink(fromip,toip,lq,nlq,etx,lata,lona,ishnaa,latb,lonb,ishnab) + { + Link(fromip,toip,lq,nlq,etx); + } + + function ffmapinit() + { + if(null!=window.map)map.Dispose(); + + var INFINITE = 99.99; + + map = new VEMap('ffmap'); + <% + local fd + local uci = require "luci.model.uci".cursor() + + uci:foreach("olsrd", "LoadPlugin", function(s) + if s.library == "olsrd_nameservice.so.0.3" and s.latlon_file then + fd = io.open(s.latlon_file) + end + end) + + if fd then + local data = fd:read("*a") + fd:close() + + if data then + local line + for line in data:gmatch("[^\n]+") do + if line:match(";$") then + write(line .. "\n") + else + break + end + end + end + end + %> + } + + function ffgoto(ip) + { + map.SetCenter(points[ip]); + } + </script> + <div id="ffmap" style="position:relative; width:100%; height:640px;"></div> + </body> +</html> |