version 1.44, 2002/09/01 19:29:00
|
version 1.50, 2002/09/09 17:20:14
|
Line 67 my %courseopt;
|
Line 67 my %courseopt;
|
my %useropt; |
my %useropt; |
my %parmhash; |
my %parmhash; |
|
|
|
# This parameter keeps track of whether obtaining the user's information |
|
# failed, which the colorizer in astatus can use |
|
my $networkFailedFlag = 0; |
|
|
# ------------------------------------------------------------------ Euclid gcd |
# ------------------------------------------------------------------ Euclid gcd |
|
|
sub euclid { |
sub euclid { |
Line 191 sub astatus {
|
Line 195 sub astatus {
|
my %opendate=(); |
my %opendate=(); |
my %answerdate=(); |
my %answerdate=(); |
# need to always check part 0's open/due/answer status |
# need to always check part 0's open/due/answer status |
foreach (sort(split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'keys')))) { |
foreach (sort(split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'allpossiblekeys')))) { |
if ($_=~/^parameter\_(.*)\_opendate$/) { |
if ($_=~/^parameter\_(.*)\_opendate$/) { |
my $part=$1; |
my $part=$1; |
$duedate{$part}=&parmval($part.'.duedate',$symb); |
$duedate{$part}=&parmval($part.'.duedate',$symb); |
$opendate{$part}=&parmval($part.'.opendate',$symb); |
$opendate{$part}=&parmval($part.'.opendate',$symb); |
$answerdate{$part}=&parmval($part.'.answerdate',$symb); |
$answerdate{$part}=&parmval($part.'.answerdate',$symb); |
|
if (&parmval($part.'.opendate.type',$symb) eq 'date_interval') { |
|
$opendate{$part}=$duedate{$part}-$opendate{$part}; |
|
} |
|
if (&parmval($part.'.answerdate.type',$symb) eq 'date_interval') { |
|
$answerdate{$part}=$duedate{$part}+$answerdate{$part}; |
|
} |
} |
} |
} |
} |
my $now=time; |
my $now=time; |
Line 458 sub handler {
|
Line 468 sub handler {
|
my ($cdom,$cnum)=split(/\_/,$cid); |
my ($cdom,$cnum)=split(/\_/,$cid); |
|
|
my $userprefix=$uname.'_'.$udom.'_'; |
my $userprefix=$uname.'_'.$udom.'_'; |
|
|
unless ($uhome eq 'no_host') { |
unless ($uhome eq 'no_host') { |
# -------------------------------------------------------------- Get coursedata |
# ------------------------------------------------- Get coursedata (if present) |
unless ((time-$courserdatas{$cid.'.last_cache'})<240) { |
unless ((time-$courserdatas{$cid.'.last_cache'})<240) { |
my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum. |
my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum. |
':resourcedata',$chome); |
':resourcedata',$chome); |
Line 468 sub handler {
|
Line 478 sub handler {
|
$courserdatas{$cid}=$reply; |
$courserdatas{$cid}=$reply; |
$courserdatas{$cid.'.last_cache'}=time; |
$courserdatas{$cid.'.last_cache'}=time; |
} |
} |
|
# check to see if network failed |
|
elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i ) |
|
{ |
|
$networkFailedFlag = 1; |
|
} |
} |
} |
foreach (split(/\&/,$courserdatas{$cid})) { |
foreach (split(/\&/,$courserdatas{$cid})) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
Line 584 sub handler {
|
Line 599 sub handler {
|
($currenturl!~/^\/res\/adm/)) { |
($currenturl!~/^\/res\/adm/)) { |
$r->print('<a href="#curloc">Current Location</a><p>'); |
$r->print('<a href="#curloc">Current Location</a><p>'); |
} |
} |
|
|
|
# Handle a network error |
|
|
|
if ($networkFailedFlag) |
|
{ |
|
$r->print('<H2>LON-CAPA network failure.</H2>'."\n"); |
|
$r->print("<p>LON-CAPA's network is having difficulties, some problem" . |
|
" information, such as due dates, will not be available."); |
|
} |
# ----------------------------------------------------- The little content list |
# ----------------------------------------------------- The little content list |
for ($i=0;$i<=$#rows;$i++) { |
for ($i=0;$i<=$#rows;$i++) { |
if ($rows[$i]) { |
if ($rows[$i]) { |
Line 607 sub handler {
|
Line 631 sub handler {
|
$r->print("\n<tr>"); |
$r->print("\n<tr>"); |
my @colcont=split(/\&/,$rows[$i]); |
my @colcont=split(/\&/,$rows[$i]); |
my $avespan=$lcm/($#colcont+1); |
my $avespan=$lcm/($#colcont+1); |
|
|
|
# for each item I wish to print on this row... |
for ($j=0;$j<=$#colcont;$j++) { |
for ($j=0;$j<=$#colcont;$j++) { |
my $indent;my $indentstr; |
my $indent;my $indentstr; |
my $linkid; |
my $linkid; |
Line 640 sub handler {
|
Line 666 sub handler {
|
my $tcode=$2; |
my $tcode=$2; |
my $ctext=$3; |
my $ctext=$3; |
$rid=$4; |
$rid=$4; |
if ($tcode eq '1') { |
|
|
# will open later |
|
if ($tcode eq '1') { |
$add='<td bgcolor="#AAAAAA">'; |
$add='<td bgcolor="#AAAAAA">'; |
} |
} |
|
|
|
# solved/correct |
if ($code eq '3') { |
if ($code eq '3') { |
$add='<td bgcolor="#AAFFAA">'; |
$add='<td bgcolor="#AAFFAA">'; |
} elsif ($code eq '4') { |
} elsif ($code eq '4') { # partially correct |
$add='<td bgcolor="#E0FFAA">'; |
$add='<td bgcolor="#E0FFAA">'; |
} else { |
} else { |
$add='<td bgcolor="#FFAAAA">'; |
# not attempted |
if ($tcode eq '2') { |
|
|
# we end up here on network failure, so pick a neutral |
|
# color if the network failed instead of bright red. |
|
if ( $networkFailedFlag ) |
|
{ |
|
$add = '<td bgcolor="#AAAAAA">'; |
|
} |
|
else |
|
{ |
|
$add='<td bgcolor="#FFAAAA">'; |
|
} |
|
|
|
if ($tcode eq '2') { # open, not past due |
$add='<td bgcolor="#FFFFAA">'; |
$add='<td bgcolor="#FFFFAA">'; |
} |
} |
if ($tcode eq '4') { |
|
|
if ($tcode eq '4') { # due in next 24 hours |
$add='<td bgcolor="#FFFF33">'; |
$add='<td bgcolor="#FFFF33">'; |
$adde='</td>'; |
$adde='</td>'; |
} |
} |
Line 670 sub handler {
|
Line 713 sub handler {
|
$hwk='<font color="#229922"><b>'; |
$hwk='<font color="#229922"><b>'; |
$hwke='</b> ('.$ctext.')</font>'; |
$hwke='</b> ('.$ctext.')</font>'; |
} |
} |
|
if ($networkFailedFlag) |
|
{ |
|
$hwke='</b> (status unavailable)</font>'; |
|
} |
} |
} |
if ($rid && $hash{'src_'.$rid} eq $currenturl) { |
if ($rid && $hash{'src_'.$rid} eq $currenturl) { |
$add=$add.'<a name="curloc"></a>'. |
$add=$add.'<a name="curloc"></a>'. |