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

1.1       www         1: # The LearningOnline Network
1.2       www         2: # Documents
1.1       www         3: #
1.26    ! www         4: # $Id: londocs.pm,v 1.25 2002/10/10 17:17:11 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;
                     32: use Apache::Constants qw(:common);
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.7       www        38: 
1.8       www        39: my $iconpath;
1.7       www        40: 
                     41: # Mapread read maps into lonratedt::global arrays 
1.10      www        42: # @order and @resources, determines status
1.7       www        43: # sets @order - pointer to resources in right order
                     44: # sets @resources - array with the resources with correct idx
                     45: #
                     46: 
                     47: sub mapread {
                     48:     my ($coursenum,$coursedom,$map)=@_;
                     49:     return
                     50:       &Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
                     51:                                 $map);
                     52: }
                     53: 
                     54: sub storemap {
                     55:     my ($coursenum,$coursedom,$map)=@_;
                     56:     return
                     57:       &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
1.15      www        58:                                 $map,1);
1.7       www        59: }
                     60: 
                     61: sub editor {
                     62:     my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
1.17      www        63:     if ($ENV{'form.foldername'}) {
                     64: 	$r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
                     65:     }
1.10      www        66:     my $errtext='';
                     67:     my $fatal=0;
                     68:     ($errtext,$fatal)=
1.7       www        69:           &mapread($coursenum,$coursedom,$folder.'.sequence');
1.17      www        70:     if ($#Apache::lonratedt::order<1) {
                     71:        	$Apache::lonratedt::order[0]=1;
                     72:         $Apache::lonratedt::resources[1]='';
                     73:     }
1.7       www        74:     if ($fatal) {
                     75: 	   $r->print('<p><font color="red">'.$errtext.'</font></p>');
                     76:     } else {
                     77: # ------------------------------------------------------------ Process commands
1.16      www        78: # ---------------- if they are for this folder and user allowed to make changes
                     79: 	if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
1.10      www        80: # upload a file, if present
                     81:            if (($ENV{'form.uploaddoc.filename'}) &&
                     82:                ($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
                     83: 	    if ($folder=~/^$1/) {
                     84: # this is for a course, not a user, so set coursedoc flag
                     85: # probably the only place in the system where this should be "1"
                     86: 	      my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
                     87:               my $ext='false';
                     88:               if ($url=~/^http\:\/\//) { $ext='true'; }
                     89:               $url=~s/\:/\&colon;/g;
                     90: 	      my $comment=$ENV{'form.comment'};
                     91:               $comment=~s/\</\&lt\;/g;
                     92:               $comment=~s/\>/\&gt\;/g;
                     93:               $comment=~s/\:/\&colon;/g;
1.17      www        94:               if ($folder=~/^supplemental/) {
                     95: 		  $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
                     96: 		      $ENV{'user.domain'}.'___&&&___'.$comment;
                     97:               }
1.10      www        98:               my $newidx=$#Apache::lonratedt::resources+1;
                     99:               $Apache::lonratedt::resources[$newidx]=
                    100:                   $comment.':'.$url.':'.$ext.':normal:res';
                    101:               $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=
                    102:                                                               $newidx;       
                    103:  	      &storemap($coursenum,$coursedom,$folder.'.sequence');
                    104: 	     }
                    105:             }
1.8       www       106: 	    if ($ENV{'form.cmd'}) {
1.10      www       107:                 my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
                    108:                 if ($cmd eq 'del') {
                    109: 		    for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
                    110:                         $Apache::lonratedt::order[$i]=
                    111:                           $Apache::lonratedt::order[$i+1];
                    112:                     }
                    113:                     $#Apache::lonratedt::order--;
                    114:                 } elsif ($cmd eq 'up') {
                    115:                     my $i=$Apache::lonratedt::order[$idx-1];
                    116:                     $Apache::lonratedt::order[$idx-1]=
                    117: 			$Apache::lonratedt::order[$idx];
                    118:                     $Apache::lonratedt::order[$idx]=$i;
                    119:                 } elsif ($cmd eq 'down') {
                    120:                     my $i=$Apache::lonratedt::order[$idx+1];
                    121:                     $Apache::lonratedt::order[$idx+1]=
                    122: 			$Apache::lonratedt::order[$idx];
                    123:                     $Apache::lonratedt::order[$idx]=$i;
                    124:                 }
                    125: # Store the changed version
                    126: 		&storemap($coursenum,$coursedom,$folder.'.sequence');
1.8       www       127:             }
1.11      www       128: # Group import/search
                    129: 	    if ($ENV{'form.importdetail'}) {
                    130:                foreach (split(/\&/,$ENV{'form.importdetail'})) {
                    131:                   if (defined($_)) {
                    132: 	             my ($name,$url)=split(/\=/,$_);
                    133:                      $name=&Apache::lonnet::unescape($name);
                    134:                      $url=&Apache::lonnet::unescape($url);
                    135:                      if ($url) {
                    136: 	                my $idx=$#Apache::lonratedt::resources+1;
                    137:                         $Apache::lonratedt::order
                    138:                            [$#Apache::lonratedt::order+1]=$idx;
                    139:                         my $ext='false';
                    140:                         if ($url=~/^http\:\/\//) { $ext='true'; }
                    141:                         $url=~s/\:/\&colon;/g;
                    142:                         $Apache::lonratedt::resources[$idx]=
                    143:                            $name.':'.$url.':'.$ext.':normal:res';
                    144: 	             }
                    145:                  }
                    146: 	      }
                    147: # Store the changed version
                    148: 		&storemap($coursenum,$coursedom,$folder.'.sequence');
                    149:             }
1.16      www       150:        }
                    151: # ---------------------------------------------------------------- End commands
1.7       www       152: # ---------------------------------------------------------------- Print screen
1.10      www       153:         my $idx=0;
                    154:         $r->print('<table>');
                    155:         foreach (@Apache::lonratedt::order) {
                    156:            my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
                    157:            unless ($name) {  $name=(split(/\//,$url))[-1]; }
                    158:            unless ($name) { $name='EMPTY'; }
                    159:            $r->print(&entryline($idx,$name,$url,$folder,$allowed));
                    160:            $idx++;
                    161:         }
                    162:         $r->print('</table>');
1.7       www       163:     }
                    164: }
1.1       www       165: 
1.8       www       166: # --------------------------------------------------------------- An entry line
                    167: 
                    168: sub entryline {
                    169:     my ($index,$title,$url,$folder,$allowed)=@_;
                    170:     my $line='<tr>';
                    171: # Edit commands
                    172:     if ($allowed) {
                    173:        $line.=(<<END);
                    174: <td><table border='0' cellspacing='0' cellpadding='0'>
                    175: <tr><td><a href='/adm/coursedocs?folder=$folder&cmd=up_$index'>
                    176: <img src="${iconpath}move_up.gif" alt='UP' border='0' /></a></td></tr>
                    177: <tr><td><a href='/adm/coursedocs?folder=$folder&cmd=down_$index'>
                    178: <img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr>
                    179: </table></td><td>
                    180: <a href='/adm/coursedocs?folder=$folder&cmd=del_$index'>Remove</td>
                    181: END
                    182:     }
1.16      www       183: # Figure out what kind of a resource this is
                    184:     my ($extension)=($url=~/\.(\w+)$/);
                    185:     my $uploaded=($url=~/^\/*uploaded\//);
                    186:     my $icon='unknown';
                    187:     if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {
                    188: 	$icon=$extension;
1.10      www       189:     }
1.17      www       190:     my $isfolder=0;
1.16      www       191:     if ($uploaded) {
                    192:        if ($extension eq 'sequence') {
                    193: 	  $icon='folder_closed';
                    194:           $url=~/\/(\w+)\.sequence/;
                    195:           $url='/adm/coursedocs?folder='.$1;
1.17      www       196:           $isfolder=1;
1.16      www       197:        } else {
                    198: 	  $url=&Apache::lonnet::tokenwrapper($url);
                    199:        } 
                    200:     }
1.18      www       201:     $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
1.8       www       202: # Title
                    203:     $title=&Apache::lonnet::unescape($title);
1.17      www       204:     my $foldertitle=$title;
1.8       www       205:     if ($title=~
                    206:  /^(\d+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(.*)$/
1.17      www       207: 	) { 
                    208:             $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
                    209:             $title='<i>'.localtime($1).'</i> '.
                    210:                 &Apache::loncommon::plainname($2,$3).': <br>'.
                    211: 		$foldertitle;
1.8       www       212: 	}
1.17      www       213:     if ($isfolder) { $url.='&foldername='.$foldertitle; }
1.23      www       214:     $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'" target="cat_'.$folder.
                    215: '"><img src="/adm/lonIcons/'.
1.17      www       216:         $icon.'.gif" border="0"></a></td>'.
1.23      www       217:         "<td bgcolor='#FFFFBB'><a href='$url' target='cat_$folder'>$title</a></td></tr>";
1.8       www       218:     return $line;
                    219: }
                    220: 
                    221: # ================================================================ Main Handler
1.1       www       222: sub handler {
                    223:     my $r = shift;
                    224:     $r->content_type('text/html');
                    225:     $r->send_http_header;
                    226:     return OK if $r->header_only;
                    227: 
1.26    ! www       228:   if ($ENV{'form.verify'}) {
        !           229:  
        !           230:    my $loaderror=&Apache::lonnet::overloaderror($r);
        !           231:    if ($loaderror) { return $loaderror; }
        !           232: 
        !           233:    $r->print('<html><head><title>Verify Content</title></head>'.
        !           234:               &Apache::loncommon::bodytag('Verify Course Documents'));
        !           235: 
        !           236:   } elsif ($ENV{'form.versions'}) {
        !           237:     $r->print('<html><head><title>Check Versions</title></head>'.
        !           238:               &Apache::loncommon::bodytag('Check Course Document Versions'));
        !           239: 
        !           240:   } else {
1.7       www       241: # is this a standard course?
                    242: 
                    243:     my $standard=($ENV{'request.course.uri'}=~/^\/uploaded\//);
1.15      www       244:     my $forcestandard;
                    245:     my $forcesupplement;
                    246:     my $script='';
                    247:     my $allowed;
                    248:     my $events='';
1.19      www       249:     my $showdoc=0;
1.15      www       250:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.21      www       251:        ['folder','foldername']);
                    252:     if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
                    253:        $showdoc=$1;
                    254:     }
                    255:     unless ($showdoc) { # got called from remote
1.15      www       256:        $forcestandard=($ENV{'form.folder'}=~/^default_/);
                    257:        $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
1.7       www       258: 
1.4       www       259: # does this user have privileges to post, etc?
1.15      www       260:        $allowed=&Apache::lonnet::allowed('srm',$ENV{'request.course.id'});
                    261:        if ($allowed) { 
                    262:          &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
                    263:          $script=&Apache::lonratedt::editscript('simple'); 
                    264:        }
                    265:     } else { # got called in sequence from course
                    266:        $allowed=0;
1.21      www       267:        $script='</script>'.&Apache::lonxml::registerurl(1,undef).'<script>';
1.15      www       268:        $events='onLoad="'.&Apache::lonxml::loadevents.
                    269:            '" onUnload="'.&Apache::lonxml::unloadevents.'"';
1.3       www       270:     }
1.4       www       271: 
                    272: # get course data
                    273:     my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
                    274:     my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
                    275: 
1.14      www       276: # get personal data
                    277:  
                    278:     my $uname=$ENV{'user.name'};
                    279:     my $udom=$ENV{'user.domain'};
                    280:     my $plainname=&Apache::lonnet::escape(
                    281:                      &Apache::loncommon::plainname($uname,$udom));
                    282: 
1.8       www       283: # graphics settings
1.4       www       284: 
1.8       www       285:     $iconpath = $r->dir_config('lonIconsURL') . "/";
                    286: 
1.22      www       287:     my $now=time;
                    288: 
1.4       www       289: # print screen
1.1       www       290:     $r->print(<<ENDDOCUMENT);
                    291: <html>
                    292: <head>
                    293: <title>The LearningOnline Network with CAPA</title>
1.16      www       294: <script>
                    295: $script
1.20      www       296: </script>
1.19      www       297: ENDDOCUMENT
                    298:    if ($allowed) {
                    299:     $r->print(<<ENDNEWSCRIPT);
1.20      www       300: <script>
1.16      www       301: function makenewfolder(targetform,folderseq) {
                    302:     var foldername=prompt('Name of New Folder','New Folder');
                    303:     if (foldername) {
                    304: 	targetform.importdetail.value=foldername+"="+folderseq;
                    305:         targetform.submit();
                    306:     }
                    307: }
                    308: 
1.18      www       309: function makenewext(targetname) {
                    310:     this.document.forms.extimport.useform.value=targetname;
                    311:     window.open('/adm/rat/extpickframe.html');
                    312: }
                    313: 
1.22      www       314: function makesmppage() {
                    315:     var title=prompt('Listed Title for the Page');
                    316:     this.document.forms.newsmppg.importdetail.value=
                    317: 	title+'=/adm/$udom/$uname/$now/smppg';
                    318:     this.document.forms.newsmppg.submit();
                    319: }
                    320: 
                    321: function makebulboard() {
                    322:     var title=prompt('Listed Title for the Bulletin Board');
                    323:     this.document.forms.newbul.importdetail.value=
                    324: 	title+'=/adm/$udom/$uname/$now/bulletinboard';
                    325:     this.document.forms.newbul.submit();
                    326: }
                    327: 
1.18      www       328: function finishpick() {
                    329:     var title=this.document.forms.extimport.title.value;
                    330:     var url=this.document.forms.extimport.url.value;
                    331:     var form=this.document.forms.extimport.useform.value;
                    332:     eval
                    333:      ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
                    334:     '";this.document.forms.'+form+'.submit();');
1.16      www       335: }
                    336: </script>
1.19      www       337: ENDNEWSCRIPT
                    338:   }
                    339: # -------------------------------------------------------------------- Body tag
1.20      www       340:   $r->print('</head>'.
                    341:             &Apache::loncommon::bodytag('Course Documents','',$events));
1.19      www       342:   unless ($showdoc) {
1.25      www       343:     if ($allowed) {
                    344:        $r->print(<<ENDCOURSEVERIFY);
1.26    ! www       345: <form action="/adm/coursedocs" method="post" name="courseverify">
1.25      www       346: <input type="submit" name="verify" value="Verify Content" />
                    347: <input type="submit" name="versions" value="Check Resource Versions" />
                    348: </form>
                    349: ENDCOURSEVERIFY
                    350:     }
1.17      www       351: # --------------------------------------------------------- Standard documents
1.24      www       352:     $r->print('<table>');
1.7       www       353:     if (($standard) && ($allowed) && (!$forcesupplement)) {
1.24      www       354:        $r->print('<tr><td bgcolor="#FFFFBB"><h2>Main Course Documents</h2>');
1.7       www       355:        my $folder=$ENV{'form.folder'};
1.10      www       356:        unless ($folder=~/^default/) { $folder='default'; }
1.7       www       357:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
1.16      www       358:        my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
                    359:                      '.sequence';
1.8       www       360:        $r->print(<<ENDFORM);
1.16      www       361: <table cellspacing=2><tr>
                    362: <th bgcolor="#DDDDDD">Upload a new main course document</th>
                    363: <th bgcolor="#DDDDDD">Import a published document</th>
                    364: <th bgcolor="#DDDDDD">Special documents</th>
1.11      www       365: </tr>
1.16      www       366: <tr><td bgcolor="#DDDDDD">
1.11      www       367: File:<br />
1.10      www       368: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
1.8       www       369: <input type="file" name="uploaddoc" size="50">
                    370: <br />
1.11      www       371: Title:<br /> 
                    372: <input type="text" size="50" name="comment">
1.8       www       373: <input type="hidden" name="folder" value="$folder">
1.17      www       374: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.10      www       375: <input type="hidden" name="cmd" value="upload_default">
1.8       www       376: <input type="submit" value="Upload Document">
                    377: </form>
1.11      www       378: </td>
1.16      www       379: <td bgcolor="#DDDDDD">
1.11      www       380: <form action="/adm/coursedocs" method="post" name="simpleedit">
1.16      www       381: <input type="hidden" name="folder" value="$folder">
1.11      www       382: <input type=hidden name="importdetail" value="">
                    383: <input type=button onClick=
1.16      www       384: "javascript:groupsearch()" value="Search">
1.11      www       385: <input type=button onClick=
1.16      www       386: "javascript:groupimport();" value="Import">
1.11      www       387: </form>
1.16      www       388: </td><td bgcolor="#DDDDDD">
1.11      www       389: <form action="/adm/coursedocs" method="post" name="newfolder">
1.16      www       390: <input type="hidden" name="folder" value="$folder">
1.17      www       391: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.13      www       392: <input type=hidden name="importdetail" value="">
1.16      www       393: <input name="newfolder" type="button"
                    394: onClick="javascript:makenewfolder(this.form,'$folderseq');"
1.11      www       395: value="New Folder" />
                    396: </form>
                    397: <form action="/adm/coursedocs" method="post" name="newext">
1.16      www       398: <input type="hidden" name="folder" value="$folder">
1.17      www       399: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.13      www       400: <input type=hidden name="importdetail" value="">
1.18      www       401: <input name="newext" type="button" onClick="javascript:makenewext('newext');"
1.11      www       402: value="External Resource" />
                    403: </form>
                    404: <form action="/adm/coursedocs" method="post" name="newsyl">
1.16      www       405: <input type="hidden" name="folder" value="$folder">
1.17      www       406: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.14      www       407: <input type=hidden name="importdetail" 
                    408: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
                    409: <input name="newsyl" type="submit" value="Syllabus" />
1.15      www       410: </form>
1.17      www       411: <form action="/adm/coursedocs" method="post" name="newnav">
1.20      www       412: <input type="hidden" name="folder" value="$folder">
                    413: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.15      www       414: <input type=hidden name="importdetail" 
                    415: value="Navigate Content=/adm/navmaps">
1.20      www       416: <input name="newnav" type="submit" value="Navigate Content" />
1.22      www       417: </form>
                    418: <form action="/adm/coursedocs" method="post" name="newsmppg">
                    419: <input type="hidden" name="folder" value="$folder">
                    420: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    421: <input type=hidden name="importdetail" value="">
                    422: <input name="newsmppg" type="button" value="Simple Page"
                    423: onClick="javascript:makesmppage();" />
                    424: </form>
                    425: <form action="/adm/coursedocs" method="post" name="newbul">
                    426: <input type="hidden" name="folder" value="$folder">
                    427: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    428: <input type=hidden name="importdetail" value="">
                    429: <input name="newbulletin" type="button" value="Bulletin Board"
                    430: onClick="javascript:makebulboard();" />
1.12      www       431: </form>
                    432: <form action="/adm/coursedocs" method="post" name="newaboutme">
1.16      www       433: <input type="hidden" name="folder" value="$folder">
1.17      www       434: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.14      www       435: <input type=hidden name="importdetail" 
                    436: value="$plainname=/adm/$udom/$uname/aboutme">
1.16      www       437: <input name="newaboutme" type="submit" value="My Personal Info" />
1.11      www       438: </form>
                    439: </td></tr>
                    440: </table>
1.8       www       441: ENDFORM
1.24      www       442:        $r->print('</td></tr>');
1.7       www       443:     }
                    444: # ----------------------------------------------------- Supplemental documents
                    445:     if (!$forcestandard) {
1.24      www       446:        $r->print(
                    447:   '<tr><td bgcolor="#BBFFFF"><h2>Supplemental Course Documents</h2>');
1.7       www       448:        my $folder=$ENV{'form.folder'};
1.10      www       449:        unless ($folder=~/supplemental/) { $folder='supplemental'; }
1.7       www       450:        &editor($r,$coursenum,$coursedom,$folder,$allowed);
1.8       www       451:        if ($allowed) {
1.17      www       452:        my $folderseq=
                    453:                   '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
                    454:                      '.sequence';
                    455: 
1.8       www       456:           $r->print(<<ENDSUPFORM);
1.17      www       457: <table cellspacing=2><tr>
                    458: <th bgcolor="#DDDDDD">Upload a new supplemental course document</th>
                    459: <th bgcolor="#DDDDDD">Import a published document</th>
                    460: <th bgcolor="#DDDDDD">Special documents</th>
                    461: </tr>
                    462: <tr><td bgcolor="#DDDDDD">
1.10      www       463: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
1.4       www       464: <input type="file" name="uploaddoc" size="50">
                    465: <br />Comment:<br />
                    466: <textarea cols=50 rows=4 name='comment'>
                    467: </textarea>
1.8       www       468: <input type="hidden" name="folder" value="$folder">
1.17      www       469: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.10      www       470: <input type="hidden" name="cmd" value="upload_supplemental">
1.3       www       471: <input type="submit" value="Upload Document">
                    472: </form>
1.17      www       473: </td>
                    474: <td bgcolor="#DDDDDD">
                    475: <form action="/adm/coursedocs" method="post" name="simpleedit">
                    476: <input type="hidden" name="folder" value="$folder">
                    477: <input type=hidden name="importdetail" value="">
                    478: <input type=button onClick=
                    479: "javascript:groupsearch()" value="Search">
                    480: <input type=button onClick=
                    481: "javascript:groupimport();" value="Import">
                    482: </form>
                    483: </td><td bgcolor="#DDDDDD">
1.18      www       484: <form action="/adm/coursedocs" method="post" name="supnewfolder">
1.17      www       485: <input type="hidden" name="folder" value="$folder">
                    486: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    487: <input type=hidden name="importdetail" value="">
                    488: <input name="newfolder" type="button"
                    489: onClick="javascript:makenewfolder(this.form,'$folderseq');"
                    490: value="New Folder" />
                    491: </form>
1.18      www       492: <form action="/adm/coursedocs" method="post" name="supnewext">
1.17      www       493: <input type="hidden" name="folder" value="$folder">
                    494: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    495: <input type=hidden name="importdetail" value="">
1.18      www       496: <input name="newext" type="button" 
                    497: onClick="javascript:makenewext('supnewext');"
1.17      www       498: value="External Resource" />
                    499: </form>
1.18      www       500: <form action="/adm/coursedocs" method="post" name="supnewsyl">
1.17      www       501: <input type="hidden" name="folder" value="$folder">
                    502: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    503: <input type=hidden name="importdetail" 
                    504: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
                    505: <input name="newsyl" type="submit" value="Syllabus" />
                    506: </form>
1.18      www       507: <form action="/adm/coursedocs" method="post" name="subnewaboutme">
1.17      www       508: <input type="hidden" name="folder" value="$folder">
                    509: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
                    510: <input type=hidden name="importdetail" 
                    511: value="$plainname=/adm/$udom/$uname/aboutme">
                    512: <input name="newaboutme" type="submit" value="My Personal Info" />
                    513: </form>
                    514: </td></tr>
1.24      www       515: </table></td></tr>
1.8       www       516: ENDSUPFORM
                    517:        }
1.7       www       518:     }
1.18      www       519:     if ($allowed) {
                    520: 	$r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
                    521:     }
1.24      www       522:     $r->print('</table>');
1.19      www       523:   } else {
                    524: # -------------------------------------------------------- This is showdoc mode
                    525:       $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       526:          &entryline(0,"Click to download or use your browser's Save Link function",$showdoc).'</table></p>');
1.19      www       527:   }
1.26    ! www       528:  }
        !           529:  $r->print('</body></html>');
        !           530:  return OK;
1.1       www       531: } 
                    532: 
                    533: 1;
                    534: __END__

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