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