* The CSS definition has been removed from the config.pl file and
[BackupPC.git] / lib / BackupPC / CGI / Lib.pm
index 4bc7227..40950f8 100644 (file)
@@ -29,7 +29,7 @@
 #
 #========================================================================
 #
-# Version 2.1.0_CVS, released 3 Jul 2003.
+# Version 2.1.0beta0, released 20 Mar 2004.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -320,9 +320,10 @@ sub CheckPermission
         $Privileged ||= $Conf{CgiAdminUsers} eq "*";
     }
     $PrivAdmin = $Privileged;
+    return $Privileged if ( !defined($host) );
+
     $Privileged ||= $User eq $Hosts->{$host}{user};
     $Privileged ||= defined($Hosts->{$host}{moreUsers}{$User});
-
     return $Privileged;
 }
 
@@ -334,7 +335,7 @@ sub CheckPermission
 #
 sub GetUserHosts
 {
-    my($host, $getAll) = @_;
+    my($getAll) = @_;
     my @hosts;
 
     if ( $getAll && CheckPermission() ) {
@@ -387,7 +388,7 @@ sub ConfirmIPAddress
 
 sub Header
 {
-    my($title, $content) = @_;
+    my($title, $content, $noBrowse, $contentSub, $contentPost) = @_;
     my @adminLinks = (
         { link => "",                         name => $Lang->{Status},
                                               priv => 1},
@@ -414,7 +415,7 @@ sub Header
 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html><head>
 <title>$title</title>
-$Conf{CSSstylesheet}
+<link rel=stylesheet type="text/css" href="$Conf{CgiImageDirURL}/$Conf{CgiCSSFile}" title="CSSFile">
 $Conf{CgiHeaders}
 </head><body onLoad="document.getElementById('NavMenu').style.height=document.body.scrollHeight">
 <img src="$Conf{CgiImageDirURL}/logo.gif" hspace="5" vspace="7"><br>
@@ -430,7 +431,7 @@ EOF
        NavLink("?host=${EscURI($host)}",
                "$host $Lang->{Home}", " class=\"navbar\"");
        NavLink("?action=browse&host=${EscURI($host)}",
-               $Lang->{Browse}, " class=\"navbar\"");
+               $Lang->{Browse}, " class=\"navbar\"") if ( !$noBrowse );
        NavLink("?action=view&type=LOG&host=${EscURI($host)}",
                $Lang->{LOG_file}, " class=\"navbar\"");
        NavLink("?action=LOGlist&host=${EscURI($host)}",
@@ -449,25 +450,22 @@ EOF
            NavLink("?action=view&type=config&host=${EscURI($host)}",
                    $Lang->{Config_file}, " class=\"navbar\"");
        }
-       print <<EOF;
-</div>
-<div id="Content">
-$content
-<br><br><br>
-</div>
-<div class="NavMenu" style="height:100%" id="NavMenu">
-EOF
-    } else {
-        print <<EOF;
-<div id="Content">
-$content
+       print "</div>\n";
+    }
+    print("<div id=\"Content\">\n$content\n");
+    if ( defined($contentSub) && ref($contentSub) eq "CODE" ) {
+       while ( (my $s = &$contentSub()) ne "" ) {
+           print($s);
+       }
+    }
+    print($contentPost) if ( defined($contentPost) );
+    print <<EOF;
 <br><br><br>
 </div>
 <div class="NavMenu" id="NavMenu" style="height:100%">
 EOF
-    }
-    my $hostSelectbox = "<option value=\"#\">Select a host...</option>";
-    my @hosts = GetUserHosts($In{host}, $Conf{CgiNavBarAdminAllHosts});
+    my $hostSelectbox = "<option value=\"#\">$Lang->{Select_a_host}</option>";
+    my @hosts = GetUserHosts($Conf{CgiNavBarAdminAllHosts});
     if ( defined($Hosts) && %$Hosts > 0 && @hosts ) {
        NavSectionTitle($Lang->{Hosts});
         foreach my $host ( @hosts ) {