version 1.10, 2005/04/25 21:40:33
|
version 1.14, 2017/12/22 02:00:53
|
Line 28 use strict;
|
Line 28 use strict;
|
package Apache::londatecheck; |
package Apache::londatecheck; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::loncommon(); |
use Apache::Constants qw(:common :http :methods); |
use Apache::Constants qw(:common :http :methods); |
|
|
sub content_date_check { |
sub content_date_check { |
Line 36 sub content_date_check {
|
Line 37 sub content_date_check {
|
my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb); |
my $close=&Apache::lonnet::EXT('resource.0.contentclose',$symb); |
if ( (defined($open) && $open ne '' && time < $open) ) { |
if ( (defined($open) && $open ne '' && time < $open) ) { |
return ('CLOSED',$open,$close, |
return ('CLOSED',$open,$close, |
'<h1>'.&mt('Not open to be viewed').'</h1>'. |
'<p class="LC_warning">'.&mt('Not open to be viewed').'</p>'. |
&mt("This resource currently isn't open. ". |
&mt("This resource currently isn't open. ". |
"It will be available at [_1].", |
"It will be available at [_1].", |
&Apache::lonlocal::locallocaltime($open))); |
&Apache::lonlocal::locallocaltime($open))); |
} |
} |
if ( (defined($close) && $close ne '' && time > $close) ) { |
if ( (defined($close) && $close ne '' && time > $close) ) { |
return ('CLOSED',$open,$close, |
return ('CLOSED',$open,$close, |
'<h1>'.&mt('Not open to be viewed').'</h1>'. |
'<p class="LC_warning">'.&mt('Not open to be viewed').'</p>'. |
&mt("This resource is no longer available to be viewed.")); |
&mt("This resource is no longer available to be viewed.")); |
} |
} |
return ('OPEN',$open,$close); |
return ('OPEN',$open,$close); |
Line 54 sub handler {
|
Line 55 sub handler {
|
if (&Apache::lonnet::allowed('bre',$r->uri) eq 'F') { |
if (&Apache::lonnet::allowed('bre',$r->uri) eq 'F') { |
return DECLINED; |
return DECLINED; |
} |
} |
|
if (($r->uri =~ /ext\.tool$/) && |
|
(&Apache::lonnet::EXT('resource.0.gradable',$env{'request.symb'}) =~ /^yes$/i)) { |
|
return DECLINED; |
|
} |
my ($status,$open,$close,$msg)=&content_date_check(); |
my ($status,$open,$close,$msg)=&content_date_check(); |
if ($status ne 'OPEN') { |
if ($status ne 'OPEN') { |
$r->set_handlers('PerlHandler'=>undef); |
$r->set_handlers('PerlHandler'=>undef); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
my $html=&Apache::lonxml::xmlbegin(); |
my $start_page = |
$r->print($html.'<head><title>'.&mt("Not Open").'</title>'); |
&Apache::loncommon::start_page('Not Open',undef, |
my $addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
{'bgcolor' => '#FFFFFF', |
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
'force_register' => 1,}); |
$r->print(&Apache::lonmenu::registerurl(1)); |
my $end_page = |
$r->print('</head>'.&Apache::structuretags::body_tag_start('web')); |
&Apache::loncommon::end_page({'discussion' => 1}); |
$r->print($msg); |
$r->print($start_page.$msg.$end_page); |
$r->print(&Apache::lonxml::xmlend().'</html>'); |
|
return OK; |
return OK; |
} |
} |
return DECLINED; |
return DECLINED; |