[LON-CAPA-cvs] cvs: rat / lonsequence.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 23 May 2002 10:58:05 -0000
www Thu May 23 06:58:05 2002 EDT
Modified files:
/rat lonsequence.pm
Log:
Does display rough sequences if context ambiguous
Index: rat/lonsequence.pm
diff -u rat/lonsequence.pm:1.8 rat/lonsequence.pm:1.9
--- rat/lonsequence.pm:1.8 Thu May 23 06:19:30 2002
+++ rat/lonsequence.pm Thu May 23 06:58:05 2002
@@ -2,7 +2,7 @@
#
# Sequence Handler
#
-# $Id: lonsequence.pm,v 1.8 2002/05/23 10:19:30 www Exp $
+# $Id: lonsequence.pm,v 1.9 2002/05/23 10:58:05 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -73,7 +73,7 @@
# ---------------------------------------------------------------- View Handler
sub viewmap {
- my ($r,$url,$adv,$errtext)=@_;
+ my ($r,$url)=@_;
$r->print('<html>');
if ($ENV{'form.forceselect'}) { $r->print(<<ENDSCRIPT);
<script>
@@ -95,12 +95,10 @@
}
}
-
-
</script>
ENDSCRIPT
}
- $r->print('<body bgcolor="#FFFFFF">'.&buttons($adv));
+ $r->print('<body bgcolor="#FFFFFF">');
if ($ENV{'form.forceselect'}) { $r->print(<<ENDSELECT);
<form name=fileattr><input type=hidden name=acts value=''>
<input type="button" name="close" value='CLOSE' onClick="self.close()">
@@ -109,9 +107,6 @@
</form>
ENDSELECT
}
- if ($errtext) {
- $r->print($errtext.'<hr>');
- }
my $idx=0;
foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {
if (defined($_)) {
@@ -165,7 +160,10 @@
my $requrl=$r->uri;
# ------------------------------------------------------------ Tie symb db file
- if ($ENV{'request.course.fn'}) {
+ my $disurl='';
+ my $dismapid='';
+
+ if (($ENV{'request.course.fn'}) && (!$ENV{'form.forceselect'})) {
my $last;
if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.'_symb.db',
&GDBM_READER,0640)) {
@@ -189,8 +187,6 @@
$disid=$bighash{'map_start_'.$requrl};
$whatend='Beginning';
}
- my $disurl='';
- my $dismapid='';
if ($disid) {
$disurl=$bighash{'src_'.$disid};
$dismapid=(split(/\./,$disid))[1];
@@ -207,38 +203,24 @@
}
# --------------------------------------- Untie hash, make sure to come by here
untie(%bighash);
- if ($disurl) {
+ }
+ }
+
+# 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,
+ &Apache::lonnet::symblist($requrl,$disurl => $dismapid,
'last_known' => &Apache::lonnet::declutter($disurl));
- $r->content_type('text/html');
- $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$disurl);
- return REDIRECT;
- } else {
-# ---------- Does not have first or last resource, try to find out where we are
- unless ($symb) {
- $r->internal_redirect('/adm/ambiguous');
- }
- $r->content_type('text/html');
- $r->send_http_header;
- $r->print(<<ENDSYMB);
-<html><body bgcolor="#FFFFFF">
-<h2>$whatend of</h2>
-<h1>$sequencetitle</h1>
-</body></html>
-ENDSYMB
- return OK
- }
- } else {
- &getlost($r,'Could not access course structure.');
- return OK;
- }
+ $r->content_type('text/html');
+ $r->header_out(Location => 'http://'.$ENV{'HTTP_HOST'}.$disurl);
+ return REDIRECT;
} else {
- $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
- return HTTP_NOT_ACCEPTABLE;
+ $r->content_type('text/html');
+ $r->send_http_header;
+ &viewmap($r,$requrl);
+ return OK;
}
-
- return OK;
}
1;