<#macro contentFiles image contentId='' copy=false>
    <#local name=image?then('images','files')/>
    <#local fileTypes=image?then('image','video,audio,other')/>
<table class="list nowrap itemDetail ${name}" addButton="<@t.page 'button.new_line'/>"<#if image> batchUploadUrl="common/batchUpload.html?field=filePath&originalField=description&fileTypes=image"</#if> width="100%">
    <thead>
        <tr>
            <th type="attach" name="${name}[#index#].filePath" size="50" fieldClass="required" lookupGroup="${name}[#index#]" lookupUrl="common/upload.html?field=filePath&originalField=description${image?then('&fileTypes=image','')}"><@t.page 'file_path'/></th>
            <th type="textarea" name="${name}[#index#].description" fieldAttrs="{'maxlength':150,'rows':2,'cols':60}"><@t.page 'description'/></th>
            <th type="text" name="${name}[#index#].fileSize" fieldClass="digits" size="10" fieldAttrs="{'maxlength':20,'readonly':'readonly'}"><@t.page 'file.size'/></th>
            <th type="text" name="${name}[#index#].width" fieldClass="digits" size="10" fieldAttrs="{'maxlength':20,'readonly':'readonly'}"><@t.page 'width'/></th>
            <th type="text" name="${name}[#index#].height" fieldClass="digits" size="10" fieldAttrs="{'maxlength':20,'readonly':'readonly'}"><@t.page 'height'/></th>
            <th type="text" name="${name}[#index#].sort" fieldClass="required digits" defaultval="#index#" size="5"><@t.page 'sort'/></th>
            <th type="del" width="60"><@t.page 'operate'/></th>
        </tr>
    </thead>
    <tbody>
<#if contentId?has_content>
    <@_contentFileList contentId=contentId fileTypes=fileTypes absoluteURL=false pageSize=500>
        <#list page.list as file>
            <tr>
                <td>
                    <#if !copy><input type="hidden" name="${name}[${file?index}].id" value="${file.id}"/></#if>
                    <input type="text" name="${name}[${file?index}].filePath" value="${(file.filePath)!}" size="50" class="required" />
                    <a class="btnAttach" lookupGroup="${name}[${file?index}]" href="common/upload.html?field=filePath&originalField=description${image?then('&fileTypes=image','')}" width="1000" height="600">${image?then(t.pageMessage('upload.image'),t.pageMessage('upload.file'))}</a>
                </td>
                <td>
                    <textarea name="${name}[${file?index}].description" rows="3" cols="50" maxlength="150">${(file.description)!}</textarea>
                </td>
                <td>
                    <input type="text" name="${name}[${file?index}].fileSize" class="digits" readonly="readonly" value="${(file.fileSize)!}" size="10" maxlength="20"/>
                </td>
                <td>
                    <input type="text" name="${name}[${file?index}].width" class="digits" readonly="readonly" value="${(file.width)!}" size="10" maxlength="20"/>
                </td>
                <td>
                    <input type="text" name="${name}[${file?index}].height" class="digits" readonly="readonly" value="${(file.height)!}" size="10" maxlength="20"/>
                </td>
                <td>
                    <input type="text" name="${name}[${file?index}].sort" class="required digits" value="${file.sort!}" size="5" maxlength="5"/>
                </td>
                <td>
                    <a href="javascript:;" class="btnDel"><@t.page 'button.delete'/></a>
                </td>
            </tr>
        </#list>
    </@_contentFileList>
</#if>
    </tbody>
</table>
<#if image>
    <#include "../include_page/preview.html"/>
    <@preview name '.images' 'tr td input[name$=filePath]'/>
</#if>
</#macro>