1: # Copyright Michigan State University Board of Trustees
2: #
3: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
4: #
5: # LON-CAPA is free software; you can redistribute it and/or modify
6: # it under the terms of the GNU General Public License as published by
7: # the Free Software Foundation; either version 2 of the License, or
8: # (at your option) any later version.
9: #
10: # LON-CAPA is distributed in the hope that it will be useful,
11: # but WITHOUT ANY WARRANTY; without even the implied warranty of
12: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: # GNU General Public License for more details.
14: #
15: # You should have received a copy of the GNU General Public License
16: # along with LON-CAPA; if not, write to the Free Software
17: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: #
19: # /home/httpd/html/adm/gpl.txt
20: #
21: # http://www.lon-capa.org/
22: #
23:
24: package Apache::portfolio;
25: use strict;
26: use Apache::Constants qw(:common :http);
27: use Apache::loncommon;
28: use Apache::lonnet;
29: use Apache::lontexconvert;
30: use Apache::lonfeedback;
31: use Apache::lonlocal;
32:
33: # receives a file name and path stub from username/userfiles/portfolio/
34: # returns an anchor tag consisting encoding filename and currentpath
35: sub make_anchor {
36: my ($filename, $current_path, $current_mode, $field_name) = @_;
37: my $anchor = '<a href="/adm/portfolio?selectfile='.$filename.'¤tpath='.$current_path.'&mode='.$current_mode.'&fieldname='.$field_name.'">'.$filename.'</a>';
38: return $anchor;
39: }
40: my $dirptr=16384;
41: sub display_common {
42: my ($r,$current_path,$is_empty,$dir_list)=@_;
43: my $iconpath= $r->dir_config('lonIconsURL') . "/";
44: $r->print('<table border="0" cellspacing="2" cellpadding="2"><tr valign="middle">');
45: $r->print('<td bgcolor="#ccddaa" align="center">');
46: my $displayOut = '<form method="post" enctype="multipart/form-data">';
47: $displayOut .= '<input name="uploaddoc" type="file" />'.
48: '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
49: '<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
50: '<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
51: '<input type="hidden" name="mode" value="'.$ENV{"form.mode"}.'" />'.
52: '<input type="submit" name="storeupl" value="Upload" />'.
53: '</form>';
54: $r->print($displayOut);
55: $r->print('</td></tr><tr><td bgcolor="#ccddaa" align="center">');
56: $displayOut = '<form method="post">';
57: $displayOut .= '<input name="newdir" type="input" />'.
58: '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
59: '<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
60: '<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
61: '<input type="hidden" name="mode" value="'.$ENV{"form.mode"}.'" />'.
62: '<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.
63: '</form>';
64: $r->print($displayOut);
65: $r->print('</td></tr></table>');
66: my @tree = split (/\//,$current_path);
67: $r->print('<font size="+2">'.&make_anchor('portfolio','/',$ENV{"form.mode"},$ENV{"form.fieldname"}).'/');
68: if (@tree > 1){
69: my $newCurrentPath = '';
70: for (my $i = 1; $i< @tree; $i++){
71: $newCurrentPath .= $tree[$i].'/';
72: $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath, $ENV{"form.mode"},$ENV{"form.fieldname"}).'/');
73: }
74: }
75: $r->print('</font>');
76: &Apache::lonhtmlcommon::store_recent('portfolio',$current_path,$current_path);
77: $r->print('<br /><form method=post action="/adm/portfolio?mode='.$ENV{"form.mode"}.'&fieldname='.$ENV{"form.fieldname"}.'">'.
78: &Apache::lonhtmlcommon::select_recent('portfolio','currentpath',
79: 'this.form.submit();'));
80: $r->print("</form>");
81: }
82: sub display_directory {
83: my ($r,$current_path,$is_empty,$dir_list)=@_;
84: my $iconpath= $r->dir_config('lonIconsURL') . "/";
85: my $display_out;
86: my %locked_files=&Apache::lonnet::dump('file_permissions',
87: $ENV{'user.domain'},$ENV{'user.name'});
88: my $locked_file;
89: foreach my $key (keys %locked_files) {
90: $locked_file .= $locked_files{$key}.':';
91: }
92: if ($is_empty && ($current_path ne '/')) {
93: $display_out = '<form method="post" action="/adm/portfolio">'.
94: '<input type="hidden" name="action" value="deletedir" />'.
95: '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.
96: '<input type="hidden" name="selectfile" value="" />'.
97: '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
98: '</form>';
99:
100: $r->print($display_out);
101: return;
102: }
103: $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
104: '<tr><th>Actions</th><th> </th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
105: my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path";
106: foreach my $line (sort
107: {
108: my ($afile)=split('&',$a,2);
109: my ($bfile)=split('&',$b,2);
110: return (lc($afile) cmp lc($bfile));
111: } (@$dir_list)) {
112: #$strip holds directory/file name
113: #$dom
114: my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);
115: if (($filename ne '.') && ($filename ne '..')) {
116: if ($dirptr&$testdir) {
117: $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
118: $r->print('<td>Go to ...</td>');
119: $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>');
120: $r->print('</tr>');
121: } else {
122: $r->print('<tr bgcolor="#CCCCFF">');
123: $r->print('<td>
124: <form method="post" action="/adm/portfolio">
125: <select name="action">
126: <option value=""></option>
127: <option value="delete">'.&mt("Delete").'</option>
128: <option value="rename">'.&mt("Rename").'</option>
129: </select>
130: <input type="submit" name="doit" value="Go" />
131: <input type="hidden" name="selectfile" value="'.$filename.'" />
132: <input type="hidden" name="currentpath" value="'.$current_path.'" />
133: </form>
134: </td>');
135: $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
136: $r->print('<td><a href="'.$href_location.$filename.'">'.
137: $filename.'</a></td>');
138: $r->print('<td>'.$size.'</td>');
139: $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
140: $r->print('</tr>');
141: }
142: }
143: }
144: # <tr bgcolor="#FFAA99"> pink bg
145: # <tr bgcolor="#CCCCFF"> blue bg
146: # $r->print(&display_directory($current_path, $currentFile, @dir_list));
147: # $r->print('</td>><td>');
148: # $r->print(&display_actions($current_path, $currentFile, $isEmpty));
149: $r->print('</table></form>');
150: }
151: sub display_file_select {
152: my ($r,$current_path,$is_empty,$dir_list)=@_;
153: my $iconpath= $r->dir_config('lonIconsURL') . "/";
154: my $display_out;
155: my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
156: foreach my $key (keys %$checked_files) {
157: &Apache::lonnet::logthis("a key is $key $$checked_files{$key} is the value");
158: }
159: if ($is_empty && ($current_path ne '/')) {
160: $display_out = '<form method="post" action="/adm/portfolio">'.
161: '<input type="hidden" name="action" value="deletedir" />'.
162: '<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.
163: '<input type="hidden" name="selectfile" value="" />'.
164: '<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
165:
166: '</form>';
167:
168: $r->print($display_out);
169: return;
170: }
171: $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
172: '<tr><th>Select</th><th> </th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
173: my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio$current_path";
174: $r->print('<form method="post" name="checkselect" action="/adm/portfolio">');
175: foreach my $line (sort
176: {
177: my ($afile)=split('&',$a,2);
178: my ($bfile)=split('&',$b,2);
179: return (lc($afile) cmp lc($bfile));
180: } (@$dir_list)) {
181: #$strip holds directory/file name
182: #$dom
183: my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);
184: $filename =~ s/\s+$//;
185: if (($filename ne '.') && ($filename ne '..')) {
186: if ($dirptr&$testdir) {
187: $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
188: $r->print('<td>Go to ...</td>');
189: $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>');
190: $r->print('</tr>');
191: } else {
192: $r->print('<tr bgcolor="#CCCCFF">');
193: $r->print('<td><input type="checkbox" name="selectedfile" value="'.$filename.'"');
194: if ($$checked_files{$filename} eq 'selected') {
195: $r->print("CHECKED");
196: &Apache::lonnet::logthis("checked");
197: } else {
198: &Apache::lonnet::logthis("not checked $$checked_files{$filename} $filename");
199: }
200: $r->print('></td>');
201: $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
202: $r->print('<td><a href="'.$href_location.$filename.'">'.
203: $filename.'</a></td>');
204: $r->print('<td>'.$size.'</td>');
205: $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
206: $r->print('</tr>');
207: }
208: }
209: }
210: $r->print('</table>
211: <input type="hidden" name="continue" value="true">
212: <input type="hidden" name="fieldname" value="'.$ENV{'form.fieldname'}.'">
213: <input type="hidden" name="mode" value="selectfile">
214: <input type="submit" name="submit" value="Select checked files, and continue selecting." /><br />
215: <input type="button" name="doit" onClick= "finishSelect();" value="Select checked files, and close window" />
216: <input type="hidden" name="currentpath" value="'.$current_path.'" />
217: </form>');
218: }
219:
220: sub open_form {
221: my ($r)=@_;
222: $r->print('<form method="post" action="/adm/portfolio">');
223: $r->print('<input type="hidden" name="action" value="'.
224: $ENV{'form.action'}.'" />');
225: $r->print('<input type="hidden" name="confirmed" value="1" />');
226: $r->print('<input type="hidden" name="selectfile" value="'.
227: $ENV{'form.selectfile'}.'" />');
228: $r->print('<input type="hidden" name="currentpath" value="'.
229: $ENV{'form.currentpath'}.'" />');
230: }
231:
232: sub close_form {
233: my ($r)=@_;
234: $r->print('<p><input type="submit" value="'.&mt('Continue').
235: '" /></p></form>');
236: $r->print('<form action="/adm/portfolio" method="POST">
237: <p>
238: <input type="hidden" name="currentpath" value="'.
239: $ENV{'form.currentpath'}.'" />
240: <input type="submit" value="'.&mt('Cancel').'" />
241: </p></form>');
242:
243: }
244:
245: sub display_file {
246: my ($path,$filename)=@_;
247: if (!defined($path)) { $path=$ENV{'form.currentpath'}; }
248: if (!defined($filename)) { $filename=$ENV{'form.selectfile'}; }
249: return '<tt>'.$path.$filename.'</tt>';
250: }
251:
252: sub done {
253: return ('<h3><a href="/adm/portfolio?currentpath='.
254: $ENV{'form.currentpath'}.
255: '&fieldname='.$ENV{'form.fieldname'}.
256: '&mode='.$ENV{'form.mode'}.
257: '">'.&mt('Done').'</a></h3>');
258: }
259:
260: sub delete {
261: my ($r)=@_;
262: my @check;
263: my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
264: if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') {
265: $r->print ("The file is locked and cannot be deleted.<br />");
266: $r->print(&done());
267: } else {
268: &open_form($r);
269: $r->print('<p>'.&mt('Delete').' '.&display_file().'?</p>');
270: &close_form($r);
271: }
272: }
273:
274: sub delete_confirmed {
275: my ($r)=@_;
276: my $result=&Apache::lonnet::removeuserfile($ENV{'user.name'},
277: $ENV{'user.domain'},'portfolio'.
278: $ENV{'form.currentpath'}.
279: $ENV{'form.selectfile'});
280: if ($result ne 'ok') {
281: $r->print('<font color="red"> An error occured ('.$result.
282: ') while trying to delete '.&display_file().'</font><br />');
283: }
284: $r->print(&done());
285: }
286:
287: sub delete_dir {
288: my ($r)=@_;
289: &open_form($r);
290: $r->print('<p>'.&mt('Delete').' '.&display_file().'?</p>');
291: &close_form($r);
292: }
293:
294: sub delete_dir_confirmed {
295: my ($r)=@_;
296: my $directory_name = $ENV{'form.currentpath'};
297: $directory_name =~ m/\/$/;
298: $directory_name = $`;
299: my $result=&Apache::lonnet::removeuserfile($ENV{'user.name'},
300: $ENV{'user.domain'},'portfolio'.
301: $directory_name);
302:
303: if ($result ne 'ok') {
304: $r->print('<font color="red"> An error occured (dir) ('.$result.
305: ') while trying to delete '.$directory_name.'</font><br />');
306: } else {
307: # now remove from recent
308: # $r->print('<br /> removing '.$directory_name.'<br /');
309: &Apache::lonhtmlcommon::remove_recent('portfolio',[$directory_name.'/']);
310: my @dirs = split m!/!, $directory_name;
311:
312: # $directory_name =~ m/^(\/*\/)(\/*.)$/;
313: $directory_name='/';
314: for (my $i=1; $i < (@dirs - 1); $i ++){
315: $directory_name .= $dirs[$i].'/';
316: }
317: $ENV{'form.currentpath'} = $directory_name;
318: }
319: $r->print(&done());
320: }
321:
322: sub rename {
323: my ($r)=@_;
324: my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
325: if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'}) eq 'true') {
326: $r->print ("The file is locked and cannot be renamed.<br />");
327: $r->print(&done());
328: } else {
329: &open_form($r);
330: $r->print('<p>'.&mt('Rename').' '.&display_file().' to
331: <input name="filenewname" type="input" size="50" />?</p>');
332: &close_form($r);
333: }
334: }
335:
336: sub rename_confirmed {
337: my ($r)=@_;
338: my $filenewname=&Apache::lonnet::clean_filename($ENV{'form.filenewname'});
339: if ($filenewname eq '') {
340: $r->print('<font color="red">'.
341: &mt("Error: no valid filename was provided to rename to.").
342: '</font><br />');
343: $r->print(&done());
344: return;
345: }
346: my $result=
347: &Apache::lonnet::renameuserfile($ENV{'user.name'},$ENV{'user.domain'},
348: 'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.selectfile'},
349: 'portfolio'.$ENV{'form.currentpath'}.$filenewname);
350: if ($result ne 'ok') {
351: $r->print('<font color="red"> An errror occured ('.$result.
352: ') while trying to rename '.&display_file().' to '.
353: &display_file(undef,$filenewname).'</font><br />');
354: }
355: $r->print(&done());
356: }
357: sub select_files {
358: my ($r)=@_;
359: if ($ENV{'form.continue'} eq 'true') {
360: # here we update the selections for the currentpath
361: # eventually, have to handle removing those not checked, but . . .
362: my @items=&Apache::loncommon::get_env_multiple('form.selectedfile');
363: &Apache::lonnet::save_selected_files($ENV{'user.name'}, $ENV{'form.currentpath'}, @items);
364: }
365: my $java_script =(<<ENDSMP);
366: <script language='javascript'>
367: function finishSelect() {
368: fileList = "";
369: for (i=0;i<document.forms.checkselect.length;i++) {
370: if (document.forms.checkselect[i].checked){
371: fileList = fileList + document.forms.checkselect.currentpath.value + document.forms.checkselect[i].value + "," ;
372: }
373: }
374: opener.document.forms.lonhomework.
375: ENDSMP
376: $java_script .= $ENV{'form.fieldname'};
377: $java_script .= (<<ENDSMP);
378: .value=fileList;
379: self.close();
380: }
381: </script>
382: ENDSMP
383: $r->print($java_script);
384: $r->print("<h1>Select portfolio files</h1>
385: Check as many as you wish in response to the essay problem.<br />");
386: $r->print("<strong>Files selected from other directories:</strong><br />");
387: foreach (&Apache::lonnet::files_not_in_path($ENV{'user.name'}, $ENV{'form.currentpath'})) {
388: $r->print($_."<br />");
389: }
390: }
391: sub upload {
392: my ($r)=@_;
393: my $fname=$ENV{'form.uploaddoc.filename'};
394: my $filesize = (length($ENV{'form.uploaddoc'})) / 1000; #express in k (1024?)
395: my $disk_quota = 20000; # expressed in k
396: $fname=&Apache::lonnet::clean_filename($fname);
397: my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
398: $ENV{'user.name'}).
399: '/userfiles/portfolio';
400: # Fixme --- Move the checking for existing file to LOND error return
401: my @dir_list=&Apache::lonnet::dirlist($ENV{'form.currentpath'},
402: $ENV{'user.domain'},
403: $ENV{'user.name'},$portfolio_root);
404: my $found_file = 0;
405: foreach my $line (@dir_list) {
406: my ($filename)=split(/\&/,$line,2);
407: if ($filename eq $fname){
408: $found_file = 1;
409: }
410: }
411: my $current_disk_usage = &Apache::lonnet::diskusage($ENV{'user.domain'}, $ENV{'user.name'},$portfolio_root);
412: if (($current_disk_usage + $filesize) > $disk_quota){
413: $r->print('<font color="red">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes</strong>. Disk quota will be exceeded.'.
414: '<br />Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.');
415: }
416: elsif ($found_file){
417: $r->print('<font color="red">Unable to upload <strong>'.$fname.'</strong>, a file by that name was found in <strong>'.$ENV{'form.currentpath'}.'</strong></font>'.
418: '<br />To upload, rename or delete existing '.$fname.' in '.$ENV{'form.currentpath'});
419: } else {
420: my $result=&Apache::lonnet::userfileupload('uploaddoc','',
421: 'portfolio'.$ENV{'form.currentpath'});
422: if ($result !~ m|^/uploaded/|) {
423: $r->print('<font color="red"> An errror occured ('.$result.
424: ') while trying to upload '.&display_file().'</font><br />');
425: }
426: }
427: $r->print(&done());
428: }
429:
430: sub createdir {
431: my ($r)=@_;
432: my $newdir=&Apache::lonnet::clean_filename($ENV{'form.newdir'});
433: if ($newdir eq '') {
434: $r->print('<font color="red">'.
435: &mt("Error: no directory name was provided.").
436: '</font><br />');
437: $r->print(&done());
438: return;
439: }
440: my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
441: $ENV{'user.name'}).
442: '/userfiles/portfolio';
443: my @dir_list=&Apache::lonnet::dirlist($ENV{'form.currentpath'},
444: $ENV{'user.domain'},
445: $ENV{'user.name'},$portfolio_root);
446: my $found_file = 0;
447: foreach my $line (@dir_list) {
448: my ($filename)=split(/\&/,$line,2);
449: if ($filename eq $newdir){
450: $found_file = 1;
451: }
452: }
453: if ($found_file){
454: $r->print('<font color="red"> Unable to create a directory named <strong>'.$newdir.
455: ' </strong>a file or directory by that name already exists.</font><br />');
456: } else {
457: my $result=&Apache::lonnet::mkdiruserfile($ENV{'user.name'},
458: $ENV{'user.domain'},'portfolio'.$ENV{'form.currentpath'}.$newdir);
459: if ($result ne 'ok') {
460: $r->print('<font color="red"> An errror occured ('.$result.
461: ') while trying to create a new directory '.&display_file().'</font><br />');
462: }
463: }
464: $r->print(&done());
465: }
466:
467: sub handler {
468: # this handles file management
469: my $r = shift;
470: my $portfolio_root = &Apache::loncommon::propath($ENV{'user.domain'},
471: $ENV{'user.name'}).
472: '/userfiles/portfolio';
473: &Apache::loncommon::no_cache($r);
474: &Apache::loncommon::content_type($r,'text/html');
475: $r->send_http_header;
476: # Give the LON-CAPA page header
477: $r->print('<html><head><title>'.
478: &mt('Portfolio Manager').
479: "</title></head>\n".
480: &Apache::loncommon::bodytag('Portfolio Manager'));
481: $r->rflush();
482: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
483: ['selectfile','currentpath',
484: 'currentfile','action','fieldname','mode']);
485: if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){
486: $r->print('<font color="red"> No file was selected to upload.'.
487: 'To upload a file, click <strong>Browse...</strong>'.
488: ', select a file, then click <strong>Upload</strong>,</font>');
489: }
490: if ($ENV{'form.uploaddoc.filename'}) {
491: &upload($r);
492: } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {
493: &delete_confirmed($r);
494: } elsif ($ENV{'form.action'} eq 'delete') {
495: &delete($r);
496: } elsif ($ENV{'form.action'} eq 'deletedir' && $ENV{'form.confirmed'}) {
497: &delete_dir_confirmed($r);
498: } elsif ($ENV{'form.action'} eq 'deletedir'){
499: &delete_dir($r);
500: } elsif ($ENV{'form.action'} eq 'rename' && $ENV{'form.confirmed'}) {
501: &rename_confirmed($r);
502: } elsif ($ENV{'form.action'} eq 'rename') {
503: &rename($r);
504: } elsif ($ENV{'form.createdir'}) {
505: &createdir($r);
506: } else {
507: my $current_path='/';
508: if ($ENV{'form.currentpath'}) {
509: $current_path = $ENV{'form.currentpath'};
510: }
511: my @dir_list=&Apache::lonnet::dirlist($current_path,
512: $ENV{'user.domain'},
513: $ENV{'user.name'},$portfolio_root);
514: if ($dir_list[0] eq 'no_such_dir'){
515: # two main reasons for this:
516: # 1) never been here, so directory structure not created
517: # 2) back-button navigation after deleting a directory
518: if ($current_path eq '/'){
519: &Apache::lonnet::mkdiruserfile($ENV{'user.name'},
520: $ENV{'user.domain'},'portfolio');
521: } else {
522: # some directory that snuck in get rid of the directory
523: # from the recent pulldown, just in case
524: &Apache::lonhtmlcommon::remove_recent('portfolio',
525: [$current_path]);
526: $current_path = '/'; # force it back to the root
527: }
528: # now grab the directory list again, for the first time
529: @dir_list=&Apache::lonnet::dirlist($current_path,
530: $ENV{'user.domain'},
531: $ENV{'user.name'},$portfolio_root);
532: }
533: # need to know if directory is empty so it can be removed if desired
534: my $is_empty=(@dir_list == 2);
535: &display_common($r,$current_path,$is_empty,\@dir_list);
536: if ($ENV{"form.mode"} eq 'selectfile'){
537: &select_files($r);
538: &display_file_select($r,$current_path,$is_empty,\@dir_list);
539: } else {
540: &display_directory($r,$current_path,$is_empty,\@dir_list);
541: }
542: $r->print("</body>\n</html>\n");
543: return OK;
544: }
545: }
546: 1;
547: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>