<?php	
	include('includes/db.php'); 

   
   	$id = trim($_GET['id']);
   
	switch ($_GET[mode]): 	
	
		case 'news':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `$_GET[mode]` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Aktualności</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php'>{$rrow[title]}</a>
			<span><a href='#'>Zmiana zdjęcia</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;
		
		case 'slider':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `$_GET[mode]` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Slider</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php'>{$rrow[title]}</a>
			<span><a href='#'>Zmiana zdjęcia</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;
		
		case 'pytania':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `$_GET[mode]` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Pytania</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php'>{$rrow[pytanie]}</a>
			<span><a href='#'>Zmiana zdjęcia</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers_poto.js'></script>";													
		break;
						
		case 'lang':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `$_GET[mode]` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Aktualności</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php'>{$rrow[title]}</a>
			<span><a href='#'>Zmiana zdjęcia</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;
		
		case 'pages_gallery':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `pages` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Artykuły</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id'>{$rrow[title]}</a>
			<span><a href='#'>Galeria</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers_poto.js'></script>";													
		break;	
		
		
		case 'pages':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `pages` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Artykuły</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id'>{$rrow[title]}</a>
			<span><a href='#'>TOP</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;	
		
		case 'pagesMenu':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `pages` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Artykuły</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id'>{$rrow[title]}</a>
			<span><a href='#'>Zdjęcie kategorii Menu</a></span> ";	
			$link="$basehttp/admin/modules/pages/pages.list.php?parent_id=$rrow[parent_id]";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;	
								
				
		case 'gallery':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `$_GET[mode]` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Galeria</a> 
			<a href='$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id'>{$rrow[title]}</a>
			<span><a href='#'>Zmień zdjęcie</a></span> ";	
			$link="$basehttp/admin/modules/$_GET[mode]/$_GET[mode].list.php?id=$id";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers.js'></script>";													
		break;	
			
		case 'images':
			$rrow = mysql_fetch_array(mysql_query("SELECT * FROM `gallery` WHERE `id`='$id'"));										
			$header="
			<a href='#'>Gallery</a> 
			<a href='$basehttp/admin/modules/gallery/gallery.children.php?id=$id'>{$rrow[title]}</a>
			<span><a href='#'>Galeria</a></span> ";	
			$link="$basehttp/admin/modules/gallery/gallery.children.php?id=$id";	
			$handlers="<script type='text/javascript' src='$basehttp/admin/js/swfupload/handlers_poto.js'></script>";													
		break;					
				
		
		
								
				
	default:
	$header="<a href=''>error</a>";
	
	
	endswitch;

?>


 <div id="right_column">
        <!-- RIGHT -->
        <div id="right_top">
        	<div id="right_home"></div>
            <div id="right_right">            
			<? echo $header; ?>                     
            </div>
        </div>
        
        
        
        <div id="right_bg">        
      	<h3>Dodaj zdjęcie</h3>
          
          
<div id="table">
<? if($id) { ?>
<link href="<? echo $basehttp; ?>/admin/js/swfupload/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<? echo $basehttp; ?>/admin/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="<? echo $basehttp; ?>/admin/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="<? echo $basehttp; ?>/admin/js/swfupload/fileprogress.js"></script>
<? echo $handlers; ?>

<script type="text/javascript">
		var swfu;

		window.onload = function() {
			var settings = {
				flash_url : "<? echo $basehttp; ?>/admin/js/swfupload/swfupload.swf",
				upload_url: "<? echo $basehttp; ?>/admin/upload.php",
				post_params: {"<?php echo $_REQUEST['mode']; ?>" : "<?php echo $_REQUEST['id']; ?>"},
				file_size_limit : "100 MB",
				file_types : "*.jpg;*.jpeg;*.gif;*.png;",	
				file_types_description : "Fotki",
				file_upload_limit : 0,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,
				upload_successful : true,

				// Button settings
				button_image_url: "<? echo $basehttp; ?>/admin/gfx/upload.png",
				button_width: "120",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
	
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
	     };
	</script>
  

<form id="form1" action="<? echo $link; ?>" name="formupload" method="post" enctype="multipart/form-data">
<div id="divStatus"></div>
<table width="100%" border="0">
  <tr>
    <td>    
    <div class="fieldset flash" id="fsUploadProgress">
	<span class="legend">Proces</span>    </div>      </td>
    </tr>
    
    
  <tr>
    <td style="padding-top:20px;">
    
    <span id="spanButtonPlaceHolder"></span>
    <input name="" id="btnCancel" type="image" onclick="swfu.cancelQueue();" disabled="disabled"  style="margin-left: 2px; font-size: 8pt; border:none;" src="<? echo $basehttp; ?>/admin/gfx/buttons/button_cancel.gif" />
     </td>
    </tr>
</table>
</form>	

    
<? } else { echo "błąd"; } ?>
          </div>
          <!-- table-->
        
        </div>
        
        <div id="right_bottom"></div>       
        <!-- RIGHT -->
    </div>
  



</div>
</div>
<? include($_SERVER['DOCUMENT_ROOT'].'/admin/templates/footer.php'); ?>
