Diff for /loncom/interface/londocs.pm between versions 1.484.2.68 and 1.484.2.73

version 1.484.2.68, 2016/11/30 18:05:43 version 1.484.2.73, 2017/08/31 20:06:36
Line 1959  sub get_newmap_url { Line 1959  sub get_newmap_url {
 sub dbcopy {  sub dbcopy {
     my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;      my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;
     my ($url,$result,$errtext);      my ($url,$result,$errtext);
     $url = $dbref->{'src'};  
     if (ref($dbref) eq 'HASH') {      if (ref($dbref) eq 'HASH') {
           $url = $dbref->{'src'};
         if ($url =~ m{/(smppg|bulletinboard)$}) {          if ($url =~ m{/(smppg|bulletinboard)$}) {
             my $prefix = $1;              my $prefix = $1;
             if (($dbref->{'cdom'} =~ /^$match_domain$/) &&              if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
Line 3065  sub editor { Line 3065  sub editor {
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,          $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,                                $coursenum,$coursedom,$crstype,
                               $pathitem,$supplementalflag,$container,                                $pathitem,$supplementalflag,$container,
                               \%filters,\%curr_groups,$canedit,$isencrypted,$navmapref);                                \%filters,\%curr_groups,$canedit,
                                 $isencrypted,$navmapref);
         $idx++;          $idx++;
         $shown++;          $shown++;
     }      }
Line 3691  END Line 3692  END
  }   }
     }      }
   
     my ($editlink,$extresform,$anchor,$hiddenres);      my ($editlink,$extresform,$anchor,$hiddenres,$nomodal);
     my $orig_url = $url;      my $orig_url = $url;
     $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};      $orig_url=~s{http(:|:)//https(:|:)//}{https$2//};
     $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};      $url=~s{^http(|s)(:|:)//}{/adm/wrapper/ext/};
Line 3709  END Line 3710  END
         } elsif ($url!~/\.(sequence|page)$/) {          } elsif ($url!~/\.(sequence|page)$/) {
     $url='/adm/coursedocs/showdoc'.$url;      $url='/adm/coursedocs/showdoc'.$url;
         }          }
     } elsif ($url=~m|^/ext/|) {              } elsif ($url=~m{^(|/adm/wrapper)/ext/([^#]+)}) {
         $url='/adm/wrapper'.$url;                  my $wrapped = $1;
                   my $exturl = $2;
                   if ($wrapped eq '') {
                       $url='/adm/wrapper'.$url;
                   }
                   if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
                       $nomodal = 1;
                   }
               } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
                   if (($ENV{'SERVER_PORT'} == 443) &&
                       ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
                       $nomodal = 1;
                   }
     }      }
             if (&Apache::lonnet::symbverify($symb,$url)) {              if (&Apache::lonnet::symbverify($symb,$url)) {
                 my $shownsymb = $symb;                  my $shownsymb = $symb;
Line 3740  END Line 3753  END
                 if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||                  if (((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i) ||
                       $isencrypted || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {                        $isencrypted || (&Apache::lonnet::EXT('resource.0.encrypturl',$symb) =~ /^yes$/i)) {
                     $checkencrypt = 1;                      $checkencrypt = 1;
                 } else {                  } elsif (ref($navmapref)) {
                     unless (ref($$navmapref)) {                      unless (ref($$navmapref)) {
                         $$navmapref = Apache::lonnavmaps::navmap->new();                          $$navmapref = Apache::lonnavmaps::navmap->new();
                     }                      }
Line 3773  END Line 3786  END
             if ($url =~ /^([^#]+)#([^#]+)$/) {              if ($url =~ /^([^#]+)#([^#]+)$/) {
                 $url = $1;                  $url = $1;
                 $anchor = $2;                  $anchor = $2;
                   if (($url =~ m{^(|/adm/wrapper)/ext/(?!https:)}) && ($ENV{'SERVER_PORT'} == 443)) {
                       $nomodal = 1;
                   }
               }
           } elsif ($url =~ m{^\Q/public/$coursedom/$coursenum/syllabus\E}) {
               if (($ENV{'SERVER_PORT'} == 443) &&
                   ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ m{^http://})) {
                   $nomodal = 1;
             }              }
         }          }
     }      }
Line 3795  END Line 3816  END
             my $encryptmap = ((&LONCAPA::map::getparameter($orderidx,              my $encryptmap = ((&LONCAPA::map::getparameter($orderidx,
                                               'parameter_encrypturl'))[0]=~/^yes$/i);                                                'parameter_encrypturl'))[0]=~/^yes$/i);
             unless ($hiddenmap) {              unless ($hiddenmap) {
                 unless (ref($$navmapref)) {                  if (ref($navmapref)) {
                     $$navmapref = Apache::lonnavmaps::navmap->new();                      unless (ref($$navmapref)) {
                 }                          $$navmapref = Apache::lonnavmaps::navmap->new();
                 if (ref($$navmapref)) {                      }
                     if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.hiddenresource")) eq 'yes') {                      if (ref($$navmapref)) {
                         my @resources = $$navmapref->retrieveResources($folderurl,$filterFunc,1,1);                          if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.hiddenresource")) eq 'yes') {
                         unless (@resources) {                              my @resources = $$navmapref->retrieveResources($folderurl,$filterFunc,1,1);
                             $hiddenmap = 1;                              unless (@resources) {
                             unless ($env{'request.role.adv'}) {                                  $hiddenmap = 1;
                                 $url = '';                                  unless ($env{'request.role.adv'}) {
                                 $hiddenfolder = 1;                                      $url = '';
                                       $hiddenfolder = 1;
                                   }
                             }                              }
                         }                          }
                     }                      }
                 }                  }
             }              }
             unless ($encryptmap) {              unless ($encryptmap) {
                 if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.encrypturl")) eq 'yes') {                  if ((ref($navmapref)) && (ref($$navmapref))) {
                     $encryptmap = 1;                      if (lc($$navmapref->get_mapparam(undef,$folderurl,"0.encrypturl")) eq 'yes') {
                           $encryptmap = 1;
                       }
                 }                  }
             }              }
   
Line 3909  $form_end; Line 3934  $form_end;
         $reinit = &mt('(re-initialize course to access)');          $reinit = &mt('(re-initialize course to access)');
     }      }
     $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;      $line.='<td class="LC_docs_entry_commands"'.$tdalign.'><span class="LC_nobreak">'.$editlink.$renamelink;
       my $link;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {      if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';         $line.='<a href="'.$url.'"><img src="'.$icon.'" alt="" class="LC_icon" /></a>';
     } elsif ($url) {      } elsif ($url) {
Line 3919  $form_end; Line 3945  $form_end;
                $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');                 $anchor = '#'.&HTML::Entities::encode($anchor,'"<>&');
            }             }
        }         }
        $line.=&Apache::loncommon::modal_link(&js_escape($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.         $link = &js_escape($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.
                                              (($anchor ne '')?$anchor:'')),                                                 (($anchor ne '')?$anchor:''));
                                              '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);         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;" />'.
                     '<img src="'.$icon.'" alt="" class="LC_icon" border="0" /></a>';
          } else {
              $line.=&Apache::loncommon::modal_link($link,
                                                    '<img src="'.$icon.'" alt="" class="LC_icon" />',600,500);
          }
     } else {      } else {
        $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';         $line.='<img src="'.$icon.'" alt="" class="LC_icon" />';
     }      }
Line 3929  $form_end; Line 3961  $form_end;
     if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {      if (($url=~m{/adm/(coursedocs|supplemental)}) || (!$allowed && $url)) {
        $line.='<a href="'.$url.'">'.$title.'</a>';         $line.='<a href="'.$url.'">'.$title.'</a>';
     } elsif ($url) {      } elsif ($url) {
        $line.=&Apache::loncommon::modal_link(&js_escape($url.(($url=~/\?/)?'&amp;':'?').'inhibitmenu=yes'.         if ($nomodal) {
                                              (($anchor ne '')?$anchor:'')),             $line.='<a href="#" onclick="javascript:window.open('."'$link','syllabuspreview','height=400,width=500,scrollbars=1,resizable=1,menubar=0,location=1')".'; return false;" />'.
                                              $title,600,500);                    $title.'</a>';
          } else {
              $line.=&Apache::loncommon::modal_link($link,$title,600,500);
          }
     } elsif (($hiddenfolder) || ($hiddenres)) {      } elsif (($hiddenfolder) || ($hiddenres)) {
        $line.=$title.' <span class="LC_warning LC_docs_reinit_warn">'.&mt('(Hidden)').'</span>';         $line.=$title.' <span class="LC_warning LC_docs_reinit_warn">('.&mt('Hidden').')</span>';
     } else {      } else {
        $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';         $line.=$title.' <span class="LC_docs_reinit_warn">'.$reinit.'</span>';
     }      }
Line 5077  sub handler { Line 5112  sub handler {
   undef($hadchanges);    undef($hadchanges);
           $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,            $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,
                                               \%allfiles,\%codebase,$context,$crstype);                                                \%allfiles,\%codebase,$context,$crstype);
             undef($navmap);
   if ($hadchanges) {    if ($hadchanges) {
       &mark_hash_old();        &mark_hash_old();
   }    }
Line 5187  sub handler { Line 5223  sub handler {
     if ($disk_quota == 0) {      if ($disk_quota == 0) {
         $percent = 100.0;          $percent = 100.0;
     } else {      } else {
         $percent = 100*($current_disk_usage/$disk_quota);          $percent = 100*($usage/$disk_quota);
     }      }
     $usage = sprintf("%.2f",$usage);      $usage = sprintf("%.2f",$usage);
     $quota = sprintf("%.2f",$quota);      $quota = sprintf("%.2f",$quota);
Line 5597  unless ($container eq 'page') { Line 5633  unless ($container eq 'page') {
           if ($error) {            if ($error) {
              $r->print('<p><span class="LC_error">'.$error.'</span></p>');               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }            }
             unless (&is_hash_old()) {
           if ($hadchanges) {            if ($hadchanges) {
              &mark_hash_old();               unless (&is_hash_old()) {
                    &mark_hash_old();
                }
           }            }
   
           &changewarning($r,'');            &changewarning($r,'');

Removed from v.1.484.2.68  
changed lines
  Added in v.1.484.2.73


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