<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
	xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
	xmlns:fl="http://typo3.org/ns/TYPO3/CMS/Filelist/ViewHelpers">
<f:layout name="Default"/>

<f:section name="headline">
	<h1><f:translate id="search">Search</f:translate>: "{searchWord}"</h1>
</f:section>

<f:section name="content">

	<f:render partial="SearchForm" arguments="{searchWord:searchWord}" />

	<f:if condition="{files->f:count()} > 0">
		<div class="table-fit">
			<table class="table table-striped table-hover" id="typo3-filelist">
				<thead>
				<tr data-uid="0" data-l10nparent="0">
					<th class="col-icon nowrap"></th>
					<th class="col-path nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_filepath' )}</th>
					<th class="col-title nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_file' )}</th>
					<th class="col-control"></th>
					<th class="nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_fileext' )}</th>
					<th class="nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_tstamp' )}</th>
					<th class="nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_size' )}</th>
					<th class="nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c_rw' )}</th>
					<th class="nowrap">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:c__REF_' )}</th>
				</tr>
				</thead>
				<tbody>
				<f:for each="{files}" as="file">
					<tr data-uid="0" data-l10nparent="0">
						<td class="col-icon nowrap">
							<fl:link.clickMenuOnIcon table="{file.identifier}">
								{file.icon->f:format.raw()}
							</fl:link.clickMenuOnIcon>
						</td>
						<td class="col-path nowrap">
							{file.path}
						</td>
						<td class="col-title col-responsive nowrap">
							<f:if condition="{file.isMetadataEditable}">
								<f:then>
									<a href="#" class="filelist-file-title"
										title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
										data-url="{fl:uri.editSysFileMetadataRecord( uid:file.metadataUid, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
									>
										{file.name}
									</a>
								</f:then>
								<f:else>
									{file.name}
								</f:else>
							</f:if>
							<f:if condition="{file.isImage}">
								<br>
								<f:image image="{file.resource}" maxWidth="64" maxHeight="43" />
							</f:if>
						</td>
						<td class="col-control nowrap">
							<div class="btn-group">
								<f:if condition="{file.isEditable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-edit"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.editcontent' )}"
											data-url="{fl:uri.editFileContent( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
										>
											<core:icon identifier="actions-page-open" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.IsMetadataEditable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-edit"
										   title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
										   data-url="{fl:uri.editSysFileMetadataRecord(uid:file.metadataUid, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
										>
											<core:icon identifier="actions-open" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.publicUrl}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-view"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.view' )}"
											data-url="{file.publicUrl}"
										>
											<core:icon identifier="actions-document-view" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isReplaceable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-replace"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.replace' )}"
											data-url="{fl:uri.replaceFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
										>
											<core:icon identifier="actions-edit-replace" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isRenamable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-rename"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.rename' )}"
											data-url="{fl:uri.renameFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:{ searchWord:\'{searchWord->f:format.htmlentities()}\' } ) -> f:format.raw()}' )}"
										>
											<core:icon identifier="actions-edit-rename" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>

								<f:if condition="{file.isReadable}">
									<f:then>
										<a href="#" class="btn btn-default filelist-file-info"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.info' )}"
											data-identifier="{file.identifier}"
										>
											<core:icon identifier="actions-document-info" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>
								<f:if condition="{file.isDeletable}">
									<f:then>
										<a href="#" class="btn btn-default t3js-filelist-delete"
											title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.delete' )}"
											data-identifier="{file.identifier}"
											data-title="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.delete' )}"
											data-content="{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.delete', arguments: {0:file.name} )}"
											data-check="{f:if(condition:settings.jsConfirmationDelete, then:'1', else:'0')}"
											data-delete-url="{deleteUrl}"
											data-delete-type="delete_file"
											data-redirect-url="{f:uri.action( action:'search', arguments:{ searchWord:'{searchWord->f:format.htmlentities()}' } )}"
										>
											<core:icon identifier="actions-edit-delete" />
										</a>
									</f:then>
									<f:else>
										<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
									</f:else>
								</f:if>
							</div>
						</td>
						<td class="nowrap">{file.extension}</td>
						<td class="nowrap">{file.lastModified}</td>
						<td class="nowrap">{file.size}</td>
						<td class="nowrap">
							<f:if condition="{file.isReadable}"><strong class="text-danger">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:read' )}</strong></f:if><f:if condition="{file.isWritable}"><strong class="text-danger">{f:translate( key:'LLL:EXT:lang/Resources/Private/Language/locallang_mod_file_list.xlf:write' )}</strong></f:if>
						</td>
						<td class="nowrap">
							<f:if condition="{file.referenceCount} > 0">
								<f:then>
									<a href="#" class="filelist-file-references" data-identifier="{file.identifier}" title="{f:translate( key:'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references' )} ({file.referenceCount})">{file.referenceCount}</a>
								</f:then>
								<f:else>
									-
								</f:else>
							</f:if>
						</td>
					</tr>
				</f:for>
				</tbody>
			</table>
		</div>
	</f:if>
</f:section>
</html>
