version 1.23, 2005/02/17 08:29:43
|
version 1.27, 2005/10/30 02:39:09
|
Line 40 use Apache::lonxml;
|
Line 40 use Apache::lonxml;
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
my $target=$ENV{'form.grade_target'}; |
my $target=$env{'form.grade_target'}; |
# ------------------------------------------------------------ Print the screen |
# ------------------------------------------------------------ Print the screen |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
Line 53 $html
|
Line 53 $html
|
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
ENDDOCUMENT |
ENDDOCUMENT |
} else { |
} else { |
$r->print(&Apache::lonprintout::print_latex_header($ENV{'form.latex_type'})); |
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); |
} |
} |
my (undef,undef,undef,undef,$marker)=split(/\//,$r->uri); |
my (undef,undef,undef,undef,$marker)=split(/\//,$r->uri); |
# Is this even in a course? |
# Is this even in a course? |
unless ($ENV{'request.course.id'}) { |
unless ($env{'request.course.id'}) { |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$r->print('</head><body>Not in a course</body></html>'); |
$r->print('</head><body>Not in a course</body></html>'); |
return OK; |
return OK; |
Line 73 ENDDOCUMENT
|
Line 73 ENDDOCUMENT
|
return OK; |
return OK; |
} |
} |
|
|
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
# --------------------------------------------------------- The syllabus fields |
# --------------------------------------------------------- The syllabus fields |
my %syllabusfields=&Apache::lonlocal::texthash( |
my %syllabusfields=&Apache::lonlocal::texthash( |
Line 88 ENDDOCUMENT
|
Line 88 ENDDOCUMENT
|
($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']); |
($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']); |
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my $addentries=''; |
my $addentries=''; |
if ($ENV{'form.register'}) { |
if ($env{'form.register'}) { |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
$r->print(&Apache::lonmenu::registerurl(1)); |
$r->print(&Apache::lonmenu::registerurl(1)); |
} |
} |
# --------------------------------------------------------------- Force Student |
# --------------------------------------------------------------- Force Student |
my $forcestudent=''; |
my $forcestudent=''; |
if ($ENV{'form.forcestudent'} || $target eq 'tex' ) { $forcestudent='student'; }; |
if ($env{'form.forcestudent'} || $target eq 'tex' ) { $forcestudent='student'; }; |
my $forceedit=''; |
my $forceedit=''; |
if ($ENV{'form.forceedit'}) { $forceedit='edit'; } |
if ($env{'form.forceedit'}) { $forceedit='edit'; } |
|
|
|
|
my %syllabus=&Apache::lonnet::dump('smppage_'.$marker,$dom,$crs); |
my %syllabus=&Apache::lonnet::dump('smppage_'.$marker,$dom,$crs); |
Line 107 ENDDOCUMENT
|
Line 107 ENDDOCUMENT
|
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$r->print(&Apache::lonhtmlcommon::htmlareaheaders(). |
$r->print(&Apache::lonhtmlcommon::htmlareaheaders(). |
'</head>'.&Apache::loncommon::bodytag |
'</head>'.&Apache::loncommon::bodytag |
("Course Page",$forcestudent,$addentries,'',$dom,$ENV{'form.register'})); |
("Course Page",$forcestudent,$addentries,'',$dom,$env{'form.register'})); |
} |
} |
|
|
my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'}); |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
my $privileged=$allowed; |
my $privileged=$allowed; |
if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { |
if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { |
$forcestudent='student'; |
$forcestudent='student'; |
Line 125 ENDDOCUMENT
|
Line 125 ENDDOCUMENT
|
} elsif ($privileged and $target ne 'tex') { |
} elsif ($privileged and $target ne 'tex') { |
$r->print('<a href="'.$r->uri.'?forceedit=edit"><font size="+1">'.&mt('Edit').'</font></a>'); |
$r->print('<a href="'.$r->uri.'?forceedit=edit"><font size="+1">'.&mt('Edit').'</font></a>'); |
} |
} |
if (($ENV{'form.uploaddoc.filename'} and $target ne 'tex') && |
if (($env{'form.uploaddoc.filename'} and $target ne 'tex') && |
($ENV{'form.storeupl'}) && ($allowed)) { |
($env{'form.storeupl'}) && ($allowed)) { |
if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) { |
if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) { |
if ($syllabus{'uploaded.photourl'}) { |
if ($syllabus{'uploaded.photourl'}) { |
&Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'}); |
&Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'}); |
} |
} |
Line 137 ENDDOCUMENT
|
Line 137 ENDDOCUMENT
|
$syllabus{'uploaded.lastmodified'}=time; |
$syllabus{'uploaded.lastmodified'}=time; |
&Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs); |
&Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs); |
} |
} |
if (($allowed) && ($ENV{'form.storesyl'})) { |
if (($allowed) && ($env{'form.storesyl'})) { |
foreach (keys %syllabusfields) { |
foreach (keys %syllabusfields) { |
my $field=$ENV{'form.'.$_}; |
my $field=$env{'form.'.$_}; |
chomp($field); |
chomp($field); |
$field=~s/\s+$//s; |
$field=~s/\s+$//s; |
$field=~s/^\s+//s; |
$field=~s/^\s+//s; |
Line 176 ENDDOCUMENT
|
Line 176 ENDDOCUMENT
|
foreach (sort keys %syllabusfields) { |
foreach (sort keys %syllabusfields) { |
if (($syllabus{$_}) || ($allowed)) { |
if (($syllabus{$_}) || ($allowed)) { |
my $message=$syllabus{$_}; |
my $message=$syllabus{$_}; |
$message=~s/\n/\<br \/\>/g; |
&Apache::lonfeedback::newline_to_br(\$message); |
$message |
$message |
=~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g; |
=~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g; |
$message=&Apache::lontexconvert::msgtexconverted($message); |
|
if ($allowed) { |
if ($allowed) { |
$message=&Apache::lonspeller::markeduptext($message); |
$message=&Apache::lonspeller::markeduptext($message); |
} |
} |
|
$message=&Apache::lontexconvert::msgtexconverted($message); |
unless ($_ eq 'aaa_title') { |
unless ($_ eq 'aaa_title') { |
if (($_ ne 'bbb_content') || ($allowed)) { |
if (($_ ne 'bbb_content') || ($allowed)) { |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
Line 217 ENDDOCUMENT
|
Line 217 ENDDOCUMENT
|
$r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$message.'</h1>')); |
$r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$message.'</h1>')); |
} |
} |
if ($allowed) { |
if ($allowed) { |
if ($ENV{'form.grade_target'} ne 'tex') { |
if ($env{'form.grade_target'} ne 'tex') { |
$r->print( |
$r->print( |
'<br />Title<br /><textarea cols="80" rows="2" name="'.$_.'">'. |
'<br />Title<br /><textarea cols="80" rows="2" name="'.$_.'">'. |
$syllabus{$_}. |
$syllabus{$_}. |
Line 230 ENDDOCUMENT
|
Line 230 ENDDOCUMENT
|
} |
} |
} |
} |
} |
} |
if ($allowed && ($ENV{'form.grade_target'} ne 'tex')) { |
if ($allowed && ($env{'form.grade_target'} ne 'tex')) { |
$r->print(&Apache::lonhtmlcommon::htmlareaselectactive |
$r->print(&Apache::lonhtmlcommon::htmlareaselectactive |
('bbb_content').'</form>'); |
('bbb_content').'</form>'); |
} |
} |
if ($ENV{'form.grade_target'} ne 'tex') {$r->print('</p>');} |
if ($env{'form.grade_target'} ne 'tex') {$r->print('</p>');} |
} else { |
} else { |
$r->print('<p>No page information provided.</p>'); |
$r->print('<p>No page information provided.</p>'); |
} |
} |
if ($ENV{'form.grade_target'} ne 'tex') { |
if ($env{'form.grade_target'} ne 'tex') { |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
} else { |
} else { |
$r->print('\end{document}'); |
$r->print('\end{document}'); |