Diff for /loncom/interface/londocs.pm between versions 1.484.2.79 and 1.484.2.80

version 1.484.2.79, 2019/04/11 16:32:33 version 1.484.2.80, 2019/07/26 23:33:34
Line 834  sub docs_change_log { Line 834  sub docs_change_log {
              '// <![CDATA['."\n".               '// <![CDATA['."\n".
              &Apache::loncommon::display_filter_js('docslog')."\n".               &Apache::loncommon::display_filter_js('docslog')."\n".
              &editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag,               &editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag,
                          $coursedom,$coursenum,$canedit,\$navmap)."\n".                           $coursedom,$coursenum,$canedit,'',\$navmap)."\n".
              &history_tab_js()."\n".               &history_tab_js()."\n".
              &Apache::lonratedt::editscript('simple')."\n".               &Apache::lonratedt::editscript('simple')."\n".
              '// ]]>'."\n".               '// ]]>'."\n".
Line 2775  sub handle_edit_cmd { Line 2775  sub handle_edit_cmd {
   
 sub editor {  sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,      my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
         $supplementalflag,$orderhash,$iconpath,$pathitem,$canedit,$navmapref,          $supplementalflag,$orderhash,$iconpath,$pathitem,$canedit,
         $hiddentop)=@_;          $hostname,$navmapref,$hiddentop)=@_;
     my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);      my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
     if ($allowed) {      if ($allowed) {
         (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,          (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
Line 3096  sub editor { Line 3096  sub editor {
                               $coursenum,$coursedom,$crstype,                                $coursenum,$coursedom,$crstype,
                               $pathitem,$supplementalflag,$container,                                $pathitem,$supplementalflag,$container,
                               \%filters,\%curr_groups,$canedit,                                \%filters,\%curr_groups,$canedit,
                               $isencrypted,$navmapref);                                $isencrypted,$navmapref,$hostname);
         $idx++;          $idx++;
         $shown++;          $shown++;
     }      }
Line 3475  sub is_supplemental_title { Line 3475  sub is_supplemental_title {
 sub entryline {  sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,      my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
         $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,          $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
         $canedit,$isencrypted,$navmapref)=@_;          $canedit,$isencrypted,$navmapref,$hostname)=@_;
     my ($foldertitle,$renametitle,$oldtitle);      my ($foldertitle,$renametitle,$oldtitle);
     if (&is_supplemental_title($title)) {      if (&is_supplemental_title($title)) {
  ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);   ($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
Line 3752  END Line 3752  END
             } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {              } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
                 if (($ENV{'SERVER_PORT'} == 443) &&                  if (($ENV{'SERVER_PORT'} == 443) &&
                     ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {                      ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
                       unless (&Apache::lonnet::uses_sts()) {
                           $url .= '?usehttp=1';
                       }
                     $nomodal = 1;                      $nomodal = 1;
                 }                  }
     }      }
Line 3761  END Line 3764  END
                     if ($url =~ /^([^#]+)#([^#]+)$/) {                      if ($url =~ /^([^#]+)#([^#]+)$/) {
                         $url = $1;                          $url = $1;
                         $anchor = $2;                          $anchor = $2;
                         if ($symb =~ m{^([^#]+)\Q#$anchor\E$}) {                          my $escan = &escape('#');
                             $shownsymb = $1.&escape('#').$anchor;                          $shownsymb =~ s/^([^\#]+)#([^\#]+)$/$1$escan$2/;
                         }  
                     }                      }
                 }                  }
                 unless ($env{'request.role.adv'}) {                  unless ($env{'request.role.adv'}) {
Line 3797  END Line 3799  END
                     my $shownsymb = &Apache::lonenc::encrypted($symb);                      my $shownsymb = &Apache::lonenc::encrypted($symb);
                     my $shownurl = &Apache::lonenc::encrypted($url);                      my $shownurl = &Apache::lonenc::encrypted($url);
                     if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) {                      if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) {
                         $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&HTML::Entities::encode($shownsymb,'"<>&');                          $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
                         if ($env{'request.enc'} ne '') {                          if ($env{'request.enc'} ne '') {
                             delete($env{'request.enc'});                              delete($env{'request.enc'});
                         }                          }
Line 3817  END Line 3819  END
                 $url = $1;                  $url = $1;
                 $anchor = $2;                  $anchor = $2;
                 if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {                  if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
                       unless (&Apache::lonnet::uses_sts()) {
                           if ($hostname ne '') {
                               $url = 'http://'.$hostname.$url;
                           }
                           $url .= (($url =~ /\?/) ? '&amp;':'?').'usehttp=1';
                       }
                     $nomodal = 1;                      $nomodal = 1;
                 }                  }
             }              }
         } elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {          } elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
             if (($ENV{'SERVER_PORT'} == 443) &&              if (($ENV{'SERVER_PORT'} == 443) &&
                 ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {                  ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
                   unless (&Apache::lonnet::uses_sts()) {
                       if ($hostname ne '') {
                           $url = 'http://'.$hostname.$url;
                       }
                       $url .= (($url =~ /\?/) ? '&amp;':'?').'usehttp=1';
                   }
                 $nomodal = 1;                  $nomodal = 1;
             }              }
         }          }
Line 3947  $form_end; Line 3961  $form_end;
                                                             $forceedit,                                                              $forceedit,
                                                             undef,$symb,                                                              undef,$symb,
                                                             &escape($env{'form.folderpath'}),                                                              &escape($env{'form.folderpath'}),
                                                             $renametitle,'','',1,$suppanchor);                                                              $renametitle,$hostname,
                                                               '','',1,$suppanchor);
                 if ($jscall) {                  if ($jscall) {
                     $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.                      $editlink = '<a class="LC_docs_ext_edit" href="javascript:'.
                                 $jscall.'" >'.&mt('Edit').'</a>&nbsp;'."\n";                                  $jscall.'" >'.&mt('Edit').'</a>&nbsp;'."\n";
Line 3975  $form_end; Line 3990  $form_end;
                $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');                 $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');
            }             }
        }         }
        $link = &js_escape($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.  
                                                (($anchor ne '')?$anchor:''));         if ((!$supplementalflag) && ($nomodal) && ($hostname ne '')) {
              $link = 'http://'.$hostname.$url;
          } else {
              $link = $url;
          }
          $link = &js_escape($link.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.$anchor);
        if ($nomodal) {         if ($nomodal) {
            $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.             $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
                   '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';                    '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';
Line 5162  sub handler { Line 5182  sub handler {
                 }                  }
             }              }
             my $tabidstr = join("','",@tabids);              my $tabidstr = join("','",@tabids);
               my $hostname = $r->hostname();
     $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,      $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,
                                    $canedit,\$navmap).                                     $canedit,$hostname,\$navmap).
                        &history_tab_js().                         &history_tab_js().
                        &inject_data_js().                         &inject_data_js().
                        &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).                         &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).
Line 6299  END Line 6320  END
 }  }
   
 sub editing_js {  sub editing_js {
     my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$canedit,$navmapref) = @_;      my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,
           $canedit,$hostname,$navmapref) = @_;
     my %js_lt = &Apache::lonlocal::texthash(      my %js_lt = &Apache::lonlocal::texthash(
                                           p_mnf => 'Name of New Folder',                                            p_mnf => 'Name of New Folder',
                                           t_mnf => 'New Folder',                                            t_mnf => 'New Folder',
Line 6373  sub editing_js { Line 6395  sub editing_js {
                 }                  }
                 $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($url),'<>&"').'?symb='.                  $backtourl = &HTML::Entities::encode(&Apache::lonnet::clutter($url),'<>&"').'?symb='.
                              &HTML::Entities::encode($caller,'<>&"');                               &HTML::Entities::encode($caller,'<>&"');
                   if ($backtourl =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
                       if (($ENV{'SERVER_PORT'} == 443) &&
                           ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
                           unless (&Apache::lonnet::uses_sts()) {
                               if ($hostname ne '') {
                                   $backtourl = 'http://'.$hostname.$backtourl;
                               }
                               $backtourl .= (($backtourl =~ /\?/) ? '&amp;':'?').'usehttp=1';
                           }
                       }
                   } elsif ($backtourl =~ m{^/adm/wrapper/ext/(?!https:)}) {
                       if (($ENV{'SERVER_PORT'} == 443) && ($hostname ne '')) {
                           unless (&Apache::lonnet::uses_sts()) {
                               if ($hostname ne '') {
                                   $backtourl = 'http://'.$hostname.$backtourl;
                               }
                               $backtourl .= (($backtourl =~ /\?/) ? '&amp;':'?').'usehttp=1';
                           }
                       }
                   }
                 if ($anchor ne '') {                  if ($anchor ne '') {
                     $backtourl .= '#'.&HTML::Entities::encode($anchor,'<>&"');                      $backtourl .= '#'.&HTML::Entities::encode($anchor,'<>&"');
                 }                  }

Removed from v.1.484.2.79  
changed lines
  Added in v.1.484.2.80


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