:
- my $currenturl=$ENV{'form.postdata'};
- $currenturl=~s/^http\:\/\///;
- $currenturl=~s/^[^\/]+//;
-
-# ---------------------------------------------------------------- Send headers
-
- my $date=localtime;
- my $now=time;
-# ----------------------------------------- Get email status and discussiontime
-
- my %emailstatus=&Apache::lonnet::dump('email_status');
- my $logouttime=$emailstatus{'logout'};
- my $courseleave=$emailstatus{'logout_'.$ENV{'request.course.id'}};
- my $lastcheck=($courseleave>$logouttime?$courseleave:$logouttime);
-
- my %discussiontimes=&Apache::lonnet::dump('discussiontimes',
- $cdom,$cnum);
-
- my %feedback=();
- my %error=();
- foreach my $msgid (split(/\&/,&Apache::lonnet::reply('keys:'.
- $ENV{'user.domain'}.':'.
- $ENV{'user.name'}.':nohist_email',
- $ENV{'user.home'}))) {
- $msgid=&Apache::lonnet::unescape($msgid);
- my $plain=&Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid));
- if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) {
- my ($what,$url)=($1,$2);
- my %status=
- &Apache::lonnet::get('email_status',[$msgid]);
- if ($status{$msgid}=~/^error\:/) {
- $status{$msgid}='';
- }
-
- if (($status{$msgid} eq 'new') ||
- (!$status{$msgid})) {
- if ($what eq 'Error') {
- $error{$url}.=','.$msgid;
- } else {
- $feedback{$url}.=','.$msgid;
- }
- }
- }
- }
-# ----------------------------------------------------------- Start Page Output
- my $bodytagadd='';
- $r->print(
- 'Navigate Course Map');
- if (($currenturl=~/^\/res/) &&
- ($currenturl!~/^\/res\/adm/)) {
- $bodytagadd='onLoad="window.location.hash='."'curloc'".'"';
- }
- $r->print(&Apache::loncommon::bodytag('Navigate Course Map','',
- $bodytagadd));
- $r->print('');
- my $desc=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
- if (defined($desc)) { $r->print("$desc
\n"); }
- $r->print("$date
\n");
- $r->rflush();
- $r->print(' New discussion since '.
- localtime($lastcheck).
- '
New message (click to open)');
- if (($currenturl=~/^\/res/) &&
- ($currenturl!~/^\/res\/adm/)) {
- $r->print('Current Location
');
- }
+An icon for the status of a problem, with five possible states:
+Correct, incorrect, open, awaiting grading (for a problem where the
+computer's grade is suppressed, or the computer can't grade, like
+essay problem), or none (not open yet, not a problem). The
+third column of the standard navmap.
- # Handle a network error
+=item * B:
- if ($networkFailedFlag)
- {
- $r->print('LON-CAPA network failure.
'."\n");
- $r->print("LON-CAPA's network is having difficulties, some problem" .
- " information, such as due dates, will not be available.");
- }
-# ----------------------------------------------------- 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(' '.$hash{'title_'.$rid}.
- '
');
- }
- }
- }
- }
-# ----------------------------------------------------------------- Start table
- $r->print('
');
- for ($i=0;$i<=$#rows;$i++) {
- if ($rows[$i]) {
- $r->print("\n");
- my @colcont=split(/\&/,$rows[$i]);
- my $avespan=$lcm/($#colcont+1);
-
- # for each item I wish to print on this row...
- for ($j=0;$j<=$#colcont;$j++) {
- my $indent;my $indentstr;
- my $linkid;
- my $rid=$colcont[$j];
- $rid=~/(\d+)\.(\d+)$/;
- my $src=
- &Apache::lonnet::declutter($hash{'src_'.$1.'.'.$2});
- my $symb=
- &Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.$src;
- my $add='';
- my $adde=' | ';
- my $hwk='';
- my $hwke='';
- if ($rid=~/^l(\d+\.\d+),(.+)/) { $linkid=$1; $rid=$2; }
- if ($rid=~/^i(\d+),(.+)/) { $indent=$1; $rid=$2; }
- if ($rid=~/^h(.+)/) {
- $rid=$1;
- $add='';
- $adde=' | ';
- if (($ENV{'user.adv'}) &&
- ($parmhash{$symb.'.0.parameter_randompick'})) {
- $adde=' (randomly select '.
- $parmhash{$symb.'.0.parameter_randompick'}.
- ')';
- }
- }
- if ($rid=~/^j(.+)/) { $rid=$1; }
- if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) {
- # sub astatus describes what code/tcode mean
- my $code=$1;
- my $tcode=$2;
- my $ctext=$3;
- $rid=$4;
-
- # will open later
- if ($tcode eq '1') {
- $add='';
- }
-
- # solved/correct
- if ($code eq '3') {
- $add=' | ';
- } elsif ($code eq '4') { # partially correct
- $add=' | ';
- } else {
- # not attempted
-
- # we end up here on network failure, so pick a neutral
- # color if the network failed instead of bright red.
- if ( $networkFailedFlag )
- {
- $add = ' | ';
- }
- else
- {
- $add=' | ';
- }
-
- if ($tcode eq '2') { # open, not past due
- $add=' | ';
- }
-
- if ($tcode eq '4') { # due in next 24 hours
- $add=' | ';
- $adde=' | ';
- }
- }
- $hwk='';
- $hwke='';
- if ($code eq '1') {
- $hwke=' ('.$ctext.')';
- }
- if ($code eq '2' || $code eq '4') {
- $hwk='';
- $hwke=' ('.$ctext.')';
- }
- if ($code eq '3') {
- $hwk='';
- $hwke=' ('.$ctext.')';
- }
- if ($networkFailedFlag)
- {
- $hwke=' (status unavailable)';
- }
- }
- if ($rid && $hash{'src_'.$rid} eq $currenturl) {
- $add=$add.''.
- '> ';
- $adde=
- ' <'.$adde;
- }
- if ($discussiontimes{$symb}>$lastcheck) {
- $adde=
- ''.
- $adde;
- }
- if ($error{$src}) {
- foreach (split(/\,/,$error{$src})) {
- if ($_) {
- $adde=
- ' '
- .$adde;
- }
- }
- }
- if ($feedback{$src}) {
- foreach (split(/\,/,$feedback{$src})) {
- if ($_) {
- $adde=
- ' '
- .$adde;
- }
- }
- }
- if ($indent) {
- my $is=" ";
- for(my $i=-1;$i<$indent;$i++) { $indentstr.=$is; }
- }
- if (!$linkid) { $linkid=$rid; }
- if ($hash{'randomout_'.$rid}) {
- $adde=' (hidden)'.$adde;
- }
- $r->print($add.$indentstr);
- if ($rid) {
- $r->print(''.
- $hwk.$hash{'title_'.$rid}.$hwke.'');
- }
- $r->print($adde);
- }
- $r->print('
');
- }
- }
- $r->print("\n
");
- $r->print('');
-# -------------------------------------------------------------------- End page
- }
-# ------------------------------------------------------------- End render page
- }
-# ------------------------------------------------------------------ Untie hash
- unless (untie(%hash)) {
- &Apache::lonnet::logthis("WARNING: ".
- "Could not untie coursemap $fn (browse).");
- }
- unless (untie(%parmhash)) {
- &Apache::lonnet::logthis("WARNING: ".
- "Could not untie parmhash (browse).");
- }
- return OK;
-}
+A text readout of the details of the current status of the problem,
+such as "Due in 22 hours". The fourth column of the standard navmap.
-sub new_handle {
- my $r = shift;
+=item * B:
- # Handle header-only request
- if ($r->header_only) {
- if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
- } else {
- $r->content_type('text/html');
- }
- $r->send_http_header;
- return OK;
- }
+A text readout summarizing the status of the problem. If it is a
+single part problem, will display "Correct", "Incorrect",
+"Not yet open", "Open", "Attempted", or "Error". If there are
+multiple parts, this will output a string that in HTML will show a
+status of how many parts are in each status, in color coding, trying
+to match the colors of the icons within reason.
- # Send header, don't cache this page
- if ($ENV{'browser.mathml'}) {
- $r->content_type('text/xml');
- } else {
- $r->content_type('text/html');
- }
- &Apache::loncommon::no_cache($r);
- $r->send_http_header;
+Note this only makes sense if you are I showing parts. If
+C is true (see below), this column will not output
+anything.
- # Header
- $r->print(&Apache::loncommon::bodytag('Navigate Course Map','',
- ''));
- # Initialize the nav map
- my $navmap = Apache::lonnavmaps::navmap->new(
- $ENV{"request.course.fn"}.".db",
- $ENV{"request.course.fn"}."_parms.db", 1);
+=back
+If you add any others please be sure to document them here.
- if (!defined($navmap)) {
- my $requrl = $r->uri;
- $ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
- return HTTP_NOT_ACCEPTABLE;
- }
+An example of a column renderer that will show the ID number of a
+resource, along with the part name if any:
- # Check that it's defined
- if (!($navmap->courseMapDefined())) {
- $r->print('Coursemap undefined.' .
- '