Annotation of loncom/interface/lonnavmaps.pm, revision 1.22
1.2 www 1: # The LearningOnline Network with CAPA
2: # Navigate Maps Handler
1.1 www 3: #
1.21 www 4: # $Id: lonnavmaps.pm,v 1.20 2001/12/19 17:17:46 albertel 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
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=
115: $usercourseprefix.'.['.
116: $csec.'].'.$what;
117: my $seclevelr=
118: $usercourseprefix.'.['.
119: $csec.'].'.$symbparm;
120: my $seclevelm=
121: $usercourseprefix.'.['.
122: $csec.'].'.$mapparm;
123:
124: my $courselevel=
125: $usercourseprefix.'.'.$what;
126: my $courselevelr=
127: $usercourseprefix.'.'.$symbparm;
128: my $courselevelm=
129: $usercourseprefix.'.'.$mapparm;
130:
131: # ---------------------------------------------------------- fourth, check user
132:
133: if ($uname) {
134:
135: if ($useropt{$courselevelr}) { return $useropt{$courselevelr}; }
136:
137: if ($useropt{$courselevelm}) { return $useropt{$courselevelm}; }
138:
139: if ($useropt{$courselevel}) { return $useropt{$courselevel}; }
140:
141: }
142:
143: # --------------------------------------------------------- third, check course
144:
145: if ($csec) {
146:
147: if ($courseopt{$seclevelr}) { return $courseopt{$seclevelr}; }
148:
149: if ($courseopt{$seclevelm}) { return $courseopt{$seclevelm}; }
150:
151: if ($courseopt{$seclevel}) { return $courseopt{$seclevel}; }
152:
153: }
154:
155: if ($courseopt{$courselevelr}) { return $courseopt{$courselevelr}; }
156:
157: if ($courseopt{$courselevelm}) { return $courseopt{$courselevelm}; }
158:
159: if ($courseopt{$courselevel}) { return $courseopt{$courselevel}; }
160:
161: # ----------------------------------------------------- second, check map parms
162:
163: my $thisparm=$parmhash{$symbparm};
164: if ($thisparm) { return $thisparm; }
165:
166: # -------------------------------------------------------- first, check default
167:
168: return &Apache::lonnet::metadata($fn,$rwhat.'.default');
169:
170: }
171:
172:
173:
1.9 www 174: # ------------------------------------------------------------- Find out status
175:
176: sub astatus {
177: my $rid=shift;
178: my $code=1;
179: my $ctext='';
180: $rid=~/(\d+)\.(\d+)/;
1.10 www 181: my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.
182: &Apache::lonnet::declutter($hash{'src_'.$rid});
1.15 www 183:
184: my %duedate=();
185: my %opendate=();
186: my %answerdate=();
187: map {
188: if ($_=~/^parameter\_(.*)\_opendate$/) {
189: my $part=$1;
190: $duedate{$part}=&parmval($part.'.duedate',$symb);
191: $opendate{$part}=&parmval($part.'.opendate',$symb);
192: $answerdate{$part}=&parmval($part.'.answerdate',$symb);
193: }
194: } sort split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'keys'));
195:
1.11 www 196: my $now=time;
197: my $tcode=0;
1.16 www 198:
199: my %returnhash=&Apache::lonnet::restore($symb);
200:
201: map {
202:
203: my $duedate=$duedate{$_};
204: my $opendate=$opendate{$_};
205: my $answerdate=$answerdate{$_};
206: my $preface='';
207: unless ($_ eq '0') { $preface=' Part: '.$_.' '; }
1.12 www 208: if ($opendate) {
1.11 www 209: if ($now<$duedate) {
1.16 www 210: unless ($tcode==4) { $tcode=2; }
211: $ctext.=$preface.'Due: '.localtime($duedate);
1.11 www 212: if ($now<$opendate) {
1.16 www 213: unless ($tcode) { $tcode=1; }
214: $ctext.=$preface.'Open: '.localtime($opendate);
1.11 www 215: }
216: if ($duedate-$now<86400) {
217: $tcode=4;
1.16 www 218: $ctext.=$preface.'Due: '.localtime($duedate);
1.11 www 219: }
220: } else {
1.16 www 221: unless (($tcode==4) || ($tcode eq 2)) { $tcode=3; }
1.11 www 222: if ($now<$answerdate) {
1.16 www 223: $ctext.='Answer: '.localtime($duedate);
1.11 www 224: }
1.10 www 225: }
1.12 www 226: } else {
1.16 www 227: unless (($tcode==2) || ($tcode==4)) { $tcode=1; }
1.12 www 228: }
1.16 www 229:
230: my $status=$returnhash{'resource.'.$_.'.solved'};
231:
232: if ($status eq 'correct_by_student') {
1.9 www 233: unless ($code==2) { $code=3; }
1.16 www 234: $ctext.=' solved';
235: } elsif ($status eq 'correct_by_override') {
1.9 www 236: unless ($code==2) { $code=3; }
1.16 www 237: $ctext.=' override';
238: } elsif ($status eq 'incorrect_attempted') {
1.9 www 239: $code=2;
1.16 www 240: $ctext.=' ('.
1.17 www 241: ($returnhash{'resource.'.$_.'.tries'}?
242: $returnhash{'resource.'.$_.'.tries'}:'0').'/'.
1.16 www 243: &parmval($_.'.maxtries',$symb).' tries)';
244: } elsif ($status eq 'incorrect_by_override') {
1.9 www 245: $code=2;
1.16 www 246: $ctext.=' override';
247: } elsif ($status eq 'excused') {
1.9 www 248: unless ($code==2) { $code=3; }
1.16 www 249: $ctext.=' excused';
1.9 www 250: }
1.16 www 251:
1.17 www 252: } sort keys %opendate;
1.16 www 253:
1.11 www 254: return 'p'.$code.$tcode.'"'.$ctext.'"';
1.9 www 255: }
256:
1.2 www 257: # ------------------------------------------------------------ Build page table
258:
259: sub tracetable {
260: my ($sofar,$rid,$beenhere)=@_;
261: my $further=$sofar;
262: unless ($beenhere=~/\&$rid\&/) {
263: $beenhere.=$rid.'&';
264:
265: if (defined($hash{'is_map_'.$rid})) {
1.7 www 266: $sofar++;
267: my $tprefix='';
268: if ($hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$rid}}}
269: eq 'sequence') {
270: $tprefix='h';
271: }
1.6 www 272: if (defined($rows[$sofar])) {
1.7 www 273: $rows[$sofar].='&'.$tprefix.$rid;
1.6 www 274: } else {
1.7 www 275: $rows[$sofar]=$tprefix.$rid;
1.6 www 276: }
1.2 www 277: if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
1.7 www 278: (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) &&
279: ($tprefix eq 'h')) {
1.2 www 280: my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
281: $sofar=
282: &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
283: '&'.$frid.'&');
284: $sofar++;
285: if ($hash{'src_'.$frid}) {
286: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
287: if (($brepriv eq '2') || ($brepriv eq 'F')) {
1.7 www 288: my $pprefix='';
1.9 www 289: if ($hash{'src_'.$frid}=~
290: /\.(problem|exam|quiz|assess|survey|form)$/) {
291: $pprefix=&astatus($frid);
292:
1.7 www 293: }
1.2 www 294: if (defined($rows[$sofar])) {
1.7 www 295: $rows[$sofar].='&'.$pprefix.$frid;
1.2 www 296: } else {
1.7 www 297: $rows[$sofar]=$pprefix.$frid;
1.2 www 298: }
299: }
300: }
301: }
302: } else {
303: $sofar++;
304: if ($hash{'src_'.$rid}) {
305: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
306: if (($brepriv eq '2') || ($brepriv eq 'F')) {
1.7 www 307: my $pprefix='';
1.9 www 308: if ($hash{'src_'.$rid}=~
309: /\.(problem|exam|quiz|assess|survey|form)$/) {
310: $pprefix=&astatus($rid);
1.7 www 311: }
1.2 www 312: if (defined($rows[$sofar])) {
1.7 www 313: $rows[$sofar].='&'.$pprefix.$rid;
1.2 www 314: } else {
1.7 www 315: $rows[$sofar]=$pprefix.$rid;
1.2 www 316: }
317: }
318: }
319: }
320:
321: if (defined($hash{'to_'.$rid})) {
322: my $mincond=1;
323: my $next='';
324: map {
325: my $thiscond=
326: &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
327: if ($thiscond>=$mincond) {
328: if ($next) {
329: $next.=','.$_.':'.$thiscond;
330: } else {
331: $next=$_.':'.$thiscond;
332: }
333: if ($thiscond>$mincond) { $mincond=$thiscond; }
334: }
335: } split(/\,/,$hash{'to_'.$rid});
336: map {
337: my ($linkid,$condval)=split(/\:/,$_);
338: if ($condval>=$mincond) {
339: my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
340: if ($now>$further) { $further=$now; }
341: }
342: } split(/\,/,$next);
343:
344: }
345: }
346: return $further;
347: }
348:
349: # ================================================================ Main Handler
1.1 www 350:
351: sub handler {
1.2 www 352: my $r=shift;
353:
354:
355: # ------------------------------------------- Set document type for header only
356:
357: if ($r->header_only) {
358: if ($ENV{'browser.mathml'}) {
359: $r->content_type('text/xml');
360: } else {
361: $r->content_type('text/html');
362: }
363: $r->send_http_header;
364: return OK;
365: }
366:
367: my $requrl=$r->uri;
368: # ----------------------------------------------------------------- Tie db file
369: if ($ENV{'request.course.fn'}) {
370: my $fn=$ENV{'request.course.fn'};
371: if (-e "$fn.db") {
1.10 www 372: if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER,0640)) &&
373: (tie(%parmhash,'GDBM_File',
374: $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) {
1.2 www 375: # ------------------------------------------------------------------- Hash tied
376: my $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}};
377: my $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}};
378: if (($firstres) && ($lastres)) {
379: # ----------------------------------------------------------------- Render page
1.10 www 380: # -------------------------------------------------------------- Set parameters
381:
382:
383: # ---------------------------- initialize coursedata and userdata for this user
384: undef %courseopt;
385: undef %useropt;
386:
387: my $uname=$ENV{'user.name'};
388: my $udom=$ENV{'user.domain'};
389: my $uhome=$ENV{'user.home'};
390: my $cid=$ENV{'request.course.id'};
391: my $chome=$ENV{'course.'.$cid.'.home'};
392: my ($cdom,$cnum)=split(/\_/,$cid);
393:
394: my $userprefix=$uname.'_'.$udom.'_';
395:
396: unless ($uhome eq 'no_host') {
397: # -------------------------------------------------------------- Get coursedata
398: unless
399: ((time-$courserdatas{$cid.'.last_cache'})<240) {
400: my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.
401: ':resourcedata',$chome);
402: if ($reply!~/^error\:/) {
403: $courserdatas{$cid}=$reply;
404: $courserdatas{$cid.'.last_cache'}=time;
405: }
406: }
407: map {
408: my ($name,$value)=split(/\=/,$_);
409: $courseopt{$userprefix.&Apache::lonnet::unescape($name)}=
410: &Apache::lonnet::unescape($value);
411: } split(/\&/,$courserdatas{$cid});
412: # --------------------------------------------------- Get userdata (if present)
413: unless
414: ((time-$userrdatas{$uname.'___'.$udom.'.last_cache'})<240) {
415: my $reply=
416: &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);
417: if ($reply!~/^error\:/) {
418: $userrdatas{$uname.'___'.$udom}=$reply;
419: $userrdatas{$uname.'___'.$udom.'.last_cache'}=time;
420: }
421: }
422: map {
423: my ($name,$value)=split(/\=/,$_);
424: $useropt{$userprefix.&Apache::lonnet::unescape($name)}=
425: &Apache::lonnet::unescape($value);
426: } split(/\&/,$userrdatas{$uname.'___'.$udom});
427: }
1.2 www 428:
429: @rows=();
430:
431: &tracetable(0,$firstres,'&'.$lastres.'&');
432: if ($hash{'src_'.$lastres}) {
433: my $brepriv=
434: &Apache::lonnet::allowed('bre',$hash{'src_'.$lastres});
435: if (($brepriv eq '2') || ($brepriv eq 'F')) {
436: $rows[$#rows+1]=''.$lastres;
437: }
438: }
439:
440: # ------------------------------------------------------------------ Page parms
441:
442: my $j;
1.5 www 443: my $i;
1.2 www 444: my $lcm=1;
445: my $contents=0;
446:
447: # ---------------------------------------------- Go through table to get layout
448:
449: for ($i=0;$i<=$#rows;$i++) {
450: if ($rows[$i]) {
451: $contents++;
452: my @colcont=split(/\&/,$rows[$i]);
453: $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
454: }
455: }
1.5 www 456:
1.2 www 457:
458: unless ($contents) {
459: $r->content_type('text/html');
460: $r->send_http_header;
461: $r->print('<html><body>Empty Map.</body></html>');
462: } else {
1.10 www 463:
1.2 www 464: # ------------------------------------------------------------------ Build page
465:
1.13 www 466: my $currenturl=$ENV{'form.postdata'};
467: $currenturl=~s/^http\:\/\///;
468: $currenturl=~s/^[^\/]+//;
469:
1.2 www 470: # ---------------------------------------------------------------- Send headers
471:
472: $r->content_type('text/html');
1.19 albertel 473: &Apache::loncommon::no_cache($r);
1.2 www 474: $r->send_http_header;
1.21 www 475:
1.18 albertel 476: my $date=localtime;
1.21 www 477: my $now=time;
478: # ----------------------------------------- Get email status and discussiontime
479:
480: my %emailstatus=&Apache::lonnet::dump('email_status');
481: my $logouttime=$emailstatus{'logout'};
482: my $courseleave=
483: $emailstatus{'logout_'.$ENV{'request.course.id'}};
484: my $lastcheck=
485: ($courseleave>$logouttime?$courseleave:$logouttime);
486:
487: my %discussiontimes=&Apache::lonnet::dump(
488: 'discussiontimes',
489: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
490: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
1.22 ! www 491:
! 492: my %feedback=();
! 493: my %error=();
! 494: foreach my $msgid (
! 495: split(/\&/,&Apache::lonnet::reply('keys:'.
! 496: $ENV{'user.domain'}.':'.
! 497: $ENV{'user.name'}.':nohist_email',
! 498: $ENV{'user.home'}))) {
! 499: $msgid=&Apache::lonnet::unescape($msgid);
! 500: my $plain=&Apache::lonnet::unescape(
! 501: &Apache::lonnet::unescape($msgid));
! 502: if ($plain=~/(Error|Feedback) \[([^\]]+)\]/) {
! 503: my ($what,$url)=($1,$2);
! 504: my %status=
! 505: &Apache::lonnet::get('email_status',[$msgid]);
! 506: if ($status{$msgid}=~/^error\:/) {
! 507: $status{$msgid}='';
! 508: }
! 509:
! 510: if (($status{$msgid} eq 'new') ||
! 511: (!$status{$msgid})) {
! 512: if ($what eq 'Error') {
! 513: $error{$url}.=','.$msgid;
! 514: } else {
! 515: $feedback{$url}.=','.$msgid;
! 516: }
! 517: }
! 518: }
! 519: }
! 520: # ----------------------------------------------------------- Start Page Output
1.2 www 521: $r->print(
1.19 albertel 522: '<html><head><title>Navigate LON-CAPA Maps</title></head>');
1.13 www 523: $r->print('<body bgcolor="#FFFFFF"');
1.14 www 524: if (($currenturl=~/^\/res/) &&
525: ($currenturl!~/^\/res\/adm/)) {
1.13 www 526: $r->print(' onLoad="window.location.hash='.
527: "'curloc'".'"');
528: }
529: $r->print('><script>window.focus();</script>'.
1.6 www 530: '<img align=right src=/adm/lonIcons/lonlogos.gif>'.
1.21 www 531: '<h1>Navigate Course Map</h1>'.
532: "<h3>$date</h3>");
1.13 www 533: $r->rflush();
1.14 www 534: if (($currenturl=~/^\/res/) &&
535: ($currenturl!~/^\/res\/adm/)) {
1.13 www 536: $r->print('<a href="#curloc">Current Location</a><p>');
537: }
538: # ----------------------------------------------------- The little content list
539: for ($i=0;$i<=$#rows;$i++) {
540: if ($rows[$i]) {
541: my @colcont=split(/\&/,$rows[$i]);
542: my $avespan=$lcm/($#colcont+1);
543: for ($j=0;$j<=$#colcont;$j++) {
544: my $rid=$colcont[$j];
545: if ($rid=~/^h(.+)/) {
546: $rid=$1;
547: $r->print(
548: ' <a href="#'.$rid.'">'.$hash{'title_'.$rid}.'</a><br>');
549: }
550: }
551: }
552: }
1.2 www 553: # ----------------------------------------------------------------- Start table
1.14 www 554: $r->print('<hr><table cols="'.$lcm.'" border="0">');
1.2 www 555: for ($i=0;$i<=$#rows;$i++) {
556: if ($rows[$i]) {
557: $r->print("\n<tr>");
558: my @colcont=split(/\&/,$rows[$i]);
559: my $avespan=$lcm/($#colcont+1);
560: for ($j=0;$j<=$#colcont;$j++) {
561: my $rid=$colcont[$j];
1.6 www 562: my $add='<td> ';
1.7 www 563: my $adde='</td>';
564: my $hwk='<font color="#223322">';
565: my $hwke='</font>';
1.6 www 566: if ($rid=~/^h(.+)/) {
567: $rid=$1;
1.13 www 568: $add=
569: '<th bgcolor="#AAFF55"><a name="'.$rid.'">';
1.7 www 570: $adde='</th>';
571: }
1.11 www 572: if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) {
1.7 www 573: my $code=$1;
1.11 www 574: my $tcode=$2;
575: my $ctext=$3;
576: $rid=$4;
577: if ($tcode eq '1') {
578: $add='<td bgcolor="#AAAAAA">';
579: }
580: if ($code eq '3') {
581: $add='<td bgcolor="#AAFFAA">';
582: } else {
583: $add='<td bgcolor="#FFAAAA">';
584: if ($tcode eq '2') {
585: $add='<td bgcolor="#FFFFAA">';
586: }
587: if ($tcode eq '4') {
588: $add='<td bgcolor="#FFFF33"><blink>';
589: $adde='</blink></td>';
590: }
591: }
1.9 www 592: $hwk='<font color="#888811"><b>';
593: $hwke='</b></font>';
1.10 www 594: if ($code eq '1') {
595: $hwke='</b> ('.$ctext.')</font>';
596: }
1.7 www 597: if ($code eq '2') {
1.9 www 598: $hwk='<font color="#992222"><b>';
599: $hwke='</b> ('.$ctext.')</font>';
1.7 www 600: }
601: if ($code eq '3') {
1.9 www 602: $hwk='<font color="#229922"><b>';
603: $hwke='</b> ('.$ctext.')</font>';
1.7 www 604: }
1.6 www 605: }
1.13 www 606: if ($hash{'src_'.$rid} eq $currenturl) {
607: $add=$add.'<a name="curloc"></a>'.
1.21 www 608: '<font color=red size=+2><b>> </b></font>';
1.13 www 609: $adde=
1.21 www 610: '<font color=red size=+2><b> <</b></font>'.$adde;
611: }
1.22 ! www 612: my $src=
! 613: &Apache::lonnet::declutter($hash{'src_'.$rid});
1.21 www 614: $rid=~/^(\d+)\.(\d+)$/;
1.22 ! www 615: my $symb=
! 616: &Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.$src;
1.21 www 617: if ($discussiontimes{$symb}>$lastcheck) {
618: $adde=
619: '<img border=0 src="/adm/lonMisc/chat.gif">'.
620: $adde;
1.22 ! www 621: }
! 622: if ($error{$src}) {
! 623: foreach (split(/\,/,$error{$src})) {
! 624: if ($_) {
! 625: $adde=
! 626: ' <a href="/adm/email?display='.
! 627: &Apache::lonnet::escape($_).
! 628: '"><img src="/adm/lonMisc/bomb.gif" border=0></a>'
! 629: .$adde;
! 630: }
! 631: }
! 632: }
! 633: if ($feedback{$src}) {
! 634: foreach (split(/\,/,$feedback{$src})) {
! 635: if ($_) {
! 636: $adde=
! 637: ' <a href="/adm/email?display='.
! 638: &Apache::lonnet::escape($_).
! 639: '"><img src="/adm/lonMisc/feedback.gif" border=0></a>'
! 640: .$adde;
! 641: }
! 642: }
1.13 www 643: }
1.7 www 644: $r->print($add.'<a href="'.$hash{'src_'.$rid}.
645: '">'.$hwk.
646: $hash{'title_'.$rid}.$hwke.'</a>'.$adde);
1.2 www 647: }
648: $r->print('</tr>');
649: }
650: }
651: $r->print("\n</table>");
652: $r->print('</body></html>');
653: # -------------------------------------------------------------------- End page
654: }
655: # ------------------------------------------------------------- End render page
656: } else {
657: $r->content_type('text/html');
658: $r->send_http_header;
659: $r->print('<html><body>Coursemap undefined.</body></html>');
660: }
661: # ------------------------------------------------------------------ Untie hash
662: unless (untie(%hash)) {
663: &Apache::lonnet::logthis("<font color=blue>WARNING: ".
664: "Could not untie coursemap $fn (browse).</font>");
1.10 www 665: }
666: unless (untie(%parmhash)) {
667: &Apache::lonnet::logthis("<font color=blue>WARNING: ".
668: "Could not untie parmhash (browse).</font>");
1.2 www 669: }
670: # -------------------------------------------------------------------- All done
671: return OK;
672: # ----------------------------------------------- Errors, hash could no be tied
673: }
674: }
675: }
1.3 www 676:
1.2 www 677: $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
678: return HTTP_NOT_ACCEPTABLE;
679: }
1.1 www 680:
681: 1;
682: __END__
1.2 www 683:
684:
685:
686:
687:
688:
689:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>