Location: PHPKode > projects > Netautor Professional > netautor/napro4/appl/mediapool/mp_list.php
<?php
/* +----------------------------------------------------------------------+
   | Netautor Professional Application Server                             |
   +----------------------------------------------------------------------+
   | Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net>      |
   +----------------------------------------------------------------------+
   | This file is subject to license, that is bundled with this package   |
   | in the file LICENSE.TXT, and is available at through the             |
   | world-wide-web at http://www.netautor.com/license/                   |
   |                                                                      |
   | If you did not receive a copy of the license and are unable to       |
   | obtain it through the world-wide-web, please send a note to          |
   | hide@address.com so we can mail you a copy.                      |
   +----------------------------------------------------------------------+
   | Authors: Stefan Rottensteiner <hide@address.com>    |
   |          Marek  Kadziela      <hide@address.com>	      |
   |          Gregor Wollner                                              |
   |          Christian Unger                                             |
   |          Helli  Kleinhans  									      |
   +----------------------------------------------------------------------+*/

   /**
    * Listanzeige
	*
	* @version 	$Revision: 1.8 $
	* @author	Stefan Rottensteiner
	*/

	require_once('../../include/init.inc');

	if(!$USER->check_feature('Admin') && !$USER->check_feature('ac_mediapool'))
	{
		$USER->login_call();
	}

	$LOCALE->textdomain('mediapool');

	//	include necessary functions
	includeNaPro('file,filetype');

	$files_set_pos		= intval($_GET['files_set_pos']);
	$location_path		= strval($_GET['location_path']);
	$location_name		= strval($_GET['location_name']);
	$location_folder	= strval($_GET['location_folder']);
	$files_mask			= strval($_GET['files_mask']);

	if($fileAction == 'delete' && !empty($delete))
	{
		foreach($delete as $idx=>$fullFileName)
		{
			$fullFileName = substr($fullFileName,0,-1);
			unlink($fullFileName);
		}
	}


?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>/digiconcept/netautor/mediapool</title>
	<link href="../../include/netautor.css" rel="stylesheet" type="text/css" src="../include/netautor.css">
</head>
<script language="JavaScript" type="text/javascript">
<!--
	var checkedFilesToDelete=0;

	function mp_showFileDetail(locationName,locationPath,locationFolder,fileName)
	{
		var pp = parent.parent.document;
		parent.parent.document.getElementById('mp_detail').src="mp_detail.php?location_name="+escape(locationName)+"&location_path="+escape(locationPath)+"&location_folder="+escape(locationFolder)+"&file_name="+escape(fileName);
		pp.getElementById('f_mediapool').rows='130,40,0,*';
	}

	function mm_sendMedia(poolName,poolLink) {
		parent.parent.mm_sendMedia(poolName,poolLink);
	}

	function setDelete(myCheckbox)
	{
		if(myCheckbox.checked)
		{
			checkedFilesToDelete = checkedFilesToDelete + 1;
		}
		else
		{
			checkedFilesToDelete = checkedFilesToDelete - 1;
		}

		if(checkedFilesToDelete>0)
		{
           parent.frames['mp_bottom'].document.getElementById('buttonDelete').style.display='inline';
		}
		else
		{
           parent.frames['mp_bottom'].document.getElementById('buttonDelete').style.display='none';
		}
	}
//-->
</script>

<body class="imagepoollist">
<form id="mp_list_form" name="mp_list_form" method="post">
<input type="hidden" name="fileAction" value="" id="fileAction">

<table width="684" border="0" cellspacing="0" cellpadding="0">
		<?php
			$files_base		= $location_path.$location_folder.'/';

			$params			=	array	(	'match_file'	=> $files_mask,
											'only_files'	=> 1
										);
			$files			= File_readDirectory($files_base, 1 , $params  );

			$files_count	= count($files);

			$files_start	= $files_set_size * $files_set_pos;

			$files			=	array_slice($files, $files_start, $files_set_size );
		?>	
		<?php

		foreach ($files	as $index => $data)
		{
			$file_name	= $data['name'];
			$file_size		= $data['size'];

			$file_size_sign	= 'Bytes';

			if ($file_size > 1024 )
			{
				$file_size = $file_size / 1024;
				$file_size_sign = 'Kb';
			}

			if ($file_size > 1024 )
			{
				$file_size = $file_size / 1024;
				$file_size_sign = 'Mb';
			}

			$file_date	= date('d.m.Y, H:i',$data['creation']);
			$mime_info = array();
			ext2mime($file_name, $mime_info );

			/* Maximale Breite und Höhe für das Thumbnail */
			$max_img_width	= 50;
			$max_img_height	= 50;

			/* Trick mit GetImageSize */
			$size  = GetImageSize($data['url'].$data['name']);
			$asp_x = (float)$size[0]/(float)$max_img_width;
			$asp_y = (float)$size[1]/(float)$max_img_height;

			if($size[0] > $max_img_width || $size[1] > $max_img_height)
			{
				if($asp_x>$asp_y)
				{
					$formstring=" width='$max_img_width' ";
				}
				else
				{
					$formstring=" height='$max_img_height' ";
				}
			}
			else
			{
					$formstring=" width='".$size[0]."'  height='".$size[1]."' ";
			}

			if ($size[0]>0)
			{	/* Thumbnail eines Bildes */
				$wrapper_file_name = $data['url'].$data['name'];
				$titlestring		= " {$size[0]}x{$size[1]}";
			}
			else
			{	/* Dummybild für alles andere */
				$wrapper_file_name = '../grafik/unknown.gif';
				$titlestring		= "";
			}

		?>
			<tr height="60">
				<td width="24" height="60" align="center" valign="center" class="imgpooltd22">
					<input type="checkbox" name="delete[]" value="<?php echo($data['url'].$data['name']); ?>'" onclick="setDelete(this)"><br>
					<img src="../../grafik/pixel.gif" width="24" height="1"><br>
				</td>
				<td width="78" height="60" align="center" valign="center" class="imgpooltd21">
					<a href="#" title="Mime-Type : <?php echo $mime_info['mimetype'];?> [<?php echo $mime_info['description'];?>] <?php echo $titlestring; ?>" onClick="mp_showFileDetail('<?php echo $location_name;?>','<?php echo $location_path;?>','<?php echo $location_folder;?>','<?php echo $file_name;?>')"><img <?php echo $formstring; ?> src="<?php echo $GLOBALS['DC_ENV']->indexpath; ?>/wrapper/jpegs.php?filename=<?php echo rawurlencode($wrapper_file_name);?>" class="imgpoolimg"></a><br>
				</td>
				<td width="313" height="60" align="left" valign="center" class="imgpooltd22">
					<span class="text">
					<img src="../../grafik/pixel.gif" width="12" height="1"><a href="#" onClick="mm_sendMedia('<?php echo $location_name; ?>','<?php echo preg_replace('/\\/+/i','/','/'.$location_folder.'/'.$file_name);?>')" class="link"><?php echo htmlspecialchars($file_name);?></a><br>
					</span>
					<img src="../../grafik/pixel.gif" width="313" height="1"><br>
				</td>
				<td width="84" height="60" align="right" valign="center" class="imgpooltd21">
					<span class="text">
					<?php echo ($file_size_sign=='Bytes' ? $file_size : number_format($file_size,2) );?> <?php echo $file_size_sign;?><img src="../../grafik/pixel.gif" width="12" height="1"><br>
					</span>
					<img src="../../grafik/pixel.gif" width="84" height="1"><br>
				</td>
				<td width="52" height="60" align="center" valign="center" class="imgpooltd22">
					<span class="text">
					<?php echo strtoupper( substr($file_name,strrpos($file_name,'.') + 1) ); ?><br>
					</span>
					<img src="../../grafik/pixel.gif" width="52" height="1"><br>
				</td>

				<td width="133" height="60" align="left" valign="center" class="imgpooltd21">
					<span class="text">
					<img src="../../grafik/pixel.gif" width="12" height="1"><?php echo $file_date;?><br>
					</span>
					<img src="../../grafik/pixel.gif" width="133" height="1"><br>
				</td>
			</tr>
		<?php
		}

		?>
</table>
</form>

</body>

</html>
Return current item: Netautor Professional