Diff for /loncom/interface/londocs.pm between versions 1.623 and 1.626

version 1.623, 2017/03/08 02:51:07 version 1.626, 2017/05/08 14:20:20
Line 654  sub group_import { Line 654  sub group_import {
             }              }
         }          }
  if ($url) {   if ($url) {
             if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/exttool)s?\:?(.*)$}) {              if ($url =~ m{^(/adm/$coursedom/$coursenum/(\d+)/ext\.tool)\:?(.*)$}) {
                 $url = $1;                  $url = $1;
                 my $marker = $2;                  my $marker = $2;
                 my $info = $3;                  my $info = $3;
                 my ($toolid,%toolhash,%toolsettings);                  my ($toolid,%toolhash,%toolsettings);
                   my @extras = ('linktext','explanation','crslabel','crstitle');
                 my @toolinfo = split(/:/,$info);                  my @toolinfo = split(/:/,$info);
                 if ($residx) {                  if ($residx) {
                     %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);                      %toolsettings=&Apache::lonnet::dump('exttool_'.$marker,$coursedom,$coursenum);
Line 668  sub group_import { Line 669  sub group_import {
                 }                  }
                 $toolid =~ s/\D//g;                  $toolid =~ s/\D//g;
                 ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},                  ($toolhash{'target'},$toolhash{'width'},$toolhash{'height'},
                    $toolhash{'linktext'},$toolhash{'explanation'},
                  $toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo;                   $toolhash{'crslabel'},$toolhash{'crstitle'}) = @toolinfo;
                 $toolhash{'crslabel'} = &unescape($toolhash{'crslabel'});                  foreach my $item (@extras) {
                 $toolhash{'crstitle'} = &unescape($toolhash{'crstitle'});                      $toolhash{$item} = &unescape($toolhash{$item});
                   }
                 if (ref($ltitoolsref) eq 'HASH') {                  if (ref($ltitoolsref) eq 'HASH') {
                     my @deleted;                      my @deleted;
                     if (ref($ltitoolsref->{$toolid}) eq 'HASH') {                      if (ref($ltitoolsref->{$toolid}) eq 'HASH') {
                         if ($ltitoolsref->{$toolid}->{'url'} =~ m{^https://}) {  
                             $url =~ s/exttool$/exttools/;  
                         }  
                         $toolhash{'id'} = $toolid;                          $toolhash{'id'} = $toolid;
                         if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'window')) {                          if (($toolhash{'target'} eq 'iframe') || ($toolhash{'target'} eq 'window')) {
                             if ($toolhash{'target'} eq 'window') {                              if ($toolhash{'target'} eq 'window') {
                                 foreach my $item ('width','height') {                                  foreach my $item ('width','height') {
                                     $toolhash{$item} =~ s/^\s+//;                                      $toolhash{$item} =~ s/^\s+//;
                                     $toolhash{$item} =~ s/\s+$//;                                      $toolhash{$item} =~ s/\s+$//;
                                       if ($toolhash{$item} =~ /\D/) {
                                           delete($toolhash{$item});
                                           if ($residx) {
                                               if ($toolsettings{$item}) {
                                                   push(@deleted,$item);
                                               }
                                           }
                                       }
                                 }                                  }
                             }                              }
                         } elsif ($residx) {                          } elsif ($residx) {
                             $toolhash{'target'} = $toolsettings{'target'};                              $toolhash{'target'} = $toolsettings{'target'};
                             if ($toolhash{'target'} eq 'window') {                              if ($toolhash{'target'} eq 'window') {
                                 $toolhash{'width'} = $toolsettings{'width'};                                  foreach my $item ('width','height') { 
                                 $toolhash{'height'} = $toolsettings{'height'};                                        $toolhash{$item} = $toolsettings{$item};
                                   }
                             }                              }
                         } elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') {                          } elsif (ref($ltitoolsref->{$toolid}->{'display'}) eq 'HASH') {
                             $toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'};                              $toolhash{'target'} = $ltitoolsref->{$toolid}->{'display'}->{'target'};
Line 699  sub group_import { Line 708  sub group_import {
                             }                              }
                         }                          }
                         if ($toolhash{'target'} eq 'iframe') {                          if ($toolhash{'target'} eq 'iframe') {
                             delete($toolhash{'width'});                              foreach my $item ('width','height','linktext','explanation') {
                             delete($toolhash{'height'});                                  delete($toolhash{$item});
                             if ($residx) {                                  if ($residx) {
                                 if ($toolsettings{'width'}) {                                      if ($toolsettings{$item}) {
                                     push(@deleted,'width');                                          push(@deleted,$item);
                                 }                                      }
                                 if ($toolsettings{'height'}) {  
                                     push(@deleted,'height');  
                                 }                                  }
                             }                              }
                         }                          }
                         if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') {                          if (ref($ltitoolsref->{$toolid}->{'crsconf'}) eq 'HASH') {
                             foreach my $item ('label','title') {                               foreach my $item ('label','title','linktext','explanation') {
                                   my $crsitem;
                                   if (($item eq 'label') || ($item eq 'title')) {
                                       $crsitem = 'crs'.$item;
                                   } else {
                                       $crsitem = $item;
                                   }
                                 if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) {                                  if ($ltitoolsref->{$toolid}->{'crsconf'}->{$item}) {
                                     $toolhash{'crs'.$item} =~ s/^\s+//;                                      $toolhash{$crsitem} =~ s/^\s+//;
                                     $toolhash{'crs'.$item} =~ s/\s+$//;                                      $toolhash{$crsitem} =~ s/\s+$//;
                                     if ($toolhash{'crs'.$item} eq '') {                                      if ($toolhash{$crsitem} eq '') {
                                         delete($toolhash{'crs'.$item});                                          delete($toolhash{$crsitem});
                                     }                                      }
                                 } else {                                  } else {
                                     delete($toolhash{'crs'.$item});                                      delete($toolhash{$crsitem});
                                 }                                  }
                                 if (($residx) && (exists($toolsettings{'crs'.$item}))) {                                  if (($residx) && (exists($toolsettings{$crsitem}))) {
                                     unless (exists($toolhash{'crs'.$item})) {                                      unless (exists($toolhash{$crsitem})) {
                                         push(@deleted,'crs'.$item);                                          push(@deleted,$crsitem);
                                     }                                      }
                                 }                                  }
                             }                              }
Line 1279  sub print_paste_buffer { Line 1292  sub print_paste_buffer {
             my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];              my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
             if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) {              if ($url =~ m{^(?:/adm/wrapper/ext|(?:http|https)(?::|:))//} ) {
                 $is_external = 1;                  $is_external = 1;
             } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$}) {              } elsif ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$}) {
                 $is_exttool = 1;                  $is_exttool = 1;
             }              }
             if ($folder =~ /^supplemental/) {              if ($folder =~ /^supplemental/) {
Line 1490  sub supp_pasteable { Line 1503  sub supp_pasteable {
         ($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||          ($url =~ m{^/uploaded/$match_domain/$match_courseid/(docs|supplemental)/(default|\d+)/\d+/}) ||
         ($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||          ($url =~ m{^/adm/$match_domain/$match_username/aboutme}) ||
         ($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) ||          ($url =~ m{^/public/$match_domain/$match_courseid/syllabus}) ||
         ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/exttools?$})) {          ($url =~ m{^/adm/$match_domain/$match_courseid/\d+/ext\.tool$})) {
         return 1;          return 1;
     }      }
     return;      return;
Line 3220  sub editor { Line 3233  sub editor {
                         } else {                          } else {
                             return $errortxt;                              return $errortxt;
                         }                          }
                     } elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/exttool}) {                      } elsif ($url =~ m{^/adm/$coursedom/$coursenum/new/ext\.tool}) {
                         my ($suffix,$errortxt,$locknotfreed) =                          my ($suffix,$errortxt,$locknotfreed) =
                             &new_timebased_suffix($coursedom,$coursenum,'exttool');                              &new_timebased_suffix($coursedom,$coursenum,'exttool');
                         if ($locknotfreed) {                          if ($locknotfreed) {
Line 3838  END Line 3851  END
     |/aboutme$      |/aboutme$
     |/navmaps$      |/navmaps$
     |/bulletinboard$      |/bulletinboard$
                             |/exttools?$                              |/ext\.tool$
     |\.html$)}x)      |\.html$)}x)
              || $isexternal) {               || $isexternal) {
     $skip_confirm = 1;      $skip_confirm = 1;
Line 3997  END Line 4010  END
                 if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {                  if (($ENV{'SERVER_PORT'} == 443) && ($exturl !~ /^https:/)) {
                     $nomodal = 1;                      $nomodal = 1;
                 }                  }
     } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {      } elsif ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
  $url='/adm/wrapper'.$url;   $url='/adm/wrapper'.$url;
             } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {              } elsif ($url eq "/public/$coursedom/$coursenum/syllabus") {
                 if (($ENV{'SERVER_PORT'} == 443) &&                  if (($ENV{'SERVER_PORT'} == 443) &&
Line 4172  $form_end; Line 4185  $form_end;
         }          }
     } elsif ($supplementalflag && !$allowed) {      } elsif ($supplementalflag && !$allowed) {
         my $isexttool;          my $isexttool;
         if ($url=~m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {          if ($url=~m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
             $url='/adm/wrapper'.$url;              $url='/adm/wrapper'.$url;
             $isexttool = 1;              $isexttool = 1;
         }          }
Line 4197  $form_end; Line 4210  $form_end;
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,                  &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,undef,undef,undef,                                                       undef,undef,undef,undef,undef,undef,
                                                      undef,$disabled);                                                       undef,$disabled);
         } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {          } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/ext\.tool$}) {
             ($editlink,$extresform) =              ($editlink,$extresform) =
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,                  &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,'tool',$coursedom,                                                       undef,undef,undef,'tool',$coursedom,
Line 4412  sub new_timebased_suffix { Line 4425  sub new_timebased_suffix {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new folder/page.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new folder/page.');
         } elsif ($type eq 'smppg') {          } elsif ($type eq 'smppg') {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new simple page.');
           } elsif ($type eq 'exttool') {
               $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new external tool.');
         } else {          } else {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');
         }          }
Line 4440  sub new_timebased_suffix { Line 4455  sub new_timebased_suffix {
         } elsif ($type eq 'smppg') {          } elsif ($type eq 'smppg') {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional simple pages in this course.');                  &mt('This will prevent creation of additional simple pages in this course.');
           } elsif ($type eq 'exttool') {
               $locknotfreed .=
                   &mt('This will prevent creation of additional external tools in this course.');
         } else {          } else {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional discussion boards in this course.');                  &mt('This will prevent creation of additional discussion boards in this course.');

Removed from v.1.623  
changed lines
  Added in v.1.626


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