<!DOCTYPE html>
<html lang="<@t.page 'lang'/>">
<head>
    <meta charset="utf-8">
    <title><@t.page 'file.view'/></title>
    <link href="${base}/resource/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"/>
    <link href="${base}/resource/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen"/>
    <script src="${base}/resource/js/jquery-1.12.4.min.js"></script>
    <script src="${base}/resource/bootstrap/js/bootstrap.min.js"></script>
<script>  
function callback(fileUrl){  
    var parentWindow = ( window.parent == window ) ? window.opener : window.parent;  
    parentWindow.CKEDITOR.tools.callFunction(${CKEditorFuncNum}, fileUrl);  
    window.close();
}
</script>
</head>
<body>
<div class="container theme-showcase" role="main">
    <div class="page-header">
        <h1><@t.page 'webfile'/></h1>
    </div>
    <div class="row">
        <div class="col-md-1"></div>
        <div class="col-md-5"><@t.page 'file.name'/></div>
        <div class="col-md-2"><@t.page 'modified_date'/></div>
        <div class="col-md-2"><@t.page 'create_date'/></div>
        <div class="col-md-2"><@t.page 'file.size'/></div>
    </div>
<#if path?has_content>
    <div class="row">
        <div class="col-md-1">
            [<@t.page 'directory'/>]
        </div>
        <div class="col-md-5">
            <a href="?path=${path?keep_before_last('/')}&CKEditorFuncNum=${CKEditorFuncNum!}&type=${type!}" target="_self"><@t.page 'button.return'/></a>
        </div>
        <div class="col-md-2">
        </div>
        <div class="col-md-2">
        </div>
        <div class="col-md-2">
        </div>
    </div>
</#if>
<#assign
    imageSuffix=["png","gif","jpg","jpeg","bmp"]
    flashSuffix=["swf","fla"]
/>
<@_webFileList path=path>
    <#list list as a>
    <div class="row">
        <#assign filePath=path?has_content?then(path+'/','/')+a.fileName/>
        <div class="col-md-1">
            <#if a.directory>[<@t.page 'directory'/>]</#if>
        </div>
        <div class="col-md-5">
            <#if a.directory>
                <a href="?path=${filePath}&CKEditorFuncNum=${CKEditorFuncNum!}&type=${type!}" target="_self">${a.fileName}</a>
            <#else>
                <#if 'image'=type&&imageSuffix?seq_contains(a.fileName?keep_after_last('.'))||'flash'=type&&flashSuffix?seq_contains(a.fileName?keep_after_last('.'))>
                    <a href="javascript:callback('${site.sitePath+filePath}');">${a.fileName}</a>
                <#else>
                    ${a.fileName}
                </#if>
            </#if>
        </div>
        <div class="col-md-2">
            ${a.lastModifiedTime?datetime}
        </div>
        <div class="col-md-2">
            ${a.creationTime?datetime}
        </div>
        <div class="col-md-2">
            <@t.fileSize a.size/>
        </div>
    </div>
    </#list>
</@_webFileList>
</div>
</body>
</html>