<#function useFile filePath fileName fullPath=''>
    <#if fullPath?has_content>
       <#assign prefix=site.sitePath/>
    <#else>
       <#assign prefix=r'${site.sitePath}'/>
    </#if>
    <#assign fileType=t.fileType(fileName)/>
    <#switch fileType>
        <#case 'image'>
            <#return '<img src="'+prefix+filePath+'" alt="'+fileName+'">'/><#break>
        <#case 'video'>
            <#return '<video controls="controls"><source src="'+prefix+filePath+'" type="video/${fileSuffix}"></video>'/><#break>
        <#case 'audio'>
            <#return '<audio controls="controls" src="'+prefix+filePath+'"></audio>'/><#break>
        <#default>
            <#assign fileSuffix = fileName?keep_after_last('.')/>
            <#switch fileSuffix>
                <#case 'css'>
                    <#return '<link href="'+prefix+filePath+'" rel="stylesheet">'/><#break>
                <#case 'js'>
                    <#return '<script src="'+prefix+filePath+'"></script>'/><#break>
                <#case 'ico'>
                    <#return '<link rel="shortcut icon" href="'+prefix+filePath+'">'/><#break>
                <#case 'rar'>
                <#case 'zip'>
                <#case 'html'>
                    <#return '<a href="'+prefix+filePath+'">'+fileName+'</a>'/><#break>
                <#default>
                    <#return prefix+filePath/>
            </#switch>
    </#switch>
</#function >
<div class="pageFormContent">
    <@tools.fileList type='file' path=path>
        <#if path?has_content>
            <div class="image-list">
                <a href="cmsWebFile/lookup.html?path=${path?contains('/')?then(path?keep_before_last('/'),'')?url}&fullPath=${(fullPath?url)!}" target="dialog" mask="true">
                    <i class="thumb icon-folder-open-alt icon-large"></i>
                    <p><@t.page 'button.return'/></p>
                </a>
            </div>
        </#if>
        <#list list as a>
        <#assign filePath=path?has_content?then(path+'/','')+a.fileName/>
            <div class="image-list">
                <#if a.directory>
                    <a href="cmsWebFile/lookup.html?path=${filePath?url}&fullPath=${(fullPath?url)!}" target="dialog" mask="true" title="${filePath}">
                        <i class="thumb icon-folder-close-alt icon-large"></i>
                        <p>${a.fileName}</p>
                    </a>
                <#else>
                    <#if t.fileType(a.fileName) = 'image'>
                        <img src="${getUrl(filePath)}" alt="${a.fileName}" title="${a.fileName}(<@t.fileSize a.size/>)">
                    <#else>
                        <i class="thumb icon-file-alt icon-large"></i>
                    </#if>
                    <p title="<@t.page 'modified_date'/>:${a.lastModifiedTime?date},<@t.page 'create_date'/>:${a.creationTime?date}">
                        <a href="javascript:;" onclick="JUI.instances[$('textarea.code',navTab.getCurrentPanel()).data('id')].replaceSelection('${useFile(filePath?url_path?js_string,a.fileName?url_path?js_string,fullPath!)}');$.pdialog.closeCurrent();return false;">
                            ${a.fileName}(<@t.fileSize a.size/>)
                        </a>
                    </p>
                </#if>
            </div>
        </#list>
    </@tools.fileList>
</div>