1: # The LearningOnline Network with CAPA
2: # Wrapper for external and binary files as standalone resources
3: #
4: # $Id: lonwrapper.pm,v 1.86 2023/12/31 21:45:03 raeburn Exp $
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:
30: package Apache::lonwrapper;
31:
32: use strict;
33: use Apache::Constants qw(:common);
34: use Apache::lonenc();
35: use Apache::lonnet;
36: use Apache::lonlocal;
37: use Apache::loncommon();
38: use Apache::lonhtmlcommon();
39: use Apache::lonextresedit();
40: use Apache::lonexttool();
41: use Apache::lonhomework();
42: use Apache::lonnavmaps();
43: use LONCAPA qw(:DEFAULT :match);
44: use HTML::Entities();
45: use Digest::MD5();
46:
47: # ================================================================ Main Handler
48: sub wrapper {
49: my ($r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,$linktext,$explanation,
50: $title,$width,$height,$reuse,$is_supp) = @_;
51:
52: my $forcereg;
53: unless ($env{'form.folderpath'}) {
54: $forcereg = 1;
55: }
56: my %lt = &Apache::lonlocal::texthash(
57: 'noif' => 'No iframe support.',
58: 'show' => 'Show content in pop-up window',
59: );
60:
61: (undef,undef,undef,undef,undef,undef,my $clientmobile) =
62: &Apache::loncommon::decode_user_agent($r);
63:
64: my ($anchor,$uselink);
65: if ($is_ext) {
66: if ($env{'form.symb'}) {
67: (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'});
68: if ($res =~ /(#[^#]+)$/) {
69: $anchor = $1;
70: }
71: } elsif ($env{'form.anchor'} ne '') {
72: $anchor = '#'.$env{'form.anchor'};
73: }
74: if (($is_ext eq 'tab') || ($is_ext eq 'window')) {
75: $uselink = 1;
76: }
77: unless (($is_pdf && $clientmobile) || $uselink) {
78: my $hostname = $r->hostname();
79: my $lonhost = $r->dir_config('lonHostID');
80: my $ip = &Apache::lonnet::get_host_ip($lonhost);
81: $uselink = &Apache::loncommon::is_nonframeable($url,$absolute,$hostname,$ip);
82: }
83: }
84:
85: my $noiframe = &Apache::loncommon::modal_link(&HTML::Entities::encode($url.$anchor,'&<>"\''),$lt{'show'},500,400);
86: my $args = {'bgcolor' => '#FFFFFF'};
87: if ($forcereg) {
88: $args->{'force_register'} = $forcereg;
89: }
90: if (ref($brcrum) eq 'ARRAY') {
91: $args->{'bread_crumbs'} = $brcrum;
92: }
93: if ($absolute) {
94: $args->{'use_absolute'} = $absolute;
95: }
96: if ($env{'form.only_body'}) {
97: $args->{'only_body'} = $env{'form.only_body'};
98: } elsif (($is_supp) && ($env{'form.folderpath'} ne '')) {
99: $args->{'bread_crumbs_nomenu'} = 1;
100: }
101:
102: my ($countdown,$donemsg,$headjs);
103: if (($exttool) && (&Apache::lonnet::EXT('resource.0.gradable') =~ /^yes$/i)) {
104: $Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$url);
105: if ($env{'form.markaccess'}) {
106: my $symb=&Apache::lonnet::symbread($url);
107: my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb);
108: my ($timelimit) = split(/_/,$interval[0]);
109: my $setres = &Apache::lonnet::set_first_access($interval[1],$timelimit);
110: if ($setres eq 'ok') {
111: delete($env{'form.markaccess'});
112: }
113: } elsif ($env{'form.LC_interval_done'} eq 'true') {
114: my $symb=&Apache::lonnet::symbread($url);
115: if ($symb) {
116: (my $donebuttonresult,$donemsg) = &Apache::lonhomework::zero_timer($symb);
117: undef($env{'form.LC_interval_done'});
118: undef($env{'form.LC_interval_done_proctorpass'});
119: }
120: }
121: my ($status,$result,$resource_due) =
122: &Apache::lonexttool::gradabletool_access_check();
123: undef($Apache::lonhomework::browse);
124: if ($status eq 'CAN_ANSWER') {
125: if ($resource_due) {
126: my $time_left = $resource_due - time();
127: if ($resource_due && ($time_left > 0)) {
128: $countdown ='
129: <script type="text/javascript">
130: // <![CDATA['."\n".
131: &Apache::lonhtmlcommon::countdown().'
132: // ]]>
133: </script>'."\n".
134: &Apache::lonhtmlcommon::set_due_date($resource_due);
135: }
136: }
137: } else {
138: if ($status eq 'SHOW_ANSWER') {
139: $result = &Apache::lonexttool::display_score().
140: &Apache::lonfeedback::list_discussion('tool','OPEN');
141: }
142: return &Apache::loncommon::start_page('Menu',undef,$args).
143: $result.
144: &Apache::loncommon::end_page();
145: }
146: }
147:
148: #
149: # Where iframe is in use, if window.onload() executes before the custom resize function
150: # has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef)
151: # are used to ensure document.ready() triggers a call to resize, so the iframe contents
152: # do not obscure the Functions menu.
153: #
154:
155: unless ($clientmobile || ($exttool eq 'window') || ($exttool eq 'tab') || $uselink) {
156: $headjs = &Apache::loncommon::iframe_wrapper_headjs();
157: }
158:
159: my $startpage = &Apache::loncommon::start_page('Menu',$headjs,$args).$countdown.$donemsg;
160: my $endpage = &Apache::loncommon::end_page();
161:
162: if (($uselink) && ($title eq '')) {
163: if ($env{'form.symb'}) {
164: $title=&Apache::lonnet::gettitle($env{'form.symb'});
165: } elsif (!$is_supp) {
166: my $symb=&Apache::lonnet::symbread($r->uri);
167: if ($symb) {
168: $title=&Apache::lonnet::gettitle($symb);
169: }
170: }
171: }
172: if ($clientmobile || ($exttool eq 'window') || ($exttool eq 'tab') ||
173: ($is_ext eq 'tab') || ($is_ext eq 'window')) {
174: my $output = $startpage;
175: if ($is_pdf) {
176: $linktext = &mt('Link to PDF (for mobile devices)');
177: $output .= &create_link($url,$anchor,$title,$linktext);
178: } elsif (($exttool eq 'window') || ($exttool eq 'tab') ||
179: ($is_ext eq 'tab') || ($is_ext eq 'window')) {
180: my $preamble;
181: if ($linktext eq '') {
182: if ($exttool) {
183: $linktext = &mt('Launch External Tool');
184: } else {
185: $linktext = &mt('Link to External Resource');
186: }
187: }
188: if ($exttool) {
189: $url = &HTML::Entities::encode($url,'"<>&');
190: } else {
191: $url = &HTML::Entities::encode($url.$anchor,'&<>"');
192: }
193: if (($exttool eq 'tab') || ($is_ext eq 'tab')) {
194: my $target;
195: if ($exttool) {
196: $target = 'LCExternalToolTab';
197: } else {
198: if ($reuse) {
199: $target = 'LCExternalResTab';
200: } else {
201: $target = '_blank';
202: }
203: if ($title ne '') {
204: $preamble = '<span style="font-weight:bold;">'.$title.'</span><br />';
205: }
206: }
207: $output .= '<div>'.$preamble.
208: '<a href="'.$url.'" target="'.$target.'" style="padding:0;clear:both;margin:0;border:0">'.
209: $linktext.'</a>'.
210: '</div>';
211: } else {
212: my ($target,$extlinkimg);
213: if ($exttool) {
214: $target = 'LCExternalToolPopUp';
215: } else {
216: $target = 'LCExternalResPopUp';
217: if ($title ne '') {
218: $preamble = '<span style="font-weight:bold;">'.$title.'</span><br />';
219: }
220: $extlinkimg = '<img src="'.&Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL').'/externallink.gif').'" width="19" height="18" border="0" />';
221: unless ($reuse) {
222: my $resid;
223: if ($env{'request.course.id'}) {
224: unless (($is_supp) || ($env{'form.folderpath'} =~ /^supplemental/)) {
225: my $symb=&Apache::lonnet::symbread($r->uri);
226: if ($symb) {
227: my $navmap = Apache::lonnavmaps::navmap->new();
228: if (ref($navmap)) {
229: my $res = $navmap->getBySymb($symb);
230: if (ref($res)) {
231: $resid = $res->id;
232: $resid =~ s/\./_/g;
233: }
234: }
235: }
236: }
237: }
238: if ($resid eq '') {
239: $resid = substr(Digest::MD5::md5_hex(Digest::MD5::md5_hex(time(). {}. rand(). $$)), 0, 8);
240: }
241: &js_escape(\$resid);
242: $target .= $resid;
243: }
244: }
245: $output .= <<"ENDLINK";
246: <script type="text/javascript">
247: // <![CDATA[
248: var windowObjectReference = null;
249: var PreviousUrl;
250:
251: function openSinglePopup(strUrl) {
252: if (windowObjectReference == null || windowObjectReference.closed) {
253: windowObjectReference = window.open(strUrl, "$target",
254: "height=$height,width=$width,scrollbars=yes,resizable=yes,status=yes,menubar=no,location=no'");
255: } else if(PreviousUrl != strUrl) {
256: windowObjectReference = window.open(strUrl, "$target",
257: "height=$height,width=$width,scrollbars=yes,resizable=yes,status=yes,menubar=no,location=no'");
258: windowObjectReference.focus();
259: } else {
260: windowObjectReference.focus();
261: };
262: PreviousUrl = strUrl;
263: }
264: // ]]>
265: </script>
266: <div>$preamble
267: <a href="$url" target="$target" onclick="openSinglePopup(this.href); return false;">
268: $linktext$extlinkimg</a>
269: </div>
270: ENDLINK
271: }
272: if ($exttool) {
273: if ($explanation ne '') {
274: $output .= '<div>'.$explanation.'</div>';
275: }
276: if (&Apache::lonnet::EXT('resource.0.gradable')) {
277: $output .= &Apache::lonfeedback::list_discussion('tool','OPEN');
278: }
279: }
280: } else {
281: if ($uselink) {
282: $linktext = &mt('Link to resource');
283: $output .= &create_link($url,$anchor,$title,$linktext);
284: } else {
285: my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
286: $output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".
287: '<iframe src="'.$dest.'" height="100%" width="100%" frameborder="0">'."\n".
288: "$lt{'noif'} $noiframe\n".
289: "</iframe>\n".
290: "</div>\n";
291: }
292: }
293: $output .= $endpage;
294: return $output;
295: } elsif ($uselink) {
296: $linktext = &mt('Link to resource');
297: return $startpage.&create_link($url,$anchor,$title,$linktext).$endpage;
298: } else {
299: # javascript will position the iframe if window was resized (or zoomed)
300: my $script = &Apache::loncommon::iframe_wrapper_resizejs();
301: my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
302: return <<ENDFRAME;
303: $startpage
304: $script
305: <div class="LC_iframecontainer">
306: <iframe src="$dest">$lt{'noif'} $noiframe</iframe>
307: </div>
308: $endpage
309: ENDFRAME
310: }
311: }
312:
313: sub create_link {
314: my ($url,$anchor,$title,$linktext) = @_;
315: my $shownlink;
316: if ($title eq '') {
317: $title = $env{'form.title'};
318: if ($title eq '') {
319: unless ($env{'request.enc'}) {
320: ($title) = ($url =~ m{/([^/]+)$});
321: $title =~ s/(\?[^\?]+)$//;
322: }
323: }
324: }
325: unless ($title eq '') {
326: $shownlink = '<span style="font-weight:bold;">'.$title.'</span><br />';
327: }
328: my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
329: $shownlink .= '<a href="'.$dest.'">'.$linktext.'</a>';
330: return $shownlink;
331: }
332:
333: sub handler {
334: my $r=shift;
335: &Apache::loncommon::content_type($r,'text/html');
336: $r->send_http_header;
337:
338: return OK if $r->header_only;
339:
340: my $url = $r->uri;
341: my ($is_ext,$brcrum,$absolute,$is_pdf,$exttool,$cdom,$cnum,$hostname,
342: $linktext,$explanation,$width,$height,$reuse,$is_supp);
343:
344: for ($url){
345: s|^/adm/wrapper||;
346: $is_ext = $_ =~ s|^/ext/|http://|;
347: s|http://https://|https://| if ($is_ext);
348: s|:|:|g;
349: }
350:
351: if ($url =~ /\.pdf$/i) {
352: $is_pdf = 1;
353: } elsif (($is_ext) && ($env{'request.course.id'})) {
354: if ($env{'course.'.$env{'request.course.id'}.'.extresource'}) {
355: (my $selected,$reuse,$width,$height) = split(/:/,$env{'course.'.$env{'request.course.id'}.'.extresource'});
356: if ($selected eq 'tab') {
357: $is_ext = 'tab';
358: $width = '';
359: $height = '';
360: } elsif ($selected eq 'window') {
361: $is_ext = 'window';
362: unless ($width =~ /^\d+$/) {
363: $width = '';
364: }
365: unless ($height =~ /^\d+$/) {
366: $height = '';
367: }
368: } else {
369: $width = '';
370: $height = '';
371: $reuse = '';
372: }
373: }
374: } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/ext\.tool$}) {
375: $cdom = $1;
376: $cnum = $2;
377: my $marker = $3;
378: $exttool = 'iframe';
379: my $exttoolremote;
380: my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id','width','height'],
381: $cdom,$cnum);
382: if ($toolhash{'id'}) {
383: my ($idx,%ltitools);
384: if ($toolhash{'id'} =~ /^c(\d+)$/) {
385: $idx = $1;
386: %ltitools = &Apache::lonnet::get_course_lti($cnum,$cdom,'consumer');
387: } else {
388: $idx = $toolhash{'id'};
389: %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
390: }
391: if (ref($ltitools{$idx}) eq 'HASH') {
392: $exttoolremote = $ltitools{$idx}{'url'};
393: }
394: }
395: if ($toolhash{'target'} eq 'window') {
396: $exttool = 'window';
397: $width = $toolhash{'width'};
398: $height = $toolhash{'height'};
399: } elsif ($toolhash{'target'} eq 'tab') {
400: $exttool = 'tab';
401: }
402: if (($exttool eq 'window') || ($exttool eq 'tab')) {
403: $linktext = $toolhash{'linktext'};
404: $explanation = $toolhash{'explanation'};
405: } elsif (($exttoolremote =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
406: $exttool = 'tab';
407: }
408: }
409: if (($is_ext) || ($exttool)) {
410: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
411: ['forceedit','register','folderpath','symb','idx','title','anchor','only_body']);
412: if (($env{'form.forceedit'}) &&
413: (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
414: (($env{'form.folderpath'} =~ /^supplemental/) ||
415: ($env{'form.symb'} =~ /^uploaded/))) {
416: if ($env{'form.symb'}) {
417: (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'});
418: if ($res =~ /(#[^#]+)$/) {
419: $url .= $1;
420: }
421: } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
422: if ($env{'form.anchor'} ne '') {
423: $url .= '#'.$env{'form.anchor'};
424: }
425: $is_supp = 1;
426: }
427: my $type = 'ext';
428: if ($exttool) {
429: $type = 'tool';
430: } elsif (($url =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
431: $hostname = $r->hostname();
432: }
433: $r->print(
434: &Apache::lonextresedit::display_editor($url,$env{'form.folderpath'},
435: $env{'form.symb'},
436: $env{'form.idx'},$type,$cdom,
437: $cnum,$hostname));
438: return OK;
439: } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
440: my $crstype = &Apache::loncommon::course_type();
441: my $title = $env{'form.title'};
442: if ($title eq '') {
443: if ($is_ext) {
444: $title = &mt('External Resource');
445: } else {
446: $title = &mt('External Tool');
447: }
448: }
449: $title = &HTML::Entities::encode($title,'\'"<>&');
450: $is_supp = 1;
451: if ($env{'request.course.id'}) {
452: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
453: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
454: &Apache::loncommon::validate_folderpath(1,'',$cnum,$cdom);
455: }
456: unless ($env{'form.only_body'}) {
457: $brcrum =
458: &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
459: }
460: }
461: } elsif ($env{'request.course.id'}) {
462: my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
463: $courseurl =~ s{^/}{};
464: if ($url =~ m{^\Q/uploaded/$courseurl/supplemental/\E}) {
465: $is_supp = 1;
466: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
467: ['folderpath','title','only_body']);
468: if ($env{'form.folderpath'}) {
469: $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
470: $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
471: &Apache::loncommon::validate_folderpath(1,'',$cnum,$cdom);
472: }
473: my $title = $env{'form.title'};
474: $title = &HTML::Entities::encode($title,'\'"<>&');
475: my $crstype = &Apache::loncommon::course_type();
476: unless ($env{'form.only_body'}) {
477: $brcrum =
478: &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
479: }
480: }
481: }
482:
483: #
484: # Actual URL
485: #
486: if (($url=~/$LONCAPA::assess_re/) && (!$exttool)) {
487: #
488: # This is uploaded homework
489: #
490: $env{'request.state'}='uploaded';
491: &Apache::lonhomework::renderpage($r,$url);
492: } else {
493: #
494: # This is not homework
495: #
496: if (($is_ext) || ($exttool)) {
497: $absolute = $env{'request.use_absolute'};
498: $ENV{'QUERY_STRING'} =~ s/(^|\&)symb=[^\&]*/$1/;
499: $ENV{'QUERY_STRING'} =~ s/\&$//;
500: }
501:
502: unless ($ENV{'QUERY_STRING'} eq '') {
503: $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'};
504: }
505:
506: # encrypt url if not external
507: unless ($is_ext) {
508: &Apache::lonenc::check_encrypt(\$url);
509: }
510:
511: $r->print( wrapper($r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,
512: $linktext,$explanation,undef,$width,$height,$reuse,
513: $is_supp) );
514:
515: } # not just the menu
516:
517: return OK;
518: } # handler
519:
520: 1;
521: __END__
522:
523: =pod
524:
525: =head1 NAME
526:
527: Apache::lonwrapper - External and binary file management.
528:
529: =head1 SYNOPSIS
530:
531: Wrapper for external and binary files as standalone resources. Edit handler for rat maps; TeX content handler.
532:
533: This is part of the LearningOnline Network with CAPA project
534: described at http://www.lon-capa.org.
535:
536: =head1 Subroutines
537:
538: =over
539:
540: =item wrapper()
541:
542: Args: $r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,$linktext,$explanation,$title,$width,$height,$reuse,$is_supp
543:
544: =over
545:
546: =item $r
547:
548: request object
549:
550: =item $url
551:
552: url to display either by including in an iframe within a
553: LON-CAPA page which has a standard LON-CAPA inline menu,
554: or in some cases launched in a separate tab or window,
555: launched via a link in a LON-CAPA page with standard inline
556: menu.
557:
558: =item $brcrum
559:
560: breadcrumbs for unregistered urls
561: (i.e., external resources in Supplemental Content).
562:
563: =item $absolute
564:
565: contains protocol (http or https) followed by
566: the hostname, if menu items in the standard LON-CAPA
567: interface created by the call to loncommon::start_page()
568: within &wrapper() need to use absolute URLs rather than
569: relative URLs.
570:
571: That will be the case where an external resource has been
572: served from port 80, when the server customarily serves
573: requests using Apache/SSL (i.e., port 443). mod_rewrite
574: is used to switch requests for external resources and
575: the syllabus: /public/<domain>/<courseid>/syllabus
576: (which might also point at an external resource)
577: from https:// to http:// where the the URL of the remote site
578: specified in the resource itself is http://.
579:
580: This is done to avoid default mixed content blocking
581: in Firefox 23 and later, when serving from Apache/SSL.
582:
583: =item $is_ext
584:
585: true if URL is for an external resource. Default true value
586: is 1 (display in iframe, unless $uselink is true).
587: If external resource is to be displayed in a tab,
588: value of $is_ext will be tab, if to be displayed in a pop-up window,
589: value of $is_ext will be window.
590:
591: =item $is_pdf
592:
593: true if URL is for a PDF (based on file extension).
594:
595: =item $exttool
596:
597: If URL is for an External Tool, will contain the target type: iframe, window or tab.
598:
599: =item $linktext
600:
601: optional. If URL is for an External Tool, and target type is window or tab,
602: then the link text may be an option set in the course for each tool instance,
603: or may be a default defined in the domain for all instances of the tool.
604:
605: =item $explanation
606:
607: optional. If URL is for an External Tool, and target type is window or tab,
608: then the explanation is an option set in the course for each tool instance,
609: or may be a default defined in the domain for all instances of the tool.
610:
611: =item $title
612:
613: optional. If wrapped item is a PDF, and $clientmobile is true,
614: a link to a PDF is shown. The "title" will be displayed
615: above the link, but if not provided as an arg, $env{'form.title'}
616: will be used, otherwise, the filename will be displayed (unless
617: hidden URL set for the resource).
618:
619: =item $width
620:
621: optional. If URL is for an External Tool, and target type is window,
622: then a default width may have been defined in the domain for all instances of
623: the tool. If so, that width will be used for the window opened (via a link)
624: to launch the external tool. If the URL is for an External Resource, and
625: $is_ext is window, then a default width (px) may have been defined in the current
626: course for all external resource instances.
627:
628: =item $height
629:
630: optional. If URL is for an External Tool, and target type is window,
631: then a default height may have been defined in the domain for all instances of
632: the tool. If so, that height will be used for the window opened (via a link)
633: to launch the external tool. If the URL is for an External Resource, and
634: $is_ext is window, then a default height (px) may have been defined in the current
635: course for all external resource instances.
636:
637: =item $reuse
638:
639: optional. If the URL is for an External Resource, and $is_ext is tab or window,
640: then $reuse will be true if the same tab or window is to be reused for display
641: of all external resource instances in a a course.
642:
643: =back
644:
645: Returns markup for the entire page.
646:
647: =item create_link()
648:
649: Args: $url,$anchor,$title,$linktext
650:
651: =over
652:
653: =item $url
654:
655: URL to link to
656:
657: =item $anchor
658:
659: optional. Will be the anchor to append to the URL, if there is one.
660:
661: =item $title
662:
663: optional. If provided will be the title displayed above the link. If
664: one is not provided, then $env{'form.title'} will be used, unless empty.
665:
666: =item $linktext
667:
668: The text to inlcude between the <a href="$url"> and </a> tags.
669:
670: =back
671:
672: Returns HTML needed to show a link which can be followed to display the
673: part of the original URL following the initial /adm/wrapper part
674: in the original request, in the case where an iframe is not going to be
675: used to embed the content available at the URL in the existing page.
676:
677: =item handler()
678:
679: Content handler for requests for: /adm/wrapper/...
680: used for content to be displayed in an iframe, or launched in a separate tab
681: or window via a link. The target URL is extracted from the requested URL, by
682: removing the /adm/wrapper prefix.
683:
684: The target URL will typically be a PDF served from the current server, an
685: external resource URL served from a different server, or an external tool
686: (from an LTI Provider) launched from LON-CAPA (as LTI Consumer) and launched
687: via a link.
688:
689: If the request included forceedit in the query string, and the requester has
690: rights to modify course content, then the editor will be displayed to allow
691: changes to be made to the resource (e.g., change the URL of the external resource,
692: or change the setting for the external tool instance).
693:
694: If not in edit mode, then the wrapper() subroutine will be called to generate the
695: standard LON-CAPA inline menu, and then either a link to launch a separate tab or
696: window, or an iframe to display the content inline.
697:
698: =back
699:
700: =cut
701:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>