[LON-CAPA-cvs] cvs: rat / lonpage.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Mon, 20 May 2002 19:05:12 -0000
sakharuk Mon May 20 15:05:12 2002 EDT
Modified files:
/rat lonpage.pm
Log:
now prints pages but still heeds some additional work (mainly cleanup)
Index: rat/lonpage.pm
diff -u rat/lonpage.pm:1.36 rat/lonpage.pm:1.37
--- rat/lonpage.pm:1.36 Thu Mar 28 16:47:48 2002
+++ rat/lonpage.pm Mon May 20 15:05:11 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Page Handler
#
-# $Id: lonpage.pm,v 1.36 2002/03/28 21:47:48 www Exp $
+# $Id: lonpage.pm,v 1.37 2002/05/20 19:05:11 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -152,7 +152,8 @@
return OK;
}
- my $requrl=$r->uri;
+ my $requrl=$r->uri;
+ my $target = $ENV{'form.grade_target'};
# ----------------------------------------------------------------- Tie db file
if ($ENV{'request.course.fn'}) {
my $fn=$ENV{'request.course.fn'};
@@ -331,43 +332,45 @@
# ------------------------------------------------------------------ Build page
# ---------------------------------------------------------------- Send headers
- if ($isxml) {
- $r->content_type('text/xml');
- $r->send_http_header;
- $r->print($xmlheader);
- } else {
- $r->content_type('text/html');
- $r->send_http_header;
- $r->print('<html>');
- }
+ unless ($target eq 'tex') {
+ if ($isxml) {
+ $r->content_type('text/xml');
+ $r->send_http_header;
+ $r->print($xmlheader);
+ } else {
+ $r->content_type('text/html');
+ $r->send_http_header;
+ $r->print('<html>');
+ }
# ------------------------------------------------------------------------ Head
- $r->print("\n<head>\n".$allmeta);
- $allscript=~
- s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs;
- if ($allscript) {
- $r->print("\n<script language='JavaScript'>\n".
- $allscript."\n</script>\n");
- }
- $r->print(&Apache::lonxml::registerurl(1,undef));
- $r->print("\n</head>\n");
+ $r->print("\n<head>\n".$allmeta);
+ $allscript=~
+ s/\/\/ BEGIN LON\-CAPA Internal.+\/\/ END LON\-CAPA Internal\s//gs;
+ if ($allscript) {
+ $r->print("\n<script language='JavaScript'>\n".
+ $allscript."\n</script>\n");
+ }
+ $r->print(&Apache::lonxml::registerurl(1,undef));
+ $r->print("\n</head>\n");
# ------------------------------------------------------------------ Start body
- if ($isxml) {
- $r->print($xmlbody);
- } else {
- $r->print(
- '<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonxml::loadevents.
- '" onUnload="'.&Apache::lonxml::unloadevents.'">');
- }
+ if ($isxml) {
+ $r->print($xmlbody);
+ } else {
+ $r->print('<body bgcolor="#FFFFFF" onLoad="'.&Apache::lonxml::loadevents.'" onUnload="'.&Apache::lonxml::unloadevents.'">');
+ }
# ------------------------------------------------------------------ Start form
- if ($nforms) {
- $r->print('<form method="post" action="'.
- $requrl.'">');
- }
+ if ($nforms) {
+ $r->print('<form method="post" action="'.
+ $requrl.'">');
+ }
# ----------------------------------------------------------------- Start table
- $r->print('<table cols="'.$lcm.'" border="0">');
+ $r->print('<table cols="'.$lcm.'" border="0">');
+ }
for ($i=0;$i<=$#rows;$i++) {
if ($rows[$i]) {
- $r->print("\n<tr>");
+ unless ($target eq 'tex') {
+ $r->print("\n<tr>");
+ }
my @colcont=split(/\&/,$rows[$i]);
my $avespan=$lcm/($#colcont+1);
for ($j=0;$j<=$#colcont;$j++) {
@@ -403,40 +406,54 @@
'</img></a>';
}
$metainfo.='<br></br>';
- $r->print('<td colspan="'.$avespan.'"');
+ unless ($target eq 'tex') {
+ $r->print('<td colspan="'.$avespan.'"');
+ }
if ($cellemb{$rid} eq 'ssi') {
- if ($ssibgcolor{$rid}) {
- $r->print(' bgcolor="'.
- $ssibgcolor{$rid}.'"');
- }
- $r->print('>'.$metainfo.'<font');
- if ($ssitext{$rid}) {
- $r->print(' text="'.$ssitext{$rid}.'"');
- }
- if ($ssilink{$rid}) {
- $r->print(' link="'.$ssilink{$rid}.'"');
- }
- if ($ssitext{$rid}) {
- $r->print(' vlink="'.$ssivlink{$rid}.'"');
- }
- if ($ssialink{$rid}) {
- $r->print(' alink="'.$ssialink{$rid}.'"');
- }
-
- $r->print('>'.$ssibody{$rid}.'</font>');
- } elsif ($cellemb{$rid} eq 'img') {
+ unless ($target eq 'tex') {
+ if ($ssibgcolor{$rid}) {
+ $r->print(' bgcolor="'.
+ $ssibgcolor{$rid}.'"');
+ }
+ $r->print('>'.$metainfo.'<font');
+
+ if ($ssitext{$rid}) {
+ $r->print(' text="'.$ssitext{$rid}.'"');
+ }
+ if ($ssilink{$rid}) {
+ $r->print(' link="'.$ssilink{$rid}.'"');
+ }
+ if ($ssitext{$rid}) {
+ $r->print(' vlink="'.$ssivlink{$rid}.'"');
+ }
+ if ($ssialink{$rid}) {
+ $r->print(' alink="'.$ssialink{$rid}.'"');
+ }
+ $r->print('>');
+ }
+ $r->print($ssibody{$rid});
+ unless ($target eq 'tex') {
+ $r->print('</font>');
+ }
+ } elsif ($cellemb{$rid} eq 'img') {
$r->print('>'.$metainfo.'<img src="'.
$hash{'src_'.$rid}.'"></img>');
} elsif ($cellemb{$rid} eq 'emb') {
$r->print('>'.$metainfo.'<embed src="'.
$hash{'src_'.$rid}.'"></embed>');
}
- $r->print('</td>');
+ unless ($target eq 'tex') {
+ $r->print('</td>');
+ }
}
- $r->print('</tr>');
+ unless ($target eq 'tex') {
+ $r->print('</tr>');
+ }
}
}
- $r->print("\n</table>");
+ unless ($target eq 'tex') {
+ $r->print("\n</table>");
+ }
# ---------------------------------------------------------------- Submit, etc.
if ($nforms) {
$r->print(