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

version 1.228, 2006/05/30 12:46:09 version 1.229, 2006/05/30 20:09:25
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';
       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 Course DOCS to Construction Space').'" />'.      &mt('Dump [_1] DOCS to Construction Space',$type).'" />'.
     &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 Course DOCS to Construction Space: available on other servers');       &mt('Dump [_1] DOCS to Construction Space: available on other servers',
            $type);
     }      }
 }  }
   
Line 143  sub clean { Line 148  sub clean {
   
 sub dumpcourse {  sub dumpcourse {
     my ($r) = @_;      my ($r) = @_;
       my $type = 'Course';
     $r->print(&Apache::loncommon::start_page('Dump Course DOCS to Construction Space').      if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
       '<form name="dumpdoc" method="post">');          $type = $env{'course.'.$env{'request.course.id'}.'.type'};
       }
       $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 246  sub dumpcourse { Line 254  sub dumpcourse {
  $r->print("</table>\n");   $r->print("</table>\n");
  &untiehash();   &untiehash();
  $r->print(   $r->print(
   '<p><input type="submit" name="dumpcourse" value="'.&mt('Dump Course DOCS').'" /></p></form>');    '<p><input type="submit" name="dumpcourse" value="'.&mt('Dump [_1] DOCS',$type).'" /></p></form>');
     }      }
 }  }
   
 # ------------------------------------------------------ Generate "export" button  # ------------------------------------------------------ Generate "export" button
   
 sub exportbutton {  sub exportbutton {
       my $type = 'Course';
       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 Course to IMS').'" />'.              &mt('Export [_1] to IMS',$type).'" />'.
     &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';
       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 301  sub exportcourse { Line 317  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 .= 'Download the zip file from <a href="'.$imszipfile.'">IMS course archive</a><br />';                  $outcome .= &mt('Download the zip file from <a href="[_1]">IMS [_2] archive</a><br />',$imszipfile,lc($type));
                 if ($copyresult) {                  if ($copyresult) {
                     $outcome .= 'The following errors occurred during export - '.$copyresult;                      $outcome .= 'The following errors occurred during export - '.$copyresult;
                 }                  }
Line 309  sub exportcourse { Line 325  sub exportcourse {
                 $outcome = '<br />Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.<br />';                  $outcome = '<br />Unfortunately you will not be able to retrieve an IMS archive of this posts at this time, because there was a problem creating a manifest file.<br />';
             }              }
         }          }
         $r->print(&Apache::loncommon::start_page('Export course to IMS content package'));          $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package'));
         $r->print($outcome);          $r->print($outcome);
         $r->print(&Apache::loncommon::end_page());          $r->print(&Apache::loncommon::end_page());
     } else {      } else {
         my $display;          my $display;
         $display = '<form name="exportdoc" method="post">'."\n";          $display = '<form name="exportdoc" method="post">'."\n";
         $display .= 'Choose which items you wish to export from your course.<br /><br />';          $display .= &mt('Choose which items you wish to export from your [_1].<br /><br />',$type);
         $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 449  function containerCheck(item) { Line 465  function containerCheck(item) {
   
 </script>  </script>
         |;          |;
  $r->print(&Apache::loncommon::start_page('Export course to IMS content package',   $r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package',
  $scripttag));   $scripttag));
  $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 Course DOCS').'" /></p></form>'.                    &mt('Export [_1] DOCS',$type).'" /></p></form>'.
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
     }      }
 }  }
Line 1764  sub list_symbs { Line 1780  sub list_symbs {
 #   # 
 sub verifycontent {  sub verifycontent {
     my ($r) = @_;      my ($r) = @_;
       my $type = 'Course';
       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 Course Documents'));     $r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents'));
    $hashtied=0;     $hashtied=0;
    undef %alreadyseen;     undef %alreadyseen;
    %alreadyseen=();     %alreadyseen=();
Line 1775  sub verifycontent { Line 1795  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 course: ').   &mt('The following sequence or page is included more than once in your [_1]: ',$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 1800  sub devalidateversioncache { Line 1820  sub devalidateversioncache {
   
 sub checkversions {  sub checkversions {
     my ($r) = @_;      my ($r) = @_;
     $r->print(&Apache::loncommon::start_page('Check Course Document Versions'));      my $type = 'Course';
       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"));
     my $header='';      my $header='';
     my $startsel='';      my $startsel='';
     my $monthsel='';      my $monthsel='';
Line 1861  sub checkversions { Line 1885  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 Course');   $header=&mt('All Documents in [_1]',$type);
  $allsel=1;   $allsel=1;
  foreach (keys %hash) {   foreach (keys %hash) {
     if ($_=~/^ids\_(\/res\/.+)$/) {      if ($_=~/^ids\_(\/res\/.+)$/) {
Line 1906  sub checkversions { Line 1930  sub checkversions {
   $env{'course.'.$env{'request.course.id'}.'.domain'},    $env{'course.'.$env{'request.course.id'}.'.domain'},
   $env{'course.'.$env{'request.course.id'}.'.num'});    $env{'course.'.$env{'request.course.id'}.'.num'});
     my %lt=&Apache::lonlocal::texthash      my %lt=&Apache::lonlocal::texthash
       ('st' => 'Version changes since start of Course',        ('st' => 'Version changes since start of '.$type,
        'lm' => 'Version changes since last Month',         'lm' => 'Version changes since last Month',
        'lw' => 'Version changes since last Week',         'lw' => 'Version changes since last Week',
        'sy' => 'Version changes since Yesterday',         'sy' => 'Version changes since Yesterday',
Line 1915  sub checkversions { Line 1939  sub checkversions {
        'fi' => 'File',         'fi' => 'File',
        'md' => 'Modification Date',         'md' => 'Modification Date',
                'mr' => 'Most recently published Version',                 'mr' => 'Most recently published Version',
        've' => 'Version used in Course',         've' => 'Version used in '.$type,
                'vu' => 'Set Version to be used in Course',                 'vu' => 'Set Version to be used in '.$type,
 'sv' => 'Set Versions to be used in Course according to Selections below',  'sv' => 'Set Versions to be used in '.$type.' according to Selections below',
 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',  'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',  'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
        'di' => 'Differences');         'di' => 'Differences');
Line 1964  ENDHEADERS Line 1988  ENDHEADERS
                       '<td title="'.$lt{'mr'}.'"><nobr>Most Recent: '.                        '<td title="'.$lt{'mr'}.'"><nobr>Most Recent: '.
                       '<font size="+1">'.$currentversion.'</font>'.                        '<font size="+1">'.$currentversion.'</font>'.
                       '</nobr></td>'.                        '</nobr></td>'.
                       '<td title="'.$lt{'ve'}.'"><nobr>In Course: '.                        '<td title="'.$lt{'ve'}.'"><nobr>In '.$type.': '.
                       '<font size="+1">');                        '<font size="+1">');
 # Used in course  # Used in course
     my $usedversion=$hash{'version_'.$linkurl};      my $usedversion=$hash{'version_'.$linkurl};
Line 2077  sub changewarning { Line 2101  sub changewarning {
  }   }
  $url='/adm/coursedocs?'.$pathvar.'='.$path;   $url='/adm/coursedocs?'.$pathvar.'='.$path;
     }      }
       my $crstype = 'course';
       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 2087  sub changewarning { Line 2115  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 course').'" onClick="reinit(this.form)" />').      &mt('re-initializing [_1]',$crstype).'" onClick="reinit(this.form)" />').
 $help{'Caching'}.'</font></h3></form>'."\n\n");  $help{'Caching'}.'</font></h3></form>'."\n\n");
 }  }
   
Line 2097  sub handler { Line 2125  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 = '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 2198  sub handler { Line 2232  sub handler {
     }      }
 # -------------------------------------------------------------------- Body tag  # -------------------------------------------------------------------- Body tag
     $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';      $script = '<script type="text/javascript">'."\n".$script."\n".'</script>';
     $r->print(&Apache::loncommon::start_page('Course Documents', $script,      $r->print(&Apache::loncommon::start_page("$type Documents", $script,
      {'force_register' => $showdoc,}).       {'force_register' => $showdoc,}).
       &Apache::loncommon::help_open_menu('','','','',273,'RAT'));        &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
       
Line 2287  sub handler { Line 2321  sub handler {
   unless ($showdoc ||  $upload_result eq 'phasetwo') {    unless ($showdoc ||  $upload_result eq 'phasetwo') {
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
        my %lt=&Apache::lonlocal::texthash(         my %lt=&Apache::lonlocal::texthash(
                 'uplm' => 'Upload a new main course document',                  'uplm' => 'Upload a new main '.lc($type).' document',
                 'upls' => 'Upload a new supplemental course document',                  'upls' => 'Upload a new supplemental '.lc($type).' document',
                 'impp' => 'Import a document',                  'impp' => 'Import a document',
                 'pubd' => 'Published documents',                  'pubd' => 'Published documents',
  'copm' => 'All documents out of a published map into this folder',   'copm' => 'All documents out of a published map into this folder',
Line 2332  sub handler { Line 2366  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 Course Documents'));     &escape(&mt('Main [_1] Documents',$type));
    }     }
        }         }
        unless ($env{'form.pagepath'}) {         unless ($env{'form.pagepath'}) {
Line 2365  $exportbut Line 2399  $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 Course')));       &mt('Editing the Table of Contents for your [_1]',$type)));
     }      }
 # --------------------------------------------------------- Standard documents  # --------------------------------------------------------- Standard documents
     $r->print('<table border=2 cellspacing=4 cellpadding=4>');      $r->print('<table border=2 cellspacing=4 cellpadding=4>');
Line 2376  ENDCOURSEVERIFY Line 2410  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 Course Documents'));     $env{'form.folderpath'}='default&'.&escape(&mt('Main [_1] Documents',$type));
        }         }
        my $postexec='';         my $postexec='';
        if ($folder eq 'default') {         if ($folder eq 'default') {
Line 2607  ENDBLOCK Line 2641  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 Course Documents'));         &escape(&mt('Supplemental [_1] Documents',$type));
        }         }
        &editor($r,$coursenum,$coursedom,$folder,$allowed);         &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($allowed) {         if ($allowed) {

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


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