Details
-
Type:
Feature Request
-
Status:
Contributed Solution
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 6.1.20 EE GA2
-
Fix Version/s: None
-
Component/s: DM, DM > Document Library Display, WCM, WCM > Asset Publisher
-
Labels:None
-
Environment:Liferay Version: 6.1 GA 2
Operating System: Windows Server 2003
Application Server: JBoss 7.x
Java Virtual Machine: Java 6
Database: MySQL 5.5
-
Liferay Contributor's Agreement:Accept
-
Similar Issues:
Description
Please kindly consider adding a "configuration data" in asset publisher to allow the feature that when you click on the related asset, the document will be downloaded directly:
The detailed requirement is as the followings:
1. Add Documents and Media Portlet, Asset Publisher Portlet in one page.
2. Create a pdf file in Documents and Media Portlet.
3. Click Add New-->Web Content, create a new web content, add the pdf file as its related asset.
4. Configured the asset publisher with following options:
- Display Style > Full Content
- Show Asset Title
- Show Context Link
- Set as the Default Asset Publisher for This Page
- Show Context Link
- Enable Related Assets
5. Remove Documents and Media Portlet in the page. So the page only has Asset Publisher Portlet.
6. After click on the link of related asset in new created web content, please consider add a new display method of the document.
Current display way: the document will display in Asset Publisher Portlet or Documents and Media Portlet, Documents and Media Display Portlet and Media Gallery Portlet.
Expected display method: directly download the document and don't need to display in these portlet.
So please consider have Asset publisher has the two display way.

Instead of changing the display style the Asset Publisher should have another configuration option like "Use preview for documents" and if it's unselected the preview link will be replaced by the direct download link.
If you need it now you can hook the Asset Publisher. Create a new hook in your Liferay IDE and build up this path: docroot/META-INF/custom_jsps/html/portlet/asset_publisher/display/
Now copy the file "table.jsp" (it's exactly the same for "abstracts.jsp" and "title-list.jsp", I'll just do the example with "table.jsp") from your ROOT/html/portlet/asset_publisher/display/ folder into it. You will have to do some additions in this file:
Here https://github.com/liferay/liferay-portal/blob/master/portal-web/docroot/html/portlet/asset_publisher/display/table.jsp#L16 you have to add this:
And here https://github.com/liferay/liferay-portal/blob/master/portal-web/docroot/html/portlet/asset_publisher/display/table.jsp#L65 add this:
try { DLFileEntry fileEntry = DLFileEntryServiceUtil.getFileEntry(assetEntry.getClassPK()); if (!fileEntry.getExtension().equals("pdf")) { viewURL = themeDisplay.getPortalURL() + themeDisplay.getPathContext() + "/documents/" + fileEntry.getGroupId() + "/" + fileEntry.getFolderId() + "/" + HttpUtil.encodeURL(HtmlUtil.unescape(fileEntry.getTitle())) + "?version=" + fileEntry.getVersion(); } } catch (Exception e) { // }This will try to get a DLFileEntry by the assets classPK and if it works it will replace the viewURL by the complete download link. Hope this helps.