use strict;
package Apache::londatecheck;
use Apache::lonnet();
use Apache::Constants qw(:common :http :methods);
sub content_date_check {
my $symb=$ENV{'request.symb'};
my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb);
&Apache::lonnet::logthis("Hrrm got an open of $open");
my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);
if ( (defined($open) && time < $open) ||
(defined($close) && time > $close)) {
return ('CLOSED',$open,$close);
}
return ('OPEN',$open,$close);
}
sub handler {
my ($r)=@_;
my ($status)=&content_date_check();
if ($status ne 'OPEN') {
$r->set_handlers('PerlHandler'=>undef);
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
$r->print('<html><head><title>Go Away!</title>');
my $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
'" onUnload="'.&Apache::lonmenu::unloadevents().'"';
$r->print(&Apache::lonmenu::registerurl(1));
$r->print('</head>'.
&Apache::loncommon::bodytag('Go Away!','',$addentries,'','',
undef));
$r->print('</body></html>');
$r->print("Go Away!");
}
return OK;
}
1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>