<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.'/'.$lang_id;?>",
				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->localization['galeria']).' : '.$gallery['name']; ?></h1>

<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>
<hr class="default"/>


<form action="/admin/show_gallery/<?php echo $idgalleries; ?>" method="post">
    Język: <?php echo form_dropdown('lang_id', $languages, $lang_id)?> <input type="submit" name="submit" value="<?php echo $this->localization['zatwierdz']; ?>"/>
</form>

<hr class="default"/>

<table id="data_table" class="data_table dragable" data-dragurl="/admin/rearrange_images">
    <thead>
        <tr>
            <th width="30">Id</th>
            <th>Miniaturka</th>
            <th>Nazwa</th>
            <th>Kolejność</th>
            <th width="400">Akcje</th>
        </tr>
    </thead>
    <tbody>
        <?php
        if(!empty($image_languages) && is_array($image_languages))
            foreach($image_languages as $k=>$image)
                {
                if($image['idlanguages'] != $lang_id || $image['idgalleries'] != $idgalleries)
                continue;
                    echo '<tr id="'.$image['idimages'].'">';
                        echo '<td>'.$image['idimages'].'</td>';
                        echo '<td><img src="/files/img/galleries/'.$image['idgalleries'].'/min/'.$image['path'].'" height="50" alt=""/></td>';
                        echo '<td>'.$image['name'].'</td>';
                        echo '<td>'.$image['showorder'].'</td>';
                        echo '<td><div style="position:relative;">';
                            echo '<div style="float:left;">'.form_open('admin/add_image_language/'.$image['idimages'].'/'.$image['idgalleries']).form_submit('submit', ucfirst($this->localization['dodaj_wersje_jezykowa'])).form_close().'</div>';
                            echo '<div style="float:left;">'.form_open('admin/edit_image_language/'.$image['idimages_languages'].'/'.$idgalleries.'/'.$image['idgalleries']).form_submit('submit', ucfirst($this->localization['edytuj'])).form_close().'</div>';
                            echo '<div style="float:left;">'.form_open('admin/change_image_priority/'.$image['idimages'].'/'.$idgalleries).form_input(array('name'=>'priority', 'size'=>'3', 'value'=>$image['showorder'])).form_submit('submit', ucfirst($this->localization['ustaw'].' '.$this->localization['kolejnosc'])).form_close().'</div>';
                            
                            ?>
                            <div style="float:left;width:100%;margin-bottom:2px;">
                                <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->localization['zmien']); ?>"/></td>
                                    </tr>
                                </table>
                                </form>
                            </div>
                            <?php
                                echo '<a href="/admin/delete_image_language/'.$image['idimages_languages'].'/'.$image['idimages'].'/'.$image['idgalleries'].'/'.$lang_id.'" class="form_button delete_link" style="position:absolute; top:0px; right:0px;">'.$this->localization['usun'].'</a>';
                        echo '</div></td>';
                    echo '</tr>';
        }
        ?>
    </tbody>
</table>
















