summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-privoxy/luasrc/view/privoxy
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-01-24 10:38:54 +0100
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-01-24 10:38:54 +0100
commit29f7cf16e56c269f45184677dfaa472499622fdb (patch)
treec947bf5cf0aa02e031ef77f22a3e1f4b6b32945e /applications/luci-app-privoxy/luasrc/view/privoxy
parent40066a6799ba04cbf23c7752de6e83103a33ccad (diff)
luci-app-privoxy: move from openwrt/packages to openwrt/luci
* move from openwrt/packages to openwrt/luci * adaption to new LuCI subdirectory structure * fix error handling * modified version handling * fixed translations Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'applications/luci-app-privoxy/luasrc/view/privoxy')
-rwxr-xr-xapplications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm56
-rw-r--r--applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm49
2 files changed, 105 insertions, 0 deletions
diff --git a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm
new file mode 100755
index 0000000000..3e190709fb
--- /dev/null
+++ b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm
@@ -0,0 +1,56 @@
+
+<!-- ++ BEGIN ++ Privoxy ++ detail_logview.htm ++ -->
+<script type="text/javascript">//<![CDATA[
+ function onclick_logview(section, bottom) {
+ // get elements
+ var txt = document.getElementById("cbid.privoxy.privoxy._logview.txt"); // TextArea
+ if ( !txt ) { return; } // security check
+ var lvXHR = new XHR();
+ lvXHR.get('<%=luci.dispatcher.build_url("admin", "services", "privoxy", "logview")%>', null,
+ function(x) {
+ if (x.responseText == "_nodata_")
+ txt.value = "<%:File not found or empty%>";
+ else
+ txt.value = x.responseText;
+ if (bottom)
+ txt.scrollTop = txt.scrollHeight;
+ else
+ txt.scrollTop = 0; }
+ );
+ }
+//]]></script>
+
+<%+cbi/valueheader%>
+
+<br />
+
+<%
+-- one button on top, one at the buttom
+%>
+<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, false)"
+<%=
+attr("name", section) .. attr("id", cbid .. ".btn1") .. attr("value", self.inputtitle)
+%> />
+
+<br /><br />
+
+<%
+-- set a readable style taken from openwrt theme for textarea#syslog
+-- in openwrt theme there are problems with a width of 100 so we check for theme and set to lower value
+%>
+<textarea style="width: <%if media == "/luci-static/openwrt.org" then%>98.7%<%else%>100%<%end%> ; min-height: 500px; border: 3px solid #cccccc; padding: 5px; font-family: monospace; resize: none;" wrap="off" readonly="readonly"
+<%=
+attr("name", cbid .. ".txt") .. attr("id", cbid .. ".txt") .. ifattr(self.rows, "rows")
+%> >
+<%-=pcdata(self:cfgvalue(section))-%>
+</textarea>
+<br /><br />
+
+<%
+-- one button on top, one at the buttom
+%>
+<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, true)"
+<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", self.inputtitle) %> />
+
+<%+cbi/valuefooter%>
+<!-- ++ END ++ Privoxy ++ detail_logview.htm ++ -->
diff --git a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm
new file mode 100644
index 0000000000..b9de8864e4
--- /dev/null
+++ b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_startstop.htm
@@ -0,0 +1,49 @@
+
+<!-- ++ BEGIN ++ Privoxy ++ detail_startstop.htm ++ -->
+<script type="text/javascript">//<![CDATA[
+
+ // show XHR.poll/XHR.get response on button
+ function _data2elements(x) {
+ var btn = document.getElementById("cbid.privoxy.privoxy._startstop");
+ if ( ! btn ) { return; } // security check
+ if (x.responseText == "0") {
+ btn.value = "<%:Start%>";
+ btn.className = "cbi-button cbi-button-apply";
+ btn.disabled = false;
+ } else {
+ btn.value = "PID: " + x.responseText;
+ btn.className = "cbi-button cbi-button-reset";
+ btn.disabled = false;
+ }
+ }
+
+ // event handler for start/stop button
+ function onclick_startstop(id) {
+ // do start/stop
+ var btnXHR = new XHR();
+ btnXHR.get('<%=luci.dispatcher.build_url("admin", "services", "privoxy", "startstop")%>', null,
+ function(x) { _data2elements(x); }
+ );
+ }
+
+ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "privoxy", "status")%>', null,
+ function(x, data) { _data2elements(x); }
+ );
+
+//]]></script>
+
+<%+cbi/valueheader%>
+
+<% if self:cfgvalue(section) ~= false then
+-- We need to garantie that function cfgvalue run first to set missing parameters
+%>
+ <!-- style="font-size: 100%;" needed for openwrt theme to fix font size -->
+ <!-- type="button" onclick="..." enable standard onclick functionalty -->
+ <input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="font-size: 100%;" type="button" onclick="onclick_startstop(this.id)"
+ <%=
+ attr("name", section) .. attr("id", cbid) .. attr("value", self.inputtitle) .. ifattr(self.disabled, "disabled")
+ %> />
+<% end %>
+
+<%+cbi/valuefooter%>
+<!-- ++ END ++ Privoxy ++ detail_startstop.htm ++ -->