Diff for /loncom/interface/lonsyllabus.pm between versions 1.64 and 1.69.4.1

version 1.64, 2008/07/11 14:55:21 version 1.69.4.1, 2009/05/20 01:23:47
Line 110  sub handler { Line 110  sub handler {
 # ----------------------------------------------------------------- Make header   # ----------------------------------------------------------------- Make header 
     if ($target ne 'tex') {      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";
   
   <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 135  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(&Apache::loncommon::start_data_table());   $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) {      my @personnel=sort(keys(%coursepersonnel));
       my $lastpers=$personnel[$#personnel];
       foreach my $element (@personnel) {
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print(&Apache::loncommon::start_data_table_row().      $r->print(&Apache::lonhtmlcommon::row_title($element));
       '<td>'.$element.'</td><td>');  
  } else {   } else {
     $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & ');       $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$element).' & '); 
  }   }
Line 154  sub handler { Line 199  sub handler {
                     ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {                      ($env{'user.domain'} eq '') || ($env{'user.domain'} eq 'public')) {
     $r->print(' '.$courseperson);      $r->print(' '.$courseperson);
                 } else {                  } else {
                     $r->print(' '.&Apache::loncommon::aboutmewrapper($courseperson),                      $r->print(' '.&Apache::loncommon::aboutmewrapper($courseperson,
                               $puname,$pudom);                                $puname,$pudom));
                 }                  }
     } else {      } else {
  $r->print(' '.&Apache::loncommon::plainname($puname,   $r->print(' '.&Apache::loncommon::plainname($puname,
Line 163  sub handler { Line 208  sub handler {
     }      }
  }   }
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print('</td>'.&Apache::loncommon::end_data_table_row());              my $lastclose=$element eq $lastpers?1:0;
               $r->print(&Apache::lonhtmlcommon::row_closure($lastclose));
  } else {   } else {
     $r->print('\\\\ \hline');      $r->print('\\\\ \hline');
  }   }
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
  $r->print(&Apache::loncommon::end_data_table());   $r->print(&Apache::lonhtmlcommon::end_pick_box());
     } else {      } else {
  $r->print('\end{tabular}\\\\');   $r->print('\end{tabular}\\\\');
     }      }
Line 193  sub handler { Line 239  sub handler {
           if ($forcestudent or $target eq 'tex') { $allowed=0; }            if ($forcestudent or $target eq 'tex') { $allowed=0; }
        }         }
        if ($allowed) {         if ($allowed) {
             my $protocol = $Apache::lonnet::protocol{$homeserver};
             $protocol = 'http' if ($protocol ne 'https');
           $r->print('<p>'.            $r->print('<p>'.
 &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')  &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>'.$protocol.'://'.
     &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>'.
           '<p>'.&mt('You can specify an external URL as Syllabus in the [_1].','<a href="/adm/parmset?action=crsenv">'.&mt('Course Parameters').'</a>').'</p>'.            '<p>'.&mt('You can specify an external URL as Syllabus in the [_1].','<a href="/adm/parmset?action=crsenv">'.&mt('Course Parameters').'</a>').'</p>'.
Line 225  sub handler { Line 273  sub handler {
 # get rid of leading and trailing spaces  # get rid of leading and trailing spaces
                       $url=~s/^\s+//;                        $url=~s/^\s+//;
                       $url=~s/\s+$//;                        $url=~s/\s+$//;
                       if ($url=~m|^http://([^/]+)/(.+)$|) {                        if ($url=~m|^https?\://([^/]+)/(.+)$|) {
   my $host = $1;    my $host = $1;
                           my $remainder=$2;                            my $remainder=$2;
 # remove the hostname from internal URLs  # remove the hostname from internal URLs
Line 238  sub handler { Line 286  sub handler {
           }            }
       }        }
 # norm internal URLs  # norm internal URLs
                       unless ($url=~/^http\:/) {                        unless ($url=~/^https?\:/) {
           $url=&Apache::lonnet::clutter($url);            $url=&Apache::lonnet::clutter($url);
                       }                        }
 # re-assemble field  # re-assemble field
Line 315  sub handler { Line 363  sub handler {
    }      } 
        } else {         } else {
    &Apache::lonfeedback::newline_to_br(\$message);     &Apache::lonfeedback::newline_to_br(\$message);
    $message =~s|(https*://[^\s]+)|<a href="$1"><tt>$1</tt></a>|g;     $message =~s|(https?\://[^\s]+)|<a href="$1"><tt>$1</tt></a>|g;
    if ($allowed) {     if ($allowed) {
        $message=&Apache::lonspeller::markeduptext($message);         $message=&Apache::lonspeller::markeduptext($message);
    }     }
Line 347  sub handler { Line 395  sub handler {
  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.64  
changed lines
  Added in v.1.69.4.1


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