1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update luci-base

This commit is contained in:
Ycarus 2018-05-09 15:20:50 +02:00
parent f7b2096fa2
commit b2999bb6b2
64 changed files with 2089 additions and 2008 deletions

View file

@ -2,6 +2,7 @@
<%+cbi/valueheader%>
<input class="cbi-input-text" type="text"<%= attr("value", v) .. attr("name", cbid) .. attr("id", cbid) %> />
<script type="text/javascript">
cbi_init()
cbi_browser_init('<%=cbid%>', '<%=resource%>', '<%=url('admin/filebrowser')%>'<%=self.default_path and ", '"..self.default_path.."'"%>);
</script>
<%+cbi/valuefooter%>

View file

@ -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>

View file

@ -1,6 +1,6 @@
<%- if pageaction then -%>
<div class="cbi-page-actions">
<% if redirect then %>
<% if redirect and not flow.hidebackbtn then %>
<div style="float:left">
<input class="cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" />
</div>

View file

@ -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>

View file

@ -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>

View file

@ -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%>

View file

@ -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 -%>