File:  [LON-CAPA] / rat / lonpage.pm
Revision 1.111.2.9: download - view: text, annotated - select for diffs
Sat Jan 18 01:12:51 2020 UTC (4 years, 3 months ago) by raeburn
Branches: version_2_11_X
- For 2.11
  Backport 1.129

    1: # The LearningOnline Network with CAPA
    2: # Page Handler
    3: #
    4: # $Id: lonpage.pm,v 1.111.2.9 2020/01/18 01:12:51 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: 
   31: 
   32: 
   33: package Apache::lonpage;
   34: 
   35: use strict;
   36: use Apache::Constants qw(:common :http);
   37: use Apache::lonnet;
   38: use Apache::loncommon();
   39: use Apache::lonhtmlcommon;
   40: use Apache::lonxml();
   41: use Apache::lonlocal;
   42: use Apache::lonmenu;
   43: use Apache::lonhomework;
   44: use Apache::lonenc();
   45: use HTML::TokeParser;
   46: use GDBM_File;
   47: use Apache::lonsequence;
   48: use lib '/home/httpd/lib/perl/';
   49: use LONCAPA;
   50:  
   51: 
   52: # -------------------------------------------------------------- Module Globals
   53: my %hash;
   54: my @rows;
   55: 
   56: # ------------------------------------------------------------------ Euclid gcd
   57: 
   58: sub euclid {
   59:     my ($e,$f)=@_;
   60:     my $a; my $b; my $r;
   61:     if ($e>$f) { $b=$e; $r=$f; } else { $r=$e; $b=$f; }
   62:     while ($r!=0) {
   63: 	$a=$b; $b=$r;
   64:         $r=$a%$b;
   65:     }
   66:     return $b;
   67: }
   68: 
   69: # ------------------------------------------------------------ Build page table
   70: 
   71: sub tracetable {
   72:     my ($sofar,$rid,$beenhere)=@_;
   73:     my $further=$sofar;
   74:     my $randomout=0;
   75:     unless ($env{'request.role.adv'}) {
   76:         $randomout = $hash{'randomout_'.$rid};
   77:     }
   78:     unless ($beenhere=~/\&$rid\&/) {
   79:         $beenhere.=$rid.'&';
   80:         unless ($randomout) {
   81:             if (defined($hash{'is_map_'.$rid})) {
   82:                 if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
   83:                     (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
   84:                     my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
   85: 	            $sofar=
   86:                        &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
   87:                        '&'.$frid.$beenhere);
   88:                     $sofar++;
   89:                     if ($hash{'src_'.$frid}) {
   90:                         my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
   91:                         if (($brepriv eq '2') || ($brepriv eq 'F')) {
   92:                             if (defined($rows[$sofar])) {
   93:                                 $rows[$sofar].='&'.$frid;
   94:                             } else {
   95:                                 $rows[$sofar]=$frid;
   96:                             }
   97: 	                }
   98: 	            }
   99: 	        }
  100:             } else {
  101:                 $sofar++;
  102:                 if ($hash{'src_'.$rid}) {
  103:                     my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
  104:                     if (($brepriv eq '2') || ($brepriv eq 'F')) {
  105:                         if (defined($rows[$sofar])) {
  106:                             $rows[$sofar].='&'.$rid;
  107:                         } else {
  108:                             $rows[$sofar]=$rid;
  109:                         }
  110: 	            }
  111:                 }
  112:             }
  113:         }
  114: 
  115:         if (defined($hash{'to_'.$rid})) {
  116: 	    my $mincond=1;
  117:             my $next='';
  118:             foreach (split(/\,/,$hash{'to_'.$rid})) {
  119:                 my $thiscond=
  120:       &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
  121:                 if ($thiscond>=$mincond) {
  122: 		    if ($next) {
  123: 		        $next.=','.$_.':'.$thiscond;
  124:                     } else {
  125:                         $next=$_.':'.$thiscond;
  126: 		    }
  127:                     if ($thiscond>$mincond) { $mincond=$thiscond; }
  128: 	        }
  129:             }
  130:             foreach (split(/\,/,$next)) {
  131:                 my ($linkid,$condval)=split(/\:/,$_);
  132:                 if ($condval>=$mincond) {
  133:                     my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
  134:                     if ($now>$further) { $further=$now; }
  135: 	        }
  136:             }
  137:         }
  138:     }
  139:     return $further;
  140: }
  141: 
  142: # ================================================================ Main Handler
  143: 
  144: sub handler {
  145:   my $r=shift;
  146: 
  147: # ------------------------------------------- Set document type for header only
  148: 
  149:   if ($r->header_only) {
  150:        if ($env{'browser.mathml'}) {
  151:            &Apache::loncommon::content_type($r,'text/xml');
  152:        } else {
  153:            &Apache::loncommon::content_type($r,'text/html'); 
  154:        }
  155:        $r->send_http_header;
  156:        return OK;
  157:    }
  158:   
  159:    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  160:                                           ['forceselect','launch']);
  161:   my $number_of_columns = 1;
  162:   my $requrl=$r->uri;  
  163:   my $target = $env{'form.grade_target'};
  164: 
  165: # Short term solution: define target as 'tex_answer' when retrieving answers
  166: # for resources in a .page when generating printouts.
  167: # A better long-term fix would be to modify the way problem rendering, and 
  168: # answer rendering are retrieved for individual resources when printing a .page,
  169: # so rendered problem and answer are sequential for individual resources in 
  170: # the .page
  171: #
  172:   if ($target eq 'answer') {
  173:       if ($env{'form.answer_output_mode'} eq 'tex') {
  174:           $target = 'tex_answer';
  175:       }
  176:   }
  177: #  &Apache::lonnet::logthis("Got a target of $target");
  178:   if ($target eq 'meta') {
  179:       &Apache::loncommon::content_type($r,'text/html');
  180:       $r->send_http_header;
  181:       return OK;
  182:   }
  183: # ----------------------------------------------------------------- Tie db file
  184:   if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {
  185:       my $fn=$env{'request.course.fn'};
  186:       if (-e "$fn.db") {
  187:           my %buttonshide;
  188:           my $hostname = $r->hostname();
  189:           if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
  190: # ------------------------------------------------------------------- Hash tied
  191:               my $firstres=$hash{'map_start_'.$requrl};
  192:               my $lastres=$hash{'map_finish_'.$requrl};
  193:               if (($firstres) && ($lastres)) {
  194: # ------------------------------------------------------------- Countdown Timer
  195:                   my $now = time;
  196:                   my ($pagefirstaccess,%hastimeleft,%countdowndisp);
  197:                   my ($pagesymb,$courseid,$domain,$name)=&Apache::lonnet::whichuser();
  198:                   if ($pagesymb && ($courseid ne '') && ($domain ne '') && ($name ne '')) {
  199:                       my %times=&Apache::lonnet::get('firstaccesstimes',
  200:                                                      [$courseid."\0".$pagesymb],
  201:                                                      $domain,$name);
  202:                       if ($times{$courseid."\0".$pagesymb} =~ /^\d+$/) {
  203:                           $pagefirstaccess = $times{$courseid."\0".$pagesymb};
  204:                       }
  205:                   }
  206: # ----------------------------------------------------------------- Render page
  207: 
  208:                   @rows=();
  209: 
  210:                   &tracetable(0,$firstres,'&');
  211: 
  212: # ------------------------------------------------------------ Add to symb list
  213: 
  214:                   my $i;
  215:                   my %symbhash=();
  216:                   for ($i=0;$i<=$#rows;$i++) {
  217: 		     if ($rows[$i]) {
  218:                         my @colcont=split(/\&/,$rows[$i]);
  219:                         foreach my $rid (@colcont) {
  220: 			    my ($mapid,$resid)=split(/\./,$rid);
  221: 			    $symbhash{$hash{'src_'.$rid}}=
  222: 				[$hash{'src_'.$rid},$resid];
  223: 		        }
  224: 		     }
  225: 		  }
  226:                   &Apache::lonnet::symblist($requrl,%symbhash);
  227: 
  228: # ------------------------------------------------------------------ Page parms
  229: 
  230:                   my $j;
  231:                   my $lcm=1;
  232:                   my $contents=0;
  233:                   my $nforms=0;
  234:                   my $nuploads=0;
  235:                   my $ntimers=0;
  236:                   my %turninpaths;
  237:                   my %multiresps;
  238:                   my $turninparent;
  239:                   
  240:                   my %ssibody=();
  241:                   my %ssibgcolor=();
  242:                   my %ssitext=();
  243:                   my %ssilink=();
  244:                   my %ssivlink=();
  245:                   my %ssialink=();
  246:      
  247:                   my %cellemb=();
  248:                   my %cellexternal=();
  249: 
  250:                   my $allscript='';
  251:                   my $allmeta='';
  252: 
  253:                   my $isxml=0;
  254:                   my $xmlheader='';
  255:                   my $xmlbody='';
  256: 
  257: # --------------------------------------------- Get SSI output, post parameters
  258: 
  259:                   for ($i=0;$i<=$#rows;$i++) {
  260: 		     if ($rows[$i]) {
  261: 		      $contents++;
  262:                       my @colcont=split(/\&/,$rows[$i]);
  263:                       $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
  264:                       foreach (@colcont) {
  265:                           my $src=$hash{'src_'.$_};
  266:                           my $plainsrc = $src;
  267:                           my ($extension)=($src=~/\.(\w+)$/);
  268: 			  $cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
  269: 			  if ($hash{'encrypted_'.$_}) {
  270: 			      $src=&Apache::lonenc::encrypted($src);
  271: 			  }
  272:                           my ($mapid,$resid)=split(/\./,$_);
  273:                           my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
  274:                           unless ($env{'request.role.adv'}) {
  275:                               $buttonshide{$symb} = &Apache::lonnet::EXT("resource.0.buttonshide",$symb);
  276:                           }
  277:                           $cellemb{$_}=
  278: 			      &Apache::loncommon::fileembstyle($extension);
  279:                           if ($cellexternal{$_}) {
  280:                               unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  281:                                   $ssibody{$_} = <<ENDEXT;
  282: <iframe src="$src" width="100%">No iframe support!</iframe>
  283: ENDEXT
  284:                               }
  285:                           } elsif ($cellemb{$_} eq 'ssi') {
  286: # --------------------------------------------------------- This is an SSI cell
  287: 			      my $prefix='p_'.$_.'_';
  288:                               my $idprefix='p_'.join('_',($mapid,$resid,''));
  289:                               my %posthash=('request.prefix' => $prefix,
  290: 					    'LONCAPA_INTERNAL_no_discussion' => 'true',
  291: 					    'symb' => $symb);
  292: 			      if (($env{'form.grade_target'} eq 'tex') ||
  293:                                  ($env{'form.answer_output_mode'} eq 'tex')) {
  294: 				  $posthash{'grade_target'}=$env{'form.grade_target'};
  295: 				  $posthash{'textwidth'}=$env{'form.textwidth'};
  296: 				  $posthash{'problem_split'}=$env{'form.problem_split'};
  297: 				  $posthash{'latex_type'}=$env{'form.latex_type'};
  298: 				  $posthash{'rndseed'}=$env{'form.rndseed'};
  299:                                   $posthash{'answer_output_mode'} = $env{'form.answer_output_mode'};
  300: 			      }
  301: 			      my $submitted=$env{'form.all_submit_pressed'};
  302: 			      if (!$submitted) {
  303: 				  foreach my $key (keys(%env)) {
  304: 				      if ($key=~/^\Qform.$prefix\Esubmit_(.+)_pressed$/) {
  305:                                           if ($env{$key}) {
  306:                                               $submitted=1;
  307:                                               last;
  308:                                           }
  309: 				      }
  310:                                   }
  311: 			      }
  312:                               if ($submitted) {
  313: 				  foreach my $key (keys(%env)) {
  314: 				      if ($key=~/^\Qform.$prefix\E/) {
  315: 					  my $name=$key;
  316: 					  $name=~s/^\Qform.$prefix\E//;
  317: 					  $posthash{$name}=$env{$key};
  318:                                       }
  319: 				  }
  320: 				  if ($env{'form.all_submit_pressed'}) {
  321: 				      $posthash{'all_submit'}='yes';
  322: 				  }
  323: 			      } elsif ($env{'form.'.$prefix.'markaccess'} eq 'yes') {
  324: 		                  $posthash{'markaccess'} = $env{'form.'.$prefix.'markaccess'};
  325: 		              }
  326:                               if ($env{'environment.remote'} eq 'on') {
  327:                                   $posthash{'inhibitmenu'} = 'yes';
  328:                               }
  329:                               my $output=Apache::lonnet::ssi($src,%posthash);
  330: 			      $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;
  331:                               if (($target eq 'tex') || ($target eq 'tex_answer')) {
  332: 				  $output =~ s/^([^&]+)\\begin\{document}//;
  333: 				  $output =~ s/\\end\{document}//;
  334: #				  $output = '\parbox{\minipagewidth}{ '.$output.' }';
  335:                                   #some additional cleanup necessary for LateX (due to limitations of table environment 
  336: 				  $output =~ s/(\\vskip\s*\d+mm)\s*(\\\\)+/$1/g;
  337: 			      }
  338:                               my $matheditor;
  339:                               if ($output =~ /\Qjavascript:LC_mathedit_HWVAL_\E/) {
  340:                                   $matheditor = 'dragmath';
  341:                               } elsif ($output =~ /LCmathField/) {
  342:                                   $matheditor = 'lcmath';
  343:                               }
  344:                               my $parser=HTML::TokeParser->new(\$output);
  345:                               my $token;
  346:                               my $thisdir=$src;
  347:                               my $bodydef=0;
  348:                               my $thisxml=0;
  349:                               my @rlinks=();
  350:                               if ($output=~/\?xml/) {
  351:                                  $isxml=1;
  352:                                  $thisxml=1;
  353:                                  $output=~
  354:          /((?:\<(?:\?xml|\!DOC|html)[^\>]*(?:\>|\>\]\>)\s*)+)\<body[^\>]*\>/si;
  355:                                  $xmlheader=$1;
  356: 			      }
  357:                               while ($token=$parser->get_token) {
  358: 				if ($token->[0] eq 'S') {
  359:                                   if ($token->[1] eq 'a') {
  360: 				      if ($token->[2]->{'href'}) {
  361:                                          $rlinks[$#rlinks+1]=
  362: 					     $token->[2]->{'href'};
  363: 				      }
  364: 				  } elsif ($token->[1] eq 'img') {
  365:                                          $rlinks[$#rlinks+1]=
  366: 					     $token->[2]->{'src'};
  367: 				  } elsif ($token->[1] eq 'embed') {
  368:                                          $rlinks[$#rlinks+1]=
  369: 					     $token->[2]->{'src'};
  370: 				  } elsif ($token->[1] eq 'base') {
  371: 				      $thisdir=$token->[2]->{'href'};
  372: 				  } elsif ($token->[1] eq 'body') {
  373: 				      $bodydef=1;
  374:                                       $ssibgcolor{$_}=$token->[2]->{'bgcolor'};
  375:                                       $ssitext{$_}=$token->[2]->{'text'};
  376:                                       $ssilink{$_}=$token->[2]->{'link'};
  377:                                       $ssivlink{$_}=$token->[2]->{'vlink'};
  378:                                       $ssialink{$_}=$token->[2]->{'alink'};
  379:                                       if ($thisxml) {
  380: 					  $xmlbody=$token->[4];
  381:                                       }
  382:                                   } elsif ($token->[1] eq 'meta') {
  383: 				    if ($token->[4] !~ m:/>$:) {
  384: 				      $allmeta.="\n".$token->[4].'</meta>';
  385: 				    } else {
  386: 				      $allmeta.="\n".$token->[4];
  387: 				    }
  388:                                   } elsif (($token->[1] eq 'script') &&
  389:                                            ($bodydef==0)) {
  390: 				      $allscript.="\n\n"
  391:                                                 .$parser->get_text('/script');
  392:                                   }
  393: 			        }
  394: 			      }
  395:                               if ($output=~/\<body[^\>]*\>(.*)/si) {
  396:                                  $output=$1; 
  397:                               }
  398:                               $output=~s/\<\/body\>.*//si;
  399:                               if ($output=~/\<form/si) {
  400:                                   my $hastimer; 
  401: 				  $nforms++;
  402:                                   $output=~s/\<form[^\>]*\>//gsi;
  403:                                   $output=~s/\<\/form[^\>]*\>//gsi;
  404:                                   if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*HWFILE/) {
  405:                                       $nuploads++;
  406:                                   }
  407:                                   if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*accessbutton/) {
  408:                                       $ntimers++;
  409:                                       $hastimer = 1;
  410:                                   }
  411:                                   $output=~
  412: 				      s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
  413:                                   $output=~
  414:                                       s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
  415:                                   $output=~
  416:                                       s/(\Qthis.form.elements['\E)(HW(?:VAL|CHK)_[^']+\'\]\.(?:value=\'|checked))/$1$prefix$2/gsi;
  417:                                   if ($hastimer) {
  418:                                       $output=~
  419:                                           s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;
  420:                                       $output=~  s/\<(input[^\>]+name=\Q"$prefix\Emarkaccess"[^\>]+value=["'])(?:yes)(['"][^\>]*)\>/\<$1$2\>/gsi;
  421:                                   }
  422:                                   if ($matheditor eq 'dragmath') {
  423:                                       $output=~
  424:                                           s/(\Qjavascript:LC_mathedit_\E)(HWVAL_)([^'"]+?)(\(['"]*)(\QHWVAL_\E\3['"]\)\;void\(0\)\;)/$1$idprefix$2$3$4$idprefix$5/g;
  425:                                       $output=~
  426:                                           s/(function\s+LC_mathedit_)(HWVAL_)([^'"]+?)(\s+\(LCtextline\))/$1$idprefix$2$3$4/g;
  427:                                   } elsif ($matheditor eq 'lcmath') {
  428:                                       $output=~
  429:                                           s/(var\s+LCmathField\s+=\s+document\.getElementById\(['"])([^'"]+?)(['"]\)\;)/$1$idprefix$2$3/g;
  430:                                   }
  431:                                   $output=~
  432:                                       s/(\Q<div id="msg_\E)(\Qsubmit_\E)([^"]*)(\Q" style="display:none">\E)/<input type="hidden" name="$prefix$2$3_pressed" id="$idprefix$2$3_pressed" value="" \/>$1$idprefix$2$3$4/g;
  433:                                   $output=~
  434:                                       s/(\Q<td class="LC_status_\E)(\Qsubmit_\E)([^\"]*)(\s*[^\"]*"\>)/$1$idprefix$2$3$4/g;
  435:                                   if ($nuploads) {
  436:                                        ($turninpaths{$prefix},$multiresps{$prefix}) = 
  437:                                            &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
  438:                                        if ($turninparent eq '') {
  439:                                            $turninparent = $turninpaths{$prefix};
  440:                                            $turninparent =~ s{(/[^/]+)$}{}; 
  441:                                        }
  442:                                   }
  443:                                   $output=~
  444:                                       s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
  445:                                   $output=~
  446:                                       s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
  447:                                   unless ($hastimer) {
  448:                                       if ($plainsrc =~ /$LONCAPA::assess_re/) {
  449:                                           %Apache::lonhomework::history =
  450:                                               &Apache::lonnet::restore($symb,$courseid,$domain,$name);
  451:                                           my $type = 'problem';
  452:                                           if ($extension eq 'task') {
  453:                                               $type = 'Task';
  454:                                           }
  455:                                           my ($status,$accessmsg,$slot_name,$slot) =
  456:                                               &Apache::lonhomework::check_slot_access('0',$type,$symb);
  457:                                           undef(%Apache::lonhomework::history);
  458:                                           my $probstatus = &Apache::lonnet::EXT("resource.0.problemstatus",$symb);
  459:                                           if (($status eq 'CAN_ANSWER') || (($status eq 'CANNOT_ANSWER') && 
  460:                                               (($probstatus eq 'no') || ($probstatus eq 'no_feedback_ever')))) {
  461:                                               my ($slothastime,$timerhastime);
  462:                                               if ($slot_name ne '') {
  463:                                                   if (ref($slot) eq 'HASH') {
  464:                                                       if (($slot->{'starttime'} < $now) &&
  465:                                                           ($slot->{'endtime'} > $now)) {
  466:                                                           $slothastime = $now - $slot->{'endtime'};
  467:                                                       }
  468:                                                   }
  469:                                               }
  470:                                               my $duedate = &Apache::lonnet::EXT("resource.0.duedate",$symb);
  471:                                               my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb);
  472:                                               if (@interval > 1) {
  473:                                                   my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
  474:                                                   if ($first_access > 0) {
  475:                                                       my $timeremains = $first_access+$interval[0] - $now;
  476:                                                       if ($timeremains > 0) {
  477:                                                           $timerhastime = $timeremains;
  478:                                                       }
  479:                                                   }
  480:                                               }
  481:                                               if (($duedate && $duedate > $now) ||
  482:                                                   (!$duedate && $timerhastime > 0) ||
  483:                                                   ($slot_name ne '' && $slothastime)) {
  484:                                                   if ((@interval > 1 && $timerhastime) ||
  485:                                                       ($type eq 'Task' && $slothastime)) {
  486:                                                       $countdowndisp{$symb} = 'inline';
  487:                                                       if ((@interval > 1) && ($timerhastime)) {
  488:                                                           $hastimeleft{$symb} = $timerhastime;
  489:                                                       } else {
  490:                                                           $hastimeleft{$symb} = $slothastime;
  491:                                                       }
  492:                                                   } else {
  493:                                                       $hastimeleft{$symb} = $duedate - $now;
  494:                                                       $countdowndisp{$symb} = 'none';
  495:                                                   }
  496:                                               }
  497:                                           }
  498:                                       }
  499:                                   }
  500:                               }
  501:                               $thisdir=~s/\/[^\/]*$//;
  502: 			      foreach (@rlinks) {
  503: 				  unless (($_=~/^https?\:\/\//i) ||
  504: 					  ($_=~/^\//) ||
  505: 					  ($_=~/^javascript:/i) ||
  506: 					  ($_=~/^mailto:/i) ||
  507: 					  ($_=~/^\#/)) {
  508: 				      my $newlocation=
  509: 				    &Apache::lonnet::hreflocation($thisdir,$_);
  510:                      $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
  511: 				  }
  512: 			      }
  513: # -------------------------------------------------- Deal with Applet codebases
  514:   $output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
  515: 			      $ssibody{$_}=$output;
  516: # ---------------------------------------------------------------- End SSI cell
  517:                           }
  518:                       }
  519:                      } 
  520:                   }
  521:                   unless ($contents) {
  522:                       &Apache::loncommon::content_type($r,'text/html');
  523:                       $r->send_http_header;
  524:                       $r->print(&Apache::loncommon::start_page(undef,undef,
  525: 							       {'force_register' => 1}));
  526:                       $r->print(&mt('This page is either empty or it only contains resources that are currently hidden').'. ');
  527:                       $r->print('<br /><br />'.&mt('Please use the LON-CAPA navigation arrows to move to another item in the course').
  528: 				&Apache::loncommon::end_page());
  529:                   } else {
  530: # ------------------------------------------------------------------ Build page
  531: 
  532: # ---------------------------------------------------------------- Send headers
  533: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  534: 			  if ($isxml) {
  535: 			      &Apache::loncommon::content_type($r,'text/xml');
  536: 			  } else {
  537: 			      &Apache::loncommon::content_type($r,'text/html');
  538: 			  }
  539: 			  $r->send_http_header;
  540: # ------------------------------------------------------------------------ Head
  541: 			  if ($allscript) {
  542: 			      $allscript = 
  543: 				  "\n".'<script type="text/javascript">'."\n".
  544: 				  $allscript.
  545: 				  "\n</script>\n";
  546: 			  }
  547:                           if (($nforms) && ($nuploads)) {
  548:                               $allscript .= &Apache::lonhtmlcommon::file_submissionchk_js(\%turninpaths,\%multiresps).
  549:                                             '<script type="text/javascript" '.
  550:                                             'src="/res/adm/includes/file_upload.js"></script>';
  551:                           }
  552:                           if (($nforms) && (&Apache::lonhtmlcommon::htmlareabrowser())) {
  553:                               my %textarea_args = (
  554:                                   dragmath => 'math',
  555:                               );
  556:                               $allscript .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
  557:                           }
  558:                           if ($ntimers) {
  559:                               $allscript .= '<script type="text/javascript">'."\n".
  560:                                             '// <![CDATA['."\n".
  561:                                             'function pageTimer(form,prefix) {'."\n".
  562:                                             "   form.elements[prefix+'markaccess'].value = 'yes';\n".
  563:                                             "   form.submit();\n".
  564:                                             '}'."\n".
  565:                                             '// ]]>'.
  566:                                             "\n</script>\n";
  567:                           }
  568:                           if (keys(%hastimeleft)) {
  569:                               my (%uniquetimes,%uniquedisplays);
  570:                               foreach my $item (values(%hastimeleft)) {
  571:                                   if (exists($uniquetimes{$item})) {
  572:                                       $uniquetimes{$item} ++; 
  573:                                   } else {
  574:                                       $uniquetimes{$item} = 1;
  575:                                   }
  576:                               }
  577:                               if (keys(%uniquetimes) == 1) {
  578:                                   my (%uniquedisplays,%uniquedones,$currdisp);
  579:                                   if (keys(%countdowndisp)) {
  580:                                       foreach my $item (values(%countdowndisp)) {
  581:                                           if (exists($uniquedisplays{$item})) {
  582:                                               $uniquedisplays{$item} ++;
  583:                                           } else {
  584:                                               $uniquedisplays{$item} = 1;
  585:                                           }
  586:                                       }
  587:                                       my @countdowndisplay = keys(%uniquedisplays);
  588:                                       if (scalar(@countdowndisplay) == 1) {
  589:                                           $currdisp = $countdowndisplay[0];
  590:                                       }
  591:                                   }
  592:                                   &add_countdown_timer($currdisp);
  593:                               }
  594:                           }
  595:                           my $pagebuttonshide;
  596:                           if (keys(%buttonshide)) {
  597:                               my %uniquebuttonhide;
  598:                               foreach my $item (values(%buttonshide)) {
  599:                                   if (exists($uniquebuttonhide{$item})) {
  600:                                       $uniquebuttonhide{$item} ++;
  601:                                   } else {
  602:                                       $uniquebuttonhide{$item} = 1;
  603:                                   }
  604:                               }
  605:                               if (keys(%uniquebuttonhide) == 1) {
  606:                                   if (lc((keys(%uniquebuttonhide))[0]) eq 'yes') {
  607:                                       $pagebuttonshide = 'yes';
  608:                                   }
  609:                               }
  610:                           }
  611: # ------------------------------------------------------------------ Start body
  612: 			  $r->print(&Apache::loncommon::start_page(undef,$allscript,
  613: 								   {'force_register' => 1,
  614: 								    'bgcolor'        => '#ffffff',
  615: 								    'hide_buttons'   => $pagebuttonshide}));
  616: # ------------------------------------------------------------------ Start form
  617: 			  if ($nforms) {
  618: 			      my $fmtag = '<form name="lonhomework" method="post"  enctype="multipart/form-data"';
  619:                               if ($nuploads) {
  620:                                   my $multi;
  621:                                   if ($nuploads > 1) {
  622:                                       $multi = 1;
  623:                                   }
  624:                                   $fmtag .= 'onsubmit="return file_submission_check(this,'."'$turninparent','$multi'".');"';
  625:                               }
  626:                               $fmtag .= ' action="'.
  627: 					&Apache::lonenc::check_encrypt($requrl)
  628: 					.'" id="LC_page">';
  629:                               $r->print($fmtag);
  630: 			  }
  631: 		      } elsif (($target eq 'tex') || ($target eq 'tex_answer')) {
  632: 			  #  I think this is not needed as the header
  633: 			  # will be put in for each of the page parts
  634: 			  # by the londefdef.pm now that we are opening up
  635: 			  # the parts of a page.
  636: 			  #$r->print('\documentclass{article}
  637:                           #       \newcommand{\keephidden}[1]{}           
  638:                           #       \usepackage[dvips]{graphicx}
  639:                           #       \usepackage{epsfig}
  640:                           #       \usepackage{calc}
  641:                           #       \usepackage{longtable}
  642:                           #       \begin{document}');
  643: 		      }
  644: # ----------------------------------------------------------------- Start table
  645: 		      if (($target eq 'tex') || ($target eq 'tex_answer')) {
  646: #			 #  $r->print('\begin{longtable}INSERTTHEHEADOFLONGTABLE\endfirsthead\endhead ');
  647: 			  if ($number_of_columns le $lcm) {$number_of_columns=$lcm;};
  648: 		      } else {
  649: 			  $r->print('<table width="100%" cols="'.$lcm.'" border="0">');
  650: 		      }
  651: # generate rows
  652:                       for ($i=0;$i<=$#rows;$i++) {
  653: 			if ($rows[$i]) {
  654: 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  655: 				$r->print("\n<tr>");
  656: 			    }
  657:                           my @colcont=split(/\&/,$rows[$i]);
  658:                           my $avespan=$lcm/($#colcont+1);
  659:                           for ($j=0;$j<=$#colcont;$j++) {
  660:                               my $rid=$colcont[$j];
  661: 			      my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide,$hostname).'<br />';
  662: 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  663: 				$r->print('<td colspan="'.$avespan.'"');
  664: 			    }
  665:                               if (($cellemb{$rid} eq 'ssi') || ($cellexternal{$rid})) {
  666: 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  667: 				      if ($ssibgcolor{$rid}) {
  668: 					  $r->print(' bgcolor="'.
  669: 						    $ssibgcolor{$rid}.'"');
  670: 				      }
  671: 				      $r->print('>'.$metainfo.'<font');
  672: 		    
  673: 				      if ($ssitext{$rid}) {
  674: 					  $r->print(' text="'.$ssitext{$rid}.'"');
  675: 				      }
  676: 				      if ($ssilink{$rid}) {
  677: 					  $r->print(' link="'.$ssilink{$rid}.'"');
  678: 				      }
  679: 				      if ($ssitext{$rid}) {
  680: 					  $r->print(' vlink="'.$ssivlink{$rid}.'"');
  681: 				      }
  682: 				      if ($ssialink{$rid}) {
  683: 					  $r->print(' alink="'.$ssialink{$rid}.'"');
  684: 				      }             
  685: 				      $r->print('>');
  686: 				  }
  687:                                   unless (($cellexternal{$rid}) && 
  688:                                           ($target eq 'tex') && ($target eq 'tex_answer')) {
  689:                                       $r->print($ssibody{$rid});
  690:                                   }
  691: 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  692: 				      $r->print('</font>');
  693:                                   }
  694:                                   if ($env{'course.'.
  695:                                       $env{'request.course.id'}.
  696:                                       '.pageseparators'} eq 'yes') {
  697:                                       unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  698:                                           $r->print('<hr />');
  699:                                       } 
  700: 				  }
  701: 			      } elsif ($cellemb{$rid} eq 'img') {
  702:                                   $r->print('>'.$metainfo.'<img src="'.
  703:                                     $hash{'src_'.$rid}.'" />');
  704: 			      } elsif ($cellemb{$rid} eq 'emb') {
  705:                                   $r->print('>'.$metainfo.'<embed src="'.
  706:                                     $hash{'src_'.$rid}.'"></embed>');
  707:                               } elsif (&Apache::lonnet::declutter($hash{'src_'.$rid}) !~/\.(sequence|page)$/) {
  708:                                   $r->print($metainfo.'<b>'.$hash{'title_'.$rid}.'</b><br />');
  709:                                   unless ($cellemb{$rid} eq 'wrp') {
  710:                                       $r->print(&mt('It is recommended that you use an up-to-date virus scanner before handling this file.'));
  711:                                   }
  712:                                   $r->print('</p><p><table>'.
  713:                                             &Apache::londocs::entryline(0,
  714:                                                                         &mt("Click to download or use your browser's Save Link function"),
  715:                                                                         '/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).
  716:                                                                         '</table></p><br />');
  717:                               }
  718: 			      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  719: 				  $r->print('</td>');
  720: 			      } else {
  721: #                                  for (my $incol=1;$incol<=$avespan;$incol++) {
  722: #				      $r->print(' & ');
  723: #				  }
  724: 			      }
  725:                           }
  726: 			      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  727: 				  $r->print('</tr>');
  728: 			      } else {
  729: #				  $r->print('REMOVETHEHEADOFLONGTABLE\\\\');
  730: 			      }
  731: 		        }
  732:                       }
  733: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  734: 			  $r->print("\n</table>");
  735: 		      } else {
  736: #			  $r->print('\end{longtable}\strut');
  737: 		      }
  738: # ---------------------------------------------------------------- Submit, etc.
  739:                       if ($nforms) {
  740:                           my $class;
  741:                           if ($nforms > 1) {
  742:                               $class = ' class="LC_hwk_submit"';
  743:                               if ($ntimers) {
  744:                                   $nforms = 1;
  745:                                   $class = '';
  746:                               }
  747:                           }
  748:                           $r->print(
  749: 	                  '<input name="all_submit" value="'.&mt('Submit All').'" type="'.
  750: 			  (($nforms>1)?'submit':'hidden').'"'.$class.' id="all_submit" />'.
  751:                           '<input type="hidden" name="all_submit_pressed" '.
  752:                           'id="all_submit_pressed" value="" />'.
  753:                           '<div id="msg_all_submit" style="display:none">'.
  754:                           &mt('Processing your submission ...').'</div></form>');
  755:                       }
  756: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  757: 			  $r->print(&Apache::loncommon::end_page({'discussion'
  758: 								      => 1,}));
  759: 		      } else {
  760: 			  $r->print('\end{document}'.$number_of_columns);
  761: 		      }
  762: 		      &Apache::lonnet::symblist($requrl,%symbhash);
  763: 		      my ($map,$id,$url)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
  764: 		      &Apache::lonnet::symblist($map,'last_known'=>[$url,$id]);
  765: # -------------------------------------------------------------------- End page
  766:                   }                  
  767: # ------------------------------------------------------------- End render page
  768:               } else {
  769:                   &Apache::loncommon::content_type($r,'text/html');
  770:                   $r->send_http_header;
  771:                   &Apache::lonsequence::viewmap($r,$requrl);
  772:               }
  773: # ------------------------------------------------------------------ Untie hash
  774:               unless (untie(%hash)) {
  775:                    &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  776:                        "Could not untie coursemap $fn (browse).</font>"); 
  777:               }
  778: # -------------------------------------------------------------------- All done
  779: 	      return OK;
  780: # ----------------------------------------------- Errors, hash could no be tied
  781:           }
  782:       } 
  783:   }
  784:   &Apache::loncommon::content_type($r,'text/html');
  785:   $r->send_http_header;
  786:   &Apache::lonsequence::viewmap($r,$requrl);
  787:   return OK; 
  788: }
  789: 
  790: sub get_buttons {
  791:     my ($hash,$rid,$buttonshide,$hostname) = @_;
  792: 
  793:     my $metainfo = '';
  794:     my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});
  795:     my ($mapid,$resid)=split(/\./,$rid);
  796:     my $symb=&Apache::lonnet::encode_symb($hash->{'map_id_'.$mapid},
  797: 					  $resid,
  798: 					  $hash->{'src_'.$rid});
  799:     unless ($env{'request.role.adv'}) {
  800:         if ($buttonshide->{$symb} eq 'yes') {
  801:             return;
  802:         }
  803:     }
  804:     if ($hash->{'encrypted_'.$rid}) {
  805: 	$symb=&Apache::lonenc::encrypted($symb);
  806: 	$esrc=&Apache::lonenc::encrypted($esrc);
  807:     }
  808:     if ($hash->{'src_'.$rid} !~ m-^/uploaded/-
  809:         && $hash->{'src_'.$rid} !~ m{^https?://}
  810: 	&& !$env{'request.enc'}
  811: 	&& ($env{'request.role.adv'}
  812: 	    || !$hash->{'encrypted_'.$rid})) { 
  813: 	$metainfo .='<a name="'.&escape($symb).'" />'.
  814: 	    '<a href="'.$hash->{'src_'.$rid}.'.meta'.'" target="LONcatInfo">'.
  815:             '<img src="/res/adm/pages/catalog.png" class="LC_icon"'.
  816:             ' alt="'.&mt('Show Metadata').'"'.
  817:             ' title="'.&mt('Show Metadata').'" />'.
  818: 	    '</a>';
  819:     }
  820:     if (($hash->{'src_'.$rid} !~ m{^/uploaded/}) &&
  821:         ($hash->{'src_'.$rid} !~ m{^https?://})) {
  822:         $metainfo .= '<a href="/adm/evaluate?postdata='.
  823: 	    &escape($esrc).
  824: 	    '" target="LONcatInfo">'.
  825:             '<img src="/res/adm/pages/eval.png" class="LC_icon"'.
  826:             ' alt="'.&mt('Provide my evaluation of this resource').'"'.
  827:             ' title="'.&mt('Provide my evaluation of this resource').'" />'.
  828: 	    '</a>';
  829:     }
  830:     if (($hash->{'src_'.$rid}=~/$LONCAPA::assess_re/) &&
  831: 	($hash->{'src_'.$rid} !~ m-^/uploaded/-)) {
  832: 
  833: 	if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
  834: 	    $metainfo.=
  835: 		'<a href="/adm/grades?symb='.&escape($symb).
  836: #               '&command=submission" target="LONcatInfo">'.
  837: 		'&command=submission">'.
  838:                 '<img src="/adm/lonMisc/subm_button.png" class="LC_icon"'.
  839:                 ' alt="'.&mt('View Submissions for a Student or a Group of Students').'"'.
  840:                 ' title="'.&mt('View Submissions for a Student or a Group of Students').'" />'.
  841: 		'</a>'.
  842: 		'<a href="/adm/grades?symb='.&escape($symb).
  843: #               '&command=gradingmenu" target="LONcatInfo">'.
  844: 		'&command=gradingmenu">'.
  845:                 '<img src="/res/adm/pages/pgrd.png" class="LC_icon"'.
  846:                 ' alt="'.&mt('Content Grades').'"'.
  847:                 ' title="'.&mt('Content Grades').'" />'.
  848: 		'</a>';
  849: 	}
  850: 	if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
  851: 	    $metainfo.=
  852: 		'<a href="/adm/parmset?symb='.&escape($symb).
  853: #               '" target="LONcatInfo">'.
  854: 		'" >'.
  855:                 '<img src="/adm/lonMisc/pprm_button.png" class="LC_icon"'.
  856:                 ' alt="'.&mt('Content Settings').'"'.
  857:                 ' title="'.&mt('Content Settings').'" />'.
  858: 		'</a>';
  859: 	}
  860:     }
  861:     if ($env{'request.course.id'}) {
  862:         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
  863:         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
  864:         my $file=&Apache::lonnet::declutter($hash->{'src_'.$rid});
  865:         my $editbutton = '';
  866:         if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
  867:             my ($cfile,$home,$switchserver,$forceedit,$forceview) =
  868:                 &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb);
  869:             if ($cfile ne '') {
  870:                 my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
  871:                                                                      $forceedit,1,$symb,undef,
  872:                                                                      &escape($env{'form.title'},
  873:                                                                      $hostname));
  874:                 if ($jscall) {
  875:                     $editbutton = 1;
  876:                     my $icon = 'pcstr.png';
  877:                     my $label = &mt('Edit');
  878:                     my $title = &mt('Edit this resource');
  879:                     my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
  880:                               ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
  881:                     $metainfo .= '&nbsp;<a href="javascript:'.$jscall.';">'.$pic.'</a>';
  882:                 }
  883:             }
  884:         }
  885:         if ((!$editbutton) && ($file=~/$LONCAPA::assess_re/)) {
  886:             my $url = &Apache::lonnet::clutter($file);
  887:             my $viewsrcbutton;
  888:             if ((&Apache::lonnet::allowed('cre','/')) &&
  889:                 (&Apache::lonnet::metadata($url,'sourceavail') eq 'open')) {
  890:                 $viewsrcbutton = 1;
  891:             } elsif (&Apache::lonnet::allowed('vxc',$env{'request.course.id'})) {
  892:                 if ($url =~ m{^\Q/res/$cdom/\E($LONCAPA::match_username)/}) {
  893:                     my $auname = $1;
  894:                     if (($env{'request.course.adhocsrcaccess'} ne '') &&
  895:                         (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {
  896:                         $viewsrcbutton = 1;
  897:                     }
  898:                 }
  899:             }
  900:             if ($viewsrcbutton) {
  901:                 my $icon = 'pcstr.png';
  902:                 my $label = &mt('View Source');
  903:                 my $title = &mt('View source code');
  904:                 my $jsrid = $rid;
  905:                 $jsrid =~ s/\./_/g;
  906:                 my $showurl = &escape(&Apache::lonenc::check_encrypt($url));
  907:                 my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
  908:                           ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
  909:                 $metainfo .= '&nbsp;<a href="javascript:open_source_'.$jsrid.'();">'.$pic.'</a>'."\n".
  910:                              '<script type="text/javascript">'."\n".
  911:                              "function open_source_$jsrid() {\n".
  912:                              "  sourcewin=window.open('/adm/source?inhibitmenu=yes&viewonly=1&filename=$showurl','LONsource',".
  913:                              "'height=500,width=600,resizable=yes,location=no,menubar=no,toolbar=no,scrollbars=yes');\n".
  914:                              "}\n".
  915:                              "</script>\n";
  916:             }
  917:         }
  918:     }
  919:     return $metainfo;
  920: }
  921: 
  922: sub add_countdown_timer {
  923:     my ($currdisp) = @_;
  924:     my ($collapse,$expand,$alttxt,$title);
  925:     if ($currdisp eq 'inline') {
  926:         $collapse = '&#9658;&nbsp;';
  927:     } else {
  928:         $expand = '&#9668;&nbsp;';
  929:     }
  930:     unless ($env{'environment.icons'} eq 'iconsonly') {
  931:         $alttxt = &mt('Timer');
  932:         $title = $alttxt.'&nbsp;';
  933:     }
  934:     my $desc = &mt('Countdown to due date/time');
  935:     my $output = <<END;
  936: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
  937: <span id="ddcountcollapse" class="LC_menubuttons_inline_text">
  938: $collapse
  939: </span></a>
  940: <span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;"></span>
  941: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
  942: <span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span>
  943: <img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a>
  944: END
  945:     &Apache::lonhtmlcommon::clear_breadcrumb_tools();
  946:     &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$output);
  947:     return;
  948: }
  949: 
  950: 
  951: 1;
  952: __END__
  953: 
  954: 
  955: =head1 NAME
  956: 
  957: Apache::lonpage - Page Handler
  958: 
  959: =head1 SYNOPSIS
  960: 
  961: Invoked by /etc/httpd/conf/srm.conf:
  962: 
  963:  <LocationMatch "^/res/.*\.page$>
  964:  SetHandler perl-script
  965:  PerlHandler Apache::lonpage
  966:  </LocationMatch>
  967: 
  968: =head1 INTRODUCTION
  969: 
  970: This module renders a .page resource.
  971: 
  972: This is part of the LearningOnline Network with CAPA project
  973: described at http://www.lon-capa.org.
  974: 
  975: =head1 HANDLER SUBROUTINE
  976: 
  977: This routine is called by Apache and mod_perl.
  978: 
  979: =over 4
  980: 
  981: =item *
  982: 
  983: set document type for header only
  984: 
  985: =item *
  986: 
  987: tie db file
  988: 
  989: =item *
  990: 
  991: render page
  992: 
  993: =item *
  994: 
  995: add to symb list
  996: 
  997: =item *
  998: 
  999: page parms
 1000: 
 1001: =item *
 1002: 
 1003: Get SSI output, post parameters
 1004: 
 1005: =item *
 1006: 
 1007: SSI cell rendering
 1008: 
 1009: =item *
 1010: 
 1011: Deal with Applet codebases
 1012: 
 1013: =item *
 1014: 
 1015: Build page
 1016: 
 1017: =item *
 1018: 
 1019: send headers
 1020: 
 1021: =item *
 1022: 
 1023: start body
 1024: 
 1025: =item *
 1026: 
 1027: start form
 1028: 
 1029: =item *
 1030: 
 1031: start table
 1032: 
 1033: =item *
 1034: 
 1035: submit element, etc, render page, untie hash
 1036: 
 1037: =back
 1038: 
 1039: =head1 OTHER SUBROUTINES
 1040: 
 1041: =over 4
 1042: 
 1043: =item *
 1044: 
 1045: euclid() : Euclid's method for determining the greatest common denominator.
 1046: 
 1047: =item *
 1048: 
 1049: tracetable() : Build page table.
 1050: 
 1051: =back
 1052: 
 1053: =cut
 1054: 
 1055: 

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