<%# Opennet Firmware Copyright 2010 Rene Ejury Copyright 2017 Martin Garbe 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 -%> <%+header%>

<%:Opennet ID%>

<%+cbi/apply_xhr%> <% local new_opennet_id = luci.http.formvalue("new_opennet_id") local show_invalid_id_warning = false if (new_opennet_id) then function split_numbers(str) local t = { } str:gsub("%d+", function (w) table.insert(t, tonumber(w)) end) return t end local numbers = split_numbers(new_opennet_id) local major local minor local replace_id = true if #numbers == 1 then -- nur eine Zahl: Netzgruppe "1" major = 1 minor = numbers[1] elseif #numbers == 2 then -- zwei Zahlen: beide verwenden major = numbers[1] minor = numbers[2] elseif #numbers == 4 then -- vier Zahlen (192.168.x.y): die letzten beiden verwenden major = numbers[3] minor = numbers[4] else replace_id = false end if replace_id then if (0 <= major) and (major <= 255) and (1 <= minor) and (minor <= 255) then local id_string = major .. "." .. minor on_function("set_opennet_id", {id_string}) luci.sys.call("sleep 3") else show_invalid_id_warning = true end end end %>

<%:Opennet-ID / Network ID%>

<% if show_invalid_id_warning then %>

<%:The specified opennet ID is invalid. Please try again (input format: 'X.YYY').%>

<% end %>

<%=luci.i18n.translatef('Great that you decided to take part in Opennet. Register the IP of your Access-Point in the %sOpennet-Wiki%s and acquire a free IP-Address. Please read the information %sin the wiki%s for further details.', '', '', '', '')%>

<%:Please enter your Opennet-ID (1.X, 2.X or 3.X etc.) or the IP-Address of your first Opennet-Network-Interface, any change will reconfigure your network settings immediately.%>

<%:Mesh Interface Addresses%>

<% for net_name, net in pairs(mesh_interfaces) do %> <% end %>

<%=net_name%> (<%:device%> <%=net.ifname%>)

<%=net.ipaddr%> / <%=net.netmask%>
<%+footer%>