diff options
author | Steven Barth <steven@midlink.org> | 2008-03-27 23:14:01 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-03-27 23:14:01 +0000 |
commit | 077db659bbcb7cee6bbc4c4dbaed9776261190a0 (patch) | |
tree | 0128ec76baf8112f2dd6538e0c5a9448cdf7d91a /src/ffluci/view | |
parent | 3f1064b91949741af53eb1d198e228f768abaea8 (diff) |
* Major CBI improvements
Diffstat (limited to 'src/ffluci/view')
-rw-r--r-- | src/ffluci/view/cbi/footer.htm | 1 | ||||
-rw-r--r-- | src/ffluci/view/cbi/fvalue.htm | 17 | ||||
-rw-r--r-- | src/ffluci/view/cbi/header.htm | 1 | ||||
-rw-r--r-- | src/ffluci/view/cbi/lvalue.htm | 13 | ||||
-rw-r--r-- | src/ffluci/view/cbi/mvalue.htm | 15 | ||||
-rw-r--r-- | src/ffluci/view/cbi/nsection.htm | 15 | ||||
-rw-r--r-- | src/ffluci/view/cbi/tsection.htm | 19 | ||||
-rw-r--r-- | src/ffluci/view/cbi/value.htm | 13 |
8 files changed, 55 insertions, 39 deletions
diff --git a/src/ffluci/view/cbi/footer.htm b/src/ffluci/view/cbi/footer.htm index d6e49678eb..0629bd6d60 100644 --- a/src/ffluci/view/cbi/footer.htm +++ b/src/ffluci/view/cbi/footer.htm @@ -1,4 +1,5 @@ <input type="submit" value="<%:save Speichern%>" /> <input type="reset" value="<%:reset Zurücksetzen%>" /> + <script type="text/javascript">cbi_d_init();</script> </form> <%+footer%>
\ No newline at end of file diff --git a/src/ffluci/view/cbi/fvalue.htm b/src/ffluci/view/cbi/fvalue.htm index 6cf9a8d87c..cce116af33 100644 --- a/src/ffluci/view/cbi/fvalue.htm +++ b/src/ffluci/view/cbi/fvalue.htm @@ -1,10 +1,11 @@ - <div class="cbi-value"> - <div class="left"> - <div class="cbi-value-title"><%=self.title%></div> - <div class="cbi-value-description"><%=self.description%></div> - </div> + <div class="cbi-value" id="cbi-<%=self.config.."-"..section.."-"..self.option%>"> + <div class="cbi-value-title left"><%=self.title%></div> <div class="cbi-value-field"> - <input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == self.enabled then %> checked="checked"<% end %> value="1" /> + <input onchange="cbi_d_update(this.id)" type="checkbox" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:cfgvalue(section) == self.enabled then %> checked="checked"<% end %> value="1" /> + <div class="cbi-value-description inline"><%=self.description%></div> </div> - <div class="clear"></div> - </div>
\ No newline at end of file + </div> + <% if #self.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %>
\ No newline at end of file diff --git a/src/ffluci/view/cbi/header.htm b/src/ffluci/view/cbi/header.htm index 2731b6c2f5..e926b20916 100644 --- a/src/ffluci/view/cbi/header.htm +++ b/src/ffluci/view/cbi/header.htm @@ -1,4 +1,5 @@ <%+header%> <form method="post" action="<%=os.getenv("REQUEST_URI")%>"> + <script type="text/javascript" src="<%=media%>/cbi.js"></script> <input type="hidden" name="cbi.submit" value="1" /> <input type="submit" value="<%:cbi_save Speichern%>" class="hidden" /> diff --git a/src/ffluci/view/cbi/lvalue.htm b/src/ffluci/view/cbi/lvalue.htm index f2a5ff9750..943a18886a 100644 --- a/src/ffluci/view/cbi/lvalue.htm +++ b/src/ffluci/view/cbi/lvalue.htm @@ -1,9 +1,8 @@ - <div class="cbi-value"> + <div class="cbi-value" id="cbi-<%=self.config.."-"..section.."-"..self.option%>"> <div class="cbi-value-title left"><%=self.title%></div> - <div class="cbi-value-description right"><%=self.description%></div> <div class="cbi-value-field"> <% if self.widget == "select" then %> - <select name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>> + <select onchange="cbi_d_update(this.id)" id="cbid.<%=self.config.."."..section.."."..self.option%>" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>> <%for i, key in pairs(self.keylist) do%> <option<% if self:cfgvalue(section) == key then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option> <% end %> @@ -16,6 +15,10 @@ <% if c == self.size then c = 0 %><br /> <% end end %> <% end %> + <div class="cbi-value-description inline"><%=self.description%></div> </div> - <div class="clear"></div> - </div>
\ No newline at end of file + </div> + <% if #self.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %>
\ No newline at end of file diff --git a/src/ffluci/view/cbi/mvalue.htm b/src/ffluci/view/cbi/mvalue.htm index de7bd0c61d..7becb4f48b 100644 --- a/src/ffluci/view/cbi/mvalue.htm +++ b/src/ffluci/view/cbi/mvalue.htm @@ -1,11 +1,8 @@ <% local v = self:valuelist(section) %> - <div class="cbi-value"> - <div class="left"> - <div class="cbi-value-title"><%=self.title%></div> - <div class="cbi-value-description"><%=self.description%></div> - </div> + <div class="cbi-value" id="cbi-<%=self.config.."-"..section.."-"..self.option%>"> + <div class="cbi-value-title left"><%=self.title%></div> <div class="cbi-value-field"> <% if self.widget == "select" then %> <select multiple="multiple" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if self.size then %> size="<%=self.size%>"<% end %>> @@ -21,6 +18,10 @@ local v = self:valuelist(section) <% if c == self.size then c = 0 %><br /> <% end end %> <% end %> + <div class="cbi-value-description inline"><%=self.description%></div> </div> - <div class="clear"></div> - </div>
\ No newline at end of file + </div> + <% if #self.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %>
\ No newline at end of file diff --git a/src/ffluci/view/cbi/nsection.htm b/src/ffluci/view/cbi/nsection.htm index 7615104ad7..c1f4c8bf3a 100644 --- a/src/ffluci/view/cbi/nsection.htm +++ b/src/ffluci/view/cbi/nsection.htm @@ -2,27 +2,30 @@ <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>"> <h2><%=self.title%></h2> <div class="cbi-section-descr"><%=self.description%></div> + <% if self.addremove then %><div class="cbi-section-remove"> + <input type="submit" name="cbi.rns.<%=self.config%>.<%=self.section%>" value="<%:cbi_del Eintrag entfernen%>" /> + </div><% end %> <fieldset class="cbi-section-node"> <% self:render_children(self.section) %> <% if #self.optionals[self.section] > 0 or self.dynamic then %> <div class="cbi-optionals"> + <input type="submit" value="<%:cbi_addopt Feld hinzufügen%>" /> <% if self.dynamic then %> <input type="text" name="cbi.opt.<%=self.config%>.<%=self.section%>" /> <% else %> <select name="cbi.opt.<%=self.config%>.<%=self.section%>"> <option><%:cbi_selopt *** Zusätzliche Parameter ***%></option> <% for key, val in pairs(self.optionals[self.section]) do %> - <option value="<%=val.option%>"><%=val.title%></option> + <option id="cbi-<%=self.config.."-"..self.section.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option> + <% if #val.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..self.section.."-"..val.option%>", "cbid.<%=self.config.."."..self.section.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %> <% end %> </select> <% end %> - <input type="submit" value="<%:cbi_addopt Feld hinzufügen%>" /> </div> <% end %> - <br /> - <% if self.addremove then %> - <input type="submit" name="cbi.rns.<%=self.config%>.<%=self.section%>" value="<%:cbi_del Eintrag entfernen%>" /> - <% end %> </fieldset> </div> <% elseif self.addremove then %> diff --git a/src/ffluci/view/cbi/tsection.htm b/src/ffluci/view/cbi/tsection.htm index 9205095313..15272f05f6 100644 --- a/src/ffluci/view/cbi/tsection.htm +++ b/src/ffluci/view/cbi/tsection.htm @@ -2,8 +2,11 @@ <h2><%=self.title%></h2> <div class="cbi-section-descr"><%=self.description%></div> <% for k, v in pairs(self:cfgsections()) do%> - <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=k%>"> + <% if self.addremove then %><div class="cbi-section-remove right"> + <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" /> + </div><% end %> <% if not self.anonymous then %><h3><%=k%></h3><% end %> + <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=k%>"> <% self:render_children(k) %> <% if #self.optionals[k] > 0 or self.dynamic then %> <div class="cbi-optionals"> @@ -11,19 +14,19 @@ <input type="text" name="cbi.opt.<%=self.config%>.<%=k%>" /> <% else %> <select name="cbi.opt.<%=self.config%>.<%=k%>"> - <option><%:cbi_selopt *** Zusätzliche Parameter ***%></option> + <option><%:cbi_addopt -- Feld --%></option> <% for key, val in pairs(self.optionals[k]) do %> - <option value="<%=val.option%>"><%=val.title%></option> + <option id="cbi-<%=self.config.."-"..k.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option> + <% if #val.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(val.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..k.."-"..val.option%>", "cbid.<%=self.config.."."..k.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %> <% end %> </select> <% end %> - <input type="submit" value="<%:cbi_addopt Feld hinzufügen%>" /> + <input type="submit" value="<%:add hinzufügen%>" /> </div> <% end %> - <br /> - <% if self.addremove then %> - <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" /> - <% end %> </fieldset> <br /> <% end %> diff --git a/src/ffluci/view/cbi/value.htm b/src/ffluci/view/cbi/value.htm index ae4cd0eb59..d027bb4489 100644 --- a/src/ffluci/view/cbi/value.htm +++ b/src/ffluci/view/cbi/value.htm @@ -1,9 +1,12 @@ - <div class="cbi-value"> + <div class="cbi-value clear" id="cbi-<%=self.config.."-"..section.."-"..self.option%>"> <div class="cbi-value-title left"><%=self.title%></div> - <div class="cbi-value-description right"><%=self.description%></div> <div class="cbi-value-field"> - <input type="text" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" /> + <input type="text" onchange="cbi_d_update(this.id)" <% if self.size then %>size="<%=self.size%>" <% end %><% if self.maxlength then %>maxlength="<%=self.maxlength%>" <% end %>name="cbid.<%=self.config.."."..section.."."..self.option%>" value="<%=(self:cfgvalue(section) or "")%>" /> + <div class="cbi-value-description inline"><%=self.description%></div> </div> - <div class="clear"></div> <% if self.tag_invalid[section] then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %> - </div>
\ No newline at end of file + </div> + <% if #self.deps > 0 then %><script type="text/javascript"> + <% for j, d in ipairs(self.deps) do %>cbi_d_add("cbi-<%=self.config.."-"..section.."-"..self.option%>", "cbid.<%=self.config.."."..section.."."..d.field%>", "<%=d.value%>"); + <% end %> + </script><% end %> |