Annotation of loncom/interface/lonnavmaps.pm, revision 1.24
1.2 www 1: # The LearningOnline Network with CAPA
2: # Navigate Maps Handler
1.1 www 3: #
1.24 ! albertel 4: # $Id: lonnavmaps.pm,v 1.23 2002/01/01 20:33:15 www Exp $
1.20 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.2 www 28: # (Page Handler
1.1 www 29: #
1.2 www 30: # (TeX Content Handler
1.1 www 31: #
1.2 www 32: # 05/29/00,05/30 Gerd Kortemeyer)
33: # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
34: # 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer)
1.1 www 35: #
1.17 www 36: # 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21,9/24,9/25 Gerd Kortemeyer
1.21 www 37: # YEAR=2002
38: # 1/1 Gerd Kortemeyer
39: #
1.2 www 40:
1.1 www 41: package Apache::lonnavmaps;
42:
43: use strict;
1.2 www 44: use Apache::Constants qw(:common :http);
45: use Apache::lonnet();
1.18 albertel 46: use Apache::loncommon();
1.2 www 47: use HTML::TokeParser;
48: use GDBM_File;
49:
50: # -------------------------------------------------------------- Module Globals
51: my %hash;
52: my @rows;
53:
1.10 www 54: #
55: # These cache hashes need to be independent of user, resource and course
56: # (user and course can/should be in the keys)
57: #
58:
59: my %courserdatas;
60: my %userrdatas;
61:
62: #
63: # These global hashes are dependent on user, course and resource,
64: # and need to be initialized every time when a sheet is calculated
65: #
66: my %courseopt;
67: my %useropt;
68: my %parmhash;
69:
1.2 www 70: # ------------------------------------------------------------------ Euclid gcd
71:
72: sub euclid {
73: my ($e,$f)=@_;
74: my $a; my $b; my $r;
75: if ($e>$f) { $b=$e; $r=$f; } else { $r=$e; $b=$f; }
76: while ($r!=0) {
77: $a=$b; $b=$r;
78: $r=$a%$b;
79: }
80: return $b;
81: }
82:
1.10 www 83: # --------------------------------------------------------------------- Parmval
84:
85: # -------------------------------------------- Figure out a cascading parameter
86: #
87: # For this function to work
88: #
89: # * parmhash needs to be tied
90: # * courseopt and useropt need to be initialized for this user and course
91: #
92:
93: sub parmval {
94: my ($what,$symb)=@_;
95: my $cid=$ENV{'request.course.id'};
96: my $csec=$ENV{'request.course.sec'};
97: my $uname=$ENV{'user.name'};
98: my $udom=$ENV{'user.domain'};
99:
100: unless ($symb) { return ''; }
101: my $result='';
102:
103: my ($mapname,$id,$fn)=split(/\_\_\_/,$symb);
104:
105: # ----------------------------------------------------- Cascading lookup scheme
1.24 ! albertel 106: my $rwhat=$what;
! 107: $what=~s/^parameter\_//;
! 108: $what=~s/\_/\./;
! 109:
! 110: my $symbparm=$symb.'.'.$what;
! 111: my $mapparm=$mapname.'___(all).'.$what;
! 112: my $usercourseprefix=$uname.'_'.$udom.'_'.$cid;
! 113:
! 114: my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what;
! 115: my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm;
! 116: my $seclevelm=$usercourseprefix.'.['.$csec.'].'.$mapparm;
! 117:
! 118: my $courselevel= $usercourseprefix.'.'.$what;
! 119: my $courselevelr=$usercourseprefix.'.'.$symbparm;
! 120: my $courselevelm=$usercourseprefix.'.'.$mapparm;
! 121:
! 122: # ---------------------------------------------------------- first, check user
! 123: if ($uname) {
! 124: if ($useropt{$courselevelr}) { return $useropt{$courselevelr}; }
! 125: if ($useropt{$courselevelm}) { return $useropt{$courselevelm}; }
! 126: if ($useropt{$courselevel}) { return $useropt{$courselevel}; }
! 127: }
1.10 www 128:
1.24 ! albertel 129: # ------------------------------------------------------- second, check course
! 130: if ($csec) {
! 131: if ($courseopt{$seclevelr}) { return $courseopt{$seclevelr}; }
! 132: if ($courseopt{$seclevelm}) { return $courseopt{$seclevelm}; }
1.10 www 133: if ($courseopt{$seclevel}) { return $courseopt{$seclevel}; }
1.24 ! albertel 134: }
1.10 www 135:
1.24 ! albertel 136: if ($courseopt{$courselevelr}) { return $courseopt{$courselevelr}; }
! 137: if ($courseopt{$courselevelm}) { return $courseopt{$courselevelm}; }
! 138: if ($courseopt{$courselevel}) { return $courseopt{$courselevel}; }
1.10 www 139:
1.24 ! albertel 140: # ----------------------------------------------------- third, check map parms
1.10 www 141:
1.24 ! albertel 142: my $thisparm=$parmhash{$symbparm};
! 143: if ($thisparm) { return $thisparm; }
1.10 www 144:
1.24 ! albertel 145: # ----------------------------------------------------- fourth , check default
1.10 www 146:
1.24 ! albertel 147: return &Apache::lonnet::metadata($fn,$rwhat.'.default');
1.10 www 148: }
149:
150:
151:
1.9 www 152: # ------------------------------------------------------------- Find out status
153:
154: sub astatus {
155: my $rid=shift;
156: my $code=1;
157: my $ctext='';
158: $rid=~/(\d+)\.(\d+)/;
1.10 www 159: my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.
1.24 ! albertel 160: &Apache::lonnet::declutter($hash{'src_'.$rid});
1.15 www 161:
162: my %duedate=();
163: my %opendate=();
164: my %answerdate=();
165: map {
166: if ($_=~/^parameter\_(.*)\_opendate$/) {
167: my $part=$1;
168: $duedate{$part}=&parmval($part.'.duedate',$symb);
169: $opendate{$part}=&parmval($part.'.opendate',$symb);
170: $answerdate{$part}=&parmval($part.'.answerdate',$symb);
171: }
172: } sort split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'keys'));
173:
1.11 www 174: my $now=time;
175: my $tcode=0;
1.16 www 176:
177: my %returnhash=&Apache::lonnet::restore($symb);
178:
1.24 ! albertel 179: map {
! 180: my $duedate=$duedate{$_};
! 181: my $opendate=$opendate{$_};
! 182: my $answerdate=$answerdate{$_};
! 183: my $preface='';
! 184: unless ($_ eq '0') { $preface=' Part: '.$_.' '; }
! 185: if ($opendate) {
! 186: if ($now<$duedate) {
! 187: unless ($tcode==4) { $tcode=2; }
! 188: $ctext.=$preface.'Due: '.localtime($duedate);
! 189: if ($now<$opendate) {
! 190: unless ($tcode) { $tcode=1; }
! 191: $ctext.=$preface.'Open: '.localtime($opendate);
! 192: }
! 193: if ($duedate-$now<86400) {
! 194: $tcode=4;
! 195: $ctext.=$preface.'Due: '.localtime($duedate);
! 196: }
! 197: } else {
! 198: unless (($tcode==4) || ($tcode eq 2)) { $tcode=3; }
! 199: if ($now<$answerdate) {
! 200: $ctext.='Answer: '.localtime($duedate);
! 201: }
! 202: }
! 203: } else {
! 204: unless (($tcode==2) || ($tcode==4)) { $tcode=1; }
! 205: }
! 206:
! 207: my $status=$returnhash{'resource.'.$_.'.solved'};
! 208:
! 209: if ($status eq 'correct_by_student') {
! 210: unless ($code==2) { $code=3; }
! 211: $ctext.=' solved';
! 212: } elsif ($status eq 'correct_by_override') {
! 213: unless ($code==2) { $code=3; }
! 214: $ctext.=' override';
! 215: } elsif ($status eq 'incorrect_attempted') {
! 216: $code=2;
! 217: $ctext.=' ('.
! 218: ($returnhash{'resource.'.$_.'.tries'}?
! 219: $returnhash{'resource.'.$_.'.tries'}:'0').'/'.
1.16 www 220: &parmval($_.'.maxtries',$symb).' tries)';
1.24 ! albertel 221: } elsif ($status eq 'incorrect_by_override') {
! 222: $code=2;
! 223: $ctext.=' override';
! 224: } elsif ($status eq 'excused') {
! 225: unless ($code==2) { $code=3; }
! 226: $ctext.=' excused';
! 227: }
1.16 www 228:
1.24 ! albertel 229: } sort keys %opendate;
1.16 www 230:
1.11 www 231: return 'p'.$code.$tcode.'"'.$ctext.'"';
1.9 www 232: }
233:
1.2 www 234: # ------------------------------------------------------------ Build page table
235:
236: sub tracetable {
237: my ($sofar,$rid,$beenhere)=@_;
238: my $further=$sofar;
239: unless ($beenhere=~/\&$rid\&/) {
240: $beenhere.=$rid.'&';
241:
242: if (defined($hash{'is_map_'.$rid})) {
1.7 www 243: $sofar++;
244: my $tprefix='';
245: if ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}
246: eq 'sequence') {
247: $tprefix='h';
248: }
1.6 www 249: if (defined($rows[$sofar])) {
1.7 www 250: $rows[$sofar].='&'.$tprefix.$rid;
1.6 www 251: } else {
1.7 www 252: $rows[$sofar]=$tprefix.$rid;
1.6 www 253: }
1.2 www 254: if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
1.7 www 255: (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) &&
256: ($tprefix eq 'h')) {
1.2 www 257: my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
258: $sofar=
259: &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
260: '&'.$frid.'&');
261: $sofar++;
262: if ($hash{'src_'.$frid}) {
263: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
264: if (($brepriv eq '2') || ($brepriv eq 'F')) {
1.7 www 265: my $pprefix='';
1.9 www 266: if ($hash{'src_'.$frid}=~
267: /\.(problem|exam|quiz|assess|survey|form)$/) {
268: $pprefix=&astatus($frid);
269:
1.7 www 270: }
1.2 www 271: if (defined($rows[$sofar])) {
1.7 www 272: $rows[$sofar].='&'.$pprefix.$frid;
1.2 www 273: } else {
1.7 www 274: $rows[$sofar]=$pprefix.$frid;
1.2 www 275: }
276: }
277: }
278: }
279: } else {
280: $sofar++;
281: if ($hash{'src_'.$rid}) {
282: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
283: if (($brepriv eq '2') || ($brepriv eq 'F')) {
1.7 www 284: my $pprefix='';
1.9 www 285: if ($hash{'src_'.$rid}=~
286: /\.(problem|exam|quiz|assess|survey|form)$/) {
287: $pprefix=&astatus($rid);
1.7 www 288: }
1.2 www 289: if (defined($rows[$sofar])) {
1.7 www 290: $rows[$sofar].='&'.$pprefix.$rid;
1.2 www 291: } else {
1.7 www 292: $rows[$sofar]=$pprefix.$rid;
1.2 www 293: }
294: }
295: }
296: }
297:
298: if (defined($hash{'to_'.$rid})) {
299: my $mincond=1;
300: my $next='';
301: map {
302: my $thiscond=
303: &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
304: if ($thiscond>=$mincond) {
305: if ($next) {
306: $next.=','.$_.':'.$thiscond;
307: } else {
308: $next=$_.':'.$thiscond;
309: }
310: if ($thiscond>$mincond) { $mincond=$thiscond; }
311: }
312: } split(/\,/,$hash{'to_'.$rid});
313: map {
314: my ($linkid,$condval)=split(/\:/,$_);
315: if ($condval>=$mincond) {
316: my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
317: if ($now>$further) { $further=$now; }
318: }
319: } split(/\,/,$next);
320:
321: }
322: }
323: return $further;
324: }
325:
326: # ================================================================ Main Handler
1.1 www 327:
328: sub handler {
1.2 www 329: my $r=shift;
330:
331:
332: # ------------------------------------------- Set document type for header only
333:
334: if ($r->header_only) {
335: if ($ENV{'browser.mathml'}) {
336: $r->content_type('text/xml');
337: } else {
338: $r->content_type('text/html');
339: }
340: $r->send_http_header;
341: return OK;
342: }
343:
344: my $requrl=$r->uri;
345: # ----------------------------------------------------------------- Tie db file
346: if ($ENV{'request.course.fn'}) {
347: my $fn=$ENV{'request.course.fn'};
348: if (-e "$fn.db") {
1.10 www 349: if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER,0640)) &&
350: (tie(%parmhash,'GDBM_File',
351: $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) {
1.2 www 352: # ------------------------------------------------------------------- Hash tied
353: my $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};
354: my $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};
355: if (($firstres) && ($lastres)) {
356: # ----------------------------------------------------------------- Render page
1.10 www 357: # -------------------------------------------------------------- Set parameters
358:
359:
360: # ---------------------------- initialize coursedata and userdata for this user
361: undef %courseopt;
362: undef %useropt;
363:
364: my $uname=$ENV{'user.name'};
365: my $udom=$ENV{'user.domain'};
366: my $uhome=$ENV{'user.home'};
367: my $cid=$ENV{'request.course.id'};
368: my $chome=$ENV{'course.'.$cid.'.home'};
369: my ($cdom,$cnum)=split(/\_/,$cid);
370:
371: my $userprefix=$uname.'_'.$udom.'_';
372:
373: unless ($uhome eq 'no_host') {
374: # -------------------------------------------------------------- Get coursedata
375: unless
376: ((time-$courserdatas{$cid.'.last_cache'})<240) {
377: my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.
378: ':resourcedata',$chome);
379: if ($reply!~/^error\:/) {
380: $courserdatas{$cid}=$reply;
381: $courserdatas{$cid.'.last_cache'}=time;
382: }
383: }
384: map {
385: my ($name,$value)=split(/\=/,$_);
386: $courseopt{$userprefix.&Apache::lonnet::unescape($name)}=
387: &Apache::lonnet::unescape($value);
388: } split(/\&/,$courserdatas{$cid});
389: # --------------------------------------------------- Get userdata (if present)
390: unless
391: ((time-$userrdatas{$uname.'___'.$udom.'.last_cache'})<240) {
392: my $reply=
393: &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);
394: if ($reply!~/^error\:/) {
395: $userrdatas{$uname.'___'.$udom}=$reply;
396: $userrdatas{$uname.'___'.$udom.'.last_cache'}=time;
397: }
398: }
399: map {
400: my ($name,$value)=split(/\=/,$_);
401: $useropt{$userprefix.&Apache::lonnet::unescape($name)}=
402: &Apache::lonnet::unescape($value);
403: } split(/\&/,$userrdatas{$uname.'___'.$udom});
404: }
1.2 www 405:
406: @rows=();
407:
408: &tracetable(0,$firstres,'&'.$lastres.'&');
409: if ($hash{'src_'.$lastres}) {
410: my $brepriv=
411: &Apache::lonnet::allowed('bre',$hash{'src_'.$lastres});
412: if (($brepriv eq '2') || ($brepriv eq 'F')) {
413: $rows[$#rows+1]=''.$lastres;
414: }
415: }
416:
417: # ------------------------------------------------------------------ Page parms
418:
419: my $j;
1.5 www 420: my $i;
1.2 www 421: my $lcm=1;
422: my $contents=0;
423:
424: # ---------------------------------------------- Go through table to get layout
425:
426: for ($i=0;$i<=$#rows;$i++) {
427: if ($rows[$i]) {
428: $contents++;
429: my @colcont=split(/\&/,$rows[$i]);
430: $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
431: }
432: }
1.5 www 433:
1.2 www 434:
435: unless ($contents) {
436: $r->content_type('text/html');
437: $r->send_http_header;
438: $r->print('<html><body>Empty Map.</body></html>');
439: } else {
1.10 www 440:
1.2 www 441: # ------------------------------------------------------------------ Build page
442:
1.13 www 443: my $currenturl=$ENV{'form.postdata'};
444: $currenturl=~s/^http\:\/\///;
445: $currenturl=~s/^[^\/]+//;
446:
1.2 www 447: # ---------------------------------------------------------------- Send headers
448:
449: $r->content_type('text/html');
1.19 albertel 450: &Apache::loncommon::no_cache($r);
1.2 www 451: $r->send_http_header;
1.21 www 452:
1.18 albertel 453: my $date=localtime;
1.21 www 454: my $now=time;
455: # ----------------------------------------- Get email status and discussiontime
456:
457: my %emailstatus=&Apache::lonnet::dump('email_status');
458: my $logouttime=$emailstatus{'logout'};
459: my $courseleave=
460: $emailstatus{'logout_'.$ENV{'request.course.id'}};
461: my $lastcheck=
462: ($courseleave>$logouttime?$courseleave:$logouttime);
463:
464: my %discussiontimes=&Apache::lonnet::dump(
465: 'discussiontimes',
466: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
467: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
1.22 www 468:
469: my %feedback=();
470: my %error=();
471: foreach my $msgid (
472: split(/\&/,&Apache::lonnet::reply('keys:'.
473: $ENV{'user.domain'}.':'.
474: $ENV{'user.name'}.':nohist_email',
475: $ENV{'user.home'}))) {
476: $msgid=&Apache::lonnet::unescape($msgid);
477: my $plain=&Apache::lonnet::unescape(
478: &Apache::lonnet::unescape($msgid));
479: if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) {
480: my ($what,$url)=($1,$2);
481: my %status=
482: &Apache::lonnet::get('email_status',[$msgid]);
483: if ($status{$msgid}=~/^error\:/) {
484: $status{$msgid}='';
485: }
486:
487: if (($status{$msgid} eq 'new') ||
488: (!$status{$msgid})) {
489: if ($what eq 'Error') {
490: $error{$url}.=','.$msgid;
491: } else {
492: $feedback{$url}.=','.$msgid;
493: }
494: }
495: }
496: }
497: # ----------------------------------------------------------- Start Page Output
1.2 www 498: $r->print(
1.19 albertel 499: '<html><head><title>Navigate LON-CAPA Maps</title></head>');
1.13 www 500: $r->print('<body bgcolor="#FFFFFF"');
1.14 www 501: if (($currenturl=~/^\/res/) &&
502: ($currenturl!~/^\/res\/adm/)) {
1.13 www 503: $r->print(' onLoad="window.location.hash='.
504: "'curloc'".'"');
505: }
506: $r->print('><script>window.focus();</script>'.
1.6 www 507: '<img align=right src=/adm/lonIcons/lonlogos.gif>'.
1.21 www 508: '<h1>Navigate Course Map</h1>'.
509: "<h3>$date</h3>");
1.13 www 510: $r->rflush();
1.23 www 511: $r->print(
512: '<img src="/adm/lonMisc/chat.gif"> New discussion since '.
513: localtime($lastcheck).
514: '<br><img src="/adm/lonMisc/feedback.gif"> New message (click to open)<p>');
1.14 www 515: if (($currenturl=~/^\/res/) &&
516: ($currenturl!~/^\/res\/adm/)) {
1.13 www 517: $r->print('<a href="#curloc">Current Location</a><p>');
518: }
519: # ----------------------------------------------------- The little content list
520: for ($i=0;$i<=$#rows;$i++) {
521: if ($rows[$i]) {
522: my @colcont=split(/\&/,$rows[$i]);
523: my $avespan=$lcm/($#colcont+1);
524: for ($j=0;$j<=$#colcont;$j++) {
525: my $rid=$colcont[$j];
526: if ($rid=~/^h(.+)/) {
527: $rid=$1;
528: $r->print(
529: ' <a href="#'.$rid.'">'.$hash{'title_'.$rid}.'</a><br>');
530: }
531: }
532: }
533: }
1.2 www 534: # ----------------------------------------------------------------- Start table
1.14 www 535: $r->print('<hr><table cols="'.$lcm.'" border="0">');
1.2 www 536: for ($i=0;$i<=$#rows;$i++) {
537: if ($rows[$i]) {
538: $r->print("\n<tr>");
539: my @colcont=split(/\&/,$rows[$i]);
540: my $avespan=$lcm/($#colcont+1);
541: for ($j=0;$j<=$#colcont;$j++) {
542: my $rid=$colcont[$j];
1.6 www 543: my $add='<td> ';
1.7 www 544: my $adde='</td>';
545: my $hwk='<font color="#223322">';
546: my $hwke='</font>';
1.6 www 547: if ($rid=~/^h(.+)/) {
548: $rid=$1;
1.13 www 549: $add=
550: '<th bgcolor="#AAFF55"><a name="'.$rid.'">';
1.7 www 551: $adde='</th>';
552: }
1.11 www 553: if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) {
1.7 www 554: my $code=$1;
1.11 www 555: my $tcode=$2;
556: my $ctext=$3;
557: $rid=$4;
558: if ($tcode eq '1') {
559: $add='<td bgcolor="#AAAAAA">';
560: }
561: if ($code eq '3') {
562: $add='<td bgcolor="#AAFFAA">';
563: } else {
564: $add='<td bgcolor="#FFAAAA">';
565: if ($tcode eq '2') {
566: $add='<td bgcolor="#FFFFAA">';
567: }
568: if ($tcode eq '4') {
569: $add='<td bgcolor="#FFFF33"><blink>';
570: $adde='</blink></td>';
571: }
572: }
1.9 www 573: $hwk='<font color="#888811"><b>';
574: $hwke='</b></font>';
1.10 www 575: if ($code eq '1') {
576: $hwke='</b> ('.$ctext.')</font>';
577: }
1.7 www 578: if ($code eq '2') {
1.9 www 579: $hwk='<font color="#992222"><b>';
580: $hwke='</b> ('.$ctext.')</font>';
1.7 www 581: }
582: if ($code eq '3') {
1.9 www 583: $hwk='<font color="#229922"><b>';
584: $hwke='</b> ('.$ctext.')</font>';
1.7 www 585: }
1.6 www 586: }
1.13 www 587: if ($hash{'src_'.$rid} eq $currenturl) {
588: $add=$add.'<a name="curloc"></a>'.
1.21 www 589: '<font color=red size=+2><b>> </b></font>';
1.13 www 590: $adde=
1.21 www 591: '<font color=red size=+2><b> <</b></font>'.$adde;
592: }
1.22 www 593: my $src=
594: &Apache::lonnet::declutter($hash{'src_'.$rid});
1.21 www 595: $rid=~/^(\d+)\.(\d+)$/;
1.22 www 596: my $symb=
597: &Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.$src;
1.21 www 598: if ($discussiontimes{$symb}>$lastcheck) {
599: $adde=
600: '<img border=0 src="/adm/lonMisc/chat.gif">'.
601: $adde;
1.22 www 602: }
603: if ($error{$src}) {
604: foreach (split(/\,/,$error{$src})) {
605: if ($_) {
606: $adde=
607: ' <a href="/adm/email?display='.
608: &Apache::lonnet::escape($_).
609: '"><img src="/adm/lonMisc/bomb.gif" border=0></a>'
610: .$adde;
611: }
612: }
613: }
614: if ($feedback{$src}) {
615: foreach (split(/\,/,$feedback{$src})) {
616: if ($_) {
617: $adde=
618: ' <a href="/adm/email?display='.
619: &Apache::lonnet::escape($_).
620: '"><img src="/adm/lonMisc/feedback.gif" border=0></a>'
621: .$adde;
622: }
623: }
1.13 www 624: }
1.7 www 625: $r->print($add.'<a href="'.$hash{'src_'.$rid}.
626: '">'.$hwk.
627: $hash{'title_'.$rid}.$hwke.'</a>'.$adde);
1.2 www 628: }
629: $r->print('</tr>');
630: }
631: }
632: $r->print("\n</table>");
633: $r->print('</body></html>');
634: # -------------------------------------------------------------------- End page
635: }
636: # ------------------------------------------------------------- End render page
637: } else {
638: $r->content_type('text/html');
639: $r->send_http_header;
640: $r->print('<html><body>Coursemap undefined.</body></html>');
641: }
642: # ------------------------------------------------------------------ Untie hash
643: unless (untie(%hash)) {
644: &Apache::lonnet::logthis("<font color=blue>WARNING: ".
645: "Could not untie coursemap $fn (browse).</font>");
1.10 www 646: }
647: unless (untie(%parmhash)) {
648: &Apache::lonnet::logthis("<font color=blue>WARNING: ".
649: "Could not untie parmhash (browse).</font>");
1.2 www 650: }
651: # -------------------------------------------------------------------- All done
652: return OK;
653: # ----------------------------------------------- Errors, hash could no be tied
654: }
655: }
656: }
1.3 www 657:
1.2 www 658: $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
659: return HTTP_NOT_ACCEPTABLE;
660: }
1.1 www 661:
662: 1;
663: __END__
1.2 www 664:
665:
666:
667:
668:
669:
670:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>