File:  [LON-CAPA] / rat / lonuserstate.pm
Revision 1.39: download - view: text, annotated - select for diffs
Sat Aug 31 00:43:13 2002 UTC (21 years, 8 months ago) by www
Branches: MAIN
CVS tags: HEAD
Various new functionality for "ad hoc" courses.

    1: # The LearningOnline Network with CAPA
    2: # Construct and maintain state and binary representation of course for user
    3: #
    4: # $Id: lonuserstate.pm,v 1.39 2002/08/31 00:43:13 www 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: # (Server for RAT Maps
   29: #
   30: # (Edit Handler for RAT Maps
   31: # (TeX Content Handler
   32: #
   33: # YEAR=2000
   34: # 05/29/00,05/30 Gerd Kortemeyer)
   35: # 7/1 Gerd Kortemeyer)
   36: # 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer)
   37: #
   38: # 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30,
   39: # 9/2,9/4,9/29,9/30,10/2,10/11,10/30,10/31,
   40: # 11/1,11/2,11/14,11/16,11/22,12/28,
   41: # YEAR=2001
   42: # 07/05/01,08/30,08/31 Gerd Kortemeyer
   43: # 12/16 Scott Harrison
   44: #
   45: ###
   46: 
   47: package Apache::lonuserstate;
   48: 
   49: # ------------------------------------------------- modules used by this module
   50: use strict;
   51: use Apache::Constants qw(:common :http);
   52: use Apache::File;
   53: use HTML::TokeParser;
   54: use Apache::lonnet();
   55: use Apache::loncommon();
   56: use GDBM_File;
   57: use Apache::lonmsg;
   58: use Safe;
   59: use Safe::Hole;
   60: use Opcode;
   61: 
   62: # ---------------------------------------------------- Globals for this package
   63: 
   64: my $pc;      # Package counter
   65: my %hash;    # The big tied hash
   66: my %parmhash;# The hash with the parameters
   67: my @cond;    # Array with all of the conditions
   68: my $errtext; # variable with all errors
   69: my $retfurl; # variable with the very first URL in the course
   70: my %randompick; # randomly picked resources
   71: # --------------------------------------------------------- Loads map from disk
   72: 
   73: sub loadmap { 
   74:     my $uri=shift;
   75:     if ($hash{'map_pc_'.$uri}) { return OK; }
   76: 
   77:     $pc++;
   78:     my $lpc=$pc;
   79:     $hash{'map_pc_'.$uri}=$lpc;
   80:     $hash{'map_id_'.$lpc}=$uri;
   81: 
   82: # Determine and check filename
   83:     my $fn=&Apache::lonnet::filelocation('',$uri);
   84: 
   85:     my $ispage=($fn=~/\.page$/);
   86: 
   87:     unless (($fn=~/\.sequence$/) ||
   88:             ($fn=~/\.page$/)) { 
   89:        $errtext.="Invalid map: $fn\n";
   90:        return OK; 
   91:     }
   92: 
   93:     my $instr=&Apache::lonnet::getfile($fn);
   94: 
   95:     unless ($instr == -1) {
   96: 
   97: # Successfully got file, parse it
   98: 
   99:         my $parser = HTML::TokeParser->new(\$instr);
  100:         my $token;
  101: 
  102:         my $linkpc=0;
  103: 
  104:         $fn=~/\.(\w+)$/;
  105: 
  106:         $hash{'map_type_'.$lpc}=$1;
  107: 
  108:         while ($token = $parser->get_token) {
  109: 	    if ($token->[0] eq 'S') {
  110:                 if ($token->[1] eq 'resource') {
  111: # -------------------------------------------------------------------- Resource
  112: 
  113:                     my $rid=$lpc.'.'.$token->[2]->{'id'};
  114: 
  115:                     $hash{'kind_'.$rid}='res';
  116:                     $hash{'title_'.$rid}=$token->[2]->{'title'};
  117:                     my $turi=$token->[2]->{'src'};
  118:                     unless ($ispage) {
  119:                         $turi=~/\.(\w+)$/;
  120:                         my $embstyle=&Apache::loncommon::fileembstyle($1);
  121:                         if ($token->[2]->{'external'} eq 'true') {
  122:                             $turi=~s/^http\:\/\//\/adm\/wrapper\/ext\//;
  123:                         } else {
  124:                            my $embstyle=&Apache::loncommon::fileembstyle($1);
  125:                            if (($embstyle eq 'img') || ($embstyle eq 'emb')
  126:                           || ($turi=~/\/syllabus$/) || ($turi=~/\/aboutme$/)) {
  127: 			       $turi='/adm/wrapper'.$turi;
  128:                            }
  129:                         }
  130: 		    }
  131:                     $hash{'src_'.$rid}=$turi;
  132: 
  133:                     if (defined($hash{'ids_'.$turi})) {
  134:                         $hash{'ids_'.$turi}.=','.$rid;
  135:                     } else {
  136:                         $hash{'ids_'.$turi}=''.$rid;
  137:                     }
  138: 
  139:                     if ($token->[2]->{'external'} eq 'true') {
  140:                         $hash{'ext_'.$rid}='true:';
  141:                     } else {
  142:                         $hash{'ext_'.$rid}='false:';
  143:                     }
  144:                     if ($token->[2]->{'type'}) {
  145: 			$hash{'type_'.$rid}=$token->[2]->{'type'};
  146:                         if ($token->[2]->{'type'} eq 'start') {
  147: 			    $hash{'map_start_'.$uri}="$rid";
  148:                         }
  149:                         if ($token->[2]->{'type'} eq 'finish') {
  150: 			    $hash{'map_finish_'.$uri}="$rid";
  151:                         }
  152:                     }  else {
  153:                         $hash{'type_'.$rid}='normal';
  154:                     }
  155: 
  156:                     if (($turi=~/\.sequence$/) ||
  157:                         ($turi=~/\.page$/)) {
  158:                         $hash{'is_map_'.$rid}=1;
  159:                         &loadmap($turi);
  160:                     } 
  161:                     
  162:                 } elsif ($token->[1] eq 'condition') {
  163: # ------------------------------------------------------------------- Condition
  164: 
  165:                     my $rid=$lpc.'.'.$token->[2]->{'id'};
  166: 
  167:                     $hash{'kind_'.$rid}='cond';
  168:                     $cond[$#cond+1]=$token->[2]->{'value'};
  169:                     $hash{'condid_'.$rid}=$#cond;
  170:                     if ($token->[2]->{'type'}) {
  171:                         $cond[$#cond].=':'.$token->[2]->{'type'};
  172:                     }  else {
  173:                         $cond[$#cond].=':normal';
  174:                     }
  175: 
  176:                 } elsif ($token->[1] eq 'link') {
  177: # ----------------------------------------------------------------------- Links
  178: 
  179:                     $linkpc++;
  180:                     my $linkid=$lpc.'.'.$linkpc;
  181: 
  182:                     my $goesto=$lpc.'.'.$token->[2]->{'to'};
  183:                     my $comesfrom=$lpc.'.'.$token->[2]->{'from'};
  184:                     my $undercond=0;
  185: 
  186:                     if ($token->[2]->{'condition'}) {
  187: 			$undercond=$lpc.'.'.$token->[2]->{'condition'};
  188:                     }
  189: 
  190:                     $hash{'goesto_'.$linkid}=$goesto;
  191:                     $hash{'comesfrom_'.$linkid}=$comesfrom;
  192:                     $hash{'undercond_'.$linkid}=$undercond;
  193: 
  194:                     if (defined($hash{'to_'.$comesfrom})) {
  195:                         $hash{'to_'.$comesfrom}.=','.$linkid;
  196:                     } else {
  197:                         $hash{'to_'.$comesfrom}=''.$linkid;
  198:                     }
  199:                     if (defined($hash{'from_'.$goesto})) {
  200:                         $hash{'from_'.$goesto}.=','.$linkid;
  201:                     } else {
  202:                         $hash{'from_'.$goesto}=''.$linkid;
  203:                     }
  204:                 } elsif ($token->[1] eq 'param') {
  205: # ------------------------------------------------------------------- Parameter
  206: 
  207:                     my $referid=$lpc.'.'.$token->[2]->{'to'};
  208:                     my $part=$token->[2]->{'part'};
  209:                     unless ($part) { $part=0; }
  210:                     my $newparam=
  211: 			&Apache::lonnet::escape($token->[2]->{'type'}).':'.
  212: 			&Apache::lonnet::escape($part.'.'.
  213:                          $token->[2]->{'name'}).'='.
  214: 			&Apache::lonnet::escape($token->[2]->{'value'});
  215:                     if (defined($hash{'param_'.$referid})) {
  216:                         $hash{'param_'.$referid}.='&'.$newparam;
  217:                     } else {
  218:                         $hash{'param_'.$referid}=''.$newparam;
  219:                     }
  220:                     if ($token->[2]->{'name'} eq 'parameter_mapalias') {
  221: 			$hash{'mapalias_'.$token->[2]->{'value'}}=$referid;
  222:                     }
  223:                     if ($token->[2]->{'name'} eq 'parameter_randompick') {
  224: 			$randompick{$referid}=$token->[2]->{'value'};
  225:                     }
  226:                 } 
  227: 
  228:             }
  229:         }
  230: 
  231:     } else {
  232:         $errtext.='Map not loaded: The file does not exist. ';
  233:     }
  234: }
  235: 
  236: # --------------------------------------------------------- Simplify expression
  237: 
  238: sub simplify {
  239:    my $expression=shift;
  240: # (8)=8
  241:    $expression=~s/\((\d+)\)/$1/g;
  242: # 8&8=8
  243:    $expression=~s/(\D)(\d+)\&\2(\D)/$1$2$3/g;
  244: # 8|8=8
  245:    $expression=~s/(\D)(\d+)\|\2(\D)/$1$2$3/g;
  246: # (5&3)&4=5&3&4
  247:    $expression=~s/\((\d+)((?:\&\d+)+)\)\&(\d+\D)/$1$2\&$3/g;
  248: # (((5&3)|(4&6)))=((5&3)|(4&6))
  249:    $expression=~
  250:        s/\((\(\(\d+(?:\&\d+)*\)(?:\|\(\d+(?:\&\d+)*\))+\))\)/$1/g;
  251: # ((5&3)|(4&6))|(1&2)=(5&3)|(4&6)|(1&2)
  252:    $expression=~
  253:        s/\((\(\d+(?:\&\d+)*\))((?:\|\(\d+(?:\&\d+)*\))+)\)\|(\(\d+(?:\&\d+)*\))/\($1$2\|$3\)/g;
  254:    return $expression;
  255: }
  256: 
  257: # -------------------------------------------------------- Build condition hash
  258: 
  259: sub traceroute {
  260:     my ($sofar,$rid,$beenhere)=@_;
  261:     $sofar=simplify($sofar);
  262:     unless ($beenhere=~/\&$rid\&/) {
  263:        $beenhere.=$rid.'&';  
  264:        if (($retfurl eq '') && ($hash{'src_'.$rid})) {
  265:            my ($mapid,$resid)=split(/\./,$rid);
  266:            $retfurl=$hash{'src_'.$rid}.
  267:            (($hash{'src_'.$rid}=~/\?/)?'&':'?').'symb='.
  268:            &Apache::lonnet::symbclean(
  269:                            &Apache::lonnet::declutter($hash{'map_id_'.$mapid}).
  270:                            '___'.$resid.'___'.
  271:                            &Apache::lonnet::declutter($hash{'src_'.$rid}));
  272:        }
  273:        if (defined($hash{'conditions_'.$rid})) {
  274: 	   $hash{'conditions_'.$rid}=simplify(
  275:            '('.$hash{'conditions_'.$rid}.')|('.$sofar.')');
  276:        } else {
  277:            $hash{'conditions_'.$rid}=$sofar;
  278:        }
  279:        if (defined($hash{'is_map_'.$rid})) {
  280:            if (defined($hash{'map_start_'.$hash{'src_'.$rid}})) {
  281: 	       &traceroute($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},'&');
  282:                if (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) {
  283: 		   $sofar=
  284:                   $hash{'conditions_'.$hash{'map_finish_'.$hash{'src_'.$rid}}};
  285:                }
  286:            }
  287:        }
  288:        if (defined($hash{'to_'.$rid})) {
  289:           foreach (split(/\,/,$hash{'to_'.$rid})) {
  290: 		my $further=$sofar;
  291:                 if ($hash{'undercond_'.$_}) {
  292: 		   if (defined($hash{'condid_'.$hash{'undercond_'.$_}})) {
  293:   		       $further=simplify('('.$further.')&('.
  294:                               $hash{'condid_'.$hash{'undercond_'.$_}}.')');
  295: 		   } else {
  296:                        $errtext.='Undefined condition ID: '
  297:                                  .$hash{'undercond_'.$_}.'. ';
  298:                    }
  299:                 }
  300:                 &traceroute($further,$hash{'goesto_'.$_},$beenhere);
  301:           }
  302:        }
  303:     }
  304: }
  305: 
  306: # ------------------------------ Cascading conditions, quick access, parameters
  307: 
  308: sub accinit {
  309:     my ($uri,$short,$fn)=@_;
  310:     my %acchash=();
  311:     my %captured=();
  312:     my $condcounter=0;
  313:     $acchash{'acc.cond.'.$short.'.0'}=0;
  314:     foreach (keys %hash) {
  315:        if ($_=~/^conditions/) {
  316: 	  my $expr=$hash{$_};
  317:          foreach ($expr=~m/(\(\(\d+(?:\&\d+)+\)(?:\|\(\d+(?:\&\d+)+\))+\))/g) {
  318:              my $sub=$_;
  319:              my $orig=$_;
  320:       $sub=~/\(\((\d+\&(:?\d+\&)*)(?:\d+\&*)+\)(?:\|\(\1(?:\d+\&*)+\))+\)/;
  321:              my $factor=$1;
  322:              $sub=~s/$factor//g;
  323:              $sub=~s/^\(/\($factor\(/;
  324: 	     $sub.=')';
  325:              $sub=simplify($sub);
  326:              $orig=~s/(\W)/\\$1/g;
  327:  	     $expr=~s/$orig/$sub/;
  328: 	  }
  329:           $hash{$_}=$expr;
  330:           unless (defined($captured{$expr})) {
  331: 	      $condcounter++;
  332:               $captured{$expr}=$condcounter;
  333:               $acchash{'acc.cond.'.$short.'.'.$condcounter}=$expr;
  334:           } 
  335:        } elsif ($_=~/^param_(\d+)\.(\d+)/) {
  336:           my $prefix=&Apache::lonnet::declutter($hash{'map_id_'.$1}).
  337:       '___'.$2.'___'.&Apache::lonnet::declutter($hash{'src_'.$1.'.'.$2});
  338:           foreach (split(/\&/,$hash{$_})) {
  339: 	     my ($typename,$value)=split(/\=/,$_);
  340:              my ($type,$name)=split(/\:/,$typename);
  341:              $parmhash{$prefix.'.'.&Apache::lonnet::unescape($name)}=
  342:                                    &Apache::lonnet::unescape($value);
  343: 	     $parmhash{$prefix.'.'.&Apache::lonnet::unescape($name).'.type'}=
  344:                                    &Apache::lonnet::unescape($type);
  345:           }
  346:        }
  347:     }
  348:     foreach (keys %hash) {
  349: 	if ($_=~/^ids/) {
  350: 	  foreach (split(/\,/,$hash{$_})) {
  351: 	    my $resid=$_;
  352:             my $uri=$hash{'src_'.$resid};
  353:             $uri=~s/^\/adm\/wrapper//;
  354:             my @uriparts=split(/\//,$uri);
  355:             my $urifile=$uriparts[$#uriparts];
  356:             $#uriparts--;
  357:             my $uripath=join('/',@uriparts);
  358:             $uripath=~s/^\/res\///;
  359:            if ($uripath) {
  360:             my $uricond='0';
  361:             if (defined($hash{'conditions_'.$resid})) {
  362:  		$uricond=$captured{$hash{'conditions_'.$resid}};
  363:             }
  364:             if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) {
  365:                 if ($acchash{'acc.res.'.$short.'.'.$uripath}=~
  366:                    /(\&$urifile\:[^\&]*)/) {
  367: 		    my $replace=$1;
  368:                     my $regexp=$replace;
  369:                     $regexp=~s/\|/\\\|/g;
  370:                     $acchash{'acc.res.'.$short.'.'.$uripath}
  371:                      =~s/$regexp/$replace\|$uricond/;
  372:                 } else {
  373: 		   $acchash{'acc.res.'.$short.'.'.$uripath}.=
  374:                      $urifile.':'.$uricond.'&';
  375: 	        }
  376:             } else {
  377:                 $acchash{'acc.res.'.$short.'.'.$uripath}=
  378:                  '&'.$urifile.':'.$uricond.'&';
  379:             }
  380:            } 
  381:          }
  382:       }
  383:     }
  384:     $acchash{'acc.res.'.$short.'.'}='&:0&';
  385:     my $courseuri=$uri;
  386:     $courseuri=~s/^\/res\///;
  387:     &Apache::lonnet::delenv('(acc\.|httpref\.)');
  388:     &Apache::lonnet::appenv(%acchash,
  389:                             "request.course.id"  => $short,
  390:                             "request.course.fn"  => $fn,
  391:                             "request.course.uri" => $courseuri); 
  392: }
  393: 
  394: # ------------------------------------- Selectively delete from randompick maps
  395: 
  396: sub pickrandom {
  397:     my $randomoutentry='';
  398:     foreach my $rid (keys %randompick) {
  399:         my $rndpick=$randompick{$rid};
  400:         my $mpc=$hash{'map_pc_'.$hash{'src_'.$rid}};
  401: # ------------------------------------------- put existing resources into array
  402:         my @currentrids=();
  403:         foreach (keys %hash) {
  404: 	    if ($_=~/^src_($mpc\.\d+)/) {
  405: 		if ($hash{'src_'.$1}) { push @currentrids, $1; }
  406:             }
  407:         }
  408:         next if ($#currentrids<$rndpick);
  409: # -------------------------------- randomly eliminate the ones that should stay
  410: 	srand(&Apache::lonnet::rndseed($rid)); # use rid instead of symb
  411:         for (my $i=1;$i<=$rndpick;$i++) {
  412:             while (1) {
  413: 		my $randomidx=int(rand($#currentrids+1));
  414:                 if ($currentrids[$randomidx]) {
  415: 		    $currentrids[$randomidx]='';
  416:                     last;
  417:                 }
  418:             }
  419:         }
  420: # -------------------------------------------------------- delete the leftovers
  421:         for (my $k=0; $k<=$#currentrids; $k++) {
  422:             if ($currentrids[$k]) {
  423: 		$hash{'randomout_'.$currentrids[$k]}=1;
  424:                 my ($mapid,$resid)=split(/\./,$currentrids[$k]);
  425:                 $randomoutentry.='&'.
  426:                  &Apache::lonnet::symbclean(
  427: 		    &Apache::lonnet::declutter($hash{'map_id_'.$mapid}).
  428:                     '___'.$resid.'___'.
  429: 		    &Apache::lonnet::declutter($hash{'src_'.$currentrids[$k]})
  430:                  ).'&';
  431:             }
  432:         }
  433:     }
  434:     if ($randomoutentry) {
  435: 	&Apache::lonnet::appenv('acc.randomout' => $randomoutentry);
  436:     }
  437: }
  438: 
  439: # ---------------------------------------------------- Read map and all submaps
  440: 
  441: sub readmap {
  442:    my $short=shift;
  443:    $short=~s/^\///;
  444:    my %cenv=&Apache::lonnet::coursedescription($short);
  445:    my $fn=$cenv{'fn'};
  446:    my $uri;
  447:    $short=~s/\//\_/g;
  448:    unless ($uri=$cenv{'url'}) { 
  449:       &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  450:                        "Could not load course $short.</font>"); 
  451:       return 'No course data available.';
  452:    }
  453:    @cond=('true:normal');
  454:    unlink($fn.'.db');
  455:    unlink($fn.'_symb.db');
  456:    unlink($fn.'.state');
  457:    unlink($fn.'parms.db');
  458:    undef %randompick;
  459:    $retfurl='';
  460:    if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT(),0640)) &&
  461:        (tie(%parmhash,'GDBM_File',$fn.'_parms.db',&GDBM_WRCREAT(),0640))) {
  462:     %hash=();
  463:     %parmhash=();
  464:     $errtext='';
  465:     $pc=0;
  466:     my $furi=&Apache::lonnet::clutter($uri);
  467:     $hash{'src_0.0'}=$furi;
  468:     $hash{'title_0.0'}=&Apache::lonnet::metadata($uri,'title');
  469:     $hash{'ids_'.$furi}='0.0';
  470:     $hash{'is_map_0.0'}=1;
  471:     loadmap($uri);
  472:     if (defined($hash{'map_start_'.$uri})) {
  473:         &traceroute('0',$hash{'map_start_'.$uri},'&');
  474:         &accinit($uri,$short,$fn);
  475:         &pickrandom();
  476:     }
  477:     unless ((untie(%hash)) && (untie(%parmhash))) {
  478:       &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  479:                        "Could not untie coursemap $fn for $uri.</font>"); 
  480:     }
  481:     {
  482:      my $cfh;
  483:      if ($cfh=Apache::File->new(">$fn.state")) {
  484:         print $cfh join("\n",@cond);
  485:      } else {
  486:       &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  487:                        "Could not write statemap $fn for $uri.</font>"); 
  488:      }
  489:     }  
  490:    } else {
  491:       &Apache::lonnet::logthis("<font color=blue>WARNING: ".
  492:                        "Could not tie coursemap $fn for $uri.</font>"); 
  493:    }
  494:    &Apache::lonmsg::author_res_msg($ENV{'request.course.uri'},$errtext);
  495:    return ($retfurl,$errtext);
  496: }
  497: 
  498: # ------------------------------------------------------- Evaluate state string
  499: 
  500: sub evalstate {
  501: 
  502:     my $fn=$ENV{'request.course.fn'}.'.state';
  503:     my $state='2';
  504:     if (-e $fn) {
  505:        my @conditions=();
  506:        {
  507:         my $fh=Apache::File->new($fn);
  508:         @conditions=<$fh>;
  509:        }  
  510:        my $safeeval = new Safe;
  511:        my $safehole = new Safe::Hole;
  512:        $safeeval->permit("entereval");
  513:        $safeeval->permit(":base_math");
  514:        $safeeval->deny(":base_io");
  515:        $safehole->wrap(\&Apache::lonnet::EXT,$safeeval,'&EXT');
  516:        foreach (@conditions) {
  517: 	   my $line=$_;
  518:            chomp($line);
  519: 	   my ($condition,$weight)=split(/\:/,$_);
  520:            if ($safeeval->reval($condition)) {
  521: 	       if ($weight eq 'force') {
  522: 		   $state.='3';
  523:                } else {
  524:                    $state.='2';
  525:                }
  526:            } else {
  527:                if ($weight eq 'stop') {
  528: 		   $state.='0';
  529:                } else {
  530:                    $state.='1';
  531:                }
  532:            }
  533:        }
  534:     }
  535:     &Apache::lonnet::appenv('user.state.'.$ENV{'request.course.id'} => $state);
  536:     return $state;
  537: }
  538: 
  539: 1;
  540: __END__
  541: 
  542: =head1 NAME
  543: 
  544: Apache::lonuserstate - Construct and maintain state and binary representation
  545: of course for user
  546: 
  547: =head1 SYNOPSIS
  548: 
  549: Invoked by lonroles.pm.
  550: 
  551: &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
  552: 
  553: =head1 INTRODUCTION
  554: 
  555: This module constructs and maintains state and binary representation
  556: of course for user.
  557: 
  558: This is part of the LearningOnline Network with CAPA project
  559: described at http://www.lon-capa.org.
  560: 
  561: =head1 HANDLER SUBROUTINE
  562: 
  563: There is no handler subroutine.
  564: 
  565: =head1 OTHER SUBROUTINES
  566: 
  567: =over 4
  568: 
  569: =item *
  570: 
  571: loadmap() : Loads map from disk
  572: 
  573: =item *
  574: 
  575: simplify() : Simplify expression
  576: 
  577: =item *
  578: 
  579: traceroute() : Build condition hash
  580: 
  581: =item *
  582: 
  583: accinit() : Cascading conditions, quick access, parameters
  584: 
  585: =item *
  586: 
  587: readmap() : Read map and all submaps
  588: 
  589: =item *
  590: 
  591: evalstate() : Evaluate state string
  592: 
  593: =back
  594: 
  595: =cut

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