Foren

Modify MessageBoard portlet

Hugo Müller, geändert vor 13 Jahren.

Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hello @all,
i try to implement some MessageBoard features for my users.
First i try to set a marker for read/unread message.
in kernel/dao/search/ResutRow i add two Methods:


[size=7]public void setRead(boolean read){
		_read = read;
	}
	
	public boolean isRead(){
		return _read;
	}[/size]


In view.jsp of the MessageBoard portlet i set 'row.setRead(readThread);' twice where Bold is set (setBold()).
In taglib\ui\search_iterator\page.jsp i implemented the following code


[size=7]<%
					if (row.isRead()){%>
				read<%} else {%>
					unread<%}%>[/size]


after the entry.print(...) column.

In the 'Recent Posts' tab this works fine but at the massage home the categories always marks as unread.

Is it possible to mark a category as read if all subcategories and threads in this category is marked as read otherwise it is marked as unread?

The next nice feature i want to have is an sort by unread/read message in the 'recent post' tab.
For my szenario i have a new headerName -> read / unread. It would be very nice if there is the same sorting as by the userlist in the Control Panel.
So if the user clicks the link 'read / unread' the view gets sorted by read / unread messages. Is this possible?

Thanks in advcance!

Best regards,
Hugo
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hello guys,
i did some wrong implementation. So i removed the posted implementation.

Instead i only changed view.jsp of the message board portlet.
I inserted the following:


<liferay-ui:search-container-column-text buffer="buffer" href="<%= rowURL %>" name="read">
				
				&lt;%
					if (readThread)
						buffer.append("<h4 id="\&quot;message-board-read-message\&quot;">read</h4>");
					else
						buffer.append("<h4 id="\&quot;message-board-unread-message\&quot;">unread</h4>");
				%&gt;
				
				</liferay-ui:search-container-column-text>


So it's ok.

But the sorting by that column doesn't work emoticon
I tried to insert
orderable="&lt;%= true %&gt;

Without any success emoticon
So i also tried to insert:
[size=4]property="read"[/size]


But then i get the links all null instead of read/unread emoticon(.
How do i correctly implement sorting for columns?
Please give me some hint. Or is it to complex?
I thougt the search-engine already have the feature to order by columns.

Thanks.

Best regards
Hugo
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hello @all,
any suggestion on sorting by read/unread column? I don't know how to do that.
The read/unread column exist. But how do i use the search engine to sort by that column.
In that column i only have two possible values (read / unread or in german gelesen / ungelesen).

Please give me some hints or suggestions how to use the search engine to order by that 'read/unread' column.
Thanks!

Best regards,
Hugo
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hello @all,
any ideas? How can i order new Messages in the Message Board portlet by columns?.
And it would be very helpful to have a feature in the 'new Messages tab' that shows the Category name in which the new message is.

It is very confusing if you have a lot of categories and you can see new messages but don't know in which category the message is posted.

Please give me a hint how to implement those features. Maybe it is very simple.

Thanks!

Best regards
Hugo
Oliver Bayer, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Hugo,

maybe you can use your own Comparator. Write a Comparator class which extends from OrderByComparator. In the method compare(Object obj1, Object obj2) you have to compare the unread status from these objects. Then you can sort the result list with the following snippet:
ListUtil.sort(your-result-list, new YourComparator());

HTH Oli
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hi Oli,
thanks for your reply and the hint. I will have a look at it.
Any chance to display the category path in the 'new message tab'?

Thanks!

Best regards,
Hugo
Oliver Bayer, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Hugo,

if you have a list of unread MBMessage objects which you want to display in the tab "new message tab" then it should be no problem. Use the MBMessage object function getCategory() to display the info in the jsp.

Greets Oli
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hi Oli,
thanks for the help. I tried the getCategory() method of message object but it
displays the following:

{uuid=c07be376-8457-418b-8308-6695ac9265c7, categoryId=11826, groupId=18, companyId=1, userId=2, userName=Joe Bloggs, createDate=2011-01-14 13:26:49.715, modifiedDate=2011-01-14 13:26:49.715, parentCategoryId=11824, name=Test 1, description=Test 1, threadCount=2, messageCount=2, lastPostDate=2011-01-14 13:28:28.026}.

But it's not very helpful for the user. It should display the path like
parentcategory 1 / parentcateory 2 / parentcategory 3. This would be the best.

Maybe it would be ok to display the last two parentcategories. In the example above:
parencategory 2 / parentcategory 3

Thanks!

Best regards,
Hugo
Oliver Bayer, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Master Beiträge: 894 Beitrittsdatum: 18.02.09 Neueste Beiträge
Hi Hugo,

yes that output is not user friendly but ... emoticon.

The method getCategory() returns an object so to get the needed value call e.g. getName() or getDescription(). Look at your output to see all availlable fields.

HTH Oli
bhavishya goyal, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
hi friends,
i have a doubt if i want to add one more field in message board when we are posting new thread than i have to create hook .but i don't know which class is to be extended for adding one more field .if any one can help me plz help me because i m new to liferay
thumbnail
Thiago Leão Moreira, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
Hi Bhavishya,

Have you ever tried "Custom Fields"? It is the simplest way to extend a Liferay's entity.
bhavishya goyal, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
i have no idea about custom field can u please guide me .
thumbnail
Thiago Leão Moreira, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
Ok, go to your Control Panel -> Portal -> Custom Fields -> Message Boards Message. That's it. Play around with them a little bit that you will find out how powerful they are. ;)
bhavishya goyal, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
thanx.
Hugo Müller, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 94 Beitrittsdatum: 25.09.09 Neueste Beiträge
Hello @all,

@Olli: Thanks for the tip. It seems to work.

The thing with 'custom fields' is new to me, too. I also have a look at it. Thanks @all for this helpful discussion about "Message Board portlet".

I hope the message board portlet will be modified with those features discussed here in the near future. (e.g sorting by columns in the tab 'new messages'/ extend by a column category or display categories under the message / better mark messages as unread and read / mark the categories in at the forums start page with new if a new message in those categories is newly posted. ).

Should i post those improvements somewhere else ?

Best regards,
Hugo
Vy Nguyen, geändert vor 12 Jahren.

RE: Modify MessageBoard portlet

New Member Beiträge: 3 Beitrittsdatum: 10.06.11 Neueste Beiträge
hi friends,
i have download source code of liferay from javana.com and i already installed liferay ide in netbean.now i want to develope liferay message board from it .so plz tell me complete procedure of it because i m new to liferay so plz help me .
bhavishya goyal, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
hi,
can you tell me how to download source code of message boards and configration step in eclipse i have already installed liferay ide in eclipse .i am not able to view.jsp file in eclipse .i am new to liferay so please don't mind if this is silly question
thanks.
thumbnail
Jignesh Vachhani, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
Hi bhavishya ,

for message board source code you need to download portal source code if related liferay version.
Then you can create new java project with complete portal package in eclipse.
Also if you dont want to download the source code then you can find it in tomcat bundle(D:\tomcat\webapps\ROOT\html\portlet).
bhavishya goyal, geändert vor 13 Jahren.

RE: Modify MessageBoard portlet

Junior Member Beiträge: 58 Beitrittsdatum: 26.02.11 Neueste Beiträge
thanx for help .
can you tell me if i want to add one more field in post new thread action then and i want to store this field in database than what change should i made .this field store number