#!/usr/local/bin/perl
# index.cgi
# Display a list of exports

require './bsdexports-lib.pl';
&header("NFS Exports", "", undef, 1, 1);
print "<hr>\n";

@exp = &list_exports();
if (@exp) {
	print "<a href=edit_export.cgi>Add a new export</a> <br>\n";
	print "<table border width=100%>\n";
	print "<tr $tb> <td><b>Directories</b></td> ",
	      "<td><b>Clients</b></td> </tr>\n";
	foreach $e (@exp) {
		print "<tr $cb>\n";
		print "<td><a href=\"edit_export.cgi?index=$e->{'index'}\">",
			join(" ", @{$e->{'dirs'}}),"</a></td>\n";
		if ($e->{'network'}) {
			print "<td>$e->{'network'} / $e->{'mask'}</td>\n";
			}
		elsif (!$e->{'hosts'}) { print "<td>Everyone</td>\n"; }
		else { print "<td>",join("&nbsp;|&nbsp;",
					 @{$e->{'hosts'}}),"</td>\n"; }
		print "</tr>\n";
		}
	print "</table>\n";
	}
else {
	print "<b>No exports currently defined</b> <p>\n";
	}
print "<a href=edit_export.cgi>Add a new export</a> <p>\n";

print "<hr>\n";
print "<table width=100%> <tr>\n";
print "<td><form action=restart_mountd.cgi>\n";
print "<input type=submit value=\"Apply Changes\">\n";
print "</form></td>\n";
print "<td valign=top> Click this button to apply the current file exports\n";
print "configuration. This will make all the directories listed above\n";
print "available with the options specified.</td>\n";
print "</tr> <tr> </table>\n";

print "<hr>\n";
&footer("/", "index");

