Annotation of loncom/interface/londocs.pm, revision 1.73

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

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