[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm /lonnet/perl lonnet.pm rat lonambiguous.pm lonpage.pm lonpageflip.pm lonsequence.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 01 Mar 2005 00:23:01 -0000
This is a MIME encoded message
--albertel1109636581
Content-Type: text/plain
albertel Mon Feb 28 19:23:01 2005 EDT
Modified files:
/rat lonambiguous.pm lonpage.pm lonpageflip.pm lonsequence.pm
/loncom/auth lonacc.pm
/loncom/lonnet/perl lonnet.pm
Log:
- the _symb.db now actually does store symbs
- I am pretty sure the symbread changes are correct, but I still need to double check them
--albertel1109636581
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20050228192301.txt"
Index: rat/lonambiguous.pm
diff -u rat/lonambiguous.pm:1.14 rat/lonambiguous.pm:1.15
--- rat/lonambiguous.pm:1.14 Thu Feb 17 04:09:57 2005
+++ rat/lonambiguous.pm Mon Feb 28 19:22:57 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to resolve ambiguous file locations
#
-# $Id: lonambiguous.pm,v 1.14 2005/02/17 09:09:57 albertel Exp $
+# $Id: lonambiguous.pm,v 1.15 2005/03/01 00:22:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -93,7 +93,7 @@
my $resid=$2;
my $resurl=$bighash{'src_'.$mapid.'.'.$resid};
&Apache::lonnet::symblist($bighash{'map_id_'.$mapid},
- $resurl => $resid);
+ $resurl => [$resurl,$resid]);
untie(%bighash);
$r->header_out(Location =>
'http://'.$ENV{'HTTP_HOST'}.$resurl);
@@ -130,13 +130,13 @@
# ---------------------------------------------------------- There was an entry
if ($syval) {
-
- if ($syval=~/\_$/) {
+ my ($page,undef,$res)=&Apache::lonnet::decode_symb($syval);
+ if ($res eq 'page') {
# ----------------------------------- Okay, this should have appeared on a page
- $syval=~s/\_\_\_$//;
&Apache::loncommon::content_type($r,'text/html');
$r->header_out(Location =>
- 'http://'.$ENV{'HTTP_HOST'}.'/res/'.$syval);
+ 'http://'.$ENV{'HTTP_HOST'}.
+ &Apache::lonnet::clutter($page));
return REDIRECT;
} else {
# There is not really a problem (???), but cannot go back without endless loop
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.67 rat/lonpage.pm:1.68
--- rat/lonpage.pm:1.67 Thu Feb 17 04:09:57 2005
+++ rat/lonpage.pm Mon Feb 28 19:22:57 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.67 2005/02/17 09:09:57 albertel Exp $
+# $Id: lonpage.pm,v 1.68 2005/03/01 00:22:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -181,7 +181,7 @@
if ($rows[$i]) {
my @colcont=split(/\&/,$rows[$i]);
foreach (@colcont) {
- $symbhash{$hash{'src_'.$_}}='';
+ $symbhash{$hash{'src_'.$_}}=['page','notasymb'];
}
}
}
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.51 rat/lonpageflip.pm:1.52
--- rat/lonpageflip.pm:1.51 Thu Feb 17 04:09:57 2005
+++ rat/lonpageflip.pm Mon Feb 28 19:22:57 2005
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.51 2005/02/17 09:09:57 albertel Exp $
+# $Id: lonpageflip.pm,v 1.52 2005/03/01 00:22:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -210,9 +210,7 @@
my $newloc;
if (($last) && (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
&GDBM_READER(),0640))) {
- my ($murl,$fn)=&Apache::lonnet::decode_symb($last);
- my $id;
- ($murl,$id,$fn)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread($fn));
+ my ($murl,$id,$fn)=&Apache::lonnet::decode_symb($last);
$id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
$newloc=$hash{'src_'.$id};
if ($newloc) {
@@ -244,7 +242,7 @@
untie(%hash);
}
if ($last) {
- $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[1]);
+ $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);
} else {
&Apache::loncommon::content_type($r,'text/html');
$r->header_out(Location =>
@@ -257,9 +255,9 @@
if ($position=Apache::lonnet::symbread($currenturl)) {
# ------------------------------------------------------------------------- Yes
my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position);
- $cachehash{$startoutmap}{$thisurl}=$mapnum;
+ $cachehash{$startoutmap}{$thisurl}=[$thisurl,$mapnum];
$cachehash{$startoutmap}{'last_known'}=
- &Apache::lonnet::declutter($currenturl);
+ [&Apache::lonnet::declutter($currenturl),$mapnum];
# ============================================================ Tie the big hash
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -286,9 +284,8 @@
if ($#possibilities==0) {
# ---------------------------------------------- Only one possibility, redirect
$redirecturl=&hash_src($next);
- $cachehash{$endupmap}
- {&Apache::lonnet::declutter($redirecturl)}
- =(split(/\./,$next))[1];
+ $cachehash{$endupmap}{$redirecturl}=
+ [$redirecturl,(split(/\./,$next))[1]];
} else {
# ------------------------ There are multiple possibilities for a next resource
$multichoice=1;
@@ -303,13 +300,9 @@
$second.'___'.$symbSrc);
my ($choicemap,$choiceres)=split(/\./,$_);
- $cachehash
- {&Apache::lonnet::declutter($hash{'src_'.$choicemap})}
- {&Apache::lonnet::declutter(
- $multichoicehash
- {'src_'.$_}
- )}
- =$choiceres;
+ my $map=&Apache::lonnet::declutter($hash{'src_'.$choicemap});
+ my $url=$multichoicehash{'src_'.$_};
+ $cachehash{$map}{$url}=[$url,$choiceres];
} @possibilities;
}
} else {
@@ -319,9 +312,12 @@
# ----------------- The program must come past this point to untie the big hash
untie(%hash);
# --------------------------------------------------------- Store position info
- $cachehash{$startoutmap}{'last_direction'}=$direction;
+ $cachehash{$startoutmap}{'last_direction'}=[$direction,'notasymb'];
foreach my $thismap (keys %cachehash) {
- &Apache::lonnet::symblist($thismap,%{$cachehash{$thismap}});
+ my $mapnum=$cachehash{$thismap}->{'mapnum'};
+ delete($cachehash{$thismap}->{'mapnum'});
+ &Apache::lonnet::symblist($thismap,
+ %{$cachehash{$thismap}});
}
# ============================================== Do not return before this line
if ($redirecturl) {
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.22 rat/lonsequence.pm:1.23
--- rat/lonsequence.pm:1.22 Thu Feb 17 04:09:57 2005
+++ rat/lonsequence.pm Mon Feb 28 19:22:57 2005
@@ -2,7 +2,7 @@
#
# Sequence Handler
#
-# $Id: lonsequence.pm,v 1.22 2005/02/17 09:09:57 albertel Exp $
+# $Id: lonsequence.pm,v 1.23 2005/03/01 00:22:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -252,7 +252,7 @@
my $direction='';
my $prevmap='';
if ($last) {
- ($prevmap,$direction)=(split(/\_\_\_/,$last));
+ ($prevmap,undef,$direction)=&Apache::lonnet::decode_symb($last);
}
# ------------------------------------------------------------- Tie big db file
if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -299,8 +299,8 @@
# now either disurl is set (going to first page), or we need another display
if ($disurl) {
# -------------------------------------------------- Has first or last resource
- &Apache::lonnet::symblist($requrl,$disurl => $dismapid,
- 'last_known' => &Apache::lonnet::declutter($disurl));
+ &Apache::lonnet::symblist($requrl,$disurl => [$disurl,$dismapid],
+ 'last_known' => [$disurl,$dismapid]);
&Apache::loncommon::content_type($r,'text/html');
$r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$disurl);
return REDIRECT;
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.62 loncom/auth/lonacc.pm:1.63
--- loncom/auth/lonacc.pm:1.62 Mon Feb 7 20:20:11 2005
+++ loncom/auth/lonacc.pm Mon Feb 28 19:22:57 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.62 2005/02/08 01:20:11 albertel Exp $
+# $Id: lonacc.pm,v 1.63 2005/03/01 00:22:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -121,14 +121,14 @@
$symb=&Apache::lonnet::symbclean($ENV{'form.symb'});
if ($requrl =~ m|^/adm/wrapper/|) {
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
- &Apache::lonnet::symblist($map,$murl => $mid,
- 'last_known' => $murl);
+ &Apache::lonnet::symblist($map,$murl => [$murl,$mid],
+ 'last_known' =>[$murl,$mid]);
} elsif ((&Apache::lonnet::symbverify($symb,$requrl)) ||
(($requrl=~m|(.*)/smpedit$|) &&
&Apache::lonnet::symbverify($symb,$1))) {
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
- &Apache::lonnet::symblist($map,$murl => $mid,
- 'last_known' => $murl);
+ &Apache::lonnet::symblist($map,$murl => [$murl,$mid],
+ 'last_known' =>[$murl,$mid]);
} else {
$r->log_reason('Invalid symb for '.$requrl.': '.
$symb);
@@ -147,8 +147,8 @@
}
if ($symb) {
my ($map,$mid,$murl)=split(/\_\_\_/,$symb);
- &Apache::lonnet::symblist($map,$murl => $mid,
- 'last_known' => $murl);
+ &Apache::lonnet::symblist($map,$murl =>[$murl,$mid],
+ 'last_known' =>[$murl,$mid]);
}
}
$ENV{'request.symb'}=$symb;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.600 loncom/lonnet/perl/lonnet.pm:1.601
--- loncom/lonnet/perl/lonnet.pm:1.600 Wed Feb 23 18:19:42 2005
+++ loncom/lonnet/perl/lonnet.pm Mon Feb 28 19:22:59 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.600 2005/02/23 23:19:42 albertel Exp $
+# $Id: lonnet.pm,v 1.601 2005/03/01 00:22:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4676,7 +4676,8 @@
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db',
&GDBM_WRCREAT(),0640)) {
foreach (keys %newhash) {
- $hash{declutter($_)}=$mapname.'___'.&deversion($newhash{$_});
+ $hash{declutter($_)}=&encode_symb($mapname,$newhash{$_}->[1],
+ $newhash{$_}->[0]);
}
if (untie(%hash)) {
return 'ok';
@@ -4830,13 +4831,13 @@
}
# ---------------------------------------------------------- There was an entry
if ($syval) {
- unless ($syval=~/\_\d+$/) {
- unless ($ENV{'form.request.prefix'}=~/\.(\d+)\_$/) {
- &appenv('request.ambiguous' => $thisfn);
- return $ENV{$cache_str}='';
- }
- $syval.=$1;
- }
+ #unless ($syval=~/\_\d+$/) {
+ #unless ($ENV{'form.request.prefix'}=~/\.(\d+)\_$/) {
+ #&appenv('request.ambiguous' => $thisfn);
+ #return $ENV{$cache_str}='';
+ #}
+ #$syval.=$1;
+ #}
} else {
# ------------------------------------------------------- Was not in symb table
if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -4880,7 +4881,8 @@
}
}
if ($syval) {
- return $ENV{$cache_str}=&symbclean($syval.'___'.$thisfn);
+ return $ENV{$cache_str}=$syval;
+ #return $ENV{$cache_str}=&symbclean($syval.'___'.$thisfn);
}
}
&appenv('request.ambiguous' => $thisfn);
--albertel1109636581--