summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/view/cbi
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-25 23:34:21 +0000
committerSteven Barth <steven@midlink.org>2008-03-25 23:34:21 +0000
commit5f9910566de7165f4bb0ee62bc3ace53c708a94e (patch)
treeda06cbacc22d9d74b1e160e6dcf19fe0f62fa432 /src/ffluci/view/cbi
parent9fa7e0e92ddae9ff68f50ad20bbdfc8a3c09135a (diff)
* Entering Version 0.2
* Completed CBI * Minor bugfixes and enhancements
Diffstat (limited to 'src/ffluci/view/cbi')
-rw-r--r--src/ffluci/view/cbi/fvalue.htm10
-rw-r--r--src/ffluci/view/cbi/header.htm1
-rw-r--r--src/ffluci/view/cbi/lvalue.htm26
-rw-r--r--src/ffluci/view/cbi/mvalue.htm26
-rw-r--r--src/ffluci/view/cbi/nsection.htm37
-rw-r--r--src/ffluci/view/cbi/tsection.htm28
-rw-r--r--src/ffluci/view/cbi/value.htm11
7 files changed, 117 insertions, 22 deletions
diff --git a/src/ffluci/view/cbi/fvalue.htm b/src/ffluci/view/cbi/fvalue.htm
new file mode 100644
index 0000000000..8c8a2dfba0
--- /dev/null
+++ b/src/ffluci/view/cbi/fvalue.htm
@@ -0,0 +1,10 @@
+ <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-field">
+ <input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:ucivalue(section) == self.enabled then %> checked="checked"<% end %> value="1" />
+ </div>
+ <div class="clear"></div>
+ </div> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/header.htm b/src/ffluci/view/cbi/header.htm
index b11ed3b708..2731b6c2f5 100644
--- a/src/ffluci/view/cbi/header.htm
+++ b/src/ffluci/view/cbi/header.htm
@@ -1,3 +1,4 @@
<%+header%>
<form method="post" action="<%=os.getenv("REQUEST_URI")%>">
+ <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 739d675c43..abe5080174 100644
--- a/src/ffluci/view/cbi/lvalue.htm
+++ b/src/ffluci/view/cbi/lvalue.htm
@@ -1,11 +1,23 @@
- <div class="cbi-lvalue">
- <div class="cbi-lvalue-title"><%=self.title%></div>
- <div class="cbi-lvalue-field">
- <select name="cbid.<%=self.config.."."..self.section.."."..self.option%>"<% if self.size then %> size="<%=self.size%>"<% end %>>
-<%for k, v in pairs(self.list) do%>
- <option<% if self:ucivalue() == k then %> selected="selected"<% end %> value="<%=k%>"><%=v%></option>
+ <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-field">
+<% if self.widget == "select" then %>
+ <select 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:ucivalue(section) == key then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
<% end %>
</select>
+<% elseif self.widget == "radio" then
+ local c = 0;
+ for i, key in pairs(self.keylist) do
+ c = c + 1%>
+ <%=self.vallist[i]%><input type="radio" name="cbid.<%=self.config.."."..section.."."..self.option%>"<% if self:ucivalue(section) == key then %> checked="checked"<% end %> value="<%=key%>" />
+<% if c == self.size then c = 0 %><br />
+<% end end %>
+<% end %>
</div>
- <div class="cbi-lvalue-description"><%=self.description%></div>
+ <div class="clear"></div>
</div> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/mvalue.htm b/src/ffluci/view/cbi/mvalue.htm
new file mode 100644
index 0000000000..de7bd0c61d
--- /dev/null
+++ b/src/ffluci/view/cbi/mvalue.htm
@@ -0,0 +1,26 @@
+<%
+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-field">
+<% if self.widget == "select" then %>
+ <select multiple="multiple" 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 ffluci.util.contains(v, key) then %> selected="selected"<% end %> value="<%=key%>"><%=self.vallist[i]%></option>
+<% end %>
+ </select>
+<% elseif self.widget == "checkbox" then
+ local c = 0;
+ for i, key in pairs(self.keylist) do
+ c = c + 1%>
+ <%=self.vallist[i]%><input type="checkbox" name="cbid.<%=self.config.."."..section.."."..self.option%>[]"<% if ffluci.util.contains(v, key) then %> checked="checked"<% end %> value="<%=key%>" />
+<% if c == self.size then c = 0 %><br />
+<% end end %>
+<% end %>
+ </div>
+ <div class="clear"></div>
+ </div> \ No newline at end of file
diff --git a/src/ffluci/view/cbi/nsection.htm b/src/ffluci/view/cbi/nsection.htm
index 84f893d2b8..80dcefc07c 100644
--- a/src/ffluci/view/cbi/nsection.htm
+++ b/src/ffluci/view/cbi/nsection.htm
@@ -1,7 +1,34 @@
- <div class="cbi-nsection" id="cbi-<%=self.config%>-<%=self.section%>">
+<% if self:ucivalue(self.section) then %>
+ <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
<h2><%=self.title%></h2>
- <div class="cbi-nsection-descr"><%=self.description%></div>
- <div class="cbi-nsection-options">
-<% self:render_children() %>
- </div>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <fieldset class="cbi-section-node">
+<% self:render_children(self.section) %>
+ <% if #self.optionals > 0 or self.dynamic then %>
+ <div class="cbi-optionals">
+ <% 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 Felder ***%></option>
+ <% for key, val in pairs(self.optionals) do %>
+ <option value="<%=val.option%>"><%=val.title%></option>
+ <% 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 %>
+ <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.section%>">
+ <h2><%=self.title%></h2>
+ <div class="cbi-section-descr"><%=self.description%></div>
+ <input type="submit" name="cbi.cns.<%=self.config%>.<%=self.section%>" value="<%:cbi_cns Eintrag anlegen%>" />
+ </div>
+<% end %>
diff --git a/src/ffluci/view/cbi/tsection.htm b/src/ffluci/view/cbi/tsection.htm
index 987449406e..26f8b198e8 100644
--- a/src/ffluci/view/cbi/tsection.htm
+++ b/src/ffluci/view/cbi/tsection.htm
@@ -1,10 +1,26 @@
- <div class="cbi-tsection" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
+ <div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
<h2><%=self.title%></h2>
- <div class="cbi-tsection-descr"><%=self.description%></div>
+ <div class="cbi-section-descr"><%=self.description%></div>
<% for k, v in pairs(self:ucisections()) do%>
- <fieldset class="cbi-tsection-node" id="cbi-<%=self.config%>-<%=k%>">
+ <fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=k%>">
<% if not self.anonymous then %><legend><%=k%></legend><% end %>
<% self:render_children(k) %>
+ <% if #self.optionals > 0 or self.dynamic then %>
+ <div class="cbi-optionals">
+ <% if self.dynamic then %>
+ <input type="text" name="cbi.opt.<%=self.config%>.<%=k%>" />
+ <% else %>
+ <select name="cbi.opt.<%=self.config%>.<%=k%>">
+ <option><%:cbi_selopt *** Zusätzliche Felder ***%></option>
+ <% for key, val in pairs(self.optionals) do %>
+ <option value="<%=val.option%>"><%=val.title%></option>
+ <% end %>
+ </select>
+ <% end %>
+ <input type="submit" value="<%:cbi_addopt Feld hinzufügen%>" />
+ </div>
+ <% end %>
+ <br />
<% if self.addremove then %>
<input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:cbi_del Eintrag entfernen%>" />
<% end %>
@@ -12,12 +28,12 @@
<br />
<% end %>
<% if self.addremove then %>
- <div class="cbi-tsection-create">
+ <div class="cbi-section-create">
<% if self.anonymous then %>
<input type="submit" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:cbi_add Eintrag hinzufügen%>" />
- <% else %><input type="text" class="cbi-tsection-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
+ <% else %><input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
<input type="submit" value="<%:cbi_add Eintrag hinzufügen%>" />
- <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültiger Wert%></div><% end %>
+ <% end %><% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültige Eingabe%></div><% end %>
</div>
<% end %>
</div>
diff --git a/src/ffluci/view/cbi/value.htm b/src/ffluci/view/cbi/value.htm
index bbb5f5f3b5..54ca720d90 100644
--- a/src/ffluci/view/cbi/value.htm
+++ b/src/ffluci/view/cbi/value.htm
@@ -1,8 +1,11 @@
<div class="cbi-value">
- <div class="cbi-value-title"><%=self.title%></div>
+ <div class="left">
+ <div class="cbi-value-title"><%=self.title%></div>
+ <div class="cbi-value-description"><%=self.description%></div>
+ </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.."."..self.section.."."..self.option%>" value="<%=(self:ucivalue() or "")%>" />
+ <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:ucivalue(section) or "")%>" />
</div>
- <div class="cbi-value-description"><%=self.description%></div>
- <% if self.err_invalid then %><div class="cbi-error"><%:cbi_invalid Fehler: Ungültiger Wert%></div><% end %>
+ <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