<?php

function smarty_function_eF_template_printMiniFM($params, &$smarty) {
	$params['defaultUri'] ? $query_string = $_SERVER['PHP_SELF'].$params['defaultUri'].'&' : $query_string = $_SERVER['PHP_SELF'].'?';
	
    $str = '
    <table style = "width:100%">
    	<tr><td colspan = "100%">
    			<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._UPLOADFILE.'\', new Array(\'350px\', \'100px\'), \'upload_file_table\')"><img src = "images/16x16/export1.png" title = "'._UPLOADFILE.'" alt = "'._UPLOADFILE.'" border = "0"/></a>
    			<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(\''._CREATEFOLDER.'\', new Array(\'350px\', \'100px\'), \'create_directory_table\')"><img src = "images/16x16/folder_add.png" title = "'._CREATEFOLDER.'" alt = "'._CREATEFOLDER.'" border = "0"/></a>
    			</td></tr>    	
        <tr class = "topTitle defaultRowHeight">
        	<td class = "topTitle"></td>
        	<td class = "topTitle">'._FILENAME.'</td>
        	<td class = "topTitle">'._DATE.'</td>
        	<td class = "topTitle">'._SIZE.'</td>
        	<td class = "topTitle">'._ACTION.'</td></tr>';
    if (isset($_GET['dir'])) {
    	$str .= '<tr class = "defaultRowHeight evenRowColor"><td><img src = "images/16x16/folder_up.png" alt = "'._UPONELEVEL.'" title = "'._UPONELEVEL.'"/></td><td><a href = "'.$query_string.($params['parentId'] ? 'dir='.$params['parentId'] : null).'">.. ('._UPONELEVEL.')</a></td><td></td></tr>';
    }
    if (sizeof($params['files']) == 0) {
		$str .= '<tr class = "defaultRowHeight oddRowColor"><td class = "emptyCategory centerAlign" colspan = "100%">'._NOFILESFOUND.'</td></tr>';    	
    } else {
	    foreach ($params['files'] as $file) {
	        if ($file['type'] == 'file') {
	            is_file(G_IMAGESPATH.'file_types/'.$file['extension']) ? $img_link = 'images/file_types/'.$file['extension'] : $img_link = 'images/file_types/unknown';
	        } else {
	            $img_link = 'images/file_types/folder'; 
	        }
	        $str .= '
	        <tr class = "'.(fmod($count++, 2) ? 'evenRowColor' : 'oddRowColor').'">
	        	<td><img src = "'.$img_link.'.png" title = "'.basename($img_link).'" alt = "'.basename($img_link).'" /></td>
	        	<td>'.($file['type'] == 'file' ? '<a href = "view_file.php?file='.$file['id'].'" target = "POPUP_FRAME" onclick = "eF_js_showDivPopup(\''.$file['original_name'].'\', new Array(\'500px\', \'400px\'))">' : '<a href = "'.$query_string.'dir='.$file['id'].'">').$file['original_name'].'</a></td>
	        	<td>#filter:timestamp_time-'.$file['timestamp'].'#</td>
	        	<td>'.$file['size'].' '._KB.'</td>
	        	<td>'.($file['type'] == 'file' ? '<a href = "downloadfile.php?file='.$file['id'].'"><img src = "images/16x16/import2.png" title = "'._DOWNLOAD.'" alt = "'._DOWNLOAD.'" border = "0"></a>' : '<img src = "images/16x16/import2.png" style = "visibility:hidden">').'&nbsp;<a href = "view_file.php?file='.$file['id'].'&action=delete&reload=true" target = "POPUP_FRAME" onclick = "return confirm(\''._IRREVERSIBLEACTIONAREYOUSURE.'\')"><img src = "images/16x16/delete.png" title = "'._DELETE.'" alt = "'._DELETE.'" border = "0"></a></td></tr>';		//image has visibility:hidden for proper alignment 
	    }
    }
    $str .= '
    </table>
    <div id = "upload_file_table" style = "display:none"> 
	    '.$params['uploadForm']['javascript'].'
    	<form '.$params['uploadForm']['attributes'].'>
    	'.$params['uploadForm']['hidden'].'
	    <table>
	    	<tr><td class = "labelCell">'._FILENAME.':</td>
	    		<td class = "elementCell">'.$params['uploadForm']['file_upload']['html'].'</td></tr>
	    	<tr><td></td><td class = "infoCell">'._EACHFILESIZEMUSTBESMALLERTHAN.': '.EfrontFileSystem :: getUploadMaxSize().' '._KB.'</td></tr>
	    	<tr><td colspan = "2">&nbsp;</td></tr>
	    	<tr><td></td><td>'.$params['uploadForm']['submit_upload_file']['html'].'</td></tr>
	    </table>
	    </form>
    </div>
    <div id = "create_directory_table" style = "display:none"> 
	    '.$params['createDirectoryForm']['javascript'].'
    	<form '.$params['createDirectoryForm']['attributes'].'>
    	'.$params['createDirectoryForm']['hidden'].'
	    <table>
	    	<tr><td class = "labelCell">'._FOLDERNAME.':</td>
	    		<td class = "elementCell">'.$params['createDirectoryForm']['directory_name']['html'].'</td></tr>
	    	<tr><td colspan = "2">&nbsp;</td></tr>
	    	<tr><td></td><td>'.$params['createDirectoryForm']['submit_create_directory']['html'].'</td></tr>
	    </table>
	    </form>
    </div>';

    return $str;
}


?>