Merge pull request #2350 from TDT-AG/pr/20181204-luci-mod-system
[oweals/luci.git] / applications / luci-app-olsr-services / luasrc / view / freifunk-services / services.htm
index fbb39de8846be41745850376dae8cbbdf775e240..0aac36de87dc5ac18e44c7b289d0f442b3eb608f 100644 (file)
@@ -1,18 +1,10 @@
 <%#
-LuCI - Lua Configuration Interface
-
-Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
+ Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
+ Licensed to the public under the Apache License 2.0.
 -%>
 
 <%
-local fs  = require "luci.fs"
+local fs  = require "nixio.fs"
 local utl = require "luci.util"
 local last_update
 local i = 1
@@ -24,7 +16,7 @@ local uci = require "luci.model.uci".cursor()
 local ip = require "luci.ip"
 
 uci:foreach("olsrd", "LoadPlugin", function(s)
-       if s.library == "olsrd_nameservice.so.0.3" then
+       if s.library == "olsrd_nameservice" then
                local services_file=s.services_file
                if services_file and fs.access(services_file) then
                        has_services = true
@@ -101,9 +93,9 @@ if luci.http.formvalue("status") == "1" then
        local rv = {}
        for k, line in ipairs(services) do
                local field = utl.split(line, "[#|]", split, true)
-               local origin_lnk = ip.IPv6(pcdata(field[4])) or ""
+               local origin_lnk = ip.IPv6(pcdata(field[4]))
                local origin_link = ""
-               if #origin_lnk ~= 0 and origin_lnk:is6() then
+               if origin_lnk and origin_lnk:is6() then
                        origin_link = "["..origin_lnk:string().."]"
                else
                        origin_link = pcdata(field[4])
@@ -126,7 +118,6 @@ end
 
 <%+header%>
 
-<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
 <script type="text/javascript">//<![CDATA[
 
        XHR.poll(10 , '<%=REQUEST_URI%>', { status: 1 },
@@ -135,16 +126,21 @@ end
                var tbody = document.getElementById('olsr_services');
                        if (tbody)
                        {
-                               var s = '';
+                               var s = '<div class="tr cbi-section-table-titles">' +
+                               '<div class="th cbi-section-table-cell"><%:Url%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Protocol%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Source%></div>' +
+                               '</div>';
+
                                for (var idx = 0; idx < info.length; idx++)
                                {
                                var service = info[idx];
                                s += String.format(
-                                       '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
-                                               '<td class="cbi-section-table-titles"><a href="%s">%s</a></td>' +
-                                               '<td class="cbi-section-table-titles">%s</td>' +
-                                               '<td class="cbi-section-table-titles"><a href="http://%s/cgi-bin-status.html">%s</a></td>' +
-                                       '</tr>',
+                                       '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
+                                               '<div class="td cbi-section-table-cell left"><a href="%s">%s</a></div>' +
+                                               '<div class="td cbi-section-table-cell left">%s</div>' +
+                                               '<div class="td cbi-section-table-cell left"><a href="http://%s/cgi-bin-status.html">%s</a></div>' +
+                                       '</div>',
                                        service.url, service.descr, service.proto, service.origin_link, service.origin || '?'
                                        );
                                }
@@ -157,28 +153,25 @@ end
 
 
 
-       <h2><a id="content" name="content"><%:Services%></a></h2>
+       <h2 name="content"><%:Services%></h2>
 
        <fieldset class="cbi-section">
        <legend><%:Internal services%></legend>
-       <table class="cbi-section-table">
-               <thead>
-                       <tr class="cbi-section-table-titles">
-                               <th class="cbi-section-table-cell"><%:Url%></th>
-                               <th class="cbi-section-table-cell"><%:Protocol%></th>
-                               <th class="cbi-section-table-cell"><%:Source%></th>
-                       </tr>
-               </thead>
-
-               <tbody id="olsr_services">
+       <div class="table cbi-section-table" id="olsr_services">
+                       <div class="tr cbi-section-table-titles">
+                               <div class="th cbi-section-table-cell"><%:Url%></div>
+                               <div class="th cbi-section-table-cell"><%:Protocol%></div>
+                               <div class="th cbi-section-table-cell"><%:Source%></div>
+                       </div>
+
        <%
                for k, line in ipairs(services) do
                        local field = {}
                        -- split line at # and |, 1=url, 2=proto, 3=description, 4=source
                        local field = utl.split(line, "[#|]", split, true)
-                       local origin_lnk = ip.IPv6(pcdata(field[4])) or ""
+                       local origin_lnk = ip.IPv6(pcdata(field[4]))
                        local origin_link
-                       if #origin_lnk ~= 0 and origin_lnk:is6() then
+                       if origin_lnk and origin_lnk:is6() then
                                origin_link = "["..origin_lnk:string().."]"
                        else
                                origin_link = pcdata(field[4])
@@ -186,15 +179,14 @@ end
                        local url, proto, descr, origin = pcdata(field[1]), pcdata(field[2]), utl.trim(pcdata(field[3])), pcdata(field[4])
                        %>
 
-                       <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>">
-                               <td class="cbi-section-table-titles"><a href="<%=url%>"><%=descr%></a></td>
-                               <td class="cbi-section-table-titles"><%=proto%></td>
-                               <td class="cbi-section-table-titles"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></td>
-                       </tr>
+                       <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%>">
+                               <div class="td cbi-section-table-cell left"><a href="<%=url%>"><%=descr%></a></div>
+                               <div class="td cbi-section-table-cell left"><%=proto%></div>
+                               <div class="td cbi-section-table-cell left"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></div>
+                       </div>
                        <% i = ((i % 2) + 1)
                end %>
-               </tbody>
-       </table>
+       </div>
        <br />
        <%=last_update%>
        </fieldset>