Annotation of loncom/interface/londocs.pm, revision 1.32
1.1 www 1: # The LearningOnline Network
1.2 www 2: # Documents
1.1 www 3: #
1.32 ! www 4: # $Id: londocs.pm,v 1.31 2002/10/17 15:18:03 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.27 www 38: use GDBM_File;
1.7 www 39:
1.8 www 40: my $iconpath;
1.7 www 41:
1.27 www 42: my %hash;
43:
44: my $hashtied;
1.29 www 45: my %alreadyseen=();
1.27 www 46:
1.7 www 47: # Mapread read maps into lonratedt::global arrays
1.10 www 48: # @order and @resources, determines status
1.7 www 49: # sets @order - pointer to resources in right order
50: # sets @resources - array with the resources with correct idx
51: #
52:
53: sub mapread {
54: my ($coursenum,$coursedom,$map)=@_;
55: return
56: &Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
57: $map);
58: }
59:
60: sub storemap {
61: my ($coursenum,$coursedom,$map)=@_;
62: return
63: &Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'.
1.15 www 64: $map,1);
1.7 www 65: }
66:
67: sub editor {
68: my ($r,$coursenum,$coursedom,$folder,$allowed)=@_;
1.17 www 69: if ($ENV{'form.foldername'}) {
70: $r->print('<h3>Folder: '.$ENV{'form.foldername'}.'</h3>');
71: }
1.10 www 72: my $errtext='';
73: my $fatal=0;
74: ($errtext,$fatal)=
1.7 www 75: &mapread($coursenum,$coursedom,$folder.'.sequence');
1.17 www 76: if ($#Apache::lonratedt::order<1) {
77: $Apache::lonratedt::order[0]=1;
78: $Apache::lonratedt::resources[1]='';
79: }
1.7 www 80: if ($fatal) {
81: $r->print('<p><font color="red">'.$errtext.'</font></p>');
82: } else {
83: # ------------------------------------------------------------ Process commands
1.16 www 84: # ---------------- if they are for this folder and user allowed to make changes
85: if (($allowed) && ($ENV{'form.folder'} eq $folder)) {
1.10 www 86: # upload a file, if present
87: if (($ENV{'form.uploaddoc.filename'}) &&
88: ($ENV{'form.cmd'}=~/^upload_(\w+)/)) {
89: if ($folder=~/^$1/) {
90: # this is for a course, not a user, so set coursedoc flag
91: # probably the only place in the system where this should be "1"
92: my $url=&Apache::lonnet::userfileupload('uploaddoc',1);
93: my $ext='false';
94: if ($url=~/^http\:\/\//) { $ext='true'; }
95: $url=~s/\:/\:/g;
96: my $comment=$ENV{'form.comment'};
97: $comment=~s/\</\<\;/g;
98: $comment=~s/\>/\>\;/g;
99: $comment=~s/\:/\:/g;
1.17 www 100: if ($folder=~/^supplemental/) {
101: $comment=time.'___&&&___'.$ENV{'user.name'}.'___&&&___'.
102: $ENV{'user.domain'}.'___&&&___'.$comment;
103: }
1.10 www 104: my $newidx=$#Apache::lonratedt::resources+1;
105: $Apache::lonratedt::resources[$newidx]=
106: $comment.':'.$url.':'.$ext.':normal:res';
107: $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=
108: $newidx;
109: &storemap($coursenum,$coursedom,$folder.'.sequence');
110: }
111: }
1.8 www 112: if ($ENV{'form.cmd'}) {
1.10 www 113: my ($cmd,$idx)=split(/\_/,$ENV{'form.cmd'});
114: if ($cmd eq 'del') {
115: for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) {
116: $Apache::lonratedt::order[$i]=
117: $Apache::lonratedt::order[$i+1];
118: }
119: $#Apache::lonratedt::order--;
120: } elsif ($cmd eq 'up') {
121: my $i=$Apache::lonratedt::order[$idx-1];
122: $Apache::lonratedt::order[$idx-1]=
123: $Apache::lonratedt::order[$idx];
124: $Apache::lonratedt::order[$idx]=$i;
125: } elsif ($cmd eq 'down') {
126: my $i=$Apache::lonratedt::order[$idx+1];
127: $Apache::lonratedt::order[$idx+1]=
128: $Apache::lonratedt::order[$idx];
129: $Apache::lonratedt::order[$idx]=$i;
130: }
131: # Store the changed version
132: &storemap($coursenum,$coursedom,$folder.'.sequence');
1.8 www 133: }
1.11 www 134: # Group import/search
135: if ($ENV{'form.importdetail'}) {
136: foreach (split(/\&/,$ENV{'form.importdetail'})) {
137: if (defined($_)) {
138: my ($name,$url)=split(/\=/,$_);
139: $name=&Apache::lonnet::unescape($name);
140: $url=&Apache::lonnet::unescape($url);
141: if ($url) {
142: my $idx=$#Apache::lonratedt::resources+1;
143: $Apache::lonratedt::order
144: [$#Apache::lonratedt::order+1]=$idx;
145: my $ext='false';
146: if ($url=~/^http\:\/\//) { $ext='true'; }
147: $url=~s/\:/\:/g;
148: $Apache::lonratedt::resources[$idx]=
149: $name.':'.$url.':'.$ext.':normal:res';
150: }
151: }
152: }
153: # Store the changed version
154: &storemap($coursenum,$coursedom,$folder.'.sequence');
155: }
1.16 www 156: }
157: # ---------------------------------------------------------------- End commands
1.7 www 158: # ---------------------------------------------------------------- Print screen
1.10 www 159: my $idx=0;
160: $r->print('<table>');
161: foreach (@Apache::lonratedt::order) {
162: my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]);
163: unless ($name) { $name=(split(/\//,$url))[-1]; }
164: unless ($name) { $name='EMPTY'; }
165: $r->print(&entryline($idx,$name,$url,$folder,$allowed));
166: $idx++;
167: }
168: $r->print('</table>');
1.7 www 169: }
170: }
1.1 www 171:
1.8 www 172: # --------------------------------------------------------------- An entry line
173:
174: sub entryline {
175: my ($index,$title,$url,$folder,$allowed)=@_;
176: my $line='<tr>';
177: # Edit commands
178: if ($allowed) {
179: $line.=(<<END);
180: <td><table border='0' cellspacing='0' cellpadding='0'>
181: <tr><td><a href='/adm/coursedocs?folder=$folder&cmd=up_$index'>
182: <img src="${iconpath}move_up.gif" alt='UP' border='0' /></a></td></tr>
183: <tr><td><a href='/adm/coursedocs?folder=$folder&cmd=down_$index'>
184: <img src="${iconpath}move_down.gif" alt='DOWN' border='0' /></a></td></tr>
185: </table></td><td>
186: <a href='/adm/coursedocs?folder=$folder&cmd=del_$index'>Remove</td>
187: END
188: }
1.16 www 189: # Figure out what kind of a resource this is
190: my ($extension)=($url=~/\.(\w+)$/);
191: my $uploaded=($url=~/^\/*uploaded\//);
192: my $icon='unknown';
193: if (-e "/home/httpd/html/adm/lonIcons/$extension.gif") {
194: $icon=$extension;
1.10 www 195: }
1.17 www 196: my $isfolder=0;
1.16 www 197: if ($uploaded) {
198: if ($extension eq 'sequence') {
199: $icon='folder_closed';
200: $url=~/\/(\w+)\.sequence/;
201: $url='/adm/coursedocs?folder='.$1;
1.17 www 202: $isfolder=1;
1.16 www 203: } else {
204: $url=&Apache::lonnet::tokenwrapper($url);
205: }
206: }
1.18 www 207: $url=~s/^http\&colon\;\/\//\/adm\/wrapper\/ext\//;
1.8 www 208: # Title
209: $title=&Apache::lonnet::unescape($title);
1.17 www 210: my $foldertitle=$title;
1.8 www 211: if ($title=~
212: /^(\d+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(\w+)\_\_\_\&\&\&\_\_\_(.*)$/
1.17 www 213: ) {
214: $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
215: $title='<i>'.localtime($1).'</i> '.
216: &Apache::loncommon::plainname($2,$3).': <br>'.
217: $foldertitle;
1.8 www 218: }
1.17 www 219: if ($isfolder) { $url.='&foldername='.$foldertitle; }
1.23 www 220: $line.='<td bgcolor="#FFFFBB"><a href="'.$url.'" target="cat_'.$folder.
221: '"><img src="/adm/lonIcons/'.
1.17 www 222: $icon.'.gif" border="0"></a></td>'.
1.23 www 223: "<td bgcolor='#FFFFBB'><a href='$url' target='cat_$folder'>$title</a></td></tr>";
1.8 www 224: return $line;
225: }
226:
1.27 www 227: # ---------------------------------------------------------------- tie the hash
228:
229: sub tiehash {
230: $hashtied=0;
231: if ($ENV{'request.course.fn'}) {
232: if (tie(%hash,'GDBM_File',$ENV{'request.course.fn'}.".db",
233: &GDBM_READER(),0640)) {
234: $hashtied=1;
235: }
236: }
237: }
238:
239: sub untiehash {
240: if ($hashtied) { untie %hash; }
241: $hashtied=0;
242: }
243:
1.29 www 244: # --------------------------------------------------------------- check on this
245:
246: sub checkonthis {
247: my ($r,$url,$level,$title)=@_;
248: $alreadyseen{$url}=1;
249: $r->rflush();
250: if ($url) {
251: $r->print('<br />');
252: for (my $i=0;$i<=$level*5;$i++) {
253: $r->print(' ');
254: }
255: $r->print('<a href="'.$url.'" target="cat">'.
256: ($title?$title:$url).'</a> ');
257: if ($url=~/^\/res\//) {
258: my $result=&Apache::lonnet::repcopy(
259: &Apache::lonnet::filelocation('',$url));
260: if ($result==OK) {
261: $r->print('<font color="green">ok</font>');
262: $r->rflush();
263: my $dependencies=
264: &Apache::lonnet::metadata($url,'dependencies');
265: foreach (split(/\,/,$dependencies)) {
266: if (($_=~/^\/res\//) && (!$alreadyseen{$_})) {
267: &checkonthis($r,$_,$level+1);
268: }
269: }
270: } elsif ($result==HTTP_SERVICE_UNAVAILABLE) {
271: $r->print('<font color="red"><b>connection down</b></font>');
272: } elsif ($result==HTTP_NOT_FOUND) {
273: $r->print('<font color="red"><b>not found</b></font>');
274: } else {
275: $r->print('<font color="red"><b>access denied</b></font>');
276: }
277: }
278: }
279: }
280:
1.8 www 281: # ================================================================ Main Handler
1.1 www 282: sub handler {
283: my $r = shift;
284: $r->content_type('text/html');
285: $r->send_http_header;
286: return OK if $r->header_only;
287:
1.27 www 288:
1.26 www 289: if ($ENV{'form.verify'}) {
290:
291: my $loaderror=&Apache::lonnet::overloaderror($r);
292: if ($loaderror) { return $loaderror; }
293:
294: $r->print('<html><head><title>Verify Content</title></head>'.
295: &Apache::loncommon::bodytag('Verify Course Documents'));
1.27 www 296: $hashtied=0;
1.30 www 297: undef %alreadyseen;
298: %alreadyseen=();
1.27 www 299: &tiehash();
300: foreach (keys %hash) {
1.28 www 301: if (($_=~/^src\_(.+)$/) && (!$alreadyseen{$hash{$_}})) {
1.29 www 302: &checkonthis($r,$hash{$_},0,$hash{'title_'.$1});
1.27 www 303: }
304: }
305: &untiehash();
1.26 www 306: } elsif ($ENV{'form.versions'}) {
307: $r->print('<html><head><title>Check Versions</title></head>'.
308: &Apache::loncommon::bodytag('Check Course Document Versions'));
1.27 www 309: $hashtied=0;
310: &tiehash();
1.30 www 311: my %changes=&Apache::lonnet::dump
312: ('versionupdate',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
313: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
1.31 www 314: my $firstkey=(keys %changes)[0];
315: unless ($firstkey=~/^error\:/) {
316: unless ($ENV{'form.timerange'}) {
317: $ENV{'form.timerange'}=604800;
318: }
319: my $seltext='during the last '.$ENV{'form.timerange'}.' seconds';
320: my $startsel='';
321: my $monthsel='';
322: my $weeksel='';
323: my $daysel='';
324: if ($ENV{'form.timerange'}==-1) {
325: $seltext='since start of course';
326: $startsel='selected';
1.32 ! www 327: $ENV{'form.timerange'}=time;
! 328: }
! 329: my $starttime=time-$ENV{'form.timerange'};
! 330: if ($ENV{'form.timerange'}==2592000) {
! 331: $seltext='during the last month ('.localtime($starttime).')';
1.31 www 332: $monthsel='selected';
333: } elsif ($ENV{'form.timerange'}==604800) {
1.32 ! www 334: $seltext='during the last week ('.localtime($starttime).')';
1.31 www 335: $weeksel='selected';
336: } elsif ($ENV{'form.timerange'}==86400) {
1.32 ! www 337: $seltext='since yesterday ('.localtime($starttime).')';
1.31 www 338: $daysel='selected';
339: }
1.32 ! www 340:
1.31 www 341: $r->print(<<ENDHEADERS);
342: <form action="/adm/coursedocs" method="post">
343: <select name="timerange">
344: <option value="-1" $startsel>Since Start of Course</option>
345: <option value="2592000" $monthsel>Last Month</option>
346: <option value="604800" $weeksel>Last Week</option>
347: <option value="86400" $daysel>Since Yesterday</option>
348: </select>
349: <input type="submit" name="versions" value="Display" />
350: </form>
1.32 ! www 351: <h3>Content changed $seltext</h3>
1.31 www 352: <table border="2">
353: <tr>
354: <th>File</th><th>Modification Date</th>
355: <th>Version</th><th>Differences</th></tr>
356: ENDHEADERS
357: foreach (keys %changes) {
1.32 ! www 358: if ($changes{$_}>$starttime) {
! 359: my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
! 360: my $currentversion=&Apache::lonnet::getversion($_);
! 361: my $linkurl=&Apache::lonnet::clutter($_);
! 362: $r->print(
! 363: '<tr><td><a href="'.$linkurl.'" target="cat">'.$linkurl.
! 364: '</a></td><td>'.
! 365: localtime($changes{$_}).'</td><td>'.$currentversion.'</td>'.
! 366: '<td>');
! 367: my $lastold=1;
! 368: for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
! 369: my $url=$root.'.'.$prevvers.'.'.$extension;
! 370: if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
! 371: $starttime) {
! 372: $lastold=$prevvers;
! 373: }
! 374: }
! 375: for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
! 376: my $url=$root.'.'.$prevvers.'.'.$extension;
! 377: $r->print('<a href="'.&Apache::lonnet::clutter($url).
! 378: '">Version '.$prevvers.' ('.
! 379: localtime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
! 380: ')</a><br />');
! 381: }
! 382: $r->print('</td></tr>');
! 383: }
1.31 www 384: }
385: $r->print('</table>');
386: } else {
387: $r->print('<p>No content modifications yet.</p>');
1.30 www 388: }
1.27 www 389: &untiehash();
1.26 www 390: } else {
1.7 www 391: # is this a standard course?
392:
393: my $standard=($ENV{'request.course.uri'}=~/^\/uploaded\//);
1.15 www 394: my $forcestandard;
395: my $forcesupplement;
396: my $script='';
397: my $allowed;
398: my $events='';
1.19 www 399: my $showdoc=0;
1.15 www 400: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.21 www 401: ['folder','foldername']);
402: if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
403: $showdoc=$1;
404: }
405: unless ($showdoc) { # got called from remote
1.15 www 406: $forcestandard=($ENV{'form.folder'}=~/^default_/);
407: $forcesupplement=($ENV{'form.folder'}=~/^supplemental_/);
1.7 www 408:
1.4 www 409: # does this user have privileges to post, etc?
1.15 www 410: $allowed=&Apache::lonnet::allowed('srm',$ENV{'request.course.id'});
411: if ($allowed) {
412: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
413: $script=&Apache::lonratedt::editscript('simple');
414: }
415: } else { # got called in sequence from course
416: $allowed=0;
1.21 www 417: $script='</script>'.&Apache::lonxml::registerurl(1,undef).'<script>';
1.15 www 418: $events='onLoad="'.&Apache::lonxml::loadevents.
419: '" onUnload="'.&Apache::lonxml::unloadevents.'"';
1.3 www 420: }
1.4 www 421:
422: # get course data
423: my $coursenum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'};
424: my $coursedom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
425:
1.14 www 426: # get personal data
427:
428: my $uname=$ENV{'user.name'};
429: my $udom=$ENV{'user.domain'};
430: my $plainname=&Apache::lonnet::escape(
431: &Apache::loncommon::plainname($uname,$udom));
432:
1.8 www 433: # graphics settings
1.4 www 434:
1.8 www 435: $iconpath = $r->dir_config('lonIconsURL') . "/";
436:
1.22 www 437: my $now=time;
438:
1.4 www 439: # print screen
1.1 www 440: $r->print(<<ENDDOCUMENT);
441: <html>
442: <head>
443: <title>The LearningOnline Network with CAPA</title>
1.16 www 444: <script>
445: $script
1.20 www 446: </script>
1.19 www 447: ENDDOCUMENT
448: if ($allowed) {
449: $r->print(<<ENDNEWSCRIPT);
1.20 www 450: <script>
1.16 www 451: function makenewfolder(targetform,folderseq) {
452: var foldername=prompt('Name of New Folder','New Folder');
453: if (foldername) {
454: targetform.importdetail.value=foldername+"="+folderseq;
455: targetform.submit();
456: }
457: }
458:
1.18 www 459: function makenewext(targetname) {
460: this.document.forms.extimport.useform.value=targetname;
461: window.open('/adm/rat/extpickframe.html');
462: }
463:
1.22 www 464: function makesmppage() {
465: var title=prompt('Listed Title for the Page');
466: this.document.forms.newsmppg.importdetail.value=
467: title+'=/adm/$udom/$uname/$now/smppg';
468: this.document.forms.newsmppg.submit();
469: }
470:
471: function makebulboard() {
472: var title=prompt('Listed Title for the Bulletin Board');
473: this.document.forms.newbul.importdetail.value=
474: title+'=/adm/$udom/$uname/$now/bulletinboard';
475: this.document.forms.newbul.submit();
476: }
477:
1.18 www 478: function finishpick() {
479: var title=this.document.forms.extimport.title.value;
480: var url=this.document.forms.extimport.url.value;
481: var form=this.document.forms.extimport.useform.value;
482: eval
483: ('this.document.forms.'+form+'.importdetail.value="'+title+'='+url+
484: '";this.document.forms.'+form+'.submit();');
1.16 www 485: }
486: </script>
1.19 www 487: ENDNEWSCRIPT
488: }
489: # -------------------------------------------------------------------- Body tag
1.20 www 490: $r->print('</head>'.
491: &Apache::loncommon::bodytag('Course Documents','',$events));
1.19 www 492: unless ($showdoc) {
1.25 www 493: if ($allowed) {
494: $r->print(<<ENDCOURSEVERIFY);
1.26 www 495: <form action="/adm/coursedocs" method="post" name="courseverify">
1.25 www 496: <input type="submit" name="verify" value="Verify Content" />
497: <input type="submit" name="versions" value="Check Resource Versions" />
498: </form>
499: ENDCOURSEVERIFY
500: }
1.17 www 501: # --------------------------------------------------------- Standard documents
1.24 www 502: $r->print('<table>');
1.7 www 503: if (($standard) && ($allowed) && (!$forcesupplement)) {
1.24 www 504: $r->print('<tr><td bgcolor="#FFFFBB"><h2>Main Course Documents</h2>');
1.7 www 505: my $folder=$ENV{'form.folder'};
1.10 www 506: unless ($folder=~/^default/) { $folder='default'; }
1.7 www 507: &editor($r,$coursenum,$coursedom,$folder,$allowed);
1.16 www 508: my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
509: '.sequence';
1.8 www 510: $r->print(<<ENDFORM);
1.16 www 511: <table cellspacing=2><tr>
512: <th bgcolor="#DDDDDD">Upload a new main course document</th>
513: <th bgcolor="#DDDDDD">Import a published document</th>
514: <th bgcolor="#DDDDDD">Special documents</th>
1.11 www 515: </tr>
1.16 www 516: <tr><td bgcolor="#DDDDDD">
1.11 www 517: File:<br />
1.10 www 518: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
1.8 www 519: <input type="file" name="uploaddoc" size="50">
520: <br />
1.11 www 521: Title:<br />
522: <input type="text" size="50" name="comment">
1.8 www 523: <input type="hidden" name="folder" value="$folder">
1.17 www 524: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.10 www 525: <input type="hidden" name="cmd" value="upload_default">
1.8 www 526: <input type="submit" value="Upload Document">
527: </form>
1.11 www 528: </td>
1.16 www 529: <td bgcolor="#DDDDDD">
1.11 www 530: <form action="/adm/coursedocs" method="post" name="simpleedit">
1.16 www 531: <input type="hidden" name="folder" value="$folder">
1.11 www 532: <input type=hidden name="importdetail" value="">
533: <input type=button onClick=
1.16 www 534: "javascript:groupsearch()" value="Search">
1.11 www 535: <input type=button onClick=
1.16 www 536: "javascript:groupimport();" value="Import">
1.11 www 537: </form>
1.16 www 538: </td><td bgcolor="#DDDDDD">
1.11 www 539: <form action="/adm/coursedocs" method="post" name="newfolder">
1.16 www 540: <input type="hidden" name="folder" value="$folder">
1.17 www 541: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.13 www 542: <input type=hidden name="importdetail" value="">
1.16 www 543: <input name="newfolder" type="button"
544: onClick="javascript:makenewfolder(this.form,'$folderseq');"
1.11 www 545: value="New Folder" />
546: </form>
547: <form action="/adm/coursedocs" method="post" name="newext">
1.16 www 548: <input type="hidden" name="folder" value="$folder">
1.17 www 549: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.13 www 550: <input type=hidden name="importdetail" value="">
1.18 www 551: <input name="newext" type="button" onClick="javascript:makenewext('newext');"
1.11 www 552: value="External Resource" />
553: </form>
554: <form action="/adm/coursedocs" method="post" name="newsyl">
1.16 www 555: <input type="hidden" name="folder" value="$folder">
1.17 www 556: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.14 www 557: <input type=hidden name="importdetail"
558: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
559: <input name="newsyl" type="submit" value="Syllabus" />
1.15 www 560: </form>
1.17 www 561: <form action="/adm/coursedocs" method="post" name="newnav">
1.20 www 562: <input type="hidden" name="folder" value="$folder">
563: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.15 www 564: <input type=hidden name="importdetail"
565: value="Navigate Content=/adm/navmaps">
1.20 www 566: <input name="newnav" type="submit" value="Navigate Content" />
1.22 www 567: </form>
568: <form action="/adm/coursedocs" method="post" name="newsmppg">
569: <input type="hidden" name="folder" value="$folder">
570: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
571: <input type=hidden name="importdetail" value="">
572: <input name="newsmppg" type="button" value="Simple Page"
573: onClick="javascript:makesmppage();" />
574: </form>
575: <form action="/adm/coursedocs" method="post" name="newbul">
576: <input type="hidden" name="folder" value="$folder">
577: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
578: <input type=hidden name="importdetail" value="">
579: <input name="newbulletin" type="button" value="Bulletin Board"
580: onClick="javascript:makebulboard();" />
1.12 www 581: </form>
582: <form action="/adm/coursedocs" method="post" name="newaboutme">
1.16 www 583: <input type="hidden" name="folder" value="$folder">
1.17 www 584: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.14 www 585: <input type=hidden name="importdetail"
586: value="$plainname=/adm/$udom/$uname/aboutme">
1.16 www 587: <input name="newaboutme" type="submit" value="My Personal Info" />
1.11 www 588: </form>
589: </td></tr>
590: </table>
1.8 www 591: ENDFORM
1.24 www 592: $r->print('</td></tr>');
1.7 www 593: }
594: # ----------------------------------------------------- Supplemental documents
595: if (!$forcestandard) {
1.24 www 596: $r->print(
597: '<tr><td bgcolor="#BBFFFF"><h2>Supplemental Course Documents</h2>');
1.7 www 598: my $folder=$ENV{'form.folder'};
1.10 www 599: unless ($folder=~/supplemental/) { $folder='supplemental'; }
1.7 www 600: &editor($r,$coursenum,$coursedom,$folder,$allowed);
1.8 www 601: if ($allowed) {
1.17 www 602: my $folderseq=
603: '/uploaded/'.$coursedom.'/'.$coursenum.'/supplemental_'.time.
604: '.sequence';
605:
1.8 www 606: $r->print(<<ENDSUPFORM);
1.17 www 607: <table cellspacing=2><tr>
608: <th bgcolor="#DDDDDD">Upload a new supplemental course document</th>
609: <th bgcolor="#DDDDDD">Import a published document</th>
610: <th bgcolor="#DDDDDD">Special documents</th>
611: </tr>
612: <tr><td bgcolor="#DDDDDD">
1.10 www 613: <form action="/adm/coursedocs" method="post" enctype="multipart/form-data">
1.4 www 614: <input type="file" name="uploaddoc" size="50">
615: <br />Comment:<br />
616: <textarea cols=50 rows=4 name='comment'>
617: </textarea>
1.8 www 618: <input type="hidden" name="folder" value="$folder">
1.17 www 619: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
1.10 www 620: <input type="hidden" name="cmd" value="upload_supplemental">
1.3 www 621: <input type="submit" value="Upload Document">
622: </form>
1.17 www 623: </td>
624: <td bgcolor="#DDDDDD">
625: <form action="/adm/coursedocs" method="post" name="simpleedit">
626: <input type="hidden" name="folder" value="$folder">
627: <input type=hidden name="importdetail" value="">
628: <input type=button onClick=
629: "javascript:groupsearch()" value="Search">
630: <input type=button onClick=
631: "javascript:groupimport();" value="Import">
632: </form>
633: </td><td bgcolor="#DDDDDD">
1.18 www 634: <form action="/adm/coursedocs" method="post" name="supnewfolder">
1.17 www 635: <input type="hidden" name="folder" value="$folder">
636: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
637: <input type=hidden name="importdetail" value="">
638: <input name="newfolder" type="button"
639: onClick="javascript:makenewfolder(this.form,'$folderseq');"
640: value="New Folder" />
641: </form>
1.18 www 642: <form action="/adm/coursedocs" method="post" name="supnewext">
1.17 www 643: <input type="hidden" name="folder" value="$folder">
644: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
645: <input type=hidden name="importdetail" value="">
1.18 www 646: <input name="newext" type="button"
647: onClick="javascript:makenewext('supnewext');"
1.17 www 648: value="External Resource" />
649: </form>
1.18 www 650: <form action="/adm/coursedocs" method="post" name="supnewsyl">
1.17 www 651: <input type="hidden" name="folder" value="$folder">
652: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
653: <input type=hidden name="importdetail"
654: value="Syllabus=/public/$coursedom/$coursenum/syllabus">
655: <input name="newsyl" type="submit" value="Syllabus" />
656: </form>
1.18 www 657: <form action="/adm/coursedocs" method="post" name="subnewaboutme">
1.17 www 658: <input type="hidden" name="folder" value="$folder">
659: <input type="hidden" name="foldername" value="$ENV{'form.foldername'}">
660: <input type=hidden name="importdetail"
661: value="$plainname=/adm/$udom/$uname/aboutme">
662: <input name="newaboutme" type="submit" value="My Personal Info" />
663: </form>
664: </td></tr>
1.24 www 665: </table></td></tr>
1.8 www 666: ENDSUPFORM
667: }
1.7 www 668: }
1.18 www 669: if ($allowed) {
670: $r->print('<form name="extimport"><input type="hidden" name="title"><input type="hidden" name="url"><input type="hidden" name="useform"></form>');
671: }
1.24 www 672: $r->print('</table>');
1.19 www 673: } else {
674: # -------------------------------------------------------- This is showdoc mode
675: $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 676: &entryline(0,"Click to download or use your browser's Save Link function",$showdoc).'</table></p>');
1.19 www 677: }
1.26 www 678: }
679: $r->print('</body></html>');
680: return OK;
1.1 www 681: }
682:
683: 1;
684: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>