--- loncom/interface/lonsyllabus.pm 2008/11/07 18:06:19 1.69 +++ loncom/interface/lonsyllabus.pm 2010/02/15 16:05:32 1.106.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.69 2008/11/07 18:06:19 bisitz Exp $ +# $Id: lonsyllabus.pm,v 1.106.2.2 2010/02/15 16:05:32 faziophi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,6 +29,7 @@ package Apache::lonsyllabus; use strict; +use Apache::lontemplate; use Apache::Constants qw(:common); use Apache::loncommon; use Apache::lonnet; @@ -39,6 +40,16 @@ use Apache::lonlocal; use Apache::lonhtmlcommon; use Apache::lonspeller(); use HTML::Entities(); +use Digest::MD5 qw(md5_hex); +use Storable qw(freeze thaw); + +# These are strings representing types of fields +# that will used to parse/display a field correctly +use constant { + TYPE_TEXT_HTML => 'html', #<-- default + TYPE_TEXT_PLAIN => 'text', + TYPE_URL_INCLUDE => 'include-url', +}; sub handler { my $r = shift; @@ -51,40 +62,37 @@ 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'},['delete', 'rename', 'field', 'forcestudent','register','forceedit','forceflush','wrapperdisplay']); # ----------------------------------------------------- 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; } # ------------------------------------- There is such a course, get environment my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum); # ------------------------------------------------------------ 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)); + $r->print(&Apache::lonwrapper::simple_menu()); + } else { + $r->print(&Apache::lonwrapper::wrapper("/public/$cdom/$cnum/syllabus?wrapperdisplay=menu", + $externalsyllabus)); } return OK; - } + } -# ------------------------------ The buck stops here: internal syllabus display -# --------------------------------------------------------- The syllabus fields +# --------------------------------------------------------- The old syllabus fields my %syllabusfields=&Apache::lonlocal::texthash( 'aaa_instructorinfo' => 'Instructor Information', 'bbb_description' => 'Course Description', @@ -101,15 +109,16 @@ sub handler { 'jjj_weblinks' => 'Web Links', '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 + +# ----------------------------------------------------------------- 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"; @@ -117,11 +126,11 @@ sub handler {