/** * Show a list of images in a long horizontal table. * @author $Author: mschering $ * @version $Id: images.php,v 1.1 2006/03/23 10:01:26 mschering Exp $ * @package ImageManager */ require_once('config.inc.php'); require_once('Classes/ImageManager.php'); //default path is / $relative = '/'; $manager = new ImageManager($IMConfig); //process any file uploads $manager->processUploads(); $manager->deleteFiles(); $refreshDir = false; //process any directory functions if($manager->deleteDirs() || $manager->processNewDir()) $refreshDir = true; //check for any sub-directory request //check that the requested sub-directory exists //and valid if(isset($_REQUEST['dir'])) { $path = rawurldecode($_REQUEST['dir']); if($manager->validRelativePath($path)) $relative = $path; } $manager = new ImageManager($IMConfig); //get the list of files and directories $list = $manager->getFiles($relative); /* ================= OUTPUT/DRAW FUNCTIONS ======================= */ /** * Draw the files in an table. */ function drawFiles($list, &$manager) { global $relative; foreach($list as $entry => $file) { ?> }//foreach }//function drawFiles /** * Draw the directory. */ function drawDirs($list, &$manager) { global $relative; foreach($list as $path => $dir) { ?> } //foreach }//function drawDirs /** * No directories and no files. */ function drawNoResults() { ?> No Images Found } /** * No directories and no files. */ function drawErrorBase(&$manager) { ?> Invalid base directory: } ?> Image List /* if(window.top) I18N = window.top.I18N; function hideMessage() { var topDoc = window.top.document; var messages = topDoc.getElementById('messages'); if(messages) messages.style.display = "none"; } init = function() { hideMessage(); var topDoc = window.top.document; //we need to refesh the drop directory list //save the current dir, delete all select options //add the new list, re-select the saved dir. if($refreshDir) { $dirs = $manager->getDirs(); ?> var selection = topDoc.getElementById('dirPath'); var currentDir = selection.options[selection.selectedIndex].text; while(selection.length > 0) { selection.remove(0); } selection.options[selection.length] = new Option("/",""); selection.options[selection.length] = new Option("",""); for(var i = 0; i < selection.length; i++) { var thisDir = selection.options[i].text; if(thisDir == currentDir) { selection.selectedIndex = i; break; } } } function editImage(image) { var url = "editor.php?img="+image; Dialog(url, function(param) { if (!param) // user must have pressed Cancel return false; else { return true; } }, null); } /*]]>*/ elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?>