<?php //$this->addCss('style', 1) ?>
<?php //$this->addJsLib('jquery-ui') ?>
<?php //$this->addJs('main', 1) ?>
<?php //$this->addJs('lang', 2) ?>
<script type="text/javascript">

    var create_dir = "<?php echo $lang['create_dir_title'] ?>";
    var rename_file = "<?php echo $lang['rename'] ?>";
    var input_attr = "<?php echo addslashes($lang['input_attr']) ?>";
    var input_name = "<?php echo $lang['input_name'] ?>";
    var input_zip = "<?php echo $lang['input_zip'] ?>";
    var owner_rights = "<?php echo $lang['owner_rights'] ?>";
    var group_rights = "<?php echo $lang['group_rights'] ?>";
    var public_rights = "<?php echo $lang['public_rights'] ?>";
    var reading = "<?php echo $lang['reading'] ?>";
    var writing = "<?php echo $lang['writing'] ?>";
    var execution = "<?php echo $lang['execution'] ?>";
                                            
    lang = <?php echo json_encode($lang) ?>;

    top_offset = <?php echo $top_offset ?>;
    fileadmin_act_link = '<?php echo addslashes($refresh_link) ?>'; 
</script>
<?php echo (!empty($teaser)) ? $teaser : '' ?>
<?php echo (!empty($errors)) ? $errors : '' ?>
<table id="MainTable" border="0" name="MainTable" cellspacing="0" cellpadding="0" align="center" width="100%">
    <tr>
        <td colspan="2" valign="top">
	    <table width="100%" cellspacing="0" cellpadding="0" class="fileadmin-paneltable">
	        <td>
	            <?php if (!empty($mainmenu)): ?>
	            <table class="fileadmin-main" cellspacing="0" cellpadding="0">
	                <tr><td>
	                    <?php foreach ($mainmenu as $item): ?>
	                    <div class="fileadmin-div-mainmenu">
            			    <a class="fileadmin-menu" id="<?php echo $item['name'] ?>" title="<?php echo htmlspecialchars($item['title']) ?>"
            			    href="<?php echo htmlspecialchars($item['href']) ?>"><img class="fileadmin-img"
            				src="<?php echo $view['assets']->getUrl('images/fileadmin/'.$item['img']) ?>" alt="<?php echo htmlspecialchars($item['name']) ?>"><?php echo $item['name'] ?></a>
            			</div>
            			<?php endforeach; ?>
	                </td></tr>
	            </table>
	            <hr class="fileadmin-hr"/>
	            <?php endif; ?>
	            <?php if (!empty($dirhistory)): ?>
	            <?php
	            for ($i=0; isset($dirhistory[$i]); $i++) {
	            	if ($i == 0) {
                        echo '<a class="fileadmin-link" href="'.htmlspecialchars($dirhistory[$i]['link']).'">&lt;'.$lang['root'].'&gt;</a> /'."\n";
	            	} else {
                        echo '<a class="fileadmin-link" href="'.htmlspecialchars($dirhistory[$i]['link']).'">'.htmlspecialchars($dirhistory[$i]['name']).'</a> /'."\n";
	            	}
	            }
	            ?>
	            <?php endif; ?>
	            <hr class="fileadmin-hr"/>
	            <form method="Post" name="FilesForm" class="fileadmin-form" action="<?php echo htmlspecialchars($action) ?>">
	                <table class="fileadmin-main" width="100%">
	                    <tr valign="top"><td>
	                        <?php if (!empty($filelist)): ?>
	                        <table class="fileadmin-main" width="100%">
			            <tr>
			            <?php foreach ($columns as $column): ?>
        	            	<td><a class="fileadmin-link" href="javascript:fileadmin_sort_files('<?php echo $column['sort'] ?>')"><b><?php echo $column['title'] ?></b></a></td>
        	            <?php endforeach; ?>
					<td></td>
				    </tr>
				    <?php foreach ($filelist as $file): ?>
				    <tr class="<?php echo $file['class'] ?> fileadmin-main-row">
				      <td class="fileadmin-main-name"> <input id="file_<?php echo $file['id'] ?>" type="checkbox" filename="<?php echo htmlspecialchars($file['name']) ?>" attributes="<?php echo htmlspecialchars($file['attr']) ?>" <?php echo $file['check'] ?> />
				        <input name="fileadmin_name_<?php echo $file['id'] ?>"
    				        id="fileadmin_name_<?php echo $file['id'] ?>"
    				        type="hidden"
    				        value="<?php echo htmlspecialchars($file['name']) ?>" />
				      <?php if ($file['item'] == 'sub'): ?>
				        <a class="fileadmin-link" href="<?php echo htmlspecialchars($file['link']) ?>"><img class="fileadmin-img"
						src="<?php echo $view['assets']->getUrl('images/fileadmin/filetypes/dir.gif') ?>" /><?php echo htmlspecialchars($file['name']) ?></a>
					  </td>
				      <td class="fileadmin-tdfont">---</td>
				      <td class="fileadmin-tdfont fileadmin-main-size"><?php echo $file['size'] ?></td>
					  <td class="fileadmin-tdfont">---</td>
				      <?php endif; ?>
				      <?php if ($file['item'] == 'link'): ?>
				        <a class="fileadmin-link" href="<?php echo htmlspecialchars($file['link']) ?>" target="_blank"><img class="fileadmin-img"
						src="<?php echo $view['assets']->getUrl('images/fileadmin/filetypes/symlink.gif') ?>" /><?php echo htmlspecialchars($file['name']) ?></a>
					  </td>
				      <td class="fileadmin-tdfont">---</td>
				      <td class="fileadmin-tdfont fileadmin-main-size"><?php echo $file['size'] ?></td>
					  <td class="fileadmin-tdfont">---</td>
				      <?php endif; ?>
				      <?php if ($file['item'] == 'file'): ?>
				        <a class="fileadmin-link" <?php echo $file['a_attributes'] ?>><img class="fileadmin-img"
						src="<?php echo $view['assets']->getUrl('images/fileadmin/filetypes') ?>/<?php echo $file['type'] ?>.gif" /><?php echo htmlspecialchars($file['name']) ?></a>
					  </td>
				      <td class="fileadmin-tdfont fileadmin-main-ext"><?php echo $file['ext'] ?></td>
				      <td class="fileadmin-tdfont fileadmin-main-size"><?php echo $file['size'] ?></td>
					  <td class="fileadmin-tdfont fileadmin-main-time"><?php echo $file['time'] ?></td>
				      <?php endif; ?>
				      <td id="attr_<?php echo $file['id'] ?>" class="fileadmin-tdfont fileadmin-main-attr"><?php echo $file['attr'] ?></td>
				      <td nowrap="nowrap" class="fileadmin-main-actions">
                          <?php foreach ($file['actions'] as $a): ?>
                          <a title="<?php echo $a['title'] ?>" href="<?php echo htmlspecialchars($a['link']) ?>"><img
					    	class="fileadmin-img" alt="<?php echo htmlspecialchars($a['alt']) ?>"
						    src="<?php echo htmlspecialchars($view['assets']->getUrl('images/fileadmin').'/'.$a['img']) ?>" /></a>&nbsp;
                          <?php endforeach; ?>
				      </td>
				    </tr>
				    <?php endforeach; ?>
				    	</table>
				    	<?php endif; ?>
	                    </td></tr>
	                    <tr><td>
	                    <?php if (!empty($filelist)): ?>
	                    <a class="fileadmin-link" href="javascript:fileadmin_check_all()"><?php echo $lang['select_all'] ?></a>&nbsp;&nbsp;/&nbsp;
	                    <a class="fileadmin-link" href="javascript:fileadmin_uncheck_all()"><?php echo $lang['deselect'] ?></a>&nbsp;&nbsp;/&nbsp;
	                    <a class="fileadmin-link" href="javascript:fileadmin_swap_check_all()"><?php echo $lang['invert_selection'] ?></a>
	                    <?php endif; ?>
	                    <span class="fileadmin-main"><?php echo $buffer ?></span>
	                    </td>
	                    </tr>
			    <tr><td colspan="2" valign="top" class="fileadmin-version"><a href="<?php echo htmlspecialchars($refresh_link) ?>" id="PanelRefresh"><?php echo $lang['refresh'] ?></a>
			    </td></tr>
	                </table>
	                <input name="fcount" type="hidden" value="<?php echo htmlspecialchars($files_count) ?>" />
	            </form>
	            <form name="MainForm" action="<?php echo htmlspecialchars($action); ?>" method="post" class="fileadmin-form">
	                <input name="str" type="hidden" value="" />
	                <input name="act" type="hidden" value="" />
	                <input name="curdir" type="hidden" value="<?php echo htmlspecialchars($current_dir) ?>" />
	                <input name="post_files" type="hidden" value="" />
	            </form>
	        </td></tr>
	    </table>
	    <div id="fileadmin_form">
            <form action="" method="Post">
            </form>
        </div>
	</td>
    </tr>
    <tr><td height="100%"></td></tr>
</table>
<div id="fileadmin-dialog-rename" title="<?php echo htmlspecialchars($lang['rename']) ?>" style="display: none;">
    <input name="rename_filename" value="" style="width: 300px;" />
</div>
<div id="fileadmin-dialog-create-dir" title="<?php echo htmlspecialchars($lang['create_dir_title']) ?>" style="display: none;">
    <input name="create_dir" value="" style="width: 300px;" />
</div>
<div id="fileadmin-dialog-change-attributes" title="<?php echo htmlspecialchars($lang['attr_change']) ?>" style="display: none;">
</div>
<div id="fileadmin-dialog-change-attributes-recursive" title="<?php echo htmlspecialchars($lang['attr_change_rec']) ?>" style="display: none;">
</div>
<div id="fileadmin-dialog-zip" title="<?php echo htmlspecialchars($lang['zip_title']) ?>" style="display: none;">
    <input name="zip" value="" style="width: 300px;" /> 
</div>
<?php if (!empty($rewrite)): ?>
<script language="javascript" type="text/javascript">
    document.MainForm.str.value = window.confirm('<?php echo addslashes($lang['do_rewrite']) ?>') ? "Yes" : "No";
    applyForm(4);
</script>
<?php endif; ?>
<div id="dialog" title="<?php echo htmlspecialchars($lang['create_dir_title']) ?>" style="display: none; height: 40px;">
	<input name="dir" value="" size="20" />
</div>