libs/web: fix html output for complex datatypes containing apostrophes
[project/luci.git] / libs / web / luasrc / view / cbi / tsection.htm
index 0fa285c..087548b 100644 (file)
@@ -1,18 +1,3 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-
 <fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
        <% if self.title and #self.title > 0 then -%>
                <legend><%=self.title%></legend>
@@ -21,7 +6,7 @@ $Id$
        <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
                <% if self.addremove then -%>
                        <div class="cbi-section-remove right">
-                               <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:Delete%>" />
+                               <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" class="cbi-button" />
                        </div>
                <%- end %>
 
@@ -33,7 +18,7 @@ $Id$
 
                <%+cbi/tabmenu%>
 
-               <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
+               <fieldset class="cbi-section-node<% if self.tabs then %> cbi-section-node-tabbed<% end %>" id="cbi-<%=self.config%>-<%=section%>">
                        <%+cbi/ucisection%>
                </fieldset>
                <br />
@@ -47,11 +32,12 @@ $Id$
                <% if self.template_addremove then include(self.template_addremove) else -%>
                <div class="cbi-section-create">
                        <% if self.anonymous then -%>
-                               <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:Add%>" />
+                               <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
                        <%- else -%>
                                <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
-                               <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
-                               <input type="submit" class="cbi-button cbi-button-add" value="<%:Add%>" />
+                               <input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" />
+                               <script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');</script>
+                               <input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
                                <% if self.invalid_cts then -%>
                                        <br /><%:Invalid%></div>
                                <%- end %>