<%shared> # Variables declared in the shared section are visible in all of the # methods in this Mason component. # # Split the dhandler args into a year, month, and page numbers. A request # for /magazines/1989/01/01/ would make $year = 1990, $month = 01, and # $page = 01. These are validated in the validate method. We also store # the dhandler args in the @args array to simplify some checking later on. my @args = split m|/|, $m->dhandler_arg; my ($year, $month, $page) = @args; # $full_index is an index of all available issue years, months, and pages-- # see the build-full-index method for more information. $issue_info is # only populated if a month is requested and that month's magazine issue # has been OCRed. my $full_index = $m->comp('/comp/magazine-gallery.mas:build-full-index'); my $issue_info = $m->comp('/comp/magazine-gallery.mas:validate-request', full_index => $full_index, args => \@args, year => $year, month => $month, page => $page); <%init> # Apache will not set a content type for a dhandler under mod_perl. $r->content_type('text/html'); # If there were no dhandler args, show an index of all years. If there # was one dhandler arg, then a year was requested, so show an index of the # months in that year. If there were two dhandler args, both a year and # month were requested, so show an index of the pages of that month's # issue. If there were three dhandler args, a year, month, and page were # requested, so show that page. if (!scalar @args) { $m->comp('/comp/magazine-gallery.mas:index-all', full_index => $full_index); } elsif (scalar @args == 1) { $m->comp('/comp/magazine-gallery.mas:index-year', full_index => $full_index, year => $year); } elsif (scalar @args == 2) { $m->comp('/comp/magazine-gallery.mas:index-month', full_index => $full_index, year => $year, month => $month); } elsif (scalar @args == 3) { $m->comp('/comp/magazine-gallery.mas:page', full_index => $full_index, year => $year, month => $month, page => $page); } <%method page-head> <& '/comp/magazine-gallery.mas:page-head', args => \@args, year => $year, month => $month, page => $page, issue_info => $issue_info &> <%method navigation> <& '/comp/magazine-gallery.mas:navigation', full_index => $full_index, year => $year, month => $month &> <%attr> newsletter_name => 'MAGazine' content_root => '/var/www/memphisamigagroup.net/htdocs/magazines/' uri_root => '/magazines' comp_root => '/magazines' width => 770 height => 996 th_width => 110 th_height => 142