Annotation of loncom/publisher/loncfile.pm, revision 1.54
1.1 www 1: # The LearningOnline Network with CAPA
2: # Handler to rename files, etc, in construction space
3: #
1.9 foxr 4: # This file responds to the various buttons and events
5: # in the top frame of the construction space directory.
6: # Each event is processed in two phases. The first phase
7: # presents a page that describes the proposed action to the user
8: # and requests confirmation. The second phase commits the action
9: # and displays a page showing the results of the action.
10: #
1.24 albertel 11: #
1.54 ! albertel 12: # $Id: loncfile.pm,v 1.53 2004/04/03 00:23:47 www Exp $
1.7 albertel 13: #
14: # Copyright Michigan State University Board of Trustees
15: #
16: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
17: #
18: # LON-CAPA is free software; you can redistribute it and/or modify
19: # it under the terms of the GNU General Public License as published by
20: # the Free Software Foundation; either version 2 of the License, or
21: # (at your option) any later version.
22: #
23: # LON-CAPA is distributed in the hope that it will be useful,
24: # but WITHOUT ANY WARRANTY; without even the implied warranty of
25: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26: # GNU General Public License for more details.
27: #
28: # You should have received a copy of the GNU General Public License
29: # along with LON-CAPA; if not, write to the Free Software
30: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31: #
32: # /home/httpd/html/adm/gpl.txt
33: #
34: # http://www.lon-capa.org/
35: #
1.12 foxr 36: =pod
37:
38: =head1 NAME
39:
40: Apache::loncfile - Construction space file management.
41:
42: =head1 SYNOPSIS
43:
44: Content handler for buttons on the top frame of the construction space
45: directory.
46:
47: =head1 INTRODUCTION
48:
49: loncfile is invoked when buttons in the top frame of the construction
1.17 harris41 50: space directory listing are clicked. All operations proceed in two phases.
1.12 foxr 51: The first phase describes to the user exactly what will be done. If the user
52: confirms the operation, the second phase commits the operation and indicates
53: completion. When the user dismisses the output of phase2, they are returned to
54: an "appropriate" directory listing in general.
55:
56: This is part of the LearningOnline Network with CAPA project
57: described at http://www.lon-capa.org.
58:
59: =head2 Subroutines
60:
61: =cut
1.1 www 62:
63: package Apache::loncfile;
64:
65: use strict;
66: use Apache::File;
1.15 foxr 67: use File::Basename;
1.1 www 68: use File::Copy;
1.18 foxr 69: use HTML::Entities();
1.1 www 70: use Apache::Constants qw(:common :http :methods);
71: use Apache::loncacc;
1.9 foxr 72: use Apache::Log ();
1.15 foxr 73: use Apache::lonnet;
1.33 www 74: use Apache::loncommon();
1.47 sakharuk 75: use Apache::lonlocal;
1.9 foxr 76:
1.45 taceyjo1 77: my $DEBUG=0;
1.10 foxr 78: my $r; # Needs to be global for some stuff RF.
1.12 foxr 79:
80: =pod
81:
82: =item Debug($request, $message)
83:
1.17 harris41 84: If debugging is enabled puts out a debugging message determined by the
1.12 foxr 85: caller. The debug message goes to the Apache error log file. Debugging
1.17 harris41 86: is enabled by setting the module global DEBUG variable to nonzero (TRUE).
1.12 foxr 87:
88: Parameters:
89:
90: =over 4
91:
1.17 harris41 92: =item $request - The current request operation.
1.12 foxr 93:
1.17 harris41 94: =item $message - The message to put in the log file.
1.12 foxr 95:
96: =back
97:
98: Returns:
99: nothing.
100:
101: =cut
102:
1.9 foxr 103: sub Debug {
1.12 foxr 104:
105: # Marshall the parameters.
106:
107: my $r = shift;
108: my $log = $r->log;
109: my $message = shift;
110:
1.22 albertel 111: # Put out the indicated message butonly if DEBUG is true.
1.12 foxr 112:
113: if ($DEBUG) {
1.46 taceyjo1 114: $r->log_reason($message);
1.12 foxr 115: }
116: }
117:
118: =pod
119:
120: =item URLToPath($url)
121:
122: Convert a URL to a file system path.
123:
124: In order to manipulate the construction space objects, it is necessary
125: to access url identified objects a filespace objects. This function
126: translates a construction space URL to a file system path.
127: Parameters:
128:
129: =over 4
130:
131: =item Url - string [in] The url to convert.
132:
133: =back
134:
135: Returns:
136:
137: =over 4
138:
1.16 harris41 139: =item The corresponding file system path.
1.12 foxr 140:
141: =back
142:
143: Global References
144:
145: =over 4
146:
147: =item $r - Request object [in] Referenced in the &Debug calls.
148:
149: =back
150:
151: =cut
152:
153: sub URLToPath {
154: my $Url = shift;
155: &Debug($r, "UrlToPath got: $Url");
1.37 www 156: $Url=~ s/\/+/\//g;
1.12 foxr 157: $Url=~ s/^http\:\/\/[^\/]+//;
1.35 www 158: $Url=~ s/^\///;
159: $Url=~ s/(\~|priv\/)(\w+)\//\/home\/$2\/public_html\//;
1.12 foxr 160: &Debug($r, "Returning $Url \n");
161: return $Url;
162: }
163:
1.36 www 164: sub url {
165: my $fn=shift;
166: $fn=~s/^\/home\/(\w+)\/public\_html/\/priv\/$1/;
167: return $fn;
168: }
169:
170: sub display {
171: my $fn=shift;
1.43 albertel 172: $fn=~s-^/home/(\w+)/public_html-/priv/$1-;
1.36 www 173: return '<tt>'.$fn.'</tt>';
174: }
175:
1.50 www 176:
177: # see if the file is
178: # a) published (return 0 if not)
179: # b) if, so obsolete (return 0 if not)
180:
181: sub obsolete_unpub {
182: my ($user,$domain,$construct)=@_;
183: my $published=$construct;
184: $published=~
185: s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//;
186: if (-e $published) {
187: if (&Apache::lonnet::metadata($published,'obsolete')) {
188: return 1;
189: }
190: return 0;
191: } else {
192: return 1;
193: }
194: }
195:
196:
197:
1.12 foxr 198: =pod
199:
1.39 www 200: =item exists($user, $domain, $file)
1.12 foxr 201:
1.17 harris41 202: Determine if a resource file name has been published or exists
1.12 foxr 203: in the construction space.
204:
205: Parameters:
206:
207: =over 4
208:
209: =item $user - string [in] - Name of the user for which to check.
210:
211: =item $domain - string [in] - Name of the domain in which the resource
212: might have been published.
213:
214: =item $file - string [in] - Name of the file.
215:
216: =back
217:
218: Returns:
219:
220: =over 4
221:
222: =item string - Either where the resource exists as an html string that can
223: be embedded in a dialog or an empty string if the resource
224: does not exist.
225:
226: =back
227:
228: =cut
229:
1.8 albertel 230: sub exists {
1.39 www 231: my ($user, $domain, $construct) = @_;
232: my $published=$construct;
233: $published=~
234: s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//;
235: my $result='';
1.21 albertel 236: if ( -d $construct ) {
1.47 sakharuk 237: return &mt('Error: destination for operation is an existing directory.');
1.21 albertel 238: }
1.12 foxr 239: if ( -e $published) {
1.47 sakharuk 240: $result.='<p><font color="red">'.&mt('Warning: target file exists, and has been published!').'</font></p>';
1.36 www 241: } elsif ( -e $construct) {
1.47 sakharuk 242: $result.='<p><font color="red">'.&mt('Warning: target file exists!').'</font></p>';
1.21 albertel 243: }
1.12 foxr 244: return $result;
245:
1.8 albertel 246: }
247:
1.12 foxr 248: =pod
249:
250: =item checksuffix($old, $new)
251:
252: Determine if a resource filename suffix (the stuff after the .) would change
253: as a result of this operation.
254:
255: Parameters:
256:
257: =over 4
258:
259: =item $old = string [in] Previous filename.
260:
261: =item $new = string [in] Resultant filename.
262:
263: =back
264:
265: Returns:
266:
267: =over 4
268:
1.17 harris41 269: =item Empty string if everything worked.
1.12 foxr 270:
271: =item String containing an error message if there was a problem.
272:
273: =back
274:
275: =cut
276:
1.8 albertel 277: sub checksuffix {
278: my ($old,$new) = @_;
279: my $result;
280: my $oldsuffix;
281: my $newsuffix;
282: if ($new=~m:(.*/*)([^/]+)\.(\w+)$:) { $newsuffix=$3; }
283: if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; }
284: if ($oldsuffix ne $newsuffix) {
1.12 foxr 285: $result.=
1.47 sakharuk 286: '<p><font color="red">'.&mt('Warning: change of MIME type!').'</font></p>';
1.8 albertel 287: }
288: return $result;
289: }
1.32 albertel 290:
291: sub cleanDest {
292: my ($request,$dest)=@_;
293: #remove bad characters
294: if ($dest=~/[\#\?&]/) {
1.47 sakharuk 295: $request->print("<p><font color=\"red\">".&mt('Invalid characters in requested name have been removed.')."</font></p>");
1.32 albertel 296: $dest=~s/[\#\?&]//g;
297: }
298: return $dest;
299: }
300:
1.36 www 301: sub relativeDest {
302: my ($fn,$newfilename,$uname)=@_;
303: if ($newfilename=~/^\//) {
304: # absolute, simply add path
305: $newfilename='/home/'.$uname.'/public_html/';
306: } else {
307: my $dir=$fn;
308: $dir=~s/\/[^\/]+$//;
309: $newfilename=$dir.'/'.$newfilename;
310: }
311: $newfilename=~s://+:/:g; # remove duplicate /
312: while ($newfilename=~m:/\.\./:) {
313: $newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/..
314: }
315: return $newfilename;
316: }
317:
1.12 foxr 318: =pod
319:
320: =item CloseForm1($request, $user, $file)
321:
322: Close of a form on the successful completion of phase 1 processing
323:
324: Parameters:
325:
326: =over 4
327:
328: =item $request - Apache Request Object [in] - Apache server request object.
329:
1.13 foxr 330: =item $cancelurl - the url to go to on cancel.
1.12 foxr 331:
332: =back
333:
334: =cut
335:
336: sub CloseForm1 {
1.36 www 337: my ($request, $fn) = @_;
1.47 sakharuk 338: $request->print('<p><input type="submit" value="'.&mt('Continue').'" /></p></form>');
1.36 www 339: $request->print('<form action="'.&url($fn).
1.47 sakharuk 340: '" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>');
1.12 foxr 341: }
342:
343:
344: =pod
345:
346: =item CloseForm2($request, $user, $directory)
347:
348: Successfully close off the phase 2 form.
349:
350: Parameters:
351:
352: =over 4
353:
354: =item $request - Apache Request object [in] - The request that is being
355: executed.
356:
357: =item $user - string [in] - Name of the user that is initiating the
358: request.
359:
360: =item $directory - string [in] - Directory in which the operation is
361: being done relative to the top level construction space
362: directory.
363:
364: =back
365:
366: =cut
367:
368: sub CloseForm2 {
1.36 www 369: my ($request, $user, $fn) = @_;
1.47 sakharuk 370: $request->print('<h3><a href="'.&url($fn).'/">'.&mt('Done').'</a></h3>');
1.12 foxr 371: }
372:
373: =pod
374:
375: =item Rename1($request, $filename, $user, $domain, $dir)
376:
377: Perform phase 1 processing of the file rename operation.
378:
379: Parameters:
380:
381: =over 4
382:
383: =item $request - Apache Request Object [in] The request object for the
384: current request.
385:
386: =item $filename - The filename relative to construction space.
387:
388: =item $user - Name of the user making the request.
389:
390: =item $domain - User login domain.
391:
392: =item $dir - Directory specification of the path to the file.
393:
394: =back
395:
396: Side effects:
397:
398: =over 4
399:
400: =item A new form is displayed prompting for confirmation. The newfilename
401: hidden field of this form is loaded with
402: new filename relative to the current directory ($dir).
403:
404: =back
405:
406: =cut
407:
408: sub Rename1 {
1.52 albertel 409: my ($request, $user, $domain, $fn, $newfilename, $style) = @_;
1.36 www 410:
411: if(-e $fn) {
412: if($newfilename) {
1.42 albertel 413: # is dest a dir
1.52 albertel 414: if ($style eq 'move') {
415: if (-d $newfilename) {
416: if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; }
417: }
1.42 albertel 418: }
1.29 albertel 419: if ($newfilename =~ m|/[^\.]+$|) {
1.36 www 420: #no extension add on original extension
421: if ($fn =~ m|/[^\.]*\.([^\.]+)$|) {
1.24 albertel 422: $newfilename.='.'.$1;
423: }
424: }
1.36 www 425: $request->print(&checksuffix($fn, $newfilename));
1.27 albertel 426: #renaming a dir, delete the trailing /
1.39 www 427: #remove second to last element for current dir
428: if (-d $fn) {
1.53 www 429: $newfilename=~/\.(\w+)$/;
430: if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
431: $request->print('<br /><font color="red">'.
432: &mt('Cannot change MIME type of a directory').
433: '</font>'.
434: '<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
435: return;
436: }
1.39 www 437: $newfilename=~s/\/[^\/]+\/([^\/]+)$/\/$1/;
1.27 albertel 438: }
1.42 albertel 439: $newfilename=~s://+:/:g; # remove duplicate /
440: while ($newfilename=~m:/\.\./:) {
441: $newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/..
442: }
1.39 www 443: my $return=&exists($user, $domain, $newfilename);
1.21 albertel 444: $request->print($return);
445: if ($return =~/^Error:/) {
1.47 sakharuk 446: $request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
1.21 albertel 447: return;
448: }
1.50 www 449: unless (&obsolete_unpub($user,$domain,$fn)) {
450: $request->print('<h3>'.&mt('Cannot rename or move non-obsolete published file').'</h3>'.
451: '<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
452: return;
453: }
1.52 albertel 454: my $action;
455: if ($style eq 'rename') {
456: $action=&mt('Rename');
457: } else {
458: $action=&mt('Move');
459: }
1.23 albertel 460: $request->print('<input type="hidden" name="newfilename" value="'.
1.12 foxr 461: $newfilename.
1.52 albertel 462: '" /><p>'.$action.' '.&display($fn).
1.36 www 463: '</tt><br />to '.&display($newfilename).'?</p>');
464: &CloseForm1($request, $fn);
1.12 foxr 465: } else {
1.47 sakharuk 466: $request->print('<p>'.&mt('No new filename specified.').'</p></form>');
1.12 foxr 467: return;
468: }
469: } else {
1.47 sakharuk 470: $request->print('<p> '.&mt('No such file').': '.&display($fn).'</p></form>');
1.12 foxr 471: return;
472: }
473:
474: }
475: =pod
476:
477: =item Delete1
478:
479: Performs phase 1 processing of the delete operation. In phase one
480: we just check to be sure the file exists.
481:
482: Parameters:
483:
484: =over 4
485:
1.36 www 486: =item $request - Apache Request Object [in] request object for the current
1.12 foxr 487: request.
488:
1.36 www 489: =item $user - string [in] Name of the user initiating the request.
1.12 foxr 490:
1.36 www 491: =item $domain - string [in] Domain the initiating user is logged in as
1.13 foxr 492:
1.36 www 493: =item $filename - string [in] Source filename.
1.12 foxr 494:
495: =back
496:
497: =cut
498:
499: sub Delete1 {
1.36 www 500: my ($request, $user, $domain, $fn) = @_;
1.12 foxr 501:
1.36 www 502: if( -e $fn) {
1.23 albertel 503: $request->print('<input type="hidden" name="newfilename" value="'.
1.36 www 504: $fn.'"/>');
1.50 www 505: unless (&obsolete_unpub($user,$domain,$fn)) {
506: $request->print('<h3>'.&mt('Cannot delete non-obsolete published file').'</h3>'.
507: '<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
508: return;
509: }
1.47 sakharuk 510: $request->print('<p>'.&mt('Delete').' '.&display($fn).'?</p>');
1.36 www 511: &CloseForm1($request, $fn);
1.12 foxr 512: } else {
1.47 sakharuk 513: $request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
1.12 foxr 514: }
515: }
516:
517: =pod
518:
519: =item Copy1($request, $user, $domain, $filename, $newfilename)
520:
521: Performs phase 1 processing of the construction space copy command.
1.17 harris41 522: Ensure that the source file exists. Ensure that a destination exists,
523: also warn if the destination already exists.
1.12 foxr 524:
525: Parameters:
526:
527: =over 4
528:
529: =item $request - Apache Request Object [in] request object for the current
530: request.
531:
532: =item $user - string [in] Name of the user initiating the request.
533:
534: =item $domain - string [in] Domain the initiating user is logged in as
535:
1.36 www 536: =item $fn - string [in] Source filename.
1.12 foxr 537:
538: =item $newfilename-string [in] Destination filename.
539:
540: =back
541:
542: =cut
543:
544: sub Copy1 {
1.42 albertel 545: my ($request, $user, $domain, $fn, $newfilename) = @_;
1.12 foxr 546:
1.42 albertel 547: if(-e $fn) {
548: # is dest a dir
549: if (-d $newfilename) {
550: if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; }
551: }
552: if ($newfilename =~ m|/[^\.]+$|) {
553: #no extension add on original extension
554: if ($fn =~ m|/[^\.]*\.([^\.]+)$|) { $newfilename.='.'.$1; }
555: }
556: $newfilename=~s://+:/:g; # remove duplicate /
557: while ($newfilename=~m:/\.\./:) {
558: $newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/..
559: }
560: $request->print(&checksuffix($fn,$newfilename));
561: my $return=&exists($user, $domain, $newfilename);
562: $request->print($return);
563: if ($return =~/^Error:/) {
1.47 sakharuk 564: $request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
1.42 albertel 565: return;
566: }
567: $request->print('<input type="hidden" name="newfilename" value="'.
568: $newfilename.
1.47 sakharuk 569: '" /><p>'.&mt('Copy').' '.&display($fn).'<br />to '.
1.42 albertel 570: &display($newfilename).'?</p>');
571: &CloseForm1($request, $fn);
572: } else {
1.47 sakharuk 573: $request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
1.21 albertel 574: }
1.19 albertel 575: }
576:
577: =pod
578:
1.12 foxr 579: =item NewDir1
580:
581: Does all phase 1 processing of directory creation:
582: Ensures that the user provides a new directory name,
583: and that the directory does not already exist.
584:
585: Parameters:
586:
587: =over 4
588:
589: =item $request - Apache Request Object [in] - Server request object for the
1.17 harris41 590: current url.
1.12 foxr 591:
592: =item $username - Name of the user that is requesting the directory creation.
593:
1.36 www 594: =item $domain - Domain user is in
595:
596: =item $fn - source file.
1.12 foxr 597:
598: =item $newdir - Name of the directory to be created; path relative to the
599: top level of construction space.
600: =back
601:
602: Side Effects:
603:
604: =over 4
605:
606: =item A new form is displayed. Clicking on the confirmation button
607: causes the newdir operation to transition into phase 2. The hidden field
608: "newfilename" is set with the construction space path to the new directory.
609:
610:
611: =back
612:
613: =cut
614:
615:
616: sub NewDir1
617: {
1.51 raeburn 618: my ($request, $username, $domain, $fn, $newfilename, $mode) = @_;
1.12 foxr 619:
1.39 www 620: my $result=&exists($username,$domain,$newfilename);
621: if ($result) {
622: $request->print('<font color="red">'.$result.'</font></form>');
623: } else {
1.51 raeburn 624: if ($mode eq 'testbank') {
625: $request->print('<input type="hidden" name="callingmode" value="testbank">');
626: } elsif ($mode eq 'imsimport') {
627: $request->print('<input type="hidden" name="callingmode" value="imsimport">');
628: }
1.23 albertel 629: $request->print('<input type="hidden" name="newfilename" value="'.
1.47 sakharuk 630: $newfilename.'" /><p>'.&mt('Make new directory').' '.
1.36 www 631: &display($newfilename).'?</p>');
632: &CloseForm1($request, $fn);
1.12 foxr 633: }
634: }
635:
1.44 taceyjo1 636:
637: sub Decompress1 {
638: my ($request, $user, $domain, $fn) = @_;
639: if( -e $fn) {
640: $request->print('<input type="hidden" name="newfilename" value="'.$fn.'"/>');
1.47 sakharuk 641: $request->print('<p>'.&mt('Decompress').' '.&display($fn).'?</p>');
1.44 taceyjo1 642: &CloseForm1($request, $fn);
643: } else {
1.47 sakharuk 644: $request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
1.44 taceyjo1 645: }
646: }
1.12 foxr 647: =pod
648:
1.22 albertel 649: =item NewFile1
650:
651: Does all phase 1 processing of file creation:
652: Ensures that the user provides a new filename, adds proper extension
653: if needed and that the file does not already exist, if it is a html,
654: problem, page, or sequence, it then creates a form link to hand the
655: actual creation off to the proper handler.
656:
657: Parameters:
658:
659: =over 4
660:
661: =item $request - Apache Request Object [in] - Server request object for the
662: current url.
663:
664: =item $username - Name of the user that is requesting the directory creation.
665:
666: =item $domain - Name of the domain of the user
667:
1.36 www 668: =item $fn - Source file name
1.22 albertel 669:
670: =item $newfilename
671: - Name of the file to be created; no path information
672: =back
673:
674: Side Effects:
675:
676: =over 4
677:
678: =item 2 new forms are displayed. Clicking on the confirmation button
679: causes the browser to attempt to load the specfied URL, allowing the
1.36 www 680: proper handler to take care of file creation. There is also a Cancel
1.22 albertel 681: button which returns you to the driectory listing you came from
682:
683: =back
684:
685: =cut
686:
687:
688: sub NewFile1 {
1.36 www 689: my ($request, $user, $domain, $fn, $newfilename) = @_;
1.22 albertel 690:
691: if ($ENV{'form.action'} =~ /new(.+)file/) {
692: my $extension=$1;
1.40 www 693:
694: ##Informs User (name).(number).(extension) not allowed
695: if($newfilename =~ /\.(\d+)\.(\w+)$/){
696: $r->print('<font color="red">'.$newfilename.
1.47 sakharuk 697: ' - '.&mt('Bad Filename').'<br />('.&mt('name').').('.&mt('number').').('.&mt('extension').')'.
698: ' '.&mt('Not Allowed').'</font>');
1.40 www 699: return;
700: }
1.22 albertel 701: if ($newfilename !~ /\Q.$extension\E$/) {
1.26 albertel 702: if ($newfilename =~ m|^[^\.]*\.([^\.]+)$|) {
703: #already has an extension strip it and add in expected one
704: $newfilename =~ s|.([^\.]+)$||;
705: }
1.22 albertel 706: $newfilename.=".$extension";
707: }
1.31 albertel 708: }
1.39 www 709: my $result=&exists($user,$domain,$newfilename);
710: if($result) {
711: $request->print('<font color="red">'.$result.'</font></form>');
712: } else {
1.47 sakharuk 713: $request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>');
1.22 albertel 714: $request->print('</form>');
1.36 www 715: $request->print('<form action="'.&url($newfilename).
1.47 sakharuk 716: '" method="POST"><p><input type="submit" value="'.&mt('Continue').'" /></p></form>');
1.36 www 717: $request->print('<form action="'.&url($fn).
1.47 sakharuk 718: '" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>');
1.22 albertel 719: }
720: }
721:
722: =pod
723:
1.12 foxr 724: =item phaseone($r, $fn, $uname, $udom)
725:
726: Peforms phase one processing of the request. In phase one, error messages
727: are returned if the request cannot be performed (e.g. attempts to manipulate
728: files that are nonexistent). If the operation can be performed, what is
729: about to be done will be presented to the user for confirmation. If the
730: user confirms the request, then phase two is executed, the action
731: performed and reported to the user.
732:
733: Parameters:
734:
735: =over 4
736:
737: =item $r - request object [in] - The Apache request being executed.
738:
739: =item $fn = string [in] - The filename being manipulated by the
740: request.
741:
742: =item $uname - string [in] Name of user logged in and doing this action.
743:
1.17 harris41 744: =item $udom - string [in] Domain name under which the user logged in.
1.12 foxr 745:
746: =back
747:
748: =cut
1.8 albertel 749:
1.1 www 750: sub phaseone {
1.12 foxr 751: my ($r,$fn,$uname,$udom)=@_;
752:
1.36 www 753: my $newfilename=&cleanDest($r,$ENV{'form.newfilename'});
754: $newfilename=&relativeDest($fn,$newfilename,$uname);
1.23 albertel 755: $r->print('<form action="/adm/cfile" method="post">'.
1.36 www 756: '<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'.
757: '<input type="hidden" name="phase" value="two" />'.
758: '<input type="hidden" name="action" value="'.$ENV{'form.action'}.'" />');
1.12 foxr 759:
760: if ($ENV{'form.action'} eq 'rename') {
1.52 albertel 761: &Rename1($r, $uname, $udom, $fn, $newfilename, 'rename');
762: } elsif ($ENV{'form.action'} eq 'move') {
763: &Rename1($r, $uname, $udom, $fn, $newfilename, 'move');
1.12 foxr 764: } elsif ($ENV{'form.action'} eq 'delete') {
1.36 www 765: &Delete1($r, $uname, $udom, $fn);
1.44 taceyjo1 766: } elsif ($ENV{'form.action'} eq 'decompress') {
767: &Decompress1($r, $uname, $udom, $fn);
1.12 foxr 768: } elsif ($ENV{'form.action'} eq 'copy') {
1.36 www 769: if($newfilename) {
770: &Copy1($r, $uname, $udom, $fn, $newfilename);
771: } else {
1.47 sakharuk 772: $r->print('<p>'.&mt('No new filename specified.').'</p></form>');
1.36 www 773: }
1.12 foxr 774: } elsif ($ENV{'form.action'} eq 'newdir') {
1.51 raeburn 775: my $mode = '';
776: if (exists($ENV{'form.callingmode'}) ) {
777: $mode = $ENV{'form.callingmode'};
778: }
779: &NewDir1($r, $uname, $udom, $fn, $newfilename, $mode);
1.22 albertel 780: } elsif ($ENV{'form.action'} eq 'newfile' ||
781: $ENV{'form.action'} eq 'newhtmlfile' ||
1.28 www 782: $ENV{'form.action'} eq 'newproblemfile' ||
783: $ENV{'form.action'} eq 'newpagefile' ||
1.30 albertel 784: $ENV{'form.action'} eq 'newsequencefile' ||
1.34 www 785: $ENV{'form.action'} eq 'newrightsfile' ||
786: $ENV{'form.action'} eq 'newstyfile' ||
1.30 albertel 787: $ENV{'form.action'} eq 'Select Action') {
1.36 www 788: if ($newfilename) {
789: &NewFile1($r, $uname, $udom, $fn, $newfilename);
1.25 albertel 790: } else {
1.47 sakharuk 791: $r->print('<p>'.&mt('No new filename specified.').'</p></form>');
1.22 albertel 792: }
1.12 foxr 793: }
794: }
795:
796: =pod
797:
798: =item Rename2($request, $user, $directory, $oldfile, $newfile)
799:
1.17 harris41 800: Performs phase 2 processing of a rename reequest. This is where the
1.12 foxr 801: actual rename is performed.
802:
803: Parameters
804:
805: =over 4
806:
807: =item $request - Apache request object [in] The request being processed.
808:
809: =item $user - string [in] The name of the user initiating the request.
810:
811: =item $directory - string [in] The name of the directory relative to the
812: construction space top level of the renamed file.
813:
814: =item $oldfile - Name of the file.
815:
816: =item $newfile - Name of the new file.
817:
818: =back
819:
820: Returns:
821:
822: =over 4
823:
824: =item 1 Success.
825:
826: =item 0 Failure.
827:
828: =cut
829:
830: sub Rename2 {
831:
832: my ($request, $user, $directory, $oldfile, $newfile) = @_;
833:
834: &Debug($request, "Rename2 directory: ".$directory." old file: ".$oldfile.
835: " new file ".$newfile."\n");
836: &Debug($request, "Target is: ".$directory.'/'.
837: $newfile);
1.38 www 838: if (-e $oldfile) {
1.40 www 839:
840: my $oRN=$oldfile;
841: my $nRN=$newfile;
1.38 www 842: unless (rename($oldfile,$newfile)) {
1.47 sakharuk 843: $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
1.12 foxr 844: return 0;
1.40 www 845: }
846: ## If old name.(extension) exits, move under new name.
847: ## If it doesn't exist and a new.(extension) exists
848: ## delete it (only concern when renaming over files)
849: my $tmp1=$oRN.'.meta';
850: my $tmp2=$nRN.'.meta';
851: if(-e $tmp1){
852: unless(rename($tmp1,$tmp2)){ }
1.41 matthew 853: } elsif(-e $tmp2){
1.40 www 854: unlink $tmp2;
855: }
856: $tmp1=$oRN.'.save';
857: $tmp2=$nRN.'.save';
858: if(-e $tmp1){
859: unless(rename($tmp1,$tmp2)){ }
1.41 matthew 860: } elsif(-e $tmp2){
1.40 www 861: unlink $tmp2;
862: }
863: $tmp1=$oRN.'.log';
864: $tmp2=$nRN.'.log';
865: if(-e $tmp1){
866: unless(rename($tmp1,$tmp2)){ }
1.41 matthew 867: } elsif(-e $tmp2){
1.40 www 868: unlink $tmp2;
869: }
870: $tmp1=$oRN.'.bak';
871: $tmp2=$nRN.'.bak';
872: if(-e $tmp1){
873: unless(rename($tmp1,$tmp2)){ }
1.41 matthew 874: } elsif(-e $tmp2){
1.40 www 875: unlink $tmp2;
1.38 www 876: }
1.12 foxr 877: } else {
1.47 sakharuk 878: $request->print("<p> ".&mt('No such file').": ".&display($oldfile).'</p></form>');
1.12 foxr 879: return 0;
880: }
881: return 1;
882: }
883: =pod
884:
885: =item Delete2($request, $user, $filename)
886:
887: Performs phase two of a delete. The user has confirmed that they want
888: to delete the selected file. The file is deleted and the results of the
889: delete attempt are indicated.
890:
891: Parameters:
892:
893: =over 4
894:
895: =item $request - Apache Request object [in] the request object for the current
896: delete operation.
897:
898: =item $user - string [in] The name of the user initiating the delete
899: request.
900:
1.17 harris41 901: =item $filename - string [in] The name of the file, relative to construction
902: space, to delete.
1.12 foxr 903:
904: =back
905:
906: Returns:
907: 1 - success.
908: 0 - Failure.
909:
910: =cut
911:
912: sub Delete2 {
913: my ($request, $user, $filename) = @_;
1.46 taceyjo1 914: if(opendir DIR, $filename) {
915: my @files=readdir(DIR);
916: shift @files; shift @files; # takes off . and ..
917: if(@files) {
1.47 sakharuk 918: $request->print('<font color="red"> '.&mt('Error: Directory Non Empty').'</font>');
1.46 taceyjo1 919: return 0;
1.48 taceyjo1 920: } else {
1.46 taceyjo1 921: if(-e $filename) {
922: unless(rmdir($filename)) {
1.47 sakharuk 923: $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
1.46 taceyjo1 924: return 0;
925: }
1.48 taceyjo1 926: } else {
927: $request->print('<p> '.&mt('No such file').'. </p></form>');
1.46 taceyjo1 928: return 0;
929: }
930: }
1.48 taceyjo1 931: } else {
1.46 taceyjo1 932: if(-e $filename) {
933: unless(unlink($filename)) {
1.47 sakharuk 934: $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
1.46 taceyjo1 935: return 0;
936: }
1.48 taceyjo1 937: } else {
938: $request->print('<p> '.&mt('No such file').'. </p></form>');
1.12 foxr 939: return 0;
940: }
1.46 taceyjo1 941: }
1.12 foxr 942: return 1;
943: }
944:
945: =pod
946:
947: =item Copy2($request, $username, $dir, $oldfile, $newfile)
948:
949: Performs phase 2 of a copy. The file is copied and the status
950: of that copy is reported back to the user.
951:
952: =over 4
953:
954: =item $request - Apache request object [in]; the apache request currently
955: being executed.
956:
957: =item $username - string [in] Name of the user who is requesting the copy.
958:
959: =item $dir - string [in] Directory path relative to the construction space
960: of the destination file.
961:
962: =item $oldfile - string [in] Name of the source file.
963:
964: =item $newfile - string [in] Name of the destination file.
965:
966:
967: =back
968:
969: Returns 0 failure, and 0 successs.
970:
971: =cut
1.1 www 972:
1.12 foxr 973: sub Copy2 {
974: my ($request, $username, $dir, $oldfile, $newfile) = @_;
975: &Debug($request ,"Will try to copy $oldfile to $newfile");
976: if(-e $oldfile) {
977: unless (copy($oldfile, $newfile)) {
1.47 sakharuk 978: $request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>');
1.12 foxr 979: return 0;
980: } else {
1.14 foxr 981: unless (chmod(0660, $newfile)) {
1.47 sakharuk 982: $request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>');
1.14 foxr 983: return 0;
984: }
1.12 foxr 985: return 1;
986: }
1.11 albertel 987: } else {
1.47 sakharuk 988: $request->print('<p> '.&mt('No such file').' </p>');
1.12 foxr 989: return 0;
1.11 albertel 990: }
1.12 foxr 991: return 1;
992: }
993: =pod
994:
995: =item NewDir2($request, $user, $newdirectory)
1.1 www 996:
1.12 foxr 997: Performs phase 2 processing of directory creation. This involves creating the directory and
998: reporting the results of that creation to the user.
999:
1000: Parameters:
1001: =over 4
1002:
1003: =item $request - Apache request object [in]. Object representing the current HTTP request.
1004:
1005: =item $user - string [in] The name of the user that is initiating the request.
1006:
1007: =item $newdirectory - string [in] The full path of the directory being created.
1008:
1009: =back
1010:
1011: Returns 0 - failure 1 - success.
1012:
1013: =cut
1.8 albertel 1014:
1.12 foxr 1015: sub NewDir2 {
1016: my ($request, $user, $newdirectory) = @_;
1017:
1018: unless(mkdir($newdirectory, 02770)) {
1.47 sakharuk 1019: $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
1.12 foxr 1020: return 0;
1021: }
1022: unless(chmod(02770, ($newdirectory))) {
1.47 sakharuk 1023: $request->print('<font color="red"> '.&mt('Error').': '.$!.'</font>');
1.12 foxr 1024: return 0;
1025: }
1026: return 1;
1.1 www 1027: }
1.44 taceyjo1 1028: sub decompress2 {
1029: my ($r, $user, $dir, $file) = @_;
1030: &Apache::lonnet::appenv('cgi.file' => $file);
1031: &Apache::lonnet::appenv('cgi.dir' => $dir);
1032: my $result=&Apache::lonnet::ssi_body('/cgi-bin/decompress.pl');
1033: $r->print($result);
1034: &Apache::lonnet::delenv('cgi.file');
1035: &Apache::lonnet::delenv('cgi.dir');
1036: return 1;
1037: }
1.12 foxr 1038: =pod
1039:
1040: =item phasetwo($r, $fn, $uname, $udom)
1041:
1042: Controls the phase 2 processing of file management
1043: requests for construction space. In phase one, the user
1044: was asked to confirm the operation. In phase 2, the operation
1045: is performed and the result is shown.
1046:
1047: The strategy is to break out the processing into specific action processors
1048: named action2 where action is the requested action and the 2 denotes
1049: phase 2 processing.
1050:
1051: Parameters:
1052:
1053: =over 4
1054:
1055: =item $r - Apache Request object [in] The request object for this httpd
1056: transaction.
1057:
1058: =item $fn - string [in] A filename indicating the object that is being
1059: manipulated.
1060:
1061: =item $uname - string [in] The name of the user initiating the file management
1062: request.
1063:
1064: =item $udom - string [in] The login domain of the user initiating the
1065: file management request.
1066: =back
1067:
1068: =cut
1069:
1.1 www 1070: sub phasetwo {
1071: my ($r,$fn,$uname,$udom)=@_;
1.12 foxr 1072:
1.9 foxr 1073: &Debug($r, "loncfile - Entering phase 2 for $fn");
1.12 foxr 1074:
1075: # Break down the file into it's component pieces.
1076:
1.27 albertel 1077: my $dir; # Directory path
1078: my $main; # Filename.
1079: my $suffix; # Extension.
1.46 taceyjo1 1080: if ($fn=~m:(.*)/([^/]+):) {
1.27 albertel 1081: $dir=$1; # Directory path
1082: $main=$2; # Filename.
1.54 ! albertel 1083: }
! 1084: if($main=~m:\.(\w+)$:){ # Fixes problems with filenames with no extensions
! 1085: $main=$`; #This is what is before the match (.) so it's just the main filename, yea it's nasty
! 1086: $suffix=$1; #This is the actually filename extension if it exists
! 1087: }
1.12 foxr 1088: my $dest; # On success this is where we'll go.
1.9 foxr 1089:
1.12 foxr 1090: &Debug($r,
1091: "loncfile::phase2 dir = $dir main = $main suffix = $suffix");
1092: &Debug($r,
1093: " newfilename = ".$ENV{'form.newfilename'});
1.9 foxr 1094:
1095: my $conspace=$fn;
1.12 foxr 1096:
1097: &Debug($r,
1098: "loncfile::phase2 Full construction space name: $conspace");
1099:
1100: &Debug($r,
1101: "loncfie::phase2 action is $ENV{'form.action'}");
1102:
1103: # Select the appropriate processing sub.
1.44 taceyjo1 1104: if ($ENV{'form.action'} eq 'decompress') {
1105: $main .= '.';
1106: $main .= $suffix;
1107: if(!&decompress2($r, $uname, $dir, $main)) {
1108: return ;
1109: }
1110: $dest = $dir."/.";
1111:
1112:
1113: } elsif ($ENV{'form.action'} eq 'rename') { # Rename.
1.12 foxr 1114: if($ENV{'form.newfilename'}) {
1.27 albertel 1115: if (!defined($dir)) {
1116: $fn=~m:^(.*)/:;
1117: $dir=$1;
1118: }
1.12 foxr 1119: if(!&Rename2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) {
1120: return;
1121: }
1.38 www 1122: $dest = &url($ENV{'form.newfilename'});
1.12 foxr 1123: }
1.5 www 1124: } elsif ($ENV{'form.action'} eq 'delete') {
1.12 foxr 1125: if(!&Delete2($r, $uname, $ENV{'form.newfilename'})) {
1126: return ;
1127: }
1128: # Once a resource is deleted, we just list the directory that
1129: # previously held it.
1130: #
1.20 albertel 1131: $dest = $dir."/."; # Parent dir.
1.5 www 1132: } elsif ($ENV{'form.action'} eq 'copy') {
1.12 foxr 1133: if($ENV{'form.newfilename'}) {
1134: if(!&Copy2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) {
1.44 taceyjo1 1135: return ;
1.12 foxr 1136: }
1137: $dest = $ENV{'form.newfilename'};
1138:
1139: } else {
1.47 sakharuk 1140: $r->print('<p>'.&mt('No New filename specified').'</p></form>');
1.12 foxr 1141: return;
1142: }
1143:
1.5 www 1144: } elsif ($ENV{'form.action'} eq 'newdir') {
1.38 www 1145: my $newdir= $ENV{'form.newfilename'};
1.12 foxr 1146: if(!&NewDir2($r, $uname, $newdir)) {
1147: return;
1148: }
1149: $dest = $newdir."/"
1150: }
1.51 raeburn 1151: if ( ($ENV{'form.action'} eq 'newdir') && ($ENV{'form.phase'} eq 'two') && ( ($ENV{'form.callingmode'} eq 'testbank') || ($ENV{'form.callingmode'} eq 'imsimport') ) ) {
1152: $r->print('<h3><a href="javascript:self.close()">'.&mt('Done').'</a></h3>');
1153: } else {
1154: $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');
1155: }
1.1 www 1156: }
1157:
1158: sub handler {
1159:
1.10 foxr 1160: $r=shift;
1.1 www 1161:
1.9 foxr 1162:
1163: &Debug($r, "loncfile.pm - handler entered");
1.12 foxr 1164: &Debug($r, " filename: ".$ENV{'form.filename'});
1165: &Debug($r, " newfilename: ".$ENV{'form.newfilename'});
1.36 www 1166: #
1167: # Determine the root filename
1168: # This could come in as "filename", which actually is a URL, or
1169: # as "qualifiedfilename", which is indeed a real filename in filesystem
1170: #
1.1 www 1171: my $fn;
1172:
1173: if ($ENV{'form.filename'}) {
1.44 taceyjo1 1174:
1175: &Debug($r, "test: $ENV{'form.filename'}");
1.22 albertel 1176: $fn=&Apache::lonnet::unescape($ENV{'form.filename'});
1.35 www 1177: $fn=&URLToPath($fn);
1.44 taceyjo1 1178: }
1.45 taceyjo1 1179: #Just hijack the script only the first time around to inject the correct information for further processing
1.44 taceyjo1 1180: elsif($ENV{'QUERY_STRING'} && $ENV{'form.phase'} ne 'two') {
1181: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['decompress']);
1182: $fn=&Apache::lonnet::unescape($ENV{'form.decompress'});
1183: $fn=&URLToPath($fn);
1184: $ENV{'form.action'}="decompress";
1185: }
1186:
1187: elsif ($ENV{'form.qualifiedfilename'}) {
1.36 www 1188: $fn=$ENV{'form.qualifiedfilename'};
1.1 www 1189: } else {
1.9 foxr 1190: &Debug($r, "loncfile::handler - no form.filename");
1.1 www 1191: $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}.
1192: ' unspecified filename for cfile', $r->filename);
1193: return HTTP_NOT_FOUND;
1194: }
1195:
1196: unless ($fn) {
1.9 foxr 1197: &Debug($r, "loncfile::handler - doctored url is empty");
1.1 www 1198: $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}.
1199: ' trying to cfile non-existing file', $r->filename);
1200: return HTTP_NOT_FOUND;
1201: }
1202:
1203: # ----------------------------------------------------------- Start page output
1204: my $uname;
1205: my $udom;
1206:
1207: ($uname,$udom)=
1208: &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));
1.9 foxr 1209: &Debug($r,
1210: "loncfile::handler constructaccess uname = $uname domain = $udom");
1.1 www 1211: unless (($uname) && ($udom)) {
1212: $r->log_reason($uname.' at '.$udom.
1.4 www 1213: ' trying to manipulate file '.$ENV{'form.filename'}.
1.1 www 1214: ' ('.$fn.') - not authorized',
1215: $r->filename);
1216: return HTTP_NOT_ACCEPTABLE;
1217: }
1218:
1219:
1.49 www 1220: &Apache::loncommon::content_type($r,'text/html');
1.1 www 1221: $r->send_http_header;
1222:
1.51 raeburn 1223: if ( ($ENV{'form.action'} eq 'newdir') && ($ENV{'form.phase'} eq 'two') && ( ($ENV{'form.callingmode'} eq 'testbank') || ($ENV{'form.callingmode'} eq 'imsimport') ) ) {
1224: my $newdirname = $ENV{'form.newfilename'};
1225: $r->print('<html><head><title>LON-CAPA Construction Space</title><script language="Javascript">');
1226: $r->print(qq|
1227: function writeDone() {
1228: var winName = window.opener
1229: window.focus();
1230: winName.document.dataForm.newdir.value = "$newdirname"
1231: setTimeout("self.close()",10000)
1232: }
1233: </script>
1234: </head>|);
1235: my $loaditem = 'onLoad="writeDone()"';
1236: $r->print(&Apache::loncommon::bodytag('Construction Space File Operation','',$loaditem));
1237: } else {
1238: $r->print('<html><head><title>LON-CAPA Construction Space</title></head>');
1239: $r->print(&Apache::loncommon::bodytag('Construction Space File Operation'));
1240: }
1.1 www 1241:
1242:
1.47 sakharuk 1243: $r->print('<h3>'.&mt('Location').': '.&display($fn).'</h3>');
1.1 www 1244:
1245: if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) {
1.47 sakharuk 1246: $r->print('<h3><font color="red">'.&mt('Co-Author').': '.$uname.' at '.$udom.
1.1 www 1247: '</font></h3>');
1248: }
1249:
1.9 foxr 1250:
1251: &Debug($r, "loncfile::handler Form action is $ENV{'form.action'} ");
1.2 www 1252: if ($ENV{'form.action'} eq 'delete') {
1.9 foxr 1253:
1.47 sakharuk 1254: $r->print('<h3>'.&mt('Delete').'</h3>');
1.2 www 1255: } elsif ($ENV{'form.action'} eq 'rename') {
1.47 sakharuk 1256: $r->print('<h3>'.&mt('Rename').'</h3>');
1.52 albertel 1257: } elsif ($ENV{'form.action'} eq 'move') {
1258: $r->print('<h3>'.&mt('Move').'</h3>');
1.2 www 1259: } elsif ($ENV{'form.action'} eq 'newdir') {
1.47 sakharuk 1260: $r->print('<h3>'.&mt('New Directory').'</h3>');
1.44 taceyjo1 1261: } elsif ($ENV{'form.action'} eq 'decompress') {
1.47 sakharuk 1262: $r->print('<h3>'.&mt('Decompress').'</h3>');
1.2 www 1263: } elsif ($ENV{'form.action'} eq 'copy') {
1.47 sakharuk 1264: $r->print('<h3>'.&mt('Copy').'</h3>');
1.22 albertel 1265: } elsif ($ENV{'form.action'} eq 'newfile' ||
1266: $ENV{'form.action'} eq 'newhtmlfile' ||
1.28 www 1267: $ENV{'form.action'} eq 'newproblemfile' ||
1268: $ENV{'form.action'} eq 'newpagefile' ||
1.30 albertel 1269: $ENV{'form.action'} eq 'newsequencefile' ||
1.34 www 1270: $ENV{'form.action'} eq 'newrightsfile' ||
1271: $ENV{'form.action'} eq 'newstyfile' ||
1.30 albertel 1272: $ENV{'form.action'} eq 'Select Action' ) {
1.47 sakharuk 1273: $r->print('<h3>'.&mt('New Resource').'</h3>');
1.2 www 1274: } else {
1.47 sakharuk 1275: $r->print('<p>'.&mt('Unknown Action').' '.$ENV{'form.action'}.' </p></body></html>');
1.2 www 1276: return OK;
1277: }
1.1 www 1278: if ($ENV{'form.phase'} eq 'two') {
1.9 foxr 1279: &Debug($r, "loncfile::handler entering phase2");
1.4 www 1280: &phasetwo($r,$fn,$uname,$udom);
1.1 www 1281: } else {
1.9 foxr 1282: &Debug($r, "loncfile::handler entering phase1");
1.3 www 1283: &phaseone($r,$fn,$uname,$udom);
1.1 www 1284: }
1285:
1286: $r->print('</body></html>');
1287: return OK;
1288: }
1289:
1290: 1;
1291: __END__
1.9 foxr 1292:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>