Diff for /loncom/interface/londocs.pm between versions 1.484.2.32 and 1.565

version 1.484.2.32, 2013/05/19 15:34:59 version 1.565, 2013/09/23 17:35:07
Line 56  my $hashtied; Line 56  my $hashtied;
 my %alreadyseen=();  my %alreadyseen=();
   
 my $hadchanges;  my $hadchanges;
   my $suppchanges;
   
   
 my %help=();  my %help=();
Line 79  sub storemap { Line 80  sub storemap {
       $map,1,$report);        $map,1,$report);
     if ($errtext) { return ($errtext,2); }      if ($errtext) { return ($errtext,2); }
   
     $hadchanges=1;      if ($map =~ /^default/) {
           $hadchanges=1;
       } else {
           $suppchanges=1;
       }
     return ($errtext,0);      return ($errtext,0);
 }  }
   
Line 350  $initialtext Line 355  $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 380  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 402  END Line 407  END
     }      }
     my ($errtext,$fatal) =      my ($errtext,$fatal) =
         &storemap($coursenum, $coursedom, $folder.'.'.$container,1);          &storemap($coursenum, $coursedom, $folder.'.'.$container,1);
       unless ($fatal) {
           if ($folder =~ /^supplemental/) {
               &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
               my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
                                               $folder.'.'.$container);
           }
       }
     return ($errtext,$fatal,$fixuperrors);      return ($errtext,$fatal,$fixuperrors);
 }  }
   
Line 488  sub docs_change_log { Line 500  sub docs_change_log {
     }      }
     my $folderpath=$env{'form.folderpath'};      my $folderpath=$env{'form.folderpath'};
     if ($folderpath eq '') {      if ($folderpath eq '') {
         $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Content').':::::');          $folderpath = 'default&'.&escape(&mt('Main Content').':::::');
     }      }
     $pathitem = '<input type="hidden" name="folderpath" value="'.      $pathitem = '<input type="hidden" name="folderpath" value="'.
                 &HTML::Entities::encode($folderpath,'<>&"').'" />';                  &HTML::Entities::encode($folderpath,'<>&"').'" />';
Line 700  sub update_paste_buffer { Line 712  sub update_paste_buffer {
              my $url = $env{'docs.markedcopy_url_'.$suffix};               my $url = $env{'docs.markedcopy_url_'.$suffix};
              if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&               if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
                  ($url ne '')) {                   ($url ne '')) {
                  $pasteurls{$cid.'_'.$url};                   $pasteurls{$cid.'_'.$url} = 1;
              }               }
         }          }
     }      }
Line 1097  sub do_paste_from_buffer { Line 1109  sub do_paste_from_buffer {
     }      }
   
     my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,      my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,
         %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult,          %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult);
         %msgs);  
   
     foreach my $suffix (@topaste) {      foreach my $suffix (@topaste) {
         my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});          my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});
Line 1299  sub do_paste_from_buffer { Line 1310  sub do_paste_from_buffer {
                     if ($prefix eq 'smppg') {                      if ($prefix eq 'smppg') {
                         $msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;                          $msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;
                     } elsif ($prefix eq 'bulletinboard') {                      } elsif ($prefix eq 'bulletinboard') {
                         $msg = &mt('Paste failed: An error occurred when copying the bulletin board.').' '.$errtext;                          $msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;
                     }                      }
                     $results{$suffix} = $result;                      $results{$suffix} = $result;
                     $msgerrs{$suffix} = $msg;                      $msgerrs{$suffix} = $msg;
Line 1307  sub do_paste_from_buffer { Line 1318  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 1357  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 1549  sub get_newmap_url { Line 1560  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);
     my $url = $dbref->{'src'};      $url = $dbref->{'src'};
     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 1574  sub dbcopy { Line 1585  sub dbcopy {
                     if ($prefix eq 'smppg') {                      if ($prefix eq 'smppg') {
                         $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);                          $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);
                     } else {                      } else {
                         $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a bulletin board [_1].',$url);                          $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url);
                     }                      }
                     if ($error) {                      if ($error) {
                         $errtext .= '<br />'.$error;                          $errtext .= '<br />'.$error;
Line 1588  sub dbcopy { Line 1599  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 1615  sub dbcopy { Line 1626  sub dbcopy {
                         &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 discussion boards in this course.');
                     }                      }
                     $lockerrorsref->{$prefix} .= &mt('Please contact the domain coordinator for your LON-CAPA domain.').'</div>';                      $lockerrorsref->{$prefix} .= ' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.',
                                                        '<a href="/adm/helpdesk" target="_helpdesk">','</a>').
                                                    '</div>';
                 }                  }
             }              }
         } elsif ($url =~ m{/syllabus$}) {          } elsif ($url =~ m{/syllabus$}) {
Line 1736  sub url_paste_fixups { Line 1749  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 2195  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 2222  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 2681  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 2704  sub editor { Line 2717  sub editor {
             }              }
             $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')              $to_show .= &Apache::loncommon::start_scrollbox('400px','380px','200px','contentscroll')
                        .'<div class="LC_info" id="contentlist">'                         .'<div class="LC_info" id="contentlist">'
                        .&mt('Currently no documents.')                         .&mt('Currently empty')
                        .'</div>'                         .'</div>'
                        .&Apache::loncommon::end_scrollbox();                         .&Apache::loncommon::end_scrollbox();
         }          }
Line 2717  sub editor { Line 2730  sub editor {
                       .'</div>';                        .'</div>';
         } else {          } else {
             $to_show = '<div class="LC_info" id="contentlist">'              $to_show = '<div class="LC_info" id="contentlist">'
                       .&mt('Currently no documents.')                        .&mt('Currently empty')
                       .'</div>'                        .'</div>'
         }          }
     }      }
Line 2802  sub multiple_check_form { Line 2815  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 3123  ENDREM Line 3158  ENDREM
                 push(@{$filtersref->{'canremove'}},$orderidx);                  push(@{$filtersref->{'canremove'}},$orderidx);
             }              }
         }          }
         unless ($isexternal) {          $renamelink=(<<ENDREN);
             $renamelink=(<<ENDREN);  
 <a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>  <a href='javascript:changename("$esc_path","$index","$renametitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN  ENDREN
         }  
  $line.=(<<END);   $line.=(<<END);
 <td>  <td>
 <div class="LC_docs_entry_move">  <div class="LC_docs_entry_move">
Line 3260  $form_common."\n". Line 3293  $form_common."\n".
                     push(@{$filtersref->{'randomorder'}},$orderidx);                      push(@{$filtersref->{'randomorder'}},$orderidx);
                 }                  }
             }              }
             my $formname = 'edit_rorder_'.$orderidx;              $formname = 'edit_rorder_'.$orderidx;
     $rand_order_text =       $rand_order_text = 
 '<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n".  '<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\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 3463  sub new_timebased_suffix { Line 3496  sub new_timebased_suffix {
         } 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.');
         } else {          } else {
             $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new bulletin board.');              $errtext = &mt('Failed to acquire a unique timestamp-based suffix for the new discussion board.');
         }          }
         if ($error) {          if ($error) {
             $errtext .= '<br />'.$error;              $errtext .= '<br />'.$error;
         }          }
     }      }
     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 3482  sub new_timebased_suffix { Line 3515  sub new_timebased_suffix {
                 &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 {
             $locknotfreed .=              $locknotfreed .=
                 &mt('This will prevent creation of additional bulletin boards in this course.');                  &mt('This will prevent creation of additional discussion boards in this course.');
         }          }
         unless ($type eq 'paste') {          unless ($type eq 'paste') {
             $locknotfreed .=              $locknotfreed .=
                 ' '.&mt('Please contact the domain coordinator for your LON-CAPA domain.');                  ' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.',
                           '<a href="/adm/helpdesk" target="_helpdesk">','</a>');
         }          }
         $locknotfreed .= '</div>';          $locknotfreed .= '</div>';
     }      }
Line 3651  sub list_symbs { Line 3685  sub list_symbs {
 sub verifycontent {  sub verifycontent {
     my ($r) = @_;      my ($r) = @_;
     my $crstype = &Apache::loncommon::course_type();      my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));      $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Content'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Content'));
     $r->print(&startContentScreen('tools'));      $r->print(&startContentScreen('tools'));
     $r->print('<h4 class="LC_info">'.&mt($crstype.' content verification').'</h4>');       $r->print('<h4 class="LC_info">'.&mt($crstype.' content verification').'</h4>'); 
    $hashtied=0;     $hashtied=0;
Line 3754  sub checkversions { Line 3788  sub checkversions {
     &changewarning($r,'');      &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {      if ($env{'form.timerange'} eq 'all') {
 # show all documents  # show all documents
  $header=&mt('All Documents in '.$crstype);   $header=&mt('All content in '.$crstype);
  $allsel=' selected="selected"';   $allsel=' selected="selected"';
  foreach my $key (keys(%hash)) {   foreach my $key (keys(%hash)) {
     if ($key=~/^ids\_(\/res\/.+)$/) {      if ($key=~/^ids\_(\/res\/.+)$/) {
Line 4029  sub startContentScreen { Line 4063  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('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";
         $output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Content Editor').'</b></a></li>'."\n";          $output .= '<li '.(($mode eq 'suppdocs')?' class="active"':'').'><a href="/adm/coursedocs?forcesupplement=1"><b>'.&mt('Supplemental Content Editor').'</b></a></li>'."\n";
         $output .= '<li '.(($mode eq 'tools')?' class="active"':'').'><a href="/adm/coursedocs?tools=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Utilities').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";          $output .= '<li '.(($mode eq 'tools')?' class="active"':'').'><a href="/adm/coursedocs?tools=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Utilities').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>'."\n";
                    '><a href="/adm/coursedocs?tools=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Utilities').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>';                     '><a href="/adm/coursedocs?tools=1"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&mt('Content Utilities').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></a></li>';
Line 4052  sub endContentScreen { Line 4087  sub endContentScreen {
 }  }
   
 sub supplemental_base {  sub supplemental_base {
     return 'supplemental&'.&escape(&mt('Supplemental '.&Apache::loncommon::course_type().' Content'));      return 'supplemental&'.&escape(&mt('Supplemental Content'));
 }  }
   
 sub handler {  sub handler {
Line 4077  sub handler { Line 4112  sub handler {
                'Supplemental','Score_Upload_Form','Adding_Pages',                 'Supplemental','Score_Upload_Form','Adding_Pages',
                'Importing_LON-CAPA_Resource','Importing_IMS_Course',                 'Importing_LON-CAPA_Resource','Importing_IMS_Course',
                        'Uploading_From_Harddrive',                         'Uploading_From_Harddrive',
                'Check_Resource_Versions','Verify_Content') {                 'Check_Resource_Versions','Verify_Content',
                          'Course_Roster','Web_Page','Dropbox') {
  $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);   $help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
     }      }
     # Composite help files      # Composite help files
Line 4093  sub handler { Line 4129  sub handler {
   'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');    'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
     $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');      $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');      $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
     $help{'Course Roster'} = &Apache::loncommon::help_open_topic('Docs_Course_Roster');  
     $help{'Web Page'} =  &Apache::loncommon::help_open_topic('Docs_Web_Page');  
     
     my $allowed;      my $allowed;
 # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.  # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
Line 4151  sub handler { Line 4185  sub handler {
 # supplementalflag=0: show standard documents  # supplementalflag=0: show standard documents
 # toolsflag=1: show utilities  # toolsflag=1: show utilities
   
     $env{'form.folderpath'} = &unescape($env{'form.folderpath'});      my $unesc_folderpath = &unescape($env{'form.folderpath'});
     my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);      my $supplementalflag=($unesc_folderpath=~/^supplemental/);
     if (($env{'form.folderpath'}=~/^default/) || ($env{'form.folderpath'} eq "")) {      if (($unesc_folderpath=~/^default/) || ($unesc_folderpath eq "")) {
        $supplementalflag=0;         $supplementalflag=0;
     }      }
     if ($env{'form.forcesupplement'}) { $supplementalflag=1; }      if ($env{'form.forcesupplement'}) { $supplementalflag=1; }
Line 4185  sub handler { Line 4219  sub handler {
        }         }
    } elsif ($env{'form.command'} eq 'editdocs') {     } elsif ($env{'form.command'} eq 'editdocs') {
        $env{'form.folderpath'} = 'default&'.         $env{'form.folderpath'} = 'default&'.
                                  &escape(&mt('Main '.$crstype.' Content').':::::');                                   &escape(&mt('Main Content').':::::');
        &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}});         &Apache::lonnet::appenv({'docs.exit.'.$env{'request.course.id'} => $env{'form.command'}});
    } elsif ($env{'form.command'} eq 'editsupp') {     } elsif ($env{'form.command'} eq 'editsupp') {
        $env{'form.folderpath'} = 'supplemental&'.         $env{'form.folderpath'} = 'supplemental&'.
Line 4230  sub handler { Line 4264  sub handler {
        if ($supplementalflag) {         if ($supplementalflag) {
           $env{'form.folderpath'}=&supplemental_base();            $env{'form.folderpath'}=&supplemental_base();
        } else {         } else {
           $env{'form.folderpath'}='default'.&escape(&mt('Main '.$crstype.' Content').            $env{'form.folderpath'}='default&'.&escape(&mt('Main Content').
                                   ':::::');                                    ':::::');
        }         }
     }      }
Line 4256  sub handler { Line 4290  sub handler {
             if ($env{'form.folder'} eq '' ||              if ($env{'form.folder'} eq '' ||
                 $env{'form.folder'} eq 'supplemental') {                  $env{'form.folder'} eq 'supplemental') {
                 $folderpath='default&'.                  $folderpath='default&'.
                             &escape(&mt('Main '.$crstype.' Content').':::::');                              &escape(&mt('Main Content').':::::');
             }              }
         }          }
         $containertag = '<input type="hidden" name="folderpath" value="" />';          $containertag = '<input type="hidden" name="folderpath" value="" />';
Line 4359  sub handler { Line 4393  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 4411  sub handler { Line 4445  sub handler {
        my %lt=&Apache::lonlocal::texthash(         my %lt=&Apache::lonlocal::texthash(
  'copm' => 'All documents out of a published map into this folder',   'copm' => 'All documents out of a published map into this folder',
                 'upfi' => 'Upload File',                  'upfi' => 'Upload File',
                 'upld' => 'Import Content',                  'upld' => 'Upload Content',
                 'srch' => 'Search',                  'srch' => 'Search',
                 'impo' => 'Import',                  'impo' => 'Import',
  'lnks' => 'Import from Stored Links',   'lnks' => 'Import from Stored Links',
Line 4424  sub handler { Line 4458  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 4432  sub handler { Line 4466  sub handler {
                 'grpo' => 'Group Portfolio',                  'grpo' => 'Group Portfolio',
                 'rost' => 'Course Roster',                  'rost' => 'Course Roster',
                 'abou' => 'Personal Information Page for a User',                  'abou' => 'Personal Information Page for a User',
                 'imsf' => 'IMS Import',                  'imsf' => 'IMS Upload',
                 'imsl' => 'Import IMS package',                  'imsl' => 'Upload IMS package',
                 'cms'  => 'Origin of IMS package',                  'cms'  => 'Origin of IMS package',
                 'se'   => 'Select',                  'se'   => 'Select',
                 'file' =>  'File',                  'file' =>  'File',
Line 4581  HIDDENFORM Line 4615  HIDDENFORM
        if ($folder eq '' || $supplementalflag) {         if ($folder eq '' || $supplementalflag) {
            $folder='default';             $folder='default';
    $savefolderpath = $env{'form.folderpath'};     $savefolderpath = $env{'form.folderpath'};
    $env{'form.folderpath'}='default&'.&escape(&mt('Content'));     $env{'form.folderpath'}='default&'.&escape(&mt('Main Content'));
            $pathitem = '<input type="hidden" name="folderpath" value="'.             $pathitem = '<input type="hidden" name="folderpath" value="'.
        &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';         &HTML::Entities::encode($env{'form.folderpath'},'<>&"').'" />';
        }         }
Line 4637  NSPROBFORM Line 4671  NSPROBFORM
  $pathitem   $pathitem
  <input type="hidden" name="importdetail" value="" />   <input type="hidden" name="importdetail" value="" />
  <a class="LC_menubuttons_link" href="javascript:makedropbox();">$lt{'drbx'}</a>   <a class="LC_menubuttons_link" href="javascript:makedropbox();">$lt{'drbx'}</a>
           $help{'Dropbox'}
  </form>   </form>
 NDBFORM  NDBFORM
   
Line 4687  NASOFORM Line 4722  NASOFORM
  <input type="hidden" name="importdetail"    <input type="hidden" name="importdetail" 
  value="$lt{'rost'}=/adm/viewclasslist" />   value="$lt{'rost'}=/adm/viewclasslist" />
  <a class="LC_menubuttons_link" href="javascript:document.newroster.submit()">$lt{'rost'}</a>   <a class="LC_menubuttons_link" href="javascript:document.newroster.submit()">$lt{'rost'}</a>
  $help{'Course Roster'}   $help{'Course_Roster'}
  </form>   </form>
 NROSTFORM  NROSTFORM
   
Line 4707  NROSTFORM Line 4742  NROSTFORM
         $pathitem          $pathitem
         <input type="hidden" name="importdetail" value="$newwebpage" />          <input type="hidden" name="importdetail" value="$newwebpage" />
         <a class="LC_menubuttons_link" href="javascript:makewebpage();">$lt{'webp'}</a>          <a class="LC_menubuttons_link" href="javascript:makewebpage();">$lt{'webp'}</a>
         $help{'Web Page'}          $help{'Web_Page'}
         </form>          </form>
 NWEBFORM  NWEBFORM
     
Line 4784  NGFFORM Line 4819  NGFFORM
             );              );
         }          }
         push(@importdoc,          push(@importdoc,
             {'<img class="LC_noBorder_LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform}              {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/pdfupload.png" alt="'.$lt{upl}.'" onclick="javascript:toggleUpload(\'doc\');" />'=>$fileuploadform}
         );          );
         $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc));          $fileuploadform =  &create_form_ul(&create_list_elements(@importdoc));
   
Line 4806  NGFFORM Line 4841  NGFFORM
         $communityform = &create_form_ul(&create_list_elements(@communityforma));          $communityform = &create_form_ul(&create_list_elements(@communityforma));
   
 my %orderhash = (  my %orderhash = (
                 'aa' => ['Import Content',$fileuploadform],                  'aa' => ['Upload',$fileuploadform],
                 'bb' => ['Published Content',$importpubform],                  'bb' => ['Import',$importpubform],
                 'cc' => ['Grading Resources',$gradingform],                  'cc' => ['Grading',$gradingform],
                 );                  );
 unless ($container eq 'page') {  unless ($container eq 'page') {
     $orderhash{'00'} = ['Newfolder',$newfolderform];      $orderhash{'00'} = ['Newfolder',$newfolderform];
     $orderhash{'dd'} = ['Collaboration',$communityform];      $orderhash{'dd'} = ['Collaboration',$communityform];
     $orderhash{'ee'} = ['Special Pages',$specialdocumentsform];      $orderhash{'ee'} = ['Other',$specialdocumentsform];
 }  }
   
  $hadchanges=0;   $hadchanges=0;
Line 4924  SNAMFORM Line 4959  SNAMFORM
         $pathitem          $pathitem
         <input type="hidden" name="importdetail" value="$supwebpage" />          <input type="hidden" name="importdetail" value="$supwebpage" />
         <a class="LC_menubuttons_link" href="javascript:makewebpage('supp');">$lt{'webp'}</a>          <a class="LC_menubuttons_link" href="javascript:makewebpage('supp');">$lt{'webp'}</a>
         $help{'Web Page'}          $help{'Web_Page'}
         </form>          </form>
 SWEBFORM  SWEBFORM
   
Line 4947  my @supimportdoc = ( Line 4982  my @supimportdoc = (
 $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));  $supupdocform =  &create_form_ul(&create_list_elements(@supimportdoc));
 my %suporderhash = (  my %suporderhash = (
  '00' => ['Supnewfolder', $supnewfolderform],   '00' => ['Supnewfolder', $supnewfolderform],
                 'ee' => ['Import Content',$supupdocform],                  'ee' => ['Upload',$supupdocform],
                 'ff' => ['Special Pages',&create_form_ul(&create_list_elements(@specialdocs))]                  'ff' => ['Other',&create_form_ul(&create_list_elements(@specialdocs))]
                 );                  );
         if ($supplementalflag) {          if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,             my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
                                $supplementalflag,\%suporderhash,$iconpath,$pathitem);                                 $supplementalflag,\%suporderhash,$iconpath,$pathitem);
            if ($error) {             if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');                $r->print('<p><span class="LC_error">'.$error.'</span></p>');
            }             } else {
                  if ($suppchanges) {
                      my %servers = &Apache::lonnet::internet_dom_servers($coursedom);
                      my @ids=&Apache::lonnet::current_machine_ids();
                      foreach my $server (keys(%servers)) {
                          next if (grep(/^\Q$server\E$/,@ids));
                          my $hashid=$coursenum.':'.$coursedom;
                          &Apache::lonnet::remote_devalidate_cache($server,'suppcount',$hashid);
                      }
                      &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
                      undef($suppchanges);
                  }  
              } 
         }          }
     } elsif ($supplementalflag) {      } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,          my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
Line 5102  sub remove_archive { Line 5149  sub remove_archive {
     } else {      } else {
         my $currcmd = $env{'form.cmd'};          my $currcmd = $env{'form.cmd'};
         my $position = $env{'form.position'};          my $position = $env{'form.position'};
         if ($position > 0) {           if ($position > 0) {
             $env{'form.cmd'} = 'del_'.$position;              $env{'form.cmd'} = 'remove_'.$position;
             my ($title,$url,@rrest) =               my ($title,$url,@rrest) = 
                 split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);                  split(/:/,$LONCAPA::map::resources[$LONCAPA::map::order[$position]]);
             if (&handle_edit_cmd($docuname,$docudom)) {              if (&handle_edit_cmd($docuname,$docudom)) {
Line 5138  sub generate_admin_menu { Line 5185  sub generate_admin_menu {
     my ($crstype) = @_;      my ($crstype) = @_;
     my $lc_crstype = lc($crstype);      my $lc_crstype = lc($crstype);
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     my %lt=&Apache::lonlocal::texthash (      my %lt= ( # do not translate here
                                          'vc'   => 'Verify Content',                                           'vc'   => 'Verify Content',
                                          'cv'   => 'Check/Set Resource Versions',                                           'cv'   => 'Check/Set Resource Versions',
                                          'ls'   => 'List Resource Identifiers',                                           'ls'   => 'List Resource Identifiers',
                                          'imse' => 'Export contents to IMS Archive',                                           'imse' => 'Export contents to IMS Archive',
                                          'dcd'  => "Dump $crstype Content to Authoring Space",                                           'dcd'  => "Dump $crstype Content to Authoring Space",
                                        );              );
     my ($candump,$dumpurl);      my ($candump,$dumpurl);
     if ($home + $other > 0) {      if ($home + $other > 0) {
         $candump = 'F';          $candump = 'F';
Line 5329  sub editing_js { Line 5376  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 5365  sub editing_js { Line 5412  sub editing_js {
         $main_container_page = 1;          $main_container_page = 1;
     }      }
     my $toplevelmain =       my $toplevelmain = 
         &escape(&mt('Main '.$crstype.' Content').':::::');          &escape(&mt('Main Content').':::::');
     my $toplevelsupp = &supplemental_base();      my $toplevelsupp = &supplemental_base();
   
     my $backtourl;      my $backtourl;
Line 5443  function makewebpage(type) { Line 5490  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.32  
changed lines
  Added in v.1.565


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