留言板

Html in liferay 6.1

thumbnail
Ujjainee Sarkar,修改在6 年前。

Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
Can we upload a file as html as input and render the same as a page in Liferay 6.1?
thumbnail
Andrew Jardine,修改在6 年前。

RE: Html in liferay 6.1

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
You mean -- as in take a static HTML site and "upload" it into Liferay and then have the site returned as it is now, but being served by Liferay?
thumbnail
Ujjainee Sarkar,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
Hello Andrew,
Actually when I am uploading the html file it is coming like this(Screenshot attached). Any perfect icon or text is not visible. Only a blank icon. So is there any way of rendering this HTML link from the liferay page. Like I uploaded the file and when I'm clicking on the file the html page will open.
thumbnail
Andrew Jardine,修改在6 年前。

RE: Html in liferay 6.1

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
Ok -- I should have asked this first -- WHERE are you uploading this HTML? Are you trying to add it to the Document Library? or are you trying to add it as new Web Content? -- or something else altogether?

Maybe give me the list of steps that you are using so that I have some more context?
thumbnail
Ujjainee Sarkar,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
Yeah I'm uploading it in documents and media portlet which comes as the out-of-the-box portlet and I want that the uploaded file should be visible or atleast show some meaningful related icon when uploaded instead of being blank.
thumbnail
Andrew Jardine,修改在6 年前。

RE: Html in liferay 6.1

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
I see what you mean. Ok -- I don't have the 6.1 source code handy right now but I looked it up in the 6.2 codebase -- and will go out on a limb here and assume that they're the same, or similar at least.

There is a file in TOMCAT_HOME/webapps/ROOT/html/portlet/document_library/file_entry_columns.jspf that you can hook. In this file thre is a section --


<c:when test="<%= fileEntryColumn.equals(&quot;name&quot;) %>">
			<liferay-ui:search-container-column-text href="<%= rowHREF %>" index="<%= j %>" name="<%= fileEntryColumn %>">

				&lt;%
				String thumbnailSrc = DLUtil.getThumbnailSrc(fileEntry, latestFileVersion, fileShortcut, themeDisplay);
				%&gt;

				<span class="entry-thumbnail">
					<img alt="<liferay-ui:message key=" thumbnail">" class="thumbnail" src="&lt;%= thumbnailSrc %&gt;" /&gt;

					<c:if test="<%= fileShortcut != null %>">
						<img alt="<liferay-ui:message key=" shortcut">" class="shortcut-icon" src="&lt;%= themeDisplay.getPathThemeImages() %&gt;/file_system/large/overlay_link.png" /&gt;
					</c:if>

					<c:if test="<%= fileEntry.isCheckedOut() %>">
						<img alt="<liferay-ui:message key=" locked">" class="locked-icon" src="&lt;%= themeDisplay.getPathThemeImages() %&gt;/file_system/large/overlay_lock.png" /&gt;
					</c:if>

					<c:if test="<%= ((latestFileVersionStatus != WorkflowConstants.STATUS_ANY) &amp;&amp; (latestFileVersionStatus != WorkflowConstants.STATUS_APPROVED)) %>">
						<aui:workflow-status showIcon="<%= false %>" showLabel="<%= false %>" status="<%= latestFileVersionStatus %>" />
					</c:if>
				</span>

				<div class="entry-metadata">
					<span class="entry-title">&lt;%= HtmlUtil.escape(latestFileVersion.getTitle()) %&gt;</span>

					<c:if test="<%= Validator.isNotNull(latestFileVersion.getDescription()) %>">
						<div class="entry-description">
							&lt;%= HtmlUtil.escape(latestFileVersion.getDescription()) %&gt;
						</div>
					</c:if>
				</div>
			</liferay-ui:search-container-column-text>
		</c:when>


-- you can see in this block that there is an <img/> tag that set's the thubnail source calculated right above it with --

&lt;%
    String thumbnailSrc = DLUtil.getThumbnailSrc(fileEntry, latestFileVersion, fileShortcut, themeDisplay);
%&gt;


.. and I guess it can't calculate anything for your html files. So you have two options I guess. You could hook the JSP and add logic to detect the absence and then hook into your own util to generate one, OR, what I would guess is a better solution, would be to create your own document type that contains a field that allows you to specify an image when you upload the HTML file. The second option would require you upfront to generate the image to have it handy for when you create the content item -- but I would say that it is a more appropriate use of the system (over the JSP hook and mangling the display logic).
thumbnail
Ujjainee Sarkar,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
But Andrew, according to your second option I have to choose a image manually for my html and it may or may not be related to the html? Then how can one understand which html file is it if the image or text is not automatically derived from the html file?
thumbnail
Olaf Kock,修改在6 年前。

RE: Html in liferay 6.1

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
This boils down to: Liferay does not create thumbnails from HTML documents out of the box. You can override this behavior (and provide your own thumbnail generator that renders the document and creates a GIF, PNG or JPG image, but it's not done by default.
thumbnail
Ujjainee Sarkar,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
Thanx Alfonso and Olaf! I got my answer to my query that Liferay does not create thumbnails from HTML documents by default. Thanks a lot!emoticon
thumbnail
Andrew Jardine,修改在6 年前。

RE: Html in liferay 6.1

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
-- if you do go the route of generating thumbnails (dynamically) for HTML files that are added, then you should consider contributing that plugin to the marketplace. I don't know how many people store HTML in the DL, but no doubt you are not the first and will probably not be the last.
thumbnail
Ujjainee Sarkar,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 127 加入日期: 16-7-20 最近的帖子
Yeah actually we got a query for this and i was not sure whether it is possible or not. So for the time being I'm considering it as not possible and not proceeding with the plan further.
thumbnail
Alfonso Crisci,修改在6 年前。

RE: Html in liferay 6.1

Regular Member 帖子: 136 加入日期: 14-4-2 最近的帖子
Hi Ujjainee,

These properties could also help for the "unstyled" icon issue:

You can map a PNG for generic thumbnails by adding the image to the theme's file system folder. For example, the generic thumbnail for documents can be found in: /html/themes/_unstyled/images/file_system/large/document.png.
Defaults:

dl.file.generic.names=compressed,document,flash,image,music,pdf,presentation,spreadsheet,video
dl.file.generic.extensions[compressed]=lar,rar,zip
dl.file.generic.extensions[document]=doc,docx,pages,rtf,odt
dl.file.generic.extensions[flash]=flv,swf
dl.file.generic.extensions[image]=bmp,gif,jpeg,jpg,odg,png,svg
dl.file.generic.extensions[music]=acc,mid,mp3,oga,ogg,wav,wma
dl.file.generic.extensions[pdf]=pdf
dl.file.generic.extensions[presentation]=key,keynote,odp,pps,ppt,pptx
dl.file.generic.extensions[spreadsheet]=csv,numbers,ods,xls,xlsx
dl.file.generic.extensions[video]=avi,m4v,mov,mp4,mpg,ogv,qt,rm,wmv

You can map a GIF for the extension by adding the image to the theme's image display and document library folder. The wildcard extension of * will be ignored. For example, the default image for the DOC extension would be found in: /html/themes/_unstyled/images/file_system/small/doc.gif.
Defaults:

dl.file.icons=.bmp,.css,.doc,.docx,.dot,.gif,.gz,.htm,.html,.jpeg,.jpg,.js,.lar,.odb,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.ppt,.pptx,.rtf,.swf,.sxc,.sxi,.sxw,.tar,.tiff,.tgz,.txt,.vsd,.xls,.xlsx,.xml,.zip,.jrxml