### ### HotBar ### ### Produce a "hot button bar" in the current location. ### ### Call with: ### #call HotBar PAGELIST.FILE HOTBAR.FILE ### To represent a missing entry, pass in /dev/null. ### ### The PAGELIST.FILE is used to specify the order that pages ### are to be ordered in the document. ### ### The HOTBAR.FILE indicates which buttons to put on the ### hotbar. ### ### It might be nice to have images associated with buttons. ### ### Vertial Table Hotbar ### It generates rows for each hotbar item. sub VTableHotBar_local { local($args) = @_; local($prev, $next); local($basename, $fname, $hotbar, $item, $last, $name, @names); local($pagelist, $value, @values); # First find the previous and next information $prev = ""; $next = ""; ($pagelist, $hotbar) = split(/\s+/, $args); if ($pagelist eq "" || $hotbar eq "") { print "Usage: #call HotBar PAGELIST.FILE HOTBAR.FILE\n"; return; } #print "Before $pagelist $hotbar\n"; print OUT " \n " ; $pagelist = "$Directory/$pagelist" if ($pagelist !~ m#^/#); $hotbar = "$Directory/$hotbar" if ($hotbar !~ m#^/#); $pagelist = CanonFname($pagelist); $hotbar = CanonFname($hotbar); #print "After $pagelist $hotbar\n"; if (!open(PL, "<$pagelist")) { print "Cannot open pagelist $pagelist\n"; } else { # Find previous item $last = ""; while () { chomp; $last = $_; next if (/^#/); last if (/^$Symbols{'__HTMLFILE__'}$/); $prev = $_; } $prev = "" if ($last !~ /^$Symbols{'__HTMLFILE__'}$/); # Find the next item while () { chomp; next if (/^#/); $next = $_; last; } close PL; #print "Make $prev relative from $Symbols{'__HTMLFILE__'} "; $prev = RootRelative($Symbols{'__HTMLFILE__'}, $prev) if ($prev ne ""); #print "giving $prev.\n"; #print "Make $next relative from $Symbols{'__HTMLFILE__'} "; $next = RootRelative($Symbols{'__HTMLFILE__'}, $next) if ($next ne ""); #print "giving $next\n"; } # Find the pairs of URLs/description. if (!open(HB, "<$hotbar")) { print "Cannot open hotbar file $hotbar\n"; } else { while () { chomp; next if (/^#/ || /^\s*$/); s/^\s*//; ($name, $value) = split(/\s+/, Expand($_), 2); next if (!defined(!$value)); push(@names, $name); push(@values, $value); } close HB; } # OK. We've now got all the information we are going to get. # It's time to emit the code. # print OUT "
\n"; # print OUT "$Symbols{'__HR__'}\n"; print OUT "Previous\n" if ($prev ne ""); for ($item = 0; $item <= $#names; $item++) { $basename = $names[$item]; $basename =~ s/\.[^.]*$//; # if (($Symbols{'__FILE__'} =~ m#/$basename#) || # ($Symbols{'__FILE__'} =~ m#^$basename#)) # { # print OUT "[$values[$item]]\n"; # } # else { $basename = $names[$item]; $basename .= ".html" if ($basename !~ /\./); print OUT "$values[$item]\n"; } } print OUT "Next\n" if ($next ne ""); # print OUT "
\n"; # print OUT "$Symbols{'__HR__'}\n"; } return 1 ;