3 // Manage all uploaded files in a course file area
5 // This file is a hack to files/index.php that removes
6 // the headers and adds some controls so that images
7 // can be selected within the Richtext editor.
9 // All the Moodle-specific stuff is in this top section
10 // Configuration and access control occurs here.
11 // Must define: USER, basedir, baseweb, html_header and html_footer
12 // USER is a persistent variable using sessions
14 require("../../../config.php");
15 require_once($CFG->libdir
.'/filelib.php');
17 $id = required_param('id', PARAM_INT
);
18 $file = optional_param('file', '', PARAM_PATH
);
19 $wdir = optional_param('wdir', '', PARAM_PATH
);
20 $action = optional_param('action', '', PARAM_ACTION
);
21 $name = optional_param('name', '', PARAM_FILE
);
22 $oldname = optional_param('oldname', '', PARAM_FILE
);
23 $usecheckboxes = optional_param('usecheckboxes', 1, PARAM_INT
);
24 $save = optional_param('save', 0, PARAM_BOOL
);
25 $text = optional_param('text', '', PARAM_RAW
);
26 $confirm = optional_param('confirm', 0, PARAM_BOOL
);
29 if (! $course = get_record("course", "id", $id) ) {
30 error("That's an invalid course id");
33 require_login($course);
34 require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE
, $id));
36 function html_footer() {
37 echo "\n\n</body>\n</html>";
40 function html_header($course, $wdir, $formfield=""){
45 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
46 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
49 <meta http
-equiv
="content-type" content
="text/html; charset=utf-8" />
50 <title
>coursefiles
</title
>
51 <script type
="text/javascript">
55 function set_value(params
) {
56 /// function's argument is an object containing necessary values
57 /// to export parent window (url,isize,itype,iwidth,iheight, imodified)
58 /// set values when user click's an image name.
59 var upper
= window
.parent
;
60 var insimg
= upper
.document
.getElementById('f_url');
64 if(params
.itype
.indexOf("image/gif") == -1 && params
.itype
.indexOf("image/jpeg") == -1 && params
.itype
.indexOf("image/png") == -1) {
65 alert("<?php print_string("notimage
","editor
");?>");
68 for(field in params
) {
69 var value
= params
[field
];
71 case "url" : upper
.document
.getElementById('f_url').value
= value
;
72 upper
.ipreview
.location
.replace('popups/preview.php?id='+
<?php
print($course->id
);?
> +
'&imageurl='+ value
);
74 case "isize" : upper
.document
.getElementById('isize').value
= value
; break;
75 case "itype" : upper
.document
.getElementById('itype').value
= value
; break;
76 case "iwidth": upper
.document
.getElementById('f_width').value
= value
; break;
77 case "iheight": upper
.document
.getElementById('f_height').value
= value
; break;
81 for(field in params
) {
82 var value
= params
[field
];
85 //upper.document.getElementById('f_href').value = value;
86 upper
.opener
.document
.getElementById('f_href').value
= value
;
89 //case "imodified" : upper.document.getElementById('imodified').value = value; break;
90 //case "isize" : upper.document.getElementById('isize').value = value; break;
91 //case "itype" : upper.document.getElementById('itype').value = value; break;
96 if ( window
.tinyMCE
!= "undefined" || window
.TinyMCE
!= "undefined" ) {
97 upper
.opener
.Dialog
._return(params
.url
);
100 alert("Something odd just occurred!!!");
106 function set_dir(strdir
) {
108 var upper
= window
.parent
.document
;
110 for(var i
= 0; i
< upper
.forms
.length
; i++
) {
111 var f
= upper
.forms
[i
];
113 f
.wdir
.value
= strdir
;
121 function set_rename(strfile
) {
122 var upper
= window
.parent
.document
;
123 upper
.getElementById('irename').value
= strfile
;
127 function reset_value() {
128 var upper
= window
.parent
.document
;
129 for(var i
= 0; i
< upper
.forms
.length
; i++
) {
130 var f
= upper
.forms
[i
];
131 for(var j
= 0; j
< f
.elements
.length
; j++
) {
132 var e
= f
.elements
[j
];
133 if(e
.type
!= "submit" && e
.type
!= "button" && e
.type
!= "hidden") {
141 upper
.getElementById('irename').value
= 'xx';
143 var prev
= window
.parent
.ipreview
;
145 prev
.location
.replace('about:blank');
147 var uploader
= window
.parent
.document
.forms
['uploader'];
148 if(uploader
!= null) {
151 set_dir('<?php print($wdir);?>');
156 <style type
="text/css">
158 background
-color
: white
;
163 body
,p
,table
,td
,input
,select
,a
{
164 font
-family
: Tahoma
, sans
-serif
;
173 vertical
-align
:middle
;
181 <body onload
="reset_value();">
186 if (! $basedir = make_upload_directory("$course->id")) {
187 error("The site administrator needs to fix the file permissions");
190 $baseweb = $CFG->wwwroot
;
192 // End of configuration and access control
202 html_header($course, $wdir);
203 require_once($CFG->dirroot
.'/lib/uploadlib.php');
205 if ($save and confirm_sesskey()) {
206 $um = new upload_manager('userfile',false,false,$course,false,0);
207 $dir = "$basedir$wdir";
208 if ($um->process_file_uploads($dir)) {
209 notify(get_string('uploadedfile'));
211 // um will take care of error reporting.
214 $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes
);
215 $filesize = display_size($upload_max_filesize);
217 $struploadafile = get_string("uploadafile");
218 $struploadthisfile = get_string("uploadthisfile");
219 $strmaxsize = get_string("maxsize", "", $filesize);
220 $strcancel = get_string("cancel");
222 echo "<p>$struploadafile ($strmaxsize) --> <strong>$wdir</strong>";
223 echo "<table border=\"0\"><tr><td colspan=\"2\">\n";
224 echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"coursefiles.php\">\n";
225 upload_print_form_fragment(1,array('userfile'),null,false,null,$course->maxbytes
,0,false);
226 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
227 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
228 echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />\n";
229 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
230 echo " </td><tr><td align=\"right\">";
231 echo " <input type=\"submit\" name=\"save\" value=\"$struploadthisfile\" />\n";
233 echo "</td>\n<td>\n";
234 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
235 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
236 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
237 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
238 echo " <input type=\"submit\" value=\"$strcancel\" />\n";
240 echo "</td>\n</tr>\n</table>\n";
246 if ($confirm and confirm_sesskey()) {
247 html_header($course, $wdir);
248 foreach ($USER->filelist
as $file) {
249 $fullfile = $basedir.$file;
250 if (! fulldelete($fullfile)) {
251 echo "<br />Error: Could not delete: $fullfile";
259 html_header($course, $wdir);
260 if (setfilelist($_POST)) {
261 echo "<p align=center>".get_string("deletecheckwarning").":</p>";
262 print_simple_box_start("center");
263 printfilelist($USER->filelist
);
264 print_simple_box_end();
266 $frameold = $CFG->framename
;
267 $CFG->framename
= "ibrowser";
268 notice_yesno (get_string("deletecheckfiles"),
269 "coursefiles.php?id=$id&wdir=$wdir&action=delete&confirm=1&sesskey=$USER->sesskey",
270 "coursefiles.php?id=$id&wdir=$wdir&action=cancel");
271 $CFG->framename
= $frameold;
280 html_header($course, $wdir);
281 if ($count = setfilelist($_POST) and confirm_sesskey()) {
282 $USER->fileop
= $action;
283 $USER->filesource
= $wdir;
284 echo "<p align=\"center\">";
285 print_string("selectednowmove", "moodle", $count);
293 html_header($course, $wdir);
294 if (isset($USER->fileop
) and $USER->fileop
== "move" and confirm_sesskey()) {
295 foreach ($USER->filelist
as $file) {
296 $shortfile = basename($file);
297 $oldfile = $basedir.$file;
298 $newfile = $basedir.$wdir."/".$shortfile;
299 if (!rename($oldfile, $newfile)) {
300 echo "<p>Error: $shortfile not moved";
310 if (!empty($name) and confirm_sesskey()) {
311 html_header($course, $wdir);
312 $name = clean_filename($name);
313 if (file_exists($basedir.$wdir."/".$name)) {
314 echo "Error: $name already exists!";
315 } else if (!@rename
($basedir.$wdir."/".$oldname, $basedir.$wdir."/".$name)) {
316 echo "Error: could not rename $oldname to $name";
321 $strrename = get_string("rename");
322 $strcancel = get_string("cancel");
323 $strrenamefileto = get_string("renamefileto", "moodle", $file);
324 html_header($course, $wdir, "form.name");
325 echo "<p>$strrenamefileto:";
326 echo "<table border=\"0\">\n<tr>\n<td>\n";
327 echo "<form action=\"coursefiles.php\" method=\"post\" id=\"form\">\n";
328 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
329 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
330 echo " <input type=\"hidden\" name=\"action\" value=\"rename\" />\n";
331 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
332 echo " <input type=\"hidden\" name=\"oldname\" value=\"$file\" />\n";
333 echo " <input type=\"text\" name=\"name\" size=\"35\" value=\"$file\" />\n";
334 echo " <input type=\"submit\" value=\"$strrename\" />\n";
337 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
338 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
339 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
340 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
341 echo " <input type=\"submit\" value=\"$strcancel\" />\n";
343 echo "</td></tr>\n</table>\n";
349 if (!empty($name) and confirm_sesskey()) {
350 html_header($course, $wdir);
351 $name = clean_filename($name);
352 if (file_exists("$basedir$wdir/$name")) {
353 echo "Error: $name already exists!";
354 } else if (! make_upload_directory("$course->id/$wdir/$name")) {
355 echo "Error: could not create $name";
360 $strcreate = get_string("create");
361 $strcancel = get_string("cancel");
362 $strcreatefolder = get_string("createfolder", "moodle", $wdir);
363 html_header($course, $wdir, "form.name");
364 echo "<p>$strcreatefolder:";
365 echo "<table border=\"0\">\n<tr><td>\n";
366 echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\">\n";
367 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
368 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
369 echo " <input type=\"hidden\" name=\"action\" value=\"mkdir\" />\n";
370 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
371 echo " <input type=\"text\" name=\"name\" size=\"35\" />\n";
372 echo " <input type=\"submit\" value=\"$strcreate\" />\n";
375 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
376 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
377 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
378 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
379 echo " <input type=\"submit\" value=\"$strcancel\" />\n";
381 echo "</td>\n</tr>\n</table>\n";
387 html_header($course, $wdir);
388 if (($text != '') and confirm_sesskey()) {
389 $fileptr = fopen($basedir.$file,"w");
390 fputs($fileptr, stripslashes($text));
395 $streditfile = get_string("edit", "", "<strong>$file</strong>");
396 $fileptr = fopen($basedir.$file, "r");
397 $contents = fread($fileptr, filesize($basedir.$file));
400 print_heading("$streditfile");
402 echo "<table><tr><td colspan=\"2\">\n";
403 echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\" $onsubmit>\n";
404 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
405 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
406 echo " <input type=\"hidden\" name=file value=\"$file\" />";
407 echo " <input type=\"hidden\" name=\"action\" value=\"edit\" />\n";
408 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
409 print_textarea(false, 25, 80, 680, 400, "text", $contents);
410 echo "</td>\n</tr>\n<tr>\n<td>\n";
411 echo " <input type=\"submit\" value=\"".get_string("savechanges")."\" />\n";
413 echo "</td>\n<td>\n";
414 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
415 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
416 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
417 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
418 echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />\n";
420 echo "</td></tr></table>\n";
422 if ($usehtmleditor) {
423 use_html_editor("text");
432 if (!empty($name) and confirm_sesskey()) {
433 html_header($course, $wdir);
434 $name = clean_filename($name);
437 foreach ($USER->filelist
as $file) {
438 $files[] = "$basedir/$file";
441 if (!zip_files($files,"$basedir/$wdir/$name")) {
442 error(get_string("zipfileserror","error"));
449 html_header($course, $wdir, "form.name");
451 if (setfilelist($_POST)) {
452 echo "<p align=\"center\">".get_string("youareabouttocreatezip").":</p>";
453 print_simple_box_start("center");
454 printfilelist($USER->filelist
);
455 print_simple_box_end();
457 echo "<p align=\"center\">".get_string("whattocallzip");
458 echo "<table border=\"0\">\n<tr>\n<td>\n";
459 echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\">\n";
460 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
461 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
462 echo " <input type=\"hidden\" name=\"action\" value=\"zip\" />\n";
463 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
464 echo " <INPUT type=\"text\" name=\"name\" size=\"35\" value=\"new.zip\" />\n";
465 echo " <input type=\"submit\" value=\"".get_string("createziparchive")."\" />";
467 echo "</td>\n<td>\n";
468 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
469 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
470 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
471 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
472 echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />\n";
474 echo "</td>\n</tr>\n</table>\n";
484 html_header($course, $wdir);
485 if (!empty($file) and confirm_sesskey()) {
486 $strok = get_string("ok");
487 $strunpacking = get_string("unpacking", "", $file);
489 echo "<p align=\"center\">$strunpacking:</p>";
491 $file = basename($file);
493 if (!unzip_file("$basedir/$wdir/$file")) {
494 error(get_string("unzipfileserror","error"));
497 echo "<center><form action=\"coursefiles.php\" method=\"get\">\n";
498 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
499 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
500 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
501 echo " <input type=\"submit\" value=\"$strok\" />\n";
511 html_header($course, $wdir);
512 if (!empty($file) and confirm_sesskey()) {
513 $strname = get_string("name");
514 $strsize = get_string("size");
515 $strmodified = get_string("modified");
516 $strok = get_string("ok");
517 $strlistfiles = get_string("listfiles", "", $file);
519 echo "<p align=\"center\">$strlistfiles:</p>";
520 $file = basename($file);
522 require_once($CFG->libdir
.'/pclzip/pclzip.lib.php');
523 $archive = new PclZip("$basedir/$wdir/$file");
524 if (!$list = $archive->listContent("$basedir/$wdir")) {
525 notify($archive->errorInfo(true));
528 echo "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\">\n";
529 echo "<tr>\n<th align=\"left\" scope=\"col\">$strname</th><th align=\"right\" scope=\"col\">$strsize</th><th align=\"right\" scope=\"col\">$strmodified</th></tr>";
530 foreach ($list as $item) {
532 print_cell("left", $item['filename']);
533 if (! $item['folder']) {
534 print_cell("right", display_size($item['size']));
536 echo "<td> </td>\n";
538 $filedate = userdate($item['mtime'], get_string("strftimedatetime"));
539 print_cell("right", $filedate);
544 echo "<br /><center><form action=\"coursefiles.php\" method=\"get\">\n";
545 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
546 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
547 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
548 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
549 echo " <input type=\"submit\" value=\"$strok\" />\n";
562 html_header($course, $wdir);
569 /// FILE FUNCTIONS ///////////////////////////////////////////////////////////
572 function setfilelist($VARS) {
575 $USER->filelist
= array ();
579 foreach ($VARS as $key => $val) {
580 if (substr($key,0,4) == "file") {
582 $val = rawurldecode($val);
583 if (!detect_munged_arguments($val, 0)) {
584 $USER->filelist
[] = $val;
591 function clearfilelist() {
594 $USER->filelist
= array ();
599 function printfilelist($filelist) {
600 global $basedir, $CFG;
602 foreach ($filelist as $file) {
603 if (is_dir($basedir.$file)) {
604 echo "<img src=\"$CFG->pixpath/f/folder.gif\" class=\"icon\" alt=\"".get_string('folder')."\" /> $file<br />";
605 $subfilelist = array();
606 $currdir = opendir($basedir.$file);
607 while (false !== ($subfile = readdir($currdir))) {
608 if ($subfile <> ".." && $subfile <> ".") {
609 $subfilelist[] = $file."/".$subfile;
612 printfilelist($subfilelist);
615 $icon = mimeinfo("icon", $file);
616 echo "<img src=\"$CFG->pixpath/f/$icon\" class=\"icon\" alt=\"".get_string('file')."\" /> $file<br />";
622 function print_cell($alignment="center", $text=" ") {
623 echo "<td align=\"$alignment\" nowrap=\"nowrap\">\n";
628 function get_image_size($filepath) {
629 /// This function get's the image size
631 /// Check if file exists
632 if(!file_exists($filepath)) {
635 /// Get the mime type so it really an image.
636 if(mimeinfo("icon", basename($filepath)) != "image.gif") {
639 $array_size = getimagesize($filepath);
643 unset($filepath,$array_size);
646 function displaydir ($wdir) {
647 // $wdir == / or /a or /a/b/c/d etc
650 global $usecheckboxes;
654 $fullpath = $basedir.$wdir;
656 $directory = opendir($fullpath); // Find all files
657 while (false !== ($file = readdir($directory))) {
658 if ($file == "." ||
$file == "..") {
662 if (is_dir($fullpath."/".$file)) {
668 closedir($directory);
670 $strfile = get_string("file");
671 $strname = get_string("name");
672 $strsize = get_string("size");
673 $strmodified = get_string("modified");
674 $straction = get_string("action");
675 $strmakeafolder = get_string("makeafolder");
676 $struploadafile = get_string("uploadafile");
677 $strwithchosenfiles = get_string("withchosenfiles");
678 $strmovetoanotherfolder = get_string("movetoanotherfolder");
679 $strmovefilestohere = get_string("movefilestohere");
680 $strdeletecompletely = get_string("deletecompletely");
681 $strcreateziparchive = get_string("createziparchive");
682 $strrename = get_string("rename");
683 $stredit = get_string("edit");
684 $strunzip = get_string("unzip");
685 $strlist = get_string("list");
686 $strchoose = get_string("choose");
689 echo "<form action=\"coursefiles.php\" method=\"post\" name=\"dirform\">\n";
690 echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n";
695 $bdir = str_replace("/".basename($wdir),"",$wdir);
699 print "<tr>\n<td colspan=\"5\">";
700 print "<a href=\"coursefiles.php?id=$id&wdir=$bdir&usecheckboxes=$usecheckboxes\" onclick=\"return reset_value();\">";
701 print "<img src=\"$CFG->wwwroot/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"".get_string('parentfolder')."\" />";
702 print "</a></td>\n</tr>\n";
707 if (!empty($dirlist)) {
709 foreach ($dirlist as $dir) {
713 $filename = $fullpath."/".$dir;
714 $fileurl = $wdir."/".$dir;
715 $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
719 if ($usecheckboxes) {
720 print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" onclick=\"return set_rename('$dir');\" />");
722 print_cell("left", "<a href=\"coursefiles.php?id=$id&wdir=$fileurl\" onclick=\"return reset_value();\"><img src=\"$CFG->pixpath/f/folder.gif\" class=\"icon\" alt=\"".get_string('folder')."\" /></a> <a href=\"coursefiles.php?id=$id&wdir=$fileurl&usecheckboxes=$usecheckboxes\" onclick=\"return reset_value();\">".htmlspecialchars($dir)."</a>");
723 print_cell("right", " ");
724 print_cell("right", $filedate);
731 if (!empty($filelist)) {
733 foreach ($filelist as $file) {
735 $icon = mimeinfo("icon", $file);
736 $imgtype = mimeinfo("type",$file);
739 $filename = $fullpath."/".$file;
740 $fileurl = "$wdir/$file";
741 $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
743 $dimensions = get_image_size($filename);
745 $imgwidth = $dimensions[0];
746 $imgheight = $dimensions[1];
748 $imgwidth = "Unknown";
749 $imgheight = "Unknown";
754 if ($usecheckboxes) {
755 print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" onclick=\";return set_rename('$file');\" />");
757 echo "<td align=\"left\" nowrap=\"nowrap\">";
758 if ($CFG->slasharguments
) {
759 $ffurl = "/file.php/$id$fileurl";
761 $ffurl = "/file.php?file=/$id$fileurl";
763 link_to_popup_window ($ffurl, "display",
764 "<img src=\"$CFG->pixpath/f/$icon\" class=\"icon\" alt=\"$strfile\" />",
766 $file_size = filesize($filename);
768 echo "<a onclick=\"return set_value(info = {url: '".$CFG->wwwroot
.$ffurl."',";
769 echo " isize: '".$file_size."', itype: '".$imgtype."', iwidth: '".$imgwidth."',";
770 echo " iheight: '".$imgheight."', imodified: '".$filedate."' })\" href=\"#\">$file</a>";
773 if ($icon == "zip.gif") {
774 $edittext = "<a href=\"coursefiles.php?id=$id&wdir=$wdir&file=$fileurl&action=unzip&sesskey=$USER->sesskey\">$strunzip</a> ";
775 $edittext .= "<a href=\"coursefiles.php?id=$id&wdir=$wdir&file=$fileurl&action=listzip&sesskey=$USER->sesskey\">$strlist</a> ";
777 $edittext = " ";
779 print_cell("right", "$edittext ");
780 print_cell("right", $filedate);
791 echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
793 echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
794 echo "<input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
795 echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
797 "move" => "$strmovetoanotherfolder",
798 "delete" => "$strdeletecompletely",
799 "zip" => "$strcreateziparchive"
801 if (!empty($count)) {
802 choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
804 if (!empty($USER->fileop
) and ($USER->fileop
== "move") and ($USER->filesource
<> $wdir)) {
805 echo "<form action=\"coursefiles.php\" method=\"get\">\n";
806 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
807 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />\n";
808 echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />\n";
809 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />\n";
810 echo " <input type=\"submit\" value=\"$strmovefilestohere\" />\n";