mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-28 03:01:54 +08:00
62 lines
2.4 KiB
HTML
62 lines
2.4 KiB
HTML
<% if self:cfgvalue(self.section) then section = self.section; cfgs = self:cfgvalue(self.section)%>
|
|
<fieldset class="cbi-section">
|
|
<% if self.title and #self.title > 0 then -%>
|
|
<legend><%=self.title%></legend>
|
|
<%- end %>
|
|
<div class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
|
|
<% local isempty = true for i, val in ipairs(cfgs) do -%>
|
|
<% local cfg = luci.util.split(val, "|")[1]; local src = luci.util.split(val, "|")[2] -%>
|
|
<div class="cbi-value<% if i > #cfgs then -%> cbi-value-last<%- end%>" id="cbi-<%=cfg.."-source-urls"%>" data-index="<%=i%>" data-depends="[]">
|
|
<label class="cbi-value-title"<%= attr("for", "source") %>>
|
|
<a title="<%=translate('Go to relevant configuration page')%>" class="cbi-title-ref" href="<%=self.extedit % cfg%>">
|
|
<%-='%d) %s' % {i, cfg}-%>
|
|
</a>
|
|
</label>
|
|
<div class="cbi-value-field">
|
|
<%
|
|
write('Source: <a href="%s">%s</a>' % {src, src})
|
|
%>
|
|
</div>
|
|
</div>
|
|
<% isempty = false -%>
|
|
<%- end %>
|
|
<br />
|
|
<% if isempty then i = 1 -%>
|
|
<em><%:One or more requred configure is missing!%><br /><br /></em>
|
|
<%- end %>
|
|
<% if self.description and #self.description > 0 then -%>
|
|
<div class="cbi-section-descr"><%=self.description%></div>
|
|
<%- end %>
|
|
<div class="cbi-section-create">
|
|
<input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.new.source" name="cbi.cts.<%=self.config%>.new.source" data-type="uciname" data-optional="true" />
|
|
<input type="submit" class="cbi-button cbi-button-add" onclick="window.location.href='<%=self.extedit%>'.format(document.getElementById('cbi.cts.<%=self.config%>.new.source').value); return false" value="<%:Add%>/<%:Edit%><%:Resolvers%>" />
|
|
<% if self.invalid_cts then -%>
|
|
<br /><%:Invalid%></div>
|
|
<%- end %>
|
|
</div>
|
|
<br />
|
|
<% self:render_children(section, scope or {}) %>
|
|
</div>
|
|
<br />
|
|
<% if self.error and self.error[1] then -%>
|
|
<div class="cbi-section-error">
|
|
<ul><% for _, e in ipairs(self.error[1]) do -%>
|
|
<li>
|
|
<%- if e == "invalid" then -%>
|
|
<%:One or more configure contain invalid values!%>
|
|
<%- elseif e == "missing" then -%>
|
|
<%:One or more required configure is missing!%>
|
|
<%- else -%>
|
|
<%=pcdata(e)%>
|
|
<%- end -%>
|
|
</li>
|
|
<%- end %></ul>
|
|
</div>
|
|
<%- end %>
|
|
<% if message then %>
|
|
<div class="alert-message"><%=message%></div>
|
|
<% end %>
|
|
<br />
|
|
</fieldset>
|
|
<% end %>
|