Foren

how to get latest version of documents urls uploaded in Documents and media

Daniel Klein, geändert vor 9 Jahren.

how to get latest version of documents urls uploaded in Documents and media

New Member Beiträge: 8 Beitrittsdatum: 19.12.14 Neueste Beiträge
Hi all,

In my liferay application I have added documents and media portlet for all users then users can add and
modify their uploaded documents.

Task: I want to show or preview latest version of documents in iframes.
Issue: I am using WebDav url for preview into iframe but when user updates it's document then
that webDav url not show latest version of document in iframes.

If anyone have an idea regard how to purge this then please share with me.


Thanks in advance.

Regards ,
Daniel
Tiger T T, geändert vor 9 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

New Member Beiträge: 8 Beitrittsdatum: 19.12.14 Neueste Beiträge
Hi any one have an idea regards this?
thumbnail
Manali Lalaji, geändert vor 9 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi,

Have you checked this issue: https://issues.liferay.com/browse/LPS-51635 ?

HTH!
Tiger T T, geändert vor 9 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

New Member Beiträge: 8 Beitrittsdatum: 19.12.14 Neueste Beiträge
Thanks Manali for replying,
Ok I have check this issue and trying do this in another way so I have checked with normal URLs but
In my case when I have upload any document and then get normal URL of that document and then put that URL in browser then it show me
one pop up for download instated of showing that document on browser why?
You have any idea regards this?

Once again thanks for replying emoticon
thumbnail
Manali Lalaji, geändert vor 9 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

Expert Beiträge: 362 Beitrittsdatum: 09.03.10 Neueste Beiträge
Hi,

I checked in Liferay 6.2 as well, that when you paste normalURL of document in browser, it shows you preview of document.
Only in case of webdav url, it prompts for downloading the file.
Are you following the same scenario or trying to use that normal document url in iframe or something else?

HTH!
Tiger T T, geändert vor 9 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

New Member Beiträge: 8 Beitrittsdatum: 19.12.14 Neueste Beiträge
Hi,
I am using liferay 6.1.0 CE but in my case it happens exactly apposite to that
I'm trying to show Documents in I frame but whenever i have used normal URL then it prompts to download document and if i have used webDav URL it show me
Document but with older version. you have any idea why this happen or in which case this occurs?

thanks and regards
Tiger
thumbnail
Prabhakar Singh, geändert vor 8 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

New Member Beiträge: 8 Beitrittsdatum: 02.08.12 Neueste Beiträge
Hi , I know its too late ,but even i was looking into a similar requirement today and thats when i came across your post. End of the day i got a solution, thought i must share it here so that it may be of help for someone landing to this post in future.

Requirement : My requirement was to upload an Image in Document Media and use it for Site Logo. Note: This Image will exist by the name of 'Dynamic Logo' and incase this image is not available,the site-logo must fallback to the default Logo-Image embeded within the Theme.

Challenge: I created a url fetching the DlFileEntry object for this Image and used the same in theme, it works f9 but was unable to fetch the latest version of the Image updated.
FYI, I added a method in my services portlet for this and called the same from Theme using ServiceLocator.

Workaround: I just changed the way i was creating this LogoURL in my services and its working as a charm now.
Here's a code snippet of the Service Method i used to create the URL :


public static String getDocumentAndMediaImageUrlByTitle(ThemeDisplay themeDisplay, String imageTitle){
String dynamicLogoUrl = null ;
DLFileEntry dlFileEntry = null;
try {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(DLFileEntry.class, PortalClassLoaderUtil.getClassLoader())
.add(RestrictionsFactoryUtil.eq("companyId", themeDisplay.getCompanyId()))
.add(RestrictionsFactoryUtil.eq("groupId", themeDisplay.getScopeGroupId()))
.add(RestrictionsFactoryUtil.eq("title", imageTitle));

List<DLFileEntry> dynamicQueryResultList = (List<DLFileEntry>) DLFileEntryLocalServiceUtil.dynamicQuery(dynamicQuery);
if(CollectionUtils.isNotEmpty(dynamicQueryResultList)) {
dlFileEntry = dynamicQueryResultList.get(0);
}else{
_log.warn(" No Image found in DLFileEntry by Title = "+imageTitle +" and groupId = "+themeDisplay.getScopeGroupId());
}
if(Validator.isNotNull(dlFileEntry)){
/*dynamicLogoUrl = themeDisplay.getPortalURL()
+ themeDisplay.getPathContext() + "/documents/"
+ dlFileEntry.getGroupId() + StringPool.SLASH
+ dlFileEntry.getUuid();*/


dynamicLogoUrl = themeDisplay.getPortalURL()
+ themeDisplay.getPathContext() + "/documents/"
+ dlFileEntry.getGroupId() + "/"
+ dlFileEntry.getFolderId() + "/"
+ HttpUtil.encodeURL(HtmlUtil.unescape(imageTitle))
+ "/" + dlFileEntry.getUuid();


_log.debug( " # dynamicLogoUrl created for Title = "+imageTitle+ " is = "+dynamicLogoUrl);
}
} catch (SystemException e) {
e.printStackTrace();
}
return dynamicLogoUrl;
}

The Red colored commented code is the previous one that i tried and didn't gave me the latest version of Image updated in Documents & Media.
And , the Green Colored code is the workaround for that.
asif aftab, geändert vor 8 Jahren.

RE: how to get latest version of documents urls uploaded in Documents and m

Regular Member Beiträge: 123 Beitrittsdatum: 02.09.13 Neueste Beiträge
Thanks,
It is useful.