[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 11 Feb 2002 18:32:22 -0000
albertel Mon Feb 11 13:32:22 2002 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
- retabinate, and update comments
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.23 loncom/interface/lonnavmaps.pm:1.24
--- loncom/interface/lonnavmaps.pm:1.23 Tue Jan 1 15:33:15 2002
+++ loncom/interface/lonnavmaps.pm Mon Feb 11 13:32:22 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.23 2002/01/01 20:33:15 www Exp $
+# $Id: lonnavmaps.pm,v 1.24 2002/02/11 18:32:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -103,70 +103,48 @@
my ($mapname,$id,$fn)=split(/\_\_\_/,$symb);
# ----------------------------------------------------- Cascading lookup scheme
- my $rwhat=$what;
- $what=~s/^parameter\_//;
- $what=~s/\_/\./;
-
- my $symbparm=$symb.'.'.$what;
- my $mapparm=$mapname.'___(all).'.$what;
- my $usercourseprefix=$uname.'_'.$udom.'_'.$cid;
-
- my $seclevel=
- $usercourseprefix.'.['.
- $csec.'].'.$what;
- my $seclevelr=
- $usercourseprefix.'.['.
- $csec.'].'.$symbparm;
- my $seclevelm=
- $usercourseprefix.'.['.
- $csec.'].'.$mapparm;
-
- my $courselevel=
- $usercourseprefix.'.'.$what;
- my $courselevelr=
- $usercourseprefix.'.'.$symbparm;
- my $courselevelm=
- $usercourseprefix.'.'.$mapparm;
-
-# ---------------------------------------------------------- fourth, check user
-
- if ($uname) {
-
- if ($useropt{$courselevelr}) { return $useropt{$courselevelr}; }
-
- if ($useropt{$courselevelm}) { return $useropt{$courselevelm}; }
-
- if ($useropt{$courselevel}) { return $useropt{$courselevel}; }
-
- }
-
-# --------------------------------------------------------- third, check course
-
- if ($csec) {
-
- if ($courseopt{$seclevelr}) { return $courseopt{$seclevelr}; }
-
- if ($courseopt{$seclevelm}) { return $courseopt{$seclevelm}; }
+ my $rwhat=$what;
+ $what=~s/^parameter\_//;
+ $what=~s/\_/\./;
+
+ my $symbparm=$symb.'.'.$what;
+ my $mapparm=$mapname.'___(all).'.$what;
+ my $usercourseprefix=$uname.'_'.$udom.'_'.$cid;
+
+ my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what;
+ my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm;
+ my $seclevelm=$usercourseprefix.'.['.$csec.'].'.$mapparm;
+
+ my $courselevel= $usercourseprefix.'.'.$what;
+ my $courselevelr=$usercourseprefix.'.'.$symbparm;
+ my $courselevelm=$usercourseprefix.'.'.$mapparm;
+
+# ---------------------------------------------------------- first, check user
+ if ($uname) {
+ if ($useropt{$courselevelr}) { return $useropt{$courselevelr}; }
+ if ($useropt{$courselevelm}) { return $useropt{$courselevelm}; }
+ if ($useropt{$courselevel}) { return $useropt{$courselevel}; }
+ }
+# ------------------------------------------------------- second, check course
+ if ($csec) {
+ if ($courseopt{$seclevelr}) { return $courseopt{$seclevelr}; }
+ if ($courseopt{$seclevelm}) { return $courseopt{$seclevelm}; }
if ($courseopt{$seclevel}) { return $courseopt{$seclevel}; }
-
- }
-
- if ($courseopt{$courselevelr}) { return $courseopt{$courselevelr}; }
-
- if ($courseopt{$courselevelm}) { return $courseopt{$courselevelm}; }
+ }
- if ($courseopt{$courselevel}) { return $courseopt{$courselevel}; }
+ if ($courseopt{$courselevelr}) { return $courseopt{$courselevelr}; }
+ if ($courseopt{$courselevelm}) { return $courseopt{$courselevelm}; }
+ if ($courseopt{$courselevel}) { return $courseopt{$courselevel}; }
-# ----------------------------------------------------- second, check map parms
+# ----------------------------------------------------- third, check map parms
- my $thisparm=$parmhash{$symbparm};
- if ($thisparm) { return $thisparm; }
+ my $thisparm=$parmhash{$symbparm};
+ if ($thisparm) { return $thisparm; }
-# -------------------------------------------------------- first, check default
+# ----------------------------------------------------- fourth , check default
- return &Apache::lonnet::metadata($fn,$rwhat.'.default');
-
+ return &Apache::lonnet::metadata($fn,$rwhat.'.default');
}
@@ -179,7 +157,7 @@
my $ctext='';
$rid=~/(\d+)\.(\d+)/;
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=();
@@ -198,58 +176,57 @@
my %returnhash=&Apache::lonnet::restore($symb);
- map {
-
- my $duedate=$duedate{$_};
- my $opendate=$opendate{$_};
- my $answerdate=$answerdate{$_};
- my $preface='';
- unless ($_ eq '0') { $preface=' Part: '.$_.' '; }
- if ($opendate) {
- if ($now<$duedate) {
- unless ($tcode==4) { $tcode=2; }
- $ctext.=$preface.'Due: '.localtime($duedate);
- if ($now<$opendate) {
- unless ($tcode) { $tcode=1; }
- $ctext.=$preface.'Open: '.localtime($opendate);
- }
- if ($duedate-$now<86400) {
- $tcode=4;
- $ctext.=$preface.'Due: '.localtime($duedate);
- }
- } else {
- unless (($tcode==4) || ($tcode eq 2)) { $tcode=3; }
- if ($now<$answerdate) {
- $ctext.='Answer: '.localtime($duedate);
- }
- }
- } else {
- unless (($tcode==2) || ($tcode==4)) { $tcode=1; }
- }
-
- my $status=$returnhash{'resource.'.$_.'.solved'};
-
- if ($status eq 'correct_by_student') {
- unless ($code==2) { $code=3; }
- $ctext.=' solved';
- } elsif ($status eq 'correct_by_override') {
- unless ($code==2) { $code=3; }
- $ctext.=' override';
- } elsif ($status eq 'incorrect_attempted') {
- $code=2;
- $ctext.=' ('.
- ($returnhash{'resource.'.$_.'.tries'}?
- $returnhash{'resource.'.$_.'.tries'}:'0').'/'.
+ map {
+ my $duedate=$duedate{$_};
+ my $opendate=$opendate{$_};
+ my $answerdate=$answerdate{$_};
+ my $preface='';
+ unless ($_ eq '0') { $preface=' Part: '.$_.' '; }
+ if ($opendate) {
+ if ($now<$duedate) {
+ unless ($tcode==4) { $tcode=2; }
+ $ctext.=$preface.'Due: '.localtime($duedate);
+ if ($now<$opendate) {
+ unless ($tcode) { $tcode=1; }
+ $ctext.=$preface.'Open: '.localtime($opendate);
+ }
+ if ($duedate-$now<86400) {
+ $tcode=4;
+ $ctext.=$preface.'Due: '.localtime($duedate);
+ }
+ } else {
+ unless (($tcode==4) || ($tcode eq 2)) { $tcode=3; }
+ if ($now<$answerdate) {
+ $ctext.='Answer: '.localtime($duedate);
+ }
+ }
+ } else {
+ unless (($tcode==2) || ($tcode==4)) { $tcode=1; }
+ }
+
+ my $status=$returnhash{'resource.'.$_.'.solved'};
+
+ if ($status eq 'correct_by_student') {
+ unless ($code==2) { $code=3; }
+ $ctext.=' solved';
+ } elsif ($status eq 'correct_by_override') {
+ unless ($code==2) { $code=3; }
+ $ctext.=' override';
+ } elsif ($status eq 'incorrect_attempted') {
+ $code=2;
+ $ctext.=' ('.
+ ($returnhash{'resource.'.$_.'.tries'}?
+ $returnhash{'resource.'.$_.'.tries'}:'0').'/'.
&parmval($_.'.maxtries',$symb).' tries)';
- } elsif ($status eq 'incorrect_by_override') {
- $code=2;
- $ctext.=' override';
- } elsif ($status eq 'excused') {
- unless ($code==2) { $code=3; }
- $ctext.=' excused';
- }
+ } elsif ($status eq 'incorrect_by_override') {
+ $code=2;
+ $ctext.=' override';
+ } elsif ($status eq 'excused') {
+ unless ($code==2) { $code=3; }
+ $ctext.=' excused';
+ }
- } sort keys %opendate;
+ } sort keys %opendate;
return 'p'.$code.$tcode.'"'.$ctext.'"';
}