Fórumok

View File Entry details in dialog box from a Dynamic Data List Template

thumbnail
Sam Collett, módosítva 8 év-val korábban

View File Entry details in dialog box from a Dynamic Data List Template

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2008.11.13. Legújabb bejegyzések
Hi,
I currently have a dynamic data list which contains references to documents within a dynamic data library. I have created a freemarker template which currently lists all the documents (plus some other meta data), but when I create a link to the document it is link to download it. How can I show the document details instead in a popup instead - the same as what you see when you click on a file entry within the documents and media portlet?

What I have so far:
<#--
Display templates are used to lay out the fields defined in a data
definition.

Please use the left panel to quickly add commonly used variables.
Autocomplete is also available and can be invoked by typing "${".
-->
<#assign DDLRecordLocalService =
    serviceLocator.findService(
    "com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService")>
<#assign DLFileEntryService =
    serviceLocator.findService(
    "com.liferay.portlet.documentlibrary.service.DLFileEntryService")>
<#assign records = DDLRecordLocalService.getRecords(reserved_record_set_id)>
<#if records?has_content>
<table class="table table-bordered table-hover table-striped">
    <thead>
        <tr>
            <th>Document Title</th>
            <th>Document Directory</th>
        </tr>
    </thead>
    <tbody>
	&lt;#list records as cur_record&gt;
	    &lt;#assign jsonDoc = jsonFactoryUtil.createJSONObject(cur_record.getFieldValue("Document", locale))&gt;
		&lt;#assign document = DLFileEntryService.getFileEntryByUuidAndGroupId(jsonDoc.getString("uuid"), jsonDoc.getLong("groupId"))&gt;
		<tr>
		    <td>
		    <a href="${ddmUtil.getDisplayFieldValue(themeDisplay, cur_record.getFieldValue(" document", locale), cur_record.getfieldtype("document"))}">
	${document.getTitle()}
</a></td>
		    <td>${cur_record.getFieldValue("Directory", locale)}</td>
	    </tr>
	<!--#list-->
	</tbody>
</table>
&lt;#else&gt;
<p>No documents</p>
<!--#if-->


Regards,
Sam