Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Is there any way to hide the input field of Tags of message board portlet? Quang Tran Minh May 9, 2012 9:14 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 9:32 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 9:44 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 9:48 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 9:55 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 10:19 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 11:06 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 11:14 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 11:35 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 11:46 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 11:57 AM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 9, 2012 12:02 PM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 9, 2012 8:31 PM
RE: Is there any way to hide the input field of Tags of message board portl Hiral Ramavat May 10, 2012 6:30 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 10, 2012 8:19 AM
RE: Is there any way to hide the input field of Tags of message board portl Rochad Tlusty May 28, 2012 10:43 PM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh May 17, 2012 8:59 AM
RE: Is there any way to hide the input field of Tags of message board portl Rochad Tlusty May 18, 2012 11:23 AM
RE: Is there any way to hide the input field of Tags of message board portl Quang Tran Minh June 13, 2012 10:40 PM
Quang Tran Minh
Is there any way to hide the input field of Tags of message board portlet?
May 9, 2012 9:14 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hi everyone,

When posting a new thread, is there any way to hide the input field of <aui:input name="Tags" type="assetTags"/> or preventing users from inputting tags by selecting tag from the button "Select" but cannot use the input field.

(This <aui:input name="Tags" type="assetTags"/> can be found in line 308 of edit_message.jsp of message board portlet).

Regards,
Quang
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 9:32 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

We can not do this using any configuration of the message board portlet. We have to customize the code using Hook, and comment that line.

Or you can also hide that using css (display:none) on the specific page. (Page Level CSS) But this approach is not advisable, it will still load on the page, by css we are hiding it. for time being we can do that

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 9:44 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hiral Ramavat:
We can not do this using any configuration of the message board portlet. We have to customize the code using Hook, and comment that line.

Or you can also hide that using css (display:none) on the specific page. (Page Level CSS) But this approach is not advisable, it will still load on the page, by css we are hiding it. for time being we can do that

Thanks,
Hiral


Thank you for your quick reply. Yeah, I already used hook to comment that line but I still don't know how to get the tags from database and stick it with the post message after pressing publish button... emoticon it seems like a miracle emoticon I have been searching for it since 3 weeks ago.
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 9:48 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

Are you searching specific tag from the database?

If so, you can use API provided by Liferay to get the tags. Let me know if you need any help on this. Which version of liferay you are using?

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 9:55 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hi Hiral Ramavat,

I just want to display all the tags which in the database to the jsp page by using AJAX and to stick it with the message. I'm using Liferay version 6.0.6 CE.

P/S: Just like the "Select" button below the input field of Tags

Thanks,
Quang
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 10:19 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

If you want to display all the tag from all the community/organization then you can use following API provided by Liferay.

List<com.liferay.portlet.tags.model.TagsEntry> results = TagsEntryLocalServiceUtil.getEntries();

Above will give you all the tag in list format.

Hope it will help you.

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 11:06 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hiral Ramavat:
If you want to display all the tag from all the community/organization then you can use following API provided by Liferay.

List<com.liferay.portlet.tags.model.TagsEntry> results = TagsEntryLocalServiceUtil.getEntries();

Above will give you all the tag in list format.

Hope it will help you.

Thanks,
Hiral


Hi Hiral,

Your code doesn't work for my liferay 6.0.6. Anyway, thank you so much for your reply!
I already tried to get the tags from database by the idea you provided but the problem is how can I make it tagged to the message. For example, if I post a thread with title "Liferay", content: "Liferay" and I check two tags: "7cogs" and "Liferay", so how do my thread "Liferay" got tagged with "7cogs" and "Liferay" ?

Regards,
Quang
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 11:14 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

Are you using Liferay OOB feature for tagging your content? Or have you completely disabled it?
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 11:35 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

I didn't know about Liferay OOB feature about tagging content in Message Board porlet. In addition, I googled it but can't figure out what it is. I would appreciate if you could help me!!
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 11:46 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

You can use tagging feature provided by liferay.

Try to add new thread in the message board portlet. It will allow you to add or select the tag for that thread.

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 11:57 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hi Hiral,

According to my first post, I did know it but.... what I expected is to prevent users from inputting new tags from the input field of <aui:input>, therefore, they can only select which tags they want to tagged their thread.

Regards,
Quang
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 12:02 PM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

Ohh...Ok...but in you previous post you have written that you want tagging your content in message.

can you please elaborate more about your problem

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 9, 2012 8:31 PM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Hi Hiral,

First of all, my problem is I want to forbid the insert tags function, I mean I don't want any users can create new tags except Admin. Therefore, when I choose "Post New Thread" in message board portlet, it should only display for users a list of tags from database to select, not to insert their new tags. However, I already made all the tags display in posting message page but how do I tag my message by selecting tags from the tag list ? You got me?

Anyway, thanks for your concern!!
Regards,
Quang
Hiral Ramavat
RE: Is there any way to hide the input field of Tags of message board portl
May 10, 2012 6:30 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 101

Join Date: February 13, 2012

Recent Posts

You mean, it is not allow you to select the particular tag with that past? Have you hide select button provided by liferay and using your own custom List of tags? Is it so? - Please Confirm.

Thanks,
Hiral
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 10, 2012 8:19 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

This is the default tags in message board portlet in "posting or editting message" page.



I want to remove or hide the input field, and only display the select button to make this box appears:



Users can only select tags, but not to input new tags.
Rochad Tlusty
RE: Is there any way to hide the input field of Tags of message board portl
May 28, 2012 10:43 PM
Answer

Rochad Tlusty

Rank: Junior Member

Posts: 42

Join Date: January 18, 2012

Recent Posts

I think I might be able to help. In your instance of Liferay, you should have a folder /html/js/liferay, There you will find a file named asset_tags_selector.js (if you can't find it just search for the file). Around line 398 of this file you will see the following code,


 1
 2                                        _onAddEntryClick: function(event) {
 3                                                var instance = this;
 4
 5                                                var text = instance.inputNode.val();
 6
 7                                                if (text) {
 8                                                        if(text.indexOf(',') > -1) {
 9                                                                var items = text.split(',');
10
11                                                                A.each(
12                                                                        items,
13                                                                        function(item, index, collection) {
14                                                                                instance.entries.add(item, {});
15                                                                        }
16                                                                );
17                                                        } else {
18                                                                instance.entries.add(text, {});
19                                                        }
20                                                }
21
22                                                Liferay.Util.focusFormField(instance.inputNode);
23                                        }

Here you can modify or remove the ability to add tags through the asset selector. As far as being able to type in tags, I think you can just change the line around 115 in this file to false,
1
2allowAnyEntry: {
3                                                value: true
4                                        },

Maybe not exactly what you're looking for, but should help you get closer.
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
May 17, 2012 8:59 AM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

It helps me a lot. I will try.

Thanks for your help !
Rochad Tlusty
RE: Is there any way to hide the input field of Tags of message board portl
May 18, 2012 11:23 AM
Answer

Rochad Tlusty

Rank: Junior Member

Posts: 42

Join Date: January 18, 2012

Recent Posts

I should also add that you probably want to remove the suggestions as well, as it can create new tags based on keywords in the body (probably undesirable for you).
Quang Tran Minh
RE: Is there any way to hide the input field of Tags of message board portl
June 13, 2012 10:40 PM
Answer

Quang Tran Minh

Rank: New Member

Posts: 11

Join Date: May 2, 2012

Recent Posts

Rochad Tlusty:
I should also add that you probably want to remove the suggestions as well, as it can create new tags based on keywords in the body (probably undesirable for you).



After taking my final exams, I found a solution for my problem.
First step: we need to look at all the files in message_boards portlet folder, then the code to create "insert tags" function is in line 308 of edit_message.jsp
1<aui:input name="tags" type="assetTags"/>

Our brain may raise a question: "How does this thing work? I do not understand.". For more understanding, we need to break down the tag a little into its separate parts:
1_ aui
2                 _ input
3                 _ assetTags

Next step: These things are liferay params, so where are they? Let's look at this path:
1  tomcat-server\webapps\ROOT\WEB-INF\tld\liferay-ui.tld

In this file (liferay-ui.tld), we search for anything related to assetTags. After looking that file, we will see these lines
 1 <tag>
 2        <name>asset-tags-selector</name>
 3        <tag-class>com.liferay.taglib.ui.AssetTagsSelectorTag</tag-class>
 4        <body-content>JSP</body-content>
 5        <attribute>
 6            <name>className</name>
 7            <required>false</required>
 8            <rtexprvalue>true</rtexprvalue>
 9        </attribute>
10        <attribute>
11            <name>classPK</name>
12            <required>false</required>
13            <rtexprvalue>true</rtexprvalue>
14        </attribute>
15        <attribute>
16            <name>contentCallback</name>
17            <required>false</required>
18            <rtexprvalue>true</rtexprvalue>
19        </attribute>
20        <attribute>
21            <name>curTags</name>
22            <required>false</required>
23            <rtexprvalue>true</rtexprvalue>
24        </attribute>
25        <attribute>
26            <name>focus</name>
27            <required>false</required>
28            <rtexprvalue>true</rtexprvalue>
29        </attribute>
30        <attribute>
31            <name>hiddenInput</name>
32            <required>false</required>
33            <rtexprvalue>true</rtexprvalue>
34        </attribute>
35    </tag>

This is what we are looking for. To find the path to the JSP, its stored in the tagclass.
1 <tag-class>com.liferay.taglib.ui.AssetTagsSelectorTag</tag-class>

In the java class, you'll see a variable with the path to the JSP:
1 private static final String _PAGE = "/html/taglib/ui/asset_tags_selector/page.jsp";

In the JSP file (page.jsp), there is a div:
1<div class="lfr-tags-selector-content" id="<%= namespace + randomNamespace %>assetTagsSelector">
2    <aui:input name="<%= hiddenInput %>" type="hidden"/>
3
4    <input class="lfr-tag-selector-input" id="<%= randomNamespace %>assetTagNames" size="15" type="text"/>
5</div>


All we need is to add the attribute disabled="disabled" to the input tag in order to prevent any input from users.
After that, to remove "Add" button with "plus" icon, lets look at
1\html\js\liferay\asset_tags_selector.js

Take a deeper look at line 398 to line 439:

 1var toolbar = [
 2                            /*{
 3                                handler: {
 4                                    context: instance,
 5                                    fn: instance._onAddEntryClick
 6                                },
 7                                icon: 'plus',
 8                                id: 'add',
 9                                label: Liferay.Language.get('add')
10                            },*/
11                            {
12                                handler: {
13                                    context: instance,
14                                    fn: instance._showSelectPopup
15                                },
16                                icon: 'search',
17                                id: 'select',
18                                label: Liferay.Language.get('select')
19                            }
20                        ];

The variable toolbar stores 3 buttons, which are add, select and suggestions, all we need is put a comment block to "add" codes like the code above.
We finish here.