Skip to content

Commit

Permalink
Applied mrtg-rrd.cgi-patch-addhead_pagetop_pagefoot_for_directories.d…
Browse files Browse the repository at this point in the history
…iff from 2009-04-09 from http://www.makkintosshu.com/development/#mrtg-rrdcgi-patch-addhead-bodytag-pagefoot-support-in-directory-listings, which modifies parse_directories() & print_dir() so that AddHead[_], PageTop[_], and

PageFoot[_] defaults work on directory listing pages.
  • Loading branch information
morgant committed Dec 10, 2015
1 parent 2bbeade commit 338ae34
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions mrtg-rrd.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,12 @@ sub try_read_config($)
read_mrtg_config($cfgfile, \%defaults, $cfgref, \$order);
}

parse_directories();

delete $targets{'^'};
delete $targets{_};
delete $targets{'$'};

parse_directories();

$config_time = time;
}

Expand Down Expand Up @@ -852,6 +852,8 @@ sub parse_directories {

# FIXME: the sort is expensive
for my $name (sort { $targets{$a}{order} <=> $targets{$b}{order} } keys %targets) {
next if $name =~ /^[\$\^_]$/;

my $dir = $targets{$name}{directory}
if defined $targets{$name}{directory};
$dir = '' unless defined $dir;
Expand All @@ -869,6 +871,9 @@ sub parse_directories {
$targets{$name}{config};
$directories{$prefix}{bodytag} =
$targets{$name}{bodytag};
$directories{$prefix}{addhead} = $targets{_}{addhead};
$directories{$prefix}{pagetop} = $targets{_}{pagetop};
$directories{$prefix}{pagefoot} = $targets{_}{pagefoot};
}
$prefix .= $component . '/';
}
Expand All @@ -877,6 +882,9 @@ sub parse_directories {
$targets{$name}{config};
$directories{$dir}{bodytag} =
$targets{$name}{bodytag};
$directories{$dir}{addhead} = $targets{_}{addhead};
$directories{$dir}{pagetop} = $targets{_}{pagetop};
$directories{$dir}{pagefoot} = $targets{_}{pagefoot};
}

push (@{$directories{$dir}{target}}, $name);
Expand All @@ -894,9 +902,12 @@ sub print_dir($) {
<HTML>
<HEAD>
<TITLE>MRTG: Directory $dir1</TITLE>
</HEAD>
EOF
print $directories{$dir}{bodytag};
print $directories{$dir}{addhead} if defined $directories{$dir}{addhead};

print "</HEAD>\n", $directories{$dir}{bodytag};

print $directories{$dir}{pagetop} if defined $directories{$dir}{pagetop};

my $subdirs_printed;
if (defined @{$directories{$dir}{subdir}}) {
Expand Down Expand Up @@ -938,6 +949,9 @@ EOF
}

print_banner($directories{$dir}{config});

print $directories{$dir}{pagefoot} if defined $directories{$dir}{pagefoot};

print "</BODY>\n</HTML>\n";
}

Expand Down

0 comments on commit 338ae34

Please sign in to comment.