--- tabea.cgi 2002/07/10 13:53:44 1.36
+++ tabea.cgi 2002/07/16 14:49:09 1.37
@@ -38,14 +38,6 @@
my $cfgfile = "./tabea.cfg";
-# establish my configuration
-my $MY = {};
-$MY->{PROGNAME} = ($0 =~ m|^.*?([^/]+?)(?:\.[^/.]+)?$|)[0];
-$MY->{TEMPLATE} = '';
-my $fh = new IO::File ("<".$MY->{PROGNAME}.".html") || die;
-$MY->{TEMPLATE} .= $_ while (<$fh>);
-$fh->close();
-
# establish CGI query object
my $cgi = new CGI;
@@ -82,6 +74,17 @@
# Read the configuration
my %cfghash = &read_config($cfgfile);
+# Get HTML Header
+
+my $MY = {};
+$MY->{TEMPLATE} = '';
+
+my $fh = new IO::File ("<".$cfghash{'BaseDir'} . $cfghash{'PageTemplate'}) || die;
+$MY->{TEMPLATE} .= $_ while (<$fh>);
+$fh->close();
+
+
+
# fetch parameters
my $dialog = $cgi->param("dialog") || "";
my $username = $cgi->param("username") || "";
@@ -92,6 +95,9 @@
my $new2_password = $cgi->param("new2_password") || "";
my $filename = $cgi->param("filename") || "";
+
+my $headertext = "";
+
my $form = '';
for my $name (qw(admin cfgedit changepwd changer chpwd confr copy copyc copyt del d2user d3user \
@@ -107,91 +113,117 @@
if ($form eq '') {
$page .= &login();
+ $headertext = "Login";
}
elsif ($form eq 'mainw') {
$page .= mainw();
+ $headertext = "Main";
}
elsif ($form eq 'edit') {
$page .= &edit($cgi->param('configslist'));
+ $headertext = "Edit";
}
elsif ($form eq 'save') {
$page .= &save($cgi->param('editfile'), $cgi->param('editwindow'));
+ $headertext = "Save";
}
elsif ($form eq 'view') {
$page .= &view($cgi->param('templatelist'));
+ $headertext = "View";
}
elsif ($form eq 'new') {
$page .= &new($cfghash{'BaseDir'} . $cfghash{'ConfigDir'}, $username);
+ $headertext = "New File";
}
elsif ($form eq 'newf') {
$page .= &newfile($cfghash{'BaseDir'} . $cfghash{'ConfigDir'},
$username, $cgi->param('newfile'), $cgi->param('new_rights'));
+ $headertext = "New File";
}
elsif ($form eq 'confr') {
$page .= &config_rights($cgi->param('configslist'));
+ $headertext = "Config Rights";
}
elsif ($form eq 'changer') {
$page .= &change_rights($cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/"
. $cgi->param('filename'), $cgi->param('changerights') );
+ $headertext = "Config Rights";
}
elsif ($form eq 'copyt') {
$page .= ©_file($cgi->param('templatelist') );
+ $headertext = "Copy File";
}
elsif ($form eq 'copyc') {
$page .= ©_file($cgi->param('configslist'));
+ $headertext = "Copy File";
}
elsif ($form eq 'copy' ) {
$page .= ©($cgi->param('srcfile'), $cfghash{'BaseDir'} . $cfghash{'ConfigDir'} . "/" .
$username . "/". $cgi->param('dstfile'));
+ $headertext = "Copy File";
}
elsif ($form eq 'del' ) {
$page .= &del($cgi->param('configslist'));
+ $headertext = "Delete File";
}
elsif ($form eq 'run' ) {
$page .= &run($cgi->param('configslist') );
+ $headertext = "Run";
}
elsif ($form eq 'admin' ) {
if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) {
$page .= &admin($cgi->param('username') );
+ $headertext = "Administration";
} else {
$page .= &chpwd($cgi->param('username') );
+ $headertext = "Change Password";
}
}
elsif ($form eq 'chpwd' ) {
if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) {
$page .= &chpwd($cgi->param('akt_user') );
+ $headertext = "Change Password";
} else {
$page .= &chpwd($cgi->param('username') );
+ $headertext = "Change Password";
}
}
elsif ($form eq 'changepwd' ) {
if ( $cgi->param('username') eq $cfghash{'TabeaUser'}) {
$page .= &changepwd($cgi->param('akt_user') );
+ $headertext = "Change Password";
} else {
$page .= &changepwd($cgi->param('username') );
+ $headertext = "Change Password";
}
}
elsif ($form eq 'nuser' ) {
$page .= &nuser();
+ $headertext = "New User";
}
elsif ($form eq 'newuser' ) {
$page .= &newuser($cgi->param('akt_user'));
+ $headertext = "New User";
}
elsif ($form eq 'duser' ) {
- $page .= &duser($akt_user);
+ $page .= &duser($akt_user);
+ $headertext = "Delete User";
}
elsif ($form eq 'd2user' ) {
- $page .= &d2user($akt_user);
+ $page .= &d2user($akt_user);
+ $headertext = "Delete New User";
}
elsif ($form eq 'd3user' ) {
- $page .= &d3user($akt_user);
+ $page .= &d3user($akt_user);
+ $headertext = "Delete New User";
}
elsif ($form eq 'cfgedit' ) {
- $page .= &cfgedit();
+ $page .= &cfgedit();
+ $headertext = "Edit Configuration";
}
elsif ($form eq 'logout' ) {
$cgi->param(-name => 'username', -value => "");
@@ -213,7 +245,11 @@
my $out = $MY->{TEMPLATE};
$out =~ s|%%BODY%%|$page|s;
-$out =~ s|%%TITLE%%|Test|s;
+
+if ( ! $headertext ) {
+ $headertext .= $cfghash{'StdHeader'};
+}
+$out =~ s|%%TITLE%%|$headertext|s;
print STDOUT $cgi->header(-cookie => $cookies, -expires => '+1s') . $out;
@@ -836,8 +872,7 @@
$text .= "<font size=+2>" .
"Running Configuration: $rpath<br><br>\n" .
"</font>" .
- "<br><br>" .
- "Run command: " . $rcommand . "<br>";
+ "<br><br>" ;
system("$rcommand > $output 2>&1");
&logging("Running command $rcommand");
|