#!/usr/local/bin/perl
# edit_virt.cgi
# Display a form for editing some kind of per-directory options file

require './apache-lib.pl';
&ReadParse();
$access{'global'} || &error($text{'htaccess_ecannot'});
$access_types{$in{'type'}} || &error($text{'etype'});
&allowed_auth_file($in{'file'}) || &error($text{'htindex_ecannot'});
$hconf = &get_htaccess_config($in{'file'});
$d = $hconf->[$in{'idx'}];
$conf = $d->{'members'};
@dirs = &editable_directives($in{'type'}, 'directory');
&header($text{"type_$in{'type'}"}, "");
print "<center><font size=+2>",&text('htfile_header', &dir_name($d),
      "<tt>$in{'file'}</tt>"),"</font></center>\n";
print "<hr>\n";

print "<form method=post action=save_files.cgi>\n";
print "<input type=hidden name=type value=$in{'type'}>\n";
print "<input type=hidden name=file value=$in{'file'}>\n";
print "<input type=hidden name=idx value=$in{'idx'}>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>",&text('htfile_header2', $text{"type_$in{'type'}"},
	&dir_name($d)),"</b></td> </tr>\n";
print "<tr $cb> <td><table>\n";
&generate_inputs(\@dirs, $conf);
print "</table></td> </tr></table><br>\n";
print "<input type=submit value=\"$text{'save'}\"></form>\n";

print "<hr>\n";
&footer("htaccess_index.cgi?file=$in{'file'}", $text{'htindex_return'});


