File:  [LON-CAPA] / rat / lonpage.pm
Revision 1.54: download - view: text, annotated - select for diffs
Tue Oct 21 20:40:10 2003 UTC (20 years, 6 months ago) by albertel
Branches: MAIN
CVS tags: version_1_1_X, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, HEAD
- need to recognize when called with target of meta and gracefully return blank (BUG#2022)

    1: # The LearningOnline Network with CAPA
    2: # Page Handler
    3: #
    4: # $Id: lonpage.pm,v 1.54 2003/10/21 20:40:10 albertel 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: # (TeX Content Handler
   29: #
   30: # YEAR=2000
   31: # 05/29/00,05/30 Gerd Kortemeyer)
   32: # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
   33: # 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16,
   34: # YEAR=2001
   35: # 08/13/01,08/30,10/1 Gerd Kortemeyer
   36: # YEAR=2002
   37: # 03/19 Gerd Kortemeyer
   38: #
   39: ###
   40: 
   41: package Apache::lonpage;
   42: 
   43: use strict;
   44: use Apache::Constants qw(:common :http);
   45: use Apache::lonnet();
   46: use Apache::loncommon();
   47: use Apache::lonxml();
   48: use Apache::lonmenu;
   49: use HTML::TokeParser;
   50: use GDBM_File;
   51: use Apache::lonsequence;
   52: 
   53: # -------------------------------------------------------------- Module Globals
   54: my %hash;
   55: my @rows;
   56: 
   57: # ------------------------------------------------------------------ Euclid gcd
   58: 
   59: sub euclid {
   60:     my ($e,$f)=@_;
   61:     my $a; my $b; my $r;
   62:     if ($e>$f) { $b=$e; $r=$f; } else { $r=$e; $b=$f; }
   63:     while ($r!=0) {
   64: 	$a=$b; $b=$r;
   65:         $r=$a%$b;
   66:     }
   67:     return $b;
   68: }
   69: 
   70: # ------------------------------------------------------------ Build page table
   71: 
   72: sub tracetable {
   73:     my ($sofar,$rid,$beenhere)=@_;
   74:     my $further=$sofar;
   75:     unless ($beenhere=~/\&$rid\&/) {
   76:        $beenhere.=$rid.'&';  
   77: 
   78:        if (defined($hash{'is_map_'.$rid})) {
   79:            if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
   80:                (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
   81:               my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
   82: 	      $sofar=
   83:                 &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
   84:                 '&'.$frid.'&');
   85:               $sofar++;
   86:               if ($hash{'src_'.$frid}) {
   87:                my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
   88:                if (($brepriv eq '2') || ($brepriv eq 'F')) {
   89:                  if (defined($rows[$sofar])) {
   90:                    $rows[$sofar].='&'.$frid;
   91:                  } else {
   92:                    $rows[$sofar]=$frid;
   93:                  }
   94: 	       }
   95: 	      }
   96: 	   }
   97:        } else {
   98:           $sofar++;
   99:           if ($hash{'src_'.$rid}) {
  100:            my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
  101:            if (($brepriv eq '2') || ($brepriv eq 'F')) {
  102:              if (defined($rows[$sofar])) {
  103:                $rows[$sofar].='&'.$rid;
  104:              } else {
  105:                $rows[$sofar]=$rid;
  106:              }
  107: 	   }
  108:           }
  109:        }
  110: 
  111:        if (defined($hash{'to_'.$rid})) {
  112: 	  my $mincond=1;
  113:           my $next='';
  114:           foreach (split(/\,/,$hash{'to_'.$rid})) {
  115:               my $thiscond=
  116:       &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
  117:               if ($thiscond>=$mincond) {
  118: 		  if ($next) {
  119: 		      $next.=','.$_.':'.$thiscond;
  120:                   } else {
  121:                       $next=$_.':'.$thiscond;
  122: 		  }
  123:                   if ($thiscond>$mincond) { $mincond=$thiscond; }
  124: 	      }
  125:           }
  126:           foreach (split(/\,/,$next)) {
  127:               my ($linkid,$condval)=split(/\:/,$_);
  128:               if ($condval>=$mincond) {
  129:                 my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
  130:                 if ($now>$further) { $further=$now; }
  131: 	      }
  132:           }
  133: 
  134:        }
  135:     }
  136:     return $further;
  137: }
  138: 
  139: # ================================================================ Main Handler
  140: 
  141: sub handler {
  142:   my $r=shift;
  143: 
  144: # ------------------------------------------- Set document type for header only
  145: 
  146:   if ($r->header_only) {
  147:        if ($ENV{'browser.mathml'}) {
  148:            &Apache::loncommon::content_type($r,'text/xml');
  149:        } else {
  150:            &Apache::loncommon::content_type($r,'text/html'); 
  151:        }
  152:        $r->send_http_header;
  153:        return OK;
  154:    }
  155:   
  156:    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  157:                                           ['forceselect','launch']);
  158:   my $number_of_columns = 1;
  159:   my $requrl=$r->uri;  
  160:   my $target = $ENV{'form.grade_target'};
  161:   &Apache::lonnet::logthis("Got a target of $target");
  162:   if ($target eq 'meta') {
  163:       &Apache::loncommon::content_type($r,'text/html');
  164:       $r->send_http_header;
  165:       return OK;
  166:   }
  167: # ----------------------------------------------------------------- Tie db file
  168:   if (($ENV{'request.course.fn'}) && (!$ENV{'form.forceselect'})) {
  169:       my $fn=$ENV{'request.course.fn'};
  170:       if (-e "$fn.db") {
  171:           if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
  172: # ------------------------------------------------------------------- Hash tied
  173:               my $firstres=$hash{'map_start_'.$requrl};
  174:               my $lastres=$hash{'map_finish_'.$requrl};
  175:               if (($firstres) && ($lastres)) {
  176: # ----------------------------------------------------------------- Render page
  177: 
  178:                   @rows=();
  179: 
  180:                   &tracetable(0,$firstres,'&');
  181: 
  182: # ------------------------------------------------------------ Add to symb list
  183: 
  184:                   my $i;
  185:                   my %symbhash=();
  186:                   for ($i=0;$i<=$#rows;$i++) {
  187: 		     if ($rows[$i]) {
  188:                         my @colcont=split(/\&/,$rows[$i]);
  189:                         foreach (@colcont) {
  190:                            $symbhash{$hash{'src_'.$_}}='';
  191: 		        }
  192: 		     }
  193: 		  }
  194:                   &Apache::lonnet::symblist($requrl,%symbhash);
  195: 
  196: # ------------------------------------------------------------------ Page parms
  197: 
  198:                   my $j;
  199:                   my $lcm=1;
  200:                   my $contents=0;
  201:                   my $nforms=0;
  202:                   
  203:                   my %ssibody=();
  204:                   my %ssibgcolor=();
  205:                   my %ssitext=();
  206:                   my %ssilink=();
  207:                   my %ssivlink=();
  208:                   my %ssialink=();
  209:      
  210:                   my %metalink=();
  211: 
  212:                   my %cellemb=();
  213: 
  214:                   my $allscript='';
  215:                   my $allmeta='';
  216: 
  217:                   my $isxml=0;
  218:                   my $xmlheader='';
  219:                   my $xmlbody='';
  220: 
  221: # --------------------------------------------- Get SSI output, post parameters
  222: 
  223:                   for ($i=0;$i<=$#rows;$i++) {
  224: 		     if ($rows[$i]) {
  225: 		      $contents++;
  226:                       my @colcont=split(/\&/,$rows[$i]);
  227:                       $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
  228:                       foreach (@colcont) {
  229:                           my $src=$hash{'src_'.$_};
  230:                           $src=~/\.(\w+)$/;
  231:                           $metalink{$_}=$src.'.meta';
  232:                           $cellemb{$_}=Apache::loncommon::fileembstyle($1);
  233:                           if ($cellemb{$_} eq 'ssi') {
  234: # --------------------------------------------------------- This is an SSI cell
  235: 			      my $prefix=$_.'_';
  236:                               my %posthash=('request.prefix' => $prefix);
  237:                               if (($ENV{'form.'.$prefix.'submit'}) 
  238:                                || ($ENV{'form.all_submit'})) {
  239:                                foreach (keys %ENV) {
  240: 				  if ($_=~/^form.$prefix/) {
  241: 				      my $name=$_;
  242:                                       $name=~s/^form.$prefix//;
  243:                                       $posthash{$name}=$ENV{$_};
  244:                                   }
  245:                                }
  246: 			      }
  247:                               my $output=Apache::lonnet::ssi($src,%posthash);
  248: 			      $output=~
  249: 	    s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs;
  250:                               if ($target eq 'tex') {
  251: 				  $output =~ s/^([^&]+)\\begin{document}//;
  252: 				  $output =~ s/\\end{document}//;
  253: 				  $output = '\parbox{\minipagewidth}{ '.$output.' }';
  254:                                   #some additional cleanup necessary for LateX (due to limitations of table environment 
  255: 				  $output =~ s/(\\vskip\s*\d+mm)\s*(\\\\)+/$1/g;
  256: 			      }
  257:                               my $parser=HTML::TokeParser->new(\$output);
  258:                               my $token;
  259:                               my $thisdir=$src;
  260:                               my $bodydef=0;
  261:                               my $thisxml=0;
  262:                               my @rlinks=();
  263:                               if ($output=~/\?xml/) {
  264:                                  $isxml=1;
  265:                                  $thisxml=1;
  266:                                  $output=~
  267:          /((?:\<(?:\?xml|\!DOC|html)[^\>]*(?:\>|\>\]\>)\s*)+)\<body[^\>]*\>/si;
  268:                                  $xmlheader=$1;
  269: 			      }
  270:                               while ($token=$parser->get_token) {
  271: 				if ($token->[0] eq 'S') {
  272:                                   if ($token->[1] eq 'a') {
  273: 				      if ($token->[2]->{'href'}) {
  274:                                          $rlinks[$#rlinks+1]=
  275: 					     $token->[2]->{'href'};
  276: 				      }
  277: 				  } elsif ($token->[1] eq 'img') {
  278:                                          $rlinks[$#rlinks+1]=
  279: 					     $token->[2]->{'src'};
  280: 				  } elsif ($token->[1] eq 'embed') {
  281:                                          $rlinks[$#rlinks+1]=
  282: 					     $token->[2]->{'src'};
  283: 				  } elsif ($token->[1] eq 'base') {
  284: 				      $thisdir=$token->[2]->{'href'};
  285: 				  } elsif ($token->[1] eq 'body') {
  286: 				      $bodydef=1;
  287:                                       $ssibgcolor{$_}=$token->[2]->{'bgcolor'};
  288:                                       $ssitext{$_}=$token->[2]->{'text'};
  289:                                       $ssilink{$_}=$token->[2]->{'link'};
  290:                                       $ssivlink{$_}=$token->[2]->{'vlink'};
  291:                                       $ssialink{$_}=$token->[2]->{'alink'};
  292:                                       if ($thisxml) {
  293: 					  $xmlbody=$token->[4];
  294:                                       }
  295:                                   } elsif ($token->[1] eq 'meta') {
  296: 				    if ($token->[4] !~ m:/>$:) {
  297: 				      $allmeta.="\n".$token->[4].'</meta>';
  298: 				    } else {
  299: 				      $allmeta.="\n".$token->[4];
  300: 				    }
  301:                                   } elsif (($token->[1] eq 'script') &&
  302:                                            ($bodydef==0)) {
  303: 				      $allscript.="\n\n"
  304:                                                 .$parser->get_text('/script');
  305:                                   }
  306: 			        }
  307: 			      }
  308:                               if ($output=~/\<body[^\>]*\>(.*)/si) {
  309:                                  $output=$1; 
  310:                               }
  311:                               $output=~s/\<\/body\>.*//si;
  312:                               if ($output=~/\<form/si) {
  313: 				  $nforms++;
  314:                                   $output=~s/\<form[^\>]*\>//gsi;
  315:                                   $output=~s/\<\/form[^\>]*\>//gsi;
  316:                                   $output=~
  317: 				      s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([\w\.\:]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
  318:                               }
  319:                               $thisdir=~s/\/[^\/]*$//;
  320: 			      foreach (@rlinks) {
  321: 				  unless (($_=~/^http:\/\//i) ||
  322: 					  ($_=~/^\//) ||
  323: 					  ($_=~/^javascript:/i) ||
  324: 					  ($_=~/^mailto:/i) ||
  325: 					  ($_=~/^\#/)) {
  326: 				      my $newlocation=
  327: 				    &Apache::lonnet::hreflocation($thisdir,$_);
  328:                      $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
  329: 				  }
  330: 			      }
  331: # -------------------------------------------------- Deal with Applet codebases
  332:   $output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
  333: 			      $ssibody{$_}=$output;
  334: # ---------------------------------------------------------------- End SSI cell
  335:                           }
  336:                       }
  337:                      } 
  338:                   }
  339:                   unless ($contents) {
  340:                       &Apache::loncommon::content_type($r,'text/html');
  341:                       $r->send_http_header;
  342:                       $r->print('<html><body>'.&mt('Empty page').'.</body></html>');
  343:                   } else {
  344: # ------------------------------------------------------------------ Build page
  345: 
  346: # ---------------------------------------------------------------- Send headers
  347: 		      unless ($target eq 'tex') {
  348: 			  if ($isxml) {
  349: 			      &Apache::loncommon::content_type($r,'text/xml');
  350: 			      $r->send_http_header;
  351: 			      $r->print($xmlheader);
  352: 			  } else {
  353: 			      &Apache::loncommon::content_type($r,'text/html');
  354: 			      $r->send_http_header;
  355: 			      $r->print('<html>');
  356: 			  }
  357: # ------------------------------------------------------------------------ Head
  358: 			  $r->print("\n<head>\n".$allmeta);
  359: 			  if ($allscript) {
  360: 			      $r->print("\n<script language='JavaScript'>\n".
  361: 					$allscript."\n</script>\n");
  362: 			  }
  363: 			  $r->print(&Apache::lonmenu::registerurl(1,undef));
  364: 			  $r->print("\n</head>\n");
  365: # ------------------------------------------------------------------ Start body
  366: 			  if ($isxml) {
  367: 			      $r->print($xmlbody);
  368: 			  } else {
  369: 			      $r->print(
  370:                '<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonmenu::loadevents.
  371:                '" onUnload="'.&Apache::lonmenu::unloadevents.'">'.
  372:                               &Apache::lonmenu::menubuttons(undef,$target,1)
  373: 					);
  374: 			  }
  375: # ------------------------------------------------------------------ Start form
  376: 			  if ($nforms) {
  377: 			      $r->print('<form method="post" action="'.
  378: 					$requrl.'">');
  379: 			  }
  380: 		      } else {
  381: 			  $r->print('\documentclass{article}
  382:                                  \newcommand{\keephidden}[1]{}           
  383:                                  \usepackage[dvips]{graphicx}
  384:                                  \usepackage{epsfig}
  385:                                  \usepackage{calc}
  386:                                  \usepackage{longtable}
  387:                                  \begin{document}');
  388: 		      }
  389: # ----------------------------------------------------------------- Start table
  390: 		      if ($target eq 'tex') {
  391: 			  $r->print('\begin{longtable}INSERTTHEHEADOFLONGTABLE\endfirsthead\endhead ');
  392: 			  if ($number_of_columns le $lcm) {$number_of_columns=$lcm;};
  393: 		      } else {
  394: 			  $r->print('<table cols="'.$lcm.'" border="0">');
  395: 		      }
  396:                       for ($i=0;$i<=$#rows;$i++) {
  397: 			if ($rows[$i]) {
  398: 			    unless ($target eq 'tex') {
  399: 				$r->print("\n<tr>");
  400: 			    }
  401:                           my @colcont=split(/\&/,$rows[$i]);
  402:                           my $avespan=$lcm/($#colcont+1);
  403:                           for ($j=0;$j<=$#colcont;$j++) {
  404:                               my $rid=$colcont[$j];
  405:                               my $metainfo='<a href="'.
  406:                                     $metalink{$rid}.'" target="LONcatInfo">'.
  407:                           '<img src="/adm/lonMisc/cat_button.gif" border=0>'.
  408: 			  '</img></a><a href="/adm/evaluate?postdata='.
  409:       &Apache::lonnet::escape(&Apache::lonnet::declutter($hash{'src_'.$rid}))
  410:       .'" target="LONcatInfo">'.
  411:                           '<img src="/adm/lonMisc/eval_button.gif" border=0>'.
  412:                           '</img></a>';
  413:                               if (
  414:  ($hash{'src_'.$rid}=~/\.(problem|exam|quiz|assess|survey|form)$/) &&
  415:  (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'}))) {
  416: 				  my ($mapid,$resid)=split(/\./,$rid);
  417:                                  my $symb=
  418:                 &Apache::lonnet::declutter($hash{'map_id_'.$mapid}).
  419:                 '___'.$resid.'___'.
  420: 		&Apache::lonnet::declutter($hash{'src_'.$rid});
  421:                                  $metainfo.=
  422:                   '<a href="/adm/grades?symb='.&Apache::lonnet::escape($symb).
  423: #                 '&command=submission" target="LONcatInfo">'.
  424:                   '&command=submission">'.
  425:                           '<img src="/adm/lonMisc/subm_button.gif" border=0>'.
  426: 			  '</img></a>'.
  427:                   '<a href="/adm/grades?symb='.&Apache::lonnet::escape($symb).
  428: #                  '&command=gradingmenu" target="LONcatInfo">'.
  429:                   '&command=gradingmenu">'.
  430:                           '<img src="/adm/lonMisc/pgrd_button.gif" border=0>'.
  431: 			  '</img></a>'.
  432:                   '<a href="/adm/parmset?symb='.&Apache::lonnet::escape($symb).
  433: #                          '" target="LONcatInfo">'.
  434:                           '" >'.
  435:                           '<img src="/adm/lonMisc/pprm_button.gif" border=0>'.
  436: 			      '</img></a>';
  437:                               }
  438:                               $metainfo.='<br></br>';
  439: 			    unless ($target eq 'tex') {
  440: 				$r->print('<td colspan="'.$avespan.'"');
  441: 			    }
  442:                               if ($cellemb{$rid} eq 'ssi') {
  443: 				  unless ($target eq 'tex') {
  444: 				      if ($ssibgcolor{$rid}) {
  445: 					  $r->print(' bgcolor="'.
  446: 						    $ssibgcolor{$rid}.'"');
  447: 				      }
  448: 				      $r->print('>'.$metainfo.'<font');
  449: 		    
  450: 				      if ($ssitext{$rid}) {
  451: 					  $r->print(' text="'.$ssitext{$rid}.'"');
  452: 				      }
  453: 				      if ($ssilink{$rid}) {
  454: 					  $r->print(' link="'.$ssilink{$rid}.'"');
  455: 				      }
  456: 				      if ($ssitext{$rid}) {
  457: 					  $r->print(' vlink="'.$ssivlink{$rid}.'"');
  458: 				      }
  459: 				      if ($ssialink{$rid}) {
  460: 					  $r->print(' alink="'.$ssialink{$rid}.'"');
  461: 				      }             
  462: 				      $r->print('>');
  463: 				  }
  464:                                   $r->print($ssibody{$rid});	
  465: 				  unless ($target eq 'tex') {
  466: 				      $r->print('</font>');
  467:                                   }
  468:                                   if ($ENV{'course.'.
  469:                                       $ENV{'request.course.id'}.
  470:                                       '.pageseparators'} eq 'yes') {
  471:                                       unless($target eq 'tex') {
  472:                                           $r->print('<hr />');
  473:                                       } else {
  474:                                           $r->print('\hline');
  475:                                       }
  476: 				  }
  477: 			      } elsif ($cellemb{$rid} eq 'img') {
  478:                                   $r->print('>'.$metainfo.'<img src="'.
  479:                                     $hash{'src_'.$rid}.'"></img>');
  480: 			      } elsif ($cellemb{$rid} eq 'emb') {
  481:                                   $r->print('>'.$metainfo.'<embed src="'.
  482:                                     $hash{'src_'.$rid}.'"></embed>');
  483:                               }
  484: 			      unless ($target eq 'tex') {
  485: 				  $r->print('</td>');
  486: 			      } else {
  487:                                   for (my $incol=1;$incol<=$avespan;$incol++) {
  488: 				      $r->print(' & ');
  489: 				  }
  490: 			      }
  491:                           }
  492: 			      unless ($target eq 'tex') {
  493: 				  $r->print('</tr>');
  494: 			      } else {
  495: 				  $r->print('REMOVETHEHEADOFLONGTABLE\\\\');
  496: 			      }
  497: 		        }
  498:                       }
  499: 		      unless ($target eq 'tex') {
  500: 			  $r->print("\n</table>");
  501: 		      } else {
  502: 			  $r->print('\end{longtable}\strut');
  503: 		      }
  504: # ---------------------------------------------------------------- Submit, etc.
  505:                       if ($nforms) {
  506:                           $r->print(
  507: 	                  '<input name="all_submit" value="Submit All" type="'.
  508: 			  (($nforms>1)?'submit':'hidden').'"></input></form>');
  509:                       }
  510: 		      unless ($target eq 'tex') {
  511: 			  $r->print('</body>'.&Apache::lonxml::xmlend());
  512: 		      } else {
  513: 			  $r->print('\end{document}'.$number_of_columns);
  514: 		      }
  515: # -------------------------------------------------------------------- End page
  516:                   }                  
  517: # ------------------------------------------------------------- End render page
  518:               } else {
  519:                   $r->content_type('text/html');
  520:                   $r->send_http_header;
  521:                   &Apache::lonsequence::viewmap($r,$requrl);
  522:               }
  523: # ------------------------------------------------------------------ Untie hash
  524:               unless (untie(%hash)) {
  525:                    &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  526:                        "Could not untie coursemap $fn (browse).</font>"); 
  527:               }
  528: # -------------------------------------------------------------------- All done
  529: 	      return OK;
  530: # ----------------------------------------------- Errors, hash could no be tied
  531:           }
  532:       } 
  533:   }
  534:   $r->content_type('text/html');
  535:   $r->send_http_header;
  536:   &Apache::lonsequence::viewmap($r,$requrl);
  537:   return OK; 
  538: }
  539: 
  540: 1;
  541: __END__
  542: 
  543: =head1 NAME
  544: 
  545: Apache::lonpage - Page Handler
  546: 
  547: =head1 SYNOPSIS
  548: 
  549: Invoked by /etc/httpd/conf/srm.conf:
  550: 
  551:  <LocationMatch "^/res/.*\.page$>
  552:  SetHandler perl-script
  553:  PerlHandler Apache::lonpage
  554:  </LocationMatch>
  555: 
  556: =head1 INTRODUCTION
  557: 
  558: This module renders a .page resource.
  559: 
  560: This is part of the LearningOnline Network with CAPA project
  561: described at http://www.lon-capa.org.
  562: 
  563: =head1 HANDLER SUBROUTINE
  564: 
  565: This routine is called by Apache and mod_perl.
  566: 
  567: =over 4
  568: 
  569: =item *
  570: 
  571: set document type for header only
  572: 
  573: =item *
  574: 
  575: tie db file
  576: 
  577: =item *
  578: 
  579: render page
  580: 
  581: =item *
  582: 
  583: add to symb list
  584: 
  585: =item *
  586: 
  587: page parms
  588: 
  589: =item *
  590: 
  591: Get SSI output, post parameters
  592: 
  593: =item *
  594: 
  595: SSI cell rendering
  596: 
  597: =item *
  598: 
  599: Deal with Applet codebases
  600: 
  601: =item *
  602: 
  603: Build page
  604: 
  605: =item *
  606: 
  607: send headers
  608: 
  609: =item *
  610: 
  611: start body
  612: 
  613: =item *
  614: 
  615: start form
  616: 
  617: =item *
  618: 
  619: start table
  620: 
  621: =item *
  622: 
  623: submit element, etc, render page, untie hash
  624: 
  625: =back
  626: 
  627: =head1 OTHER SUBROUTINES
  628: 
  629: =over 4
  630: 
  631: =item *
  632: 
  633: euclid() : Euclid's method for determining the greatest common denominator.
  634: 
  635: =item *
  636: 
  637: tracetable() : Build page table.
  638: 
  639: =back
  640: 
  641: =cut
  642: 
  643: 
  644: 
  645: 

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