summaryrefslogtreecommitdiffhomepage
path: root/libs/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-08-13 17:14:25 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-08-13 17:14:25 +0000
commit892ed55ba08d3d5553e621e57d69a3eb8ffa4efc (patch)
tree0a2bf5a1a62005675d64d990f0064194be9972ee /libs/cbi
parent6b1be858be3f462d0e81a3fc6c3483041115c046 (diff)
libs/cbi: attach pcdata() to template scope and use it
Diffstat (limited to 'libs/cbi')
-rw-r--r--libs/cbi/luasrc/cbi.lua1
-rw-r--r--libs/cbi/luasrc/view/cbi/dvalue.htm4
-rw-r--r--libs/cbi/luasrc/view/cbi/dynlist.htm2
-rw-r--r--libs/cbi/luasrc/view/cbi/map.htm2
-rw-r--r--libs/cbi/luasrc/view/cbi/tblsection.htm2
-rw-r--r--libs/cbi/luasrc/view/cbi/tvalue.htm2
-rw-r--r--libs/cbi/luasrc/view/cbi/ucisection.htm4
7 files changed, 9 insertions, 8 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index 83f5c27e7..044993a6a 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -1340,6 +1340,7 @@ function AbstractValue.render(self, s, scope)
scope.section = s
scope.cbid = self:cbid(s)
scope.striptags = luci.util.striptags
+ scope.pcdata = luci.util.pcdata
scope.ifattr = function(cond,key,val)
if cond then
diff --git a/libs/cbi/luasrc/view/cbi/dvalue.htm b/libs/cbi/luasrc/view/cbi/dvalue.htm
index 28cd9ab94..819860a06 100644
--- a/libs/cbi/luasrc/view/cbi/dvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/dvalue.htm
@@ -15,8 +15,8 @@ $Id$
<%+cbi/valueheader%>
<% if self.href then %><a href="<%=self.href%>"><% end -%>
- <%=luci.util.pcdata(self:cfgvalue(section))%>
+ <%=pcdata(self:cfgvalue(section))%>
<%- if self.href then %></a><%end%>
&#160;
-<input type="hidden" id="<%=cbid%>" value="<%=luci.util.pcdata(self:cfgvalue(section))%>" />
+<input type="hidden" id="<%=cbid%>" value="<%=pcdata(self:cfgvalue(section))%>" />
<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/dynlist.htm b/libs/cbi/luasrc/view/cbi/dynlist.htm
index 1f3b90141..cbde2efb3 100644
--- a/libs/cbi/luasrc/view/cbi/dynlist.htm
+++ b/libs/cbi/luasrc/view/cbi/dynlist.htm
@@ -18,7 +18,7 @@ $Id$
for i=1, #vals + 1 do
local val = vals[i]
%>
- <input class="cbi-input-text" value="<%=luci.util.pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> />
+ <input class="cbi-input-text" value="<%=pcdata(val)%>" onchange="cbi_d_update(this.id)" type="text"<%= attr("id", cbid .. "." .. i) .. attr("name", cbid) .. ifattr(self.size, "size")%> />
<% if i <= #vals then %>
<input class="cbi-input-image" type="image" value="<%:cbi_del%>" name="cbi.rle.<%=section .. "." .. self.option .. "." .. i%>" alt="<%:cbi_del%>" title="<%:cbi_del%>" src="<%=resource%>/cbi/remove.gif" />
<% else %>
diff --git a/libs/cbi/luasrc/view/cbi/map.htm b/libs/cbi/luasrc/view/cbi/map.htm
index 949edea5c..0b5ac5881 100644
--- a/libs/cbi/luasrc/view/cbi/map.htm
+++ b/libs/cbi/luasrc/view/cbi/map.htm
@@ -24,7 +24,7 @@ $Id$
self._apply = nil
local line = fp:read()
while line do
- write("<li>" .. luci.util.pcdata(line) .. "</li>\n")
+ write("<li>" .. pcdata(line) .. "</li>\n")
line = fp:read()
end
fp:close()
diff --git a/libs/cbi/luasrc/view/cbi/tblsection.htm b/libs/cbi/luasrc/view/cbi/tblsection.htm
index 029ad661c..99b5b97b5 100644
--- a/libs/cbi/luasrc/view/cbi/tblsection.htm
+++ b/libs/cbi/luasrc/view/cbi/tblsection.htm
@@ -109,7 +109,7 @@ end
<% if self.error then %>
<div class="cbi-section-error">
<ul><% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%>
- <li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li>
+ <li><%=pcdata(e):gsub("\n","<br />")%></li>
<%- end end %></ul>
</div>
<% end %>
diff --git a/libs/cbi/luasrc/view/cbi/tvalue.htm b/libs/cbi/luasrc/view/cbi/tvalue.htm
index 36782d82d..b628c5c52 100644
--- a/libs/cbi/luasrc/view/cbi/tvalue.htm
+++ b/libs/cbi/luasrc/view/cbi/tvalue.htm
@@ -14,6 +14,6 @@ $Id$
-%>
<%+cbi/valueheader%>
<textarea class="cbi-input-textarea" <% if not self.size then %> style="width: 100%"<% else %> cols="<%=self.size%>"<% end %> onchange="cbi_d_update(this.id)"<%= attr("name", cbid) .. attr("id", cbid) .. ifattr(self.rows, "rows") .. ifattr(self.wrap, "wrap") %>>
- <%-=luci.util.pcdata(self:cfgvalue(section))-%>
+ <%-=pcdata(self:cfgvalue(section))-%>
</textarea>
<%+cbi/valuefooter%>
diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm
index 7e8467cfc..241681f26 100644
--- a/libs/cbi/luasrc/view/cbi/ucisection.htm
+++ b/libs/cbi/luasrc/view/cbi/ucisection.htm
@@ -17,7 +17,7 @@ $Id$
if type(self.hidden) == "table" then
for k, v in pairs(self.hidden) do
-%>
- <input type="hidden" id="cbid.<%=self.config%>.<%=section%>.<%=k%>" name="cbid.<%=self.config%>.<%=section%>.<%=k%>" value="<%=luci.util.pcdata(v)%>" />
+ <input type="hidden" id="cbid.<%=self.config%>.<%=section%>.<%=k%>" name="cbid.<%=self.config%>.<%=section%>.<%=k%>" value="<%=pcdata(v)%>" />
<%-
end
end
@@ -27,7 +27,7 @@ $Id$
<% if self.error and self.error[section] then -%>
<div class="cbi-section-error">
- <ul><% for _, e in ipairs(self.error[section]) do %><li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li><% end %></ul>
+ <ul><% for _, e in ipairs(self.error[section]) do %><li><%=pcdata(e):gsub("\n","<br />")%></li><% end %></ul>
</div>
<%- end %>