[LON-CAPA-cvs] cvs: loncom /interface lonsyllabus.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Mon, 03 May 2004 17:36:47 -0000
sakharuk Mon May 3 13:36:47 2004 EDT
Modified files:
/loncom/interface lonsyllabus.pm
Log:
Lonsyllabus.pm now understand what to do for the target='tex'. I've checked it for coorse coordinator and am going to check for student.
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.27 loncom/interface/lonsyllabus.pm:1.28
--- loncom/interface/lonsyllabus.pm:1.27 Fri Feb 13 10:01:29 2004
+++ loncom/interface/lonsyllabus.pm Mon May 3 13:36:47 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Syllabus
#
-# $Id: lonsyllabus.pm,v 1.27 2004/02/13 15:01:29 www Exp $
+# $Id: lonsyllabus.pm,v 1.28 2004/05/03 17:36:47 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,11 +44,17 @@
return OK if $r->header_only;
# ------------------------------------------------------------ Print the screen
- $r->print(<<ENDDOCUMENT);
+ my $target=$ENV{'form.grade_target'};
+ &Apache::lonnet::logthis("NOW TARGET IS DEFINIED AS $target");
+ if ($target ne 'tex') {
+ $r->print(<<ENDDOCUMENT);
<html>
<head>
<title>The LearningOnline Network with CAPA</title>
ENDDOCUMENT
+ } else {
+ $r->print(&Apache::lonprintout::print_latex_header($ENV{'form.latex_type'}));
+ }
my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
# Is this even a course?
my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);
@@ -92,27 +98,53 @@
# ------------------------------------- There is such a course, get environment
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
- $r->print('</head>'.&Apache::loncommon::bodytag
- ("Syllabus",$forcestudent,$addentries,'',$cdom,$ENV{'form.register'}));
- $r->print('<h1>'.$courseenv{'description'}.'</h1><h3>'.
- $Apache::lonnet::domaindescription{$cdom}.'</h3>');
+ if ($target ne 'tex') {
+ $r->print('</head>'.&Apache::loncommon::bodytag
+ ("Syllabus",$forcestudent,$addentries,'',$cdom,$ENV{'form.register'}));
+ $r->print('<h1>'.$courseenv{'description'}.'</h1><h3>'.
+ $Apache::lonnet::domaindescription{$cdom}.'</h3>');
+ } else {
+ $r->print('\noindent\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.
+ $Apache::lonnet::domaindescription{$cdom}.'}\\\\');
+ }
# -------------------------------------------------------------- Announcements?
$r->print(&Apache::lonannounce::showday(time,2,
&Apache::lonannounce::readcalendar($cdom.'_'.$cnum)));
# -------------------------------------------------------- Get course personnel
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
- $r->print('<table border="2">');
+ if ($target ne 'tex') {
+ $r->print('<table border="2">');
+ } else {
+ $r->print('\begin{tabular}{|c|c|}\hline');
+ }
foreach (sort keys %coursepersonnel) {
- $r->print('<tr><td>'.$_.'</td><td>');
+ if ($target ne 'tex') {
+ $r->print('<tr><td>'.$_.'</td><td>');
+ } else {
+ $r->print(' '.$_.'\\\\ ');
+ }
foreach (split(/\,/,$coursepersonnel{$_})) {
my ($puname,$pudom)=split(/\:/,$_);
- $r->print(' '.&Apache::loncommon::aboutmewrapper(
- &Apache::loncommon::plainname($puname,
- $pudom),$puname,$pudom));
+ if ($target ne 'tex') {
+ $r->print(' '.&Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($puname,
+ $pudom),$puname,$pudom));
+ } else {
+ $r->print(' '.&Apache::loncommon::plainname($puname,
+ $pudom).' ');
+ }
}
- $r->print('</td></tr>');
+ if ($target ne 'tex') {
+ $r->print('</td></tr>');
+ } else {
+ $r->print('\\\\ \hline');
+ }
+ }
+ if ($target ne 'tex') {
+ $r->print('</table>');
+ } else {
+ $r->print('\end{tabular}\\\\');
}
- $r->print('</table>');
# ---------------------------------------------------------- Load syllabus info
my %syllabus=&Apache::lonnet::dump('syllabus',$cdom,$cnum);
my $allowed=0;
@@ -141,8 +173,10 @@
&Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').
'</p>');
} elsif ($privileged) {
- $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.
-&mt('Edit').'</font></a>');
+ if ($target ne 'tex') {
+ $r->print('<p><a href="'.$r->uri.'?forceedit=1"><font size="+1">'.
+ &mt('Edit').'</font></a>');
+ }
}
if (($allowed) && ($ENV{'form.storesyl'})) {
foreach (keys %syllabusfields) {
@@ -192,9 +226,15 @@
&Apache::loncommon::plainname($syllabus{'uploaded.name'},
$syllabus{'uploaded.domain'}),$syllabus{'uploaded.name'},
$syllabus{'uploaded.domain'});
- $r->print('<table><tr><td>'.&mt('Last updated').':</td><td>'.
- $lastmod.'</td><td>'.&mt('by').' '.$who.
- '</td></tr></table><p>');
+ if ($target ne 'tex') {
+ $r->print('<table><tr><td>'.&mt('Last updated').':</td><td>'.
+ $lastmod.'</td><td>'.&mt('by').' '.$who.
+ '</td></tr></table><p>');
+ } else {
+ $r->print('\\\\ '.&mt('Last updated').': '.$lastmod.' '.&mt('by').'\\\\ '.
+ &Apache::loncommon::plainname($syllabus{'uploaded.name'},
+ $syllabus{'uploaded.domain'}).'\\\\');
+ }
if ($allowed) {
$r->print('<form method="post">'.
'<input type="hidden" name="forceedit" value="edit" />');
@@ -232,8 +272,13 @@
$message
=~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
$message=&Apache::lontexconvert::msgtexconverted($message);
- $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
- $message.'</blockquote>');
+ if ($target ne 'tex') {
+ $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
+ $message.'</blockquote>');
+ } else {
+ $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.
+ &Apache::lonxml::xmlparse($r,' ',$message).'\\\\');
+ }
}
if ($allowed) {
$r->print('<br /><textarea cols="80" rows="6" name="'.$_.'">'.
@@ -245,11 +290,11 @@
if ($allowed) {
$r->print('</form>');
}
- $r->print('</p>');
+ if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}
} else {
$r->print('<p>No syllabus information provided.</p>');
}
- $r->print('</body></html>');
+ if ($target ne 'tex') {$r->print('</body></html>');} else {$r->print('\end{document}');}
return OK;
}