version 1.9, 2000/09/30 17:26:28
|
version 1.14, 2000/10/31 19:31:42
|
Line 11
|
Line 11
|
# 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer) |
# 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer) |
# |
# |
# 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30, |
# 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30, |
# 9/2,9/4,9/29,9/30 Gerd Kortemeyer |
# 9/2,9/4,9/29,9/30,10/2,10/11,10/30,10/31 Gerd Kortemeyer |
|
|
package Apache::lonuserstate; |
package Apache::lonuserstate; |
|
|
Line 21 use Apache::File;
|
Line 21 use Apache::File;
|
use HTML::TokeParser; |
use HTML::TokeParser; |
use Apache::lonnet(); |
use Apache::lonnet(); |
use GDBM_File; |
use GDBM_File; |
|
use Apache::lonmsg; |
|
|
# ---------------------------------------------------- Globals for this package |
# ---------------------------------------------------- Globals for this package |
|
|
Line 42 sub loadmap {
|
Line 43 sub loadmap {
|
|
|
my $fn='/home/httpd/html'.$uri; |
my $fn='/home/httpd/html'.$uri; |
|
|
unless (($fn=~/\.course$/) || |
unless (($fn=~/\.sequence$/) || |
($fn=~/\.sequence$/) || |
|
($fn=~/\.page$/)) { |
($fn=~/\.page$/)) { |
$errtext.="Invalid map: $fn\n"; |
$errtext.="Invalid map: $fn\n"; |
return OK; |
return OK; |
Line 117 sub loadmap {
|
Line 117 sub loadmap {
|
$hash{'type_'.$rid}='normal'; |
$hash{'type_'.$rid}='normal'; |
} |
} |
|
|
if (($turi=~/\.course$/) || |
if (($turi=~/\.sequence$/) || |
($turi=~/\.sequence$/) || |
|
($turi=~/\.page$/)) { |
($turi=~/\.page$/)) { |
$hash{'is_map_'.$rid}=1; |
$hash{'is_map_'.$rid}=1; |
&loadmap($turi); |
&loadmap($turi); |
Line 251 sub accinit {
|
Line 250 sub accinit {
|
map { |
map { |
my $sub=$_; |
my $sub=$_; |
my $orig=$_; |
my $orig=$_; |
$sub=~/\(\((\d+\&(:?\d+\&)*)(?:\d+\&*)+\)(?:\|\(\1(?:\d+\&*)+\))+\)/; |
$sub=~/\(\((\d+\&(:?\d+\&)*)(?:\d+\&*)+\)(?:\|\(\1(?:\d+\&*)+\))+\)/; |
my $factor=$1; |
my $factor=$1; |
$sub=~s/$factor//g; |
$sub=~s/$factor//g; |
$sub=~s/^\(/\($factor\(/; |
$sub=~s/^\(/\($factor\(/; |
Line 270 sub accinit {
|
Line 269 sub accinit {
|
} keys %hash; |
} keys %hash; |
map { |
map { |
if ($_=~/^ids/) { |
if ($_=~/^ids/) { |
my $resid=$hash{$_}; |
map { |
|
my $resid=$_; |
my $uri=$hash{'src_'.$resid}; |
my $uri=$hash{'src_'.$resid}; |
my @uriparts=split(/\//,$uri); |
my @uriparts=split(/\//,$uri); |
my $urifile=$uriparts[$#uriparts]; |
my $urifile=$uriparts[$#uriparts]; |
$#uriparts--; |
$#uriparts--; |
my $uripath=join('/',@uriparts); |
my $uripath=join('/',@uriparts); |
$uripath=~s/^\/res\///; |
$uripath=~s/^\/res\///; |
|
my $uricond='0'; |
if (defined($hash{'conditions_'.$resid})) { |
if (defined($hash{'conditions_'.$resid})) { |
$urifile.=':'.$captured{$hash{'conditions_'.$resid}}; |
$uricond=$captured{$hash{'conditions_'.$resid}}; |
} else { |
|
$urifile.=':0'; |
|
} |
} |
if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) { |
if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) { |
$acchash{'acc.res.'.$short.'.'.$uripath}.=$urifile.'&'; |
if ($acchash{'acc.res.'.$short.'.'.$uripath}=~ |
|
/(\&$urifile\:[^\&]*)/) { |
|
my $replace=$1; |
|
$acchash{'acc.res.'.$short.'.'.$uripath} |
|
=~s/$replace/$replace\|$uricond/; |
|
} else { |
|
$acchash{'acc.res.'.$short.'.'.$uripath}.= |
|
$urifile.':'.$uricond.'&'; |
|
} |
} else { |
} else { |
$acchash{'acc.res.'.$short.'.'.$uripath}='&'.$urifile.'&'; |
$acchash{'acc.res.'.$short.'.'.$uripath}= |
} |
'&'.$urifile.':'.$uricond.'&'; |
} |
} |
|
} split(/\,/,$hash{$_}); |
|
} |
} keys %hash; |
} keys %hash; |
my $courseuri=$uri; |
my $courseuri=$uri; |
$courseuri=~s/^\/res\///; |
$courseuri=~s/^\/res\///; |
|
&Apache::lonnet::delenv('(acc\.|httpref\.)'); |
&Apache::lonnet::appenv(%acchash, |
&Apache::lonnet::appenv(%acchash, |
"request.course.id" => $short, |
"request.course.id" => $short, |
"request.course.fn" => $fn, |
"request.course.fn" => $fn, |
Line 312 sub readmap {
|
Line 322 sub readmap {
|
return 'No course data available.'; |
return 'No course data available.'; |
} |
} |
@cond=('true:normal'); |
@cond=('true:normal'); |
|
unlink($fn.'.db'); |
|
unlink($fn.'_symb.db'); |
|
unlink($fn.'.state'); |
if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT,0640)) { |
if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_WRCREAT,0640)) { |
%hash=(); |
%hash=(); |
$errtext=''; |
$errtext=''; |
Line 338 sub readmap {
|
Line 351 sub readmap {
|
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
"Could not tie coursemap $fn for $uri.</font>"); |
"Could not tie coursemap $fn for $uri.</font>"); |
} |
} |
|
&Apache::lonmsg::author_res_msg($ENV{'request.course.uri'},$errtext); |
return $errtext; |
return $errtext; |
} |
} |
|
|