2 LuCI - Lua Configuration Interface
3 Copyright
2008 Steven Barth
<steven@midlink.org
>
4 Copyright
2008 Jo-Philipp Wich
<xm@leipzig.freifunk.net
>
6 Licensed under the Apache License, Version
2.0 (the
"License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-
2.0
16 <?xml version=
"1.0" encoding=
"UTF-8"?>
17 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
18 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
20 <title>Filebrowser - LuCI
</title>
21 <style type=
"text/css">
28 list-style-type: none;
32 vertical-align: bottom;
37 <script type=
"text/javascript">
38 function callback(path) {
40 var input = window.opener.document.getElementById('<%=luci.http.formvalue('field')%
>');
54 require(
"luci.dispatcher")
56 local field = luci.http.formvalue('field')
57 local request = luci.dispatcher.context.path
60 for i =
3, #request do
61 if request[i] ~= '..' and #request[i]
> 0 then
62 path[#path+
1] = request[i]
66 local filepath = table.concat( path, '/' )
67 local filestat = nixio.fs.stat( filepath )
68 local baseurl = luci.dispatcher.build_url('admin', 'filebrowser')
70 if filestat and filestat.type ==
"reg" then
71 table.remove( path, #path )
72 filepath = table.concat( path, '/' ) .. '/'
73 elseif not ( filestat and filestat.type ==
"dir" ) then
77 filepath = filepath .. '/'
80 local entries = nixio.util.consume((nixio.fs.dir(filepath)))
84 <% for i, dir in ipairs(path) do %
>
86 <a href=
"<%=baseurl%>?field=<%=field%>">(root)
</a>
87 <% elseif next(path, i) then %
>
88 <% baseurl = baseurl .. '/' .. dir %
>
89 /
<a href=
"<%=baseurl%>?field=<%=field%>"><%=dir%
></a>
91 <% baseurl = baseurl .. '/' .. dir %
>
101 <% for _, e in luci.util.vspairs(entries) do
102 local stat = nixio.fs.stat(filepath..e)
103 if stat and stat.type == 'dir' then
106 <img src=
"/luci-static/resources/cbi/folder.png" alt=
"Directory" />
107 <a href=
"<%=baseurl%>/<%=e%>?field=<%=field%>"><%=e%
>/
</a>
111 <% for _, e in luci.util.vspairs(entries) do
112 local stat = nixio.fs.stat(filepath..e)
113 if stat and stat.type ~= 'dir' then
116 <img src=
"/luci-static/resources/cbi/file.png" alt=
"File" />
117 <a href=
"#" onclick=
"callback('<%=filepath..e%>')"><%=e%
></a>