File:  [LON-CAPA] / rat / lonpage.pm
Revision 1.111.2.8: download - view: text, annotated - select for diffs
Mon Aug 12 15:36:40 2019 UTC (4 years, 8 months ago) by raeburn
Branches: version_2_11_X
- For 2.11
  Backport 1.127, 1.128

    1: # The LearningOnline Network with CAPA
    2: # Page Handler
    3: #
    4: # $Id: lonpage.pm,v 1.111.2.8 2019/08/12 15:36:40 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: 			      }
  324:                               if ($env{'environment.remote'} eq 'on') {
  325:                                   $posthash{'inhibitmenu'} = 'yes';
  326:                               }
  327:                               my $output=Apache::lonnet::ssi($src,%posthash);
  328: 			      $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;
  329:                               if (($target eq 'tex') || ($target eq 'tex_answer')) {
  330: 				  $output =~ s/^([^&]+)\\begin\{document}//;
  331: 				  $output =~ s/\\end\{document}//;
  332: #				  $output = '\parbox{\minipagewidth}{ '.$output.' }';
  333:                                   #some additional cleanup necessary for LateX (due to limitations of table environment 
  334: 				  $output =~ s/(\\vskip\s*\d+mm)\s*(\\\\)+/$1/g;
  335: 			      }
  336:                               my $matheditor;
  337:                               if ($output =~ /\Qjavascript:LC_mathedit_HWVAL_\E/) {
  338:                                   $matheditor = 'dragmath';
  339:                               } elsif ($output =~ /LCmathField/) {
  340:                                   $matheditor = 'lcmath';
  341:                               }
  342:                               my $parser=HTML::TokeParser->new(\$output);
  343:                               my $token;
  344:                               my $thisdir=$src;
  345:                               my $bodydef=0;
  346:                               my $thisxml=0;
  347:                               my @rlinks=();
  348:                               if ($output=~/\?xml/) {
  349:                                  $isxml=1;
  350:                                  $thisxml=1;
  351:                                  $output=~
  352:          /((?:\<(?:\?xml|\!DOC|html)[^\>]*(?:\>|\>\]\>)\s*)+)\<body[^\>]*\>/si;
  353:                                  $xmlheader=$1;
  354: 			      }
  355:                               while ($token=$parser->get_token) {
  356: 				if ($token->[0] eq 'S') {
  357:                                   if ($token->[1] eq 'a') {
  358: 				      if ($token->[2]->{'href'}) {
  359:                                          $rlinks[$#rlinks+1]=
  360: 					     $token->[2]->{'href'};
  361: 				      }
  362: 				  } elsif ($token->[1] eq 'img') {
  363:                                          $rlinks[$#rlinks+1]=
  364: 					     $token->[2]->{'src'};
  365: 				  } elsif ($token->[1] eq 'embed') {
  366:                                          $rlinks[$#rlinks+1]=
  367: 					     $token->[2]->{'src'};
  368: 				  } elsif ($token->[1] eq 'base') {
  369: 				      $thisdir=$token->[2]->{'href'};
  370: 				  } elsif ($token->[1] eq 'body') {
  371: 				      $bodydef=1;
  372:                                       $ssibgcolor{$_}=$token->[2]->{'bgcolor'};
  373:                                       $ssitext{$_}=$token->[2]->{'text'};
  374:                                       $ssilink{$_}=$token->[2]->{'link'};
  375:                                       $ssivlink{$_}=$token->[2]->{'vlink'};
  376:                                       $ssialink{$_}=$token->[2]->{'alink'};
  377:                                       if ($thisxml) {
  378: 					  $xmlbody=$token->[4];
  379:                                       }
  380:                                   } elsif ($token->[1] eq 'meta') {
  381: 				    if ($token->[4] !~ m:/>$:) {
  382: 				      $allmeta.="\n".$token->[4].'</meta>';
  383: 				    } else {
  384: 				      $allmeta.="\n".$token->[4];
  385: 				    }
  386:                                   } elsif (($token->[1] eq 'script') &&
  387:                                            ($bodydef==0)) {
  388: 				      $allscript.="\n\n"
  389:                                                 .$parser->get_text('/script');
  390:                                   }
  391: 			        }
  392: 			      }
  393:                               if ($output=~/\<body[^\>]*\>(.*)/si) {
  394:                                  $output=$1; 
  395:                               }
  396:                               $output=~s/\<\/body\>.*//si;
  397:                               if ($output=~/\<form/si) {
  398:                                   my $hastimer; 
  399: 				  $nforms++;
  400:                                   $output=~s/\<form[^\>]*\>//gsi;
  401:                                   $output=~s/\<\/form[^\>]*\>//gsi;
  402:                                   if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*HWFILE/) {
  403:                                       $nuploads++;
  404:                                   }
  405:                                   if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*accessbutton/) {
  406:                                       $ntimers++;
  407:                                       $hastimer = 1;
  408:                                   }
  409:                                   $output=~
  410: 				      s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
  411:                                   $output=~
  412:                                       s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
  413:                                   $output=~
  414:                                       s/(\Qthis.form.elements['\E)(HW(?:VAL|CHK)_[^']+\'\]\.(?:value=\'|checked))/$1$prefix$2/gsi;
  415:                                   if ($hastimer) {
  416:                                       $output=~
  417:                                           s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;
  418:                                       $output=~  s/\<(input[^\>]+name=\Q"$prefix\Emarkaccess"[^\>]+value=["'])(?:yes)(['"][^\>]*)\>/\<$1$2\>/gsi;
  419:                                   }
  420:                                   if ($matheditor eq 'dragmath') {
  421:                                       $output=~
  422:                                           s/(\Qjavascript:LC_mathedit_\E)(HWVAL_)([^'"]+?)(\(['"]*)(\QHWVAL_\E\3['"]\)\;void\(0\)\;)/$1$idprefix$2$3$4$idprefix$5/g;
  423:                                       $output=~
  424:                                           s/(function\s+LC_mathedit_)(HWVAL_)([^'"]+?)(\s+\(LCtextline\))/$1$idprefix$2$3$4/g;
  425:                                   } elsif ($matheditor eq 'lcmath') {
  426:                                       $output=~
  427:                                           s/(var\s+LCmathField\s+=\s+document\.getElementById\(['"])([^'"]+?)(['"]\)\;)/$1$idprefix$2$3/g;
  428:                                   }
  429:                                   $output=~
  430:                                       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;
  431:                                   $output=~
  432:                                       s/(\Q<td class="LC_status_\E)(\Qsubmit_\E)([^\"]*)(\s*[^\"]*"\>)/$1$idprefix$2$3$4/g;
  433:                                   if ($nuploads) {
  434:                                        ($turninpaths{$prefix},$multiresps{$prefix}) = 
  435:                                            &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
  436:                                        if ($turninparent eq '') {
  437:                                            $turninparent = $turninpaths{$prefix};
  438:                                            $turninparent =~ s{(/[^/]+)$}{}; 
  439:                                        }
  440:                                   }
  441:                                   $output=~
  442:                                       s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
  443:                                   $output=~
  444:                                       s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
  445:                                   unless ($hastimer) {
  446:                                       if ($plainsrc =~ /$LONCAPA::assess_re/) {
  447:                                           %Apache::lonhomework::history =
  448:                                               &Apache::lonnet::restore($symb,$courseid,$domain,$name);
  449:                                           my $type = 'problem';
  450:                                           if ($extension eq 'task') {
  451:                                               $type = 'Task';
  452:                                           }
  453:                                           my ($status,$accessmsg,$slot_name,$slot) =
  454:                                               &Apache::lonhomework::check_slot_access('0',$type,$symb);
  455:                                           undef(%Apache::lonhomework::history);
  456:                                           my $probstatus = &Apache::lonnet::EXT("resource.0.problemstatus",$symb);
  457:                                           if (($status eq 'CAN_ANSWER') || (($status eq 'CANNOT_ANSWER') && 
  458:                                               (($probstatus eq 'no') || ($probstatus eq 'no_feedback_ever')))) {
  459:                                               my ($slothastime,$timerhastime);
  460:                                               if ($slot_name ne '') {
  461:                                                   if (ref($slot) eq 'HASH') {
  462:                                                       if (($slot->{'starttime'} < $now) &&
  463:                                                           ($slot->{'endtime'} > $now)) {
  464:                                                           $slothastime = $now - $slot->{'endtime'};
  465:                                                       }
  466:                                                   }
  467:                                               }
  468:                                               my $duedate = &Apache::lonnet::EXT("resource.0.duedate",$symb);
  469:                                               my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb);
  470:                                               if (@interval > 1) {
  471:                                                   my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
  472:                                                   if ($first_access > 0) {
  473:                                                       my $timeremains = $first_access+$interval[0] - $now;
  474:                                                       if ($timeremains > 0) {
  475:                                                           $timerhastime = $timeremains;
  476:                                                       }
  477:                                                   }
  478:                                               }
  479:                                               if (($duedate && $duedate > $now) ||
  480:                                                   (!$duedate && $timerhastime > 0) ||
  481:                                                   ($slot_name ne '' && $slothastime)) {
  482:                                                   if ((@interval > 1 && $timerhastime) ||
  483:                                                       ($type eq 'Task' && $slothastime)) {
  484:                                                       $countdowndisp{$symb} = 'inline';
  485:                                                       if ((@interval > 1) && ($timerhastime)) {
  486:                                                           $hastimeleft{$symb} = $timerhastime;
  487:                                                       } else {
  488:                                                           $hastimeleft{$symb} = $slothastime;
  489:                                                       }
  490:                                                   } else {
  491:                                                       $hastimeleft{$symb} = $duedate - $now;
  492:                                                       $countdowndisp{$symb} = 'none';
  493:                                                   }
  494:                                               }
  495:                                           }
  496:                                       }
  497:                                   }
  498:                               }
  499:                               $thisdir=~s/\/[^\/]*$//;
  500: 			      foreach (@rlinks) {
  501: 				  unless (($_=~/^https?\:\/\//i) ||
  502: 					  ($_=~/^\//) ||
  503: 					  ($_=~/^javascript:/i) ||
  504: 					  ($_=~/^mailto:/i) ||
  505: 					  ($_=~/^\#/)) {
  506: 				      my $newlocation=
  507: 				    &Apache::lonnet::hreflocation($thisdir,$_);
  508:                      $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
  509: 				  }
  510: 			      }
  511: # -------------------------------------------------- Deal with Applet codebases
  512:   $output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
  513: 			      $ssibody{$_}=$output;
  514: # ---------------------------------------------------------------- End SSI cell
  515:                           }
  516:                       }
  517:                      } 
  518:                   }
  519:                   unless ($contents) {
  520:                       &Apache::loncommon::content_type($r,'text/html');
  521:                       $r->send_http_header;
  522:                       $r->print(&Apache::loncommon::start_page(undef,undef,
  523: 							       {'force_register' => 1}));
  524:                       $r->print(&mt('This page is either empty or it only contains resources that are currently hidden').'. ');
  525:                       $r->print('<br /><br />'.&mt('Please use the LON-CAPA navigation arrows to move to another item in the course').
  526: 				&Apache::loncommon::end_page());
  527:                   } else {
  528: # ------------------------------------------------------------------ Build page
  529: 
  530: # ---------------------------------------------------------------- Send headers
  531: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  532: 			  if ($isxml) {
  533: 			      &Apache::loncommon::content_type($r,'text/xml');
  534: 			  } else {
  535: 			      &Apache::loncommon::content_type($r,'text/html');
  536: 			  }
  537: 			  $r->send_http_header;
  538: # ------------------------------------------------------------------------ Head
  539: 			  if ($allscript) {
  540: 			      $allscript = 
  541: 				  "\n".'<script type="text/javascript">'."\n".
  542: 				  $allscript.
  543: 				  "\n</script>\n";
  544: 			  }
  545:                           if (($nforms) && ($nuploads)) {
  546:                               $allscript .= &Apache::lonhtmlcommon::file_submissionchk_js(\%turninpaths,\%multiresps).
  547:                                             '<script type="text/javascript" '.
  548:                                             'src="/res/adm/includes/file_upload.js"></script>';
  549:                           }
  550:                           if (($nforms) && (&Apache::lonhtmlcommon::htmlareabrowser())) {
  551:                               my %textarea_args = (
  552:                                   dragmath => 'math',
  553:                               );
  554:                               $allscript .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
  555:                           }
  556:                           if ($ntimers) {
  557:                               $allscript .= '<script type="text/javascript">'."\n".
  558:                                             '// <![CDATA['."\n".
  559:                                             'function pageTimer(form,prefix) {'."\n".
  560:                                             "   form.elements[prefix+'markaccess'].value = 'yes';\n".
  561:                                             "   form.submit();\n".
  562:                                             '}'."\n".
  563:                                             '// ]]>'.
  564:                                             "\n</script>\n";
  565:                           }
  566:                           if (keys(%hastimeleft)) {
  567:                               my (%uniquetimes,%uniquedisplays);
  568:                               foreach my $item (values(%hastimeleft)) {
  569:                                   if (exists($uniquetimes{$item})) {
  570:                                       $uniquetimes{$item} ++; 
  571:                                   } else {
  572:                                       $uniquetimes{$item} = 1;
  573:                                   }
  574:                               }
  575:                               if (keys(%uniquetimes) == 1) {
  576:                                   my (%uniquedisplays,%uniquedones,$currdisp);
  577:                                   if (keys(%countdowndisp)) {
  578:                                       foreach my $item (values(%countdowndisp)) {
  579:                                           if (exists($uniquedisplays{$item})) {
  580:                                               $uniquedisplays{$item} ++;
  581:                                           } else {
  582:                                               $uniquedisplays{$item} = 1;
  583:                                           }
  584:                                       }
  585:                                       my @countdowndisplay = keys(%uniquedisplays);
  586:                                       if (scalar(@countdowndisplay) == 1) {
  587:                                           $currdisp = $countdowndisplay[0];
  588:                                       }
  589:                                   }
  590:                                   &add_countdown_timer($currdisp);
  591:                               }
  592:                           }
  593:                           my $pagebuttonshide;
  594:                           if (keys(%buttonshide)) {
  595:                               my %uniquebuttonhide;
  596:                               foreach my $item (values(%buttonshide)) {
  597:                                   if (exists($uniquebuttonhide{$item})) {
  598:                                       $uniquebuttonhide{$item} ++;
  599:                                   } else {
  600:                                       $uniquebuttonhide{$item} = 1;
  601:                                   }
  602:                               }
  603:                               if (keys(%uniquebuttonhide) == 1) {
  604:                                   if (lc((keys(%uniquebuttonhide))[0]) eq 'yes') {
  605:                                       $pagebuttonshide = 'yes';
  606:                                   }
  607:                               }
  608:                           }
  609: # ------------------------------------------------------------------ Start body
  610: 			  $r->print(&Apache::loncommon::start_page(undef,$allscript,
  611: 								   {'force_register' => 1,
  612: 								    'bgcolor'        => '#ffffff',
  613: 								    'hide_buttons'   => $pagebuttonshide}));
  614: # ------------------------------------------------------------------ Start form
  615: 			  if ($nforms) {
  616: 			      my $fmtag = '<form name="lonhomework" method="post"  enctype="multipart/form-data"';
  617:                               if ($nuploads) {
  618:                                   my $multi;
  619:                                   if ($nuploads > 1) {
  620:                                       $multi = 1;
  621:                                   }
  622:                                   $fmtag .= 'onsubmit="return file_submission_check(this,'."'$turninparent','$multi'".');"';
  623:                               }
  624:                               $fmtag .= ' action="'.
  625: 					&Apache::lonenc::check_encrypt($requrl)
  626: 					.'" id="LC_page">';
  627:                               $r->print($fmtag);
  628: 			  }
  629: 		      } elsif (($target eq 'tex') || ($target eq 'tex_answer')) {
  630: 			  #  I think this is not needed as the header
  631: 			  # will be put in for each of the page parts
  632: 			  # by the londefdef.pm now that we are opening up
  633: 			  # the parts of a page.
  634: 			  #$r->print('\documentclass{article}
  635:                           #       \newcommand{\keephidden}[1]{}           
  636:                           #       \usepackage[dvips]{graphicx}
  637:                           #       \usepackage{epsfig}
  638:                           #       \usepackage{calc}
  639:                           #       \usepackage{longtable}
  640:                           #       \begin{document}');
  641: 		      }
  642: # ----------------------------------------------------------------- Start table
  643: 		      if (($target eq 'tex') || ($target eq 'tex_answer')) {
  644: #			 #  $r->print('\begin{longtable}INSERTTHEHEADOFLONGTABLE\endfirsthead\endhead ');
  645: 			  if ($number_of_columns le $lcm) {$number_of_columns=$lcm;};
  646: 		      } else {
  647: 			  $r->print('<table width="100%" cols="'.$lcm.'" border="0">');
  648: 		      }
  649: # generate rows
  650:                       for ($i=0;$i<=$#rows;$i++) {
  651: 			if ($rows[$i]) {
  652: 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  653: 				$r->print("\n<tr>");
  654: 			    }
  655:                           my @colcont=split(/\&/,$rows[$i]);
  656:                           my $avespan=$lcm/($#colcont+1);
  657:                           for ($j=0;$j<=$#colcont;$j++) {
  658:                               my $rid=$colcont[$j];
  659: 			      my $metainfo =&get_buttons(\%hash,$rid,\%buttonshide,$hostname).'<br />';
  660: 			    unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  661: 				$r->print('<td colspan="'.$avespan.'"');
  662: 			    }
  663:                               if (($cellemb{$rid} eq 'ssi') || ($cellexternal{$rid})) {
  664: 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  665: 				      if ($ssibgcolor{$rid}) {
  666: 					  $r->print(' bgcolor="'.
  667: 						    $ssibgcolor{$rid}.'"');
  668: 				      }
  669: 				      $r->print('>'.$metainfo.'<font');
  670: 		    
  671: 				      if ($ssitext{$rid}) {
  672: 					  $r->print(' text="'.$ssitext{$rid}.'"');
  673: 				      }
  674: 				      if ($ssilink{$rid}) {
  675: 					  $r->print(' link="'.$ssilink{$rid}.'"');
  676: 				      }
  677: 				      if ($ssitext{$rid}) {
  678: 					  $r->print(' vlink="'.$ssivlink{$rid}.'"');
  679: 				      }
  680: 				      if ($ssialink{$rid}) {
  681: 					  $r->print(' alink="'.$ssialink{$rid}.'"');
  682: 				      }             
  683: 				      $r->print('>');
  684: 				  }
  685:                                   unless (($cellexternal{$rid}) && 
  686:                                           ($target eq 'tex') && ($target eq 'tex_answer')) {
  687:                                       $r->print($ssibody{$rid});
  688:                                   }
  689: 				  unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  690: 				      $r->print('</font>');
  691:                                   }
  692:                                   if ($env{'course.'.
  693:                                       $env{'request.course.id'}.
  694:                                       '.pageseparators'} eq 'yes') {
  695:                                       unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  696:                                           $r->print('<hr />');
  697:                                       } 
  698: 				  }
  699: 			      } elsif ($cellemb{$rid} eq 'img') {
  700:                                   $r->print('>'.$metainfo.'<img src="'.
  701:                                     $hash{'src_'.$rid}.'" />');
  702: 			      } elsif ($cellemb{$rid} eq 'emb') {
  703:                                   $r->print('>'.$metainfo.'<embed src="'.
  704:                                     $hash{'src_'.$rid}.'"></embed>');
  705:                               } elsif (&Apache::lonnet::declutter($hash{'src_'.$rid}) !~/\.(sequence|page)$/) {
  706:                                   $r->print($metainfo.'<b>'.$hash{'title_'.$rid}.'</b><br />');
  707:                                   unless ($cellemb{$rid} eq 'wrp') {
  708:                                       $r->print(&mt('It is recommended that you use an up-to-date virus scanner before handling this file.'));
  709:                                   }
  710:                                   $r->print('</p><p><table>'.
  711:                                             &Apache::londocs::entryline(0,
  712:                                                                         &mt("Click to download or use your browser's Save Link function"),
  713:                                                                         '/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).
  714:                                                                         '</table></p><br />');
  715:                               }
  716: 			      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  717: 				  $r->print('</td>');
  718: 			      } else {
  719: #                                  for (my $incol=1;$incol<=$avespan;$incol++) {
  720: #				      $r->print(' & ');
  721: #				  }
  722: 			      }
  723:                           }
  724: 			      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  725: 				  $r->print('</tr>');
  726: 			      } else {
  727: #				  $r->print('REMOVETHEHEADOFLONGTABLE\\\\');
  728: 			      }
  729: 		        }
  730:                       }
  731: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  732: 			  $r->print("\n</table>");
  733: 		      } else {
  734: #			  $r->print('\end{longtable}\strut');
  735: 		      }
  736: # ---------------------------------------------------------------- Submit, etc.
  737:                       if ($nforms) {
  738:                           my $class;
  739:                           if ($nforms > 1) {
  740:                               $class = ' class="LC_hwk_submit"';
  741:                               if ($ntimers) {
  742:                                   $nforms = 1;
  743:                                   $class = '';
  744:                               }
  745:                           }
  746:                           $r->print(
  747: 	                  '<input name="all_submit" value="'.&mt('Submit All').'" type="'.
  748: 			  (($nforms>1)?'submit':'hidden').'"'.$class.' id="all_submit" />'.
  749:                           '<input type="hidden" name="all_submit_pressed" '.
  750:                           'id="all_submit_pressed" value="" />'.
  751:                           '<div id="msg_all_submit" style="display:none">'.
  752:                           &mt('Processing your submission ...').'</div></form>');
  753:                       }
  754: 		      unless (($target eq 'tex') || ($target eq 'tex_answer')) {
  755: 			  $r->print(&Apache::loncommon::end_page({'discussion'
  756: 								      => 1,}));
  757: 		      } else {
  758: 			  $r->print('\end{document}'.$number_of_columns);
  759: 		      }
  760: 		      &Apache::lonnet::symblist($requrl,%symbhash);
  761: 		      my ($map,$id,$url)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
  762: 		      &Apache::lonnet::symblist($map,'last_known'=>[$url,$id]);
  763: # -------------------------------------------------------------------- End page
  764:                   }                  
  765: # ------------------------------------------------------------- End render page
  766:               } else {
  767:                   &Apache::loncommon::content_type($r,'text/html');
  768:                   $r->send_http_header;
  769:                   &Apache::lonsequence::viewmap($r,$requrl);
  770:               }
  771: # ------------------------------------------------------------------ Untie hash
  772:               unless (untie(%hash)) {
  773:                    &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  774:                        "Could not untie coursemap $fn (browse).</font>"); 
  775:               }
  776: # -------------------------------------------------------------------- All done
  777: 	      return OK;
  778: # ----------------------------------------------- Errors, hash could no be tied
  779:           }
  780:       } 
  781:   }
  782:   &Apache::loncommon::content_type($r,'text/html');
  783:   $r->send_http_header;
  784:   &Apache::lonsequence::viewmap($r,$requrl);
  785:   return OK; 
  786: }
  787: 
  788: sub get_buttons {
  789:     my ($hash,$rid,$buttonshide,$hostname) = @_;
  790: 
  791:     my $metainfo = '';
  792:     my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});
  793:     my ($mapid,$resid)=split(/\./,$rid);
  794:     my $symb=&Apache::lonnet::encode_symb($hash->{'map_id_'.$mapid},
  795: 					  $resid,
  796: 					  $hash->{'src_'.$rid});
  797:     unless ($env{'request.role.adv'}) {
  798:         if ($buttonshide->{$symb} eq 'yes') {
  799:             return;
  800:         }
  801:     }
  802:     if ($hash->{'encrypted_'.$rid}) {
  803: 	$symb=&Apache::lonenc::encrypted($symb);
  804: 	$esrc=&Apache::lonenc::encrypted($esrc);
  805:     }
  806:     if ($hash->{'src_'.$rid} !~ m-^/uploaded/-
  807:         && $hash->{'src_'.$rid} !~ m{^https?://}
  808: 	&& !$env{'request.enc'}
  809: 	&& ($env{'request.role.adv'}
  810: 	    || !$hash->{'encrypted_'.$rid})) { 
  811: 	$metainfo .='<a name="'.&escape($symb).'" />'.
  812: 	    '<a href="'.$hash->{'src_'.$rid}.'.meta'.'" target="LONcatInfo">'.
  813:             '<img src="/res/adm/pages/catalog.png" class="LC_icon"'.
  814:             ' alt="'.&mt('Show Metadata').'"'.
  815:             ' title="'.&mt('Show Metadata').'" />'.
  816: 	    '</a>';
  817:     }
  818:     if (($hash->{'src_'.$rid} !~ m{^/uploaded/}) &&
  819:         ($hash->{'src_'.$rid} !~ m{^https?://})) {
  820:         $metainfo .= '<a href="/adm/evaluate?postdata='.
  821: 	    &escape($esrc).
  822: 	    '" target="LONcatInfo">'.
  823:             '<img src="/res/adm/pages/eval.png" class="LC_icon"'.
  824:             ' alt="'.&mt('Provide my evaluation of this resource').'"'.
  825:             ' title="'.&mt('Provide my evaluation of this resource').'" />'.
  826: 	    '</a>';
  827:     }
  828:     if (($hash->{'src_'.$rid}=~/$LONCAPA::assess_re/) &&
  829: 	($hash->{'src_'.$rid} !~ m-^/uploaded/-)) {
  830: 
  831: 	if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
  832: 	    $metainfo.=
  833: 		'<a href="/adm/grades?symb='.&escape($symb).
  834: #               '&command=submission" target="LONcatInfo">'.
  835: 		'&command=submission">'.
  836:                 '<img src="/adm/lonMisc/subm_button.png" class="LC_icon"'.
  837:                 ' alt="'.&mt('View Submissions for a Student or a Group of Students').'"'.
  838:                 ' title="'.&mt('View Submissions for a Student or a Group of Students').'" />'.
  839: 		'</a>'.
  840: 		'<a href="/adm/grades?symb='.&escape($symb).
  841: #               '&command=gradingmenu" target="LONcatInfo">'.
  842: 		'&command=gradingmenu">'.
  843:                 '<img src="/res/adm/pages/pgrd.png" class="LC_icon"'.
  844:                 ' alt="'.&mt('Content Grades').'"'.
  845:                 ' title="'.&mt('Content Grades').'" />'.
  846: 		'</a>';
  847: 	}
  848: 	if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
  849: 	    $metainfo.=
  850: 		'<a href="/adm/parmset?symb='.&escape($symb).
  851: #               '" target="LONcatInfo">'.
  852: 		'" >'.
  853:                 '<img src="/adm/lonMisc/pprm_button.png" class="LC_icon"'.
  854:                 ' alt="'.&mt('Content Settings').'"'.
  855:                 ' title="'.&mt('Content Settings').'" />'.
  856: 		'</a>';
  857: 	}
  858:     }
  859:     if ($env{'request.course.id'}) {
  860:         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
  861:         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
  862:         my $file=&Apache::lonnet::declutter($hash->{'src_'.$rid});
  863:         my $editbutton = '';
  864:         if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
  865:             my ($cfile,$home,$switchserver,$forceedit,$forceview) =
  866:                 &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb);
  867:             if ($cfile ne '') {
  868:                 my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
  869:                                                                      $forceedit,1,$symb,undef,
  870:                                                                      &escape($env{'form.title'},
  871:                                                                      $hostname));
  872:                 if ($jscall) {
  873:                     $editbutton = 1;
  874:                     my $icon = 'pcstr.png';
  875:                     my $label = &mt('Edit');
  876:                     my $title = &mt('Edit this resource');
  877:                     my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
  878:                               ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
  879:                     $metainfo .= '&nbsp;<a href="javascript:'.$jscall.';">'.$pic.'</a>';
  880:                 }
  881:             }
  882:         }
  883:         if ((!$editbutton) && ($file=~/$LONCAPA::assess_re/)) {
  884:             my $url = &Apache::lonnet::clutter($file);
  885:             my $viewsrcbutton;
  886:             if ((&Apache::lonnet::allowed('cre','/')) &&
  887:                 (&Apache::lonnet::metadata($url,'sourceavail') eq 'open')) {
  888:                 $viewsrcbutton = 1;
  889:             } elsif (&Apache::lonnet::allowed('vxc',$env{'request.course.id'})) {
  890:                 if ($url =~ m{^\Q/res/$cdom/\E($LONCAPA::match_username)/}) {
  891:                     my $auname = $1;
  892:                     if (($env{'request.course.adhocsrcaccess'} ne '') &&
  893:                         (grep(/^\Q$auname\E$/,split(/,/,$env{'request.course.adhocsrcaccess'})))) {
  894:                         $viewsrcbutton = 1;
  895:                     }
  896:                 }
  897:             }
  898:             if ($viewsrcbutton) {
  899:                 my $icon = 'pcstr.png';
  900:                 my $label = &mt('View Source');
  901:                 my $title = &mt('View source code');
  902:                 my $jsrid = $rid;
  903:                 $jsrid =~ s/\./_/g;
  904:                 my $showurl = &escape(&Apache::lonenc::check_encrypt($url));
  905:                 my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
  906:                           ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
  907:                 $metainfo .= '&nbsp;<a href="javascript:open_source_'.$jsrid.'();">'.$pic.'</a>'."\n".
  908:                              '<script type="text/javascript">'."\n".
  909:                              "function open_source_$jsrid() {\n".
  910:                              "  sourcewin=window.open('/adm/source?inhibitmenu=yes&viewonly=1&filename=$showurl','LONsource',".
  911:                              "'height=500,width=600,resizable=yes,location=no,menubar=no,toolbar=no,scrollbars=yes');\n".
  912:                              "}\n".
  913:                              "</script>\n";
  914:             }
  915:         }
  916:     }
  917:     return $metainfo;
  918: }
  919: 
  920: sub add_countdown_timer {
  921:     my ($currdisp) = @_;
  922:     my ($collapse,$expand,$alttxt,$title);
  923:     if ($currdisp eq 'inline') {
  924:         $collapse = '&#9658;&nbsp;';
  925:     } else {
  926:         $expand = '&#9668;&nbsp;';
  927:     }
  928:     unless ($env{'environment.icons'} eq 'iconsonly') {
  929:         $alttxt = &mt('Timer');
  930:         $title = $alttxt.'&nbsp;';
  931:     }
  932:     my $desc = &mt('Countdown to due date/time');
  933:     my $output = <<END;
  934: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
  935: <span id="ddcountcollapse" class="LC_menubuttons_inline_text">
  936: $collapse
  937: </span></a>
  938: <span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;"></span>
  939: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
  940: <span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span>
  941: <img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a>
  942: END
  943:     &Apache::lonhtmlcommon::clear_breadcrumb_tools();
  944:     &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$output);
  945:     return;
  946: }
  947: 
  948: 
  949: 1;
  950: __END__
  951: 
  952: 
  953: =head1 NAME
  954: 
  955: Apache::lonpage - Page Handler
  956: 
  957: =head1 SYNOPSIS
  958: 
  959: Invoked by /etc/httpd/conf/srm.conf:
  960: 
  961:  <LocationMatch "^/res/.*\.page$>
  962:  SetHandler perl-script
  963:  PerlHandler Apache::lonpage
  964:  </LocationMatch>
  965: 
  966: =head1 INTRODUCTION
  967: 
  968: This module renders a .page resource.
  969: 
  970: This is part of the LearningOnline Network with CAPA project
  971: described at http://www.lon-capa.org.
  972: 
  973: =head1 HANDLER SUBROUTINE
  974: 
  975: This routine is called by Apache and mod_perl.
  976: 
  977: =over 4
  978: 
  979: =item *
  980: 
  981: set document type for header only
  982: 
  983: =item *
  984: 
  985: tie db file
  986: 
  987: =item *
  988: 
  989: render page
  990: 
  991: =item *
  992: 
  993: add to symb list
  994: 
  995: =item *
  996: 
  997: page parms
  998: 
  999: =item *
 1000: 
 1001: Get SSI output, post parameters
 1002: 
 1003: =item *
 1004: 
 1005: SSI cell rendering
 1006: 
 1007: =item *
 1008: 
 1009: Deal with Applet codebases
 1010: 
 1011: =item *
 1012: 
 1013: Build page
 1014: 
 1015: =item *
 1016: 
 1017: send headers
 1018: 
 1019: =item *
 1020: 
 1021: start body
 1022: 
 1023: =item *
 1024: 
 1025: start form
 1026: 
 1027: =item *
 1028: 
 1029: start table
 1030: 
 1031: =item *
 1032: 
 1033: submit element, etc, render page, untie hash
 1034: 
 1035: =back
 1036: 
 1037: =head1 OTHER SUBROUTINES
 1038: 
 1039: =over 4
 1040: 
 1041: =item *
 1042: 
 1043: euclid() : Euclid's method for determining the greatest common denominator.
 1044: 
 1045: =item *
 1046: 
 1047: tracetable() : Build page table.
 1048: 
 1049: =back
 1050: 
 1051: =cut
 1052: 
 1053: 

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