Diff for /loncom/interface/lonsyllabus.pm between versions 1.138.2.3 and 1.140

version 1.138.2.3, 2017/03/15 03:31:48 version 1.140, 2016/02/20 00:12:40
Line 116  sub handler { Line 116  sub handler {
         }          }
         unless ($allowed && $forceedit) {          unless ($allowed && $forceedit) {
             my $file=&Apache::lonnet::filelocation("",$item);              my $file=&Apache::lonnet::filelocation("",$item);
             if ($file =~ /\.(tex|x?html?)$/) {              if ($file =~ /\.(tex|x?html?)$/) {  
                 my $filetype = $1;                  my $filetype = $1;
                 my $filecontents=&Apache::lonnet::getfile($file);                  my $filecontents=&Apache::lonnet::getfile($file);
                 if ($filecontents eq -1) {                  if ($filecontents eq -1) {
Line 168  sub handler { Line 168  sub handler {
                               &mt('Print the syllabus directly from your web browser').                                &mt('Print the syllabus directly from your web browser').
                               '\end{document}');                                '\end{document}');
                 } else {                  } else {
                     my $brcrum;                      $r->print(&Apache::lonwrapper::wrapper($item,undef,$env{'request.use_absolute'},
                     if ($env{'form.folderpath'} =~ /^supplemental/) {                                                             undef,$is_pdf,undef,&mt('Syllabus')));
                         my $title = $env{'form.title'};  
                         if ($title eq '') {  
                             $title = &mt('Syllabus');  
                         }  
                         $brcrum =  
                             &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);  
                     }  
                     $r->print(&Apache::lonwrapper::wrapper($item,$brcrum,$env{'request.use_absolute'},  
                                                            undef,$is_pdf,&mt('Syllabus')));  
                 }                  }
             }              }
             return OK;              return OK;
Line 192  sub handler { Line 183  sub handler {
                          '\end{document}');                           '\end{document}');
             } else {              } else {
                 my $is_ext = 1;                  my $is_ext = 1;
                 my ($is_pdf,$brcrum);                  my $is_pdf;
                 if ($external =~ /\.pdf$/i) {                  if ($external =~ /\.pdf$/i) {
                     $is_pdf = 1;                      $is_pdf = 1;
                 }                  }
                 if ($env{'form.folderpath'} =~ /^supplemental/) {                  $r->print(&Apache::lonwrapper::wrapper($external,undef,$env{'request.use_absolute'},
                     my $title = $env{'form.title'};                                                         $is_ext,$is_pdf,undef,&mt('Syllabus')));
                     if ($title eq '') {  
                         $title = &mt('Syllabus');  
                     }  
                     $brcrum =  
                         &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);  
                 }  
                 $r->print(&Apache::lonwrapper::wrapper($external,$brcrum,$env{'request.use_absolute'},  
                                                        $is_ext,$is_pdf,&mt('Syllabus')));  
             }              }
             return OK;              return OK;
         }          }
Line 627  function toggleEditor(pick) { Line 610  function toggleEditor(pick) {
   
 var regexp = $urlregexp;  var regexp = $urlregexp;
   
 function extUrlPreview(caller,protocol) {  function extUrlPreview(caller) {
     if (document.getElementById(caller)) {      if (document.getElementById(caller)) {
         var url = document.getElementById(caller).value;          var url = document.getElementById(caller).value;
         if (regexp.test(url)) {          if (regexp.test(url)) {
             var http_regex = /^http\:\/\//gi;              openMyModal(url,500,400,'yes');
             if ((protocol == 'https') && (http_regex.test(url))) {  
                 window.open(url,"syllabuspreview","height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1");  
             } else {  
                 openMyModal(url,500,400,'yes');  
             }  
         } else {          } else {
             alert("$invurl");              alert("$invurl");
         }          }
Line 824  sub chooser { Line 802  sub chooser {
         $checked{'templatebox'} = $check;          $checked{'templatebox'} = $check;
         $display{'templatebox'} = 'block';          $display{'templatebox'} = 'block';
     }      }
     my $protocol = ($ENV{'SERVER_PORT'} == 443?'https':'http');  
   
     my $output =       my $output = 
         '<form name="syllabus" method="post" enctype="multipart/form-data" action="">'."\n".          '<form name="syllabus" method="post" enctype="multipart/form-data" action="">'."\n".
Line 837  sub chooser { Line 814  sub chooser {
     $output .= '</fieldset></div>'."\n".      $output .= '</fieldset></div>'."\n".
                '<div id="url" class="LC_left_float" style="display: '.$display{'url'}.'">'."\n".                 '<div id="url" class="LC_left_float" style="display: '.$display{'url'}.'">'."\n".
                '<fieldset><legend>'.$lt{'chourl'}.'</legend><span class="LC_nobreak">'."\n".                 '<fieldset><legend>'.$lt{'chourl'}.'</legend><span class="LC_nobreak">'."\n".
                '<a href="javascript:extUrlPreview('."'syllabusurl','$protocol'".');">'.$lt{'pr'}.'</a></span>&nbsp;'."\n".                 '<a href="javascript:extUrlPreview('."'syllabusurl'".');">'.$lt{'pr'}.'</a></span>&nbsp;'."\n".
                '<input type="text" id="syllabusurl" name="externalsyllabus" value="'.$external.'" size="55" />'."\n".                 '<input type="text" id="syllabusurl" name="externalsyllabus" value="'.$external.'" size="55" />'."\n".
                '&nbsp;<input type="submit" name="storeurl" value="'.$lt{'save'}.'" />'."\n".                 '&nbsp;<input type="submit" name="storeurl" value="'.$lt{'save'}.'" />'."\n".
                '</fieldset></div>'."\n".                 '</fieldset></div>'."\n".

Removed from v.1.138.2.3  
changed lines
  Added in v.1.140


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