{extends file=$smarty.const.SMARTY_LAYOUT_MAIN_GENERAL_PAGINATED_LISTING}

{block name="engine-header" append}
	{$JS->load( "ModulesAbstract/FileExplorer/View/_js/fileExplorer.js")}
	{$CSS->load("ModulesAbstract/FileExplorer/View/_css/fileExplorer.css")}

	{$JS->loadGroup("filemanager")}
	{$CSS->loadGroup("filemanager")}
{/block}

{block name="listingFilters" append}
	<span id="fileExplorerNav"></span>
{/block}

{block name="css" append}
	{$thIndex = 3}
	<style>
		#pageContent tbody.list >tr:hover >td:nth-child({$thIndex}) {
			cursor: pointer;
			background-color:#C8DAF3;
		}
	</style>
{/block}

{block name="js" append}
	<script type="text/javascript">

		//Module langs
		if (!MVC.listing._LANG) {
			MVC.listing._LANG = { 'delete':{ } }
		}
		MVC.listing._LANG['delete']['deleteDirectory'] = '{$absLang.confirms["deleteDirectory"]}';
		MVC.listing._LANG['delete']['deleteFile']      = '{$absLang.confirms["deleteFile"]}';

		//Current Path
		MVC.listing.prototype.currentPath = '{$requestedPath}';

		//Filters
		filters = { 'path':MVC.listing.prototype.currentPath };
		{if $filters}
			{foreach $filters as $key=>$value}
				filters['{$key}'] = '{$value}';
			{/foreach}
		{/if}


		MVC.scheduleOnLoad(function(){
			//Refresh current listing after popup-close
			MVC.pageRefresh = function (module, action, windowName, execOutput){
				MVC.listing.installedHandlers['listing'].pagination.loadPage(0, { 'path':MVC.listing.installedHandlers.listing.currentPath });
			}
		});

		{if !CurrentUserAccess::getInstance()->hasAccessToOption({module}|cat:'-download')}
			// no permsission to download
			MVC.listing.prototype.downloadFile = function(element) {
				return false;
			}
		{/if}

	</script>
{/block}

{block name="content_listing_initialize" append}
	MVC.listing.installedHandlers.listing.displayPathNav();
	MVC.listing.installedHandlers.listing.pagination.reloadList = function(options){
		options['path'] = this.parent.currentPath;
		this.loadPage(0, options);
	}
{/block}