File:  [LON-CAPA] / loncom / interface / londocs.pm
Revision 1.77: download - view: text, annotated - select for diffs
Tue Sep 9 19:39:04 2003 UTC (20 years, 10 months ago) by www
Branches: MAIN
CVS tags: HEAD
Bug #2148: new "mdc" privilege to edit/modify DOCS

    1: # The LearningOnline Network
    2: # Documents
    3: #
    4: # $Id: londocs.pm,v 1.77 2003/09/09 19:39:04 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: 
   42: my $iconpath;
   43: 
   44: my %hash;
   45: 
   46: my $hashtied;
   47: my %alreadyseen=();
   48: 
   49: my $hadchanges;
   50: 
   51: # Available help topics
   52: 
   53: my %help=();
   54: 
   55: # Mapread read maps into lonratedt::global arrays 
   56: # @order and @resources, determines status
   57: # sets @order - pointer to resources in right order
   58: # sets @resources - array with the resources with correct idx
   59: #
   60: 
   61: sub mapread {
   62:     my ($coursenum,$coursedom,$map)=@_;
   63:     return
   64:       &Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
   65:                                 $map);
   66: }
   67: 
   68: sub storemap {
   69:     my ($coursenum,$coursedom,$map)=@_;
   70:     $hadchanges=1;
   71:     return
   72:       &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
   73:                                 $map,1);
   74: }
   75: 
   76: # ----------------------------------------- Return hash with valid author names
   77: 
   78: sub authorhosts {
   79:     my %outhash=();
   80:     my $home=0;
   81:     my $other=0;
   82:     foreach (keys %ENV) {
   83: 	if ($_=~/^user\.role\.(au|ca)\.(.+)$/) {
   84: 	    my $role=$1;
   85: 	    my $realm=$2;
   86: 	    my ($start,$end)=split(/\./,$ENV{$_});
   87: 	    if (($start) && ($start>time)) { next; }
   88: 	    if (($end) && (time>$end)) { next; }
   89: 	    my $ca; my $cd;
   90: 	    if ($1 eq 'au') {
   91: 		$ca=$ENV{'user.name'};
   92: 		$cd=$ENV{'user.domain'};
   93: 	    } else {
   94: 		($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/);
   95: 	    }
   96: 	    if (&Apache::lonnet::homeserver($ca,$cd) eq 
   97: 		$Apache::lonnet::perlvar{'lonHostID'}) {
   98: 		$home++;
   99: 		$outhash{'home_'.$ca.'@'.$cd}=1;
  100: 	    } else {
  101: 		$outhash{'otherhome_'.$ca.'@'.$cd}=
  102: 		    &Apache::lonnet::homeserver($ca,$cd);
  103: 		$other++;
  104: 	    }
  105: 	}
  106:     }
  107:     return ($home,$other,%outhash);
  108: }
  109: # ------------------------------------------------------ Generate "dump" button
  110: 
  111: sub dumpbutton {
  112:     my ($home,$other,%outhash)=&authorhosts();
  113:     if ($home+$other==0) { return ''; }
  114:     my $output='</td><td bgcolor="#DDDDCC">';
  115:     if ($home) {
  116: 	return '</td><td bgcolor="#DDDDCC">'.
  117: 	    '<input type="submit" name="dumpcourse" value="Dump Course DOCS to Construction Space" />';
  118:     } else {
  119: 	return'</td><td bgcolor="#DDDDCC">'.
  120:       'Dump Course DOCS to Construction Space: available on other servers';
  121:     }
  122: }
  123: 
  124: # -------------------------------------------------------- Actually dump course
  125: 
  126: sub dumpcourse {
  127:     my $r=shift;
  128:     $r->print('<html><head><title>Dump DOCS</title></head>'.
  129:         &Apache::loncommon::bodytag('Dump Course DOCS to Construction Space').
  130: 	      '<form name="dumpdoc" method="post">');
  131:     my ($home,$other,%outhash)=&authorhosts();
  132:     unless ($home) { return ''; }
  133:     my $origcrsid=$ENV{'request.course.id'};
  134:     my %origcrsdata=&Apache::lonnet::coursedescription($origcrsid);
  135:     if (($ENV{'form.authorspace'}) && ($ENV{'form.authorfolder'}=~/\w/)) {
  136: # Do the dumping
  137: 	unless ($outhash{'home_'.$ENV{'form.authorspace'}}) { return ''; }
  138: 	my ($ca,$cd)=split(/\@/,$ENV{'form.authorspace'});
  139: 	my $title=$ENV{'form.authorfolder'};
  140: 
  141:     } else {
  142: # Input form
  143: 	unless ($home==1) {
  144: 	    $r->print(
  145: 		      '<h3>Select the Construction Space</h3><select name="authorspace">');
  146: 	}
  147: 	foreach (sort keys %outhash) {
  148: 	    if ($_=~/^home_(.+)$/) {
  149: 		if ($home==1) {
  150: 		    $r->print(
  151: 		  '<input type="hidden" name="authorspace" value="'.$1.'" />');
  152: 		} else {
  153: 		    $r->print('<option value="'.$1.'">'.$_.'</option>');
  154: 		}
  155: 	    }
  156: 	}
  157: 	unless ($home==1) {
  158: 	    $r->print('</select>');
  159: 	}
  160: 	my $title=$origcrsdata{'description'};
  161: 	$title=~s/\s+/\_/gs;
  162: 	$title=~s/\W//gs;
  163: 	$r->print('<h3>Folder in Construction Space</h3><input type="text" size="50" name="authorfolder" value="'.$title.'" /><br />');
  164: 	&tiehash();
  165: 	foreach (&Apache::loncreatecourse::crsdirlist($origcrsid,'userfiles')) {
  166: 	    $r->print("\n<br />".$_.' '.
  167:   $hash{'title_'.$hash{
  168: 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}
  169: 		      );
  170: 	}
  171: 	&untiehash();
  172: 	$r->print(
  173:   '<input type="submit" name="dumpcourse" value="Dump Course DOCS" /></form>');
  174:     }
  175: }
  176: 
  177: 
  178: # Imports the given (name, url) resources into the course
  179: # coursenum, coursedom, and folder must precede the list
  180: sub group_import {
  181:     my $coursenum = shift;
  182:     my $coursedom = shift;
  183:     my $folder = shift;
  184:     while (@_) {
  185: 	my $name = shift;
  186: 	my $url = shift;
  187: 	if ($url) {
  188: 	    my $idx = $#Apache::lonratedt::resources + 1;
  189: 	    $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=$idx;
  190: 	    my $ext = 'false';
  191: 	    if ($url=~/^http:\/\//) { $ext = 'true'; }
  192: 	    $url =~ s/:/\&colon;/g;
  193: 	    $name =~ s/:/\&colon;/g;
  194: 	    $Apache::lonratedt::resources[$idx] = 
  195: 		join ':', ($name, $url, $ext, 'normal', 'res');
  196: 	}
  197:     }
  198:     &storemap($coursenum, $coursedom, $folder);
  199: }
  200: 
  201: sub editor {
  202:     my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
  203:     if ($ENV{'form.foldername'}) {
  204: 	$r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
  205:     }
  206:     my $errtext='';
  207:     my $fatal=0;
  208:     ($errtext,$fatal)=
  209:           &mapread($coursenum,$coursedom,$folder.'.sequence');
  210:     if ($#Apache::lonratedt::order<1) {
  211:        	$Apache::lonratedt::order[0]=1;
  212:         $Apache::lonratedt::resources[1]='';
  213:     }
  214:     if ($fatal) {
  215: 	   $r->print('<p><font color="red">'.$errtext.'</font></p>');
  216:     } else {
  217: # ------------------------------------------------------------ Process commands
  218: # ---------------- if they are for this folder and user allowed to make changes
  219: 	if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
  220: # upload a file, if present
  221:            if (($ENV{'form.uploaddoc.filename'}) &&
  222:                ($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
  223: 	    if ($folder=~/^$1/) {
  224: # this is for a course, not a user, so set coursedoc flag
  225: # probably the only place in the system where this should be "1"
  226: 	      my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
  227:               my $ext='false';
  228:               if ($url=~/^http\:\/\//) { $ext='true'; }
  229:               $url=~s/\:/\&colon;/g;
  230: 	      my $comment=$ENV{'form.comment'};
  231:               $comment=~s/\</\&lt\;/g;
  232:               $comment=~s/\>/\&gt\;/g;
  233:               $comment=~s/\:/\&colon;/g;
  234:               if ($folder=~/^supplemental/) {
  235: 		  $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
  236: 		      $ENV{'user.domain'}.'___&&&___'.$comment;
  237:               }
  238:               my $newidx=$#Apache::lonratedt::resources+1;
  239:               $Apache::lonratedt::resources[$newidx]=
  240:                   $comment.':'.$url.':'.$ext.':normal:res';
  241:               $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=
  242:                                                               $newidx;       
  243:  	      &storemap($coursenum,$coursedom,$folder.'.sequence');
  244: 	     }
  245:             }
  246: 	    if ($ENV{'form.cmd'}) {
  247:                 my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
  248:                 if ($cmd eq 'del') {
  249: 		    for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
  250:                         $Apache::lonratedt::order[$i]=
  251:                           $Apache::lonratedt::order[$i+1];
  252:                     }
  253:                     $#Apache::lonratedt::order--;
  254:                 } elsif ($cmd eq 'up') {
  255: 		  if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) {
  256:                     my $i=$Apache::lonratedt::order[$idx-1];
  257:                     $Apache::lonratedt::order[$idx-1]=
  258: 			$Apache::lonratedt::order[$idx];
  259:                     $Apache::lonratedt::order[$idx]=$i;
  260: 		   }
  261:                 } elsif ($cmd eq 'down') {
  262: 		   if (defined($Apache::lonratedt::order[$idx+1])) {
  263:                     my $i=$Apache::lonratedt::order[$idx+1];
  264:                     $Apache::lonratedt::order[$idx+1]=
  265: 			$Apache::lonratedt::order[$idx];
  266:                     $Apache::lonratedt::order[$idx]=$i;
  267: 		   }
  268:                 } elsif ($cmd eq 'rename') {
  269:                     my ($rtitle,@rrest)=split(/\:/,
  270:                        $Apache::lonratedt::resources[
  271: 				       $Apache::lonratedt::order[$idx]]);
  272:                     my $comment=
  273:                      &HTML::Entities::decode($ENV{'form.title'});
  274:                     $comment=~s/\</\&lt\;/g;
  275:                     $comment=~s/\>/\&gt\;/g;
  276:                     $comment=~s/\:/\&colon;/g;
  277:                     $Apache::lonratedt::resources[
  278: 				       $Apache::lonratedt::order[$idx]]=
  279:                              $comment.':'.join(':',@rrest);
  280:                     
  281:                 }
  282: # Store the changed version
  283: 		&storemap($coursenum,$coursedom,$folder.'.sequence');
  284:             }
  285: # Group import/search
  286: 	    if ($ENV{'form.importdetail'}) {
  287: 		my @imports;
  288: 		foreach (split(/\&/,$ENV{'form.importdetail'})) {
  289: 		    if (defined($_)) {
  290: 			my ($name,$url)=split(/\=/,$_);
  291: 			$name=&Apache::lonnet::unescape($name);
  292: 			$url=&Apache::lonnet::unescape($url);
  293: 			push @imports, $name, $url;
  294: 		    }
  295: 		}
  296: # Store the changed version
  297: 		group_import($coursenum, $coursedom, $folder, @imports);
  298:             }
  299: # Loading a complete map
  300: 	   if (($ENV{'form.importmap'}) && ($ENV{'form.loadmap'})) {
  301:               foreach
  302: (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) {
  303:                    my $idx=$#Apache::lonratedt::resources;
  304:                    $idx++;
  305:                    $Apache::lonratedt::resources[$idx]=$_;
  306:                    $Apache::lonratedt::order
  307:                             [$#Apache::lonratedt::order+1]=$idx;
  308:                 }
  309: 
  310: # Store the changed version
  311: 		&storemap($coursenum,$coursedom,$folder.'.sequence');
  312:            }
  313:        }
  314: # ---------------------------------------------------------------- End commands
  315: # ---------------------------------------------------------------- Print screen
  316:         my $idx=0;
  317:         $r->print('<table>');
  318:         foreach (@Apache::lonratedt::order) {
  319:            my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
  320:            unless ($name) {  $name=(split(/\//,$url))[-1]; }
  321:            unless ($name) { $name='NO RESOURCE'; $url='/adm/notfound.html'; }
  322:            $r->print(&entryline($idx,$name,$url,$folder,$allowed,$_));
  323:            $idx++;
  324:         }
  325:         $r->print('</table>');
  326:     }
  327: }
  328: 
  329: # --------------------------------------------------------------- An entry line
  330: 
  331: sub entryline {
  332:     my ($index,$title,$url,$folder,$allowed,$residx)=@_;
  333:     $title=~s/\&colon\;/\:/g;
  334:     $title=&HTML::Entities::encode(&HTML::Entities::decode(
  335:      &Apache::lonnet::unescape($title)),'\"\<\>\&\'');
  336:     my $renametitle=$title;
  337:     my $foldertitle=$title;
  338:     if ($title=~
  339:  /^(\d+)\_\_\_\&amp\;\&amp\;\&amp\;\_\_\_(\w+)\_\_\_\&amp\;\&amp\;\&amp\;\_\_\_(\w+)\_\_\_\&amp\;\&amp\;\&amp\;\_\_\_(.*)$/
  340: 	) { 
  341:             $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
  342:             $renametitle=$4;
  343:             $title='<i>'.localtime($1).'</i> '.
  344:                 &Apache::loncommon::plainname($2,$3).': <br>'.
  345: 		$foldertitle;
  346: 	}
  347:     $renametitle=~s/\&quot\;/\\\"/g;
  348:     my $line='<tr>';
  349: # Edit commands
  350:     if ($allowed) {
  351:        $line.=(<<END);
  352: <td><table border='0' cellspacing='2' cellpadding='0'>
  353: <tr><td bgcolor="#DDDDDD">
  354: <a href='/adm/coursedocs?folder=$folder&cmd=up_$index'>
  355: <img src="${iconpath}move_up.gif" alt='UP' border='0' /></a></td></tr>
  356: <tr><td bgcolor="#DDDDDD">
  357: <a href='/adm/coursedocs?folder=$folder&cmd=down_$index'>
  358: <img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr>
  359: </table></td><td bgcolor="#DDDDDD">
  360: <a href='javascript:removeres("$folder","$index","$renametitle");'>
  361: <font size="-2" color="#990000">Remove</font></a>
  362: <a href='javascript:changename("$folder","$index","$renametitle");'>
  363: <font size="-2" color="#009900">Rename</font></a></td>
  364: END
  365:     }
  366: # Figure out what kind of a resource this is
  367:     my ($extension)=($url=~/\.(\w+)$/);
  368:     my $uploaded=($url=~/^\/*uploaded\//);
  369:     my $icon='unknown';
  370:     if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {
  371: 	$icon=$extension;
  372:     }
  373:     my $isfolder=0;
  374:     if ($uploaded) {
  375:        if ($extension eq 'sequence') {
  376: 	  $icon='folder_closed';
  377:           $url=~/\/(\w+)\.sequence/;
  378:           $url='/adm/coursedocs?folder='.$1;
  379:           $isfolder=1;
  380:        } else {
  381: 	  $url=&Apache::lonnet::tokenwrapper($url);
  382:        } 
  383:     }
  384:     $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
  385:     if (($residx) && ($folder!~/supplemental/)) {
  386:        $url.=(($url=~/\?/)?'&':'?').'symb='.
  387:        &Apache::lonnet::escape(&Apache::lonnet::symbclean(
  388:           &Apache::lonnet::declutter('uploaded/'.
  389:            $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.'/'.
  390:            $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.'/'.$folder.
  391:            '.sequence').
  392:            '___'.$residx.'___'.
  393: 	   &Apache::lonnet::declutter($url)));
  394:     }
  395:     if ($isfolder) { $url.='&foldername='.
  396:        &Apache::lonnet::escape($foldertitle); }
  397:     $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'" target="cat_'.$folder.
  398: '"><img src="/adm/lonIcons/'.
  399:         $icon.'.gif" border="0"></a></td>'.
  400:         "<td bgcolor='#FFFFBB'><a href='$url' target='cat_$folder'>$title</a></td></tr>";
  401:     return $line;
  402: }
  403: 
  404: # ---------------------------------------------------------------- tie the hash
  405: 
  406: sub tiehash {
  407:     $hashtied=0;
  408:     if ($ENV{'request.course.fn'}) {
  409:         if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
  410:             &GDBM_READER(),0640)) {
  411:                 $hashtied=1;
  412:         }
  413:     }    
  414: }
  415: 
  416: sub untiehash {
  417:     if ($hashtied) { untie %hash; }
  418:     $hashtied=0;
  419: }
  420: 
  421: # --------------------------------------------------------------- check on this
  422: 
  423: sub checkonthis {
  424:     my ($r,$url,$level,$title)=@_;
  425:     $alreadyseen{$url}=1;
  426:     $r->rflush();
  427:     if (($url) && ($url!~/^\/uploaded\//) && ($url!~/\*$/)) {
  428:        $r->print('<br />');
  429:        for (my $i=0;$i<=$level*5;$i++) {
  430:            $r->print('&nbsp;');
  431:        }
  432:        $r->print('<a href="'.$url.'" target="cat">'.
  433: 		 ($title?$title:$url).'</a> ');
  434:        if ($url=~/^\/res\//) {
  435: 	  my $result=&Apache::lonnet::repcopy(
  436:                               &Apache::lonnet::filelocation('',$url));
  437:           if ($result==OK) {
  438:              $r->print('<font color="green">ok</font>');
  439:              $r->rflush();
  440:              &Apache::lonnet::countacc($url);
  441:              $url=~/\.(\w+)$/;
  442:              if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
  443: 		 $r->print('<br />');
  444:                  $r->rflush();
  445:                  for (my $i=0;$i<=$level*5;$i++) {
  446:                      $r->print('&nbsp;');
  447:                  }
  448:                  $r->print('- Rendering: ');
  449:                  my $oldpath=$ENV{'request.filename'};
  450:                  $ENV{'request.filename'}=&Apache::lonnet::filelocation('',$url);
  451:                  &Apache::lonxml::xmlparse($r,'web',
  452:                    &Apache::lonnet::getfile(
  453:                     &Apache::lonnet::filelocation('',$url)));
  454: 		 $ENV{'request.filename'}=$oldpath;
  455:                  if (($Apache::lonxml::errorcount) ||
  456:                      ($Apache::lonxml::warningcount)) {
  457: 		     if ($Apache::lonxml::errorcount) {
  458:                         $r->print('<font color="red"><b>'.
  459: 			  $Apache::lonxml::errorcount.' error(s)</b></font> ');
  460:                      }
  461: 		     if ($Apache::lonxml::warningcount) {
  462:                         $r->print('<font color="blue">'.
  463: 			  $Apache::lonxml::warningcount.' warning(s)</font>');
  464:                      }
  465:                  } else {
  466:                      $r->print('<font color="green">ok</font>');
  467:                  }
  468:                  $r->rflush();
  469:              }
  470: 	     my $dependencies=
  471:                 &Apache::lonnet::metadata($url,'dependencies');
  472:              foreach (split(/\,/,$dependencies)) {
  473: 		 if (($_=~/^\/res\//) && (!$alreadyseen{$_})) {
  474:                     &checkonthis($r,$_,$level+1);
  475:                  }
  476:              }
  477:           } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {
  478:              $r->print('<font color="red"><b>connection down</b></font>');
  479:           } elsif ($result==HTTP_NOT_FOUND) {
  480:              $r->print('<font color="red"><b>not found</b></font>');
  481:           } else {
  482:              $r->print('<font color="red"><b>access denied</b></font>');
  483:           }
  484:       }
  485:    }
  486: }
  487: 
  488: 
  489: #
  490: # -------------------------------------------------------------- Verify Content
  491: # 
  492: sub verifycontent {
  493:    my $r=shift; 
  494:    my $loaderror=&Apache::lonnet::overloaderror($r);
  495:    if ($loaderror) { return $loaderror; }
  496: 
  497:    $r->print('<html><head><title>Verify Content</title></head>'.
  498:               &Apache::loncommon::bodytag('Verify Course Documents'));
  499:    $hashtied=0;
  500:    undef %alreadyseen;
  501:    %alreadyseen=();
  502:    &tiehash();
  503:    foreach (keys %hash) {
  504:        if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {
  505:            &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});
  506:        }
  507:    }
  508:    &untiehash();
  509:    $r->print('<h1>Done.</h1>');
  510: }
  511: 
  512: # -------------------------------------------------------------- Check Versions
  513: 
  514: sub checkversions {
  515:     my $r=shift;
  516:    $r->print('<html><head><title>Check Versions</title></head>'.
  517:               &Apache::loncommon::bodytag('Check Course Document Versions'));
  518:    $hashtied=0;
  519:    &tiehash();
  520:    my %changes=&Apache::lonnet::dump
  521:     ('versionupdate',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
  522:                      $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
  523:    my $firstkey=(keys %changes)[0];
  524:    unless ($firstkey=~/^error\:/) {
  525:        unless ($ENV{'form.timerange'}) {
  526: 	   $ENV{'form.timerange'}=604800;
  527:        }
  528:        my $seltext='during the last '.$ENV{'form.timerange'}.' seconds';
  529:        my $startsel='';
  530:        my $monthsel='';
  531:        my $weeksel='';
  532:        my $daysel='';
  533:        if ($ENV{'form.timerange'}==-1) {
  534: 	   $seltext='since start of course';
  535:            $startsel='selected';
  536:            $ENV{'form.timerange'}=time;
  537:        }
  538:        my $starttime=time-$ENV{'form.timerange'};
  539:        if ($ENV{'form.timerange'}==2592000) {
  540:            $seltext='during the last month ('.localtime($starttime).')';
  541:            $monthsel='selected';
  542:        } elsif ($ENV{'form.timerange'}==604800) {
  543:            $seltext='during the last week ('.localtime($starttime).')';
  544:            $weeksel='selected';
  545:        } elsif ($ENV{'form.timerange'}==86400) {
  546:            $seltext='since yesterday ('.localtime($starttime).')';
  547:            $daysel='selected';
  548:        }
  549: 
  550:        $r->print(<<ENDHEADERS);
  551: <form action="/adm/coursedocs" method="post">
  552: <select name="timerange">
  553: <option value="-1" $startsel>Since Start of Course</option>
  554: <option value="2592000" $monthsel>Last Month</option>
  555: <option value="604800" $weeksel>Last Week</option>
  556: <option value="86400" $daysel>Since Yesterday</option>
  557: </select>
  558: <input type="submit" name="versions" value="Display" />
  559: </form>
  560: <h3>Content changed $seltext</h3>
  561: <table border="2">
  562: <tr>
  563: <th>File</th><th>Modification Date</th>
  564: <th>Version</th><th>Differences</th></tr>
  565: ENDHEADERS
  566:        foreach (keys %changes) {
  567: 	  if ($changes{$_}>$starttime) {
  568: 	     my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
  569:              my $currentversion=&Apache::lonnet::getversion($_);
  570:              my $linkurl=&Apache::lonnet::clutter($_);
  571:              $r->print(
  572:                  '<tr><td><a href="'.$linkurl.'" target="cat">'.$linkurl.
  573:                  '</a></td><td>'.
  574:                  localtime($changes{$_}).'</td><td>'.$currentversion.'</td>'.
  575: 		       '<td>');
  576:              my $lastold=1;
  577:              for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
  578:                  my $url=$root.'.'.$prevvers.'.'.$extension;
  579:                  if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
  580:                                                              $starttime) {
  581:                      $lastold=$prevvers;
  582:                  }
  583:              }
  584:             for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
  585:                  my $url=$root.'.'.$prevvers.'.'.$extension;
  586:                  $r->print('<a href="'.&Apache::lonnet::clutter($url).
  587:                    '">Version '.$prevvers.' ('.
  588:                  localtime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
  589:                  ')</a>');
  590:                  if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
  591:                     $r->print(' <a href="/adm/diff?filename='.
  592:                             &Apache::lonnet::clutter($root.'.'.$extension).
  593:                             '&versionone='.$prevvers.
  594: 			     '">Diffs</a>');
  595:                  }
  596:                  $r->print('<br />');
  597:              }
  598:              $r->print('</td></tr>');
  599:           }
  600:        }
  601:        $r->print('</table>');
  602:        $r->print('<h1>Done.</h1>');
  603:    } else {
  604:        $r->print('<p>No content modifications yet.</p>');
  605:    }
  606:    &untiehash();
  607: }
  608: 
  609: # ================================================================ Main Handler
  610: sub handler {
  611:     my $r = shift;
  612:     $r->content_type('text/html');
  613:     $r->send_http_header;
  614:     return OK if $r->header_only;
  615: 
  616: # --------------------------------------------- Initialize help topics for this
  617:   foreach ('Adding_Course_Doc','Main_Course_Documents',
  618:            'Adding_External_Resource','Navigate_Content',
  619:            'Adding_Folders','Docs_Overview', 'Load_Map',
  620:            'Supplemental', 'Score_Upload_Form',
  621:            'Importing_LON-CAPA_Resource','Uploading_From_Harddrive') {
  622:       $help{$_}=&Apache::loncommon::help_open_topic('Docs_'.$_);
  623:   }
  624:     # Composite help files
  625:     $help{'Syllabus'} = &Apache::loncommon::help_open_topic(
  626: 		    'Docs_About_Syllabus,Docs_Editing_Templated_Pages');
  627:     $help{'Simple Page'} = &Apache::loncommon::help_open_topic(
  628: 		    'Docs_About_Simple_Page,Docs_Editing_Templated_Pages');
  629:     $help{'Bulletin Board'} = &Apache::loncommon::help_open_topic(
  630: 		    'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages');
  631:     $help{'My Personal Info'} = &Apache::loncommon::help_open_topic(
  632: 		  'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages');
  633:     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
  634:  
  635:   if ($ENV{'form.verify'}) {
  636:       &verifycontent($r);
  637:   } elsif ($ENV{'form.versions'}) {
  638:       &checkversions($r);
  639:   } elsif ($ENV{'form.dumpcourse'}) {
  640:       &dumpcourse($r);
  641:   } else {
  642: # is this a standard course?
  643: 
  644:     my $standard=($ENV{'request.course.uri'}=~/^\/uploaded\//);
  645:     my $forcestandard;
  646:     my $forcesupplement;
  647:     my $script='';
  648:     my $allowed;
  649:     my $events='';
  650:     my $showdoc=0;
  651:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
  652:        ['folder','foldername']);
  653:     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
  654:        $showdoc=$1;
  655:     }
  656:     unless ($showdoc) { # got called from remote
  657:        $forcestandard=($ENV{'form.folder'}=~/^default_/);
  658:        $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
  659: 
  660: # does this user have privileges to post, etc?
  661:        $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});
  662:        if ($allowed) { 
  663:          &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
  664:          $script=&Apache::lonratedt::editscript('simple'); 
  665:        }
  666:     } else { # got called in sequence from course
  667:        $allowed=0;
  668:        $script='</script>'.&Apache::lonmenu::registerurl(1,undef).'<script>';
  669:        $events='onLoad="'.&Apache::lonmenu::loadevents.
  670:            '" onUnload="'.&Apache::lonmenu::unloadevents.'"';
  671:     }
  672: 
  673: # get course data
  674:     my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
  675:     my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
  676: 
  677: # get personal data
  678:  
  679:     my $uname=$ENV{'user.name'};
  680:     my $udom=$ENV{'user.domain'};
  681:     my $plainname=&Apache::lonnet::escape(
  682:                      &Apache::loncommon::plainname($uname,$udom));
  683: 
  684: # graphics settings
  685: 
  686:     $iconpath = $r->dir_config('lonIconsURL') . "/";
  687: 
  688:     my $now=time;
  689: 
  690: # print screen
  691:     $r->print(<<ENDDOCUMENT);
  692: <html>
  693: <head>
  694: <title>The LearningOnline Network with CAPA</title>
  695: <script>
  696: $script
  697: </script>
  698: ENDDOCUMENT
  699:    if ($allowed) {
  700:     $r->print(<<ENDNEWSCRIPT);
  701: <script>
  702: function makenewfolder(targetform,folderseq) {
  703:     var foldername=prompt('Name of New Folder','New Folder');
  704:     if (foldername) {
  705: 	targetform.importdetail.value=foldername+"="+folderseq;
  706:         targetform.submit();
  707:     }
  708: }
  709: 
  710: function makenewext(targetname) {
  711:     this.document.forms.extimport.useform.value=targetname;
  712:     window.open('/adm/rat/extpickframe.html');
  713: }
  714: 
  715: function makeexamupload() {
  716:    var title=prompt('Listed Title for the Uploaded Score');
  717:    if (title) { 
  718:     this.document.forms.newexamupload.importdetail.value=
  719: 	title+'=/res/lib/templates/examupload.problem';
  720:     this.document.forms.newexamupload.submit();
  721:    }
  722: }
  723: 
  724: function makesmppage() {
  725:    var title=prompt('Listed Title for the Page');
  726:    if (title) { 
  727:     this.document.forms.newsmppg.importdetail.value=
  728: 	title+'=/adm/$udom/$uname/$now/smppg';
  729:     this.document.forms.newsmppg.submit();
  730:    }
  731: }
  732: 
  733: function makesmpproblem() {
  734:    var title=prompt('Listed Title for the Problem');
  735:    if (title) { 
  736:     this.document.forms.newsmpproblem.importdetail.value=
  737: 	title+'=/res/lib/templates/simpleproblem.problem';
  738:     this.document.forms.newsmpproblem.submit();
  739:    }
  740: }
  741: 
  742: function makebulboard() {
  743:    var title=prompt('Listed Title for the Bulletin Board');
  744:    if (title) {
  745:     this.document.forms.newbul.importdetail.value=
  746: 	title+'=/adm/$udom/$uname/$now/bulletinboard';
  747:     this.document.forms.newbul.submit();
  748:    }
  749: }
  750: 
  751: function finishpick() {
  752:     var title=this.document.forms.extimport.title.value;
  753:     var url=this.document.forms.extimport.url.value;
  754:     var form=this.document.forms.extimport.useform.value;
  755:     eval
  756:      ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
  757:     '";this.document.forms.'+form+'.submit();');
  758: }
  759: 
  760: function changename(folder,index,oldtitle) {
  761:     var title=prompt('New Title',oldtitle);
  762:     if (title) {
  763: 	this.document.forms.renameform.title.value=title;
  764: 	this.document.forms.renameform.cmd.value='rename_'+index;
  765: 	this.document.forms.renameform.folder.value=folder;
  766:         this.document.forms.renameform.submit();
  767:     }
  768: }
  769: 
  770: function removeres(folder,index,oldtitle) {
  771:     if ((oldtitle=='NO RESOURCE') || (confirm('Remove "'+oldtitle+'"?'))) {
  772: 	this.document.forms.renameform.cmd.value='del_'+index;
  773: 	this.document.forms.renameform.folder.value=folder;
  774:         this.document.forms.renameform.submit();
  775:     }
  776: }
  777: </script>
  778: 
  779: ENDNEWSCRIPT
  780:   }
  781: # -------------------------------------------------------------------- Body tag
  782:   $r->print('</head>'.
  783:             &Apache::loncommon::bodytag('Course Documents','',$events,
  784: 					'','',$showdoc));
  785:   unless ($showdoc) {
  786:     if ($allowed) {
  787:        my $dumpbut=&dumpbutton();
  788:        $r->print(<<ENDCOURSEVERIFY);
  789: <form name="renameform" method="post" action="/adm/coursedocs">
  790: <input type="hidden" name="title" />
  791: <input type="hidden" name="cmd" />
  792: <input type="hidden" name="folder" />
  793: </form>
  794: <form name="simpleedit" method="post" action="/adm/coursedocs">
  795: <input type=hidden name="importdetail" value="">
  796: <input type="hidden" name="folder" />
  797: </form>
  798: <form action="/adm/coursedocs" method="post" name="courseverify">
  799: <table bgcolor="#AAAAAA" width="100%" cellspacing="4" cellpadding="4">
  800: <tr><td bgcolor="#DDDDCC">
  801: <input type="submit" name="verify" value="Verify Content" />
  802: </td><td bgcolor="#DDDDCC">
  803: <input type="submit" name="versions" value="Check Resource Versions" />
  804: $dumpbut
  805: </td></tr></table>
  806: </form>
  807: ENDCOURSEVERIFY
  808:        $r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
  809: 		     'Editing the Table of Contents for your Course'));
  810:     }
  811: # --------------------------------------------------------- Standard documents
  812:     $r->print('<table border=2 cellspacing=4 cellpadding=4>');
  813:     if (($standard) && ($allowed) && (!$forcesupplement)) {
  814:        $r->print('<tr><td bgcolor="#BBBBBB"><h2>Main Course Documents'.
  815:   ($allowed?' '.$help{'Main_Course_Documents'}:'').'</h2>');
  816:        my $folder=$ENV{'form.folder'};
  817:        unless ($folder=~/^default/) { $folder='default'; }
  818:        my $postexec='';
  819:        if ($folder eq 'default') {
  820: 	   $r->print('<script>this.window.name="loncapaclient";</script>');
  821:        } else {
  822:            $postexec='self.close();';
  823:        }
  824:        $hadchanges=0;
  825:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
  826:        if ($hadchanges) {
  827: 	   $r->print(
  828: '<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'. 
  829: '<form method="post" action="/adm/roles" target="loncapaclient">'.
  830: '<input type="hidden" name="orgurl" value="/adm/coursedocs" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">Changes will become active for your current session after <input type="hidden" name="'.
  831: $ENV{'request.role'}.'" value="1" /><input type="button" value="re-initializing course" onClick="reinit(this.form)"/>, or the next time you log in.'.
  832: $help{'Caching'}.'</font></h3></form>');
  833:        }
  834:        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
  835:                      '.sequence';
  836: 
  837:        $r->print(<<ENDFORM);
  838: <table cellspacing=4 cellpadding=4><tr>
  839: <th bgcolor="#DDDDDD">Upload a new main course document</th>
  840: <th bgcolor="#DDDDDD">Import a published document</th>
  841: <th bgcolor="#DDDDDD">Special documents</th>
  842: </tr>
  843: <tr><td bgcolor="#DDDDDD">
  844: File:<br />
  845: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
  846: <input type="file" name="uploaddoc" size="40">
  847: <br />
  848: Title:<br />
  849: <input type="text" size="50" name="comment">
  850: <input type="hidden" name="folder" value="$folder">
  851: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  852: <input type="hidden" name="cmd" value="upload_default">
  853: <input type="submit" value="Upload Document">
  854: <nobr>
  855:  $help{'Uploading_From_Harddrive'}
  856: </nobr>
  857: </form>
  858: </td>
  859: <td bgcolor="#DDDDDD">
  860: <form action="/adm/coursedocs" method="post" name="simpleeditdefault">
  861: <input type="hidden" name="folder" value="$folder">
  862: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  863: <input type=button onClick=
  864: "javascript:document.forms.simpleedit.folder.value='$folder';groupsearch()" value="Search">
  865: <nobr>
  866: <input type=button onClick=
  867: "javascript:document.forms.simpleedit.folder.value='$folder';groupimport();" value="Import">
  868: $help{'Importing_LON-CAPA_Resource'}
  869: </nobr>
  870: <p>
  871: <hr />
  872: <input type="text" size="20" name="importmap"><br />
  873: <nobr><input type=button 
  874: onClick="javascript:openbrowser('simpleeditdefault','importmap','sequence,page','')"
  875: value="Select Map"> <input type="submit" name="loadmap" value="Load Map">
  876: $help{'Load_Map'}</nobr>
  877: </p>
  878: </form>
  879: </td><td bgcolor="#DDDDDD">
  880: <form action="/adm/coursedocs" method="post" name="newfolder">
  881: <input type="hidden" name="folder" value="$folder">
  882: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  883: <input type=hidden name="importdetail" value="">
  884: <nobr>
  885: <input name="newfolder" type="button"
  886: onClick="javascript:makenewfolder(this.form,'$folderseq');"
  887: value="New Folder" />$help{'Adding_Folders'}
  888: </nobr>
  889: </form>
  890: <form action="/adm/coursedocs" method="post" name="newext">
  891: <input type="hidden" name="folder" value="$folder">
  892: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  893: <input type=hidden name="importdetail" value="">
  894: <nobr>
  895: <input name="newext" type="button" onClick="javascript:makenewext('newext');"
  896: value="External Resource" /> $help{'Adding_External_Resource'}
  897: </nobr>
  898: </form>
  899: <form action="/adm/coursedocs" method="post" name="newsyl">
  900: <input type="hidden" name="folder" value="$folder">
  901: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  902: <input type=hidden name="importdetail" 
  903: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
  904: <nobr>
  905: <input name="newsyl" type="submit" value="Syllabus" /> 
  906:  $help{'Syllabus'}
  907: </nobr>
  908: </form>
  909: <form action="/adm/coursedocs" method="post" name="newnav">
  910: <input type="hidden" name="folder" value="$folder">
  911: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  912: <input type=hidden name="importdetail" 
  913: value="Navigate Content=/adm/navmaps">
  914: <nobr>
  915: <input name="newnav" type="submit" value="Navigate Content" />
  916: $help{'Navigate_Content'}
  917: </nobr>
  918: </form>
  919: <form action="/adm/coursedocs" method="post" name="newsmppg">
  920: <input type="hidden" name="folder" value="$folder">
  921: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  922: <input type=hidden name="importdetail" value="">
  923: <nobr>
  924: <input name="newsmppg" type="button" value="Simple Page"
  925: onClick="javascript:makesmppage();" /> $help{'Simple Page'}
  926: </nobr>
  927: </form>
  928: <form action="/adm/coursedocs" method="post" name="newsmpproblem">
  929: <input type="hidden" name="folder" value="$folder">
  930: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  931: <input type=hidden name="importdetail" value="">
  932: <nobr>
  933: <input name="newsmpproblem" type="button" value="Simple Problem"
  934: onClick="javascript:makesmpproblem();" />$help{'Simple Problem'}
  935: </nobr>
  936: </form>
  937: <form action="/adm/coursedocs" method="post" name="newexamupload">
  938: <input type="hidden" name="folder" value="$folder">
  939: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  940: <input type=hidden name="importdetail" value="">
  941: <nobr>
  942: <input name="newexamupload" type="button" value="Score Upload Form"
  943: onClick="javascript:makeexamupload();" />
  944: $help{'Score_Upload_Form'}
  945: </nobr>
  946: </form>
  947: <form action="/adm/coursedocs" method="post" name="newbul">
  948: <input type="hidden" name="folder" value="$folder">
  949: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  950: <input type=hidden name="importdetail" value="">
  951: <nobr>
  952: <input name="newbulletin" type="button" value="Bulletin Board"
  953: onClick="javascript:makebulboard();" />
  954: $help{'Bulletin Board'}
  955: </nobr>
  956: </form>
  957: <form action="/adm/coursedocs" method="post" name="newaboutme">
  958: <input type="hidden" name="folder" value="$folder">
  959: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  960: <input type=hidden name="importdetail" 
  961: value="$plainname=/adm/$udom/$uname/aboutme">
  962: <nobr>
  963: <input name="newaboutme" type="submit" value="My Personal Info" />
  964: $help{'My Personal Info'}
  965: </nobr>
  966: </form>
  967: </td></tr>
  968: </table>
  969: ENDFORM
  970:        $r->print('</td></tr>');
  971:     }
  972: # ----------------------------------------------------- Supplemental documents
  973:     if (!$forcestandard) {
  974:        $r->print(
  975:   '<tr><td bgcolor="#BBBBBB"><h2>Supplemental Course Documents'.
  976:   ($allowed?' '.$help{'Supplemental'}:'').'</h2>');
  977:        my $folder=$ENV{'form.folder'};
  978:        unless ($folder=~/supplemental/) { $folder='supplemental'; }
  979:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
  980:        if ($allowed) {
  981:        my $folderseq=
  982:                   '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
  983:                      '.sequence';
  984: 
  985:           $r->print(<<ENDSUPFORM);
  986: <table cellspacing=4 cellpadding=4><tr>
  987: <th bgcolor="#DDDDDD">Upload a new supplemental course document</th>
  988: <th bgcolor="#DDDDDD">Import a published document</th>
  989: <th bgcolor="#DDDDDD">Special documents</th>
  990: </tr>
  991: <tr><td bgcolor="#DDDDDD">
  992: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
  993: <input type="file" name="uploaddoc" size="40">
  994: <br />Comment:<br />
  995: <textarea cols=50 rows=4 name='comment'>
  996: </textarea>
  997: <input type="hidden" name="folder" value="$folder">
  998: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
  999: <input type="hidden" name="cmd" value="upload_supplemental">
 1000: <nobr>
 1001: <input type="submit" value="Upload Document">
 1002:  $help{'Uploading_From_Harddrive'}
 1003: </nobr>
 1004: </form>
 1005: </td>
 1006: <td bgcolor="#DDDDDD">
 1007: <form action="/adm/coursedocs" method="post" name="simpleeditsupplement">
 1008: <input type="hidden" name="folder" value="$folder">
 1009: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 1010: <input type=hidden name="importdetail" value="">
 1011: <input type=button onClick=
 1012: "javascript:document.forms.simpleedit.folder.value='$folder';groupsearch()" value="Search">
 1013: <input type=button onClick=
 1014: "javascript:document.forms.simpleedit.folder.value='$folder';groupimport();" value="Import">$help{'Importing_LON-CAPA_Resource'}
 1015: <p>
 1016: <hr />
 1017: <input type="text" size="20" name="importmap">
 1018: <input type=button 
 1019: onClick="javascript:openbrowser('simpleeditsupplement','importmap','sequence,page','')"
 1020: value="Select Map"><input type="submit" name="loadmap" value="Load Map">
 1021: </p>
 1022: </form>
 1023: </td><td bgcolor="#DDDDDD">
 1024: <form action="/adm/coursedocs" method="post" name="supnewfolder">
 1025: <input type="hidden" name="folder" value="$folder">
 1026: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 1027: <input type=hidden name="importdetail" value="">
 1028: <nobr>
 1029: <input name="newfolder" type="button"
 1030: onClick="javascript:makenewfolder(this.form,'$folderseq');"
 1031: value="New Folder" /> $help{'Adding_Folders'}
 1032: </nobr>
 1033: </form>
 1034: <form action="/adm/coursedocs" method="post" name="supnewext">
 1035: <input type="hidden" name="folder" value="$folder">
 1036: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 1037: <input type=hidden name="importdetail" value="">
 1038: <nobr>
 1039: <input name="newext" type="button" 
 1040: onClick="javascript:makenewext('supnewext');"
 1041: value="External Resource" /> $help{'Adding_External_Resource'}
 1042: </nobr>
 1043: </form>
 1044: <form action="/adm/coursedocs" method="post" name="supnewsyl">
 1045: <input type="hidden" name="folder" value="$folder">
 1046: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 1047: <input type=hidden name="importdetail" 
 1048: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
 1049: <nobr>
 1050: <input name="newsyl" type="submit" value="Syllabus" />
 1051: $help{'Syllabus'}
 1052: </nobr>
 1053: </form>
 1054: <form action="/adm/coursedocs" method="post" name="subnewaboutme">
 1055: <input type="hidden" name="folder" value="$folder">
 1056: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
 1057: <input type=hidden name="importdetail" 
 1058: value="$plainname=/adm/$udom/$uname/aboutme">
 1059: <nobr>
 1060: <input name="newaboutme" type="submit" value="My Personal Info" />
 1061: $help{'My Personal Info'}
 1062: </nobr>
 1063: </form>
 1064: </td></tr>
 1065: </table></td></tr>
 1066: ENDSUPFORM
 1067:        }
 1068:     }
 1069:     if ($allowed) {
 1070: 	$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
 1071:     }
 1072:     $r->print('</table>');
 1073:   } else {
 1074: # -------------------------------------------------------- This is showdoc mode
 1075:       $r->print("<h1>Uploaded Document</h1><p>It is recommended that you use an up-to-date virus scanner before handling this file.</p><p><table>".
 1076:          &entryline(0,"Click to download or use your browser's Save Link function",$showdoc).'</table></p>');
 1077:   }
 1078:  }
 1079:  $r->print('</body></html>');
 1080:  return OK;
 1081: } 
 1082: 
 1083: 1;
 1084: __END__

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