<#function useFile filePath fileName fullPath=''>
    <#assign fileSuffix = fileName?keep_after_last('.')/>
    <#if fullPath?has_content>
       <#assign prefix=site.sitePath/>
    <#else>
       <#assign prefix=r'${site.sitePath}'/>
    </#if>
    <#switch fileSuffix>
        <#case 'css'>
            <#return '<link href="'+prefix+filePath+'" rel="stylesheet">'/><#break>
        <#case 'js'>
            <#return '<script src="'+prefix+filePath+'"></script>'/><#break>
        <#case 'jpg'>
        <#case 'png'>
        <#case 'bmp'>
        <#case 'jpeg'>
        <#case 'gif'>
            <#return '<img src="'+prefix+filePath+'">'/><#break>
        <#case 'ico'>
            <#return '<link rel="shortcut icon" href="'+prefix+filePath+'">'/><#break>
        <#case 'ogg'>
        <#case 'webm'>
        <#case 'mpeg'>
        <#case 'mpg'>
        <#case 'mov'>
        <#case 'rm'>
        <#case 'ram'>
        <#case 'avi'>
        <#case 'wmv'>
        <#case 'mp4'>
            <#return '<video controls="controls"><source src="'+prefix+filePath+'" type="video/${fileSuffix}"></video>'/><#break>
        <#case 'wav'>
        <#case 'acc'>
        <#case 'mid'>
        <#case 'midi'>
        <#case 'wma'>
        <#case 'mpga'>
        <#case 'mp3'>
            <#return '<audio controls="controls" src="'+prefix+filePath+'"></audio>'/><#break>
        <#case 'rar'>
        <#case 'zip'>
        <#case 'html'>
            <#return '<a href="'+prefix+filePath+'">'+fileName+'</a>'/><#break>
        <#default>
            <#return prefix+filePath/>
    </#switch>
</#function >
<div class="pageContent">
    <table class="table" width="100%" layoutH>
        <thead>
            <tr>
                <th><@t.page 'use'/></th>
                <th width="30"></th>
                <th><@t.page 'name'/></th>
                <th><@t.page 'modified_date'/></th>
                <th><@t.page 'create_date'/></th>
                <th><@t.page 'file.size'/></th>
            </tr>
        </thead>
        <tbody>
    <@_webFileList path=path>
        <#if path?has_content>
            <tr>
                <td></td>
                <td class="tree"><div class="folder_expandable"></div></td>
                <td>
                    <a href="cmsWebFile/lookup.html?path=${path?keep_before_last('/')?url}&editor=${editor!'cmsTemplateEditor'}&fullPath=${(fullPath?url)!}" target="dialog" mask="true" title="${path?keep_before_last('/')}">
                        <@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>
                    <#if !a.directory>
                        <a href="javascript:;" class="btnText green" onclick="DWZ.codemirror.instances[$('textarea.code',navTab.getCurrentPanel()).data('id')].replaceSelection('${useFile(filePath?keep_after('/'),a.fileName,fullPath!)}');$.pdialog.closeCurrent();return false;"><i class="icon-ok"></i> <@t.page 'select'/></a>
                    </#if>
                </td>
                <td class="tree"><div class="${a.directory?then('folder_expandable','file')}" style="width:30px;"></div></td>
                <td>
                    <#if a.directory>
                        <a href="cmsWebFile/lookup.html?path=${filePath?url}&fullPath=${(fullPath?url)!}" target="dialog" mask="true" title="${filePath}">
                            ${a.fileName}
                        </a>
                    <#else>
                        ${a.fileName}
                    </#if>
                </td>
                <td>${a.lastModifiedTime?datetime}</td>
                <td>${a.creationTime?datetime}</td>
                <td><@t.fileSize a.size/></td>
            </tr>
        </#list>
    </@_webFileList>
        </tbody>
    </table>
</div>