<#assign editableSubfix=['css','js','html','shtml','htm','xml','txt']/>
<div class="pageHeader">
    <form class="pagerForm" autocomplete="off" onsubmit="return navTabSearch(this);" method="post">
        <input type="hidden" name="orderField" value="${orderField!}" />
        <div class="searchBar">
            <ul class="searchContent">
                <li>
                    <label><@t.page 'path'/>:</label>
                    <label>${path?has_content?then(path+'/','/')}</label>
                </li>
            </ul>
        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a href="cmsWebFile/content.html?path=${(path?url)!}" target="navTab" rel="cmsWebFile/content"><i class="icon-plus-sign-alt icon-large"></i> <@t.page 'button.create_file'/></a></li>
            <li><a href="cmsWebFile/directory.html?path=${(path?url)!}" target="dialog" mask="true" width="500" height="200"><i class="icon-folder-close-alt icon-large"></i> <@t.page 'button.create_directory'/></a></li>
            <li><a href="cmsWebFile/upload.html?path=${(path?url)!}" target="dialog" mask="true" width="500" height="200"><i class="icon-upload icon-large"></i> <@t.page 'button.upload_file'/></a></li>
            <li><a href="cmsWebFile/zip?path=${path?has_content?then(path+'/','/')}&_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.compress_directory'/>" target="ajaxTodo"><i class="icon-upload icon-large"></i> <@t.page 'button.compress_current_directory'/></a></li>
            <li><a href="cmsWebFile/delete?_csrf=<@_csrfToken admin=true/>" title="<@t.page 'confirm.batch_delete_file'/>" target="selectedTodo" rel="paths"><i class="icon-trash icon-large"></i> <@t.page 'button.batch_delete'/></a></li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH>
        <thead>
            <tr>
                <th width="20"><input type="checkbox" group="paths" class="checkboxCtrl"></th>
                <th width="30"></th>
                <th orderField="fileName" class="<#if !orderField??||'fileName'==orderField>asc<#else>order</#if>"><@t.page 'name'/></th>
                <th orderField="modifiedDate" class="<#if orderField??&&'modifiedDate'==orderField>desc<#else>order</#if>"><@t.page 'modified_date'/></th>
                <th orderField="createDate" class="<#if orderField??&&'createDate'==orderField>desc<#else>order</#if>"><@t.page 'create_date'/></th>
                <th orderField="fileSize" class="<#if orderField??&&'fileSize'==orderField>desc<#else>order</#if>"><@t.page 'file.size'/></th>
                <th><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
    <@_webFileList path=path orderField=orderField>
        <#if path?has_content>
            <tr>
                <td></td>
                <td class="tree"><div class="folder_expandable"></div></td>
                <td>
                    <a href="cmsWebFile/list.html?path=${path?keep_before_last('/')}" target="navTab" rel="cmsWebFile/list" title="<@t.page 'button.return'/>">
                        <@t.page 'button.return'/>
                    </a>
                </td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
        </#if>
        <#list list as a>
            <#assign filePath=path?has_content?then(path+'/','/')+a.fileName/>
            <tr>
                <td><input name="paths" value="${filePath}" type="checkbox"></td>
                <td class="tree"><div class="${a.directory?then('folder_expandable','file')}" style="width:30px;"></div></td>
                <td>
                    <#if a.directory>
                        <a href="cmsWebFile/list.html?path=${filePath?url}" target="navTab" rel="cmsWebFile/list">
                            ${a.fileName}
                        </a>
                    <#else>
                    ${a.fileName}
                    </#if>
                </td>
                <td>${a.lastModifiedTime?datetime}</td>
                <td>${a.creationTime?datetime}</td>
                <td><@t.fileSize a.size/></td>
                <td class="wrap">
                    <#if a.directory>
                        <a href="cmsWebFile/zip?path=${filePath?url}&_csrf=<@_csrfToken admin=true/>" class="btnText blue" title="<@t.page 'confirm.compress_directory'/>" target="ajaxTodo"><@t.page 'button.compress'/></a>
                    <#else>
                        <#if a.fileName?ends_with('.zip')>
                            <a href="cmsWebFile/unzipParameters.html?path=${filePath?url}" class="btnText blue" target="dialog" mask="true"><@t.page 'button.decompress'/></a>
                        </#if>
                        <#if editableSubfix?seq_contains(a.fileName?keep_after_last('.')?lower_case)>
                          <a href="cmsWebFile/content.html?path=${filePath?url}" class="edit btnText blue" target="navTab" rel="cmsWebFile/content:${filePath}" icon="<i class='icon-edit'></i>" title="${a.fileName}"><i class="icon-edit"></i> <@t.page 'button.edit'/></a>
                        </#if>
                        <a href="${site.sitePath+filePath?keep_after('/')}" class="btnText" target="_blank"><@t.page 'button.view'/></a>
                    </#if>
                </td>
            </tr>
        </#list>
    </@_webFileList>
        </tbody>
    </table>
</div>