Annotation of loncom/interface/lonsyllabus.pm, revision 1.109

1.1       www         1: # The LearningOnline Network
                      2: # Syllabus
                      3: #
1.109   ! bisitz      4: # $Id: lonsyllabus.pm,v 1.108 2010/03/10 14:20:53 wenzelju Exp $
1.1       www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
                     28: 
                     29: package Apache::lonsyllabus;
                     30: 
                     31: use strict;
1.70      amueller   32: use Apache::lontemplate;
1.1       www        33: use Apache::Constants qw(:common);
                     34: use Apache::loncommon;
                     35: use Apache::lonnet;
1.5       www        36: use Apache::lontexconvert;
1.11      www        37: use Apache::lonfeedback;
1.19      www        38: use Apache::lonannounce;
1.23      www        39: use Apache::lonlocal;
1.32      www        40: use Apache::lonhtmlcommon;
1.38      www        41: use Apache::lonspeller();
1.54      albertel   42: use HTML::Entities();
1.1       www        43: 
                     44: sub handler {
                     45:     my $r = shift;
1.46      www        46:     &Apache::loncommon::content_type($r,'text/html');
                     47:     $r->send_http_header;
                     48:     return OK if $r->header_only;
1.45      www        49: 
1.46      www        50:     my $target=$env{'form.grade_target'};
1.45      www        51: # --------------------------------------------------- Get course info from URL
                     52:     my (undef,undef,$cdom,$cnum)=split(/\//,$r->uri);
1.46      www        53: # ------------------------------------------------------------ Get query string
                     54:     &Apache::loncommon::get_unprocessed_cgi
1.107     droeschl   55:                         ($ENV{'QUERY_STRING'},['forcestudent','register','forceedit']);
1.45      www        56: # ----------------------------------------------------- Is this even a course?
                     57:     my $homeserver=&Apache::lonnet::homeserver($cnum,$cdom);
                     58:     if ($homeserver eq 'no_host') {
                     59:         &Apache::loncommon::content_type($r,'text/html');
                     60:         $r->send_http_header;
1.106     faziophi   61:         &Apache::loncommon::simple_error_page($r,'No syllabus available',
1.91      amueller   62:                           'No syllabus available');
1.45      www        63:         return OK;
                     64:     }
                     65: # ------------------------------------- There is such a course, get environment
                     66:     my %courseenv=&Apache::lonnet::dump('environment',$cdom,$cnum);
1.46      www        67: 
1.1       www        68: # ------------------------------------------------------------ Print the screen
1.49      albertel   69: 
                     70:     if ($target eq 'tex') {
1.91      amueller   71:         $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
1.86      bisitz     72:     }
1.46      www        73: # -------------------------------------------------- Let's see who handles this
1.47      www        74:     my $externalsyllabus=$courseenv{'externalsyllabus'};
1.49      albertel   75: 
1.46      www        76:     if ($externalsyllabus=~/\w/) {
1.107     droeschl   77:         $r->print( Apache::lonwrapper::wrapper($externalsyllabus) );
                     78:         return OK;
1.90      amueller   79:     }
1.42      www        80: 
1.46      www        81: # ------------------------------ The buck stops here: internal syllabus display
1.5       www        82: # --------------------------------------------------------- The syllabus fields
1.23      www        83:     my %syllabusfields=&Apache::lonlocal::texthash(
1.5       www        84:        'aaa_instructorinfo' => 'Instructor Information',
                     85:        'bbb_description'    => 'Course Description',
                     86:        'ccc_prereq'         => 'Prerequisites',
1.7       www        87:        'cdc_classhours'     => 'Class Hours',
1.5       www        88:        'ddd_officehours'    => 'Office Hours',
                     89:        'eee_helproom'       => 'Helproom Hours',
1.7       www        90:        'efe_projectinfo'    => 'Project Information',
1.5       www        91:        'fff_examinfo'       => 'Exam Information',
1.7       www        92:        'fgf_deadlines'      => 'Deadlines',
1.5       www        93:        'ggg_grading'        => 'Grading Information',
1.7       www        94:        'hhh_readings'       => 'Readings',
                     95:        'iii_coursepack'     => 'Coursepack',
                     96:        'jjj_weblinks'       => 'Web Links',
1.9       www        97:        'kkk_textbook'       => 'Textbook',
                     98:        'lll_includeurl'     => 'URLs To Include in Syllabus');
1.6       www        99: # --------------------------------------------------------------- Force Student
                    100:     my $forcestudent='';
1.40      albertel  101:     if ($env{'form.forcestudent'}) { $forcestudent='student'; };
1.27      www       102:     my $forceedit='';
1.40      albertel  103:     if ($env{'form.forceedit'}) { $forceedit='edit'; }
1.86      bisitz    104: 
                    105: # ----------------------------------------------------------------- Make header
1.28      sakharuk  106:     if ($target ne 'tex') {
1.91      amueller  107:         my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
1.65      raeburn   108:         my $js;
                    109:         if ($env{'form.backto'} eq 'coursecatalog') {
                    110:             $js .= <<"ENDSCRIPT";
                    111: 
                    112: <script type="text/javascript">
                    113: function ToCatalog(caller) {
                    114:     numidx = getIndexByName('coursenum');
1.90      amueller  115:         if (numidx > -1) {
                    116:             if (caller != 'details') {
                    117:                 document.backtocat.elements[numidx].value = '';
                    118:             }
1.65      raeburn   119:         }
                    120:     document.backtocat.submit();
                    121: }
                    122: 
                    123: function getIndexByName(item) {
                    124:     for (var i=0;i<document.backtocat.elements.length;i++) {
                    125:         if (document.backtocat.elements[i].name == item) {
                    126:             return i;
                    127:         }
                    128:     }
                    129:     return -1;
                    130: }
                    131: 
                    132: </script>
                    133: 
                    134: ENDSCRIPT
                    135:         }
1.91      amueller  136:         my $start_page =
                    137:          &Apache::loncommon::start_page("Syllabus", $rss_link.$js,
1.97      amueller  138:                        {'function'       => undef,
1.91      amueller  139:                         'domain'         => $cdom,
                    140:                         'force_register' =>
                    141:                         $env{'form.register'},});
1.49      albertel  142: 
1.91      amueller  143:         $r->print($start_page);
1.65      raeburn   144:         if ($env{'form.backto'} eq 'coursecatalog') {
                    145:             &Apache::lonhtmlcommon::clear_breadcrumbs();
                    146:             &Apache::lonhtmlcommon::add_breadcrumb
1.90      amueller  147:                 ({href=>"javascript:ToCatalog()",
1.100     bisitz    148:                 text=>"Course/Community Catalog"});
1.65      raeburn   149:             if ($env{'form.coursenum'} ne '') {
                    150:                 &Apache::lonhtmlcommon::add_breadcrumb
1.90      amueller  151:                     ({href=>"javascript:ToCatalog('details')",
                    152:                     text=>"Course details"});
1.65      raeburn   153:             }
                    154:             &Apache::lonhtmlcommon::add_breadcrumb
1.90      amueller  155:                 ({href=>$r->uri,
                    156:                 text=>"Course syllabus"});
1.65      raeburn   157:             $r->print(&Apache::lonhtmlcommon::breadcrumbs());
1.86      bisitz    158:         }
1.17      www       159:     }
                    160: # ---------------------------------------------------------- Load syllabus info
1.4       www       161:     my %syllabus=&Apache::lonnet::dump('syllabus',$cdom,$cnum);
1.5       www       162:     my $allowed=0;
1.27      www       163:     my $privileged=0;
1.4       www       164: 
1.2       www       165: # This handler might be called anonymously ...
                    166: # ----------------------------------------------------- Only if not public call
1.40      albertel  167:     if ($env{'user.environment'}) {
1.1       www       168: # does this user have privileges to post, etc?
1.90      amueller  169:         if ($env{'request.course.id'}
1.91      amueller  170:         && $cdom eq $env{'course.'.$env{'request.course.id'}.'.domain'}
                    171:         && $cnum eq $env{'course.'.$env{'request.course.id'}.'.num'}) {
1.90      amueller  172:             $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
1.91      amueller  173:             $privileged=$allowed;
                    174:             if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
                    175:                 $forcestudent='student';
                    176:             }
1.90      amueller  177:             if ($forcestudent or $target eq 'tex') { $allowed=0; }
                    178:         }
1.98      amueller  179: 		#store what the user typed in
1.90      amueller  180:         if (($allowed) && ($env{'form.storesyl'})) {
1.91      amueller  181:             foreach my $syl_field (keys(%syllabusfields)) {
1.90      amueller  182:                 my $field=$env{'form.'.$syl_field};
1.91      amueller  183:                 chomp($field);
1.90      amueller  184:                 $field=~s/\s+$//s;
1.91      amueller  185:                 $field=~s/^\s+//s;
                    186:                 $field=~s/\<br\s*\/*\>$//s;
                    187:                 $field=&Apache::lonfeedback::clear_out_html($field,1);
1.98      amueller  188: 				#here it will be stored
1.91      amueller  189:                 $syllabus{$syl_field}=$field;
1.90      amueller  190:                 if ($syl_field eq 'lll_includeurl') { # clean up included URLs
                    191:                     my $field='';
1.91      amueller  192:                     foreach my $value (split(/\n/,$syllabus{$syl_field})) {
                    193:                         my $url=$value;
1.9       www       194: # get rid of leading and trailing spaces
1.90      amueller  195:                         $url=~s/^\s+//;
                    196:                         $url=~s/\s+$//;
                    197:                         if ($url=~m|^https?\://([^/]+)/(.+)$|) {
1.91      amueller  198:                             my $host = $1;
1.90      amueller  199:                             my $remainder=$2;
1.9       www       200: # remove the hostname from internal URLs
1.91      amueller  201:                             my $hostname = &Apache::lonnet::hostname($host);
                    202:                             my %all_hostnames = &Apache::lonnet::all_hostnames();
                    203:                             foreach my $possible_host (keys(%all_hostnames)) {
1.90      amueller  204:                                 if ($possible_host =~ /\Q$hostname\E/i) {
1.91      amueller  205:                                     $url=$remainder;
                    206:                                 }
                    207:                             }
                    208:                         }
1.9       www       209: # norm internal URLs
1.90      amueller  210:                         unless ($url=~/^https?\:/) {
1.91      amueller  211:                             $url=&Apache::lonnet::clutter($url);
1.90      amueller  212:                         }
1.9       www       213: # re-assemble field
1.90      amueller  214:                         if ($url) {
1.91      amueller  215:                             $field.=$url."\n";
1.90      amueller  216:                         }
1.91      amueller  217:                     }
1.90      amueller  218:                     $syllabus{$syl_field}=$field;
1.91      amueller  219:                 }
1.90      amueller  220:             }
                    221:             $syllabus{'uploaded.domain'}=$env{'user.domain'};
                    222:             $syllabus{'uploaded.name'}=$env{'user.name'};
                    223:             $syllabus{'uploaded.lastmodified'}=time;
                    224:             &Apache::lonnet::put('syllabus',\%syllabus,$cdom,$cnum);
                    225:         }
1.4       www       226:     }
1.85      bisitz    227: 
1.93      bisitz    228: #--------Functions
1.94      droeschl  229:     if( ($allowed || $privileged) && $target ne 'tex') {
                    230:         my $functions=&Apache::lonhtmlcommon::start_funclist();
                    231:         if ($allowed) {
1.97      amueller  232: 			#if you have the register flag, keep it
                    233: 			if($env{'form.register'} == 1) {
                    234:             	$functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.99      amueller  235:                           '<a href="'.$r->uri.'?forcestudent=1&amp;register=1">'
1.97      amueller  236:                            .&mt('Show Public View').'</a>'
                    237:                            .&Apache::loncommon::help_open_topic(
                    238:                                 'Uploaded_Templates_PublicView'));
                    239: 			} else {
                    240:             	$functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.94      droeschl  241:                           '<a href="'.$r->uri.'?forcestudent=1">'
                    242:                            .&mt('Show Public View').'</a>'
                    243:                            .&Apache::loncommon::help_open_topic(
                    244:                                 'Uploaded_Templates_PublicView'));
1.97      amueller  245: 			}
1.93      bisitz    246:         } elsif ($privileged) {
1.97      amueller  247: 			if($env{'form.register'} == 1) {
                    248: 	            $functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.99      amueller  249:                            '<a href="'.$r->uri.'?forceedit=1&amp;register=1">'
1.97      amueller  250:                             .&mt('Edit').'</a>');
                    251: 			} else {
                    252: 	            $functions.=&Apache::lonhtmlcommon::add_item_funclist(
1.94      droeschl  253:                            '<a href="'.$r->uri.'?forceedit=1">'
                    254:                             .&mt('Edit').'</a>');
1.97      amueller  255: 			}
1.93      bisitz    256:         }
1.94      droeschl  257: 
1.93      bisitz    258:         $functions.=&Apache::lonhtmlcommon::end_funclist();
                    259:         $r->print(&Apache::loncommon::head_subbox($functions));
                    260:     }
                    261: 
1.94      droeschl  262: #---------------------Print External URL Syllabus Info and Help Text
1.90      amueller  263:     if( ($allowed) && ($target ne 'tex') ) {
1.91      amueller  264:         my $protocol = $Apache::lonnet::protocol{$homeserver};
                    265:           $protocol = 'http' if ($protocol ne 'https');
1.85      bisitz    266:         $r->print('<p class="LC_info">'
                    267:                  .&mt('This syllabus can be publicly viewed at [_1]'
                    268:                      ,'<tt>'.$protocol.'://'.&Apache::lonnet::hostname($homeserver).$r->uri.'</tt>')
                    269:                  .'&nbsp;'.&Apache::loncommon::help_open_topic('Syllabus_ExtLink')
                    270:                  .'</p>'
                    271:                  .'<p class="LC_info">'
1.96      raeburn   272:                  .&mt('Instead of using this template you can specify an external URL as Syllabus in the [_1]Course Configuration[_2].'
1.99      amueller  273:                      ,'<a href="/adm/courseprefs?actions=courseinfo&amp;phase=display">','</a>')
1.85      bisitz    274:                  .'</p>'
                    275:         );
1.94      droeschl  276:         #-Print Help Text
                    277:         $r->print(&Apache::loncommon::help_open_topic( 
                    278:                         'Uploaded_Templates_TextBoxes',
                    279:                         &mt('Help with filling in text boxes')));
1.90      amueller  280:     }
1.85      bisitz    281: 
1.88      amueller  282: #----------Print last update
1.90      amueller  283:     my $lastmod=$syllabus{'uploaded.lastmodified'};
                    284:     $lastmod=($lastmod?&Apache::lonlocal::locallocaltime($lastmod):&mt('never'));
1.109   ! bisitz    285:     my $who;
        !           286:     if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) {
        !           287:         $who = &Apache::loncommon::aboutmewrapper(
        !           288:                    &Apache::loncommon::plainname($syllabus{'uploaded.name'},
        !           289:                    $syllabus{'uploaded.domain'}),$syllabus{'uploaded.name'},
        !           290:                    $syllabus{'uploaded.domain'});
        !           291:     } else {
        !           292:         # Public user?
        !           293:         # Only display name of user, but no link to personal information page
        !           294:         $who = &Apache::loncommon::plainname(
        !           295:                    $syllabus{'uploaded.name'},
        !           296:                    $syllabus{'uploaded.domain'});
        !           297:     }
        !           298: 
1.90      amueller  299:     if ($target ne 'tex') {
1.91      amueller  300:         $r->print('<div class="LC_info">'.&mt('Last updated').': '.
                    301:             $lastmod . ' '.
                    302:             ($who ? &mt('by').' '.$who
1.89      bisitz    303:                            : '' ) .
1.88      amueller  304:              '</div>' );
1.89      bisitz    305: 
1.90      amueller  306:     } else {
1.91      amueller  307:         $r->print('\\\\ '.&mt('Last updated').': '.$lastmod.' '.
                    308:             ($who? &mt('by').'\\\\ '.
                    309:                     &Apache::loncommon::plainname($syllabus{'uploaded.name'},$syllabus{'uploaded.domain'})
                    310:                   :'')
                    311:              .'\\\\');
1.90      amueller  312:     }
1.80      neumanie  313: #----------------------------Print Headtitle
1.90      amueller  314:     if ($target ne 'tex') {
1.91      amueller  315:         $r->print('<h1>'.$courseenv{'description'}.'</h1>');
                    316:         $r->print('<h3>'.  &Apache::lonnet::domain($cdom,'description').'</h3>');
1.90      amueller  317:     } else {
1.91      amueller  318:         $r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.
                    319:         &Apache::lonnet::domain($cdom,'description').'}\\\\');
1.90      amueller  320:     }
1.80      neumanie  321: # -------------------------------------------------------- Get course personnel
                    322:     my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
                    323:     if ($target ne 'tex') {
1.91      amueller  324:         $r->print(&Apache::lonhtmlcommon::start_pick_box());
1.80      neumanie  325:     } else {
1.91      amueller  326:         $r->print('\begin{tabular}{|p{0.45\textwidth}|p{0.45\textwidth}|}\hline');
1.80      neumanie  327:     }
                    328:     my @personnel=sort(keys(%coursepersonnel));
                    329:     my $lastpers=$personnel[$#personnel];
                    330:     foreach my $element (@personnel) {
1.91      amueller  331:         if ($target ne 'tex') {
                    332:             $r->print(&Apache::lonhtmlcommon::row_title($element));
                    333:         } else {
                    334:             $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & ');
                    335:         }
1.80      neumanie  336:         foreach (split(/\,/,$coursepersonnel{$element})) {
1.91      amueller  337:             my ($puname,$pudom)=split(/\:/,$_);
                    338:             if ($target ne 'tex') {
1.80      neumanie  339:                 my $courseperson = &Apache::loncommon::plainname($puname,$pudom);
                    340:                 if (($env{'user.name'} eq '') || ($env{'user.name'} eq 'public') ||
                    341:                     ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {
1.91      amueller  342:                     $r->print(' '.$courseperson);
1.80      neumanie  343:                 } else {
                    344:                     $r->print(' '.&Apache::loncommon::aboutmewrapper($courseperson,
                    345:                               $puname,$pudom));
                    346:                 }
1.91      amueller  347:             } else {
                    348:                 $r->print(' '.&Apache::loncommon::plainname($puname,
1.80      neumanie  349:                               $pudom).' ');
1.91      amueller  350:             }
                    351:         }
                    352:         if ($target ne 'tex') {
1.80      neumanie  353:             my $lastclose=$element eq $lastpers?1:0;
                    354:             $r->print(&Apache::lonhtmlcommon::row_closure($lastclose));
1.91      amueller  355:         } else {
                    356:             $r->print('\\\\ \hline');
                    357:         }
1.80      neumanie  358:     }
                    359:     if ($target ne 'tex') {
1.91      amueller  360:         $r->print(&Apache::lonhtmlcommon::end_pick_box());
1.80      neumanie  361:     } else {
1.91      amueller  362:         $r->print('\end{tabular}\\\\');
1.80      neumanie  363:     }
1.79      neumanie  364: # -------------------------------------------------------------- Announcements?
                    365:     my $day = &Apache::lonannounce::showday(time,2,
1.91      amueller  366:              &Apache::lonannounce::readcalendar($cdom.'_'.$cnum));
1.80      neumanie  367:     if ($target ne 'tex') {
1.91      amueller  368:         if ($allowed) {
1.108     wenzelju  369:             &Apache::lontemplate::print_start_template($r,&mt('RSS Feeds and Blogs'),'LC_Box');
1.91      amueller  370:             $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));
                    371:             my $editurl= &Apache::lonnet::absolute_url().'/adm/'.$cdom.'/'.$cnum.'/_rss.html';
                    372:             $r->print( '<a href="'.$editurl.'">'.&mt('New RSS Feed or Blog').'</a>');
                    373:             &Apache::lontemplate::print_end_template($r);
                    374:         } elsif (&Apache::lonrss::advertisefeeds($cnum,$cdom) ne '') {
1.108     wenzelju  375:             &Apache::lontemplate::print_start_template($r,&mt('RSS Feeds and Blogs'),'LC_Box');
1.91      amueller  376:             $r->print(&Apache::lonrss::advertisefeeds($cnum,$cdom,$forceedit));
                    377:             &Apache::lontemplate::print_end_template($r);
                    378:         }
1.86      bisitz    379: 
1.79      neumanie  380:     } else {
1.91      amueller  381:         $r->print(&Apache::lonxml::xmlparse($r,'tex',$day));
1.86      bisitz    382:     }
1.79      neumanie  383: # ---------------------------------------------------------------- Get syllabus
1.86      bisitz    384:     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
1.90      amueller  385:         if ($allowed) {
1.95      bisitz    386:             $r->print('<form method="post" action="">'.
1.91      amueller  387:             '<input type="hidden" name="forceedit" value="edit" />');
1.90      amueller  388:         }
                    389:         my @htmlids=();
1.106     faziophi  390: 		my $url_include_handler = sub {
                    391: 			my ($r, $field, $message, $group, $data_ref, $fields_ref, $target, $allowed) = @_;
                    392: 			my %data = %{$data_ref};
                    393: 			my %fields = %{$fields_ref};
                    394: 			my $urls=$message;
                    395: 			$message='';
                    396: 			foreach my $filelink (split(/\n/,$urls)) {
                    397: 				my $output='';
                    398: 			   # embed style?
                    399: 				my ($curfext)=($filelink=~/\.([^\.]+)$/);
                    400: 				my $embstyle=&Apache::loncommon::fileembstyle($curfext);
                    401: 				if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {# make ssi call and remove everything but the body contents
                    402: 					$output=&Apache::lonnet::ssi_body($filelink);
                    403: 				} elsif ($embstyle eq 'img') {# embed as an image
                    404: 					$output='<img src="'.$filelink.'" />';
                    405: 				}
                    406: 				if ($output ne '') {
                    407: 					   if ($target ne 'tex') {
                    408: 						   $message.='<p>'.$output.'</p>';
                    409: 					   } else {
                    410: 						   $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';
                    411: 					   }
                    412: 				}
                    413: 			}
                    414: 			if ($allowed) {
                    415: 				 &Apache::lonfeedback::newline_to_br(\$urls);
                    416: 				 &Apache::lontemplate::print_start_template($r,$fields{$field}.
                    417: 						  &Apache::loncommon::help_open_topic('Syllabus_URLs'),'LC_Box');
                    418: 				 $r->print($urls);
                    419: 				 $r->print("<br /><div>");
                    420: 				 &Apache::lontemplate::print_textarea_template($r, $data{$field},
                    421: 					$field, Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);
                    422: 				 &Apache::lontemplate::print_saveall_template($r);                         
                    423: 				 $r->print("</div>");
                    424: 				 &Apache::lontemplate::print_end_template($r);
1.86      bisitz    425: 
1.106     faziophi  426: 			} else {
                    427: 				$r->print($message);
                    428: 			}
                    429: 		};
                    430: 		my %custom_hash = ( 'lll_includeurl' => $url_include_handler );
                    431: 		@htmlids = &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, 
                    432: 			$target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_hash);
1.90      amueller  433:         if ($allowed) {
1.91      amueller  434:             $r->print('</form>'.
                    435:             &Apache::lonhtmlcommon::htmlareaselectactive(@htmlids));
1.90      amueller  436:         }
1.4       www       437:     } else {
1.91      amueller  438:         if ($target ne 'tex') {$r->print('<p>');} else {$r->print('\par ');}
                    439:         $r->print(&mt('No syllabus information provided.'));
                    440:         if ($target ne 'tex') {$r->print('</p>');}
1.1       www       441:     }
1.86      bisitz    442:     if ($target ne 'tex') {
1.65      raeburn   443:         if ($env{'form.backto'} eq 'coursecatalog') {
                    444:             $r->print('<form name="backtocat" method="post" action="/adm/coursecatalog">'.
1.66      raeburn   445:                       &Apache::lonhtmlcommon::echo_form_input(['backto','courseid']).
1.65      raeburn   446:                       '</form>');
                    447:         }
1.91      amueller  448:         $r->print(&Apache::loncommon::end_page());
1.48      albertel  449:     } else {
1.91      amueller  450:         $r->print('\end{document}');
1.48      albertel  451:     }
1.1       www       452:     return OK;
1.86      bisitz    453: }
1.1       www       454: 
                    455: 1;
                    456: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>