[LON-CAPA-cvs] cvs: rat / lonpageflip.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 11 Apr 2002 19:21:52 -0000
www Thu Apr 11 15:21:52 2002 EDT
Modified files:
/rat lonpageflip.pm
Log:
Trying to disentangle the maps
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.21 rat/lonpageflip.pm:1.22
--- rat/lonpageflip.pm:1.21 Thu Apr 11 14:19:46 2002
+++ rat/lonpageflip.pm Thu Apr 11 15:21:52 2002
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.21 2002/04/11 18:19:46 www Exp $
+# $Id: lonpageflip.pm,v 1.22 2002/04/11 19:21:52 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -203,33 +203,33 @@
my $position;
if ($position=Apache::lonnet::symbread($currenturl)) {
# ------------------------------------------------------------------------- Yes
- my ($mapurl,$mapnum,$thisurl)=split(/\_\_\_/,$position);
- $cachehash{$mapurl}{$thisurl}=$mapnum;
- $cachehash{$mapurl}{'last_known'}=&Apache::lonnet::declutter($currenturl);
- my $startoutmap=$mapurl;
+ my ($startoutmap,$mapnum,$thisurl)=split(/\_\_\_/,$position);
+ $cachehash{$startoutmap}{$thisurl}=$mapnum;
+ $cachehash{$startoutmap}{'last_known'}=&Apache::lonnet::declutter($currenturl);
# ============================================================ Tie the big hash
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
&GDBM_READER,0640)) {
- my $rid=$hash{'map_pc_/res/'.$mapurl}.'.'.$mapnum;
+ my $rid=$hash{'map_pc_/res/'.$startoutmap}.'.'.$mapnum;
# ------------------------------------------------- Move forward, backward, etc
-
- ($next,$mapurl)=&move($rid,$mapurl,$direction);
+ my $endupmap;
+ ($next,$endupmap)=&move($rid,$startoutmap,$direction);
# -------------------------------------- Do we have one and only one empty URL?
my $safecount=0;
while (($next) && ($next!~/\,/) && (!$hash{'src_'.$next})
&& ($safecount<25)) {
- ($next,$mapurl)=&move($next,$mapurl,$direction);
+ ($next,$endupmap)=&move($next,$endupmap,$direction);
$safecount++;
}
+# We are now at at least one non-empty URL
# ----------------------------------------------------- Check out possibilities
if ($next) {
@possibilities=split(/\,/,$next);
if ($#possibilities==0) {
# ---------------------------------------------- Only one possibility, redirect
$redirecturl=$hash{'src_'.$next};
- $cachehash{$mapurl}
+ $cachehash{$endupmap}
{&Apache::lonnet::declutter($redirecturl)}
=(split(/\./,$next))[1];
} else {
@@ -239,12 +239,14 @@
$multichoicehash{'src_'.$_}=$hash{'src_'.$_};
$multichoicehash{'title_'.$_}=$hash{'title_'.$_};
$multichoicehash{'type_'.$_}=$hash{'type_'.$_};
- $cachehash{$mapurl}
- {&Apache::lonnet::declutter(
+ my ($choicemap,$choiceres)=split(/\./,$_);
+ $cachehash
+ {&Apache::lonnet::declutter($hash{'src_'.$choicemap})}
+ {&Apache::lonnet::declutter(
$multichoicehash
{'src_'.$_}
)}
- =(split(/\./,$_))[1];
+ =$choiceres;
} @possibilities;
}
} else {
@@ -254,7 +256,7 @@
# ----------------- The program must come past this point to untie the big hash
untie(%hash);
# --------------------------------------------------------- Store position info
- $cachehash{$mapurl}{'last_direction'}=$direction;
+ $cachehash{$startoutmap}{'last_direction'}=$direction;
foreach my $thismap (keys %cachehash) {
&Apache::lonnet::symblist($thismap,%{$cachehash{$thismap}});
}