[LON-CAPA-cvs] cvs: rat / lonpageflip.pm lonsequence.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 23 May 2002 15:07:56 -0000
www Thu May 23 11:07:56 2002 EDT
Modified files:
/rat lonpageflip.pm lonsequence.pm
Log:
Bug #175
If the beginning of a sequence is an empty resource, use "move" from
lonpageflip now to get to non-empty page.
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.24 rat/lonpageflip.pm:1.25
--- rat/lonpageflip.pm:1.24 Fri Apr 12 10:24:58 2002
+++ rat/lonpageflip.pm Thu May 23 11:07:55 2002
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.24 2002/04/12 14:24:58 www Exp $
+# $Id: lonpageflip.pm,v 1.25 2002/05/23 15:07:55 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,6 +61,16 @@
}
}
return $current;
+}
+
+sub fullmove {
+ my ($rid,$mapurl,$direction)=@_;
+ if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
+ &GDBM_READER,0640)) {
+ ($rid,$mapurl)=&move($rid,$mapurl,$direction);
+ untie(%hash);
+ }
+ return($rid,$mapurl);
}
sub move {
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.10 rat/lonsequence.pm:1.11
--- rat/lonsequence.pm:1.10 Thu May 23 09:04:59 2002
+++ rat/lonsequence.pm Thu May 23 11:07:55 2002
@@ -2,7 +2,7 @@
#
# Sequence Handler
#
-# $Id: lonsequence.pm,v 1.10 2002/05/23 13:04:59 www Exp $
+# $Id: lonsequence.pm,v 1.11 2002/05/23 15:07:55 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,6 +44,7 @@
use GDBM_File;
use Apache::lonratedt;
use Apache::lonratsrv;
+use Apache::lonpageflip;
# ----------------------------------------------------------- Could not resolve
@@ -189,6 +190,18 @@
$disurl=$bighash{'src_'.$disid};
$dismapid=(split(/\./,$disid))[1];
}
+# ------------------------- If this is an empty one, skip to next non-empty one
+ if ((!$disurl) && ($disid)) {
+ $direction=($direction?$direction:'forward');
+ ($disid,$requrl)=
+ &Apache::lonpageflip::fullmove($disid,
+ &Apache::lonnet::declutter($requrl),$direction);
+ if ($disid) {
+ $disurl=$bighash{'src_'.$disid};
+ $dismapid=(split(/\./,$disid))[1];
+ }
+ }
+
# --------------------------------------- Untie hash, make sure to come by here
untie(%bighash);
}