version 1.129, 2013/08/26 23:38:07
|
version 1.130, 2013/08/27 03:00:38
|
Line 73 sub handler {
|
Line 73 sub handler {
|
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum); |
my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum); |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
|
|
# ------------------------------------------------------------ Print the screen |
|
|
|
if ($target eq 'tex') { |
|
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); |
|
} |
|
|
|
# --------------------------------------------------------------- Force Student |
# --------------------------------------------------------------- Force Student |
my ($forceedit,$forcestudent); |
my ($forceedit,$forcestudent); |
if ($env{'form.forceedit'}) { $forceedit=1; } |
if ($env{'form.forceedit'}) { $forceedit=1; } |
Line 124 sub handler {
|
Line 118 sub handler {
|
if ($filecontents eq -1) { |
if ($filecontents eq -1) { |
$r->print(&mt('Syllabus file unavailable')); |
$r->print(&mt('Syllabus file unavailable')); |
} elsif ($filetype eq 'tex') { |
} elsif ($filetype eq 'tex') { |
my $result = &Apache::lontexconvert::converted(\$filecontents, |
if ($target eq 'tex') { |
$env{'form.texengine'}); |
$r->print($filecontents); |
my %args; |
} else { |
&get_breadcrumbs($cdom,$cnum,$crstype,\%args); |
my $result = &Apache::lontexconvert::converted(\$filecontents, |
$r->print(&Apache::loncommon::start_page("Syllabus",undef,\%args). |
$env{'form.texengine'}); |
$result. |
my %args; |
&Apache::loncommon::end_page()); |
&get_breadcrumbs($cdom,$cnum,$crstype,\%args); |
|
$r->print(&Apache::loncommon::start_page("Syllabus",undef,\%args). |
|
$result. |
|
&Apache::loncommon::end_page()); |
|
} |
} else { |
} else { |
my %mystyle; |
my %mystyle; |
|
unless ($target eq 'tex') { |
|
$target = 'web'; |
|
} |
&Apache::structuretags::reset_problem_globals(); |
&Apache::structuretags::reset_problem_globals(); |
my $oldfile = $env{'request.filename'}; |
my $oldfile = $env{'request.filename'}; |
$env{'request.filename'} = $item; |
$env{'request.filename'} = $item; |
my $result = &Apache::lonxml::xmlparse($r,'web',$filecontents, |
my $result = &Apache::lonxml::xmlparse($r,$target,$filecontents, |
'',%mystyle); |
'',%mystyle); |
&Apache::structuretags::reset_problem_globals(); |
&Apache::structuretags::reset_problem_globals(); |
&Apache::lonhomework::finished_parsing(); |
&Apache::lonhomework::finished_parsing(); |
Line 145 sub handler {
|
Line 146 sub handler {
|
$r->print($result); |
$r->print($result); |
} |
} |
} else { |
} else { |
$r->print(&Apache::lonwrapper::wrapper($item)); |
if ($target eq 'tex') { |
|
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}). |
|
' \strut \\\\ \textbf{'.&mt('Syllabus').'} \strut \\\\ '. |
|
&mt('Unsupported file type.').' \strut \\\\ '. |
|
&mt('Print the syllabus directly from your web browser'). |
|
'\end{document}'); |
|
} else { |
|
$r->print(&Apache::lonwrapper::wrapper($item)); |
|
} |
} |
} |
return OK; |
return OK; |
} |
} |
} elsif ($external=~/\w/) { |
} elsif ($external=~/\w/) { |
unless ($allowed && $forceedit) { |
unless ($allowed && $forceedit) { |
$r->print(&Apache::lonwrapper::wrapper($external)); |
if ($target eq 'tex') { |
|
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}). |
|
' \strut \\\\ \textbf{'.&mt('Syllabus').'} \strut \\\\ '.$external.' '. |
|
' \strut \\\\ '.&mt('Print the syllabus directly from your web browser'). |
|
'\end{document}'); |
|
} else { |
|
$r->print(&Apache::lonwrapper::wrapper($external)); |
|
} |
return OK; |
return OK; |
} |
} |
} |
} |
|
|
|
# ------------------------------------------------------------ Print the screen |
|
|
|
if ($target eq 'tex') { |
|
$r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); |
|
} |
|
|
# ------------------------------ The buck stops here: internal syllabus display |
# ------------------------------ The buck stops here: internal syllabus display |
# --------------------------------------------------------- The syllabus fields |
# --------------------------------------------------------- The syllabus fields |
Line 1363 sub update_syllabus_env {
|
Line 1384 sub update_syllabus_env {
|
$storehash{'updatedsyllabus'} = $now; |
$storehash{'updatedsyllabus'} = $now; |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.updatedsyllabus' => $now |
&Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.updatedsyllabus' => $now |
}); |
}); |
|
|
} elsif ($saved eq 'url') { |
} elsif ($saved eq 'url') { |
my $prefix = &home_http_host($cdom,$cnum); |
my $prefix = &home_http_host($cdom,$cnum); |
if ($external =~ m{^\Q$prefix/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) { |
if ($external =~ m{^\Q$prefix/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) { |
Line 1395 sub update_syllabus_env {
|
Line 1415 sub update_syllabus_env {
|
if (@envkeys > 0) { |
if (@envkeys > 0) { |
foreach my $item (@envkeys) { |
foreach my $item (@envkeys) { |
my $key = $item.'syllabus'; |
my $key = $item.'syllabus'; |
if ($courseenv->{$key}) { |
if ($courseenv->{$key} ne '') { |
&Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.'.$key); |
&Apache::lonnet::delenv('course.'.$env{'request.course.id'}.'.'.$key); |
$storehash{$key} = ''; |
$storehash{$key} = ''; |
} |
} |