version 1.10, 2001/01/30 19:31:32
|
version 1.15, 2001/09/21 19:56:45
|
Line 9
|
Line 9
|
# 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23, |
# 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23, |
# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer) |
# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer) |
# |
# |
# 3/1/1,6/1,17/1,29/1,30/1 Gerd Kortemeyer |
# 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21 Gerd Kortemeyer |
|
|
package Apache::lonnavmaps; |
package Apache::lonnavmaps; |
|
|
Line 153 sub astatus {
|
Line 153 sub astatus {
|
$rid=~/(\d+)\.(\d+)/; |
$rid=~/(\d+)\.(\d+)/; |
my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. |
my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. |
&Apache::lonnet::declutter($hash{'src_'.$rid}); |
&Apache::lonnet::declutter($hash{'src_'.$rid}); |
|
|
|
my %duedate=(); |
|
my %opendate=(); |
|
my %answerdate=(); |
|
map { |
|
if ($_=~/^parameter\_(.*)\_opendate$/) { |
|
my $part=$1; |
|
$duedate{$part}=&parmval($part.'.duedate',$symb); |
|
$opendate{$part}=&parmval($part.'.opendate',$symb); |
|
$answerdate{$part}=&parmval($part.'.answerdate',$symb); |
|
} |
|
} sort split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'keys')); |
|
|
my $duedate=&parmval('0.duedate',$symb); |
my $duedate=&parmval('0.duedate',$symb); |
if ($duedate) { |
my $opendate=&parmval('0.opendate',$symb); |
$ctext.='Due: '.localtime($duedate); |
my $answerdate=&parmval('0.answerdate',$symb); |
|
my $now=time; |
|
my $tcode=0; |
|
if ($opendate) { |
|
if ($now<$duedate) { |
|
$tcode=2; |
|
$ctext='Due: '.localtime($duedate); |
|
if ($now<$opendate) { |
|
$tcode=1; |
|
$ctext='Open: '.localtime($opendate); |
|
} |
|
if ($duedate-$now<86400) { |
|
$tcode=4; |
|
$ctext='Due: '.localtime($duedate); |
|
} |
|
} else { |
|
$tcode=3; |
|
if ($now<$answerdate) { |
|
$ctext='Answer: '.localtime($duedate); |
|
} |
} |
} |
|
} else { |
|
$tcode=1; |
|
} |
my $answer=&Apache::lonnet::reply( |
my $answer=&Apache::lonnet::reply( |
"restore:$ENV{'user.domain'}:$ENV{'user.name'}:". |
"restore:$ENV{'user.domain'}:$ENV{'user.name'}:". |
$ENV{'request.course.id'}.':'. |
$ENV{'request.course.id'}.':'. |
Line 191 sub astatus {
|
Line 226 sub astatus {
|
} elsif ($returnhash{$_} eq 'incorrect_attempted') { |
} elsif ($returnhash{$_} eq 'incorrect_attempted') { |
$code=2; |
$code=2; |
$ctext.= |
$ctext.= |
$returnhash{'resource.'.$part.'.tries'}.' attempt(s)'; |
$returnhash{'resource.'.$part.'.tries'}.'/'. |
|
&parmval($part.'.maxtries',$symb).' tries'; |
} elsif ($returnhash{$_} eq 'incorrect_by_override') { |
} elsif ($returnhash{$_} eq 'incorrect_by_override') { |
$code=2; |
$code=2; |
$ctext.='override'; |
$ctext.='override'; |
Line 202 sub astatus {
|
Line 238 sub astatus {
|
} |
} |
} keys %returnhash; |
} keys %returnhash; |
} |
} |
return 'p'.$code.'"'.$ctext.'"'; |
return 'p'.$code.$tcode.'"'.$ctext.'"'; |
} |
} |
|
|
# ------------------------------------------------------------ Build page table |
# ------------------------------------------------------------ Build page table |
Line 414 sub handler {
|
Line 450 sub handler {
|
|
|
# ------------------------------------------------------------------ Build page |
# ------------------------------------------------------------------ Build page |
|
|
|
my $currenturl=$ENV{'form.postdata'}; |
|
$currenturl=~s/^http\:\/\///; |
|
$currenturl=~s/^[^\/]+//; |
|
|
# ---------------------------------------------------------------- Send headers |
# ---------------------------------------------------------------- Send headers |
|
|
$r->content_type('text/html'); |
$r->content_type('text/html'); |
Line 421 sub handler {
|
Line 461 sub handler {
|
$r->print( |
$r->print( |
'<html><head><title>Navigate LON-CAPA Maps</title></head>'); |
'<html><head><title>Navigate LON-CAPA Maps</title></head>'); |
|
|
$r->print('<body bgcolor="#FFFFFF">'. |
$r->print('<body bgcolor="#FFFFFF"'); |
'<script>window.focus();</script>'. |
if (($currenturl=~/^\/res/) && |
|
($currenturl!~/^\/res\/adm/)) { |
|
$r->print(' onLoad="window.location.hash='. |
|
"'curloc'".'"'); |
|
} |
|
$r->print('><script>window.focus();</script>'. |
'<img align=right src=/adm/lonIcons/lonlogos.gif>'. |
'<img align=right src=/adm/lonIcons/lonlogos.gif>'. |
'<h1>Navigate Course Map</h1>'); |
'<h1>Navigate Course Map</h1>'); |
$r->rflush(); |
$r->rflush(); |
|
if (($currenturl=~/^\/res/) && |
|
($currenturl!~/^\/res\/adm/)) { |
|
$r->print('<a href="#curloc">Current Location</a><p>'); |
|
} |
|
# ----------------------------------------------------- The little content list |
|
for ($i=0;$i<=$#rows;$i++) { |
|
if ($rows[$i]) { |
|
my @colcont=split(/\&/,$rows[$i]); |
|
my $avespan=$lcm/($#colcont+1); |
|
for ($j=0;$j<=$#colcont;$j++) { |
|
my $rid=$colcont[$j]; |
|
if ($rid=~/^h(.+)/) { |
|
$rid=$1; |
|
$r->print( |
|
' <a href="#'.$rid.'">'.$hash{'title_'.$rid}.'</a><br>'); |
|
} |
|
} |
|
} |
|
} |
# ----------------------------------------------------------------- Start table |
# ----------------------------------------------------------------- Start table |
$r->print('<table cols="'.$lcm.'" border="0">'); |
$r->print('<hr><table cols="'.$lcm.'" border="0">'); |
for ($i=0;$i<=$#rows;$i++) { |
for ($i=0;$i<=$#rows;$i++) { |
if ($rows[$i]) { |
if ($rows[$i]) { |
$r->print("\n<tr>"); |
$r->print("\n<tr>"); |
Line 441 sub handler {
|
Line 505 sub handler {
|
my $hwke='</font>'; |
my $hwke='</font>'; |
if ($rid=~/^h(.+)/) { |
if ($rid=~/^h(.+)/) { |
$rid=$1; |
$rid=$1; |
$add='<th bgcolor="#AAFF55">'; |
$add= |
|
'<th bgcolor="#AAFF55"><a name="'.$rid.'">'; |
$adde='</th>'; |
$adde='</th>'; |
} |
} |
if ($rid=~/^p(\d)\"([\w\: \(\)\,]*)\"(.+)/) { |
if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) { |
my $code=$1; |
my $code=$1; |
my $ctext=$2; |
my $tcode=$2; |
$rid=$3; |
my $ctext=$3; |
|
$rid=$4; |
|
if ($tcode eq '1') { |
|
$add='<td bgcolor="#AAAAAA">'; |
|
} |
|
if ($code eq '3') { |
|
$add='<td bgcolor="#AAFFAA">'; |
|
} else { |
|
$add='<td bgcolor="#FFAAAA">'; |
|
if ($tcode eq '2') { |
|
$add='<td bgcolor="#FFFFAA">'; |
|
} |
|
if ($tcode eq '4') { |
|
$add='<td bgcolor="#FFFF33"><blink>'; |
|
$adde='</blink></td>'; |
|
} |
|
} |
$hwk='<font color="#888811"><b>'; |
$hwk='<font color="#888811"><b>'; |
$hwke='</b></font>'; |
$hwke='</b></font>'; |
if ($code eq '1') { |
if ($code eq '1') { |
Line 462 sub handler {
|
Line 543 sub handler {
|
$hwke='</b> ('.$ctext.')</font>'; |
$hwke='</b> ('.$ctext.')</font>'; |
} |
} |
} |
} |
|
if ($hash{'src_'.$rid} eq $currenturl) { |
|
$add=$add.'<a name="curloc"></a>'. |
|
'<font color=red><b>-> </b></font>'; |
|
$adde= |
|
'<font color=red><b> <-</b></font>'.$adde; |
|
} |
$r->print($add.'<a href="'.$hash{'src_'.$rid}. |
$r->print($add.'<a href="'.$hash{'src_'.$rid}. |
'">'.$hwk. |
'">'.$hwk. |
$hash{'title_'.$rid}.$hwke.'</a>'.$adde); |
$hash{'title_'.$rid}.$hwke.'</a>'.$adde); |
Line 470 sub handler {
|
Line 557 sub handler {
|
} |
} |
} |
} |
$r->print("\n</table>"); |
$r->print("\n</table>"); |
|
|
$r->print('</body></html>'); |
$r->print('</body></html>'); |
# -------------------------------------------------------------------- End page |
# -------------------------------------------------------------------- End page |
} |
} |