--- loncom/interface/lonsyllabus.pm 2008/11/19 11:51:49 1.70 +++ loncom/interface/lonsyllabus.pm 2009/05/11 13:34:10 1.89 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.70 2008/11/19 11:51:49 amueller Exp $ +# $Id: lonsyllabus.pm,v 1.89 2009/05/11 13:34:10 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,20 +69,20 @@ sub handler { if ($target eq 'tex') { $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 { + } 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 @@ -107,8 +107,8 @@ sub handler { 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 $js; @@ -139,7 +139,7 @@ function getIndexByName(item) { ENDSCRIPT } - my $start_page = + my $start_page = &Apache::loncommon::start_page("Syllabus", $rss_link.$js, {'function' => $forcestudent, 'domain' => $cdom, @@ -162,63 +162,7 @@ ENDSCRIPT text=>"Course syllabus"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs()); } - $r->print('
'. -&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'
'.&mt('This syllabus can be publicly viewed at') - .' http://'. - &Apache::lonnet::hostname($homeserver).$r->uri.''. - &Apache::loncommon::help_open_topic('Syllabus_ExtLink').'
'. - ''.&mt('You can specify an external URL as Syllabus in the [_1].',''.&mt('Course Parameters').'').'
'. - ''. -&mt('Show Public View').''. - &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView'). - '
'); - } elsif ($privileged) { - if ($target ne 'tex') { - $r->print(''. - &mt('Edit').''); - } - } if (($allowed) && ($env{'form.storesyl'})) { foreach my $syl_field (keys(%syllabusfields)) { my $field=$env{'form.'.$syl_field}; @@ -272,7 +199,7 @@ ENDSCRIPT # get rid of leading and trailing spaces $url=~s/^\s+//; $url=~s/\s+$//; - if ($url=~m|^http://([^/]+)/(.+)$|) { + if ($url=~m|^https?\://([^/]+)/(.+)$|) { my $host = $1; my $remainder=$2; # remove the hostname from internal URLs @@ -285,7 +212,7 @@ ENDSCRIPT } } # norm internal URLs - unless ($url=~/^http\:/) { + unless ($url=~/^https?\:/) { $url=&Apache::lonnet::clutter($url); } # re-assemble field @@ -302,20 +229,43 @@ ENDSCRIPT &Apache::lonnet::put('syllabus',\%syllabus,$cdom,$cnum); } } -# ---------------------------------------------------------------- Get syllabus - if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { - my $lastmod=$syllabus{'uploaded.lastmodified'}; + +#---------------------Print External URL Syllabus Info +if( ($allowed) && ($target ne 'tex') ) { + my $protocol = $Apache::lonnet::protocol{$homeserver}; + $protocol = 'http' if ($protocol ne 'https'); + $r->print('
' + .&mt('This syllabus can be publicly viewed at [_1]' + ,''.$protocol.'://'.&Apache::lonnet::hostname($homeserver).$r->uri.'') + .' '.&Apache::loncommon::help_open_topic('Syllabus_ExtLink') + .'
' + .'' + .&mt('Instead of using this template you can specify an external URL as Syllabus in the [_1]Course Parameters[_2].' + ,'','') + .'
' + ); +} + +#-Print Help Text +if ($target ne 'tex') { + if ($allowed) { + $r->print(&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes'))); + } +} +#----------Print last update + my $lastmod=$syllabus{'uploaded.lastmodified'}; $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never')); my $who = &Apache::loncommon::aboutmewrapper( &Apache::loncommon::plainname($syllabus{'uploaded.name'}, $syllabus{'uploaded.domain'}),$syllabus{'uploaded.name'}, $syllabus{'uploaded.domain'}); - if ($target ne 'tex') { - $r->print(''.&mt('Last updated').': | '. - $lastmod.' | '.
+ if ($target ne 'tex') {
+ $r->print(' '.&mt('Last updated').': '.
+ $lastmod . ' '.
($who ? &mt('by').' '.$who
- : '' ).
- ' |
'); + : '' ) . + '' ); + } else { $r->print('\\\\ '.&mt('Last updated').': '.$lastmod.' '. ($who? &mt('by').'\\\\ '. @@ -323,12 +273,100 @@ ENDSCRIPT :'') .'\\\\'); } +#--------Functions +if ($target ne 'tex') { + if( $allowed || $privileged) { + $r->print(&Apache::lontemplate::start_functionslist()); + if ($allowed) { + $r->print(&Apache::lontemplate::item_functionslist( + ''.&mt('Show Public View').'' + .&Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView'))); + } elsif ($privileged) { + $r->print(&Apache::lontemplate::item_functionslist( + ''.&mt('Edit').'')); + } + $r->print(&Apache::lontemplate::end_functionslist()); + } + } +#----------------------------Print Headtitle +if ($target ne 'tex') { + $r->print('
');} else {$r->print('\par ');} + if ($target ne 'tex') {$r->print('
');} else {$r->print('\par ');} $r->print(&mt('No syllabus information provided.')); if ($target ne 'tex') {$r->print('
');} } @@ -406,7 +445,7 @@ ENDSCRIPT $r->print('\end{document}'); } return OK; -} +} 1; __END__