Diff for /loncom/interface/londocs.pm between versions 1.124 and 1.141

version 1.124, 2004/05/06 18:28:16 version 1.141, 2004/09/09 18:56:01
Line 36  use Apache::lonratedt; Line 36  use Apache::lonratedt;
 use Apache::lonratsrv;  use Apache::lonratsrv;
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::loncreatecourse;  use Apache::loncreatecourse;
   use Apache::lonnavmaps;
 use HTML::Entities;  use HTML::Entities;
 use GDBM_File;  use GDBM_File;
 use Apache::lonlocal;  use Apache::lonlocal;
Line 121  sub dumpbutton { Line 122  sub dumpbutton {
     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 Course DOCS to Construction Space').'" />'.
       &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 Course DOCS to Construction Space: available on other servers');
Line 156  sub dumpcourse { Line 158  sub dumpcourse {
  $crs=~s/\_/\//g;   $crs=~s/\_/\//g;
  foreach (keys %replacehash) {   foreach (keys %replacehash) {
     my $newfilename=$title.'/'.$replacehash{$_};      my $newfilename=$title.'/'.$replacehash{$_};
     $newfilename=~s/[^\w\/\.]+/\_/g;      $newfilename=~s/[^\w\/\.\/]+/\_/g;
     my @dirs=split(/\//,$newfilename);      my @dirs=split(/\//,$newfilename);
     my $path='/home/'.$ca.'/public_html';      my $path='/home/'.$ca.'/public_html';
     my $makepath=$path;      my $makepath=$path;
Line 200  sub dumpcourse { Line 202  sub dumpcourse {
     $r->print(      $r->print(
   '<input type="hidden" name="authorspace" value="'.$1.'" />');    '<input type="hidden" name="authorspace" value="'.$1.'" />');
  } else {   } else {
     $r->print('<option value="'.$1.'">'.$_.'</option>');      $r->print('<option value="'.$1.'">'.$1.' - '.
         &Apache::loncommon::plainname(split(/\@/,$1)).'</option>');
  }   }
     }      }
  }   }
Line 223  sub dumpcourse { Line 226  sub dumpcourse {
  $title=$_;   $title=$_;
     }      }
     $title=~s/\.(\w+)$//;      $title=~s/\.(\w+)$//;
     $title=~s/\W+/\_/gs;      $title=~s/[^\w\/]+/\_/gs;
     $title.='.'.$ext;      $title.='.'.$ext;
     $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n");      $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n");
  }   }
Line 234  sub dumpcourse { Line 237  sub dumpcourse {
     }      }
 }  }
   
   # ------------------------------------------------------ Generate "export" button
   
   sub exportbutton {
       return '</td><td bgcolor="#DDDDCC">'.
               '<input type="submit" name="exportcourse" value="'.
               &mt('Export Course to IMS').'" />'.
               &Apache::loncommon::help_open_topic('Docs_Export_Course_Docs');
   }
   
   sub exportcourse {
       my $r=shift;
       my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                                  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
       my $numdisc = keys %discussiontime;
       my $navmap = Apache::lonnavmaps::navmap->new();
       my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
       my $curRes;
   
       &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                               ['finishexport']);
       if ($ENV{'form.finishexport'}) {
           &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                               ['archive','discussion']);
   
           my @exportitems = ();
           if (defined($ENV{'form.archive'})) {
               if (ref($ENV{'form.archive'}) eq 'ARRAY') {
                   @exportitems = @{$ENV{'form.archive'}};
               } else {
                   $exportitems[0] = $ENV{'form.archive'};
               }
           }
           my @discussions = ();
           if (defined($ENV{'form.discussion'})) {
               if (ref($ENV{'form.discussion'}) eq 'ARRAY') {
                   @discussions = $ENV{'form.discussion'};
               } else {
                   $discussions[0] = $ENV{'form.discussion'};
               }
           }
           my $curRes;
           my $count;
           my %symbs;
           my $display;
           while ($curRes = $it->next()) {
               if (ref($curRes)) {
                   $count ++;
                   $symbs{$count} = $curRes->symb();
                   if (grep/^$count$/,@exportitems) {
                       $display.= 'Export content item '.$curRes->title()."<br />\n";
                   }
                   if (grep/^$count$/,@discussions) {
                       $display.= 'Export discussion posts '.$curRes->title()."<br />\n";
                   }  
               }
           }
   
           $r->print('<html><head><title>Export Course</title></head>'.
               &Apache::loncommon::bodytag('Export course to IMS or SCORM content package'
   ));
   
           my $exportfile;
           $r->print($display);
           $r->print('</body></html>');
       } else {
           my $display;
           $display = '<form name="exportdoc" method="post">'."\n";
           $display .= 'Choose which items you wish to export from your course.<br /><br />';
           $display .= '<table border="0" cellspacing="0" cellpadding="3">'.
                       '<tr><td><fieldset><legend>&nbsp;<b>Content items</b></legend>'.
                       '<input type="button" value="check all" '.
                       'onclick="javascript:checkAll(document.exportdoc.archive)" />'.
                       '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
                       ' onclick="javascript:uncheckAll(document.exportdoc.archive)" /></fieldset></td>'.
                       '<td>&nbsp;</td><td>&nbsp;</td>'.
                       '<td align="right"><fieldset><legend>&nbsp;<b>Discussion posts'.
                       '</b></legend><input type="button" value="check all"'.
                       ' onclick="javascript:checkAll(document.exportdoc.discussion)" />'.
                       '&nbsp;&nbsp;<input type="button" value="uncheck all"'.
                       ' onclick="javascript:uncheckAll(document.exportdoc.discussion)" /></fieldset></td>'.
                       '</tr></table>';
           my $curRes;
           my $depth = 0;
           my $count = 0;
           my $boards = 0;
           my $startcount = 5;
           my %parent = ();
           my %children = ();
           my $lastcontainer = $startcount;
           my @bgcolors = ('#F6F6F6','#FFFFFF');
           $display .= '<table cellspacing="0"><tr>'.
               '<td><b>Export content item?<br /></b></td><td>&nbsp;</td><td align="right">'."\n";
           if ($numdisc > 0) {
               $display.='<b>Export&nbsp;discussion posts?</b>'."\n";
           }
           $display.='&nbsp;</td></tr>';
           while ($curRes = $it->next()) {
               if (ref($curRes)) {
                   $count ++;
               }
               if ($curRes == $it->BEGIN_MAP()) {
                   $depth++;
                   $parent{$depth} = $lastcontainer;
               }
               if ($curRes == $it->END_MAP()) {
                   $depth--;
                   $lastcontainer = $parent{$depth};
               }
               if (ref($curRes)) {
                   my $symb = $curRes->symb();
                   my $color = $count%2;
                   $display .='<tr bgcolor='.$bgcolors[$color].'><td>'."\n".
                       '<input type="checkbox" name="archive" value="'.$count.'" ';
                   if (($curRes->is_sequence()) || ($curRes->is_page())) {
                       my $checkitem = $count + $boards + $startcount;
                       $display .= 'onClick="javascript:propagateCheck('."'$checkitem'".')"';
                   }
                   $display .= ' />'."\n";
                   for (my $i=0; $i<$depth; $i++) {
                       $display .= '<img src="/adm/lonIcons/whitespace1.gif" width="25" height="1" alt="" border="0" /><img src="/adm/lonIcons/whitespace1.gif" width="25" height="1" alt="" border="0" />'."\n";
                   }
                   if ($curRes->is_sequence()) {
                       $display .= '<img src="/adm/lonIcons/navmap.folder.open.gif">&nbsp;'."\n";
                       $lastcontainer = $count + $startcount + $boards;
                   } elsif ($curRes->is_page()) {
                       $display .= '<img src="/adm/lonIcons/navmap.page.open.gif">&nbsp;'."\n";
                       $lastcontainer = $count + $startcount + $boards;
                   }
                   my $currelem = $count+$boards+$startcount;
                   $children{$parent{$depth}} .= $currelem.':';
                   $display .= '&nbsp;'.$curRes->title().'</td>';
                   if ($discussiontime{$symb} > 0) {
                       $boards ++;
                       $currelem = $count+$boards+$startcount;
                       $display .= '<td>&nbsp;</td><td align="right"><input type="checkbox" name="discussion" value="'.$count.'" />&nbsp;</td>'."\n";
                   } else {
                       $display .= '<td colspan="2">&nbsp;</td>'."\n";
                   }
               }
           }
           my $scripttag = qq|
   <script>
   
   function checkAll(field) {
       for (i = 0; i < field.length; i++)
           field[i].checked = true ;
   }
   
   function uncheckAll(field) {
       for (i = 0; i < field.length; i++)
           field[i].checked = false ;
   }
   
   function propagateCheck(item) {
       if (document.exportdoc.elements[item].checked == true) {
           containerCheck(item)
       }
   } 
   
   function containerCheck(item) {
       document.exportdoc.elements[item].checked = true
       var numitems = $count + $boards + $startcount
       var parents = new Array(numitems)
       for (var i=$startcount; i<numitems; i++) {
           parents[i] = new Array
       }
           |;
   
           foreach my $container (sort { $a <=> $b } keys %children) {
               my @contents = split/:/,$children{$container};
               for (my $i=0; $i<@contents; $i ++) {
                   $scripttag .= '    parents['.$container.']['.$i.'] = '.$contents[$i]."\n";
               }
           }
   
           $scripttag .= qq|
       if (parents[item].length > 0) {
           for (var j=0; j<parents[item].length; j++) {
               containerCheck(parents[item][j])
           }
        }   
   }
   
   </script>
           |;
           $r->print('<html><head><title>Export Course</title>'.$scripttag.'</head>'.
               &Apache::loncommon::bodytag('Export course to IMS or SCORM content package'
   ));
   
           $r->print($display.'</table>'.
                     '<p><input type="hidden" name="finishexport" value="1">'.
                     '<input type="submit" name="exportcourse" value="'.
                     &mt('Export Course DOCS').'" /></p></form></body></html>');
       }
   }
   
   
 # Imports the given (name, url) resources into the course  # Imports the given (name, url) resources into the course
 # coursenum, coursedom, and folder must precede the list  # coursenum, coursedom, and folder must precede the list
Line 279  sub breadcrumbs { Line 478  sub breadcrumbs {
                 
       
     }      }
     return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,undef,undef,undef,0);      return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,undef,undef,undef,
          0,'nohelp');
 }  }
   
 sub editor {  sub editor {
Line 326  sub editor { Line 526  sub editor {
   
     my $newpos=$ENV{'form.newpos'}-1;      my $newpos=$ENV{'form.newpos'}-1;
     my $currentpos=$ENV{'form.currentpos'}-1;      my $currentpos=$ENV{'form.currentpos'}-1;
     $r->print('Sorting '.$idx.': '.$currentpos.' -> '.$newpos);      my $i;
       my @neworder=();
       if ($newpos>$currentpos) {
   # moving stuff up
    for ($i=0;$i<$currentpos;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i];
    }
    for ($i=$currentpos;$i<$newpos;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i+1];
    }
                           $neworder[$newpos]=$Apache::lonratedt::order[$currentpos];
    for ($i=$newpos+1;$i<=$#Apache::lonratedt::order;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i];
    }
       } else {
   # moving stuff down
    for ($i=0;$i<$newpos;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i];
    }
    $neworder[$newpos]=$Apache::lonratedt::order[$currentpos];
    for ($i=$newpos+1;$i<$currentpos+1;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i-1];
    }
    for ($i=$currentpos+1;$i<=$#Apache::lonratedt::order;$i++) {
       $neworder[$i]=$Apache::lonratedt::order[$i];
    }
       }
       @Apache::lonratedt::order=@neworder;
  }   }
 # store the changed version  # store the changed version
   
Line 344  sub editor { Line 571  sub editor {
     if ( ($folder=~/^$1/) || ($1 eq 'default') ) {      if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
 # this is for a course, not a user, so set coursedoc flag  # this is for a course, not a user, so set coursedoc flag
 # probably the only place in the system where this should be "1"  # probably the only place in the system where this should be "1"
       my $url=&Apache::lonnet::userfileupload('uploaddoc',1);        my $url=&Apache::lonnet::userfileupload('uploaddoc',1,'docs');
               my $ext='false';                my $ext='false';
               if ($url=~/^http\:\/\//) { $ext='true'; }                if ($url=~/^http\:\/\//) { $ext='true'; }
               $url=~s/\:/\&colon;/g;                $url=~s/\:/\&colon;/g;
Line 372  sub editor { Line 599  sub editor {
     if ($ENV{'form.cmd'}) {      if ($ENV{'form.cmd'}) {
                 my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});                  my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
                 if ($cmd eq 'del') {                  if ($cmd eq 'del') {
       my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]);
       if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) {
    &Apache::lonnet::removeuploadedurl($url);
       }
     for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {      for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
                         $Apache::lonratedt::order[$i]=                          $Apache::lonratedt::order[$i]=
                           $Apache::lonratedt::order[$i+1];                            $Apache::lonratedt::order[$i+1];
Line 462  sub editor { Line 693  sub editor {
            $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));             $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
            $idx++;             $idx++;
         }          }
    unless ($idx) {
       $r->print('<tr><td>'.&mt('Currently no documents.').'</td></tr>');
    }
         $r->print('</table>');          $r->print('</table>');
     }      }
 }  }
Line 539  END Line 773  END
     my $isfolder=0;      my $isfolder=0;
     my $folderarg;      my $folderarg;
     if ($uploaded) {      if ($uploaded) {
        if ($extension eq 'sequence') {   if ($extension eq 'sequence') {
   $icon=$iconpath.'/folder_closed.gif';      $icon=$iconpath.'/folder_closed.gif';
           $url=~/$coursenum\/([\/\w]+)\.sequence$/;      $url=~/$coursenum\/([\/\w]+)\.sequence$/;
           $url='/adm/coursedocs?';      $url='/adm/coursedocs?';
   $folderarg=$1;      $folderarg=$1;
           $isfolder=1;      $isfolder=1;
        }   } else {
       &Apache::lonnet::allowuploaded('/adm/coursedoc',$url);
    }
     }      }
     $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;      $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
     if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) {      if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) {
Line 558  END Line 794  END
    &Apache::lonnet::declutter($url));     &Apache::lonnet::declutter($url));
  (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);   (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
  $url=&Apache::lonnet::clutter($url);   $url=&Apache::lonnet::clutter($url);
    if ($url=~/^\/*uploaded\//) {
       $url=~/\.(\w+)$/;
       my $embstyle=&Apache::loncommon::fileembstyle($1);
       if (($embstyle eq 'img') || ($embstyle eq 'emb')) {
    $url='/adm/wrapper'.$url;
       } elsif ($embstyle eq 'ssi') {
    #do nothing with these
       } elsif ($url!~/\.(sequence|page)$/) {
    $url='/adm/coursedocs/showdoc'.$url;
       }
    }
  $url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);   $url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
     }      }
     my $parameterset='&nbsp;';      my $parameterset='&nbsp;';
Line 586  END Line 833  END
  $line.=(<<ENDPARMS);   $line.=(<<ENDPARMS);
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td>  <input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td>
 <td bgcolor="#BBBBFF"><font size='-2'>  <!--<td bgcolor="#BBBBFF"><font size='-2'>
 <input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td>  <input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td>-->
 <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>  <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
 <td bgcolor="#BBBBFF"><font size='-2'>  <td bgcolor="#BBBBFF"><font size='-2'>
 <input type="submit" value="$lt{'sp'}" />  <input type="submit" value="$lt{'sp'}" />
Line 601  ENDPARMS Line 848  ENDPARMS
 # ---------------------------------------------------------------- tie the hash  # ---------------------------------------------------------------- tie the hash
   
 sub tiehash {  sub tiehash {
       my ($mode)=@_;
     $hashtied=0;      $hashtied=0;
     if ($ENV{'request.course.fn'}) {      if ($ENV{'request.course.fn'}) {
         if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",   if ($mode eq 'write') {
             &GDBM_READER(),0640)) {      if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
       &GDBM_WRCREAT(),0640)) {
                   $hashtied=2;
       }
    } else {
       if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
       &GDBM_READER(),0640)) {
                 $hashtied=1;                  $hashtied=1;
         }      }
    }
     }          }    
 }  }
   
Line 619  sub untiehash { Line 874  sub untiehash {
   
 sub checkonthis {  sub checkonthis {
     my ($r,$url,$level,$title)=@_;      my ($r,$url,$level,$title)=@_;
       $url=&Apache::lonnet::unescape($url);
     $alreadyseen{$url}=1;      $alreadyseen{$url}=1;
     $r->rflush();      $r->rflush();
     if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {      if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
Line 705  sub verifycontent { Line 961  sub verifycontent {
    %alreadyseen=();     %alreadyseen=();
    &tiehash();     &tiehash();
    foreach (keys %hash) {     foreach (keys %hash) {
        if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {         if ($hash{$_}=~/\.(page|sequence)$/) {
      if (($_=~/^src_/) && ($alreadyseen{&Apache::lonnet::unescape($hash{$_})})) {
          $r->print('<hr /><font color="red">'.
    &mt('The following sequence or page is included more than once in your course: ').
    &Apache::lonnet::unescape($hash{$_}).'</font><br />'.
    &mt('Note that grading records for problems included in this sequence or folder will overlap.<hr />'));
      }
          }
          if (($_=~/^src\_(.+)$/) && (!$alreadyseen{&Apache::lonnet::unescape($hash{$_})})) {
            &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});             &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});
        }         }
    }     }
Line 772  sub checkversions { Line 1036  sub checkversions {
  } else {   } else {
     $r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>');      $r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>');
  }   }
  &changewarning($r,'');   &mark_hash_old();
     }      }
       &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 Course');
Line 893  ENDHEADERS Line 1158  ENDHEADERS
 # Set version  # Set version
     $r->print(&Apache::loncommon::select_form($setversions{$linkurl},      $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
       'set_version_'.$linkurl,        'set_version_'.$linkurl,
       ('' => '',        ('select_form_order' =>
          ['',1..$currentversion,'mostrecent'],
          '' => '',
        'mostrecent' => 'most recent',         'mostrecent' => 'most recent',
        map {$_,$_} (1..$currentversion))));         map {$_,$_} (1..$currentversion))));
     $r->print('</nobr></td></tr><tr><td></td>');      $r->print('</nobr></td></tr><tr><td></td>');
Line 954  ENDHEADERS Line 1221  ENDHEADERS
     &untiehash();      &untiehash();
 }  }
   
   sub mark_hash_old {
       my $retie_hash=0;
       if ($hashtied) {
    $retie_hash=1;
    &untiehash();
       }
       &tiehash('write');
       $hash{'old'}=1;
       &untiehash();
       if ($retie_hash) { &tiehash(); }
   }
   
   sub is_hash_old {
       my $untie_hash=0;
       if (!$hashtied) {
    $untie_hash=1;
    &tiehash();
       }
       my $return=$hash{'old'};
       if ($untie_hash) { &untiehash(); }
       return $return;
   }
   
 sub changewarning {  sub changewarning {
     my ($r,$postexec)=@_;      my ($r,$postexec)=@_;
       if (!&is_hash_old()) { return; }
     $r->print(      $r->print(
 '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'.   '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. 
 '<form method="post" action="/adm/roles" target="loncapaclient">'.  '<form method="post" action="/adm/roles" target="loncapaclient">'.
Line 981  sub handler { Line 1272  sub handler {
            'Adding_External_Resource','Navigate_Content',             'Adding_External_Resource','Navigate_Content',
            'Adding_Folders','Docs_Overview', 'Load_Map',             'Adding_Folders','Docs_Overview', 'Load_Map',
            'Supplemental', 'Score_Upload_Form',             'Supplemental', 'Score_Upload_Form',
            'Importing_LON-CAPA_Resource','Uploading_From_Harddrive') {             'Importing_LON-CAPA_Resource','Uploading_From_Harddrive',
      'Check_Resource_Versions','Verify_Content') {
       $help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_);        $help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_);
   }    }
     # Composite help files      # Composite help files
Line 1003  sub handler { Line 1295  sub handler {
       &checkversions($r);        &checkversions($r);
   } elsif ($ENV{'form.dumpcourse'}) {    } elsif ($ENV{'form.dumpcourse'}) {
       &dumpcourse($r);        &dumpcourse($r);
     } elsif ($ENV{'form.exportcourse'}) {
         &exportcourse($r);
   } else {    } else {
 # is this a standard course?  # is this a standard course?
   
Line 1021  sub handler { Line 1315  sub handler {
  $ENV{'form.folder'}=pop(@folderpath);   $ENV{'form.folder'}=pop(@folderpath);
     }       } 
     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {      if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
        $showdoc=$1;         $showdoc='/'.$1;
     }      }
     unless ($showdoc) { # got called from remote      unless ($showdoc) { # got called from remote
        $forcestandard=($ENV{'form.folder'}=~/^default_/);         $forcestandard=($ENV{'form.folder'}=~/^default_/);
Line 1176  ENDNEWSCRIPT Line 1470  ENDNEWSCRIPT
   $r->print('</head>'.    $r->print('</head>'.
             &Apache::loncommon::bodytag('Course Documents','',$events,              &Apache::loncommon::bodytag('Course Documents','',$events,
  '','',$showdoc).   '','',$showdoc).
     &Apache::loncommon::help_open_faq(273).      &Apache::loncommon::help_open_menu('','','','',273,'RAT'));
     &Apache::loncommon::help_open_bug('RAT'));  
   unless ($showdoc) {    unless ($showdoc) {
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
        my %lt=&Apache::lonlocal::texthash(         my %lt=&Apache::lonlocal::texthash(
Line 1208  ENDNEWSCRIPT Line 1501  ENDNEWSCRIPT
 # -----------------------------------------------------------------------------  # -----------------------------------------------------------------------------
     if ($allowed) {      if ($allowed) {
        my $dumpbut=&dumpbutton();         my $dumpbut=&dumpbutton();
          my $exportbut=&exportbutton();
        my %lt=&Apache::lonlocal::texthash(         my %lt=&Apache::lonlocal::texthash(
  'vc' => 'Verify Content',   'vc' => 'Verify Content',
  'cv' => 'Check/Set Resource Versions',   'cv' => 'Check/Set Resource Versions',
Line 1234  ENDNEWSCRIPT Line 1528  ENDNEWSCRIPT
 <form action="/adm/coursedocs" method="post" name="courseverify">  <form action="/adm/coursedocs" method="post" name="courseverify">
 <table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4">  <table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4">
 <tr><td bgcolor="#DDDDCC">  <tr><td bgcolor="#DDDDCC">
 <input type="submit" name="verify" value="$lt{'vc'}" />  <input type="submit" name="verify" value="$lt{'vc'}" />$help{'Verify_Content'}
 </td><td bgcolor="#DDDDCC">  </td><td bgcolor="#DDDDCC">
 <input type="submit" name="versions" value="$lt{'cv'}" />      <input type="submit" name="versions" value="$lt{'cv'}" />$help{'Check_Resource_Versions'}
 $dumpbut  $dumpbut
   $exportbut
 </td></tr></table>  </td></tr></table>
 </form>  </form>
 ENDCOURSEVERIFY  ENDCOURSEVERIFY
Line 1264  ENDCOURSEVERIFY Line 1559  ENDCOURSEVERIFY
        $hadchanges=0;         $hadchanges=0;
        &editor($r,$coursenum,$coursedom,$folder,$allowed);         &editor($r,$coursenum,$coursedom,$folder,$allowed);
        if ($hadchanges) {         if ($hadchanges) {
    &changewarning($r,$postexec);     &mark_hash_old()
        }         }
          &changewarning($r,$postexec);
        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.         my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
                      '.sequence';                       '.sequence';
        $r->print(<<ENDFORM);         $r->print(<<ENDFORM);
Line 1283  $lt{'title'}:<br /> Line 1579  $lt{'title'}:<br />
 <input type="text" size="50" name="comment">  <input type="text" size="50" name="comment">
 <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />  <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 <input type="hidden" name="cmd" value="upload_default">  <input type="hidden" name="cmd" value="upload_default">
 <input type="submit" value="$lt{'upld'}">  
 <nobr>  <nobr>
   <input type="submit" value="$lt{'upld'}">
  $help{'Uploading_From_Harddrive'}   $help{'Uploading_From_Harddrive'}
 </nobr>  </nobr>
 </form>  </form>
Line 1491  ENDSUPFORM Line 1787  ENDSUPFORM
     $r->print('</table>');      $r->print('</table>');
   } else {    } else {
 # -------------------------------------------------------- This is showdoc mode  # -------------------------------------------------------- This is showdoc mode
       $r->print("<h1>".&mt('Uploaded Document').'</h1><p>'.        $r->print("<h1>".&mt('Uploaded Document').' - '.
    &Apache::lonnet::gettitle($r->uri).'</h1><p>'.
 &mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><p><table>".  &mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><p><table>".
          &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>');           &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>');
   }    }

Removed from v.1.124  
changed lines
  Added in v.1.141


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