version 1.1, 2001/01/11 15:20:58
|
version 1.7, 2001/06/01 15:58:00
|
Line 5 use Apache::lonnet;
|
Line 5 use Apache::lonnet;
|
use POSIX qw(strftime); |
use POSIX qw(strftime); |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::outputtags',('duedatebox')); |
&Apache::lonxml::register('Apache::outputtags',('displayduedate','displaytitle')); |
} |
} |
|
|
|
sub start_displayduedate { |
sub start_duedatebox { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my $result; |
my $result; |
my $status=$Apache::inputtags::status['-1']; |
my $status=$Apache::inputtags::status['-1']; |
&Apache::lonxml::debug("got a $status in duedatebox"); |
&Apache::lonxml::debug("got a $status in duedatebox"); |
if ($status =~ /CAN.*_ANSWER/) { |
if (($status =~ /CAN.*_ANSWER/) && ($target eq 'web')) { |
my $args =''; |
my $format = &Apache::lonxml::get_param('format',$parstack,$safeeval); |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
|
my $format = &Apache::run::run("{$args;".'return $format}',$safeeval); |
|
if ($format eq '') { |
if ($format eq '') { |
&Apache::lonxml::debug("using default format"); |
&Apache::lonxml::debug("using default format"); |
$format="%c"; |
$format="%c"; |
Line 25 sub start_duedatebox {
|
Line 22 sub start_duedatebox {
|
my $id = $Apache::inputtags::part; |
my $id = $Apache::inputtags::part; |
my $date = &Apache::lonnet::EXT("resource.$id.duedate"); |
my $date = &Apache::lonnet::EXT("resource.$id.duedate"); |
&Apache::lonxml::debug("duedatebox found $date for $id"); |
&Apache::lonxml::debug("duedatebox found $date for $id"); |
$result ='<table border="on"><tr><td>Due at '. |
if ($date) { |
POSIX::strftime($format,localtime($date)). |
$result ='<table border="on"><tr><td>Due at '. |
'</td></tr></table>'; |
POSIX::strftime($format,localtime($date)). |
|
'</td></tr></table>'; |
|
} else { |
|
$result ='<table border="on"><tr><td>No due date set.</td></tr></table>'; |
|
} |
|
} |
|
return $result; |
|
} |
|
|
|
sub end_displayduedate { |
|
return ''; |
|
} |
|
|
|
sub start_displaytitle { |
|
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
|
my $result=''; |
|
if ($target eq 'web') { |
|
$result="<h1>$Apache::lonhomework::name</h1>"; |
} |
} |
return $result; |
return $result; |
} |
} |
|
|
sub end_duedatebox { |
sub end_displaytitle { |
|
return ''; |
} |
} |
|
|
1; |
1; |