Fórum

Remove "add comment" from liferay-ui:discussion

Robert Rayas, modificado 8 Anos atrás.

Remove "add comment" from liferay-ui:discussion

New Member Postagens: 21 Data de Entrada: 28/11/14 Postagens Recentes
Hi,

I wanted to display the discussion section on view_file_entry with "add comments" but the permission to prevent the user from adding discussion doesn't work. Looking at the jsp, it is a single element and none of the properties on it have to do with "add comments".
<liferay-ui:discussion
className="<%= DLFileEntryConstants.getClassName() %>"
classPK="<%= fileEntryId %>"
formAction="<%= discussionURL %>"
formName="fm2"
ratingsEnabled="<%= enableCommentRatings %>"
redirect="<%= currentURL %>"
userId="<%= fileEntry.getUserId() %>"
/>
thumbnail
Andew Jardine, modificado 8 Anos atrás.

RE: Remove "add comment" from liferay-ui:discussion

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hey Robert,

Looking at the taglib definition, it looks like you may be able to provide your own custom permission checker classes --


		<attribute>
			<name>permissionClassName</name>
			<required>false</required>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
		<attribute>
			<name>permissionClassPK</name>
			<required>false</required>
			<rtexprvalue>true</rtexprvalue>
		</attribute>


If you don't provide these values then it appears to try to use the className and classPK values --


	protected void setAttributes(HttpServletRequest request) {
		String permissionClassName = _permissionClassName;

		if (Validator.isNull(permissionClassName)) {
			permissionClassName = _className;
		}

		long permissionClassPK = _permissionClassPK;

		if (permissionClassPK == 0) {
			permissionClassPK = _classPK;
		}

...


Maybe try adding those attributes with a custom permission class?
Robert Rayas, modificado 8 Anos atrás.

RE: Remove "add comment" from liferay-ui:discussion

New Member Postagens: 21 Data de Entrada: 28/11/14 Postagens Recentes
Hi,
Thanks for your reply. If I use the custom permission checker and it fails, will it hide the entire discussion section? I just want to hide the "add comments" links.
thumbnail
Andew Jardine, modificado 8 Anos atrás.

RE: Remove "add comment" from liferay-ui:discussion (Resposta)

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hey Robert,

I haven't studied it in details, but you probably want to have a look at the JSP found under portal-web/html/taglib/ui/discussion/page.jsp. The code that renders the "add comment" option would be in there. If it doesn't have the logic you are looking for, you could always try a JSP hook for that file and update it with whatever requiements you have.
Robert Rayas, modificado 8 Anos atrás.

RE: Remove "add comment" from liferay-ui:discussion

New Member Postagens: 21 Data de Entrada: 28/11/14 Postagens Recentes
Hi,
Thanks I was able to hook the jsp you mentioned
thumbnail
Vishal Kumar, modificado 8 Anos atrás.

RE: Remove "add comment" from liferay-ui:discussion

Regular Member Postagens: 198 Data de Entrada: 12/12/12 Postagens Recentes
May This will help you.

https://www.liferay.com/community/forums/-/message_boards/view_message/33547060
http://stackoverflow.com/questions/5941986/how-to-use-the-liferay-comments-framework