Diff for /loncom/interface/lonsyllabus.pm between versions 1.58 and 1.68

version 1.58, 2007/03/08 01:58:45 version 1.68, 2008/10/22 08:56:35
Line 66  sub handler { Line 66  sub handler {
   
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
   
     my $rss_link =  
  &Apache::lonrss::rss_link('http://'.$ENV{'HTTP_HOST'}.'/public/'.$cdom.'/'.$cnum.'/Course_Announcements.rss');  
   
     if ($target eq 'tex') {      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'}));
     }       } 
Line 112  sub handler { Line 109  sub handler {
                 
 # ----------------------------------------------------------------- Make header   # ----------------------------------------------------------------- Make header 
     if ($target ne 'tex') {      if ($target ne 'tex') {
    my $rss_link = &Apache::lonrss::rss_link($cnum,$cdom);
           my $js;
           if ($env{'form.backto'} eq 'coursecatalog') {
               $js .= <<"ENDSCRIPT";
   
   <script type="text/javascript">
   function ToCatalog(caller) {
       numidx = getIndexByName('coursenum');
       if (numidx > -1) {
           if (caller != 'details') {
               document.backtocat.elements[numidx].value = '';
           }
       }
       document.backtocat.submit();
   }
   
   function getIndexByName(item) {
       for (var i=0;i<document.backtocat.elements.length;i++) {
           if (document.backtocat.elements[i].name == item) {
               return i;
           }
       }
       return -1;
   }
   
   </script>
   
   ENDSCRIPT
           }
  my $start_page =    my $start_page = 
     &Apache::loncommon::start_page("Syllabus", $rss_link,      &Apache::loncommon::start_page("Syllabus", $rss_link.$js,
    {'function'       => $forcestudent,     {'function'       => $forcestudent,
     'domain'         => $cdom,      'domain'         => $cdom,
     'force_register' =>      'force_register' =>
  $env{'form.register'},});   $env{'form.register'},});
   
  $r->print($start_page.'<h1>'.$courseenv{'description'}.'</h1><h3>'.   $r->print($start_page);
           if ($env{'form.backto'} eq 'coursecatalog') {
               &Apache::lonhtmlcommon::clear_breadcrumbs();
               &Apache::lonhtmlcommon::add_breadcrumb
                ({href=>"javascript:ToCatalog()",
                  text=>"Course Catalog"});
               if ($env{'form.coursenum'} ne '') {
                   &Apache::lonhtmlcommon::add_breadcrumb
                     ({href=>"javascript:ToCatalog('details')",
                      text=>"Course details"});
               }
               &Apache::lonhtmlcommon::add_breadcrumb
                 ({href=>$r->uri,
                  text=>"Course syllabus"});
               $r->print(&Apache::lonhtmlcommon::breadcrumbs());
           }
           $r->print('<h1>'.$courseenv{'description'}.'</h1><h3>'.
   &Apache::lonnet::domain($cdom,'description').'</h3>');    &Apache::lonnet::domain($cdom,'description').'</h3>');
     } else {      } else {
  $r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.   $r->print('\noindent{\large\textbf{'.$courseenv{'description'}.'}}\\\\\\\\\textbf{'.
Line 137  sub handler { Line 179  sub handler {
 # -------------------------------------------------------- Get course personnel  # -------------------------------------------------------- Get course personnel
     my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);      my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'/'.$cnum);
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('<table border="2">');   $r->print(&Apache::lonhtmlcommon::start_pick_box());
     } else {      } else {
  $r->print('\begin{tabular}{|p{0.45\textwidth}|p{0.45\textwidth}|}\hline');   $r->print('\begin{tabular}{|p{0.45\textwidth}|p{0.45\textwidth}|}\hline');
     }      }
     foreach my $element (sort keys %coursepersonnel) {      foreach my $element (sort keys %coursepersonnel) {
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print('<tr><td>'.$element.'</td><td>');      $r->print(&Apache::lonhtmlcommon::row_title($element));
  } else {   } else {
     $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & ');       $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & '); 
  }   }
         foreach (split(/\,/,$coursepersonnel{$element})) {          foreach (split(/\,/,$coursepersonnel{$element})) {
     my ($puname,$pudom)=split(/\:/,$_);      my ($puname,$pudom)=split(/\:/,$_);
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print(' '.&Apache::loncommon::aboutmewrapper(                  my $courseperson = &Apache::loncommon::plainname($puname,$pudom);
                               &Apache::loncommon::plainname($puname,                  if (($env{'user.name'} eq '') || ($env{'user.name'} eq 'public') ||
                               $pudom),$puname,$pudom));                      ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {
       $r->print(' '.$courseperson);
                   } else {
                       $r->print(' '.&Apache::loncommon::aboutmewrapper($courseperson,
                                 $puname,$pudom));
                   }
     } else {      } else {
  $r->print(' '.&Apache::loncommon::plainname($puname,   $r->print(' '.&Apache::loncommon::plainname($puname,
                               $pudom).' ');                                $pudom).' ');
     }      }
  }   }
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print('</td></tr>');      $r->print(&Apache::lonhtmlcommon::row_closure());
  } else {   } else {
     $r->print('\\\\ \hline');      $r->print('\\\\ \hline');
  }   }
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print('</table>');   $r->print(&Apache::lonhtmlcommon::end_pick_box());
     } else {      } else {
  $r->print('\end{tabular}\\\\');   $r->print('\end{tabular}\\\\');
     }      }
Line 190  sub handler { Line 237  sub handler {
        }         }
        if ($allowed) {         if ($allowed) {
           $r->print('<p>'.            $r->print('<p>'.
 &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'</p><p>'.&mt('This syllabus can be publicly viewed at')  &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'</p><p>'.&mt('This syllabus can be publicly viewed at')
     .' <tt>http://'.      .' <tt>http://'.
     &Apache::lonnet::hostname($homeserver).$r->uri.'</tt>'.      &Apache::lonnet::hostname($homeserver).$r->uri.'</tt>'.
                &Apache::loncommon::help_open_topic('Syllabus_ExtLink').'</p>'.                 &Apache::loncommon::help_open_topic('Syllabus_ExtLink').'</p>'.
Line 261  sub handler { Line 308  sub handler {
                      $syllabus{'uploaded.domain'});                       $syllabus{'uploaded.domain'});
        if ($target ne 'tex') {         if ($target ne 'tex') {
    $r->print('<table><tr><td>'.&mt('Last updated').':</td><td>'.     $r->print('<table><tr><td>'.&mt('Last updated').':</td><td>'.
      $lastmod.'</td><td>'.&mt('by').' '.$who.       $lastmod.'</td><td>'.
        ($who ? &mt('by').' '.$who
                              : '' ).
      '</td></tr></table><p>');       '</td></tr></table><p>');
        } else {         } else {
    $r->print('\\\\ '.&mt('Last updated').': '.$lastmod.' '.&mt('by').'\\\\ '.     $r->print('\\\\ '.&mt('Last updated').': '.$lastmod.' '.
      &Apache::loncommon::plainname($syllabus{'uploaded.name'},       ($who? &mt('by').'\\\\ '.
                      $syllabus{'uploaded.domain'}).'\\\\');              &Apache::loncommon::plainname($syllabus{'uploaded.name'},$syllabus{'uploaded.domain'})
             :'')
        .'\\\\');
        }         }
        if ($allowed) {         if ($allowed) {
    $r->print('<form method="post">'.     $r->print('<form method="post">'.
Line 324  sub handler { Line 375  sub handler {
        if ($allowed) {         if ($allowed) {
    $r->print('<br /><textarea cols="80" rows="12" name="'.$field.'" id="'.$field.'">'.     $r->print('<br /><textarea cols="80" rows="12" name="'.$field.'" id="'.$field.'">'.
      &HTML::Entities::encode($syllabus{$field},'"&<>').       &HTML::Entities::encode($syllabus{$field},'"&<>').
      '</textarea> <input type="submit" name="storesyl" value="Store" />');       '</textarea> <input type="submit" name="storesyl" value="'.&mt('Save').'" />');
        }         }
    }     }
        }         }
Line 335  sub handler { Line 386  sub handler {
        if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}         if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}
     } else {      } else {
  if ($target ne 'tex') {$r->print('<p>');} else {$r->print('\par ');}    if ($target ne 'tex') {$r->print('<p>');} else {$r->print('\par ');} 
  $r->print('No syllabus information provided.');   $r->print(&mt('No syllabus information provided.'));
  if ($target ne 'tex') {$r->print('</p>');}   if ($target ne 'tex') {$r->print('</p>');}
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
           if ($env{'form.backto'} eq 'coursecatalog') {
               $r->print('<form name="backtocat" method="post" action="/adm/coursecatalog">'.
                         &Apache::lonhtmlcommon::echo_form_input(['backto','courseid']).
                         '</form>');
           }
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());
     } else {      } else {
  $r->print('\end{document}');   $r->print('\end{document}');

Removed from v.1.58  
changed lines
  Added in v.1.68


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