Diff for /loncom/interface/londocs.pm between versions 1.229 and 1.230

version 1.229, 2006/05/30 20:09:25 version 1.230, 2006/06/03 21:14:27
Line 121  sub authorhosts { Line 121  sub authorhosts {
   
 sub dumpbutton {  sub dumpbutton {
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
     if ($home+$other==0) { return ''; }      if ($home+$other==0) { return ''; }
     my $output='</td><td bgcolor="#DDDDCC">';      my $output='</td><td bgcolor="#DDDDCC">';
     if ($home) {      if ($home) {
  return '</td><td bgcolor="#DDDDCC">'.   return '</td><td bgcolor="#DDDDCC">'.
     '<input type="submit" name="dumpcourse" value="'.      '<input type="submit" name="dumpcourse" value="'.
     &mt('Dump [_1] DOCS to Construction Space',$type).'" />'.      &mt('Dump '.$type.' DOCS to Construction Space').'" />'.
     &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');      &Apache::loncommon::help_open_topic('Docs_Dump_Course_Docs');
     } else {      } else {
  return'</td><td bgcolor="#DDDDCC">'.   return'</td><td bgcolor="#DDDDCC">'.
      &mt('Dump [_1] DOCS to Construction Space: available on other servers',       &mt('Dump '.$type.
          $type);   ' DOCS to Construction Space: available on other servers');
     }      }
 }  }
   
Line 148  sub clean { Line 145  sub clean {
   
 sub dumpcourse {  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {      $r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space').
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};        '<form name="dumpdoc" method="post">');
     }  
     $r->print(&Apache::loncommon::start_page('Dump [_1] DOCS to Construction Space',  
       $type).'<form name="dumpdoc" method="post">');  
     my ($home,$other,%outhash)=&authorhosts();      my ($home,$other,%outhash)=&authorhosts();
     unless ($home) { return ''; }      unless ($home) { return ''; }
     my $origcrsid=$env{'request.course.id'};      my $origcrsid=$env{'request.course.id'};
Line 261  sub dumpcourse { Line 255  sub dumpcourse {
 # ------------------------------------------------------ Generate "export" button  # ------------------------------------------------------ Generate "export" button
   
 sub exportbutton {  sub exportbutton {
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
     return '</td><td bgcolor="#DDDDCC">'.      return '</td><td bgcolor="#DDDDCC">'.
             '<input type="submit" name="exportcourse" value="'.              '<input type="submit" name="exportcourse" value="'.
             &mt('Export [_1] to IMS',$type).'" />'.              &mt('Export '.$type.' to IMS').'" />'.
     &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');      &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
 }  }
   
 sub exportcourse {  sub exportcourse {
     my $r=shift;      my $r=shift;
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
     my %discussiontime = &Apache::lonnet::dump('discussiontimes',      my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                                $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});                                                 $env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
     my $numdisc = keys %discussiontime;      my $numdisc = keys %discussiontime;
Line 317  sub exportcourse { Line 305  sub exportcourse {
                 open(OUTPUT, "zip -r $imszip *  2> /dev/null |");                  open(OUTPUT, "zip -r $imszip *  2> /dev/null |");
                 close(OUTPUT);                  close(OUTPUT);
                 chdir $cwd;                  chdir $cwd;
                 $outcome .= &mt('Download the zip file from <a href="[_1]">IMS [_2] archive</a><br />',$imszipfile,lc($type));                  $outcome .= &mt('Download the zip file from <a href="[_1]">IMS '.lc($type).' archive</a><br />',$imszipfile,);
                 if ($copyresult) {                  if ($copyresult) {
                     $outcome .= 'The following errors occurred during export - '.$copyresult;                      $outcome .= 'The following errors occurred during export - '.$copyresult;
                 }                  }
Line 331  sub exportcourse { Line 319  sub exportcourse {
     } else {      } else {
         my $display;          my $display;
         $display = '<form name="exportdoc" method="post">'."\n";          $display = '<form name="exportdoc" method="post">'."\n";
         $display .= &mt('Choose which items you wish to export from your [_1].<br /><br />',$type);          $display .= &mt('Choose which items you wish to export from your '.$type.'.<br /><br />');
         $display .= '<table border="0" cellspacing="0" cellpadding="3">'.          $display .= '<table border="0" cellspacing="0" cellpadding="3">'.
                     '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.                      '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.
                     '<input type="button" value="check all" '.                      '<input type="button" value="check all" '.
Line 470  function containerCheck(item) { Line 458  function containerCheck(item) {
  $r->print($display.'</table>'.   $r->print($display.'</table>'.
                   '<p><input type="hidden" name="finishexport" value="1">'.                    '<p><input type="hidden" name="finishexport" value="1">'.
                   '<input type="submit" name="exportcourse" value="'.                    '<input type="submit" name="exportcourse" value="'.
                   &mt('Export [_1] DOCS',$type).'" /></p></form>'.                    &mt('Export '.$type.' DOCS').'" /></p></form>'.
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
     }      }
 }  }
Line 1780  sub list_symbs { Line 1768  sub list_symbs {
 #   # 
 sub verifycontent {  sub verifycontent {
     my ($r) = @_;      my ($r) = @_;
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
    my $loaderror=&Apache::lonnet::overloaderror($r);     my $loaderror=&Apache::lonnet::overloaderror($r);
    if ($loaderror) { return $loaderror; }     if ($loaderror) { return $loaderror; }
    $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));     $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
Line 1795  sub verifycontent { Line 1780  sub verifycontent {
        if ($hash{$_}=~/\.(page|sequence)$/) {         if ($hash{$_}=~/\.(page|sequence)$/) {
    if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) {     if (($_=~/^src_/) && ($alreadyseen{&unescape($hash{$_})})) {
        $r->print('<hr /><font color="red">'.         $r->print('<hr /><font color="red">'.
  &mt('The following sequence or page is included more than once in your [_1]: ',$type).   &mt('The following sequence or page is included more than once in your '.$type.': ').
  &unescape($hash{$_}).'</font><br />'.   &unescape($hash{$_}).'</font><br />'.
  &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));   &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
    }     }
Line 1820  sub devalidateversioncache { Line 1805  sub devalidateversioncache {
   
 sub checkversions {  sub checkversions {
     my ($r) = @_;      my ($r) = @_;
     my $type = 'Course';      my $type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
     $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));      $r->print(&Apache::loncommon::start_page("Check $type Document Versions"));
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
Line 1885  sub checkversions { Line 1867  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 [_1]',$type);   $header=&mt('All Documents in '.$type);
  $allsel=1;   $allsel=1;
  foreach (keys %hash) {   foreach (keys %hash) {
     if ($_=~/^ids\_(\/res\/.+)$/) {      if ($_=~/^ids\_(\/res\/.+)$/) {
Line 2101  sub changewarning { Line 2083  sub changewarning {
  }   }
  $url='/adm/coursedocs?'.$pathvar.'='.$path;   $url='/adm/coursedocs?'.$pathvar.'='.$path;
     }      }
     my $crstype = 'course';      my $course_type = &Apache::loncommon::course_type();
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
     if (!defined($message)) {      if (!defined($message)) {
  $message='Changes will become active for your current session after [_1], or the next time you log in.';   $message='Changes will become active for your current session after [_1], or the next time you log in.';
     }      }
Line 2115  sub changewarning { Line 2094  sub changewarning {
 '" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.  '" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
 &mt($message,' <input type="hidden" name="'.  &mt($message,' <input type="hidden" name="'.
     $env{'request.role'}.'" value="1" /><input type="button" value="'.      $env{'request.role'}.'" value="1" /><input type="button" value="'.
     &mt('re-initializing [_1]',$crstype).'" onClick="reinit(this.form)" />').      &mt('re-initializing '.$course_type).'" onClick="reinit(this.form)" />').
 $help{'Caching'}.'</font></h3></form>'."\n\n");  $help{'Caching'}.'</font></h3></form>'."\n\n");
 }  }
   
Line 2125  sub handler { Line 2104  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
 # Identify type - Course or Group.       my $type = &Apache::loncommon::course_type();
     my $type = 'Course';  
     if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {  
         $type = $env{'course.'.$env{'request.course.id'}.'.type'};  
     }  
   
   
 # --------------------------------------------- Initialize help topics for this  # --------------------------------------------- Initialize help topics for this
     foreach ('Adding_Course_Doc','Main_Course_Documents',      foreach ('Adding_Course_Doc','Main_Course_Documents',
Line 2366  sub handler { Line 2340  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 [_1] Documents',$type));     &escape(&mt('Main '.$type.' Documents'));
    }     }
        }         }
        unless ($env{'form.pagepath'}) {         unless ($env{'form.pagepath'}) {
Line 2399  $exportbut Line 2373  $exportbut
 </form>  </form>
 ENDCOURSEVERIFY  ENDCOURSEVERIFY
        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',         $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
      &mt('Editing the Table of Contents for your [_1]',$type)));       &mt('Editing the Table of Contents for your '.$type)));
     }      }
 # --------------------------------------------------------- Standard documents  # --------------------------------------------------------- Standard documents
     $r->print('<table border=2 cellspacing=4 cellpadding=4>');      $r->print('<table border=2 cellspacing=4 cellpadding=4>');
Line 2410  ENDCOURSEVERIFY Line 2384  ENDCOURSEVERIFY
        my $folder=$env{'form.folder'};         my $folder=$env{'form.folder'};
        if ($folder eq '' || $folder eq 'supplemental') {         if ($folder eq '' || $folder eq 'supplemental') {
            $folder='default';             $folder='default';
    $env{'form.folderpath'}='default&'.&escape(&mt('Main [_1] Documents',$type));     $env{'form.folderpath'}='default&'.&escape(&mt('Main '.$type.' Documents'));
        }         }
        my $postexec='';         my $postexec='';
        if ($folder eq 'default') {         if ($folder eq 'default') {
Line 2641  ENDBLOCK Line 2615  ENDBLOCK
        if ($folder =~ /^supplemental$/ &&         if ($folder =~ /^supplemental$/ &&
    $env{'form.folderpath'} =~ /^default\&/) {     $env{'form.folderpath'} =~ /^default\&/) {
    $env{'form.folderpath'}='supplemental&'.     $env{'form.folderpath'}='supplemental&'.
        &escape(&mt('Supplemental [_1] Documents',$type));         &escape(&mt('Supplemental '.$type.' Documents'));
        }         }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);         &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($allowed) {         if ($allowed) {

Removed from v.1.229  
changed lines
  Added in v.1.230


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