--- loncom/interface/lonsyllabus.pm 2008/12/17 00:44:53 1.74 +++ loncom/interface/lonsyllabus.pm 2012/12/03 23:53:03 1.114 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.74 2008/12/17 00:44:53 ehlerst Exp $ +# $Id: lonsyllabus.pm,v 1.114 2012/12/03 23:53:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,14 +52,20 @@ sub handler { my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri); # ------------------------------------------------------------ Get query string &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit','wrapperdisplay']); + ($ENV{'QUERY_STRING'},['register','forceedit']); # ----------------------------------------------------- Is this even a course? my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom); if ($homeserver eq 'no_host') { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - &Apache::loncommon::simple_error_page($r,'No syllabus available', - 'No syllabus available'); + &Apache::loncommon::simple_error_page($r,'No syllabus available', + 'No syllabus available'); + return OK; + } elsif (!&Apache::lonnet::is_course($cdom,$cnum)) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + &Apache::loncommon::simple_error_page($r,'No syllabus available', + 'The course/community for which the syllabus was requested does not exist.'); return OK; } # ------------------------------------- There is such a course, get environment @@ -68,21 +74,15 @@ sub handler { # ------------------------------------------------------------ Print the screen if ($target eq 'tex') { - $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); - } + $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); + } # -------------------------------------------------- Let's see who handles this my $externalsyllabus=$courseenv{'externalsyllabus'}; if ($externalsyllabus=~/\w/) { - - if ($env{'form.wrapperdisplay'} eq 'menu') { - $r->print(&Apache::lonwrapper::simple_menu()); - } else { - $r->print(&Apache::lonwrapper::wrapper("/public/$cdom/$cnum/syllabus?wrapperdisplay=menu", - $externalsyllabus)); - } - return OK; - } + $r->print( Apache::lonwrapper::wrapper($externalsyllabus) ); + return OK; + } # ------------------------------ The buck stops here: internal syllabus display # --------------------------------------------------------- The syllabus fields @@ -103,14 +103,14 @@ sub handler { 'kkk_textbook' => 'Textbook', 'lll_includeurl' => 'URLs To Include in Syllabus'); # --------------------------------------------------------------- Force Student - my $forcestudent=''; - if ($env{'form.forcestudent'}) { $forcestudent='student'; }; - my $forceedit=''; - if ($env{'form.forceedit'}) { $forceedit='edit'; } - -# ----------------------------------------------------------------- Make header + my ($forceedit,$forcestudent); + if ($env{'form.forceedit'}) { $forceedit=1; } + if (!$forceedit) { + $forcestudent=1; + } +# ----------------------------------------------------------------- Make header if ($target ne 'tex') { - my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom); + my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom); my $js; if ($env{'form.backto'} eq 'coursecatalog') { $js .= <<"ENDSCRIPT"; @@ -118,11 +118,11 @@ sub handler {