treewide: always include cbi.js
[project/luci.git] / applications / luci-app-olsr / luasrc / view / status-olsr / overview.htm
index 727b476d03f5be69ba0f79ff6b754082587cc110..f205edc16dbfed77ad54875b885c48635eace2e6 100644 (file)
@@ -1,18 +1,14 @@
 <%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-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 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
+ Licensed to the public under the Apache License 2.0.
 -%>
 
 <%
-local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4")
+
+has_ipv4_conf = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion")
+has_ipv6_conf = luci.model.uci.cursor():get_first("olsrd6", "olsrd", "IpVersion")
 
 function write_conf(conf, file)
        local fs = require "nixio.fs"
@@ -25,23 +21,23 @@ end
 
 conf = luci.http.formvalue()
 
-if conf.openwrt then
+if conf.openwrt_v4 then
        write_conf("/etc/config/olsrd", "olsrd")
        return false
 end
 
-if conf.conf_v4 then   
-       write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4")
+if conf.openwrt_v6 then
+       write_conf("/etc/config/olsrd6", "olsrd6")
        return false
 end
 
-if conf.conf_v6 then
-       write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6")
+if conf.conf_v4 then
+       write_conf("/var/etc/olsrd.conf", "olsrd.conf")
        return false
 end
 
-if conf.conf then
-       write_conf("/var/etc/olsrd.conf", "olsrd.conf")
+if conf.conf_v6 then
+       write_conf("/var/etc/olsrd6.conf", "olsrd6.conf")
        return false
 end
 
@@ -49,7 +45,6 @@ end
 
 <%+header%>
 
-<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
 <script type="text/javascript">//<![CDATA[
 
 XHR.poll(10, '<%=REQUEST_URI%>/json', { },
@@ -159,62 +154,67 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { },
 
 <div id="error" class="error"></div>
 
-<h2><a id="content" name="content">OLSR <%:Overview%></a></h2>
+<h2 name="content">OLSR <%:Overview%></h2>
 
 <fieldset class="cbi-section">
         <legend><%:Network%></legend>
 
-        <table width="100%" cellspacing="10">
-                <tr><td width="33%"><%:Interfaces%></td><td>
+        <div class="table" width="100%" cellspacing="10">
+                <div class="tr"><div class="td" width="33%"><%:Interfaces%></div><div class="td">
                        <a href="<%=REQUEST_URI%>/interfaces">
                                <span id="nr_ifaces">-<span>
                        </a>
-               </td></tr>
-                <tr><td width="33%"><%:Neighbors%></td><td>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:Neighbors%></div><div class="td">
                        <a href="<%=REQUEST_URI%>/neighbors">
                                <span id="nr_neigh">-</span>
                        </a>
-               </td></tr>
-                <tr><td width="33%"><%:Nodes%></td><td>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:Nodes%></div><div class="td">
                        <a href="<%=REQUEST_URI%>/topology">
                                <span id="nr_nodes">-</span>
                        </a>
-               </td></tr>
-                <tr><td width="33%"><%:HNA%></td><td>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:HNA%></div><div class="td">
                        <a href="<%=REQUEST_URI%>/hna">
                                <span id="nr_hna">-</span>
                        </a>
-               </td></tr>
-                <tr><td width="33%"><%:Links total%></td><td>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:Links total%></div><div class="td">
                        <a href="<%=REQUEST_URI%>/topology">
                                <span id="nr_topo">-</span>
                        </a>
-               </td></tr>
-                <tr><td width="33%"><%:Links per node (average)%></td><td>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:Links per node (average)%></div><div class="td">
                        <span id="meshfactor">-</span>
-               </td></tr>
+               </div></div>
 
 
-        </table>
+        </div>
 </fieldset>
 
 
 <fieldset class="cbi-section">
         <legend>OLSR <%:Configuration%></legend>
-        <table width="100%" cellspacing="10">
-                <tr><td width="33%"><%:Version%></td><td>
+        <div class="table" width="100%" cellspacing="10">
+                <div class="tr"><div class="td" width="33%"><%:Version%></div><div class="td">
                        <span id="version">-<span>
-               </td></tr>
-                <tr><td width="33%"><%:Download Config%></td><td>
-                               <a href="<%=REQUEST_URI%>?openwrt">OpenWrt</a>,
-                               <% if ipv == "6and4" then %>
-                                       <a href="<%=REQUEST_URI%>?conf_v4">OLSRD IPv4</a>,
-                                       <a href="<%=REQUEST_URI%>?conf_v6">OLSRD IPv6</a>
-                               <% else %>
-                                       <a href="<%=REQUEST_URI%>?conf">OLSRD</a>
-                               <% end %>
-               </td></tr>
-       </table>
+               </div></div>
+                <div class="tr"><div class="td" width="33%"><%:Download Config%></div><div class="td">
+                       <% if has_ipv4_conf then %>
+                           <a href="<%=REQUEST_URI%>?openwrt_v4">OpenWrt (IPv4)</a>,
+                       <% end %>
+                       <% if has_ipv6_conf then %>
+                           <a href="<%=REQUEST_URI%>?openwrt_v6">OpenWrt (IPv6)</a>,
+                       <% end %>
+                       <% if has_ipv4_conf then %>
+                           <a href="<%=REQUEST_URI%>?conf_v4">OLSRD (IPv4)</a>,
+                       <% end %>
+                       <% if has_ipv6_conf then %>
+                           <a href="<%=REQUEST_URI%>?conf_v6">OLSRD (IPv6)</a>
+                       <% end %>
+               </div></div>
+       </div>
 </fieldset>
 
 <%+footer%>