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