Project

General

Profile

« Previous | Next » 

Revision 6982850b

Added by Hamish Coleman over 17 years ago

  • ID 6982850beb81f60c55d09c8df0aaac5cf7409fe0

Add frameset based treemenu implementation

View differences:

mrtg.cgi
if ($style eq 'wide') {
$target="_self";
} else {
$target="list";
$target="basefrm";
}
print "\n<table border=2 cellpadding=2 cellspacing=0 style=\"margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse; font-size: 95%;\">\n";
......
print "</table>\n";
}
sub print_treemenu($) {
my ($lists) = @_;
print "USETEXTLINKS = 1\n";
print "STARTALLOPEN = 0\n";
print "ICONPATH = ''\n";
print 'foldersTree = gFld("<i>Treeview Demo</i>", "javascript:true")',"\n";
print 'foldersTree.treeID = "Frameset"',"\n";
# print contents
for my $i (sort keys %{$lists}) {
print "m$i = insFld(foldersTree, gFld(\"$i\", \"javascript:true\"))\n";
for my $j (sort keys %{$lists->{$i}}) {
print "insDoc(m$i, gLnk(\"R\", \"$j\", \"?page=list&list=$i,$j\"))\n";
}
}
}
sub print_list($$$) {
my ($lists,$graph,$list) = @_;
......
$ysize = $router->{ysize};
$xsize = $router->{xsize};
print a({-href=>$router->{name}.".html",-target=>"list"},
print a({-href=>$router->{name}.".html",-target=>"basefrm"},
img{
-src=>$router->{name}."-$graph.".$router->{imagetype},
-height=>"$ysize",
......
'(This List is ',param('list'),")\n";
}
my $page = param('page') || 'none';
my $page = param('page') || 'treeview';
my $this_host = hostname;
my @tests;
my $lists;
......
if($page eq 'frame') {
print "Content-type: text/html\n\n";
print "<html><head><title>$this_host MRTG Index (V$VERSION)</title></head>\n";
print '<frameset cols="200,*">'; # FIXME onresize if navigator.family==nn4
print '<frame src="?page=menu" name=menu>';
print '<frame src="?page=list&list=OTHER,OTHER" name=list>';
print '<frameset cols="200,*">';
print '<frame src="?page=menu" name=treeframe>';
print '<frame src="?page=list&list=OTHER,OTHER" name=basefrm>';
print "</frameset>\n";
print "</html>\n";
} elsif($page eq 'none') {
print header,
start_html(-TITLE=>"$this_host MRTG Index (V$VERSION)", -BGCOLOR=>'#e6e6e6'),
"\n";
@tests = init_tests(@config_files);
$lists = init_lists(@tests);
print table(
{-width=>"100\%"},
TR(td("Select which list to show"))
);
print_menu_table($lists,'wide');
print "\n","Direct questions and feedback to ",
a({-href=>"mailto:hamish\@zot.org"}, "Hamish"),
" (Version $VERSION)",
end_html;
} elsif($page eq 'treeview') {
print "Content-type: text/html\n\n";
print "<html><head><title>$this_host MRTG Index (V$VERSION)</title></head>\n";
print "<script>\n";
print "function op() { }\n";
print "</script>\n";
print '<frameset cols="200,*">'; # FIXME onresize if navigator.family==nn4
print '<frame src="?page=treemenu" name=treeframe>';
print '<frame src="javascript:true" name=basefrm>';
print "</frameset>\n";
print "</html>\n";
} elsif($page eq 'list') {
print header,
......
@tests = init_tests(@config_files);
$lists = init_lists(@tests);
print_menu_table($lists,'high');
print end_html;
} elsif($page eq 'treemenu') {
print header,
start_html(-TITLE=>"$this_host MRTG Index (V$VERSION)", -BGCOLOR=>'#e6e6e6'),
"\n";
@tests = init_tests(@config_files);
$lists = init_lists(@tests);
print '<script src="ua.js"></script>';
print '<script src="ftiens4.js"></script>';
print '<script>';
print_treemenu($lists);
print '</script>';
print '<DIV style="position:absolute; top:0; left:0;"><TABLE border=0><TR><TD><FONT size=-2><A style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank>Javascript Tree Menu</A></FONT></TD></TR></TABLE></DIV>';
print '<script>initializeDocument()</script>';
print '<NOSCRIPT>A tree for site navigation will open here if you enable JavaScript in your browser.</NOSCRIPT>';
print end_html;
} elsif($page eq 'noframe') {
print header,
......
print "</table>\n";
print end_html;
} elsif($page eq 'none') {
print header,
start_html(-TITLE=>"$this_host MRTG Index (V$VERSION)", -BGCOLOR=>'#e6e6e6'),
"\n";
@tests = init_tests(@config_files);
$lists = init_lists(@tests);
print table(
{-width=>"100\%"},
TR(td("Select which list to show"))
);
print_menu_table($lists,'wide');
print "\n","Direct questions and feedback to ",
a({-href=>"mailto:hamish\@zot.org"}, "Hamish"),
" (Version $VERSION)",
end_html;
}
if ($warnings) {

Also available in: Unified diff