version 1.7, 2004/08/23 19:34:00
|
version 1.14, 2017/12/22 02:00:53
|
Line 26
|
Line 26
|
|
|
use strict; |
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 { |
my $symb=$ENV{'request.symb'}; |
my $symb=$env{'request.symb'}; |
my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb); |
my $open=&Apache::lonnet::EXT('resource.0.contentopen',$symb); |
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, |
|
'<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, |
|
'<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 50 sub content_date_check {
|
Line 53 sub content_date_check {
|
sub handler { |
sub handler { |
my ($r)=@_; |
my ($r)=@_; |
if (&Apache::lonnet::allowed('bre',$r->uri) eq 'F') { |
if (&Apache::lonnet::allowed('bre',$r->uri) eq 'F') { |
return OK; |
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') { |
Line 58 sub handler {
|
Line 65 sub handler {
|
&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; |
$r->print('<html><head><title>'.&mt("Not Open").'</title>'); |
my $start_page = |
my $addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
&Apache::loncommon::start_page('Not Open',undef, |
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
{'bgcolor' => '#FFFFFF', |
$r->print(&Apache::lonmenu::registerurl(1)); |
'force_register' => 1,}); |
$r->print('</head>'. |
my $end_page = |
&Apache::loncommon::bodytag('','',$addentries,'','', |
&Apache::loncommon::end_page({'discussion' => 1}); |
undef)); |
$r->print($start_page.$msg.$end_page); |
|
|
$r->print($msg); |
return OK; |
$r->print('</body></html>'); |
|
} |
} |
return OK; |
return DECLINED; |
} |
} |
1; |
1; |