Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mirrors
openwrt
freifunk
提交
993d4db0
F
freifunk
项目概览
mirrors
/
openwrt
/
freifunk
10 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
freifunk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
993d4db0
编写于
5月 26, 2021
作者:
S
Sven Roederer
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'add-new-olsr-based-map' (PR #18)
based on @booo the map-provider was changed.
上级
c369050a
5de89c38
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
172 addition
and
0 deletion
+172
-0
modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
...luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
+2
-0
modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm
modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm
+29
-0
modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm
modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm
+141
-0
未找到文件。
modules/luci-mod-freifunk/luasrc/controller/freifunk/freifunk.lua
浏览文件 @
993d4db0
...
...
@@ -91,6 +91,8 @@ function index()
page
.
title
=
_
(
"Contact"
)
page
.
order
=
15
entry
({
"freifunk"
,
"map"
},
template
(
"freifunk-map/frame"
),
_
(
"Map"
),
50
)
entry
({
"freifunk"
,
"map"
,
"content"
},
template
(
"freifunk-map/map"
),
nil
,
51
)
entry
({
"admin"
,
"freifunk"
,
"profile_error"
},
template
(
"freifunk/profile_error"
))
end
...
...
modules/luci-mod-freifunk/luasrc/view/freifunk-map/frame.htm
0 → 100644
浏览文件 @
993d4db0
<
%+
header
%
>
<
%
local
has_latlon =
false
local
uci =
require
"
luci.model.uci
".
cursor
()
uci:foreach
("
olsrd
",
"
LoadPlugin
",
function
(
s
)
if
s.library =
=
"
olsrd_nameservice
"
and
s.latlon_file
then
has_latlon =
true
end
end
)
%
>
<
%
if
has_latlon
then
%
>
<iframe
style=
"width:100%; height:640px; border:none"
src=
"<%=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
%
>
modules/luci-mod-freifunk/luasrc/view/freifunk-map/map.htm
0 → 100644
浏览文件 @
993d4db0
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"
integrity=
"sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=
""
/>
<script
src=
"https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"
integrity=
"sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=
""
>
</script>
<title>
Map
</title>
</head>
<body
style=
"margin:0"
>
<div
id=
"ffmap"
style=
"position:relative; width:100%; height:640px;"
></div>
<script
type=
"text/javascript"
>
var
INFINITE
=
99.99
;
var
map
=
L
.
map
(
'
ffmap
'
).
setView
([
52.48
,
12
],
13
);
var
osmUrl
=
'
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
'
;
var
osmAttrib
=
'
Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors
'
;
var
osm
=
new
L
.
TileLayer
(
osmUrl
,
{
attribution
:
osmAttrib
});
map
.
addLayer
(
osm
);
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
]
=
[
lat
,
lon
];
var
marker
=
L
.
circleMarker
([
lat
,
lon
]).
addTo
(
map
);
marker
.
bindPopup
(
'
Node:
'
+
name
+
'
<br>IP:
'
+
mainip
+
'
<br>DefGW:
'
+
hnaip
);
}
function
Self
(
mainip
,
lat
,
lon
,
ishna
,
hnaip
,
name
)
{
//map.LoadMap(new VELatLong(lat, lon), 15, VEMapStyle.Hybrid);
//map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
//map.ShowMiniMap(14, 474);
Node
(
mainip
,
lat
,
lon
,
ishna
,
hnaip
,
name
);
map
.
setView
([
lat
,
lon
],
13
)
}
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
};
var
polyline
=
L
.
polyline
([
points
[
fromip
],
points
[
toip
]],
{
color
:
'
rgb(
'
+
red
+
'
,
'
+
green
+
'
,
'
+
blue
+
'
)
'
})
.
addTo
(
map
);
polyline
.
bindPopup
(
fromip
+
"
-
"
+
toip
+
"
<br>
"
+
"
ETX:
"
+
etx
+
"
<br>
"
+
"
LQ:
"
+
lq
+
"
<br>
"
+
"
NLQ:
"
+
nlq
+
"
<br>
"
);
}
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
()
{
<%
local
fd
local
uci
=
require
"
luci.model.uci
"
.
cursor
()
uci
:
foreach
(
"
olsrd
"
,
"
LoadPlugin
"
,
function
(
s
)
if
s
.
library
==
"
olsrd_nameservice
"
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
%>
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录