package navigation;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(print_navigation);

#------------------------------------------------------------------------------
# /var/config/www/cgi-bin/navigation.pm - displays the navigation pane
#
# Creation:     09.07.2005
# Last Update:  $Id$
#
# Copyright (c) 2004-2005  the eisfair webconf team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#------------------------------------------------------------------------------

use strict;
use CGI::Carp qw(fatalsToBrowser);
use menu;

# sub print_navigation($package, $file, $open) {{{
sub print_navigation
{
    my ($package, $file, $open) = @_;

    my $menu   = parse_menu($file, $package);
    my $menu2  = parse_menu($open, $package);
    my $params = $menu->[0];
    my $title  = $params->{"title"} || "eisfair setup";

    my $url;
    #print_head($title, $package, "class=\"index\"");
    print "<div id=\"navigation\">\n<ul>\n";

    shift @$menu;
    foreach (@$menu)
    {
        $url = make_menu_url($_);
        print "<li>$url</li>\n";

        if ($_->{"file"} eq $open)
        {
            print "<ul>\n";
            shift @$menu2;
            foreach (@$menu2)
            {
                $url = make_menu_url($_);
                print "<li>$url</li>\n";
            }
            print "</ul>\n";
        }
    }
    print "</ul></div>\n<div id=\"main\">\n";
}
#}}}

