Annotation of loncom/interface/lonexttool.pm, revision 1.14
1.1 raeburn 1: # The LearningOnline Network with CAPA
2: # Launch External Tool Provider (LTI)
3: #
1.14 ! raeburn 4: # $Id: lonexttool.pm,v 1.13 2017/12/30 00:16:29 raeburn Exp $
1.1 raeburn 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: #
28:
29: =pod
30:
31: =head1 NAME
32:
33: Apache::lonexttool - Tool Provider launcher
34:
35: =head1 SYNOPSIS
36:
37:
38: =head1 OVERVIEW
39:
40: =cut
41:
42: package Apache::lonexttool;
43:
44: use strict;
45: use Apache::Constants qw(:common :http);
46: use Encode;
47: use Digest::SHA;
48: use HTML::Entities;
49: use Apache::lonlocal;
50: use Apache::lonnet;
51: use Apache::loncommon;
1.12 raeburn 52: use Apache::londatecheck;
53: use Apache::lonipcheck;
54: use Apache::lonhomework;
55: use Apache::structuretags;
1.9 raeburn 56: use LONCAPA::ltiutils;
1.1 raeburn 57:
58: sub handler {
59: my $r=shift;
60: &Apache::loncommon::content_type($r,'text/html');
61: $r->send_http_header;
62:
63: return OK if $r->header_only;
64:
65: my $target=$env{'form.grade_target'};
66: # ------------------------------------------------------------ Print the screen
67: if ($target eq 'tex') {
68: $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
1.12 raeburn 69: } else {
70: $target = 'web';
1.1 raeburn 71: }
72:
73: # Is this even in a course?
74: unless ($env{'request.course.id'}) {
75: if ($target ne 'tex') {
1.11 raeburn 76: &Apache::loncommon::simple_error_page($r,'','Not in a course',
77: {'only_body' => 1});
1.1 raeburn 78: } else {
79: $r->print('\textbf{Not in a course}\end{document}');
80: }
81: return OK;
82: }
83:
1.3 raeburn 84: my ($marker,$exttool) = (split(m{/},$r->uri))[4,5];
1.1 raeburn 85: $marker=~s/\D//g;
86:
87: if (!$marker) {
88: if ($target ne 'tex') {
1.3 raeburn 89: $r->print(&mt('Invalid Call'));
1.1 raeburn 90: } else {
1.3 raeburn 91: $r->print('\textbf{'&mt('Invalid Call').'}\end{document}');
1.1 raeburn 92: }
93: return OK;
94: }
95:
96: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
97: my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
98: my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
1.12 raeburn 99: my ($idx,$is_tool,%toolhash,%toolsettings);
1.1 raeburn 100:
1.3 raeburn 101: if ($r->uri eq "/adm/$cdom/$cnum/$marker/$exttool") {
1.12 raeburn 102: %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$cdom,$cnum);
1.3 raeburn 103: if ($toolsettings{'id'}) {
1.12 raeburn 104: $idx = $toolsettings{'id'};
1.7 raeburn 105: my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
1.6 raeburn 106: if (ref($ltitools{$idx}) eq 'HASH') {
1.12 raeburn 107: %toolhash = %{$ltitools{$idx}};
1.3 raeburn 108: $toolhash{'display'} = {
109: target => $toolsettings{'target'},
110: width => $toolsettings{'width'},
111: height => $toolsettings{'height'},
112: };
1.4 raeburn 113: $toolhash{'crslabel'} = $toolsettings{'crslabel'};
114: $toolhash{'crstitle'} = $toolsettings{'crstitle'};
1.5 raeburn 115: $toolhash{'crsappend'} = $toolsettings{'crsappend'};
1.12 raeburn 116: $toolhash{'gradable'} = $toolsettings{'gradable'};
1.3 raeburn 117: $is_tool = 1;
1.1 raeburn 118: }
119: }
1.3 raeburn 120: }
121: unless ($is_tool) {
1.1 raeburn 122: if ($target ne 'tex') {
1.3 raeburn 123: $r->print('<div>'.&mt('Invalid Call').'</div>');
1.1 raeburn 124: } else {
1.3 raeburn 125: $r->print('\textbf{'.&mt(Invalid Call).'}\end{document}');
1.1 raeburn 126: }
1.12 raeburn 127: return OK;
128: }
129:
1.13 raeburn 130: my ($status,$open,$close,$msg,$donebuttonresult,$donemsg);
1.12 raeburn 131: if ($toolhash{'gradable'}) {
132: $Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$r->uri);
1.13 raeburn 133: my ($symb) = &Apache::lonnet::whichuser();
1.12 raeburn 134: if ($env{'form.markaccess'}) {
1.13 raeburn 135: my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb);
1.12 raeburn 136: my ($timelimit) = split(/_/,$interval[0]);
137: &Apache::lonnet::set_first_access($interval[1],$timelimit);
1.13 raeburn 138: } elsif ($symb && $env{'form.LC_interval_done'} eq 'true') {
139: # Set the event timer to zero if the "done button" was clicked. The button is
140: # part of the doneButton form created in lonmenu.pm
141: ($donebuttonresult,$donemsg) = &Apache::lonhomework::zero_timer($symb);
142: undef($env{'form.LC_interval_done'});
143: undef($env{'form.LC_interval_done_proctorpass'});
1.12 raeburn 144: }
145: ($status,$msg) = &gradabletool_access_check();
146: undef($Apache::lonhomework::browse);
147: if ($status eq 'SHOW_ANSWER') {
148: $r->print(&display_score());
149: return OK;
150: } elsif ($status ne 'CAN_ANSWER') {
151: $r->print($msg);
152: return OK;
153: }
154: } else {
155: my ($status,$open,$close,$msg)=&Apache::londatecheck::content_date_check();
156: if ($status ne 'OPEN') {
157: if ($target eq 'tex') {
158: $r->print(&mt('Not open to be viewed'));
159: } else {
160: $r->print($msg);
161: }
162: return OK;
163: } else {
164: ($status,$msg)=&Apache::lonipcheck::ip_access_check();
165: if ($status ne 'OPEN') {
166: if ($target eq 'tex') {
167: $r->print(&mt('Not open to be viewed'));
168: } else {
169: $r->print($msg);
170: }
171: return OK;
172: }
173: }
174: }
175: my $launchok = 1;
176: if ($target eq 'tex') {
177: $r->print(&mt('External Tool'));
178: } else {
179: my $now = time;
180: if ($toolhash{'passback'}) {
181: if (&LONCAPA::ltiutils::set_service_secret($cdom,$cnum,$marker,'grade',$now,
182: \%toolsettings,\%toolhash) eq 'ok') {
183: $toolhash{'gradesecret'} = $toolsettings{'gradesecret'};
184: } else {
185: undef($launchok);
186: }
187: }
188: if ($toolhash{'roster'}) {
189: if (&LONCAPA::ltiutils::set_service_secret($cdom,$cnum,$marker,'roster',$now,
190: \%toolsettings,\%toolhash) eq 'ok') {
191: $toolhash{'rostersecret'} = $toolsettings{'rostersecret'};
192: }
193: }
194: my $submittext = &mt('Launch [_1]',$toolhash{'title'});
195: if (($toolhash{'key'} ne '') && ($toolhash{'secret'} ne '') &&
196: ($toolhash{'url'} ne '') && ($launchok)) {
197: my %lti = <i_params($r,$cnum,$cdom,$idx,$submittext,\%toolhash);
198: my $url = $toolhash{'url'};
199: if ($toolhash{'crsappend'} ne '') {
200: $url .= $toolhash{'crsappend'};
201: }
202: $r->print(&launch_html($url,$toolhash{'key'},$toolhash{'secret'},
1.14 ! raeburn 203: $toolhash{'sigmethod'},$submittext,\%lti));
1.12 raeburn 204: } else {
205: $r->print('<div>'.&mt('External Tool Unavailable').'</div>');
206: }
1.1 raeburn 207: }
208: return OK;
209: }
210:
211: sub lti_params {
1.6 raeburn 212: my ($r,$cnum,$cdom,$idx,$submittext,$toolsref) = @_;
1.1 raeburn 213: my ($version,$context_type,$msgtype,$toolname,$passback,$roster,$locale,
1.6 raeburn 214: $crslabel,$crstitle,$gradesecret,$rostersecret,%fields,%rolesmap,
215: %display,%custom,@userlangs);
1.1 raeburn 216: if (ref($toolsref) eq 'HASH') {
217: $version = $toolsref->{'version'};
218: $toolname = $toolsref->{'title'};
219: $passback = $toolsref->{'passback'};
1.6 raeburn 220: $gradesecret = $toolsref->{'gradesecret'};
1.1 raeburn 221: $roster = $toolsref->{'roster'};
1.6 raeburn 222: $rostersecret = $toolsref->{'rostersecret'};
1.1 raeburn 223: $msgtype = $toolsref->{'messagetype'};
224: if (ref($toolsref->{'fields'}) eq 'HASH') {
225: %fields = %{$toolsref->{'fields'}};
226: }
227: if (ref($toolsref->{'roles'}) eq 'HASH') {
228: %rolesmap = %{$toolsref->{'roles'}};
229: }
230: if (ref($toolsref->{'display'}) eq 'HASH') {
231: %display = %{$toolsref->{'display'}};
232: }
233: if (ref($toolsref->{'custom'}) eq 'HASH') {
234: %custom = %{$toolsref->{'custom'}};
235: }
1.4 raeburn 236: $crslabel = $toolsref->{'crslabel'};
237: $crstitle = $toolsref->{'crstitle'};
1.1 raeburn 238: }
239: if ($version eq '') {
240: $version = 'LTI-1p0';
241: }
242: if ($context_type eq '') {
243: $context_type = 'CourseSection';
244: }
245: if ($msgtype eq '') {
246: $msgtype = 'basic-lti-launch-request';
247: }
1.4 raeburn 248: if ($crslabel eq '') {
249: $crslabel = $env{'course.'.$env{'request.course.id'}.'.internal.coursecode'},
250: }
251: if ($crstitle eq '') {
252: $crstitle = $env{'course.'.$env{'request.course.id'}.'.description'},;
253: }
1.1 raeburn 254: my $lonhost = $r->dir_config('lonHostID');
255: my $loncaparev = $r->dir_config('lonVersion');
256: my $uname = $env{'user.name'};
257: my $udom = $env{'user.domain'};
258: my @possroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
1.3 raeburn 259: my ($roleprefix) = ($env{'request.role'} =~ /^(\w+)\./);
260: my $ltirole = $rolesmap{$roleprefix};
1.1 raeburn 261: unless (grep(/^\Q$ltirole\E$/,@possroles)) {
262: $ltirole = 'Learner';
263: }
264: my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
265: $digest_user = &Digest::SHA::sha1_hex($digest_user);
266: if ($env{'course.'.$env{'request.course.id'}.'.languages'} ne '') {
267: @userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/,
268: $env{'course.'.$env{'request.course.id'}.'.languages'}));
269: } else {
1.2 raeburn 270: my %langhash = &Apache::loncommon::getlangs($uname,$udom);
1.1 raeburn 271: if ($langhash{'languages'} ne '') {
272: @userlangs = split(/\s*(\,|\;|\:)\s*/,$langhash{'languages'});
273: } else {
274: my %domdefs = &Apache::lonnet::get_domain_defaults($udom);
275: if ($domdefs{'lang_def'} ne '') {
276: @userlangs = ($domdefs{'lang_def'});
277: }
278: }
279: }
280: if (scalar(@userlangs) == 1) {
281: $locale = $userlangs[0];
282: }
283: my ($title,$digest_symb);
284: my ($symb) = &Apache::lonnet::whichuser();
285: if ($symb) {
286: $digest_symb = &Encode::decode_utf8($symb);
287: $digest_symb = &Digest::SHA::sha1_hex($digest_symb);
288: my $navmap = Apache::lonnavmaps::navmap->new();
289: if (ref($navmap)) {
290: my $res = $navmap->getBySymb($symb);
291: if (ref($res)) {
292: $title = $res->compTitle();
293: }
294: }
295: }
1.4 raeburn 296: my $domdesc = &Apache::lonnet::domain($cdom);
297: my $primary_id = &Apache::lonnet::domain($cdom,'primary');
298: my $int_dom = &Apache::lonnet::internet_dom($primary_id);
299: my $portal_url = &Apache::lonnet::course_portal_url($cnum,$cdom);
300:
1.1 raeburn 301: my %ltiparams = (
302: lti_version => $version,
303: lti_message_type => $msgtype,
304: resource_link_title => $title,
305: resource_link_id => $digest_symb,
306: tool_consumer_instance_guid => $lonhost,
1.4 raeburn 307: tool_consumer_instance_description => $domdesc,
1.1 raeburn 308: tool_consumer_info_product_family_code => 'loncapa',
1.4 raeburn 309: tool_consumer_instance_name => $int_dom,
310: tool_consumer_instance_url => $portal_url,
1.1 raeburn 311: tool_consumer_info_version => $loncaparev,
312: user_id => $digest_user,
313: roles => $ltirole,
314: context_id => $env{'request.course.id'},
315: context_type => $context_type,
1.4 raeburn 316: context_label => $crslabel,
317: context_title => $crstitle,
1.1 raeburn 318: launch_presentation_locale => $locale,
319: );
1.3 raeburn 320: my $crshome = $env{'course.'.$env{'request.course.id'}.'.home'};
321: my $crshostname = &Apache::lonnet::hostname($crshome);
1.1 raeburn 322: if ($crshostname) {
1.3 raeburn 323: my $crsprotocol = $Apache::lonnet::protocol{$crshome};
1.1 raeburn 324: unless ($crsprotocol eq 'https') {
325: $crsprotocol = 'http';
1.6 raeburn 326: }
327: if (($passback) || ($roster)) {
328: if ($passback) {
1.8 raeburn 329: $ltiparams{'lis_outcome_service_url'} = $crsprotocol.'://'.$crshostname.'/adm/service/passback';
1.1 raeburn 330: $ltiparams{'ext_ims_lis_basic_outcome_url'} = $ltiparams{'lis_outcome_service_url'};
1.6 raeburn 331: if ($gradesecret) {
1.9 raeburn 332: my $uniqid = $digest_symb.':::'.$digest_user.':::'.$env{'request.course.id'};
1.10 raeburn 333: $ltiparams{'lis_result_sourcedid'} = &LONCAPA::ltiutils::get_service_id($gradesecret,$uniqid);
1.6 raeburn 334: }
335: }
336: if ($roster) {
337: if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
1.8 raeburn 338: $ltiparams{'ext_ims_lis_memberships_url'} = $crsprotocol.'://'.$crshostname.'/adm/service/roster';
1.6 raeburn 339: if ($rostersecret) {
1.9 raeburn 340: my $uniqid = $digest_symb.':::'.$env{'request.course.id'};
1.10 raeburn 341: $ltiparams{'ext_ims_lis_memberships_id'} = &LONCAPA::ltiutils::get_service_id($rostersecret,$uniqid);
1.6 raeburn 342: }
343: }
344: }
345: my %digesthash;
346: if ($ltiparams{'lis_result_sourcedid'}) {
347: $digesthash{$ltiparams{'lis_result_sourcedid'}} = "$idx\0".time;
348: }
349: if ($ltiparams{'ext_ims_lis_memberships_id'}) {
350: $digesthash{$ltiparams{'ext_ims_lis_memberships_id'}} = "$idx\0".time;
1.1 raeburn 351: }
1.6 raeburn 352: if (($digest_symb) && ($gradesecret || $rostersecret)) {
353: $digesthash{$digest_symb} = $symb;
354: }
355: if (($passback) && ($gradesecret)) {
356: $digesthash{$digest_user} = $uname.':'.$udom;
357: }
358: if (keys(%digesthash)) {
359: &Apache::lonnet::put('exttools',\%digesthash,$cdom,$cnum);
1.1 raeburn 360: }
361: }
362: }
363: if ($display{'target'}) {
364: $ltiparams{'launch_presentation_document_target'} = $display{'target'};
365: }
366: if ($display{'width'}) {
367: $ltiparams{'launch_presentation_width'} = $display{'width'};
368: }
369: if ($display{'height'}) {
370: $ltiparams{'launch_presentation_height'} = $display{'height'};
371: }
372: if ($fields{'firstname'}) {
373: $ltiparams{'lis_person_name_given'} = $env{'environment.firstname'};
374: }
375: if ($fields{'lastname'}) {
376: $ltiparams{'lis_person_name_family'} = $env{'environment.lastname'};
377: }
378: if ($fields{'fullname'}) {
379: $ltiparams{'lis_person_name_full'} = &Apache::loncommon::plainname($uname,$udom);
380: }
381: if ($fields{'email'}) {
382: my %emails = &Apache::loncommon::getemails($uname,$udom);
383: my $contact_email;
1.3 raeburn 384: foreach my $type ('permanentemail','critnotification','notification') {
385: if ($emails{$type} =~ /\@/) {
386: $contact_email = $emails{$type};
1.1 raeburn 387: last;
388: }
389: }
1.2 raeburn 390: $ltiparams{'lis_person_contact_email_primary'} = $contact_email;
1.1 raeburn 391: }
1.4 raeburn 392: if ($fields{'user'}) {
1.6 raeburn 393: $ltiparams{'lis_person_sourcedid'} = $uname.':'.$udom;
1.4 raeburn 394: }
1.1 raeburn 395: if (keys(%custom)) {
396: foreach my $key (keys(%custom)) {
1.5 raeburn 397: my $value = $custom{$key};
398: $value =~ s/^\s+|\s+\$//g;
399: if ($value =~ /^\QLONCAPA::env{\E([^\}]+)\}$/) {
400: if (exists($env{$1})) {
401: $value = $env{$1};
402: }
403: }
404: $ltiparams{'custom_'.$key} = $value;
1.1 raeburn 405: }
406: }
407: foreach my $key (keys(%ltiparams)) {
408: $ltiparams{$key} = &Encode::decode_utf8($ltiparams{$key});
409: }
1.3 raeburn 410: $ltiparams{'basiclti_submit'} = $submittext;
1.1 raeburn 411: return %ltiparams;
412: }
413:
414: sub launch_html {
1.14 ! raeburn 415: my ($url,$key,$secret,$sigmethod,$submittext,$paramsref) = @_;
! 416: my $hashref = &LONCAPA::ltiutils::sign_params($url,$key,$secret,$sigmethod,$paramsref);
1.5 raeburn 417: my $action = &HTML::Entities::encode($url,'<>&"');
1.1 raeburn 418: my $form = <<"END";
419: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
420: <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
421: <body>
422: <div id="LCltiLaunch">
1.5 raeburn 423: <form name="LCltiLaunchForm" id="LCltiLaunchFormId" action="$action" method="post" encType="application/x-www-form-urlencoded">
1.1 raeburn 424: END
425: if (ref($hashref) eq 'HASH') {
426: foreach my $item (keys(%{$hashref})) {
1.3 raeburn 427: my $type = 'hidden';
428: if ($item eq 'basiclti_submit') {
429: $type = 'submit';
430: }
431: $form .= '<input type="'.$type.'" name="'.$item.'" value="'.$hashref->{$item}.'" id="id_'.$item.'" />'."\n";
1.1 raeburn 432: }
433: }
434: $form .= "</form></div>\n";
435: $form .= <<"ENDJS";
436: <script type="text/javascript">
437: document.getElementById("LCltiLaunch").style.display = "none";
438: nei = document.createElement('input');
439: nei.setAttribute('type','hidden');
1.3 raeburn 440: nei.setAttribute('name','basiclti_submit');
1.1 raeburn 441: nei.setAttribute('value','$submittext');
1.3 raeburn 442: document.getElementById("LCltiLaunchFormId").appendChild(nei);
1.1 raeburn 443: document.LCltiLaunchForm.submit();
444: </script>
445: ENDJS
446: $form .= "</body></html>\n";
447: return $form;
448: }
449:
1.12 raeburn 450: sub gradabletool_access_check {
451: my ($result,$resource_due);
452: my $status;
453: my ($symb,$courseid,$udom,$uname) = &Apache::lonnet::whichuser();
454: my @targets;
455: if (defined($env{'form.submitted'}) && defined($env{'form.validate'})) {
456: @targets = ('grade','web');
457: } else {
458: @targets = ('web');
459: }
460: foreach my $target (@targets) {
461: undef(%Apache::lonhomework::results);
462: undef(%Apache::lonhomework::history);
463: %Apache::lonhomework::history =
464: &Apache::lonnet::restore($symb,$courseid,$udom,$uname);
465: &Apache::lonhomework::set_show_problem_status(&Apache::lonnet::EXT('resource.0.problemstatus'));
466: my ($accessmsg,$slot_name,$slot,$ipused);
467: ($status,$accessmsg,$slot_name,$slot,$ipused) =
468: &Apache::lonhomework::check_slot_access('0','tool',$symb);
469: if (( $status eq 'CLOSED' ) ||
470: ( $status eq 'UNCHECKEDOUT') ||
471: ( $status eq 'NOT_YET_VIEWED') ||
472: ( $status eq 'BANNED') ||
473: ( $status eq 'UNAVAILABLE') ||
474: ( $status eq 'NOT_IN_A_SLOT') ||
475: ( $status eq 'NOTRESERVABLE') ||
476: ( $status eq 'RESERVABLE') ||
477: ( $status eq 'RESERVABLE_LATER') ||
478: ( $status eq 'INVALID_ACCESS') ||
479: ( $status eq 'NEED_DIFFERENT_IP') ||
480: ( $status eq 'WAITING_FOR_GRADE')) {
481: $result = &Apache::structuretags::access_status_msg('tool',$status,$symb,
482: $target,$ipused,$accessmsg);
483: } elsif ($status eq 'NEEDS_CHECKIN') {
484: $result = &Apache::structuretags::checkin_prompt($target,$slot_name,$slot,'tool');
485: } elsif ($target eq 'web') {
486: if ($status eq 'CAN_ANSWER') {
487: $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
488: if ($slot_name ne '') {
489: $resource_due = &Apache::structuretags::selfcheckin_resource($resource_due,
490: $slot_name,$slot,
491: $env{'request.symb'});
492: }
493: }
494: }
495: }
496: return ($status,$result,$resource_due);
497: }
498:
499: sub display_score {
500: my $weight = &Apache::lonnet::EXT('resource.0.weight');
501: if ((!defined($weight)) || ($weight eq '')) { $weight=1; }
502: my $awarded = $Apache::lonhomework::history{'resource.0.awarded'};
503: if (!defined($awarded)) { $awarded=0; }
504: my $display='';
505: if (!defined($awarded)) {
506: $display = &mt('[_1] possible points.',$weight);
507: } else {
508: my $points = $awarded*$weight;
509: my $result = sprintf('%.2f',$points);
510: $display = &mt('You have [_1] out of [quant,_2,possible point]',
511: $result,$weight);
512: }
513: my $comment = $Apache::lonhomework::history{'resource.0.comment'};
514: if (!defined($comment) || $comment!~/\w/) {
515: $comment='';
516: } else {
517: $comment='<br /><table><tr><td bgcolor="#FFFFDD">'.$comment.'</td></tr></table>';
518: }
519: my $gradeinfo = $Apache::lonhomework::history{'resource.0.gradeinfo'};
520: if (!defined($gradeinfo) || $gradeinfo!~/\w/) {
521: $gradeinfo='';
522: } else {
523: $gradeinfo='<br /><table><tr><td bgcolor="#DDDDFF"><font size="+2">'.$gradeinfo.'</font></td></tr></table>';
524: }
525: return $display.$comment.$gradeinfo;
526: }
527:
1.1 raeburn 528: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>