luci-app-ddns: rollup to 2.3.0 to reflect changes on ddns-scripts
[project/luci.git] / applications / luci-app-ddns / luasrc / view / ddns / overview_status.htm
index 37c54be..b409ed0 100644 (file)
@@ -2,12 +2,6 @@
 <!-- ++ BEGIN ++ Dynamic DNS ++ overview_status.htm ++ -->
 <script type="text/javascript">//<![CDATA[
 
-       // variables to store version information
-       var luci_version
-       var luci_build
-       var ddns_version
-       var ddns_required
-
        // helper to extract section from objects id
        // cbi.ddns.SECTION._xyz
        function _id2section(id) {
        // screen objects
        // called by XHR.poll and onclick_startstop
        function _data2elements(data) {
-               // DDNS Service
-               // fill Version informations
-               luci_version  = data[0].luci_ver
-               luci_build    = data[0].luci_build
-               ddns_version  = data[0].script_ver
-               ddns_required = data[0].script_min
-
                // Service sections
                for( 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 + "._domainIP.two");   // Registered IP
+                       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
                                        break;
                        }
 
-                       // domain
-                       // (data[i].domain ignored here
+                       // lookup
+                       // (data[i].lookup ignored here
 
                        // registered IP
                        // rip.innerHTML = "Registered IP";
-                       if (data[i].domain == "_nodomain_")
+                       if (data[i].lookup == "_nolookup_")
                                rip.innerHTML = '';
                        else if (data[i].reg_ip == "_nodata_")
                                rip.innerHTML = '<em><%:No data%></em>';
                }
        }
 
-       // event handler for map.title link
-       function onclick_maptitle() {
-               var str = "<%:Version Information%>";
-               str += "\n\nluci-app-ddns:";
-               str += "\n\t<%:Version%>:\t" + luci_version;
-               str += "\n\t<%:Build%>:\t" + luci_build;
-               str += "\n\nddns-scripts <%:required%>:";
-               str += "\n\t<%:Version%>:\t" + ddns_required + " <%:or greater%>";
-               str += "\n\nddns-scripts <%:installed%>:";
-               str += "\n\t<%:Version%>:\t" + ddns_version;
-               str += "\n\n"
-               alert(str);
-       }
-
        // 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");           // objext defined below to make in-/visible
+               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
 
                // do start/stop
                var btnXHR = new XHR();
-               btnXHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "startstop")%>/' + section + '/' + cbx.checked, null,
+               btnXHR.post('<%=url([[admin]], [[services]], [[ddns]], [[startstop]])%>/' + section + '/' + cbx.checked, { token: '<%=token%>' },
                        function(x, data) {
-                               if (x.responseText == "_uncommited_") {
+                               if (x.responseText == "_uncommitted_") {
                                        // we need a trick to display Ampersand "&" in stead of "&#38;" or "&amp;"
                                        // after translation
                                        txt="<%:Please [Save & Apply] your changes first%>";
                                } else {
                                        // should have data because status changed
                                        // so update screen
-                                       if (data)
-                                               _data2elements(data);
+                                       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('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+       XHR.get('<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
                function(x, data) {
-                       _data2elements(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(15, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+       XHR.poll(5, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
                function(x, data) {
-                       _data2elements(data);
+                       if (data) { _data2elements(data); }
                }
        );