Annotation of loncom/auth/londatecheck.pm, revision 1.1
1.1 ! albertel 1: use strict;
! 2: package Apache::londatecheck;
! 3: use Apache::lonnet();
! 4: use Apache::Constants qw(:common :http :methods);
! 5:
! 6: sub content_date_check {
! 7: my $symb=$ENV{'request.symb'};
! 8: my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb);
! 9: &Apache::lonnet::logthis("Hrrm got an open of $open");
! 10: my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb);
! 11: if ( (defined($open) && time < $open) ||
! 12: (defined($close) && time > $close)) {
! 13: return ('CLOSED',$open,$close);
! 14: }
! 15: return ('OPEN',$open,$close);
! 16: }
! 17:
! 18: sub handler {
! 19: my ($r)=@_;
! 20: my ($status)=&content_date_check();
! 21: if ($status ne 'OPEN') {
! 22: $r->set_handlers('PerlHandler'=>undef);
! 23: &Apache::loncommon::content_type($r,'text/html');
! 24: $r->send_http_header;
! 25: return OK if $r->header_only;
! 26: $r->print('<html><head><title>Go Away!</title>');
! 27: my $addentries=' onLoad="'.&Apache::lonmenu::loadevents().
! 28: '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
! 29: $r->print(&Apache::lonmenu::registerurl(1));
! 30: $r->print('</head>'.
! 31: &Apache::loncommon::bodytag('Go Away!','',$addentries,'','',
! 32: undef));
! 33: $r->print('</body></html>');
! 34: $r->print("Go Away!");
! 35: }
! 36: return OK;
! 37: }
! 38: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>