function displaydir($wdir, $files) { // $wdir == / or /a or /a/b/c/d etc @ini_set('memory_limit', '1024M'); global $courseid, $DB, $OUTPUT; global $USER, $CFG, $COURSE; global $choose; global $deptstr, $userstr; require_once $CFG->dirroot . '/blocks/morsle/constants.php'; $course = $COURSE; $user = $USER; // Get the sort parameter if there is one $sort = optional_param('sort', 1, PARAM_INT); $dirlist = array(); $filelist = array(); $dirhref = array(); $filehref = array(); $courseid = $course->id; $coursecontext = context_course::instance($COURSE->id); // separate all the files list into directories and files foreach ($files as $name => $file) { if (is_folder($file)) { $dirlist[$name] = $file; } else { $filelist[$name] = $file; } } // setup variables and strings $strname = get_string("name", 'block_morsle'); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("morslemakecollection", 'block_morsle'); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strlinktocourse = get_string("linktocourse", 'block_morsle'); $strmovefilestohere = get_string("movefilestohere"); $strdeletefromcollection = get_string("deletefromcollection", 'block_morsle'); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strfolder = get_string("folder"); $strfile = get_string("file"); $strdownload = get_string("strdownload", 'block_morsle'); $struploadthisfile = get_string("uploadthisfile"); $struploadandlinkthisfile = get_string("uploadandlinkthisfile", 'block_morsle'); $filesize = 'Varies as to type of document'; $strmaxsize = get_string("maxsize", "", $filesize); $strcancel = get_string("cancel"); $strmodified = get_string("strmodified", 'block_morsle'); //CLAMP #289 set color and background-color to transparent //Kevin Wiliarty 2011-03-08 $padrename = get_string("rename"); $padedit = $padunzip = $padlist = $padrestore = $padchoose = $padfolder = $padfile = $padlink = ''; $attsArr = array($padedit => $stredit, $padunzip => $strunzip, $padlist => $strlist, $padrestore => $strrestore, $padchoose => $strchoose, $padfolder => $strfolder, $padfile => $strfile, $padlink => $strlinktocourse); foreach ($attsArr as $key => $value) { $key = html_writer::div($value . ' ', '', array('style' => 'color:transparent; background-color:transparent; display:inline;')); } /* $padedit = html_writer::div($stredit . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padunzip = html_writer::div($strunzip . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padlist = html_writer::div($strlist . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padrestore = html_writer::div($strrestore . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padchoose = html_writer::div($strchoose . ' ','', array('style'=>'color: transparent; background-color:transparent; display:inline')); $padfolder = html_writer::div($strfolder . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); $padfile = html_writer::div($strfile . ' ','', array('style'=>'color:transparent; background-color; transparent; display:inline;')); $padlink = html_writer::div($strlinktocourse . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); */ $gdocsstr = 'Google-Docs-Storage-for-'; // Set sort arguments so that clicking on a column that is already sorted reverses the sort order $sortvalues = array(1, 2, 3); foreach ($sortvalues as &$sortvalue) { if ($sortvalue == $sort) { $sortvalue = -$sortvalue; } } $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); // beginning of with selected files portion echo html_writer::start_tag('table', array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '2', 'style' => 'min-width: 900px; margin-left:auto; margin-right:auto', 'class' => 'files')); if ($wdir !== '') { echo html_writer::start_tag('tr'); //html_writer::table($table); if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'center')); // move files to other folder form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'paste')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); echo html_writer::tag('input', '', array('align' => 'center', 'type' => 'submit', 'value' => $strmovefilestohere)); //echo "<span> --> <b>$wdir</b></span><br />"; echo html_writer::start_span() . '-->' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::end_tag('br'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td'); echo html_writer::end_tag('form'); // cancel moving form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'style' => 'color:red; margin-left:10px')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); } else { if (has_capability('moodle/course:update', $coursecontext) || strpos($wdir, '-write')) { echo html_writer::start_tag('tr', array('style' => 'background-color: #ffddbb;')); echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'left', 'style' => 'background-color:#ffddbb; padding-left:5px;')); // file upload form // TODO: what if we're in the user or departmental dir? echo html_writer::start_tag('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => 'morslefiles.php')); echo html_writer::start_span() . ' ' . $struploadafile . ' (' . $strmaxsize . ') ' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::tag('br', ''); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'upload')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); if (!isset($coursebytes)) { $coursebytes = 0; } if (!isset($modbytes)) { $modbytes = 0; } $maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes); $str = html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $maxbytes)) . "\n"; $name = 'userfile'; $str .= html_writer::tag('input', '', array('type' => 'file', 'size' => '50', 'name' => $name, 'alt' => $name, 'style' => 'margin-left: 5px;')) . html_writer::end_tag('br') . "\n"; echo $str; echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'save', 'value' => $struploadthisfile, 'style' => 'color:green; padding-left:5px;')); echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'savelink', 'value' => $struploadandlinkthisfile, 'style' => 'color:blue; padding-left:5px;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); // cancel button div only if not in root morsle directory echo html_writer::start_tag('tr'); echo html_writer::tag('td', '', array('colspan' => '2', 'style' => 'background-color:#ffddbb;')); echo html_writer::start_tag('td', array('style' => 'background-color:#ffddbb; padding-left:5px;', 'colspan' => '1', 'align' => 'right')); echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'align' => 'left', 'style' => 'color:red;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); echo html_writer::end_tag('tr'); echo html_writer::start_tag('tr'); echo html_writer::start_tag('tr') . html_writer::tag('td', '<br>', array('colspace' => '4')) . html_writer::end_tag('tr'); echo html_writer::start_tag('td', array('style' => 'max-width:50px; white-space:nowrap;', 'colspan' => '2', 'align' => 'left')); //dummy form - alignment only echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::start_tag('fieldset', array('class' => 'invisiblefieldset')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectall, 'onclick' => 'checkall();', 'style' => 'color:green;')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectnone, 'onclick' => 'checknone();', 'style' => 'color:red;')); echo html_writer::end_tag('fieldset'); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td', array('align' => 'center', 'colspan' => '2')); // makedir form // TODO: program to allow this in user and departmental directory if (strpos($wdir, $deptstr) === false && strpos($wdir, $userstr) === false) { // not a user or departmental folder echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'makedir')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strmakeafolder)); echo html_writer::end_tag('form'); } echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); } } } echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'post', 'id' => 'dirform')); echo html_writer::start_div(); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::start_tag('tr'); echo html_writer::start_tag('th', array('class' => 'header', 'scope' => 'col', 'style' => 'max-width:40px;')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); // $options = array ("delete" => "$strdeletefromcollection"); // only editing teachers can link items to course page if (has_capability('moodle/course:update', $coursecontext)) { $options['link'] = "{$strlinktocourse}"; } if (!empty($filelist) || !empty($dirlist)) { // echo html_writer::tag('label', "$strwithchosenfiles...", array('for'=>'formactionid')); // echo html_writer::select($options, "$strwithchosenfiles...", '', array(1 => "$strwithchosenfiles...")); echo html_writer::start_div('', array('id' => 'noscriptgo', 'style' => 'display:inline;')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => get_string('go'))); echo html_writer::script('document.getElementById("noscriptgo").style.display="none"'); echo html_writer::end_div(); } echo html_writer::end_tag('th'); echo html_writer::start_tag('th', array('style' => 'padding-right:120px;', 'class' => 'header name', 'scope' => 'col')) . html_writer::link(qualified_me(), $strname, array('&sort' => '{' . $sortvalues[0] . '}')) . html_writer::end_tag('th'); echo html_writer::start_tag('th', array('class' => 'header date', 'scope' => 'col')) . html_writer::link(qualified_me(), $strmodified, array('&sort' => '{' . $sortvalues[2] . '}')) . html_writer::end_tag('th'); echo html_writer::tag('th', $straction, array('class' => 'header commands', 'scope' => 'col')); echo html_writer::end_tag('tr') . "\n"; // Sort parameter indicates column to sort by, and parity gives the direction switch ($sort) { case 1: $sortcmp = 'return strcasecmp($a[0],$b[0]);'; break; case -1: $sortcmp = 'return strcasecmp($b[0],$a[0]);'; break; case 2: $sortcmp = 'return ($a[1] - $b[1]);'; break; case -2: $sortcmp = 'return ($b[1] - $a[1]);'; break; case 3: $sortcmp = 'return ($a[2] - $b[2]);'; break; case -3: $sortcmp = 'return ($b[2] - $a[2]);'; break; } // Create a 2D array of directories and sort $dirdetails = array(); foreach ($dirlist as $name => $dir) { $dirdetails[$name] = new stdClass(); $dirdetails[$name]->updated = docdate($dir); $dirdetails[$name]->link = $dir->alternateLink; // usort($dirdetails, create_function('$a,$b', $sortcmp)); } // TODO: change to handle cross-listed courses // TODO: this needs to change if we eliminate morsle table if ($wdir === '') { $shortname = is_number(substr($course->shortname, 0, 5)) ? substr($course->shortname, 6) : $course->shortname; // SPLIT INTO DEPARTMENTAL CODES $dept = explode("-", $shortname); $deptpart = defined($dept[0]) ? CONSTANT($dept[0]) : null; $deptstr = $deptpart . $deptstr; $deptaccount = strtolower($deptstr); // only show the user collection if we're in the base folder $dirdetails[$userstr] = new stdClass(); $dirdetails[$userstr]->updated = date('Y-m-d'); $dirdetails[$userstr]->link = 'https://drive.google.com'; // always include departmental directory if exists // check to see if we even have a departmental account for this department but don't show the departmental collection if we're already in it indicated by $wdir if ($is_morsle_dept = $DB->get_record('morsle_active', array('shortname' => $deptaccount)) && has_capability('moodle/course:update', $coursecontext)) { $dirdetails[$deptstr] = new stdClass(); $dirdetails[$deptstr]->updated = date('Y-m-d'); } } // Create a 2D array of files and sort $filedetails = array(); $filetitles = array(); foreach ($filelist as $name => $file) { $filedetails[$name] = new stdClass(); $filedetails[$name]->updated = docdate($file); $filedetails[$name]->link = $file->alternateLink; // $row = array($filename, $filedate); // array_push($filedetails, $row); // usort($filedetails, create_function('$a,$b', $sortcmp)); } // TODO: fix this hack so we're back to being able to sort // ksort($filedetails); // sets the locked in sorting to name // need this in order to look up the link for the file based on doc title (key) /* if (sizeof($filelist) > 0) { $filevalues = array_values($filelist); $filelist = array_combine($filetitles, $filevalues); } */ // $count = 0; // $countdir = 0; $edittext = $padchoose . $padedit . $padunzip . $padlist . $padrestore; if ($wdir !== '') { $pathparts = explode('/', $wdir); array_pop($pathparts); $wdir = implode('/', $pathparts); echo "<tr class=\"folder\">"; print_cell(); print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid='.$courseid.'&wdir='.$wdir.'/&choose='.$choose.'"> '.get_string('parentfolder').'</a>', 'parent'); echo "</tr>"; } if (!empty($dirdetails)) { foreach ($dirdetails as $name => $dir) { echo html_writer::start_tag('tr', array('class' => 'folder')); $filedate = $dir->updated; $filesafe = rawurlencode($name); $filename = $name; $fileurl = $dir->link; // $countdir++; // TODO: fix the parent directory if ($name == '..') { // $fileurl = rawurlencode(dirname($wdir)); print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '/' . $fileurl . '&choose=' . $choose . '"><img src="' . $OUTPUT->pix_url('f/parent.gif') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); /* } else if ($name === $userstr) { // if departmental account or user collection // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections // don't know where this fits in $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose .'&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="' . $fileurl . '" target="_blank"><img src="'. $OUTPUT->pix_url("f/folder") .'" class="icon" alt="" /> '. $filename .'</a>'); print_cell("right", $filedate, 'date'); // print_cell(); print_cell(); // print_cell(); } else if ($name === $deptstr){ // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell("center", "<input type=\"checkbox\" name=\"dir$countdir\" value=\"$filename\" />", 'checkbox'); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$branchdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } // print_cell(); */ } else { // not a user or departmental folder print_cell(); // print_cell("center", "<input type=\"checkbox\" name=\"$name\" value=\"$filename\" />", 'checkbox'); // print_cell("left", "<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir/$filesafe&choose=$choose\"><img src=\"$OUTPUT->pix_url('f/folder')\" class=\"icon\" alt=\"$strfolder\" /> ".$filename."</a>", 'name'); $branchdir = "{$wdir}/{$filesafe}"; // $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . $filename . '</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "{$edittext}<a href=\"morslefiles.php?courseid={$courseid}&wdir={$branchdir}&file={$filename}&action=link&type=dir&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); // print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } } echo html_writer::end_tag('tr'); } } $iconchoices = array('excel' => 'download/spreadsheets', 'powerpoint' => 'download/presentations', 'word' => 'download/documents', 'pdf' => 'application/pdf'); if (!empty($filedetails)) { foreach ($filedetails as $name => $file) { if (isset($filelist[$name]->exportLinks)) { $links = array(); $links = array_values($filelist[$name]->exportLinks); $exportlink = $links[0]; } else { $exportlink = $filelist[$name]->alternateLink; } // positively identify the correct icon regardless of filename extension $icon = $filelist[$name]->iconLink; $filename = $name; $fileurl = $file->link; $embedlink = $filelist[$name]->embedLink; $embedsafe = rawurlencode($embedlink); $fileurlsafe = rawurlencode($fileurl); $filedate = $file->updated; $fileid = $filelist[$name]->id; $selectfile = trim($fileurl, "/"); // echo html_writer::start_tag('td', array('class'=>'file')); // echo html_writer::end_tag('td'); print_cell("center", "<input type=\"checkbox\" name=\"file\" value=\"{$filename}\" />", 'checkbox'); //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 // echo html_writer::start_tag('td', array('align'=>'left','style'=>'white-space:nowrap; padding-left:0px;','class'=>'name')); print_cell('left', '<a href="' . $fileurl . '" class="morslefile" target="_blank"> <img src="' . $icon . '" class="icon" alt="' . $strfile . '" /> ' . $filename . '</a>', 'name'); // $echovar = '<a href="' . $fileurl . '" target="_blank"> // <img src="' . $OUTPUT->pix_url("f/$icon") . '" class="icon" alt="' . $strfile . '" /> ' . htmlspecialchars($filename) . '</a>'; // echo $echovar; //html_writer::link(qualified_me(), $strname, array('&sort'=>'{'.$sortvalues[0].'}')) //$echovar = html_writer::tag('a', $fileurl, array('target'=>'_blank')) . html_writer::img($OUTPUT->pix_url("f/$icon"), $strfile, array('class'=>'icon')) . ' '.htmlspecialchars($filename) . html_writer::end_tag('a'); //echo $echovar; // echo html_writer::end_tag('td'); print_cell("right", $filedate, 'date'); if (has_capability('moodle/course:update', $coursecontext)) { if (strpos($wdir, $gdocsstr) === 1) { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}/{$fileid}&file={$filename}&name={$filename}&filelink={$fileurl}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } else { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}&file={$filename}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } // print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?courseid=$courseid&embedlink=' . $embedsafe . '&name=' . $filename . '"> Embed </a>','embed'); } // print_cell('left', '  <a title="' . strip_tags($strdownload) . ': ' . $name . '" href="' .$CFG->wwwroot // . '/blocks/morsle/docs_export.php?exportlink=' . s($exportlink) . '&shortname=' . $course->shortname . '&title=' . $filename . '" target="_blank"> Download </a>','commands'); print_cell(); print_cell('left', '  <a title="' . $name . '" href="' . s($exportlink) . '" target="_blank"> Download </a>', 'commands'); //print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?"' . s($embedlink) . '" target="_blank"> Embed in a Page resource </a>','commands'); echo html_writer::end_tag('tr'); } } echo html_writer::end_div(); echo html_writer::end_tag('form'); echo html_writer::end_tag('table'); }
function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $usecheckboxes; global $id; global $USER, $CFG; $fullpath = $basedir . $wdir; $directory = opendir($fullpath); // Find all files while (false !== ($file = readdir($directory))) { if ($file == "." || $file == "..") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } else { $filelist[] = $file; } } closedir($directory); $strfile = get_string("file"); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strchoose = get_string("choose"); echo "<form action=\"coursefiles.php\" method=\"post\" name=\"dirform\">\n"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n"; if ($wdir == "/") { $wdir = ""; } else { $bdir = str_replace("/" . basename($wdir), "", $wdir); if ($bdir == "/") { $bdir = ""; } print "<tr>\n<td colspan=\"5\">"; print "<a href=\"coursefiles.php?id={$id}&wdir={$bdir}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">"; print "<img src=\"{$CFG->wwwroot}/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"" . get_string('parentfolder') . "\" />"; print "</a></td>\n</tr>\n"; } $count = 0; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { $count++; $filename = $fullpath . "/" . $dir; $fileurl = $wdir . "/" . $dir; $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); echo "<tr>"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$dir}');\" />"); } 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>"); print_cell("right", " "); print_cell("right", $filedate); echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); foreach ($filelist as $file) { $icon = mimeinfo("icon", $file); $imgtype = mimeinfo("type", $file); $count++; $filename = $fullpath . "/" . $file; $fileurl = "{$wdir}/{$file}"; $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); $dimensions = get_image_size($filename); if ($dimensions) { $imgwidth = $dimensions[0]; $imgheight = $dimensions[1]; } else { $imgwidth = "Unknown"; $imgheight = "Unknown"; } unset($dimensions); echo "<tr>\n"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\";return set_rename('{$file}');\" />"); } echo "<td align=\"left\" nowrap=\"nowrap\">"; $ffurl = get_file_url($id . $fileurl); link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />", 480, 640); $file_size = filesize($filename); echo "<a onclick=\"return set_value(info = {url: '" . $ffurl . "',"; echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',"; echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "' })\" href=\"#\">{$file}</a>"; echo "</td>\n"; if ($icon == "zip.gif") { $edittext = "<a href=\"coursefiles.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> "; $edittext .= "<a href=\"coursefiles.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> "; } else { $edittext = " "; } print_cell("right", "{$edittext} "); print_cell("right", $filedate); echo "</tr>\n"; } } echo "</table>\n"; if (empty($wdir)) { $wdir = "/"; } echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; echo "<tr>\n<td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:getElementById('dirform').submit()"); } if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo "<form action=\"coursefiles.php\" method=\"get\">\n"; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />\n"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />\n"; echo "</form>"; } echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; }
function fm_unzip_show_status($list, $removepath) { //This function shows the results of the unzip execution //depending of the value of the $CFG->zip, results will be //text or an array of files. global $CFG; if (empty($CFG->unzip)) { // Use built-in php-based zip function $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $strstatus = get_string("status"); echo "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\" width=\"640\">"; echo "<tr><th class=\"header\" align=\"left\">{$strname}</th>"; echo "<th class=\"header\" align=\"right\">{$strsize}</th>"; echo "<th class=\"header\" align=\"right\">{$strmodified}</th>"; echo "<th class=\"header\" align=\"right\">{$strstatus}</th></tr>"; foreach ($list as $item) { echo "<tr>"; $item['filename'] = str_replace(cleardoubleslashes($removepath) . '/', "", $item['filename']); print_cell("left", $item['filename']); if (!$item['folder']) { print_cell("right", display_size($item['size'])); } else { echo "<td> </td>"; } $filedate = userdate($item['mtime'], get_string("strftimedatetime")); print_cell("right", $filedate); print_cell("right", $item['status']); echo "</tr>"; } echo "</table>"; } else { // Use external zip program print_simple_box_start("center"); echo "<pre>"; foreach ($list as $item) { echo str_replace(cleardoubleslashes($removepath . '/'), '', $item) . '<br />'; } echo "</pre>"; print_simple_box_end(); } }
function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $id; global $USER, $CFG; global $choose; $fullpath = $basedir . $wdir; $dirlist = array(); $directory = opendir($fullpath); // Find all files while (false !== ($file = readdir($directory))) { if ($file == "." || $file == "..") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } else { $filelist[] = $file; } } closedir($directory); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strfolder = get_string("folder"); $strfile = get_string("file"); echo "<form action=\"index.php\" method=\"post\" id=\"dirform\">"; echo "<div>"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; // echo "<hr align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<hr/>"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">"; echo "<tr>"; echo "<th class=\"header\" scope=\"col\"></th>"; echo "<th class=\"header name\" scope=\"col\">{$strname}</th>"; echo "<th class=\"header size\" scope=\"col\">{$strsize}</th>"; echo "<th class=\"header date\" scope=\"col\">{$strmodified}</th>"; echo "<th class=\"header commands\" scope=\"col\">{$straction}</th>"; echo "</tr>\n"; if ($wdir != "/") { $dirlist[] = '..'; } $count = 0; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { echo "<tr class=\"folder\">"; if ($dir == '..') { $fileurl = rawurlencode(dirname($wdir)); print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader print_cell('left', '<a href="index.php?id=' . $id . '&wdir=' . $fileurl . '&choose=' . $choose . '"><img src="' . $CFG->pixpath . '/f/parent.gif" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); } else { $count++; $filename = $fullpath . "/" . $dir; $fileurl = rawurlencode($wdir . "/" . $dir); $filesafe = rawurlencode($dir); $filesize = display_size(get_directory_size("{$fullpath}/{$dir}")); $filedate = userdate(filemtime($filename), get_string("strftimedatetime")); if ($wdir . $dir === '/moddata') { print_cell(); } else { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); } print_cell("left", "<a href=\"index.php?id={$id}&wdir={$fileurl}&choose={$choose}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" class=\"icon\" alt=\"{$strfolder}\" /> " . htmlspecialchars($dir) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); if ($wdir . $dir === '/moddata') { print_cell(); } else { print_cell("right", "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$filesafe}&action=rename&choose={$choose}\">{$strrename}</a>", 'commands'); } } echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); foreach ($filelist as $file) { $icon = mimeinfo("icon", $file); $count++; $filename = $fullpath . "/" . $file; $fileurl = trim($wdir, "/") . "/{$file}"; $filesafe = rawurlencode($file); $fileurlsafe = rawurlencode($fileurl); $filedate = userdate(filemtime($filename), get_string("strftimedatetime")); $selectfile = trim($fileurl, "/"); echo "<tr class=\"file\">"; print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); echo "<td align=\"left\" style=\"white-space:nowrap\" class=\"name\">"; $ffurl = get_file_url($id . '/' . $fileurl); link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" /> " . htmlspecialchars($file), 480, 640); echo "</td>"; $file_size = filesize($filename); print_cell("right", display_size($file_size), 'size'); print_cell("right", $filedate, 'date'); if ($choose) { $edittext = "<strong><a onclick=\"return set_value('{$selectfile}')\" href=\"#\">{$strchoose}</a></strong> "; } else { $edittext = ''; } if ($icon == "text.gif" || $icon == "html.gif") { $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=edit&choose={$choose}\">{$stredit}</a>"; } else { if ($icon == "zip.gif") { $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strunzip}</a> "; $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strlist}</a> "; if (!empty($CFG->backup_version) and has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) { $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$filesafe}&action=restore&sesskey={$USER->sesskey}&choose={$choose}\">{$strrestore}</a> "; } } } print_cell("right", "{$edittext} <a href=\"index.php?id={$id}&wdir={$wdir}&file={$filesafe}&action=rename&choose={$choose}\">{$strrename}</a>", 'commands'); echo "</tr>"; } } echo "</table>"; echo "<hr />"; //echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">"; echo "<tr><td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:getElementById('dirform').submit()"); echo '<div id="noscriptgo" style="display: inline;">'; echo '<input type="submit" value="' . get_string('go') . '" />'; echo '<script type="text/javascript">' . "\n//<![CDATA[\n" . 'document.getElementById("noscriptgo").style.display = "none";' . "\n//]]>\n" . '</script>'; echo '</div>'; } echo "</td></tr></table>"; echo "</div>"; echo "</form>"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\"><tr>"; echo "<td align=\"center\">"; if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo "<form action=\"index.php\" method=\"get\">"; echo "<div>"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />"; echo "</div>"; echo "</form>"; } echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo "<div>"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"makedir\" />"; echo " <input type=\"submit\" value=\"{$strmakeafolder}\" />"; echo "</div>"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; //dummy form - alignment only echo "<fieldset class=\"invisiblefieldset\">"; echo " <input type=\"button\" value=\"{$strselectall}\" onclick=\"checkall();\" />"; echo " <input type=\"button\" value=\"{$strselectnone}\" onclick=\"uncheckall();\" />"; echo "</fieldset>"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo "<div>"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />"; echo " <input type=\"submit\" value=\"{$struploadafile}\" />"; echo "</div>"; echo "</form>"; echo "</td></tr>"; echo "</table>"; echo "<hr/>"; //echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; }
if ($verbose) { print_cell("<pre>\n" . urldecode($row['comments']) . "\n\t</pre>"); print_cell(gather_enum_multi_print("sdram", 4, $row)); print_cell(gather_enum_multi_print("flash", 4, $row)); print_cell(gather_enum_multi_print("zbt", 16, $row)); print_cell(gather_enum_multi_print("xlxtyp", 4, $row)); print_cell(gather_enum_multi_print("xlxspd", 4, $row)); print_cell(gather_enum_multi_print("xlxtmp", 4, $row)); print_cell(gather_enum_multi_print("xlxgrd", 4, $row)); print_cell($row['cputyp']); print_cell($row['cpuspd']); print_cell($row['cpmspd']); print_cell($row['busspd']); print_cell($row['hstype']); print_cell($row['hschin']); print_cell($row['hschout']); } echo "</tr>\n"; } ?> </table> <p></p> <table width="100%"> <tr> <td align=center><?php printf("<a href=\"%s?submit=Browse&offset=%d&verbose=%d%s\">%s Listing</a>\n", $PHP_SELF, $offset, $verbose ? 0 : 1, $serno != '' ? "&serno={$serno}" : '', $verbose ? "Terse" : "Verbose"); ?> </td> <td align=center><a href="index.php">Back to Start</a></td> </tr> </table>
function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $usecheckboxes; global $id; global $USER, $CFG, $isteacher, $isstudent; $fullpath = $basedir . $wdir; $directory = opendir($fullpath); // Find all files while ($file = readdir($directory)) { if ($file == "." || $file == ".." || $file == "tmp") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } } $test = str_replace("/", "", $wdir); if (empty($test)) { $wdir = ""; } $images = netpublish_get_images($id, $wdir); /*print "<pre>"; print_r($images); print "</pre>"; exit;*/ $filelist = array(); if (!empty($images)) { $i = 0; foreach ($images as $img) { $filelist[$i]['id'] = $img->id; $filelist[$i]['course'] = $img->course; $filelist[$i]['name'] = $img->name; $filelist[$i]['mime'] = $img->mimetype; $filelist[$i]['size'] = $img->size; $filelist[$i]['dir'] = $img->dir; $filelist[$i]['filedate'] = userdate($img->timemodified, "%d %b %Y, %I:%M %p"); $filelist[$i]['width'] = $img->width; $filelist[$i]['height'] = $img->height; $filelist[$i]['owner'] = $img->owner; $i++; } } //closedir($directory); $strfile = get_string("file"); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strchoose = get_string("choose"); echo "<form action=\"imagebank.php\" method=\"post\" name=\"dirform\">\n"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">\n"; if (empty($wdir)) { $wdir = ""; } else { $bdir = str_replace("/" . basename($wdir), "", $wdir); if ($bdir == "/") { $bdir = ""; } print "<tr>\n<td colspan=\"5\">"; print "<a href=\"imagebank.php?id={$id}&wdir={$bdir}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">"; print "<img src=\"{$CFG->wwwroot}/lib/editor/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"Move up\" />"; print "</a></td>\n</tr>\n"; } $count = 0; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { $count++; $filename = $fullpath . "/" . $dir; $fileurl = rawurlencode($wdir . "/" . $dir); $filesafe = rawurlencode($dir); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); echo "<tr>"; if ($usecheckboxes && $isteacher) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$filesafe}');\" />"); } else { print_cell("left"); } print_cell("left", "<a href=\"imagebank.php?id={$id}&wdir={$fileurl}\" onclick=\"return reset_value();\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"folder\" /></a> <a href=\"imagebank.php?id={$id}&wdir={$fileurl}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">" . htmlspecialchars($dir) . "</a>"); print_cell("right", " "); print_cell("right", $filedate); echo "</tr>"; } } if (!empty($filelist)) { foreach ($filelist as $file) { $icon = mimeinfo("icon", $file['name']); $imgtype = $file['mime']; $count++; //$filename = $fullpath."/".$file['name']; $fileurl = "/mod/netpublish/image.php?id={$file['id']}"; $filesafe = rawurlencode($file['name']); $fileurlsafe = rawurlencode($fileurl); $filedate = $file['filedate']; $imgwidth = $file['width']; $imgheight = $file['height']; echo "<tr>\n"; if ($usecheckboxes) { if (intval($file['owner']) == intval($USER->id) or $isteacher) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$file['id']}\" onclick=\"return set_rename('{$file['id']}');\" />"); } else { print_cell("left"); } } echo "<td align=\"left\" nowrap=\"nowrap\">"; if ($CFG->slasharguments) { $ffurl = $fileurl; } else { $ffurl = $fileurl; } link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" border=\"0\" align=\"middle\" alt=\"{$strfile}\" />", 480, 640); $file_size = $file['size']; echo "<a onclick=\"return set_value(info = {url: '" . $CFG->wwwroot . $ffurl . "',"; echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',"; echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "', ialt: '" . $file['name'] . "' })\" href=\"#\">{$file['name']}</a>"; echo "</td>\n"; if ($icon == "zip.gif") { $edittext = "<a href=\"imagebank.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> "; $edittext .= "<a href=\"imagebank.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> "; } else { $edittext = " "; } print_cell("right", "{$edittext} "); print_cell("right", $filedate); echo "</tr>\n"; } } echo "</table>\n"; if (empty($wdir)) { $wdir = "/"; } echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; echo "<tr>\n<td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.dirform.submit()"); } if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo "<form action=\"imagebank.php\" method=\"get\">\n"; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />\n"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />\n"; echo "</form>"; } echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; }
function displaydir($file_info) { global $CFG; $children = $file_info->get_children(); $parent_info = $file_info->get_parent(); $strname = get_string('name'); $strsize = get_string('size'); $strmodified = get_string('modified'); $strfolder = get_string('folder'); $strfile = get_string('file'); $strdownload = get_string('download'); $strdelete = get_string('delete'); $straction = get_string('action'); $path = array(); $params = $file_info->get_params_rawencoded(); $params = implode('&', $params); $path[] = $file_info->get_visible_name(); $level = $parent_info; while ($level) { $params = $level->get_params_rawencoded(); $params = implode('&', $params); $path[] = '<a href="index.php?' . $params . '">' . $level->get_visible_name() . '</a>'; $level = $level->get_parent(); } $path = array_reverse($path); $path = implode(' / ', $path); echo $path . ' /'; echo "<div>"; echo "<hr/>"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"740\" class=\"files\">"; echo "<tr>"; echo "<th class=\"header\" scope=\"col\"></th>"; echo "<th class=\"header name\" scope=\"col\">{$strname}</th>"; echo "<th class=\"header size\" scope=\"col\">{$strsize}</th>"; echo "<th class=\"header date\" scope=\"col\">{$strmodified}</th>"; echo "<th class=\"header commands\" scope=\"col\">{$straction}</th>"; echo "</tr>\n"; $parentwritable = $file_info->is_writable(); if ($parent_info) { $params = $parent_info->get_params_rawencoded(); $params = implode('&', $params); echo "<tr class=\"folder\">"; print_cell(); print_cell('left', '<a href="index.php?' . $params . '"><img src="' . $CFG->pixpath . '/f/parent.gif" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); echo "</tr>"; } if ($children) { foreach ($children as $child_info) { $filename = $child_info->get_visible_name(); $filesize = $child_info->get_filesize(); $filesize = $filesize ? display_size($filesize) : ''; $filedate = $child_info->get_timemodified(); $filedate = $filedate ? userdate($filedate) : ''; $mimetype = $child_info->get_mimetype(); $params = $child_info->get_params_rawencoded(); $params = implode('&', $params); if ($child_info->is_directory()) { echo "<tr class=\"folder\">"; print_cell(); print_cell("left", "<a href=\"index.php?{$params}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" class=\"icon\" alt=\"{$strfolder}\" /> " . s($filename) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); if ($parentwritable) { print_cell("right", "<a href=\"index.php?{$params}&sesskey=" . sesskey() . "&delete=1\"><img src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command'); } else { print_cell(); } echo "</tr>"; } else { $icon = mimeinfo_from_type("icon", $mimetype); if ($downloadurl = $child_info->get_url(true)) { $downloadurl = " <a href=\"{$downloadurl}\" title=\"" . get_string('downloadfile') . "\"><img src=\"{$CFG->pixpath}/t/down.gif\" class=\"iconsmall\" alt=\"{$strdownload}\" /></a>"; } else { $downloadurl = ''; } if ($viewurl = $child_info->get_url()) { $viewurl = " " . link_to_popup_window($viewurl, "display", "<img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strfile}\" /> ", 480, 640, get_string('viewfileinpopup'), null, true); } else { $viewurl = ''; } echo "<tr class=\"file\">"; print_cell(); print_cell("left", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" /> " . s($filename) . $downloadurl . $viewurl, 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); if ($parentwritable) { print_cell("right", "<a href=\"index.php?{$params}&sesskey=" . sesskey() . "&delete=1\"><img src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command'); } else { print_cell(); } echo "</tr>"; } } } echo "</table>"; echo "</div>"; echo "<hr/>"; }
function displaydir($uuid, $wdir, $courseid = 0) { global $USER, $CFG; global $basedir; global $usecheckboxes; global $id; global $oid; global $shared; global $userid; global $repo; $fullpath = $basedir . $wdir; $dirlist = array(); $filelist = array(); $parentdir = new Object(); if (!empty($userid)) { $ustore = $repo->get_user_store($userid); } if (!empty($userid) && ($uuid == '' || $uuid == $ustore)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($shared) && ($uuid == '' || $uuid == $repo->suuid)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($oid) && ($uuid == '' || $uuid == $repo->get_organization_store($oid))) { $parentdir->title = ''; $parentdir->url = ''; } else { if ($uuid == '' || !($parent = $repo->get_parent($uuid)) || $id != SITEID && ($uuid == '' || $uuid == $repo->get_course_store($id))) { $parentdir->title = ''; $parentdir->url = ''; } else { $parentdir->uuid = $parent->uuid; $parentdir->name = $parent->title; $parentdir->title = '..'; } } } } $dirlist[] = $parentdir; $catselect = array(); if (empty($uuid) && $id != SITEID) { $uuid = $repo->get_course_store($id); } if (!empty($search)) { if (($data = data_submitted()) && confirm_sesskey()) { if (!empty($data->categories)) { $catselect = $data->categories; } } $search = stripslashes($search); $repodir = $repo->search($search, $catselect); } else { $repodir = $repo->read_dir($uuid); } // Store the UUID value that we are currently browsing. $repo->set_repository_location($uuid, $id, $userid, $shared, $oid); if (!empty($repodir->folders)) { foreach ($repodir->folders as $folder) { $dirlist[] = $folder; } } if (!empty($repodir->files)) { foreach ($repodir->files as $file) { $filelist[] = $file; } } $strfile = get_string("file"); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strchoose = get_string("choose"); $strbrowserepo = get_string('browserepository', 'repository'); $strdownloadlocal = get_string('downloadlocally', 'repository'); echo "<form action=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php\" method=\"post\" name=\"dirform\">\n"; echo '<input type="hidden" name="oid" value="' . $oid . '" />' . "\n"; echo '<input type="hidden" name="shared" value="' . $shared . '" />' . "\n"; echo '<input type="hidden" name="userid" value="' . $userid . '" />' . "\n"; echo '<input type="hidden" name="uuid" value="' . $uuid . '" />' . "\n"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n"; if (!empty($parentdir->uuid)) { print "<tr>\n<td colspan=\"5\">"; print '<a href=' . $CFG->wwwroot . '/file/repository/alfresco/coursefiles.php?id=' . $id . '&uuid=' . $parentdir->uuid . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=/&usecheckboxes=' . $usecheckboxes . '" ' . 'onclick="return reset_value();">'; print "<img src=\"{$CFG->wwwroot}/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"" . get_string('parentfolder') . "\" />"; print "</a></td>\n</tr>\n"; } $count = 0; if (!empty($dirlist)) { foreach ($dirlist as $dir) { if (empty($dir->uuid)) { continue; } $count++; if ($dir->title == '..' || $dir->title == $strbrowserepo) { if (!empty($dir->url)) { if ($usecheckboxes) { print_cell(); } if (!empty($search)) { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . $strbrowserepo . '" /></a> <a href="' . $dir->url . '">' . $strbrowserepo . '</a>', 'name'); } else { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="' . $dir->url . '">' . get_string('parentfolder') . '</a>', 'name'); } print_cell(); print_cell(); } } else { $pdir = urlencode($dir->title); $fileurl = $dir->uuid; //$filename = $fullpath."/".$dir; //$fileurl = $wdir."/".$dir; $filedate = userdate($dir->modified, "%d %b %Y, %I:%M %p"); echo "<tr>"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$dir->title}');\" />"); } $astr = $CFG->wwwroot . '/file/repository/alfresco/coursefiles.php?id=' . $id . '&oid=' . $oid . '&uuid=' . $fileurl . '&shared=' . $shared . '&userid=' . $userid . '&wdir=/&usecheckboxes=' . $usecheckboxes . '" ' . 'onclick=" return reset_value();"'; print_cell('left', '<a href="' . $astr . '><img src="' . $CFG->pixpath . '/f/folder.gif" class="icon" ' . 'alt=""' . get_string('folder') . '" /></a> <a href="' . $astr . '>' . htmlspecialchars($dir->title) . '</a>'); print_cell("right", " "); print_cell("right", $filedate); } echo "</tr>"; } } if (!empty($filelist)) { foreach ($filelist as $file) { $icon = mimeinfo('icon', $file->title); $imgtype = mimeinfo('type', $file->title); $count++; $filename = $fullpath . "/" . $file->title; $fileurl = "{$file->uuid}"; $filedate = userdate($file->modified, "%d %b %Y, %I:%M %p"); $dimensions = get_image_size($file->uuid); if ($dimensions) { $imgwidth = $dimensions[0]; $imgheight = $dimensions[1]; } else { $imgwidth = "Unknown"; $imgheight = "Unknown"; } unset($dimensions); echo "<tr>\n"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\";return set_rename('{$file->title}');\" />"); } echo "<td align=\"left\" nowrap=\"nowrap\">"; $ffurl = $CFG->wwwroot . '/file/repository/' . $CFG->repository . '/openfile.php?uuid=' . $file->uuid; link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />", 480, 640); $file_size = $file->filesize; echo "<a onclick=\"return set_value(info = {url: '" . $ffurl . "',"; echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',"; echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "' })\" href=\"#\">{$file->title}</a>"; echo "</td>\n"; if ($icon == "zip.gif") { $edittext = "<a href=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php?id={$id}&userid={$userid}&oid={$oid}&shared={$shared}&uuid={$file->uuid}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> "; $edittext .= "<a href=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php?id={$id}&userid={$userid}&oid={$oid}&shared={$shared}&uuid={$file->uuid}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> "; } else { $edittext = " "; } print_cell("right", "{$edittext} "); print_cell("right", $filedate); echo "</tr>\n"; } } echo "</table>\n"; if (empty($wdir)) { $wdir = "/"; } echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; echo "<tr>\n<td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />\n"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />\n"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />\n"; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />\n"; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; $options = array("delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:getElementById('dirform').submit()"); } echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; }
} else { $icon = mimeinfo("icon", $file); echo "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"\" /> {$file}<br />"; } } } function print_cell($alignment = 'center', $text = ' ', $class = '') { if ($class) { $class = ' class="' . $class . '"'; } echo '<td align="' . $alignment . '" nowrap="nowrap"' . $class . '>' . $text . '</td>'; } function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $podcast; global $id; global $USER, $CFG; global $choose; $fullpath = $basedir . $wdir; $dirlist = array(); $directory = opendir($fullpath); // Find all files while (false !== ($file = readdir($directory))) { if ($file == "." || $file == "..") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } else { $filelist[] = $file; } } closedir($directory); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); echo "<form action=\"index.php\" method=\"post\" name=\"dirform\">"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">"; echo "<tr>"; echo "<th width=\"5\"></th>"; echo "<th align=\"left\" class=\"header name\">{$strname}</th>"; echo "<th align=\"right\" class=\"header size\">{$strsize}</th>"; echo "<th align=\"right\" class=\"header date\">{$strmodified}</th>"; echo "<th align=\"right\" class=\"header commands\">{$straction}</th>"; echo "</tr>\n"; if ($wdir != "/") { $dirlist[] = '..'; } $count = 0; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { echo "<tr class=\"folder\">"; if ($dir == '..') { $fileurl = rawurlencode(dirname($wdir)); print_cell(); print_cell('left', '<a href="index.php?id=' . $id . '&pod=' . $podcast . '&wdir=' . $fileurl . '&choose=' . $choose . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="index.php?id=' . $id . '&pod=' . $podcast . '&wdir=' . $fileurl . '&choose=' . $choose . '">' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); } else { $count++; $filename = $fullpath . "/" . $dir; $fileurl = rawurlencode($wdir . "/" . $dir); $filesafe = rawurlencode($dir); $filesize = display_size(get_directory_size("{$fullpath}/{$dir}")); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); print_cell("left", "<a href=\"index.php?id={$id}&pod={$podcast}&wdir={$fileurl}&choose={$choose}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id={$id}&pod={$podcast}&wdir={$fileurl}&choose={$choose}\">" . htmlspecialchars($dir) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); print_cell("right", "<a href=\"index.php?id={$id}&pod={$podcast}&wdir={$wdir}&file={$filesafe}&action=rename&choose={$choose}\">{$strrename}</a>", 'commands'); } echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); foreach ($filelist as $file) { $icon = mimeinfo("icon", $file); $count++; $filename = $fullpath . "/" . $file; $fileurl = trim($wdir, "/") . "/{$file}"; $filesafe = rawurlencode($file); $fileurlsafe = rawurlencode($fileurl); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); $selectfile = trim($fileurl, "/"); echo "<tr class=\"file\">"; print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); echo "<td align=\"left\" nowrap=\"nowrap\" class=\"name\">"; if ($CFG->slasharguments) { $ffurl = str_replace('//', '/', "/file.php/{$id}/{$fileurl}"); } else { $ffurl = str_replace('//', '/', "/file.php?file=/{$id}/{$fileurl}"); } link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />", 480, 640); echo ' '; link_to_popup_window($ffurl, "display", htmlspecialchars($file), 480, 640); echo "</td>"; $file_size = filesize($filename); print_cell("right", display_size($file_size), 'size'); print_cell("right", $filedate, 'date'); if ($choose) { $edittext = "<strong><a onclick=\"return set_value('{$selectfile}')\" href=\"#\">{$strchoose}</a></strong> "; } else { $edittext = ''; } if ($icon == "text.gif" || $icon == "html.gif") { $edittext .= "<a href=\"index.php?id={$id}&pod={$podcast}&wdir={$wdir}&file={$fileurl}&action=edit&choose={$choose}\">{$stredit}</a>"; } else { if ($icon == "zip.gif") { $edittext .= "<a href=\"index.php?id={$id}&pod={$podcast}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strunzip}</a> "; $edittext .= "<a href=\"index.php?id={$id}&pod={$podcast}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strlist}</a> "; } } print_cell("right", "{$edittext} <a href=\"index.php?id={$id}&pod={$podcast}&wdir={$wdir}&file={$filesafe}&action=rename&choose={$choose}\">{$strrename}</a>", 'commands'); echo "</tr>"; } } echo "</table>"; echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">"; echo "<tr><td>"; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"pod\" value=\"{$podcast}\" />"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.dirform.submit()"); } echo "</form>"; echo "<td align=\"center\">"; if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"pod\" value=\"{$podcast}\" />"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />"; echo "</form>"; } echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"pod\" value=\"{$podcast}\" />"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"makedir\" />"; echo " <input type=\"submit\" value=\"{$strmakeafolder}\" />"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; //dummy form - alignment only echo " <input type=\"button\" value=\"{$strselectall}\" onclick=\"checkall();\" />"; echo " <input type=\"button\" value=\"{$strselectnone}\" onclick=\"uncheckall();\" />"; echo "</form>"; echo "</td>";
?> <table width="100%" border=1 cellpadding=10> <tr valign=top> <th>logno / edit</th> <th>date</th> <th>who</th> <th width="70%">details</th> </tr> <?php $r = mysql_query("select * from log where serno={$serno} order by logno limit {$offset},{$limit}"); while ($row = mysql_fetch_array($r)) { echo "<tr>\n"; print_cell("<a href=\"edlog.php?serno={$row['serno']}&logno={$row['logno']}\">{$row['logno']}</a>"); print_cell($row['date']); print_cell($row['who']); print_cell("<pre>" . urldecode($row['details']) . "</pre>"); echo "</tr>\n"; } mysql_free_result($r); ?> </table> <hr></hr> <p></p> <table width="100%"> <tr> <td align=center> <a href="newlog.php?serno=<?php echo "{$serno}"; ?> ">Add to Log</a> </td>
print_header("Heutige Aktivität"); print_cell("Brennerlaufzeit", $changes[SensorBetriebszeit]); print_cell("Brennerstarts", $changes[SensorBrennerstarts]); print_cell("Heizungs-Brennerlaufzeit", $changes[SensorHeizZeit]); print_cell("Warmwasserbereitungszeit", $changes[SensorWarmwasserbereitungsZeit]); print_cell("Warmwasserbereitungen", $changes[SensorWarmwasserBereitungen]); ?> </table> </td> <td width=20></td> <td width=390> <?php print_header("Betriebsstatus"); print_cell("Brennerlaufzeit", $sensors[SensorBetriebszeit]); print_cell("Brennerstarts", $sensors[SensorBrennerstarts]); print_cell("Systemdruck", $sensors[SensorSystemdruck]); print_cell("Servicecode", $sensors[SensorServiceCode]); print_cell("Fehlercode", $sensors[SensorFehlerCode]); # TODO: Fehler ?> </table> </td> </tr> </table> </td></tr> </table> </body> </html>
function displaydir($file_info) { global $CFG, $OUTPUT; $children = $file_info->get_children(); $parent_info = $file_info->get_parent(); $strname = get_string('name'); $strsize = get_string('size'); $strmodified = get_string('modified'); $strfolder = get_string('folder'); $strfile = get_string('file'); $strdownload = get_string('download'); $strdelete = get_string('delete'); $straction = get_string('action'); $path = array(); $params = $file_info->get_params_rawencoded(); $params = implode('&', $params); $path[] = $file_info->get_visible_name(); $level = $parent_info; while ($level) { $params = $level->get_params_rawencoded(); $params = implode('&', $params); $path[] = '<a href="index.php?' . $params . '">' . $level->get_visible_name() . '</a>'; $level = $level->get_parent(); } $path = array_reverse($path); $path = implode(' / ', $path); echo $path . ' /'; echo "<div>"; echo "<hr/>"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"740\" class=\"files\">"; echo "<tr>"; echo "<th class=\"header\" scope=\"col\"></th>"; echo "<th class=\"header name\" scope=\"col\">{$strname}</th>"; echo "<th class=\"header size\" scope=\"col\">{$strsize}</th>"; echo "<th class=\"header date\" scope=\"col\">{$strmodified}</th>"; echo "<th class=\"header commands\" scope=\"col\">{$straction}</th>"; echo "</tr>\n"; $parentwritable = $file_info->is_writable(); if ($parent_info) { $params = $parent_info->get_params_rawencoded(); $params = implode('&', $params); echo "<tr class=\"folder\">"; print_cell(); print_cell('left', '<a href="index.php?' . $params . '"><img src="' . $OUTPUT->old_icon_url('f/parent') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); echo "</tr>"; } if ($children) { foreach ($children as $child_info) { $filename = $child_info->get_visible_name(); $filesize = $child_info->get_filesize(); $filesize = $filesize ? display_size($filesize) : ''; $filedate = $child_info->get_timemodified(); $filedate = $filedate ? userdate($filedate) : ''; $mimetype = $child_info->get_mimetype(); $params = $child_info->get_params_rawencoded(); $params = implode('&', $params); if ($child_info->is_directory()) { echo "<tr class=\"folder\">"; print_cell(); print_cell("left", "<a href=\"index.php?{$params}\"><img src=\"" . $OUTPUT->old_icon_url('f/folder') . "\" class=\"icon\" alt=\"{$strfolder}\" /> " . s($filename) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); if ($parentwritable) { print_cell("right", "<a href=\"index.php?{$params}&sesskey=" . sesskey() . "&delete=1\"><img src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command'); } else { print_cell(); } echo "</tr>"; } else { if ($downloadurl = $child_info->get_url(true)) { $downloadurl = " <a href=\"{$downloadurl}\" title=\"" . get_string('downloadfile') . "\"><img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" class=\"iconsmall\" alt=\"{$strdownload}\" /></a>"; } else { $downloadurl = ''; } if ($viewurl = $child_info->get_url()) { $link = html_link::make($viewurl, "display", "<img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"{$strfile}\" /> "); $link->add_action(new popup_action('click', $link->url, 'display', array('height' => 480, 'width' => 640))); $viewurl = " " . $OUTPUT->link($link); } else { $viewurl = ''; } echo "<tr class=\"file\">"; print_cell(); print_cell("left", "<img src=\"" . $OUTPUT->old_icon_url(file_mimetype_icon($mimetype)) . "\" class=\"icon\" alt=\"{$strfile}\" /> " . s($filename) . $downloadurl . $viewurl, 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); if ($parentwritable) { print_cell("right", "<a href=\"index.php?{$params}&sesskey=" . sesskey() . "&delete=1\"><img src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command'); } else { print_cell(); } echo "</tr>"; } } } echo "</table>"; echo "</div>"; echo "<hr/>"; }
function displaydir($uuid, $wdir, $courseid = 0) { global $USER; global $CFG; global $basedir; global $id; global $oid; global $shared; global $userid; global $choose; global $repo; //global $uuid; global $canedit; global $category; $search = optional_param('search', '', PARAM_CLEAN); /// Get the context instance for where we originated viewing this browser from. if (!empty($oid)) { $cluster_context = get_context_instance(context_level_base::get_custom_context_level('cluster', 'block_curr_admin'), $oid); } if ($id == SITEID) { $context = get_context_instance(CONTEXT_SYSTEM, SITEID); } else { $context = get_context_instance(CONTEXT_COURSE, $id); } $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strbrowserepo = get_string('browserepository', 'repository'); $strdownloadlocal = get_string('downloadlocally', 'repository'); $dirlist = array(); $filelist = array(); $parentdir = new Object(); if (!empty($userid)) { $ustore = $repo->get_user_store($userid); } if (!empty($search)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($userid) && ($uuid == '' || $uuid == $ustore)) { if (empty($uuid)) { $uuid = $ustore; } $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($shared) && ($uuid == '' || $uuid == $repo->suuid)) { if (empty($uuid)) { $uuid = $repo->suuid; } $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($oid) && ($uuid == '' || $uuid == $repo->get_organization_store($oid))) { if (empty($uuid)) { $uuid = $repo->get_organization_store($oid); } $parentdir->title = ''; $parentdir->url = ''; } else { if ($id != SITEID && ($uuid == '' || !($parent = $repo->get_parent($uuid)) || ($uuid == '' || $uuid == $repo->get_course_store($id)))) { if (empty($uuid)) { $uuid = $repo->get_course_store($id); } $parentdir->title = ''; $parentdir->url = ''; } else { if ($id == SITEID && ($uuid == '' || !($parent = $repo->get_parent($uuid)))) { if (empty($uuid)) { $node = $repo->get_root(); $uuid = $node->uuid; } $parentdir->title = ''; $parentdir->url = ''; } else { $parentdir->uuid = $parent->uuid; $parentdir->name = $parent->title; $parentdir->title = '..'; } } } } } } $dirlist[] = $parentdir; $catselect = array(); if (!empty($search)) { if (($data = data_submitted()) && confirm_sesskey()) { if (!empty($data->categories)) { $catselect = $data->categories; } } else { if (!empty($category)) { $catselect = array($category); } } $search = stripslashes($search); $repodir = $repo->search($search, $catselect); } else { $repodir = $repo->read_dir($uuid); } // Store the UUID value that we are currently browsing. $repo->set_repository_location($uuid, $id, $userid, $shared, $oid); if (!empty($repodir->folders)) { foreach ($repodir->folders as $folder) { $dirlist[] = $folder; } } if (!empty($repodir->files)) { foreach ($repodir->files as $file) { $filelist[] = $file; } } echo '<form action="index.php" method="post" name="reposearch">'; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo '<center>'; echo '<input type="text" name="search" size="40" value="' . s($search) . '" /> '; echo '<input type="submit" value="' . get_string('search') . '" />'; helpbutton('search', get_string('alfrescosearch', 'repository_alfresco'), 'block_repository'); echo '</center><br />'; if ($cats = $repo->category_get_children(0)) { $baseurl = $CFG->wwwroot . '/file/repository/index.php?choose=' . $choose . '&id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $wdir . '&uuid=' . $uuid; $catfilter = repository_alfresco_get_category_filter(); $icon = 'folder.gif'; $eicon = 'folder-expanded.gif'; $menu = new HTML_TreeMenu(); $tnodes = array(); if ($cats = $repo->category_get_children(0)) { if ($nodes = repository_alfresco_make_category_select_tree_browse($cats, $catselect, $baseurl)) { for ($i = 0; $i < count($nodes); $i++) { $menu->addItem($nodes[$i]); } } } $treemenu = new HTML_TreeMenu_DHTML($menu, array('images' => $CFG->wwwroot . '/lib/HTML_TreeMenu-1.2.0/images')); // Add roll up - roll down code here, similar to Show Advanced in course/modedit // Advanced Search/Hide Advanced Search // "category filter" now has help text - so, how to add that too, but use yui library // for hiding this echo '<script language="JavaScript" type="text/javascript">'; echo "<!--\n"; include $CFG->libdir . '/HTML_TreeMenu-1.2.0/TreeMenu.js'; echo "\n// -->"; echo '</script>'; print_simple_box_start('center', '75%'); //looks for search.html file and gets text alfrescosearch from repository_alfresco lang file which I guess we use too... // now hmmm, so where does search.html go? or in our case, categoryfilter.html, I guess repository/alfresco print_heading(helpbutton('categoryfilter', get_string('alfrescocategoryfilter', 'block_repository'), 'block_repository', true, false, null, true) . get_string('categoryfilter', 'block_repository') . ':', 'center', '3'); $treemenu->printMenu(); echo '<br />'; print_simple_box_end(); } echo '</form>'; echo '<center>'; print_single_button('index.php', array('id' => $id, 'shared' => $shared, 'oid' => $oid, 'userid' => $userid, 'uuid' => $uuid), get_string('showall'), 'get'); echo '</center>'; if ($canedit) { echo "<form action=\"index.php\" method=\"post\" name=\"dirform\" id=\"dirform\">"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; } echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">"; echo "<tr>"; echo "<th width=\"5\"></th>"; echo "<th align=\"left\" class=\"header name\">{$strname}</th>"; echo "<th align=\"right\" class=\"header size\">{$strsize}</th>"; echo "<th align=\"right\" class=\"header date\">{$strmodified}</th>"; echo "<th align=\"right\" class=\"header commands\">{$straction}</th>"; echo "</tr>\n"; $count = 0; if (!empty($dirlist)) { foreach ($dirlist as $dir) { if (empty($dir->title)) { continue; } echo "<tr class=\"folder\">"; if ($dir->title == '..' || $dir->title == $strbrowserepo) { if (!empty($dir->url)) { print_cell(); if (!empty($search)) { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . $strbrowserepo . '" /></a> <a href="' . $dir->url . '">' . $strbrowserepo . '</a>', 'name'); } else { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="' . $dir->url . '">' . get_string('parentfolder') . '</a>', 'name'); } print_cell(); print_cell(); print_cell(); } else { $pdir = urlencode($dir->title); $fileurl = $dir->uuid; print_cell(); print_cell('left', '<a href="index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $pdir . '&uuid=' . $fileurl . '&choose=' . $choose . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $pdir . '&uuid=' . $fileurl . '&choose=' . $choose . '">' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); } } else { $count++; $filename = $dir->title; $pdir = urlencode($filename); $fileurl = $dir->uuid; $filesafe = rawurlencode($dir->title); $filesize = '-'; $filedate = !empty($dir->modified) ? userdate($dir->modified, "%d %b %Y, %I:%M %p") : '-'; if ($canedit) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); } else { print_cell(); } print_cell("left", "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\">" . htmlspecialchars($dir->title) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); print_cell('right', '-', 'commands'); } echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); echo ' <script language="javascript"> <!-- function openextpopup(url,name,options,fullscreen) { windowobj = window.open(url,name,options); if (fullscreen) { windowobj.moveTo(0,0); windowobj.resizeTo(screen.availWidth,screen.availHeight); } windowobj.focus(); return false; } // --> </script> '; foreach ($filelist as $file) { // $icon = $file->icon; $icon = mimeinfo('icon', $file->title); $count++; $filename = $file->title; $fileurl = $CFG->wwwroot . '/file/repository/alfresco/openfile.php?uuid=' . $file->uuid; $filesafe = rawurlencode($file->title); $fileurlsafe = rawurlencode($fileurl); $filedate = !empty($file->modified) ? userdate($file->modified, "%d %b %Y, %I:%M %p") : '-'; $filesize = ''; $selectfile = $fileurl; echo "<tr class=\"file\">"; if ($canedit) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$file->uuid}\" />", 'checkbox'); } else { print_cell(); } echo "<td align=\"left\" nowrap=\"nowrap\" class=\"name\">"; if ($CFG->slasharguments) { $ffurl = str_replace('//', '/', "/file.php/{$id}/{$fileurl}"); } else { $ffurl = str_replace('//', '/', "/file.php?file=/{$id}/{$fileurl}"); } $height = 480; $width = 640; $name = '_blank'; $url = $fileurl; $title = 'Popup window'; $linkname = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$file->title}\" />"; $options = 'menubar=0,location=0,scrollbars,resizable,width=' . $width . ',height=' . $height; if (!empty($search) && !empty($file->parent)) { $pdir = urlencode($file->parent->name); $fileurl = $file->parent->uuid; $motext = get_string('parentfolder', 'repository', $file->parent->name); echo "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\" title=\"{$motext}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> "; } echo '<a target="' . $name . '" title="' . $title . '" href="' . $url . '" ' . ">{$linkname}</a>"; echo ' '; $linkname = htmlspecialchars($file->title); echo '<a target="' . $name . '" title="' . $title . '" href="' . $url . '" ' . ">{$linkname}</a>"; echo "</td>"; print_cell("right", display_size(isset($file->filesize) ? $file->filesize : '-'), 'size'); print_cell("right", $filedate, 'date'); if ($choose) { $edittext = "<strong><a onclick=\"return set_value('{$selectfile}')\" href=\"#\">{$strchoose}</a></strong> "; } else { $edittext = ''; } if (strstr($icon, 'zip.gif') !== false) { $edittext .= "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&uuid={$file->uuid}&action=unzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strunzip}</a> "; $edittext .= "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&uuid={$file->uuid}&action=listzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strlist}</a> "; } /// User's cannot download files locally if they cannot access the local file storage. if (has_capability('moodle/course:managefiles', $context)) { $popupurl = '/files/index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&repouuid=' . $file->uuid . '&repofile=' . $filesafe . '&dd=1'; $edittext .= link_to_popup_window($popupurl, 'coursefiles', $strdownloadlocal, 500, 750, $strdownloadlocal, 'none', true); } print_cell('right', $edittext, 'commands'); echo "</tr>"; } } echo "</table>"; echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; /// Don't display the editing form buttons (yet). if (empty($search)) { echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">"; echo "<tr><td>"; if ($canedit) { echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; $options = array('move' => $strmovetoanotherfolder, 'delete' => $strdeletecompletely, 'zip' => $strcreateziparchive); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.dirform.submit()"); } } echo "</form>"; echo "<td align=\"center\">"; if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $uuid) { echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />"; echo "</form>"; } echo "</td>"; if ($canedit) { echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"makedir\" />"; echo " <input type=\"submit\" value=\"{$strmakeafolder}\" />"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; //dummy form - alignment only echo " <input type=\"button\" value=\"{$strselectall}\" onclick=\"checkall();\" />"; echo " <input type=\"button\" value=\"{$strselectnone}\" onclick=\"uncheckall();\" />"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />"; echo " <input type=\"submit\" value=\"{$struploadafile}\" />"; echo "</form>"; echo "</td>"; } echo '</tr>'; echo "</table>"; } else { $url = 'index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&uuid=' . $uuid; echo '<h3><a href="' . $url . '">' . get_string('returntofilelist', 'repository') . '</a></h3>'; } if ($canedit) { echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; } }