Diff for /loncom/interface/londocs.pm between versions 1.484.2.35 and 1.552

version 1.484.2.35, 2013/05/27 00:07:52 version 1.552, 2013/07/09 00:17:22
Line 350  $initialtext Line 350  $initialtext
 </html>  </html>
 END  END
                 $env{'form.output'}=$newhtml;                  $env{'form.output'}=$newhtml;
                 my $result =                  my $result = 
                     &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,                      &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
                                                           'output',                                                            'output',
                                                           "$filepath/$residx/$fname.html");                                                            "$filepath/$residx/$fname.html");
Line 375  END Line 375  END
                           removefrommap => \%removefrommap,                            removefrommap => \%removefrommap,
                           removeparam   => \%removeparam,                            removeparam   => \%removeparam,
                       );                        );
         my ($result,$msgsarray,$lockerror) =          my ($result,$msgsarray,$lockerror) = 
             &apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated);              &apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated);
         if (keys(%import_errors) > 0) {          if (keys(%import_errors) > 0) {
             $fixuperrors =              $fixuperrors =
Line 1307  sub do_paste_from_buffer { Line 1307  sub do_paste_from_buffer {
                     next;                      next;
         }          }
                 if ($lockerr{$prefix}) {                  if ($lockerr{$prefix}) {
                     $lockerrs{$suffix} = $lockerr{$prefix};                      $lockerrs{$suffix} = $lockerr{$prefix};  
                 }                  }
             }              }
         }          }
Line 1346  sub do_paste_from_buffer { Line 1346  sub do_paste_from_buffer {
                     if ($newdocsdir eq '') {                      if ($newdocsdir eq '') {
                         $newdocsdir = 'default';                          $newdocsdir = 'default';
                     }                      }
                     if (($prefixchg{$suffix}) ||                      if (($prefixchg{$suffix}) || 
                         ($srcdom{$suffix} ne $coursedom) ||                           ($srcdom{$suffix} ne $coursedom) || 
                         ($srcnum{$suffix} ne $coursenum) ||                          ($srcnum{$suffix} ne $coursenum) ||
                         ($env{'form.docs.markedcopy_options_'.$suffix} ne 'move')) {                          ($env{'form.docs.markedcopy_options_'.$suffix} ne 'move')) {
Line 1553  sub dbcopy { Line 1553  sub dbcopy {
     if (ref($dbref) eq 'HASH') {      if (ref($dbref) eq 'HASH') {
         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$/) && 
                 ($dbref->{'cnum'} =~ /^$match_courseid$/)) {                  ($dbref->{'cnum'} =~ /^$match_courseid$/)) {
                 my $db_name;                  my $db_name;
                 my $marker = (split(m{/},$url))[4];                  my $marker = (split(m{/},$url))[4];
Line 1588  sub dbcopy { Line 1588  sub dbcopy {
                         my $photo = $contents{'uploaded.photourl'};                          my $photo = $contents{'uploaded.photourl'};
                         my ($subdir,$fname) =                          my ($subdir,$fname) =
                             ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});                              ($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});
                         my $newphoto;                          my $newphoto; 
                         if ($fname ne '') {                          if ($fname ne '') {
                             my $content = &Apache::lonnet::getfile($photo);                              my $content = &Apache::lonnet::getfile($photo);
                             unless ($content eq '-1') {                              unless ($content eq '-1') {
                                 $env{'form.'.$suffix.'.photourl'} = $content;                                  $env{'form.'.$suffix.'.photourl'} = $content;
                                 $newphoto =                                  $newphoto = 
                                     &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname");                                      &Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname");
                                 delete($env{'form.'.$suffix.'.photourl'});                                  delete($env{'form.'.$suffix.'.photourl'});
                             }                              }
Line 1610  sub dbcopy { Line 1610  sub dbcopy {
                     }                      }
                 }                  }
                 if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {                  if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {
                     $lockerrorsref->{$prefix} =                      $lockerrorsref->{$prefix} = 
                         '<div class="LC_error">'.                          '<div class="LC_error">'.
                         &mt('There was a problem removing a lockfile.');                          &mt('There was a problem removing a lockfile.');
                     if ($prefix eq 'smppg') {                      if ($prefix eq 'smppg') {
                         $lockerrorsref->{$prefix} .=                          $lockerrorsref->{$prefix} .= 
                             &mt('This will prevent creation of additional simple pages in this course.');                              &mt('This will prevent creation of additional simple pages in this course.');
                     } else {                      } else {
                         $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.');                          $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.');
Line 1736  sub url_paste_fixups { Line 1736  sub url_paste_fixups {
             }              }
             next if ($token->[2]->{'type'} eq 'external');              next if ($token->[2]->{'type'} eq 'external');
             if ($token->[2]->{'type'} eq 'zombie') {              if ($token->[2]->{'type'} eq 'zombie') {
                 next if ($skip);                  next if ($skip);  
                 $zombies->{$oldurl}{$id} = $ressrc;                  $zombies->{$oldurl}{$id} = $ressrc;
                 $changed = 1;                  $changed = 1;
             } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {              } elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {
Line 2182  sub update_parameter { Line 2182  sub update_parameter {
                          'randomorder'    => {},                           'randomorder'    => {},
                       );                        );
         foreach my $which (keys(%allchecked)) {          foreach my $which (keys(%allchecked)) {
             $env{'form.all'.$which} =~ s/,$//;              $env{'form.all'.$which} =~ s/,$//;   
             if ($which eq 'randompick') {              if ($which eq 'randompick') {
                 foreach my $item (split(/,/,$env{'form.all'.$which})) {                  foreach my $item (split(/,/,$env{'form.all'.$which})) {
                     my ($res,$value) = split(/:/,$item);                      my ($res,$value) = split(/:/,$item);
Line 2209  sub update_parameter { Line 2209  sub update_parameter {
             foreach my $which (keys(%allchecked)) {              foreach my $which (keys(%allchecked)) {
                 if (($which eq 'randompick' || $which eq 'randomorder')) {                  if (($which eq 'randompick' || $which eq 'randomorder')) {
                     next if (!$is_map);                      next if (!$is_map);
                 }                  } 
                 my $oldvalue = 0;                  my $oldvalue = 0;
                 my $newvalue = 0;                  my $newvalue = 0;
                 if ($allchecked{$which}{$res}) {                  if ($allchecked{$which}{$res}) {
Line 2668  sub editor { Line 2668  sub editor {
                     if (@allidx > 0) {                      if (@allidx > 0) {
                         my $path;                          my $path;
                         if ($env{'form.folderpath'}) {                          if ($env{'form.folderpath'}) {
                             $path =                              $path = 
                                 &HTML::Entities::encode($env{'form.folderpath'},'<>&"');                                  &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
                         }                          }
                         if (@allidx > 1) {                          if (@allidx > 1) {
                             $to_show .=                              $to_show .= 
                                 &Apache::loncommon::continue_data_table_row().                                  &Apache::loncommon::continue_data_table_row().
                                 '<td colspan="2">&nbsp;</td>'.                                  '<td colspan="2">&nbsp;</td>'.
                                 '<td>'.                                  '<td>'.
Line 2802  sub multiple_check_form { Line 2802  sub multiple_check_form {
 }  }
   
 sub process_file_upload {  sub process_file_upload {
     my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;      my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd,$crstype) = @_;
 # upload a file, if present  # upload a file, if present
       my $filesize = length($env{'form.uploaddoc'});
       if (!$filesize) {
           $$upload_output = '<div class="LC_error">'.
                              &mt('Unable to upload [_1]. (size = [_2] bytes)',
                             '<span class="LC_filename">'.$env{'form.uploaddoc.filename'}.'</span>',
                             $filesize).'<br />'.
                             &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').'<br />'.
                             '</div>';
           return;
       }
       my $quotatype = 'unofficial';
       if ($crstype eq 'Community') {
           $quotatype = 'community';    
       } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.instcode'}) {
           $quotatype = 'official';
       }
       if (&Apache::loncommon::get_user_quota($coursenum,$coursedom,'course',$quotatype)) {
           $filesize = int($filesize/1000); #expressed in kb
           $$upload_output = &Apache::loncommon::excess_filesize_warning($coursenum,$coursedom,'course',
                                                                         $env{'form.uploaddoc.filename'},$filesize,'upload');
           return if ($$upload_output);
       }
     my ($parseaction,$showupload,$nextphase,$mimetype);      my ($parseaction,$showupload,$nextphase,$mimetype);
     if ($env{'form.parserflag'}) {      if ($env{'form.parserflag'}) {
         $parseaction = 'parse';          $parseaction = 'parse';
Line 3264  $form_common."\n". Line 3286  $form_common."\n".
 $form_param."\n".  $form_param."\n".
 $form_common."\n".  $form_common."\n".
 '<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.' /> '.&mt('Random Order').' </label></span>'.  '<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.' /> '.&mt('Random Order').' </label></span>'.
 $form_end;  $form_end; 
         }          }
     } elsif ($supplementalflag && !$allowed) {      } elsif ($supplementalflag && !$allowed) {
         $url .= ($url =~ /\?/) ? '&amp;':'?';          $url .= ($url =~ /\?/) ? '&amp;':'?';
Line 3468  sub new_timebased_suffix { Line 3490  sub new_timebased_suffix {
         }          }
     }      }
     if ($freedlock ne 'ok') {      if ($freedlock ne 'ok') {
         $locknotfreed =          $locknotfreed = 
             '<div class="LC_error">'.              '<div class="LC_error">'.
             &mt('There was a problem removing a lockfile.').' ';              &mt('There was a problem removing a lockfile.').' ';
         if ($type eq 'paste') {          if ($type eq 'paste') {
Line 4027  sub startContentScreen { Line 4049  sub startContentScreen {
     if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {      if (($mode eq 'navmaps') || ($mode eq 'supplemental')) {
         $output .= '<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";          $output .= '<li'.(($mode eq 'navmaps')?' class="active"':'').'><a href="/adm/navmaps"><b>&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Overview').'&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
         $output .= '<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";          $output .= '<li'.(($mode eq 'coursesearch')?' class="active"':'').'><a href="/adm/searchcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Search').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
           $output .= '<li'.(($mode eq 'courseindex')?' class="active"':'').'><a href="/adm/indexcourse"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Index').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
         $output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>';          $output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/supplemental"><b>'.&mt('Supplemental Content').'</b></a></li>';
     } else {      } else {
         $output .= '<li '.(($mode eq 'docs')?' class="active"':'').' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Main Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";          $output .= '<li '.(($mode eq 'docs')?' class="active"':'').' id="tabbededitor"><a href="/adm/coursedocs?forcestandard=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Main Content Editor').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
Line 4357  sub handler { Line 4380  sub handler {
           # Process file upload - phase one - upload and parse primary file.            # Process file upload - phase one - upload and parse primary file.
   undef($hadchanges);    undef($hadchanges);
           $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,            $uploadphase = &process_file_upload(\$upload_output,$coursenum,$coursedom,
                                               \%allfiles,\%codebase,$context);                                                \%allfiles,\%codebase,$context,$crstype);
   if ($hadchanges) {    if ($hadchanges) {
       &mark_hash_old();        &mark_hash_old();
   }    }
Line 4422  sub handler { Line 4445  sub handler {
                 'navc' => 'Table of Contents',                  'navc' => 'Table of Contents',
                 'sipa' => 'Simple Course Page',                  'sipa' => 'Simple Course Page',
                 'sipr' => 'Simple Problem',                  'sipr' => 'Simple Problem',
                 'webp' => 'Blank Web Page (editable)',                  'webp' => 'Blank Web Page (editable)', 
                 'drbx' => 'Drop Box',                  'drbx' => 'Drop Box',
                 'scuf' => 'External Scores (handgrade, upload, clicker)',                  'scuf' => 'External Scores (handgrade, upload, clicker)',
                 'bull' => 'Discussion Board',                  'bull' => 'Discussion Board',
Line 5327  sub editing_js { Line 5350  sub editing_js {
                                           p_msb => 'Title for the Problem',                                            p_msb => 'Title for the Problem',
                                           p_mdb => 'Title for the Drop Box',                                            p_mdb => 'Title for the Drop Box',
                                           p_mbb => 'Title for the Discussion Board',                                            p_mbb => 'Title for the Discussion Board',
                                           p_mwp => 'Title for Web Page',                                            p_mwp => 'Title for Web Page', 
                                           p_mab => "Enter user:domain for User's Personal Information Page",                                            p_mab => "Enter user:domain for User's Personal Information Page",
                                           p_mab2 => 'Personal Information Page of ',                                            p_mab2 => 'Personal Information Page of ',
                                           p_mab_alrt1 => 'Not a valid user:domain',                                            p_mab_alrt1 => 'Not a valid user:domain',
Line 5441  function makewebpage(type) { Line 5464  function makewebpage(type) {
        formname = this.document.forms.newwebpage;         formname = this.document.forms.newwebpage;
    }     }
    if (title) {     if (title) {
        var webpage = formname.importdetail.value;         var webpage = formname.importdetail.value; 
        formname.importdetail.value = escape(title)+'='+webpage;         formname.importdetail.value = escape(title)+'='+webpage;
        formname.submit();         formname.submit();
    }     }

Removed from v.1.484.2.35  
changed lines
  Added in v.1.552


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