summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/luasrc/view
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2019-11-06 01:33:53 +0100
committerAnsuel Smith <ansuelsmth@gmail.com>2019-11-11 20:47:16 +0100
commit34fa5122f98af4ac635dfc26a64f6d2d3e4fafcb (patch)
tree39183ec3b008cd16a23e3fa0a6ab544602aa4408 /applications/luci-app-ddns/luasrc/view
parent0731f7e5e43f490c39e364e43988a59ee2be9576 (diff)
luci-app-ddns: convert to client side implementation
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'applications/luci-app-ddns/luasrc/view')
-rw-r--r--applications/luci-app-ddns/luasrc/view/admin_status/index/ddns.htm1
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/detail_logview.htm56
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm23
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/detail_value.htm9
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/global_value.htm33
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/overview_doubleline.htm10
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm16
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/overview_startstop.htm17
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm180
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/system_status.htm60
10 files changed, 0 insertions, 405 deletions
diff --git a/applications/luci-app-ddns/luasrc/view/admin_status/index/ddns.htm b/applications/luci-app-ddns/luasrc/view/admin_status/index/ddns.htm
deleted file mode 100644
index 9791065083..0000000000
--- a/applications/luci-app-ddns/luasrc/view/admin_status/index/ddns.htm
+++ /dev/null
@@ -1 +0,0 @@
-<%+ddns/system_status%>
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/detail_logview.htm b/applications/luci-app-ddns/luasrc/view/ddns/detail_logview.htm
deleted file mode 100644
index fd1d5be268..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/detail_logview.htm
+++ /dev/null
@@ -1,56 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ detail_logview.htm ++ -->
-<script type="text/javascript">//<![CDATA[
- function onclick_logview(section, bottom) {
- // get elements
- var txt = document.getElementById("cbid.ddns." + section + "._logview.txt"); // TextArea
- if ( !txt ) { return; } // security check
-
- XHR.get('<%=url([[admin]], [[services]], [[ddns]], [[logview]])%>/' + section, 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 ++ Dynamic DNS ++ detail_logview.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm b/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm
deleted file mode 100644
index b69d780ea9..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm
+++ /dev/null
@@ -1,23 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ detail_lvalue.htm ++ -->
-<!-- no value header to suppress next line -->
-&#160;
-<% if self.widget == "select" then %>
- <select class="cbi-input-select" onchange="cbi_d_update(this.id)"<%= attr("id", cbid) .. attr("name", cbid) .. ifattr(self.size, "size") %>>
- <% for i, key in pairs(self.keylist) do -%>
- <option id="cbi-<%=self.config.."-"..section.."-"..self.option.."-"..key%>"<%= attr("value", key) .. ifattr(tostring(self:cfgvalue(section) or self.default) == key, "selected", "selected") %>><%=striptags(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
-%>
- <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr((self:cfgvalue(section) or self.default) == key, "checked", "checked") %> />
- <label<%= attr("for", cbid..c) %>></label>
- <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label>
-<% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %>&#160;<% else %><br /><% end %>
-<% end end %>
-<% end %>
-<%+cbi/valuefooter%>
-<!-- ++ END ++ Dynamic DNS ++ detail_lvalue.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/detail_value.htm b/applications/luci-app-ddns/luasrc/view/ddns/detail_value.htm
deleted file mode 100644
index cbe76abc6e..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/detail_value.htm
+++ /dev/null
@@ -1,9 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ detail_value.htm ++ -->
-<%+cbi/valueheader%>
- <input type="text" class="cbi-input-text" style="width: 10em;" onchange="cbi_d_update(this.id)"<%=
- attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) ..
- ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder")
- %> />
-<!-- no value footer to suppress next line -->
-<!-- ++ END ++ Dynamic DNS ++ detail_value.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm b/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm
deleted file mode 100644
index 3cbb66b4bf..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm
+++ /dev/null
@@ -1,33 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ global_value.htm ++ -->
-<%+cbi/valueheader%>
-<script type="text/javascript">//<![CDATA[
- // event handler on changed date
- function onkeyup_date(value) {
- var obj = document.getElementById("cbid.ddns.global.ddns_dateformat.help");
- if ( !obj ) { return; } // security check
-
- if ( value == "" || value.length == 0 ) { value = "%F %R"; }
- var now = new Date();
- var txt = now.toLocaleFormat(value);
- // handle newline(%n) and tab(%t) needs to be converted to HTML
- txt = txt.replace(new RegExp('\r?\n','g'), '<br />');
- txt = txt.replace(new RegExp('\t','g'), '&nbsp;&nbsp;&nbsp;&nbsp;');
- obj.innerHTML = "<%:Current setting%>: <strong>" + txt + "<\/strong>";
- }
-//]]></script>
-
-<input type="text" class="cbi-input-text" onchange="cbi_d_update(this.id)" onkeyup="onkeyup_date(this.value)"
- <%=
- attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) ..
- ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder")
- %>
-/>
-<br />
-<div class="cbi-value-description">
- <span class="cbi-value-helpicon"><img src="<%=resource%>/cbi/help.gif" alt="<%:help%>" /></span><%=self.description%>
- <br /><%:Current setting%>: <strong><%=self.date_string%></strong>
-</div> <!-- div class="cbi-value-description" -->
-</div> <!-- div class="cbi-value-field" -->
-</div> <!-- div class="cbi-value cbi-value-last" -->
-<!-- ++ END ++ Dynamic DNS ++ global_value.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_doubleline.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_doubleline.htm
deleted file mode 100644
index 1d1b4be019..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/overview_doubleline.htm
+++ /dev/null
@@ -1,10 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ overview_doubleline.htm ++ -->
-<%+cbi/valueheader%>
-
-<span id="<%=cbid%>.one"><%=self:set_one(section)%></span>
-<br />
-<span id="<%=cbid%>.two"><%=self:set_two(section)%></span>
-
-<%+cbi/valuefooter%>
-<!-- ++ END ++ Dynamic DNS ++ overview_doubleline.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm
deleted file mode 100644
index 2efc125fcc..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm
+++ /dev/null
@@ -1,16 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ overview_enabled.htm ++ -->
-<%+cbi/valueheader%>
-
-<input type="hidden" value="1"<%=
- attr("name", "cbi.cbe." .. self.config .. "." .. section .. "." .. self.option)
-%> />
- <!-- modified to call own function -->
-<input class="cbi-input-checkbox" onclick="cbi_d_update(this.id)" onchange="onchange_enabled(this.id)" type="checkbox"<%=
- attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) ..
- ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked")
-%> />
-<label<%= attr("for", cbid)%>></label>
-
-<%+cbi/valuefooter%>
-<!-- ++ END ++ Dynamic DNS ++ overview_enabled.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_startstop.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_startstop.htm
deleted file mode 100644
index 327028cbea..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/overview_startstop.htm
+++ /dev/null
@@ -1,17 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ overview_startstop.htm ++ -->
-<%+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 functionality -->
- <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 ++ Dynamic DNS ++ overview_startstop.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm
deleted file mode 100644
index b6e89775c3..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm
+++ /dev/null
@@ -1,180 +0,0 @@
-
-<!-- ++ BEGIN ++ Dynamic DNS ++ overview_status.htm ++ -->
-<script type="text/javascript">//<![CDATA[
-
- // helper to extract section from objects id
- // cbi.ddns.SECTION._xyz
- function _id2section(id) {
- var x = id.split(".");
- return x[2];
- }
-
- // helper to move status data to the relevant
- // screen objects
- // called by XHR.poll and onclick_startstop
- function _data2elements(data) {
- // Service sections
- for( var i = 1; i < data.length; i++ )
- {
- var section = data[i].section // Section to handle
- var cbx = document.getElementById("cbid.ddns." + section + ".enabled"); // Enabled
- var btn = document.getElementById("cbid.ddns." + section + "._startstop"); // Start/Stop button
- var rip = document.getElementById("cbid.ddns." + section + "._lookupIP.two"); // Registered IP
- var lup = document.getElementById("cbid.ddns." + section + "._update.one"); // Last Update
- var nup = document.getElementById("cbid.ddns." + section + "._update.two"); // Next Update
- if ( !(cbx && btn && rip && lup && nup) ) { return; } // security check
-
- // process id
- if (data[i].pid > 0) {
- // stop always possible if process running
- btn.value = "PID: " + data[i].pid;
- btn.className = "cbi-button cbi-input-reset";
- } else {
- // default Start / enabled
- btn.value = "<%:Start%>";
- btn.className = "cbi-button cbi-input-apply";
- }
- btn.disabled = false; // button enabled
-
- // last update
- switch (data[i].datelast) {
- case "_empty_":
- lup.innerHTML = '<em><%:Unknown error%></em>' ;
- break;
- case "_never_":
- lup.innerHTML = '<em><%:Never%></em>' ;
- break;
- default:
- lup.innerHTML = data[i].datelast;
- break;
- }
-
- // next update
- switch (data[i].datenext) {
- case "_empty_":
- nup.innerHTML = '<em><%:Unknown error%></em>' ;
- break;
- case "_verify_":
- nup.innerHTML = '<em><%:Verify%></em>';
- break;
- case "_runonce_":
- case "_stopped_":
- case "_disabled_":
- if (cbx.checked && data[i].datenext == "_runonce_") {
- nup.innerHTML = '<em><%:Run once%></em>';
- } else if (cbx.checked) {
- nup.innerHTML = '<em><%:Stopped%></em>';
- } else {
- nup.innerHTML = '<em><%:Disabled%></em>';
- btn.value = '----------';
- btn.className = "cbi-button cbi-input-button"; // no image
- btn.disabled = true; // disabled
- }
- break;
- default:
- nup.innerHTML = data[i].datenext;
- break;
- }
-
- // lookup
- // (data[i].lookup ignored here
-
- // registered IP
- // rip.innerHTML = "Registered IP";
- if (data[i].lookup == "_nolookup_")
- rip.innerHTML = '';
- else if (data[i].reg_ip == "_nodata_")
- rip.innerHTML = '<em><%:No data%></em>';
- else
- rip.innerHTML = data[i].reg_ip;
-
- // monitored interfacce
- // data[i].iface ignored here
- }
- }
-
- // event handler for enabled checkbox
- function onchange_enabled(id) {
- // run original function in cbi.js
- // whatever is done there
- cbi_d_update(id);
-
- var section = _id2section(id);
- var cbx = document.getElementById("cbid.ddns." + section + ".enabled");
- var btn = document.getElementById("cbid.ddns." + section + "._startstop");
- if ( !(cbx && btn) ) { return; } // security check
-
- var pid_txt = btn.value;
- var pid_found = ( pid_txt.search("PID") >= 0 ) ? true : false;
-
- if (pid_found) {
- // btn.value = "PID: 0000";
- btn.className = "cbi-button cbi-button-reset";
- btn.disabled = false;
- } else if (cbx.checked) {
- btn.value = "<%:Start%>";
- btn.className = "cbi-button cbi-button-apply";
- btn.disabled = false;
- } else {
- btn.value = '----------';
- btn.className = "cbi-button cbi-input-button"; // no image
- btn.disabled = true; // disabled
- }
- }
-
- // event handler for start/stop button
- function onclick_startstop(id) {
- // extract section
- var section = _id2section(id);
- // get elements
- var cbx = document.getElementById("cbid.ddns." + section + ".enabled"); // Enabled
- var obj = document.getElementById("cbi-ddns-overview-status-legend"); // object defined below to make in-/visible
- if ( !(obj && cbx) ) { return; } // security check
-
- // make me visible
- obj.parentNode.style.display = "block";
-
- // do start/stop
- var btnXHR = new XHR();
- btnXHR.post('<%=url([[admin]], [[services]], [[ddns]], [[startstop]])%>/' + section + '/' + cbx.checked, { token: '<%=token%>' },
- function(x, data) {
- if (x.responseText == "_uncommitted_") {
- // we need a trick to display Ampersand "&" in stead of "&#38;" or "&amp;"
- // after translation
- var txt="<%:Please [Save & Apply] your changes first%>";
- alert( txt.replace(new RegExp("<%:&%>", "g"), "&") );
- } else {
- // should have data because status changed
- // so update screen
- if (data) { _data2elements(data); }
- }
- // make me invisible
- obj.parentNode.style.display = "none";
- }
- );
- }
-
- // force to immediate show status on page load (not waiting for XHR.poll)
- XHR.get('<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
- function(x, data) {
- if (data) { _data2elements(data); }
- }
- );
-
- // define only ONE XHR.poll in a page because if one is running it blocks the other one
- // optimum is to define on Map or Section Level from here you can reach all elements
- // we need update every 15 seconds only
- XHR.poll(-1, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
- function(x, data) {
- if (data) { _data2elements(data); }
- }
- );
-
-//]]></script>
-
-<fieldset class="cbi-section" style="display:none">
- <legend id="cbi-ddns-overview-status-legend"><%:Applying changes%></legend>
- <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
- <span id="cbi-ddns-overview-status-text"><%:Waiting for changes to be applied...%></span>
-</fieldset>
-<!-- ++ END ++ Dynamic DNS ++ overview_status.htm ++ -->
diff --git a/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
deleted file mode 100644
index 41799cd4da..0000000000
--- a/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm
+++ /dev/null
@@ -1,60 +0,0 @@
-<!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
-<script type="text/javascript">//<![CDATA[
-
- //start polling data every 30 second, this doesn't change so much
- XHR.poll(30, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
- function(x, data) {
- if (data) {
- var tbl = document.getElementById('ddns_status_table');
- // security check
- if ( !(tbl) ) { return; }
-
- var rows = [];
-
- // DDNS Service disabled
- if (data[0].enabled == 0) {
- var ddns_legend = document.getElementById('ddns_status_legend');
- ddns_legend.style.display='none';
- rows.push([
- '<strong><font color="red"><%:DDNS Autostart disabled%></font>',
- '<a class="cbi-button cbi-button-action important" type="button" href="' + data[0].url_up + '"><%:enable here%></a></strong>'
- ]);
- } else {
- for(var j = 1; j < data.length; j++ )
- {
-
- rows.push([
- '<strong>' + data[j].section + '</strong>', //configuration
- data[j].datenextstat ? '<em>'+data[j].datenextstat+'</em>' : '<em>'+data[j].datenext+'</em>',
- data[j].lookup ? data[j].lookup : '<em><%:config error%></em>',
- data[j].reg_ip ? data[j].reg_ip : '<em><%:No data%></em>',
- data[j].iface // monitored interface
- ]);
- }
- }
-
- cbi_update_table(tbl, rows, '<%:There is no service configured.%>');
- }
- }
- );
-
-//]]></script>
-
-<fieldset class="cbi-section" id="ddns_status_section">
- <legend><a href="<%=url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
- <div class="cbi-section-node">
- <div class="table" id="ddns_status_table">
- <div class="tr table-titles" id="ddns_status_legend">
- <div class="th"><%:Configuration%></div>
- <div class="th"><%:Next Update%></div>
- <div class="th"><%:Lookup Hostname%></div>
- <div class="th"><%:Registered IP%></div>
- <div class="th"><%:Network%></div>
- </div>
- <div class="tr">
- <div class="td"><em><br /><%:Collecting data...%></em></div>
- </div>
- </div>
- </div>
-</fieldset>
-<!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->