1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <title>Filebrowser - LuCI</title>
6 <style type="text/css">
13 list-style-type: none;
17 vertical-align: bottom;
22 <script type="text/javascript">
23 function callback(path) {
25 var input = window.opener.document.getElementById('<%=luci.http.formvalue('field')%>');
39 require("luci.dispatcher")
41 local field = luci.http.formvalue('field')
42 local request = luci.dispatcher.context.args
45 for i = 1, #request do
46 if request[i] ~= '..' and #request[i] > 0 then
47 path[#path+1] = request[i]
51 local filepath = table.concat( path, '/' )
52 local filestat = nixio.fs.stat( filepath )
53 local baseurl = luci.dispatcher.build_url('admin', 'filebrowser')
55 if filestat and filestat.type == "reg" then
56 table.remove( path, #path )
57 filepath = table.concat( path, '/' ) .. '/'
58 elseif not ( filestat and filestat.type == "dir" ) then
62 filepath = filepath .. '/'
65 local entries = nixio.util.consume((nixio.fs.dir(filepath)))
69 <% for i, dir in ipairs(path) do %>
71 <a href="<%=baseurl%>?field=<%=field%>">(root)</a>
72 <% elseif next(path, i) then %>
73 <% baseurl = baseurl .. '/' .. dir %>
74 / <a href="<%=baseurl%>?field=<%=field%>"><%=dir%></a>
76 <% baseurl = baseurl .. '/' .. dir %>
86 <% for _, e in luci.util.vspairs(entries) do
87 local stat = nixio.fs.stat(filepath..e)
88 if stat and stat.type == 'dir' then
91 <img src="<%=resource%>/cbi/folder.gif" alt="<%:Directory%>" />
92 <a href="<%=baseurl%>/<%=e%>?field=<%=field%>"><%=e%>/</a>
96 <% for _, e in luci.util.vspairs(entries) do
97 local stat = nixio.fs.stat(filepath..e)
98 if stat and stat.type ~= 'dir' then
101 <img src="<%=resource%>/cbi/file.gif" alt="<%:File%>" />
102 <a href="#" onclick="callback('<%=filepath..e%>')"><%=e%></a>