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

		window.onload = function() {
			var settings = {
				flash_url : "/files/swfupload/swfupload/swfupload.swf",
				flash9_url : "/files/swfupload/swfupload/swfupload_fp9.swf",
				upload_url: "<?php echo '/admin/add_multiimage/'.$idgalleries.'/'.$idlang;?>",
				post_params: {"PHPSESSID" : "<?php echo $this->session->userdata('session_id'); ?>"},
				file_size_limit : "100 MB",
				file_types : "*.*",
				file_types_description : "All Files",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				// Button settings
				button_image_url: "/files/swfupload/images/TestImageNoText.png",
				button_width: "150",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span class="theFont">Dodaj</span>',
				button_text_style: ".theFont { font-size: 16; }",
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				
				// The event handler functions are defined in handlers.js
				swfupload_preload_handler : preLoad,
				swfupload_load_failed_handler : loadFailed,
				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>
<h1><?= ucfirst($this->site['galeria']);?></h1>
<?php 
	//echo form_open('admin/add_image/'.$idgalleries.'/'.$idlang).form_submit('submit', ucfirst($this->site['dodaj'])).form_close().'<br/>'; 
?>

<form id="form1" action="index.php" method="post" enctype="multipart/form-data">
			<div class="fieldset flash" id="fsUploadProgress">
			<span class="legend">Kolejka wysyłania</span>
			</div>
		<div id="divStatus"></div>
			<div>
				<table>
					<tr>
						<td><span id="spanButtonPlaceHolder"></span></td>
						<td><input id="btnCancel" type="button" value="Anuluj" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" /></td>
					</tr>
				</table>
			</div>

	</form>
	
	
	</form>
<table><tr><td>
	
<?php
	foreach($images as $image){
		echo '<table><tr><td width="250"><img src="/files/img/galleries/'.$image['idgalleries'].'/min/'.$image['path'].'" alt=""/><br/>'.$image['path'].'<br/><br/></td><td><table><tr>';
		echo '<td>'.form_open('admin/add_image_language/'.$image['idimages'].'/'.$image['idgalleries']).form_submit('submit', ucfirst($this->site['dodaj_pozycje'])).form_close().'</td><td>'.form_open('admin/change_image_priority/'.$image['idimages'].'/'.$idgalleries).form_input(array('name'=>'priority', 'size'=>'3', 'value'=>$image['showorder'])).form_submit('submit', ucfirst($this->site['ustaw'].' '.$this->site['kolejnosc'])).form_close().'</td></tr></table>';
		$have_versions = 0;
		foreach($image_languages as $image_language){	
			if($image_language['idimages']==$image['idimages']){
				$have_versions = 1;
				break;
			} 
		}
		if($have_versions){
				echo '<table class="data_table"><tr class="admin_table_header"><td>';
				echo ucfirst($this->site['wyswietlana_nazwa']);
				echo '</td><td>';	
				echo ucfirst($this->site['jezyk']);
				echo '</td></tr>';
				foreach($image_languages as $image_language){	
					if($image_language['idimages']==$image['idimages']){
						echo '<tr class="data_row"><td><b>';
							echo $image_language['title'];
						echo '</b></td><td>';	
							echo $image_language['fullname'];
						echo '</td><td>';	
							echo form_open('admin/edit_image_language/'.$image_language['idimages_languages'].'/'.$idgalleries.'/'.$image_language['idgalleries']).form_submit('submit', ucfirst($this->site['edytuj'])).form_close();
						echo '</td><td>';	
							echo '<input type="button" value="'.ucfirst($this->site['usun']).'" onClick="if(window.confirm(\''.ucfirst($this->site['czy_napewno_usunac']).'\')){window.location=\'/admin/delete_image_language/'.$image_language['idimages_languages'].'/'.$image_language['idimages'].'/'.$image_language['idgalleries'].'/'.$idlang.'\';}">';
						echo '</td></tr>';	
					}
				}
				echo '<tr><td colspan="4">';
?>
                    <form action="/admin/edit_gallery_min_image" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="idimages" value="<?php echo $image['idimages']; ?>"/>
                    <input type="hidden" name="return_url" value="<?php echo current_url(); ?>"/>
                    <table>
                        <tr>
                            <td>Miniaturka</td>
                            <td><input type="file" name="min_image"/>&nbsp;<input type="submit" name="edit_gallery_min_image" value="<?php echo ucfirst($this->site['zmien']); ?>"/></td>
                        </tr>
                    </table>
                    </form>            
<?php            
                echo '</td></tr>';
                echo '</table>';
			}
			echo '</td></tr></table>';
	}	
?>
</td></tr></table>

