# The LearningOnline Network with CAPA # Page Handler # # (TeX Content Handler # # 05/29/00,05/30 Gerd Kortemeyer) # 08/30 Gerd Kortemeyer package Apache::lonpage; use strict; use Apache::Constants qw(:common :http); use Apache::lonnet(); use GDBM_File; # ================================================================ Main Handler sub handler { my $r=shift; # ----------------------------------------------------------- Set document type if ($ENV{'browser.mathml'}) { $r->content_type('text/xml'); } else { $r->content_type('text/html'); } $r->send_http_header; return OK if $r->header_only; my $requrl=$r->uri; # ----------------------------------------------------------------- Tie db file if ($ENV{'request.course.fn'}) { my $fn=$ENV{'request.course.fn'}; if (-e "$fn.db") { my %hash; if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT,0640)) { # ------------------------------------------------------------------- Hash tied my $firstres=$hash{'map_start_'.$requrl}; my $lastres=$hash{'map_finish_'.$requrl}; if (($firstres) && ($lastres)) { # ----------------------------------------------------------------- Render page $r->print("

All is cool.

"); # ------------------------------------------------------------- End render page } else { $r->print("

Page undefined.

"); } # ------------------------------------------------------------------ Untie hash unless (untie(%hash)) { &Apache::lonnet::logthis("WARNING: ". "Could not untie coursemap $fn (browse)."); } # -------------------------------------------------------------------- All done return OK; # ----------------------------------------------- Errors, hash could no be tied } } } $ENV{'user.error.msg'}="$requrl:bre:1:1:Course not initialized"; return HTTP_NOT_ACCEPTABLE; } 1; __END__