summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/view
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/luasrc/view')
-rw-r--r--modules/luci-base/luasrc/view/cbi/filebrowser.htm61
-rw-r--r--modules/luci-base/luasrc/view/cbi/simpleform.htm3
-rw-r--r--modules/luci-base/luasrc/view/cbi/tblsection.htm4
-rw-r--r--modules/luci-base/luasrc/view/error404.htm2
-rw-r--r--modules/luci-base/luasrc/view/sysauth.htm2
5 files changed, 39 insertions, 33 deletions
diff --git a/modules/luci-base/luasrc/view/cbi/filebrowser.htm b/modules/luci-base/luasrc/view/cbi/filebrowser.htm
index a79beebba7..806b1b5f40 100644
--- a/modules/luci-base/luasrc/view/cbi/filebrowser.htm
+++ b/modules/luci-base/luasrc/view/cbi/filebrowser.htm
@@ -22,9 +22,9 @@
<script type="text/javascript">
function callback(path) {
if( window.opener ) {
- var input = window.opener.document.getElementById('<%=luci.http.formvalue('field')%>');
+ var input = window.opener.document.getElementById(decodeURIComponent('<%=luci.http.urlencode(luci.http.formvalue('field'))%>'));
if( input ) {
- input.value = path;
+ input.value = decodeURIComponent(path);
window.close();
}
}
@@ -48,33 +48,44 @@
end
end
- local filepath = table.concat( path, '/' )
- local filestat = nixio.fs.stat( filepath )
- local baseurl = luci.dispatcher.build_url('admin', 'filebrowser')
+ local filestat = nixio.fs.stat(table.concat(path, '/'))
+ local baseurl = { 'admin', 'filebrowser' }
if filestat and filestat.type == "reg" then
- table.remove( path, #path )
- filepath = table.concat( path, '/' ) .. '/'
- elseif not ( filestat and filestat.type == "dir" ) then
- path = { '' }
- filepath = '/'
+ path[#path] = ''
+ elseif not (filestat and filestat.type == "dir") then
+ path = { '', '' }
else
- filepath = filepath .. '/'
+ path[#path+1] = ''
end
- local entries = nixio.util.consume((nixio.fs.dir(filepath)))
+ filepath = table.concat(path, '/')
+
+ local entries = {}
+ local _, e
+ for _, e in luci.util.vspairs(nixio.util.consume((nixio.fs.dir(filepath)))) do
+ local p = filepath .. e
+ local s = nixio.fs.stat(p)
+ if s then
+ entries[#entries+1] = {
+ name = e,
+ path = p,
+ type = s.type
+ }
+ end
+ end
-%>
- <div id="path">
+ <div id="path">
Location:
<% for i, dir in ipairs(path) do %>
<% if i == 1 then %>
- <a href="<%=baseurl%>?field=<%=field%>">(root)</a>
+ <a href="<%=url(unpack(baseurl))%>?field=<%=luci.http.urlencode(field)%>">(root)</a>
<% elseif next(path, i) then %>
- <% baseurl = baseurl .. '/' .. dir %>
- / <a href="<%=baseurl%>?field=<%=field%>"><%=dir%></a>
+ <% baseurl[#baseurl+1] = luci.http.urlencode(dir) %>
+ / <a href="<%=url(unpack(baseurl))%>?field=<%=luci.http.urlencode(field)%>"><%=pcdata(dir)%></a>
<% else %>
- <% baseurl = baseurl .. '/' .. dir %>
- / <%=dir%>
+ <% baseurl[#baseurl+1] = luci.http.urlencode(dir) %>
+ / <%=pcdata(dir)%>
<% end %>
<% end %>
</div>
@@ -83,23 +94,17 @@
<div id="listing">
<ul>
- <% for _, e in luci.util.vspairs(entries) do
- local stat = nixio.fs.stat(filepath..e)
- if stat and stat.type == 'dir' then
- -%>
+ <% for _, e in ipairs(entries) do if e.type == 'dir' then -%>
<li class="dir">
<img src="<%=resource%>/cbi/folder.gif" alt="<%:Directory%>" />
- <a href="<%=baseurl%>/<%=e%>?field=<%=field%>"><%=e%>/</a>
+ <a href="<%=url(unpack(baseurl))%>/<%=luci.http.urlencode(e.name)%>?field=<%=luci.http.urlencode(field)%>"><%=pcdata(e.name)%>/</a>
</li>
<% end end -%>
- <% for _, e in luci.util.vspairs(entries) do
- local stat = nixio.fs.stat(filepath..e)
- if stat and stat.type ~= 'dir' then
- -%>
+ <% for _, e in ipairs(entries) do if e.type ~= 'dir' then -%>
<li class="file">
<img src="<%=resource%>/cbi/file.gif" alt="<%:File%>" />
- <a href="#" onclick="callback('<%=filepath..e%>')"><%=e%></a>
+ <a href="#" onclick="callback('<%=luci.http.urlencode(e.path)%>')"><%=pcdata(e.name)%></a>
</li>
<% end end -%>
</ul>
diff --git a/modules/luci-base/luasrc/view/cbi/simpleform.htm b/modules/luci-base/luasrc/view/cbi/simpleform.htm
index 78f5c5a544..3b758d70ee 100644
--- a/modules/luci-base/luasrc/view/cbi/simpleform.htm
+++ b/modules/luci-base/luasrc/view/cbi/simpleform.htm
@@ -52,7 +52,8 @@
<%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
" />
<% end %>
- <script type="text/javascript">cbi_d_update();</script>
</div>
</form>
<% end %>
+
+<script type="text/javascript">cbi_init();</script>
diff --git a/modules/luci-base/luasrc/view/cbi/tblsection.htm b/modules/luci-base/luasrc/view/cbi/tblsection.htm
index 26d13f9372..3cb87563f1 100644
--- a/modules/luci-base/luasrc/view/cbi/tblsection.htm
+++ b/modules/luci-base/luasrc/view/cbi/tblsection.htm
@@ -35,7 +35,7 @@ end
<%- else -%>
<th>&#160;</th>
<%- end -%>
- <%- end -%>
+ <%- count = count +1; end -%>
<%- for i, k in pairs(self.children) do if not k.optional then -%>
<th class="cbi-section-table-cell"<%=width(k)%>>
<%- if k.titleref then -%><a title="<%=self.titledesc or translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=k.titleref%>"><%- end -%>
@@ -44,7 +44,7 @@ end
</th>
<%- count = count + 1; end; end; if self.sortable then -%>
<th class="cbi-section-table-cell"><%:Sort%></th>
- <%- end; if self.extedit or self.addremove then -%>
+ <%- count = count + 1; end; if self.extedit or self.addremove then -%>
<th class="cbi-section-table-cell">&#160;</th>
<%- count = count + 1; end -%>
</tr>
diff --git a/modules/luci-base/luasrc/view/error404.htm b/modules/luci-base/luasrc/view/error404.htm
index bc74226830..a762f6038b 100644
--- a/modules/luci-base/luasrc/view/error404.htm
+++ b/modules/luci-base/luasrc/view/error404.htm
@@ -7,5 +7,5 @@
<%+header%>
<h2 name="content">404 <%:Not Found%></h2>
<p><%:Sorry, the object you requested was not found.%></p>
-<tt><%:Unable to dispatch%>: <%=luci.http.request.env.PATH_INFO%></tt>
+<tt><%:Unable to dispatch%>: <%=url(unpack(luci.dispatcher.context.request))%></tt>
<%+footer%>
diff --git a/modules/luci-base/luasrc/view/sysauth.htm b/modules/luci-base/luasrc/view/sysauth.htm
index f6b0f5706a..b3ec9b7617 100644
--- a/modules/luci-base/luasrc/view/sysauth.htm
+++ b/modules/luci-base/luasrc/view/sysauth.htm
@@ -6,7 +6,7 @@
<%+header%>
-<form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
+<form method="post" action="<%=pcdata(FULL_REQUEST_URI)%>">
<%- if fuser then %>
<div class="errorbox"><%:Invalid username and/or password! Please try again.%></div>
<% end -%>