luci/modules/luci-compat/luasrc/view/cbi/map.htm
Jo-Philipp Wich fd24221d9e luci-compat: apply permission constraints from dispatcher
Since template scopes aren't shared we cannot pass the writable state from
the map templates to the page footer.

Fixes: 
Fixes: ffd627f2a ("luci-compat: disable legacy cbi forms on insufficient ACLs")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-20 09:44:14 +02:00

44 lines
1.5 KiB
HTML

<%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
<div class="alert-message warning"><%=pcdata(msg)%></div>
<%- end end -%>
<% if readable then %>
<div class="cbi-map" id="cbi-<%=self.config%>"<%=ifattr(not writable, "style", "opacity:.6; pointer-events:none")%>>
<% if self.title and #self.title > 0 then %>
<h2 name="content"><%=self.title%></h2>
<% end %>
<% if self.description and #self.description > 0 then %>
<div class="cbi-map-descr"><%=self.description%></div>
<% end %>
<% if self.tabbed then %>
<div>
<% for i, section in ipairs(self.children) do
tab = section.section or section.sectiontype %>
<div class="cbi-tabcontainer"<%=
attr("id", "container.m-%s.%s" %{ self.config, tab }) ..
attr("data-tab", tab) ..
attr("data-tab-title", section.title or tab)
%>>
<% section:render() %>
</div>
<% end %>
</div>
<% if not self.save then -%>
<div class="cbi-section-error">
<% for _, section in ipairs(self.children) do %>
<% if section.error and section.error[section.section] then -%>
<ul><li>
<%:One or more invalid/required values on tab%>:&nbsp;<%=section.title or section.section or section.sectiontype%>
</li></ul>
<%- end %>
<% end %>
</div>
<%- end %>
<% else %>
<%- self:render_children() %>
<% end %>
</div>
<% else %>
<div class="alert-message warning"><%:Insufficient permissions to read UCI configuration.%></div>
<% end %>