treewide: adapt to new luci.xml class
In the previous commit the luci.xml module was created, Let's change all references to the old functions to the new xml-module. Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
This commit is contained in:
parent
68521fca04
commit
354e4cb4a7
5 changed files with 16 additions and 14 deletions
|
@ -84,7 +84,7 @@
|
||||||
<select id="instance_template" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.select">
|
<select id="instance_template" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.select">
|
||||||
<option value="" selected="selected" disabled="disabled"><%:Select template ...%></option>
|
<option value="" selected="selected" disabled="disabled"><%:Select template ...%></option>
|
||||||
<%- for k, v in luci.util.kspairs(self.add_select_options) do %>
|
<%- for k, v in luci.util.kspairs(self.add_select_options) do %>
|
||||||
<option value="<%=k%>"><%=luci.util.pcdata(v)%></option>
|
<option value="<%=k%>"><%=luci.xml.pcdata(v)%></option>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -35,8 +35,8 @@ if luci.http.formvalue("frame") == "1" then
|
||||||
if not data then
|
if not data then
|
||||||
luci.http.write(translate("Failed to retrieve statistics from url:"))
|
luci.http.write(translate("Failed to retrieve statistics from url:"))
|
||||||
luci.http.write(" http://%s:%s" %{
|
luci.http.write(" http://%s:%s" %{
|
||||||
luci.util.pcdata(addr),
|
luci.xml.pcdata(addr),
|
||||||
luci.util.pcdata(port)
|
luci.xml.pcdata(port)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
<%-
|
<%-
|
||||||
local sys = require("luci.sys")
|
local sys = require("luci.sys")
|
||||||
local utl = require("luci.util")
|
local utl = require("luci.util")
|
||||||
|
local xml = require("luci.xml")
|
||||||
local dev = luci.http.formvalue("device")
|
local dev = luci.http.formvalue("device")
|
||||||
local ifn = utl.trim(sys.exec("/bin/ubus -S call network.wireless status 2>/dev/null | jsonfilter -l1 -e '@." .. dev .. ".interfaces[@.config.mode=\"sta\"].ifname' 2>/dev/null"))
|
local ifn = utl.trim(sys.exec("/bin/ubus -S call network.wireless status 2>/dev/null | jsonfilter -l1 -e '@." .. dev .. ".interfaces[@.config.mode=\"sta\"].ifname' 2>/dev/null"))
|
||||||
local iw
|
local iw
|
||||||
|
@ -47,10 +48,10 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
<%- for i, net in ipairs(iw.scanlist or { }) do -%>
|
<%- for i, net in ipairs(iw.scanlist or { }) do -%>
|
||||||
<div class="tr cbi-section-table-row cbi-rowstyle-1">
|
<div class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||||
<div class="td left" style="text-align: left !important">
|
<div class="td left" style="text-align: left !important">
|
||||||
<%=net.ssid and utl.pcdata(net.ssid) or "<em>%s</em>" % translate("hidden")%>
|
<%=net.ssid and xml.pcdata(net.ssid) or "<em>%s</em>" % translate("hidden")%>
|
||||||
</div>
|
</div>
|
||||||
<div class="td left" style="text-align: left !important">
|
<div class="td left" style="text-align: left !important">
|
||||||
<%=net.bssid and utl.pcdata(net.bssid)%>
|
<%=net.bssid and xml.pcdata(net.bssid)%>
|
||||||
</div>
|
</div>
|
||||||
<div class="td left" style="text-align: left !important">
|
<div class="td left" style="text-align: left !important">
|
||||||
<%=net.encryption.description%>
|
<%=net.encryption.description%>
|
||||||
|
@ -61,9 +62,9 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
<div class="td cbi-section-actions">
|
<div class="td cbi-section-actions">
|
||||||
<form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/wifiadd')%>" method="post">
|
<form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/wifiadd')%>" method="post">
|
||||||
<input type="hidden" name="token" value="<%=token%>"/>
|
<input type="hidden" name="token" value="<%=token%>"/>
|
||||||
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>"/>
|
<input type="hidden" name="device" value="<%=xml.pcdata(dev)%>"/>
|
||||||
<input type="hidden" name="ssid" value="<%=utl.pcdata(net.ssid)%>"/>
|
<input type="hidden" name="ssid" value="<%=xml.pcdata(net.ssid)%>"/>
|
||||||
<input type="hidden" name="bssid" value="<%=utl.pcdata(net.bssid)%>"/>
|
<input type="hidden" name="bssid" value="<%=xml.pcdata(net.bssid)%>"/>
|
||||||
<input type="hidden" name="description" value="<%=net.encryption.description%>"/>
|
<input type="hidden" name="description" value="<%=net.encryption.description%>"/>
|
||||||
<input type="hidden" name="wep" value="<%=net.encryption.wep and 1 or 0%>"/>
|
<input type="hidden" name="wep" value="<%=net.encryption.wep and 1 or 0%>"/>
|
||||||
<%- if net.encryption.wpa then -%>
|
<%- if net.encryption.wpa then -%>
|
||||||
|
@ -85,7 +86,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
</form>
|
</form>
|
||||||
<form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/wifiscan')%>" method="post">
|
<form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/wifiscan')%>" method="post">
|
||||||
<input type="hidden" name="token" value="<%=token%>"/>
|
<input type="hidden" name="token" value="<%=token%>"/>
|
||||||
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>"/>
|
<input type="hidden" name="device" value="<%=xml.pcdata(dev)%>"/>
|
||||||
<input class="cbi-button cbi-input-find" type="submit" value="<%:Repeat scan%>"/>
|
<input class="cbi-button cbi-input-find" type="submit" value="<%:Repeat scan%>"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local util = require "luci.util"
|
local util = require "luci.util"
|
||||||
|
local xml = require "luci.xml"
|
||||||
local http = require "luci.http"
|
local http = require "luci.http"
|
||||||
local nixio = require "nixio", require "nixio.util"
|
local nixio = require "nixio", require "nixio.util"
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ local function tree_to_json(node, json)
|
||||||
if type(node.nodes) == "table" then
|
if type(node.nodes) == "table" then
|
||||||
for subname, subnode in pairs(node.nodes) do
|
for subname, subnode in pairs(node.nodes) do
|
||||||
local spec = {
|
local spec = {
|
||||||
title = util.striptags(subnode.title),
|
title = xml.striptags(subnode.title),
|
||||||
order = subnode.order
|
order = subnode.order
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +742,7 @@ local function init_template_engine(ctx)
|
||||||
(scope and type(scope[key]) ~= "function" and scope[key]) or "")
|
(scope and type(scope[key]) ~= "function" and scope[key]) or "")
|
||||||
|
|
||||||
if noescape ~= true then
|
if noescape ~= true then
|
||||||
val = util.pcdata(val)
|
val = xml.pcdata(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
return string.format(' %s="%s"', tostring(key), val)
|
return string.format(' %s="%s"', tostring(key), val)
|
||||||
|
@ -756,8 +757,8 @@ local function init_template_engine(ctx)
|
||||||
translate = i18n.translate;
|
translate = i18n.translate;
|
||||||
translatef = i18n.translatef;
|
translatef = i18n.translatef;
|
||||||
export = function(k, v) if tpl.context.viewns[k] == nil then tpl.context.viewns[k] = v end end;
|
export = function(k, v) if tpl.context.viewns[k] == nil then tpl.context.viewns[k] = v end end;
|
||||||
striptags = util.striptags;
|
striptags = xml.striptags;
|
||||||
pcdata = util.pcdata;
|
pcdata = xml.pcdata;
|
||||||
media = media;
|
media = media;
|
||||||
theme = fs.basename(media);
|
theme = fs.basename(media);
|
||||||
resource = luci.config.main.resourcebase;
|
resource = luci.config.main.resourcebase;
|
||||||
|
|
|
@ -68,7 +68,7 @@ else
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
files[#files+1] = "<li>"
|
files[#files+1] = "<li>"
|
||||||
files[#files+1] = luci.util.pcdata(ln)
|
files[#files+1] = luci.xml.pcdata(ln)
|
||||||
files[#files+1] = "</li>"
|
files[#files+1] = "</li>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue