留言板

Problems to make asset publisher and tags navigation portlets work togethe

thumbnail
Maese Theobald,修改在14 年前。

Problems to make asset publisher and tags navigation portlets work togethe

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Hello

We are trying to work with tags navigation and asset publisher portlets but we are having some problems with the tags application.

We have in one page:
- An asset publisher that shows only web contents that have one concrete tag (i. e. TAG_A) and shows some metadata such as tags
- A tags navigation portlet

This works: If we click on an article of the asset publisher, all of them are filtered by this tags (i. e. TAG_B ) and it maintains the general filter configured in the preferences (TAG_A). I mean, it is filtered for those who have TAG_A and TAG_B

But this doesn't work: if we click on a tag of the tags navigation portlet, the asset publisher is filtered by this tag (i. e. TAG_C) but it doesn't apply the TAG_A. I mean, it only filters by TAG_C instead of "TAG_A and TAG_C"
In the URL, it's added something like "&p_r_p_564233524_tag=TAG_C&p_r_p_564233524_folksonomy=true" and we have tested all that we can imagine and configured the asset publisher in all manners but it doesn't work.

Please, how we should do in order to make that the tags navigation work with the asset publisher but without making it "loose" it's filters configured in the configuration.

Many thanks
thumbnail
Maese Theobald,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Ufff, probably we have tested all combinations in the request thinking that the "merge" for "entries" done in the asset publisher code would solve the problem but we have no (good) news.

It seems such as the asset publisher couldn't work at the same time with the "configured" tag and the one it gets from the tags navigation portlet.

In case of extension needed, how it should be (without having to rewrite the whole asset publisher code :-) because I'm sure that it's just a little thing needed in maybe the view, init, ... or something like that.

Many thanks
thumbnail
Amos Fong,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
Hi Maese,

Good news (I hope). I think it's just small change neede in init.jsp

Take a look at this logic:

String tag = ParamUtil.getString(request, "tag");

String[] entries = null;

if (Validator.isNull(tag)) {
	entries = preferences.getValues("entries", new String[0]);
}
else {
	entries = new String[] {tag};

	PortalUtil.setPageKeywords(tag, request);
}


It should be adding the tag instead of replacing the whole array.
thumbnail
Maese Theobald,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Ummmm, in case of no tag, I'm nearly sure it works because the if branch seem quite simple.

However, when you have the "tag" in the URL (because of the Tags navigation portlet... I'm not totally sure about the else branch because I don't know what the second line does.
I mean...
11 entries = new String[] {tag};

...is the line present by default in the init.jsp and puts the tag get from the request in the entries array.
But, the second one, not present int the default init.jsp...
PortalUtil.setPageKeywords(tag, request);

...what does it really do? doesn't it put again the tag in te request? does it add the tag to the array? (the array has been initialized in line 11).
If so, what about the "mix" between the preferences tag and the one selected in the tag navigation?

If it didn't work, could be a solution if we put in the array two things: something similar to...
entries = new String[] {tag, preferences.getValues("entries", new String[0]));

...I mean, trying to concatenate in the entries array the preference tags and the selected tag.
Or is this just what the 12 line does?

Ummm, ummm, I can't predict it before testing it and I promise I'll test tomorrow just when arriving to work.

I'll keep you informed in case of success
thumbnail
Amos Fong,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
Oh sorry, I probably copied those lines from a different version of Liferay than you.

PortalUtil.setPageKeywords(tag, request);

This doesn't affect the tag searching. It's setting keywords for the actual page.

...I mean, trying to concatenate in the entries array the preference tags and the selected tag.


Yes they should be concatenated for what you want to do.
thumbnail
Maese Theobald,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Don't worry Amos and many thanks again because, probably, you have push the launch button :-)

I'll write here the results of tomorrow tests.
thumbnail
Maese Theobald,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Success!

I post the code just in case it can be useful for somebody...

String tag = ParamUtil.getString(request, "tag");

String[] entries = null;
String[] arrayTagTMP = null;
String[] arrayEntriesTMP = null;

if (Validator.isNull(tag)) {
	entries = preferences.getValues("entries", new String[0]);
}
else {
	//entries = new String[] {tag};
	arrayTagTMP = new String[] {tag};
	arrayEntriesTMP = preferences.getValues("entries", new String[0]);
	entries = ArrayUtil.append(arrayEntriesTMP, arrayTagTMP);
}


In the init.jsp...
- New lines added: 4, 5, 12, 13, 14.
- Commented: line 11.
thumbnail
Lucas Roberto Thomaz,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Regular Member 帖子: 138 加入日期: 09-7-21 最近的帖子
Works very good for me.

Thanks my friend.

Best Regards,

Lucas Thomaz
thumbnail
Maese Theobald,修改在14 年前。

RE: Problems to make asset publisher and tags navigation portlets work toge

Junior Member 帖子: 64 加入日期: 09-9-8 最近的帖子
Really? Works for the abstracts display or for table list?

The only different thing from the instructions I'm doing is (I think):
- The name of my variable: instead of "articleURL" we use the one defined in the abstracts.jsp by default: viewFullContentURL
- We are trying with abstracts view instead of table list.

Please, could be any other possible difference or problem or mandatory configuration in the asset publisher so that it works?

Mant thanks