Annotation of rat/lonwrapper.pm, revision 1.74

1.1       www         1: # The LearningOnline Network with CAPA
                      2: # Wrapper for external and binary files as standalone resources
                      3: #
1.74    ! raeburn     4: # $Id: lonwrapper.pm,v 1.73 2020/02/16 23:07:36 raeburn Exp $
1.4       www         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.1       www        28: 
1.29      jms        29: 
1.1       www        30: package Apache::lonwrapper;
                     31: 
                     32: use strict;
                     33: use Apache::Constants qw(:common);
1.38      droeschl   34: use Apache::lonenc();
1.18      albertel   35: use Apache::lonnet;
1.42      raeburn    36: use Apache::lonlocal;
                     37: use Apache::loncommon();
                     38: use Apache::lonhtmlcommon();
                     39: use Apache::lonextresedit();
1.50      raeburn    40: use Apache::lonexttool();
1.68      raeburn    41: use Apache::lonhomework();
1.64      raeburn    42: use LONCAPA qw(:DEFAULT :match);
                     43: use HTML::Entities();
1.1       www        44: 
                     45: # ================================================================ Main Handler
1.21      albertel   46: sub wrapper {
1.69      raeburn    47:     my ($r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,$linktext,$explanation,
1.63      raeburn    48:         $title,$width,$height) = @_;
1.23      albertel   49: 
1.42      raeburn    50:     my $forcereg;
                     51:     unless ($env{'form.folderpath'}) {
                     52:         $forcereg = 1;
                     53:     }
1.46      raeburn    54:     my %lt = &Apache::lonlocal::texthash(
                     55:                                           'noif' => 'No iframe support.',
                     56:                                           'show' => 'Show content in pop-up window',
                     57:                                         );
                     58: 
1.69      raeburn    59:     my ($anchor,$uselink);
1.53      raeburn    60:     if ($is_ext) {
                     61:         if ($env{'form.symb'}) {
                     62:             (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'});
                     63:             if ($res =~ /(#[^#]+)$/) {
                     64:                 $anchor = $1;
                     65:             }
                     66:         } elsif ($env{'form.anchor'} ne '') {
                     67:             $anchor = '#'.$env{'form.anchor'};
1.51      raeburn    68:         }
1.69      raeburn    69:         unless (($is_pdf) && ($env{'browser.mobile'})) {
                     70:             my $hostname = $r->hostname();
                     71:             my $lonhost = $r->dir_config('lonHostID');
                     72:             my $ip = &Apache::lonnet::get_host_ip($lonhost);
                     73:             $uselink = &Apache::loncommon::is_nonframeable($url,$absolute,$hostname,$ip);
                     74:         }
1.51      raeburn    75:     }
                     76: 
                     77:     my $noiframe = &Apache::loncommon::modal_link($url.$anchor,$lt{'show'},500,400);
1.42      raeburn    78:     my $args = {'bgcolor' => '#FFFFFF'};
                     79:     if ($forcereg) {
                     80:         $args->{'force_register'} = $forcereg;
                     81:     }
                     82:     if (ref($brcrum) eq 'ARRAY') {
1.45      raeburn    83:         $args->{'bread_crumbs'} = $brcrum;
1.42      raeburn    84:     }
1.44      raeburn    85:     if ($absolute) {
1.57      raeburn    86:         $args->{'use_absolute'} = $absolute;
1.44      raeburn    87:     }
1.56      raeburn    88:     if ($env{'form.only_body'}) {
                     89:         $args->{'only_body'} = $env{'form.only_body'};
                     90:     }
1.42      raeburn    91: 
1.73      raeburn    92:     my ($countdown,$donemsg,$headjs);
1.67      raeburn    93:     if (($exttool) && (&Apache::lonnet::EXT('resource.0.gradable') =~ /^yes$/i)) {
                     94:         $Apache::lonhomework::browse = &Apache::lonnet::allowed('bre',$url);
                     95:         if ($env{'form.markaccess'}) {
1.68      raeburn    96:             my $symb=&Apache::lonnet::symbread($url);
                     97:             my @interval=&Apache::lonnet::EXT('resource.0.interval',$symb);
1.67      raeburn    98:             my ($timelimit) = split(/_/,$interval[0]);
1.68      raeburn    99:             my $setres = &Apache::lonnet::set_first_access($interval[1],$timelimit);
                    100:             if ($setres eq 'ok') {
                    101:                 delete($env{'form.markaccess'});
                    102:             }
                    103:         } elsif ($env{'form.LC_interval_done'} eq 'true') {
                    104:             my $symb=&Apache::lonnet::symbread($url);
                    105:             if ($symb) {
                    106:                 (my $donebuttonresult,$donemsg) = &Apache::lonhomework::zero_timer($symb);
                    107:                 undef($env{'form.LC_interval_done'});
                    108:                 undef($env{'form.LC_interval_done_proctorpass'});
                    109:             }
1.67      raeburn   110:         }
                    111:         my ($status,$result,$resource_due) =
                    112:             &Apache::lonexttool::gradabletool_access_check();
                    113:         undef($Apache::lonhomework::browse);
                    114:         if ($status eq 'CAN_ANSWER') {
                    115:             if ($resource_due) {
                    116:                 my $time_left = $resource_due - time();
                    117:                 if ($resource_due && ($time_left > 0)) {
                    118:                     $countdown ='
1.66      raeburn   119: <script type="text/javascript">
                    120: // <![CDATA['."\n".
                    121:                              &Apache::lonhtmlcommon::countdown().'
                    122: // ]]>
                    123: </script>'."\n".
1.67      raeburn   124:                     &Apache::lonhtmlcommon::set_due_date($resource_due);
                    125:                 }
1.66      raeburn   126:             }
1.67      raeburn   127:         } else {
                    128:             if ($status eq 'SHOW_ANSWER') {
                    129:                 $result = &Apache::lonexttool::display_score().
                    130:                           &Apache::lonfeedback::list_discussion('tool','OPEN');
                    131:             }
                    132:             return &Apache::loncommon::start_page('Menu',undef,$args).
                    133:                    $result.
                    134:                    &Apache::loncommon::end_page();
1.66      raeburn   135:         }
                    136:     }
                    137: 
1.73      raeburn   138: #
                    139: # Where iframe is in use, if window.onload() executes before the custom resize function
                    140: # has been defined (jQuery), two global javascript vars (LCnotready and LCresizedef)
                    141: # are used to ensure document.ready() triggers a call to resize, so the iframe contents
                    142: # do not obscure the Functions menu.
                    143: #
                    144: 
                    145:     unless (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab') || $uselink) {
                    146:         $headjs = '
                    147: <script type="text/javascript">
                    148: // <![CDATA[
                    149: var LCnotready = 0;
                    150: var LCresizedef = 0;
                    151: // ]]>
                    152: </script>'."\n";
1.74    ! raeburn   153:     }
1.73      raeburn   154: 
                    155:     my $startpage = &Apache::loncommon::start_page('Menu',$headjs,$args).$countdown.$donemsg;
1.67      raeburn   156:     my $endpage = &Apache::loncommon::end_page();
                    157: 
1.69      raeburn   158:     if (($uselink) && ($title eq '')) {
                    159:         if ($env{'form.symb'}) {
                    160:             $title=&Apache::lonnet::gettitle($env{'form.symb'});
                    161:         } else {
                    162:             my $symb=&Apache::lonnet::symbread($r->uri);
                    163:             if ($symb) {
                    164:                 $title=&Apache::lonnet::gettitle($symb);
                    165:             }
                    166:         }
                    167:     }
1.63      raeburn   168:     if (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab')) {
1.47      raeburn   169:         my $output = $startpage;
                    170:         if ($is_pdf) {
1.69      raeburn   171:             $linktext = &mt('Link to PDF (for mobile devices)');
                    172:             $output .= &create_link($url,$anchor,$title,$linktext);
1.63      raeburn   173:         } elsif (($exttool eq 'window') || ($exttool eq 'tab')) {
1.60      raeburn   174:             if ($linktext eq '') {
                    175:                 $linktext = &mt('Launch External Tool');
                    176:             }
1.64      raeburn   177:             $url = &HTML::Entities::encode($url,'"<>&');
1.63      raeburn   178:             if ($exttool eq 'tab') {
                    179:                 $output .= '<div>'.
                    180:                            '<a href="'.$url.'" target="LCExternalToolTab" style="padding:0;clear:both;margin:0;border:0">'.
                    181:                            $linktext.'</a>'.
                    182:                            '</div>';
                    183:             } else {
                    184:                 $output .= <<"ENDLINK";
                    185: <script type="text/javascript">
1.64      raeburn   186: // <![CDATA[
1.70      raeburn   187: var windowObjectReference = null;
                    188: var PreviousUrl;
                    189: 
1.63      raeburn   190: function openSinglePopup(strUrl) {
                    191:     if (windowObjectReference == null || windowObjectReference.closed) {
                    192:         windowObjectReference = window.open(strUrl, "LCExternalToolPopUp",
                    193:                                             "height=$height,width=$width,scrollbars=yes,resizable=yes,status=yes,menubar=no,location=no'");
                    194:     } else if(PreviousUrl != strUrl) {
                    195:         windowObjectReference = window.open(strUrl, "LCExternalToolPopUp",
                    196:                                             "height=$height,width=$width,scrollbars=yes,resizable=yes,status=yes,menubar=no,location=no'");
                    197:         windowObjectReference.focus();
                    198:     } else {
                    199:         windowObjectReference.focus();
                    200:     };
                    201:     PreviousUrl = strUrl;
                    202: }
1.64      raeburn   203: // ]]>
1.63      raeburn   204: </script>
                    205: <div>
                    206: <a href="$url" target="LCExternalToolPopUp" onclick="openSinglePopup(this.href); return false;">
                    207: $linktext</a>
                    208: </div>
                    209: ENDLINK
                    210:             }
1.60      raeburn   211:             if ($explanation ne '') {
                    212:                 $output .= '<div>'.$explanation.'</div>';
                    213:             }
1.66      raeburn   214:             if (&Apache::lonnet::EXT('resource.0.gradable')) {
                    215:                 $output .= &Apache::lonfeedback::list_discussion('tool','OPEN');
                    216:             }
1.47      raeburn   217:         } else {
1.69      raeburn   218:             if ($uselink) {
                    219:                 $linktext = &mt('Link to resource');
                    220:                 $output .= &create_link($url,$anchor,$title,$linktext);
                    221:             } else {
                    222:                 my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
                    223:                 $output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".
                    224:                            '<iframe src="'.$dest.'" height="100%" width="100%" frameborder="0">'."\n".
                    225:                            "$lt{'noif'} $noiframe\n".
                    226:                            "</iframe>\n".
                    227:                            "</div>\n";
                    228:             }
1.47      raeburn   229:         }
                    230:         $output .= $endpage;
                    231:         return $output;
1.69      raeburn   232:     } elsif ($uselink) {
                    233:         $linktext = &mt('Link to resource');
                    234:         return $startpage.&create_link($url,$anchor,$title,$linktext).$endpage;
1.46      raeburn   235:     } else {
1.55      raeburn   236:         my $offset = 5;
                    237:         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
                    238:         if ($env{'form.inhibitmenu'} eq 'yes') {
                    239:             $offset = 0;
                    240:         }
1.46      raeburn   241:         my $script = &Apache::lonhtmlcommon::scripttag(<<SCRIPT);
                    242:         \$(document).ready( function() {
                    243:             \$(window).unbind('resize').resize(function(){
1.54      damieng   244:                 var header = null;
1.55      raeburn   245:                 var offset = $offset;
1.46      raeburn   246:                 var height = 0;
                    247:                 var hdrtop = 0;
                    248:                 if (\$('div.LC_head_subbox:first').length) {
                    249:                     header = \$('div.LC_head_subbox:first');
                    250:                     offset = 9;
                    251:                 } else {
                    252:                     if (\$('#LC_breadcrumbs').length) {
                    253:                         header = \$('#LC_breadcrumbs');
                    254:                     }
                    255:                 }
1.54      damieng   256:                 if (header != null && header.length) {
1.46      raeburn   257:                     height = header.height();
                    258:                     hdrtop = header.position().top;
1.42      raeburn   259:                 }
1.46      raeburn   260:                 var pos = height + hdrtop + offset;
                    261:                 \$('.LC_iframecontainer').css('top', pos);
                    262:             });
1.73      raeburn   263:             LCresizedef = 1;
                    264:             if (LCnotready == 1) {
                    265:                 LCnotready = 0;
                    266:                 \$(window).trigger('resize');
                    267:             }
1.38      droeschl  268:         });
1.73      raeburn   269:         window.onload = function(){
                    270:              if (LCresizedef) {
                    271:                  LCnotready = 0;
                    272:                  \$(window).trigger('resize') };
                    273:              } else {
                    274:                  LCnotready = 1;
                    275:              }
                    276:         };
1.39      droeschl  277: SCRIPT
1.46      raeburn   278:         # javascript will position the iframe if window was resized (or zoomed)
1.64      raeburn   279:         my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
1.46      raeburn   280:         return <<ENDFRAME;
                    281:         $startpage
                    282:         $script
                    283:         <div class="LC_iframecontainer">
1.64      raeburn   284:             <iframe src="$dest">$lt{'noif'} $noiframe</iframe>
1.46      raeburn   285:         </div>
                    286:         $endpage
1.38      droeschl  287: ENDFRAME
1.46      raeburn   288:     }
1.21      albertel  289: }
                    290: 
1.69      raeburn   291: sub create_link {
                    292:     my ($url,$anchor,$title,$linktext) = @_;
                    293:     my $shownlink;
                    294:     if ($title eq '') {
                    295:         $title = $env{'form.title'};
                    296:         if ($title eq '') {
                    297:             unless ($env{'request.enc'}) {
                    298:                 ($title) = ($url =~ m{/([^/]+)$});
                    299:                 $title =~ s/(\?[^\?]+)$//;
                    300:             }
                    301:         }
                    302:     }
                    303:     unless ($title eq '') {
                    304:         $shownlink = '<span style="font-weight:bold;">'.$title.'</span><br />';
                    305:     }
                    306:     my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
                    307:     $shownlink .= '<a href="'.$dest.'">'.$linktext.'</a>';
                    308:     return $shownlink;
                    309: }
                    310: 
1.21      albertel  311: sub handler {
                    312:     my $r=shift;
                    313:     &Apache::loncommon::content_type($r,'text/html');
                    314:     $r->send_http_header;
                    315: 
                    316:     return OK if $r->header_only;
                    317: 
1.38      droeschl  318:     my $url = $r->uri;
1.60      raeburn   319:     my ($is_ext,$brcrum,$absolute,$is_pdf,$exttool,$cdom,$cnum,$hostname,
1.63      raeburn   320:         $linktext,$explanation,$width,$height);
1.38      droeschl  321: 
                    322:     for ($url){
                    323:         s|^/adm/wrapper||;
1.73      raeburn   324:         $is_ext = $_ =~ s|^/ext/|http://|;
1.72      raeburn   325:         s|http://https://?|https://| if ($is_ext);
1.70      raeburn   326:         s|&colon;|:|g;
1.21      albertel  327:     }
                    328: 
1.47      raeburn   329:     if ($url =~ /\.pdf$/i) {
                    330:         $is_pdf = 1;
1.62      raeburn   331:     } elsif ($url =~ m{^/adm/($match_domain)/($match_courseid)/(\d+)/ext\.tool$}) {
1.50      raeburn   332:         $cdom = $1;
                    333:         $cnum = $2;
                    334:         my $marker = $3;
                    335:         $exttool = 'iframe';
1.61      raeburn   336:         my $exttoolremote;
1.63      raeburn   337:         my %toolhash = &Apache::lonnet::get('exttool_'.$marker,['target','linktext','explanation','id','width','height'],
1.60      raeburn   338:                                             $cdom,$cnum);
1.61      raeburn   339:         if ($toolhash{'id'}) {
1.65      raeburn   340:             my %ltitools = &Apache::lonnet::get_domain_lti($cdom,'consumer');
1.61      raeburn   341:             if (ref($ltitools{$toolhash{'id'}}) eq 'HASH') {
                    342:                 $exttoolremote = $ltitools{$toolhash{'id'}}{'url'};
                    343:             }
                    344:         }
1.50      raeburn   345:         if ($toolhash{'target'} eq 'window') {
1.63      raeburn   346:             $exttool = 'window';
                    347:             $width = $toolhash{'width'};
                    348:             $height = $toolhash{'height'};
                    349:         } elsif ($toolhash{'target'} eq 'tab') {
1.70      raeburn   350:             $exttool = 'tab';
1.63      raeburn   351:         }
                    352:         if (($exttool eq 'window') || ($exttool eq 'tab')) {
1.70      raeburn   353:             $linktext = $toolhash{'linktext'};
1.60      raeburn   354:             $explanation = $toolhash{'explanation'};
1.61      raeburn   355:         } elsif (($exttoolremote =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
1.63      raeburn   356:             $exttool = 'tab';
1.50      raeburn   357:         }
1.47      raeburn   358:     }
1.50      raeburn   359:     if (($is_ext) || ($exttool)) {
1.42      raeburn   360:         &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.53      raeburn   361:             ['forceedit','register','folderpath','symb','idx','title','anchor']);
1.42      raeburn   362:         if (($env{'form.forceedit'}) &&
                    363:             (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
                    364:             (($env{'form.folderpath'} =~ /^supplemental/) ||
                    365:              ($env{'form.symb'} =~ /^uploaded/))) {
1.53      raeburn   366:             if ($env{'form.symb'}) {
                    367:                 (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'});
                    368:                 if ($res =~ /(#[^#]+)$/) {
                    369:                     $url .= $1;
                    370:                 }
                    371:             } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
                    372:                 if ($env{'form.anchor'} ne '') {
                    373:                     $url .= '#'.$env{'form.anchor'};
                    374:                 }
1.52      raeburn   375:             }
1.50      raeburn   376:             my $type = 'ext';
                    377:             if ($exttool) {
                    378:                 $type = 'tool';
1.58      raeburn   379:             } elsif (($url =~ /^http:/) && ($ENV{'SERVER_PORT'} == 443)) {
                    380:                 $hostname = $r->hostname();
1.50      raeburn   381:             }
1.42      raeburn   382:             $r->print(
                    383:                 &Apache::lonextresedit::display_editor($url,$env{'form.folderpath'},
                    384:                                                        $env{'form.symb'},
1.50      raeburn   385:                                                        $env{'form.idx'},$type,$cdom,
1.58      raeburn   386:                                                        $cnum,$hostname));
1.42      raeburn   387:             return OK;
                    388:         } elsif ($env{'form.folderpath'} =~ /^supplemental/) {
                    389:             my $crstype = &Apache::loncommon::course_type();
1.43      raeburn   390:             my $title = $env{'form.title'};
                    391:             if ($title eq '') {
1.50      raeburn   392:                 if ($is_ext) {
                    393:                     $title = &mt('External Resource');
                    394:                 } else {
                    395:                     $title = &mt('External Tool');
                    396:                 }
1.43      raeburn   397:             }
1.42      raeburn   398:             $brcrum =
1.43      raeburn   399:                 &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
1.42      raeburn   400:         }
                    401:     }
                    402: 
1.21      albertel  403: #
                    404: # Actual URL
                    405: #
1.62      raeburn   406:     if (($url=~/$LONCAPA::assess_re/) && (!$exttool)) {
1.21      albertel  407: #
                    408: # This is uploaded homework
                    409: #
1.38      droeschl  410:         $env{'request.state'}='uploaded';
                    411:         &Apache::lonhomework::renderpage($r,$url);
1.21      albertel  412:     } else {
                    413: #
                    414: # This is not homework
                    415: #
1.50      raeburn   416:         if (($is_ext) || ($exttool)) {
1.49      raeburn   417:             $absolute = $env{'request.use_absolute'};
1.38      droeschl  418:             $ENV{'QUERY_STRING'} =~ s/(^|\&)symb=[^\&]*/$1/;
1.42      raeburn   419:             $ENV{'QUERY_STRING'} =~ s/\&$//;
1.38      droeschl  420:         }
                    421: 
1.35      raeburn   422:         unless ($ENV{'QUERY_STRING'} eq '') {
1.38      droeschl  423:             $url.=(($url=~/\?/)?'&':'?').$ENV{'QUERY_STRING'};
1.35      raeburn   424:         }
1.38      droeschl  425: 
                    426:         # encrypt url if not external
1.59      raeburn   427:         unless ($is_ext) {
1.50      raeburn   428:             &Apache::lonenc::check_encrypt(\$url);
                    429:         }
1.38      droeschl  430: 
1.69      raeburn   431:         $r->print( wrapper($r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,
1.63      raeburn   432:                            $linktext,$explanation,undef,$width,$height) );
1.38      droeschl  433: 
1.21      albertel  434:     } # not just the menu
1.38      droeschl  435:     
1.21      albertel  436:     return OK;
1.13      www       437: } # handler
1.1       www       438: 
                    439: 1;
                    440: __END__
                    441: 
1.30      jms       442: =pod
1.1       www       443: 
1.30      jms       444: =head1 NAME
                    445: 
                    446: Apache::lonwrapper - External and binary file management.
                    447: 
                    448: =head1 SYNOPSIS
                    449: 
                    450: Wrapper for external and binary files as standalone resources. Edit handler for rat maps; TeX content handler.
                    451: 
                    452: This is part of the LearningOnline Network with CAPA project
                    453: described at http://www.lon-capa.org.
                    454: 
                    455: =head1 Subroutines
                    456: 
                    457: =over
                    458: 
1.71      raeburn   459: =item wrapper($r,$url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,$linktext,$explanation,$title,$width,$height)
1.30      jms       460: 
1.45      raeburn   461: =over
                    462: 
1.69      raeburn   463: =item $r
                    464: 
                    465: request object
                    466: 
1.46      raeburn   467: =item $url
                    468: 
1.71      raeburn   469: url to display either by including in an iframe within a
                    470: LON-CAPA page which has a standard LON-CAPA inline menu,
                    471: or in some cases launched in a separate tab or window,
                    472: launched via a link in a LON-CAPA page with standard inline
                    473: menu.
1.45      raeburn   474: 
                    475: =item $brcrum
                    476: 
                    477: breadcrumbs for unregistered urls
1.42      raeburn   478: (i.e., external resources in Supplemental Content).
1.45      raeburn   479: 
1.46      raeburn   480: =item $absolute
1.45      raeburn   481: 
                    482: contains protocol (http or https) followed by
                    483: the hostname, if menu items in the standard LON-CAPA
                    484: interface created by the call to loncommon::start_page()
                    485: within &wrapper() need to use absolute URLs rather than
                    486: relative URLs.
                    487: 
                    488: That will be the case where an external resource has been 
                    489: served from port 80, when the server customarily serves
                    490: requests using Apache/SSL (i.e., port 443). mod_rewrite 
1.49      raeburn   491: is used to switch requests for external resources and
                    492: the syllabus: /public/<domain>/<courseid>/syllabus
                    493: (which might also point at an external resource)
1.45      raeburn   494: from https:// to http:// where the the URL of the remote site 
                    495: specified in the resource itself is http://.
                    496: 
                    497: This is done to avoid default mixed content blocking
                    498: in Firefox 23 and later, when serving from Apache/SSL.
                    499: 
                    500: =item $is_ext
                    501: 
                    502: true if URL is for an external resource.
                    503: 
1.47      raeburn   504: =item $is_pdf
                    505: 
                    506: true if URL is for a PDF (based on file extension).
                    507: 
1.71      raeburn   508: =item $exttool
                    509: 
                    510: If URL is for an External Tool, will contain the target type: iframe, window or tab.
                    511: 
                    512: =item $linktext
                    513: 
                    514: optional. If URL is for an External Tool, and target type is window or tab, 
                    515: then the link text may be an option set in the course for each tool instance,
                    516: or may be a default defined in the domain for all instances of the tool.
                    517: 
                    518: =item $explanation
                    519: 
                    520: optional. If URL is for an External Tool, and target type is window or tab, 
                    521: then the explanation is an option set in the course for each tool instance,
                    522: or may be a default defined in the domain for all instances of the tool.
                    523: 
1.49      raeburn   524: =item $title
                    525: 
                    526: optional. If wrapped item is a PDF, and $env{'browser.mobile'} 
                    527: is true, a link to a PDF is shown. The "title" will be displayed
                    528: above the link, but if not provided as an arg, $env{'form.title'}
                    529: will be used, otherwise, the filename will be displayed (unless
                    530: hidden URL set for the resource).
                    531: 
1.71      raeburn   532: =item $width
                    533: 
                    534: optional. If URL is for an External Tool, and target type is window,
                    535: then a default width may have been defined in the domain for all instances of 
                    536: the tool.  If so, that width will be used for the window opened (via a link)
                    537: to launch the external tool.
                    538: 
                    539: =item $height
                    540: 
                    541: optional. If URL is for an External Tool, and target type is window,
                    542: then a default height may have been defined in the domain for all instances of 
                    543: the tool.  If so, that height will be used for the window opened (via a link)
                    544: to launch the external tool.
                    545: 
1.45      raeburn   546: =back
                    547: 
1.38      droeschl  548: Returns markup for the entire page.
1.30      jms       549: 
                    550: =item handler()
                    551: 
1.71      raeburn   552: Content handler for requests for: /adm/wrapper/...
                    553: used for content to be displayed in an iframe, or launched in a separate tab
                    554: or window via a link.  The target URL is extracted from the requested URL, by
                    555: removing the /adm/wrapper prefix. 
                    556: 
                    557: The target URL will typically be a PDF served from the current server, an 
                    558: external resource URL served from a different server, or an external tool
                    559: (from an LTI Provider) launched from LON-CAPA (as LTI Consumer) and launched
                    560: via a link.
                    561: 
                    562: If the request included forceedit in the query string, and the requester has
                    563: rights to modify course content, then the editor will be didplayed to allow
                    564: changes to be made to the resource (e.g., change the URL of the external resource,
                    565: or change the setting for the external tool instance.
                    566: 
                    567: If not in edit mode, then the wrapper() subroutine will be called to generate the
                    568: standard LON-CAPA inline menu, and then either a link to launch a separate tab or
                    569: window, or an iframe to display the content inline. 
                    570: 
1.30      jms       571: =back
                    572: 
                    573: =cut
1.1       www       574: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>