require("luamods/command")
require("luamods/layout")
require("luamods/cgi")
require("config/network_conf")

header = layout.getHeader()
footer = layout.getFooter()

html = header..[[
                    <div id="info">
                        <div style="background:url(images/network.png); background-size:32px; background-repeat:no-repeat; background-position: 20px center;">
                            <center><h1>Network - Status</h1></center>
                        </div>
                    </div>

                    <h3>IP address info : </h3>
                    <pre class="formLayoutfull">
                    <!-- ifconfig start -->
]]..command.ex( network_conf.ip_info )..[[
                    <!-- ifconfig end -->
                    </pre>

                    <h3>Routing tables info: </h3>
                    <pre class="formLayoutfull">
                    <!-- routing start -->
]]..command.ex( network_conf.route_info )..[[
                    <!-- routing end -->
                    </pre>

                    <h3>Network Profiles: </h3>
                    <pre class="formLayoutfull">
                    <!-- interfaces start -->
]]..command.ex("netctl list")..[[
                    <!-- interfaces end -->
                    </pre>

                    <h3>DNS config: </h3>
                    <pre class="formLayoutfull">
                    <!-- dns start -->
]]..command.ex("cat "..network_conf.dns_config )..[[
                    <!-- dns end -->
                    </pre>

                    <h3>Port forward config: </h3>
                    <pre class="formLayoutfull">
                    <!-- port forward start -->
]]..command.ex("cat "..network_conf.portforward_config)..[[
                    <!-- port forward end -->
                    </pre>

                    <h3>DHCPD config: </h3>
                    <pre class="formLayoutfull">
                    <!-- dhcpd conf start -->
]]..command.ex("cat "..network_conf.dhcpd_conf)..[[
                    <!-- dhcpd conf end -->
                    </pre>
]]..footer

print( html )
