<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:text="#{nbscloud.files.index.title} + ${currentLocation}"/>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link th:if="${darkMode}" rel="stylesheet" th:href="@{/css/darkModeColors.css}"/>
    <link th:if="${!darkMode}" rel="stylesheet" th:href="@{/css/lightModeColors.css}"/>
    <link rel="stylesheet" th:href="@{/css/main.css}"/>
    <link rel="stylesheet" th:href="@{/css/files_main.css}"/>
    <link rel="shortcut icon" th:href="@{/favicon.ico}"/>
</head>
<body>
<div id="main-container">
    <div th:replace="includes/header :: header"/>
    <div class="messageContainer" th:each="shareInfo : ${shareInfo}">
        <div th:if="${!shareInfo.isEmpty()}" class="shareMessage message">
            <span th:text="#{'nbscloud.files.share-message'}"/>
            <a th:href="@{${shareInfo}}" th:text="${shareInfo}"/>
        </div>
    </div>
    <div class="messageContainer" th:each="error : ${errors}">
        <div th:if="${!errors.isEmpty()}" class="errorMessage message">
            <span th:text="${error}"/>
        </div>
    </div>
    <div class="messageContainer" th:each="infoMessage : ${infoMessages}">
        <div th:if="${!infoMessages.isEmpty()}" class="infoMessage message">
            <span th:text="#{${infoMessage}}"/>
        </div>
    </div>
    <div th:replace="files/includes/menu :: menu"/>
    <div id="content-container">
        <table id="files-content-table">
            <tr>
                <th id="type-column" class="no-mobile"/>
                <th id="name-column">
                    <a nowrap th:if="${sortOrder != T(de.nbscloud.files.FileSystemService.SortOrder).NATURAL}"
                       th:href="@{''(sortOrder=NATURAL)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.filename}"/>
                    <a nowrap th:if="${sortOrder == T(de.nbscloud.files.FileSystemService.SortOrder).NATURAL}"
                       th:href="@{''(sortOrder=NATURAL_REVERSE)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.filename}"/>
                </th>
                <th id="size-column" class="no-mobile">
                    <a nowrap th:if="${sortOrder != T(de.nbscloud.files.FileSystemService.SortOrder).SIZE_DESC}"
                       th:href="@{''(sortOrder=SIZE_DESC)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.size}"/>
                    <a nowrap th:if="${sortOrder == T(de.nbscloud.files.FileSystemService.SortOrder).SIZE_DESC}"
                       th:href="@{''(sortOrder=SIZE_ASC)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.size}"/>
                </th>
                <th id="lastmod-column" class="no-mobile">
                    <a nowrap th:if="${sortOrder != T(de.nbscloud.files.FileSystemService.SortOrder).LAST_MOD_DESC}"
                       th:href="@{''(sortOrder=LAST_MOD_DESC)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.lastmodified}"/>
                    <a nowrap th:if="${sortOrder == T(de.nbscloud.files.FileSystemService.SortOrder).LAST_MOD_DESC}"
                       th:href="@{''(sortOrder=LAST_MOD_ASC)}"
                       th:text="#{nbscloud.files.files-content-table.table-header.lastmodified}"/>
                </th>
                <th nowrap id="actions-column" th:text="#{nbscloud.files.files-content-table.table-header.actions}"/>
            </tr>
            <tr th:each="fileEntry : ${content}">
                <td th:if="${fileEntry.directory}" class="no-mobile">d</td>
                <td th:if="${!fileEntry.directory}" class="no-mobile">-</td>
                <td th:if="${fileEntry.directory}">
                    <a th:if="${fileEntry.name != '..'}" th:href="@{/files/browse/} + ${fileEntry.path}"
                       th:text="${fileEntry.name}"/>
                    <a th:if="${fileEntry.name == '..'}" th:href="@{/files/browse/} + ${fileEntry.path}"
                       th:text="${fileEntry.name}"/>
                </td>
                <td th:if="${!fileEntry.directory && @filesFormatter.needsTruncate(fileEntry.name)}"
                    th:text="${@filesFormatter.truncateFilename(fileEntry.name)}"
                    th:title="${fileEntry.name}"/>
                <td th:if="${!fileEntry.directory && !@filesFormatter.needsTruncate(fileEntry.name)}"
                    th:text="${fileEntry.name}"/>
                <td nowrap th:text="${@filesFormatter.formatSize(fileEntry.size)}"
                    class="files-table-padded-col files-table-text-align-right no-mobile"/>
                <td nowrap th:text="${#temporals.format(fileEntry.lastModified, 'SHORT')}"
                    class="files-table-padded-col files-table-text-align-right no-mobile"/>
                <td nowrap>
                    <details th:if="${fileEntry.name != '..'}" class="files-table-text-align-right">
                        <summary th:text="#{nbscloud.show-actions}"/>
                        <div id="files-content-table-show-actions-detail-container">
                            <div id="files-content-table-show-actions-detail-container-rename">
                                <a th:href="@{/files/rename(filename=${fileEntry.name})}"
                                   th:text="#{nbscloud.files-content-table.table.actions.rename}"/>
                            </div>
                            <div id="files-content-table-show-actions-detail-container-delete">
                                <a th:href="@{/files/delete(filename=${fileEntry.name})}"
                                   th:text="#{nbscloud.files-content-table.table.actions.delete}"/>
                            </div>
                            <div th:if="${!fileEntry.directory}"
                                 id="files-content-table-show-actions-detail-container-download">
                                <a th:href="@{/files/download(filename=${fileEntry.name})}"
                                   th:text="#{nbscloud.files-content-table.table.actions.download}"/>
                            </div>
                            <div th:if="${!fileEntry.directory}"
                                 id="files-content-table-show-actions-detail-container-preview">
                                <a th:href="@{/files/preview(filename=${fileEntry.name})}"
                                   th:text="#{nbscloud.files-content-table.table.actions.preview}"/>
                            </div>
                            <div th:if="${!fileEntry.directory}"
                                 id="files-content-table-show-actions-detail-container-share">
                                <a th:href="@{/files/share(filename=${fileEntry.name})}"
                                   th:text="#{nbscloud.files-content-table.table.actions.share}"/>
                            </div>
                        </div>
                    </details>
                    <div th:if="${fileEntry.name == '..'}"/>
                </td>
            </tr>
        </table>
    </div>
    <div th:replace="includes/footer :: footer"/>
</div>
</body>
</html>