File:  [LON-CAPA] / loncom / interface / londocs.pm
Revision 1.124: download - view: text, annotated - select for diffs
Thu May 6 18:28:16 2004 UTC (20 years, 2 months ago) by www
Branches: MAIN
CVS tags: HEAD
Just saving my work.

    1: # The LearningOnline Network
    2: # Documents
    3: #
    4: # $Id: londocs.pm,v 1.124 2004/05/06 18:28:16 www Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: 
   29: package Apache::londocs;
   30: 
   31: use strict;
   32: use Apache::Constants qw(:common :http);
   33: use Apache::lonnet;
   34: use Apache::loncommon;
   35: use Apache::lonratedt;
   36: use Apache::lonratsrv;
   37: use Apache::lonxml;
   38: use Apache::loncreatecourse;
   39: use HTML::Entities;
   40: use GDBM_File;
   41: use Apache::lonlocal;
   42: 
   43: my $iconpath;
   44: 
   45: my %hash;
   46: 
   47: my $hashtied;
   48: my %alreadyseen=();
   49: 
   50: my $hadchanges;
   51: 
   52: # Available help topics
   53: 
   54: my %help=();
   55: 
   56: # Mapread read maps into lonratedt::global arrays 
   57: # @order and @resources, determines status
   58: # sets @order - pointer to resources in right order
   59: # sets @resources - array with the resources with correct idx
   60: #
   61: 
   62: sub mapread {
   63:     my ($coursenum,$coursedom,$map)=@_;
   64:     return
   65:       &Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
   66:                                 $map);
   67: }
   68: 
   69: sub storemap {
   70:     my ($coursenum,$coursedom,$map)=@_;
   71:     my ($outtext,$errtext)=
   72:       &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
   73:                                 $map,1);
   74:     if ($errtext) { return ($errtext,2); }
   75:     
   76:     $hadchanges=1;
   77:     return ($errtext,0);
   78: }
   79: 
   80: # ----------------------------------------- Return hash with valid author names
   81: 
   82: sub authorhosts {
   83:     my %outhash=();
   84:     my $home=0;
   85:     my $other=0;
   86:     foreach (keys %ENV) {
   87: 	if ($_=~/^user\.role\.(au|ca)\.(.+)$/) {
   88: 	    my $role=$1;
   89: 	    my $realm=$2;
   90: 	    my ($start,$end)=split(/\./,$ENV{$_});
   91: 	    if (($start) && ($start>time)) { next; }
   92: 	    if (($end) && (time>$end)) { next; }
   93: 	    my $ca; my $cd;
   94: 	    if ($1 eq 'au') {
   95: 		$ca=$ENV{'user.name'};
   96: 		$cd=$ENV{'user.domain'};
   97: 	    } else {
   98: 		($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/);
   99: 	    }
  100: 	    my $allowed=0;
  101: 	    my $myhome=&Apache::lonnet::homeserver($ca,$cd);
  102: 	    my @ids=&Apache::lonnet::current_machine_ids();
  103: 	    foreach my $id (@ids) { if ($id eq $myhome) { $allowed=1; } }
  104: 	    if ($allowed) {
  105: 		$home++;
  106: 		$outhash{'home_'.$ca.'@'.$cd}=1;
  107: 	    } else {
  108: 		$outhash{'otherhome_'.$ca.'@'.$cd}=$myhome;
  109: 		$other++;
  110: 	    }
  111: 	}
  112:     }
  113:     return ($home,$other,%outhash);
  114: }
  115: # ------------------------------------------------------ Generate "dump" button
  116: 
  117: sub dumpbutton {
  118:     my ($home,$other,%outhash)=&authorhosts();
  119:     if ($home+$other==0) { return ''; }
  120:     my $output='</td><td bgcolor="#DDDDCC">';
  121:     if ($home) {
  122: 	return '</td><td bgcolor="#DDDDCC">'.
  123: 	    '<input type="submit" name="dumpcourse" value="'.
  124: 	    &mt('Dump Course DOCS to Construction Space').'" />';
  125:     } else {
  126: 	return'</td><td bgcolor="#DDDDCC">'.
  127:      &mt('Dump Course DOCS to Construction Space: available on other servers');
  128:     }
  129: }
  130: 
  131: # -------------------------------------------------------- Actually dump course
  132: 
  133: sub dumpcourse {
  134:     my $r=shift;
  135:     $r->print('<html><head><title>Dump DOCS</title></head>'.
  136:         &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space').
  137: 	      '<form name="dumpdoc" method="post">');
  138:     my ($home,$other,%outhash)=&authorhosts();
  139:     unless ($home) { return ''; }
  140:     my $origcrsid=$ENV{'request.course.id'};
  141:     my %origcrsdata=&Apache::lonnet::coursedescription($origcrsid);
  142:     if (($ENV{'form.authorspace'}) && ($ENV{'form.authorfolder'}=~/\w/)) {
  143: # Do the dumping
  144: 	unless ($outhash{'home_'.$ENV{'form.authorspace'}}) { return ''; }
  145: 	my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});
  146: 	$r->print('<h3>'.&mt('Copying Files').'</h3>');
  147: 	my $title=$ENV{'form.authorfolder'};
  148: 	$title=~s/[^\w\/]+/\_/g;
  149: 	my %replacehash=();
  150: 	foreach (keys %ENV) {
  151: 	    if ($_=~/^form\.namefor\_(.+)/) {
  152: 		$replacehash{$1}=$ENV{$_};
  153: 	    }
  154: 	}
  155: 	my $crs='/uploaded/'.$ENV{'request.course.id'}.'/';
  156: 	$crs=~s/\_/\//g;
  157: 	foreach (keys %replacehash) {
  158: 	    my $newfilename=$title.'/'.$replacehash{$_};
  159: 	    $newfilename=~s/[^\w\/\.]+/\_/g;
  160: 	    my @dirs=split(/\//,$newfilename);
  161: 	    my $path='/home/'.$ca.'/public_html';
  162: 	    my $makepath=$path;
  163: 	    my $fail=0;
  164: 	    for (my $i=0;$i<$#dirs;$i++) {
  165: 		$makepath.='/'.$dirs[$i];
  166: 		unless (-e $makepath) { 
  167: 		    unless(mkdir($makepath,0777)) { $fail=1; } 
  168: 		}
  169: 	    }
  170: 	    $r->print('<br /><tt>'.$_.'</tt> => <tt>'.$newfilename.'</tt>: ');
  171: 	    if (my $fh=Apache::File->new('>'.$path.'/'.$newfilename)) {
  172: 		if ($_=~/\.(sequence|page|html|htm|xml|xhtml)$/) {
  173: 		    print $fh &Apache::loncreatecourse::rewritefile(
  174:          &Apache::loncreatecourse::readfile($ENV{'request.course.id'},$_),
  175: 				     (%replacehash,$crs => '')
  176: 								    );
  177: 		} else {
  178: 		    print $fh
  179:          &Apache::loncreatecourse::readfile($ENV{'request.course.id'},$_);
  180: 		       }
  181: 		$fh->close();
  182: 	    } else {
  183: 		$fail=1;
  184: 	    }
  185: 	    if ($fail) {
  186: 		$r->print('<font color="red">fail</font>');
  187: 	    } else {
  188: 		$r->print('<font color="green">ok</font>');
  189: 	    }
  190: 	}
  191:     } else {
  192: # Input form
  193: 	unless ($home==1) {
  194: 	    $r->print(
  195: 		      '<h3>'.&mt('Select the Construction Space').'</h3><select name="authorspace">');
  196: 	}
  197: 	foreach (sort keys %outhash) {
  198: 	    if ($_=~/^home_(.+)$/) {
  199: 		if ($home==1) {
  200: 		    $r->print(
  201: 		  '<input type="hidden" name="authorspace" value="'.$1.'" />');
  202: 		} else {
  203: 		    $r->print('<option value="'.$1.'">'.$_.'</option>');
  204: 		}
  205: 	    }
  206: 	}
  207: 	unless ($home==1) {
  208: 	    $r->print('</select>');
  209: 	}
  210: 	my $title=$origcrsdata{'description'};
  211: 	$title=~s/\s+/\_/gs;
  212: 	$title=~s/\W//gs;
  213: 	$r->print('<h3>'.&mt('Folder in Construction Space').'</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');
  214: 	&tiehash();
  215: 	$r->print('<h3>'.&mt('Filenames in Construction Space').'</h3><table border="2"><tr><th>'.&mt('Internal Filename').'</th><th>'.&mt('Title').'</th><th>'.&mt('Save as ...').'</th></tr>');
  216: 	foreach (&Apache::loncreatecourse::crsdirlist($origcrsid,'userfiles')) {
  217: 	    $r->print('<tr><td>'.$_.'</td>');
  218: 	    my ($ext)=($_=~/\.(\w+)$/);
  219: 	    my $title=$hash{'title_'.$hash{
  220: 		'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}};
  221: 	    $r->print('<td>'.($title?$title:'&nbsp;').'</td>');
  222: 	    unless ($title) {
  223: 		$title=$_;
  224: 	    }
  225: 	    $title=~s/\.(\w+)$//;
  226: 	    $title=~s/\W+/\_/gs;
  227: 	    $title.='.'.$ext;
  228: 	    $r->print("\n<td><input type='text' size='60' name='namefor_".$_."' value='".$title."' /></td></tr>\n");
  229: 	}
  230: 	$r->print("</table>\n");
  231: 	&untiehash();
  232: 	$r->print(
  233:   '<p><input type="submit" name="dumpcourse" value="'.&mt('Dump Course DOCS').'" /></p></form>');
  234:     }
  235: }
  236: 
  237: 
  238: # Imports the given (name, url) resources into the course
  239: # coursenum, coursedom, and folder must precede the list
  240: sub group_import {
  241:     my $coursenum = shift;
  242:     my $coursedom = shift;
  243:     my $folder = shift;
  244:     while (@_) {
  245: 	my $name = shift;
  246: 	my $url = shift;
  247: 	if ($url) {
  248: 	    my $idx = $#Apache::lonratedt::resources + 1;
  249: 	    $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=$idx;
  250: 	    my $ext = 'false';
  251: 	    if ($url=~/^http:\/\//) { $ext = 'true'; }
  252: 	    $url =~ s/:/\&colon;/g;
  253: 	    $name =~ s/:/\&colon;/g;
  254: 	    $Apache::lonratedt::resources[$idx] = 
  255: 		join ':', ($name, $url, $ext, 'normal', 'res');
  256: 	}
  257:     }
  258:     return &storemap($coursenum, $coursedom, $folder.'.sequence');
  259: }
  260: 
  261: sub breadcrumbs {
  262:     my ($where)=@_;
  263:     &Apache::lonhtmlcommon::clear_breadcrumbs();
  264:     my (@folders)=split('&',$ENV{'form.folderpath'});
  265:     my $folderpath;
  266:     while (@folders) {
  267: 	my $folder=shift(@folders);
  268: 	my $foldername=shift(@folders);
  269: 	if ($folderpath) {$folderpath.='&';}
  270: 	$folderpath.=$folder.'&'.$foldername;
  271: 	my $url='/adm/coursedocs?folderpath='.
  272: 	    &Apache::lonnet::escape($folderpath);
  273: 	    &Apache::lonhtmlcommon::add_breadcrumb(
  274: 		      {'href'=>$url,
  275: 		       'title'=>&Apache::lonnet::unescape($foldername),
  276: 		       'text'=>'<font size="+1">'.
  277: 			   &Apache::lonnet::unescape($foldername).'</font>'
  278: 		       });
  279: 		       
  280: 						 
  281:     }
  282:     return &Apache::lonhtmlcommon::breadcrumbs(undef,undef,undef,undef,undef,0);
  283: }
  284: 
  285: sub editor {
  286:     my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
  287: 
  288:     $r->print(&breadcrumbs($folder));
  289:     my $errtext='';
  290:     my $fatal=0;
  291:     ($errtext,$fatal)=
  292:           &mapread($coursenum,$coursedom,$folder.'.sequence');
  293:     if ($#Apache::lonratedt::order<1) {
  294:        	$Apache::lonratedt::order[0]=1;
  295:         $Apache::lonratedt::resources[1]='';
  296:     }
  297:     if ($fatal) {
  298: 	   $r->print('<p><font color="red">'.$errtext.'</font></p>');
  299:     } else {
  300: # ------------------------------------------------------------ Process commands
  301: 
  302: # ---------------- if they are for this folder and user allowed to make changes
  303: 	if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
  304: # set parameters and change order
  305: 	    if (defined($ENV{'form.setparms'})) {
  306: 		my $idx=$ENV{'form.setparms'};
  307: # set parameters
  308: 		if ($ENV{'form.randpick_'.$idx}) {
  309: 		    &Apache::lonratedt::storeparameter($idx,'parameter_randompick',$ENV{'form.randpick_'.$idx},'int_pos');
  310: 		} else {
  311: 		    &Apache::lonratedt::delparameter($idx,'parameter_randompick');
  312: 		}
  313: 		if ($ENV{'form.hidprs_'.$idx}) {
  314: 		    &Apache::lonratedt::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
  315: 		} else {
  316: 		    &Apache::lonratedt::delparameter($idx,'parameter_hiddenresource');
  317: 		}
  318: 		if ($ENV{'form.encprs_'.$idx}) {
  319: 		    &Apache::lonratedt::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
  320: 		} else {
  321: 		    &Apache::lonratedt::delparameter($idx,'parameter_encrypturl');
  322: 		}
  323: 
  324: 		if ($ENV{'form.newpos'}) {
  325: # change order
  326: 
  327: 		    my $newpos=$ENV{'form.newpos'}-1;
  328: 		    my $currentpos=$ENV{'form.currentpos'}-1;
  329: 		    $r->print('Sorting '.$idx.': '.$currentpos.' -> '.$newpos);
  330: 		}
  331: # store the changed version
  332: 
  333: 		($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
  334: 		if ($fatal) {
  335: 		    $r->print('<p><font color="red">'.$errtext.'</font></p>');
  336: 		    return;
  337: 		}
  338: 		
  339: 	    }
  340: 
  341: # upload a file, if present
  342:            if (($ENV{'form.uploaddoc.filename'}) &&
  343:                ($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
  344: 	    if ( ($folder=~/^$1/) || ($1 eq 'default') ) {
  345: # this is for a course, not a user, so set coursedoc flag
  346: # probably the only place in the system where this should be "1"
  347: 	      my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
  348:               my $ext='false';
  349:               if ($url=~/^http\:\/\//) { $ext='true'; }
  350:               $url=~s/\:/\&colon;/g;
  351: 	      my $comment=$ENV{'form.comment'};
  352:               $comment=~s/\</\&lt\;/g;
  353:               $comment=~s/\>/\&gt\;/g;
  354:               $comment=~s/\:/\&colon;/g;
  355:               if ($folder=~/^supplemental/) {
  356: 		  $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
  357: 		      $ENV{'user.domain'}.'___&&&___'.$comment;
  358:               }
  359:               my $newidx=$#Apache::lonratedt::resources+1;
  360:               $Apache::lonratedt::resources[$newidx]=
  361:                   $comment.':'.$url.':'.$ext.':normal:res';
  362:               $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=
  363:                                                               $newidx;       
  364: 
  365: 	      ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.sequence');
  366: 	      if ($fatal) {
  367: 		  $r->print('<p><font color="red">'.$errtext.'</font></p>');
  368: 		  return;
  369: 	      }
  370: 	     }
  371:             }
  372: 	    if ($ENV{'form.cmd'}) {
  373:                 my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
  374:                 if ($cmd eq 'del') {
  375: 		    for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
  376:                         $Apache::lonratedt::order[$i]=
  377:                           $Apache::lonratedt::order[$i+1];
  378:                     }
  379:                     $#Apache::lonratedt::order--;
  380:                 } elsif ($cmd eq 'up') {
  381: 		  if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) {
  382:                     my $i=$Apache::lonratedt::order[$idx-1];
  383:                     $Apache::lonratedt::order[$idx-1]=
  384: 			$Apache::lonratedt::order[$idx];
  385:                     $Apache::lonratedt::order[$idx]=$i;
  386: 		   }
  387:                 } elsif ($cmd eq 'down') {
  388: 		   if (defined($Apache::lonratedt::order[$idx+1])) {
  389:                     my $i=$Apache::lonratedt::order[$idx+1];
  390:                     $Apache::lonratedt::order[$idx+1]=
  391: 			$Apache::lonratedt::order[$idx];
  392:                     $Apache::lonratedt::order[$idx]=$i;
  393: 		   }
  394:                 } elsif ($cmd eq 'rename') {
  395:                     my ($rtitle,@rrest)=split(/\:/,
  396:                        $Apache::lonratedt::resources[
  397: 				       $Apache::lonratedt::order[$idx]]);
  398:                     my $comment=
  399:                      &HTML::Entities::decode($ENV{'form.title'});
  400:                     $comment=~s/\</\&lt\;/g;
  401:                     $comment=~s/\>/\&gt\;/g;
  402:                     $comment=~s/\:/\&colon;/g;
  403:                     $Apache::lonratedt::resources[
  404: 				       $Apache::lonratedt::order[$idx]]=
  405:                              $comment.':'.join(':',@rrest);
  406:                     
  407:                 }
  408: # Store the changed version
  409: 		($errtext,$fatal)=&storemap($coursenum,$coursedom,
  410: 					    $folder.'.sequence');
  411: 		if ($fatal) {
  412: 		    $r->print('<p><font color="red">'.$errtext.'</font></p>');
  413: 		    return;
  414: 		}
  415:             }
  416: # Group import/search
  417: 	    if ($ENV{'form.importdetail'}) {
  418: 		my @imports;
  419: 		foreach (split(/\&/,$ENV{'form.importdetail'})) {
  420: 		    if (defined($_)) {
  421: 			my ($name,$url)=split(/\=/,$_);
  422: 			$name=&Apache::lonnet::unescape($name);
  423: 			$url=&Apache::lonnet::unescape($url);
  424: 			push @imports, $name, $url;
  425: 		    }
  426: 		}
  427: # Store the changed version
  428: 		($errtext,$fatal)=group_import($coursenum, $coursedom, $folder,
  429: 					       @imports);
  430: 		if ($fatal) {
  431: 		    $r->print('<p><font color="red">'.$errtext.'</font></p>');
  432: 		    return;
  433: 		}
  434:             }
  435: # Loading a complete map
  436: 	   if (($ENV{'form.importmap'}) && ($ENV{'form.loadmap'})) {
  437: 	       foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) {
  438:                    my $idx=$#Apache::lonratedt::resources;
  439:                    $idx++;
  440:                    $Apache::lonratedt::resources[$idx]=$_;
  441:                    $Apache::lonratedt::order
  442: 		       [$#Apache::lonratedt::order+1]=$idx;
  443: 	       }
  444: 
  445: # Store the changed version
  446: 	       ($errtext,$fatal)=&storemap($coursenum,$coursedom,
  447: 					   $folder.'.sequence');
  448: 	       if ($fatal) {
  449: 		   $r->print('<p><font color="red">'.$errtext.'</font></p>');
  450: 		   return;
  451: 	       }
  452:            }
  453:        }
  454: # ---------------------------------------------------------------- End commands
  455: # ---------------------------------------------------------------- Print screen
  456:         my $idx=0;
  457:         $r->print('<table>');
  458:         foreach (@Apache::lonratedt::order) {
  459:            my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
  460:            unless ($name) {  $name=(split(/\//,$url))[-1]; }
  461:            unless ($name) { next; }
  462:            $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
  463:            $idx++;
  464:         }
  465:         $r->print('</table>');
  466:     }
  467: }
  468: 
  469: # --------------------------------------------------------------- An entry line
  470: 
  471: sub entryline {
  472:     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
  473:     $title=~s/\&colon\;/\:/g;
  474:     $title=&HTML::Entities::encode(&HTML::Entities::decode(
  475:      &Apache::lonnet::unescape($title)),'"<>&\'');
  476:     my $renametitle=$title;
  477:     my $foldertitle=$title;
  478:     my $orderidx=$Apache::lonratedt::order[$index];
  479:     if ($title=~ /^(\d+)___&amp;&amp;&amp;___(\w+)___&amp;&amp;&amp;___(\w+)___&amp;&amp;&amp;___(.*)$/	) { 
  480: 	$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
  481: 	$renametitle=$4;
  482: 	$title='<i>'.&Apache::lonlocal::locallocaltime($1).'</i> '.
  483: 	    &Apache::loncommon::plainname($2,$3).': <br />'.
  484: 	    $foldertitle;
  485:     }
  486:     $renametitle=~s/\&quot\;/\\\"/g;
  487:     my $line='<tr>';
  488: # Edit commands
  489:     my $folderpath;
  490:     if ($ENV{'form.folderpath'}) {
  491: 	$folderpath=&Apache::lonnet::escape($ENV{'form.folderpath'});
  492: 	# $htmlfoldername=&HTML::Entities::encode($ENV{'form.foldername'},'<>&"');
  493:     }
  494:     if ($allowed) {
  495: 	my $incindex=$index+1;
  496: 	my $selectbox='';
  497: 	if ($folder!~/^supplemental/) {
  498: 	    $selectbox=
  499: 		'<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
  500: 		'<select name="newpos" onChange="this.form.submit()">';
  501: 	    for (my $i=1;$i<=$#Apache::lonratedt::order+1;$i++) {
  502: 		if ($i==$incindex) {
  503: 		    $selectbox.='<option value="" selected="1">('.$i.')</option>';
  504: 		} else {
  505: 		    $selectbox.='<option value="'.$i.'">'.$i.'</option>';
  506: 		}
  507: 	    }
  508: 	    $selectbox.='</select>';
  509: 	}
  510: 	my %lt=&Apache::lonlocal::texthash(
  511:                 'up' => 'Move Up',
  512: 		'dw' => 'Move Down',
  513: 		'rm' => 'Remove',
  514: 		'rn' => 'Rename');
  515: 	$line.=(<<END);
  516: <form name="entry_$index" action="/adm/coursedocs" method="post">
  517: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
  518: <input type="hidden" name="setparms" value="$orderidx" />
  519: <td><table border='0' cellspacing='2' cellpadding='0'>
  520: <tr><td bgcolor="#DDDDDD">
  521: <a href='/adm/coursedocs?cmd=up_$index&folderpath=$folderpath'>
  522: <img src="${iconpath}move_up.gif" alt='$lt{'up'}' border='0' /></a></td></tr>
  523: <tr><td bgcolor="#DDDDDD">
  524: <a href='/adm/coursedocs?cmd=down_$index&folderpath=$folderpath'>
  525: <img src="${iconpath}move_down.gif" alt='$lt{'dw'}' border='0' /></a></td></tr>
  526: </table></td>
  527: <td>$selectbox
  528: </td><td bgcolor="#DDDDDD">
  529: <a href='javascript:removeres("$folderpath","$index","$renametitle");'>
  530: <font size="-2" color="#990000">$lt{'rm'}</font></a>
  531: <a href='javascript:changename("$folderpath","$index","$renametitle");'>
  532: <font size="-2" color="#009900">$lt{'rn'}</font></a></td>
  533: END
  534:     }
  535: # Figure out what kind of a resource this is
  536:     my ($extension)=($url=~/\.(\w+)$/);
  537:     my $uploaded=($url=~/^\/*uploaded\//);
  538:     my $icon=&Apache::loncommon::icon($url);
  539:     my $isfolder=0;
  540:     my $folderarg;
  541:     if ($uploaded) {
  542:        if ($extension eq 'sequence') {
  543: 	  $icon=$iconpath.'/folder_closed.gif';
  544:           $url=~/$coursenum\/([\/\w]+)\.sequence$/;
  545:           $url='/adm/coursedocs?';
  546: 	  $folderarg=$1;
  547:           $isfolder=1;
  548:        }
  549:     }
  550:     $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
  551:     if ((!$isfolder) && ($residx) && ($folder!~/supplemental/)) {
  552: 	my $symb=&Apache::lonnet::symbclean(
  553:           &Apache::lonnet::declutter('uploaded/'.
  554:            $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'.
  555:            $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.$folder.
  556:            '.sequence').
  557:            '___'.$residx.'___'.
  558: 	   &Apache::lonnet::declutter($url));
  559: 	(undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
  560: 	$url=&Apache::lonnet::clutter($url);
  561: 	$url.=(($url=~/\?/)?'&':'?').'symb='.&Apache::lonnet::escape($symb);
  562:     }
  563:     my $parameterset='&nbsp;';
  564:     if ($isfolder) {
  565: 	my $foldername=&Apache::lonnet::escape($foldertitle);
  566: 	my $folderpath=$ENV{'form.folderpath'};
  567: 	if ($folderpath) { $folderpath.='&' };
  568: 	$folderpath.=$folderarg.'&'.$foldername;
  569: 	$url.='folderpath='.&Apache::lonnet::escape($folderpath);
  570: 	$parameterset=&mt('Randomly Pick: ').
  571: 	    '<input type="text" size="4" name="randpick_'.$orderidx.'" value="'.
  572: 	    (&Apache::lonratedt::getparameter($orderidx,'parameter_randompick'))[0].'" />';
  573:     }
  574:     $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'"><img src="'.$icon.
  575: 	'" border="0"></a></td>'.
  576:         "<td bgcolor='#FFFFBB'><a href='$url'>$title</a></td>";
  577:     if (($allowed) && ($folder!~/^supplemental/)) {
  578:  	my %lt=&Apache::lonlocal::texthash(
  579:  			      'hd' => 'Hidden',
  580:  			      'ec' => 'URL hidden',
  581:  			      'sp' => 'Store Parameters');
  582: 	my $enctext=
  583: 	    ((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':'');
  584: 	my $hidtext=
  585: 	    ((&Apache::lonratedt::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':'');
  586: 	$line.=(<<ENDPARMS);
  587: <td bgcolor="#BBBBFF"><font size='-2'>
  588: <input type="checkbox" name="hidprs_$orderidx" $hidtext/> $lt{'hd'}</td>
  589: <td bgcolor="#BBBBFF"><font size='-2'>
  590: <input type="checkbox" name="encprs_$orderidx" $enctext/> $lt{'ec'}</td>
  591: <td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td>
  592: <td bgcolor="#BBBBFF"><font size='-2'>
  593: <input type="submit" value="$lt{'sp'}" />
  594: </font></td>
  595: ENDPARMS
  596:     }
  597:     $line.="</form></tr>";
  598:     return $line;
  599: }
  600: 
  601: # ---------------------------------------------------------------- tie the hash
  602: 
  603: sub tiehash {
  604:     $hashtied=0;
  605:     if ($ENV{'request.course.fn'}) {
  606:         if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
  607:             &GDBM_READER(),0640)) {
  608:                 $hashtied=1;
  609:         }
  610:     }    
  611: }
  612: 
  613: sub untiehash {
  614:     if ($hashtied) { untie %hash; }
  615:     $hashtied=0;
  616: }
  617: 
  618: # --------------------------------------------------------------- check on this
  619: 
  620: sub checkonthis {
  621:     my ($r,$url,$level,$title)=@_;
  622:     $alreadyseen{$url}=1;
  623:     $r->rflush();
  624:     if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
  625:        $r->print("\n<br />");
  626:        for (my $i=0;$i<=$level*5;$i++) {
  627:            $r->print('&nbsp;');
  628:        }
  629:        $r->print('<a href="'.$url.'" target="cat">'.
  630: 		 ($title?$title:$url).'</a> ');
  631:        if ($url=~/^\/res\//) {
  632: 	  my $result=&Apache::lonnet::repcopy(
  633:                               &Apache::lonnet::filelocation('',$url));
  634:           if ($result==OK) {
  635:              $r->print('<font color="green">'.&mt('ok').'</font>');
  636:              $r->rflush();
  637:              &Apache::lonnet::countacc($url);
  638:              $url=~/\.(\w+)$/;
  639:              if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
  640: 		 $r->print('<br />');
  641:                  $r->rflush();
  642:                  for (my $i=0;$i<=$level*5;$i++) {
  643:                      $r->print('&nbsp;');
  644:                  }
  645:                  $r->print('- '.&mt('Rendering').': ');
  646:                  my $oldpath=$ENV{'request.filename'};
  647:                  $ENV{'request.filename'}=&Apache::lonnet::filelocation('',$url);
  648:                  &Apache::lonxml::xmlparse($r,'web',
  649:                    &Apache::lonnet::getfile(
  650:                     &Apache::lonnet::filelocation('',$url)));
  651: 		 undef($Apache::lonhomework::parsing_a_problem);
  652: 		 $ENV{'request.filename'}=$oldpath;
  653:                  if (($Apache::lonxml::errorcount) ||
  654:                      ($Apache::lonxml::warningcount)) {
  655: 		     if ($Apache::lonxml::errorcount) {
  656:                         $r->print('<img src="/adm/lonMisc/bomb.gif" /><font color="red"><b>'.
  657: 			  $Apache::lonxml::errorcount.' '.
  658: 				  &mt('error(s)').'</b></font> ');
  659:                      }
  660: 		     if ($Apache::lonxml::warningcount) {
  661:                         $r->print('<font color="blue">'.
  662: 			  $Apache::lonxml::warningcount.' '.
  663: 				  &mt('warning(s)').'</font>');
  664:                      }
  665:                  } else {
  666:                      $r->print('<font color="green">'.&mt('ok').'</font>');
  667:                  }
  668:                  $r->rflush();
  669:              }
  670: 	     my $dependencies=
  671:                 &Apache::lonnet::metadata($url,'dependencies');
  672:              foreach (split(/\,/,$dependencies)) {
  673: 		 if (($_=~/^\/res\//) && (!$alreadyseen{$_})) {
  674:                     &checkonthis($r,$_,$level+1);
  675:                  }
  676:              }
  677:           } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {
  678:              $r->print('<font color="red"><b>'.&mt('connection down').'</b></font>');
  679:           } elsif ($result==HTTP_NOT_FOUND) {
  680: 	      unless ($url=~/\$/) {
  681: 		  $r->print('<font color="red"><b>'.&mt('not found').'</b></font>');
  682: 	      } else {
  683: 		  $r->print('<font color="yellow"><b>'.&mt('unable to verify variable URL').'</b></font>');
  684: 	      }
  685:           } else {
  686:              $r->print('<font color="red"><b>'.&mt('access denied').'</b></font>');
  687:           }
  688:       }
  689:    }
  690: }
  691: 
  692: 
  693: #
  694: # -------------------------------------------------------------- Verify Content
  695: # 
  696: sub verifycontent {
  697:    my $r=shift; 
  698:    my $loaderror=&Apache::lonnet::overloaderror($r);
  699:    if ($loaderror) { return $loaderror; }
  700: 
  701:    $r->print('<html><head><title>Verify Content</title></head>'.
  702:               &Apache::loncommon::bodytag('Verify Course Documents'));
  703:    $hashtied=0;
  704:    undef %alreadyseen;
  705:    %alreadyseen=();
  706:    &tiehash();
  707:    foreach (keys %hash) {
  708:        if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {
  709:            &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});
  710:        }
  711:    }
  712:    &untiehash();
  713:    $r->print('<h1>'.&mt('Done').'.</h1>'.'<a href="/adm/coursedocs">'.
  714: 	     &mt('Return to DOCS').'</a>');
  715: }
  716: 
  717: # -------------------------------------------------------------- Check Versions
  718: 
  719: sub checkversions {
  720:     my $r=shift;
  721:     $r->print('<html><head><title>Check Versions</title></head>'.
  722:               &Apache::loncommon::bodytag('Check Course Document Versions'));
  723:     my $header='';
  724:     my $startsel='';
  725:     my $monthsel='';
  726:     my $weeksel='';
  727:     my $daysel='';
  728:     my $allsel='';
  729:     my %changes=();
  730:     my $starttime=0;
  731:     my $haschanged=0;
  732:     my %setversions=&Apache::lonnet::dump('resourceversions',
  733: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
  734: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
  735: 
  736:     $hashtied=0;
  737:     &tiehash();
  738:     my %newsetversions=();
  739:     if ($ENV{'form.setmostrecent'}) {
  740: 	$haschanged=1;
  741: 	foreach (keys %hash) {
  742: 	    if ($_=~/^ids\_(\/res\/.+)$/) {
  743: 		$newsetversions{$1}='mostrecent';
  744: 	    }
  745: 	}
  746:     } elsif ($ENV{'form.setcurrent'}) {
  747: 	$haschanged=1;
  748: 	foreach (keys %hash) {
  749: 	    if ($_=~/^ids\_(\/res\/.+)$/) {
  750: 		my $getvers=&Apache::lonnet::getversion($1);
  751: 		if ($getvers>0) {
  752: 		    $newsetversions{$1}=$getvers;
  753: 		}
  754: 	    }
  755: 	}
  756:     } elsif ($ENV{'form.setversions'}) {
  757: 	$haschanged=1;
  758: 	foreach (keys %ENV) {
  759: 	    if ($_=~/^form\.set_version_(.+)$/) {
  760: 		my $src=$1;
  761: 		if (($ENV{$_}) && ($ENV{$_} ne $setversions{$src})) {
  762: 		    $newsetversions{$src}=$ENV{$_};
  763: 		}
  764: 	    }
  765: 	}
  766:     }
  767:     if ($haschanged) {
  768:         if (&Apache::lonnet::put('resourceversions',\%newsetversions,
  769: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
  770: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.num'}) eq 'ok') {		
  771: 	    $r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>');
  772: 	} else {
  773: 	    $r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>');
  774: 	}
  775: 	&changewarning($r,'');
  776:     }
  777:     if ($ENV{'form.timerange'} eq 'all') {
  778: # show all documents
  779: 	$header=&mt('All Documents in Course');
  780: 	$allsel=1;
  781: 	foreach (keys %hash) {
  782: 	    if ($_=~/^ids\_(\/res\/.+)$/) {
  783: 		my $src=$1;
  784: 		$changes{$src}=1;
  785: 	    }
  786: 	}
  787:     } else {
  788: # show documents which changed
  789: 	%changes=&Apache::lonnet::dump
  790: 	 ('versionupdate',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
  791:                      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
  792: 	my $firstkey=(keys %changes)[0];
  793: 	unless ($firstkey=~/^error\:/) {
  794: 	    unless ($ENV{'form.timerange'}) {
  795: 		$ENV{'form.timerange'}=604800;
  796: 	    }
  797: 	    my $seltext=&mt('during the last').' '.$ENV{'form.timerange'}.' '
  798: 		.&mt('seconds');
  799: 	    if ($ENV{'form.timerange'}==-1) {
  800: 		$seltext='since start of course';
  801: 		$startsel='selected';
  802: 		$ENV{'form.timerange'}=time;
  803: 	    }
  804: 	    $starttime=time-$ENV{'form.timerange'};
  805: 	    if ($ENV{'form.timerange'}==2592000) {
  806: 		$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  807: 		$monthsel='selected';
  808: 	    } elsif ($ENV{'form.timerange'}==604800) {
  809: 		$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  810: 		$weeksel='selected';
  811: 	    } elsif ($ENV{'form.timerange'}==86400) {
  812: 		$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
  813: 		$daysel='selected';
  814: 	    }
  815: 	    $header=&mt('Content changed').' '.$seltext;
  816: 	} else {
  817: 	    $header=&mt('No content modifications yet.');
  818: 	}
  819:     }
  820:     %setversions=&Apache::lonnet::dump('resourceversions',
  821: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
  822: 			  $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
  823:     my %lt=&Apache::lonlocal::texthash
  824: 	      ('st' => 'Version changes since start of Course',
  825: 	       'lm' => 'Version changes since last Month',
  826: 	       'lw' => 'Version changes since last Week',
  827: 	       'sy' => 'Version changes since Yesterday',
  828:                'al' => 'All Resources (possibly large output)',
  829: 	       'sd' => 'Display',
  830: 	       'fi' => 'File',
  831: 	       'md' => 'Modification Date',
  832:                'mr' => 'Most recently published Version',
  833: 	       've' => 'Version used in Course',
  834:                'vu' => 'Set Version to be used in Course',
  835: 'sv' => 'Set Versions to be used in Course according to Selections below',
  836: 'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
  837: 'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
  838: 	       'di' => 'Differences');
  839:     $r->print(<<ENDHEADERS);
  840: <form action="/adm/coursedocs" method="post">
  841: <input type="hidden" name="versions" value="1" />
  842: <input type="submit" name="setmostrecent" value="$lt{'sm'}" />
  843: <input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
  844: <select name="timerange">
  845: <option value='all' $allsel>$lt{'al'}</option>
  846: <option value="-1" $startsel>$lt{'st'}</option>
  847: <option value="2592000" $monthsel>$lt{'lm'}</option>
  848: <option value="604800" $weeksel>$lt{'lw'}</option>
  849: <option value="86400" $daysel>$lt{'sy'}</option>
  850: </select>
  851: <input type="submit" name="display" value="$lt{'sd'}" />
  852: <h3>$header</h3>
  853: <input type="submit" name="setversions" value="$lt{'sv'}" />
  854: <table border="0">
  855: ENDHEADERS
  856:     foreach (sort keys %changes) {
  857: 	if ($changes{$_}>$starttime) {
  858: 	    my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
  859: 	    my $currentversion=&Apache::lonnet::getversion($_);
  860: 	    if ($currentversion<0) {
  861: 		$currentversion=&mt('Could not be determined.');
  862: 	    }
  863: 	    my $linkurl=&Apache::lonnet::clutter($_);
  864: 	    $r->print(
  865: 		      '<tr><td colspan="5"><br /><br /><font size="+1"><b>'.
  866: 		      &Apache::lonnet::gettitle($linkurl).
  867:                       '</b></font></td></tr>'.
  868:                       '<tr><td>&nbsp;&nbsp;&nbsp;</td>'.
  869:                       '<td colspan="4">'.
  870:                       '<a href="'.$linkurl.'" target="cat">'.$linkurl.
  871: 		      '</a></td></tr>'.
  872:                       '<tr><td></td>'.
  873:                       '<td title="'.$lt{'md'}.'">'.
  874: 		      &Apache::lonlocal::locallocaltime(
  875:                            &Apache::lonnet::metadata($root.'.'.$extension,
  876:                                                      'lastrevisiondate')
  877:                                                         ).
  878:                       '</td>'.
  879:                       '<td title="'.$lt{'mr'}.'"><nobr>Most Recent: '.
  880:                       '<font size="+1">'.$currentversion.'</font>'.
  881:                       '</nobr></td>'.
  882:                       '<td title="'.$lt{'ve'}.'"><nobr>In Course: '.
  883:                       '<font size="+1">');
  884: # Used in course
  885: 	    my $usedversion=$hash{'version_'.$linkurl};
  886: 	    if (($usedversion) && ($usedversion ne 'mostrecent')) {
  887: 		$r->print($usedversion);
  888: 	    } else {
  889: 		$r->print($currentversion);
  890: 	    }
  891: 	    $r->print('</font></nobr></td><td title="'.$lt{'vu'}.'">'.
  892:                       '<nobr>Use: ');
  893: # Set version
  894: 	    $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
  895: 						      'set_version_'.$linkurl,
  896: 						      ('' => '',
  897: 						       'mostrecent' => 'most recent',
  898: 						       map {$_,$_} (1..$currentversion))));
  899: 	    $r->print('</nobr></td></tr><tr><td></td>');
  900: 	    my $lastold=1;
  901: 	    for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
  902: 		my $url=$root.'.'.$prevvers.'.'.$extension;
  903: 		if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
  904: 		    $starttime) {
  905: 		    $lastold=$prevvers;
  906: 		}
  907: 	    }
  908:             # 
  909:             # Code to figure out how many version entries should go in
  910:             # each of the four columns
  911:             my $entries_per_col = 0;
  912:             my $num_entries = ($currentversion-$lastold);
  913:             if ($num_entries % 4 == 0) {
  914:                 $entries_per_col = $num_entries/4;
  915:             } else {
  916:                 $entries_per_col = $num_entries/4 + 1;
  917:             }
  918:             my $entries_count = 0;
  919:             $r->print('<td valign="top"><font size="-2">'); 
  920:             my $cols_output = 1;
  921:             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
  922: 		my $url=$root.'.'.$prevvers.'.'.$extension;
  923: 		$r->print('<nobr><a href="'.&Apache::lonnet::clutter($url).
  924: 			  '">'.&mt('Version').' '.$prevvers.'</a> ('.
  925: 			  &Apache::lonlocal::locallocaltime(
  926:                                 &Apache::lonnet::metadata($url,
  927:                                                           'lastrevisiondate')
  928:                                                             ).
  929: 			  ')');
  930: 		if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
  931:                     $r->print(' <a href="/adm/diff?filename='.
  932: 			      &Apache::lonnet::clutter($root.'.'.$extension).
  933: 			      '&versionone='.$prevvers.
  934: 			      '">'.&mt('Diffs').'</a>');
  935: 		}
  936: 		$r->print('</nobr><br />');
  937:                 if (++$entries_count % $entries_per_col == 0) {
  938:                     $r->print('</font></td>');
  939:                     if ($cols_output != 4) {
  940:                         $r->print('<td valign="top"><font size="-2">');
  941:                         $cols_output++;
  942:                     }
  943:                 }
  944: 	    }
  945:             while($cols_output++ < 4) {
  946:                 $r->print('</font></td><td><font>')
  947:             }
  948: 	    $r->print('</font></td></tr>'."\n");
  949: 	}
  950:     }
  951:     $r->print('</table></form>');
  952:     $r->print('<h1>'.&mt('Done').'.</h1>');
  953: 
  954:     &untiehash();
  955: }
  956: 
  957: sub changewarning {
  958:     my ($r,$postexec)=@_;
  959:     $r->print(
  960: '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. 
  961: '<form method="post" action="/adm/roles" target="loncapaclient">'.
  962: '<input type="hidden" name="orgurl" value="/adm/coursedocs?folderpath='.
  963: &Apache::lonnet::escape($ENV{'form.folderpath'}).
  964: '" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
  965: &mt('Changes will become active for your current session after').
  966: ' <input type="hidden" name="'.
  967: $ENV{'request.role'}.'" value="1" /><input type="button" value="'.
  968: &mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').
  969: $help{'Caching'}.'</font></h3></form>');
  970: }
  971: 
  972: # ================================================================ Main Handler
  973: sub handler {
  974:     my $r = shift;
  975:     &Apache::loncommon::content_type($r,'text/html');
  976:     $r->send_http_header;
  977:     return OK if $r->header_only;
  978: 
  979: # --------------------------------------------- Initialize help topics for this
  980:   foreach ('Adding_Course_Doc','Main_Course_Documents',
  981:            'Adding_External_Resource','Navigate_Content',
  982:            'Adding_Folders','Docs_Overview', 'Load_Map',
  983:            'Supplemental', 'Score_Upload_Form',
  984:            'Importing_LON-CAPA_Resource','Uploading_From_Harddrive') {
  985:       $help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_);
  986:   }
  987:     # Composite help files
  988:     $help{'Syllabus'} = &Apache::loncommon::help_open_topic(
  989: 		    'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
  990:     $help{'Simple Page'} = &Apache::loncommon::help_open_topic(
  991: 		    'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
  992:     $help{'Simple Problem'} = &Apache::loncommon::help_open_topic(
  993: 		    'Option_Response_Simple');
  994:     $help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
  995: 		    'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
  996:     $help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
  997: 		  'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
  998:     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
  999:  
 1000:   if ($ENV{'form.verify'}) {
 1001:       &verifycontent($r);
 1002:   } elsif ($ENV{'form.versions'}) {
 1003:       &checkversions($r);
 1004:   } elsif ($ENV{'form.dumpcourse'}) {
 1005:       &dumpcourse($r);
 1006:   } else {
 1007: # is this a standard course?
 1008: 
 1009:     my $standard=($ENV{'request.course.uri'}=~/^\/uploaded\//);
 1010:     my $forcestandard;
 1011:     my $forcesupplement;
 1012:     my $script='';
 1013:     my $allowed;
 1014:     my $events='';
 1015:     my $showdoc=0;
 1016:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 1017: 					    ['folderpath']);
 1018:     if ($ENV{'form.folderpath'}) {
 1019: 	my (@folderpath)=split('&',$ENV{'form.folderpath'});
 1020: 	$ENV{'form.foldername'}=&Apache::lonnet::unescape(pop(@folderpath));
 1021: 	$ENV{'form.folder'}=pop(@folderpath);
 1022:     } 
 1023:     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
 1024:        $showdoc=$1;
 1025:     }
 1026:     unless ($showdoc) { # got called from remote
 1027:        $forcestandard=($ENV{'form.folder'}=~/^default_/);
 1028:        $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
 1029: 
 1030: # does this user have privileges to post, etc?
 1031:        $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
 1032:        if ($allowed) { 
 1033:          &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
 1034:          $script=&Apache::lonratedt::editscript('simple'); 
 1035:        }
 1036:     } else { # got called in sequence from course
 1037:        $allowed=0;
 1038:        $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';
 1039:        $events='onLoad="'.&Apache::lonmenu::loadevents.
 1040:            '" onUnload="'.&Apache::lonmenu::unloadevents.'"';
 1041:     }
 1042: 
 1043: # get course data
 1044:     my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
 1045:     my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
 1046: 
 1047: # get personal data
 1048:  
 1049:     my $uname=$ENV{'user.name'};
 1050:     my $udom=$ENV{'user.domain'};
 1051:     my $plainname=&Apache::lonnet::escape(
 1052:                      &Apache::loncommon::plainname($uname,$udom));
 1053: 
 1054: # graphics settings
 1055: 
 1056:     $iconpath = $r->dir_config('lonIconsURL') . "/";
 1057: 
 1058:     my $now=time;
 1059: 
 1060: # print screen
 1061:     $r->print(<<ENDDOCUMENT);
 1062: <html>
 1063: <head>
 1064: <title>The LearningOnline Network with CAPA</title>
 1065: <script>
 1066: $script
 1067: </script>
 1068: ENDDOCUMENT
 1069:    if ($allowed) {
 1070:     $r->print(<<ENDNEWSCRIPT);
 1071: <script>
 1072: function makenewfolder(targetform,folderseq) {
 1073:     var foldername=prompt('Name of New Folder','New Folder');
 1074:     if (foldername) {
 1075: 	targetform.importdetail.value=foldername+"="+folderseq;
 1076:         targetform.submit();
 1077:     }
 1078: }
 1079: 
 1080: function makenewext(targetname) {
 1081:     this.document.forms.extimport.useform.value=targetname;
 1082:     window.open('/adm/rat/extpickframe.html');
 1083: }
 1084: 
 1085: function makeexamupload() {
 1086:    var title=prompt('Listed Title for the Uploaded Score');
 1087:    if (title) { 
 1088:     this.document.forms.newexamupload.importdetail.value=
 1089: 	title+'=/res/lib/templates/examupload.problem';
 1090:     this.document.forms.newexamupload.submit();
 1091:    }
 1092: }
 1093: 
 1094: function makesmppage() {
 1095:    var title=prompt('Listed Title for the Page');
 1096:    if (title) { 
 1097:     this.document.forms.newsmppg.importdetail.value=
 1098: 	title+'=/adm/$udom/$uname/$now/smppg';
 1099:     this.document.forms.newsmppg.submit();
 1100:    }
 1101: }
 1102: 
 1103: function makesmpproblem() {
 1104:    var title=prompt('Listed Title for the Problem');
 1105:    if (title) { 
 1106:     this.document.forms.newsmpproblem.importdetail.value=
 1107: 	title+'=/res/lib/templates/simpleproblem.problem';
 1108:     this.document.forms.newsmpproblem.submit();
 1109:    }
 1110: }
 1111: 
 1112: function makebulboard() {
 1113:    var title=prompt('Listed Title for the Bulletin Board');
 1114:    if (title) {
 1115:     this.document.forms.newbul.importdetail.value=
 1116: 	title+'=/adm/$udom/$uname/$now/bulletinboard';
 1117:     this.document.forms.newbul.submit();
 1118:    }
 1119: }
 1120: 
 1121: function makeabout() {
 1122:    var user=prompt("Enter user\@domain for User's 'About Me' Page");
 1123:    if (user) {
 1124:        var comp=new Array();
 1125:        comp=user.split('\@');
 1126:        if ((typeof(comp[0])!=undefined) && (typeof(comp[1])!=undefined)) {
 1127: 	   if ((comp[0]) && (comp[1])) {
 1128: 	       this.document.forms.newaboutsomeone.importdetail.value=
 1129: 		   'About '+user+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
 1130: 	       this.document.forms.newaboutsomeone.submit();
 1131: 	   }
 1132:        }
 1133:    }
 1134: }
 1135: 
 1136: function makeims() {
 1137:     var caller = document.forms.ims.folder.value
 1138:     var newlocation = "/adm/imsimportdocs?folder="+caller+"&phase=one"
 1139:     newWindow = window.open("","IMSimport","HEIGHT=700,WIDTH=750,scrollbars=yes")
 1140:     newWindow.location.href = newlocation
 1141: }
 1142: 
 1143: 
 1144: function finishpick() {
 1145:     var title=this.document.forms.extimport.title.value;
 1146:     var url=this.document.forms.extimport.url.value;
 1147:     var form=this.document.forms.extimport.useform.value;
 1148:     eval
 1149:      ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
 1150:     '";this.document.forms.'+form+'.submit();');
 1151: }
 1152: 
 1153: function changename(folderpath,index,oldtitle) {
 1154:     var title=prompt('New Title',oldtitle);
 1155:     if (title) {
 1156: 	this.document.forms.renameform.title.value=title;
 1157: 	this.document.forms.renameform.cmd.value='rename_'+index;
 1158: 	this.document.forms.renameform.folderpath.value=folderpath;
 1159:         this.document.forms.renameform.submit();
 1160:     }
 1161: }
 1162: 
 1163: function removeres(folderpath,index,oldtitle) {
 1164:     if (confirm('Remove "'+oldtitle+'"?')) {
 1165: 	this.document.forms.renameform.cmd.value='del_'+index;
 1166: 	this.document.forms.renameform.folderpath.value=folderpath;
 1167:         this.document.forms.renameform.submit();
 1168:     }
 1169: }
 1170: 
 1171: </script>
 1172: 
 1173: ENDNEWSCRIPT
 1174:   }
 1175: # -------------------------------------------------------------------- Body tag
 1176:   $r->print('</head>'.
 1177:             &Apache::loncommon::bodytag('Course Documents','',$events,
 1178: 					'','',$showdoc).
 1179: 	    &Apache::loncommon::help_open_faq(273).
 1180: 	    &Apache::loncommon::help_open_bug('RAT'));
 1181:   unless ($showdoc) {
 1182: # -----------------------------------------------------------------------------
 1183:        my %lt=&Apache::lonlocal::texthash(
 1184:                 'uplm' => 'Upload a new main course document',
 1185:                 'upls' => 'Upload a new supplemental course document',
 1186:                 'impp' => 'Import a published document',
 1187:                 'spec' => 'Special documents',
 1188:                 'upld' => 'Upload Document',
 1189:                 'srch' => 'Search',
 1190:                 'impo' => 'Import',
 1191:                 'selm' => 'Select Map',
 1192:                 'load' => 'Load Map',
 1193:                 'newf' => 'New Folder',
 1194:                 'extr' => 'External Resource',
 1195:                 'syll' => 'Syllabus',
 1196:                 'navc' => 'Navigate Contents',
 1197:                 'sipa' => 'Simple Page',
 1198:                 'sipr' => 'Simple Problem',
 1199:                 'scuf' => 'Score Upload Form',
 1200:                 'bull' => 'Bulletin Board',
 1201:                 'mypi' => 'My Personal Info',
 1202: 		'abou' => 'About User',
 1203:                 'imsf' => 'Import IMS package',
 1204:                 'file' =>  'File',
 1205:                 'title' => 'Title',
 1206:                 'comment' => 'Comment' 
 1207: 					  );
 1208: # -----------------------------------------------------------------------------
 1209:     if ($allowed) {
 1210:        my $dumpbut=&dumpbutton();
 1211:        my %lt=&Apache::lonlocal::texthash(
 1212: 					 'vc' => 'Verify Content',
 1213: 					 'cv' => 'Check/Set Resource Versions',
 1214: 					  );
 1215: 
 1216:        my $folderpath=$ENV{'form.folderpath'};
 1217:        if (!$folderpath) {
 1218: 	   if ($ENV{'form.folder'} eq '' ||
 1219: 	       $ENV{'form.folder'} eq 'supplemental') {
 1220: 	       $folderpath='default&'.
 1221: 		   &Apache::lonnet::escape(&mt('Main Course Documents'));
 1222: 	   }
 1223:        }
 1224:        $r->print(<<ENDCOURSEVERIFY);
 1225: <form name="renameform" method="post" action="/adm/coursedocs">
 1226: <input type="hidden" name="title" />
 1227: <input type="hidden" name="cmd" />
 1228: <input type="hidden" name="folderpath" />
 1229: </form>
 1230: <form name="simpleedit" method="post" action="/adm/coursedocs">
 1231: <input type=hidden name="importdetail" value="">
 1232: <input type="hidden" name="folderpath" value="$folderpath" />
 1233: </form>
 1234: <form action="/adm/coursedocs" method="post" name="courseverify">
 1235: <table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4">
 1236: <tr><td bgcolor="#DDDDCC">
 1237: <input type="submit" name="verify" value="$lt{'vc'}" />
 1238: </td><td bgcolor="#DDDDCC">
 1239: <input type="submit" name="versions" value="$lt{'cv'}" />
 1240: $dumpbut
 1241: </td></tr></table>
 1242: </form>
 1243: ENDCOURSEVERIFY
 1244:        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
 1245: 		     &mt('Editing the Table of Contents for your Course')));
 1246:     }
 1247: # --------------------------------------------------------- Standard documents
 1248:     $r->print('<table border=2 cellspacing=4 cellpadding=4>');
 1249:     if (($standard) && ($allowed) && (!$forcesupplement)) {
 1250: 	$r->print('<tr><td bgcolor="#BBBBBB">');
 1251: #  '<h2>'.&mt('Main Course Documents').
 1252: #  ($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>');
 1253:        my $folder=$ENV{'form.folder'};
 1254:        if ($folder eq '' || $folder eq 'supplemental') {
 1255:            $folder='default';
 1256: 	   $ENV{'form.folderpath'}='default&'.&Apache::lonnet::escape(&mt('Main Course Documents'));
 1257:        }
 1258:        my $postexec='';
 1259:        if ($folder eq 'default') {
 1260: 	   $r->print('<script>this.window.name="loncapaclient";</script>');
 1261:        } else {
 1262:            #$postexec='self.close();';
 1263:        }
 1264:        $hadchanges=0;
 1265:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
 1266:        if ($hadchanges) {
 1267: 	   &changewarning($r,$postexec);
 1268:        }
 1269:        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
 1270:                      '.sequence';
 1271:        $r->print(<<ENDFORM);
 1272: <table cellspacing=4 cellpadding=4><tr>
 1273: <th bgcolor="#DDDDDD">$lt{'uplm'}</th>
 1274: <th bgcolor="#DDDDDD">$lt{'impp'}</th>
 1275: <th bgcolor="#DDDDDD">$lt{'spec'}</th>
 1276: </tr>
 1277: <tr><td bgcolor="#DDDDDD">
 1278: $lt{'file'}:<br />
 1279: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
 1280: <input type="file" name="uploaddoc" size="40">
 1281: <br />
 1282: $lt{'title'}:<br />
 1283: <input type="text" size="50" name="comment">
 1284: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1285: <input type="hidden" name="cmd" value="upload_default">
 1286: <input type="submit" value="$lt{'upld'}">
 1287: <nobr>
 1288:  $help{'Uploading_From_Harddrive'}
 1289: </nobr>
 1290: </form>
 1291: </td>
 1292: <td bgcolor="#DDDDDD">
 1293: <form action="/adm/coursedocs" method="post" name="simpleeditdefault">
 1294: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1295: <input type=button onClick="javascript:groupsearch()" value="$lt{'srch'}">
 1296: <nobr>
 1297: <input type=button onClick="javascript:groupimport();" value="$lt{'impo'}">
 1298: $help{'Importing_LON-CAPA_Resource'}
 1299: </nobr>
 1300: <p>
 1301: <hr />
 1302: <input type="text" size="20" name="importmap"><br />
 1303: <nobr><input type=button 
 1304: onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
 1305: value="$lt{'selm'}"> <input type="submit" name="loadmap" value="$lt{'load'}">
 1306: $help{'Load_Map'}</nobr>
 1307: </p>
 1308: </form>
 1309: </td><td bgcolor="#DDDDDD">
 1310: <form action="/adm/coursedocs" method="post" name="newfolder">
 1311: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1312: <input type=hidden name="importdetail" value="">
 1313: <nobr>
 1314: <input name="newfolder" type="button"
 1315: onClick="javascript:makenewfolder(this.form,'$folderseq');"
 1316: value="$lt{'newf'}" />$help{'Adding_Folders'}
 1317: </nobr>
 1318: </form>
 1319: <form action="/adm/coursedocs" method="post" name="newext">
 1320: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1321: <input type=hidden name="importdetail" value="">
 1322: <nobr>
 1323: <input name="newext" type="button" onClick="javascript:makenewext('newext');"
 1324: value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
 1325: </nobr>
 1326: </form>
 1327: <form action="/adm/coursedocs" method="post" name="newsyl">
 1328: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1329: <input type=hidden name="importdetail" 
 1330: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
 1331: <nobr>
 1332: <input name="newsyl" type="submit" value="$lt{'syll'}" /> 
 1333:  $help{'Syllabus'}
 1334: </nobr>
 1335: </form>
 1336: <form action="/adm/coursedocs" method="post" name="newnav">
 1337: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1338: <input type=hidden name="importdetail" 
 1339: value="Navigate Content=/adm/navmaps">
 1340: <nobr>
 1341: <input name="newnav" type="submit" value="$lt{'navc'}" />
 1342: $help{'Navigate_Content'}
 1343: </nobr>
 1344: </form>
 1345: <form action="/adm/coursedocs" method="post" name="newsmppg">
 1346: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1347: <input type=hidden name="importdetail" value="">
 1348: <nobr>
 1349: <input name="newsmppg" type="button" value="$lt{'sipa'}"
 1350: onClick="javascript:makesmppage();" /> $help{'Simple Page'}
 1351: </nobr>
 1352: </form>
 1353: <form action="/adm/coursedocs" method="post" name="newsmpproblem">
 1354: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1355: <input type=hidden name="importdetail" value="">
 1356: <nobr>
 1357: <input name="newsmpproblem" type="button" value="$lt{'sipr'}"
 1358: onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
 1359: </nobr>
 1360: </form>
 1361: <form action="/adm/coursedocs" method="post" name="newexamupload">
 1362: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1363: <input type=hidden name="importdetail" value="">
 1364: <nobr>
 1365: <input name="newexamupload" type="button" value="$lt{'scuf'}"
 1366: onClick="javascript:makeexamupload();" />
 1367: $help{'Score_Upload_Form'}
 1368: </nobr>
 1369: </form>
 1370: <form action="/adm/coursedocs" method="post" name="newbul">
 1371: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1372: <input type=hidden name="importdetail" value="">
 1373: <nobr>
 1374: <input name="newbulletin" type="button" value="$lt{'bull'}"
 1375: onClick="javascript:makebulboard();" />
 1376: $help{'Bulletin Board'}
 1377: </nobr>
 1378: </form>
 1379: <form action="/adm/coursedocs" method="post" name="newaboutme">
 1380: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1381: <input type=hidden name="importdetail" 
 1382: value="$plainname=/adm/$udom/$uname/aboutme">
 1383: <nobr>
 1384: <input name="newaboutme" type="submit" value="$lt{'mypi'}" />
 1385: $help{'My Personal Info'}
 1386: </nobr>
 1387: </form>
 1388: <form action="/adm/coursedocs" method="post" name="newaboutsomeone">
 1389: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1390: <input type=hidden name="importdetail" value="">
 1391: <nobr>
 1392: <input name="newaboutsomeone" type="button" value="$lt{'abou'}" 
 1393: onClick="javascript:makeabout();" />
 1394: </nobr>
 1395: </form>
 1396: <form action="/adm/imsimportdocs" method="post" name="ims">
 1397: <input type="hidden" name="folder" value="$folder" />
 1398: <input name="imsimport" type="button" value="$lt{'imsf'}" onClick="javascript:makeims();" />
 1399: </nobr>
 1400: </form>
 1401: </td></tr>
 1402: </table>
 1403: ENDFORM
 1404:        $r->print('</td></tr>');
 1405:     }
 1406: # ----------------------------------------------------- Supplemental documents
 1407:     if (!$forcestandard) {
 1408:        $r->print('<tr><td bgcolor="#BBBBBB">');
 1409: # '<h2>'.&mt('Supplemental Course Documents').
 1410: #  ($allowed?' '.$help{'Supplemental'}:'').'</h2>');
 1411:        my $folder=$ENV{'form.folder'};
 1412:        unless ($folder=~/^supplemental/) {
 1413: 	   $folder='supplemental';
 1414:        }
 1415:        if ($folder =~ /^supplemental$/ &&
 1416: 	   $ENV{'form.folderpath'} =~ /^default\&/) {
 1417: 	   $ENV{'form.folderpath'}='supplemental&'.
 1418: 	       &Apache::lonnet::escape(&mt('Supplemental Course Documents'));
 1419:        }
 1420:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
 1421:        if ($allowed) {
 1422:        my $folderseq=
 1423:                   '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
 1424:                      '.sequence';
 1425: 
 1426:           $r->print(<<ENDSUPFORM);
 1427: <table cellspacing=4 cellpadding=4><tr>
 1428: <th bgcolor="#DDDDDD">$lt{'upls'}</th>
 1429: <th bgcolor="#DDDDDD">$lt{'spec'}</th>
 1430: </tr>
 1431: <tr><td bgcolor="#DDDDDD">
 1432: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
 1433: <input type="file" name="uploaddoc" size="40">
 1434: <br />$lt{'comment'}:<br />
 1435: <textarea cols=50 rows=4 name='comment'>
 1436: </textarea>
 1437: <br />
 1438: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1439: <input type="hidden" name="cmd" value="upload_supplemental">
 1440: <nobr>
 1441: <input type="submit" value="$lt{'upld'}">
 1442:  $help{'Uploading_From_Harddrive'}
 1443: </nobr>
 1444: </form>
 1445: </td>
 1446: <td bgcolor="#DDDDDD">
 1447: <form action="/adm/coursedocs" method="post" name="supnewfolder">
 1448: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1449: <input type=hidden name="importdetail" value="">
 1450: <nobr>
 1451: <input name="newfolder" type="button"
 1452: onClick="javascript:makenewfolder(this.form,'$folderseq');"
 1453: value="$lt{'newf'}" /> $help{'Adding_Folders'}
 1454: </nobr>
 1455: </form>
 1456: <form action="/adm/coursedocs" method="post" name="supnewext">
 1457: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1458: <input type=hidden name="importdetail" value="">
 1459: <nobr>
 1460: <input name="newext" type="button" 
 1461: onClick="javascript:makenewext('supnewext');"
 1462: value="$lt{'extr'}" /> $help{'Adding_External_Resource'}
 1463: </nobr>
 1464: </form>
 1465: <form action="/adm/coursedocs" method="post" name="supnewsyl">
 1466: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1467: <input type=hidden name="importdetail" 
 1468: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
 1469: <nobr>
 1470: <input name="newsyl" type="submit" value="$lt{'syll'}" />
 1471: $help{'Syllabus'}
 1472: </nobr>
 1473: </form>
 1474: <form action="/adm/coursedocs" method="post" name="subnewaboutme">
 1475: <input type="hidden" name="folderpath" value="$ENV{'form.folderpath'}" />
 1476: <input type=hidden name="importdetail" 
 1477: value="$plainname=/adm/$udom/$uname/aboutme">
 1478: <nobr>
 1479: <input name="newaboutme" type="submit" value="$lt{'mypi'}" />
 1480: $help{'My Personal Info'}
 1481: </nobr>
 1482: </form>
 1483: </td></tr>
 1484: </table></td></tr>
 1485: ENDSUPFORM
 1486:        }
 1487:     }
 1488:     if ($allowed) {
 1489: 	$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
 1490:     }
 1491:     $r->print('</table>');
 1492:   } else {
 1493: # -------------------------------------------------------- This is showdoc mode
 1494:       $r->print("<h1>".&mt('Uploaded Document').'</h1><p>'.
 1495: &mt('It is recommended that you use an up-to-date virus scanner before handling this file.')."</p><p><table>".
 1496:          &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>');
 1497:   }
 1498:  }
 1499:  $r->print('</body></html>');
 1500:  return OK;
 1501: } 
 1502: 
 1503: 1;
 1504: __END__

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