package GimpSite;

require GimpSite::Navdata;
require GimpSite::Util;

# Configuration --------------------------------------------------------------

%GimpSite::Config = (
    basedir => '/gimp00/web-newgimp/docs/gimp',
    baseuri => '/gimp/',

    fontdir => '/gimp00/web-newgimp/stuff/ttf',              # TTF fonts
    gimp    => 'unix/tmp/gimp-perl-serv-uid-1043/gimp-perl-serv', # GIMP socket
    imgdir  => '/gimp00/web-newgimp/docs/aux/dynimg',    # image file dir
    imguri  => '/aux/dynimg',                             # ... in URI space

    navfile => '/gimp00/web-newgimp/stuff/perllib/GimpSite/Navdata.pm',
    tdir    => '/gimp00/web-newgimp/stuff/template/gimpsite',
    tcache  => '/gimp00/web-newgimp/stuff/template/gimpsite/cache.db',

    db      => {
        links   => ['dbi:Pg:dbname=gimpsite', '<user>', '<pass>']
    },

    default => {
        Title   => '',
        imgbase => '/aux/images',

        gen_text => sub {
            require GimpSite::Text;
            my ($page, $text) = @_;
            # my ($style, $text) = split /\//, $arg, 2;
            my ($uri, $w, $h) = &GimpSite::Text::Render ($text);
            return qq(<img src="$uri" alt="$text" width="$w" height="$h" border="0">);
        },

        gen_nav => sub { # generate nav from path
            my ($page, $path) = @_;

            $path =~ s/\/+/\//g;
            $path =~ s/^$GimpSite::Config{'baseuri'}//;
            $path =~ s/^\/*//;
            $path =~ s/\/*$//;

            my @pathparts = split /\//, $path;
            unshift @pathparts, '';

            return &GimpSite::Util::Navtree
	    		($page, $GimpSite::Navdata::Tree, 0, @pathparts);
        },
    },
);

1;

# EOF
