Foren

Portlet Name, Css, and Scope

Baris Sener, geändert vor 14 Jahren.

Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Hello guys,

I have a few questions about portlets.

1. How do I change a portlet's title permanently? For example change "Summary" to "My Profile".

2. I created a custom portlet but I want its scope to be current page. Like message board and file manager. I want to have different instances of it in different pages of a community.

3. How do I change a portlet's css permanently? For example changing the links in "Site Map" portlet to act like tabs; change background when a:hover, etc.

Thank you,
Baris
thumbnail
Olaf Kock, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
Two quick answers

Baris Sener:
1. How do I change a portlet's title permanently? For example change "Summary" to "My Profile".


I'd hunt for the translation files (Language_en.properties or any local one). Overriding them can happen by patching your installation (very un-elegant), the ext environment or - if I got that right - by hooks.

Baris Sener:
3. How do I change a portlet's css permanently? For example changing the links in "Site Map" portlet to act like tabs; change background when a:hover, etc.


This is done in themes. Every portlet is contained in a css class that reflects its identity - for the portlet class as well as for the instance. In a theme you generally hunt for the portlet class, not the identity. Download the plugins SDK, create a theme and modify docroot/_diffs/css/custom.css as you like. Firebug is a valuable tool for determining what you need to change.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Thank you so much. Do you have any ideas about number 2?

Baris
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
I guess I can just add the same portlet with different names, but it'll really inefficient; I'm planning on using at least 10 instances of the portlet. Someone please help...

Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
On item 2, the solution is subject to your specific requirements. You may use the following features available within portal:
- when portlet gets deployed, it has own set of portlet preferences created. You can modify preferences and use them at run-time on per instance basis. That's quite common feature.
- when portlet submits data, use portlet instance id or parameter from configured preference for marking your data with instance id.

The above is scope per instance. If you need scope per page, use place Id, scope per community - groupId, etc. You can make it scope per user, exactly the same way. That's why it is good to use portlet preferences to define level of scope for your portlet.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Hello Victor,

Thank you for your answer. I think I need scope per instance, but how do I do it? What files do I need to look into? Do I need to create new files or just change a setting?

Thanks,
Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Well as long as it is clear that you will have to implement an additional scope-specific key element (and/or db column) that is going to be used when storing and retrieving data by your scoped portlet. Let's call it ' scopeKey' .

Just a couple of cases:
1. page scope
scopeKey will be made from layout.getPlid() as it is always unique per page.
On vm level you can use:
<input type="hidden" name="scopeKey" value="$themeDisplay.getLayout().getPlid()">


2. instance scope
2.1. if you want to dig deep into liferay, you can use PortletPreferences id, (see portal db). This is the SQL to view all current instances:
SELECT     portletPreferencesId, ownerId, ownerType, plid, portletId, preferences 
FROM         PortletPreferences
ORDER BY portletId


2.2. otherwise, you may construct scopeKey as the sum of placeId and namespace. This gives you a unique value per deployed portlet.
layout.getPlid() + portletResponse.getNamespace()
or
layout.getPlid() + portletResponse.getNamespace().hashCode()

There are probably even better ways of making those keys. But it is more really an issue of managing your backend data and access to it. E.g. when you remove portlet from the page, your instance-specific data will become stale immediately, you should be able to handle full lifecycle appropriately.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Victor,

I understand what I need to do, but I'm not sure how to do it. For example when you say vm level, which vm file do you mean? There aren't any vm files in my portlet. If I decide to use page scope since it is easier to implement, are there any other changes I need to make? Or do I just get the portlet to create a new key element and that's it?

Thanks,
Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Baris, it is pretty hard to build generic theory without knowledge of the subject .
What do you have to do in your portlet? How do you structure your data, where is it stored, how do you access it, what are the actions, what are the views, etc.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
It is a video conference portlet, it uses TokBox. Right now, when you add the portlet to a page it shows people's web cam that are on the website. I want to limit this to show the people's webcam that are on the current page.

Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Hey Baris, that would really be a realy handy capability. However I do not think that this requirement would qualify for standard 'scoping' functionality. What I was mentioning before was more about portlet-scope-specific data storage and retrieval. Here is probably something about making a separate data stream.
I'll have a look inside your zip file this weekend.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Hello Victor,

Thank you so much. I really appreciate your help. I'll be waiting emoticon

Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Had a quick look, but to have a complete answer, manual for tokbox shall be analyzed:
- does it allow for several simultaneous talk groups from single camera? [if no, you can have only one video flash per portal page, therefore using page id only]
- does it allow for multiple independent talk groups from single website?
- if yes, which object parameter (or url) shall be set to allocate such independent video channel?

After this, you can construct channel id dynamically, based on page id and/or portlet namespace. All this data is available at jsp level.
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
It allows to have different chat rooms within one website, but not with this portlet. For example if I change the name of the portlet and deploy it; it'll still show the same chat room, even if it is on a different page. There is videoparty application but it is php, and it doesn't work with Liferay for some reason. I guess it is about the code that makes the call to Tokbox, not about Liferay.

Baris
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
testing testing
Baris Sener, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Scope

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
Hello Victor,

I solved my problem. Thank you for your help. I solved it through the Tokbox end.

Thanks,
Baris
Senthil Chockalingam, geändert vor 14 Jahren.

Portlet Name, Css, and Portlet Icon

Junior Member Beiträge: 58 Beitrittsdatum: 18.01.10 Neueste Beiträge
Hi,
we have doubt that we are using web content display portlet in all pages. actually we want t0 change the icon as individual. Using Css can we change it???. Reply ASAP.
thumbnail
Olaf Kock, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Portlet Icon

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
I don't fully understand what you want to do: Do you mean that you want every article to have a different Icon - e.g. not the Web-Content-Portlet-Icon but one that is determined by the article or category or similar? In this case you might want to disable the default icon by default and go for a structure/template solution that handles your choice of icon depending on the content of the structure (or on the choice of the template).

There are more possibilities to do this, but as I don't understand if this is what you want, I don't want to get too much into details. Please give an example, e.g. a screenshot or mockup, of what you're trying to accomplish.
Senthil Chockalingam, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Portlet Icon

Junior Member Beiträge: 58 Beitrittsdatum: 18.01.10 Neueste Beiträge
Hi Friendemoticon,

In a page we have used 3 Web content display portlet (i.e one section for News, one for Announcement and one for Recent Trends). we have placed this 3 sections in a page. Using Advancing Css Style option, we've changed individual Portlet Title-bar color, font,etc. But how we can change the icons for those Portlet(i.e we want to place 3 different icons for 3 portlet[Portlet Name:Web Content Display]. ???emoticon
thumbnail
Olaf Kock, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Portlet Icon

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
I'd say: Don't hunt for the WebContent portlet icon, rather remove the border in the portlet's look and feel. The icon will disappear.

Then use a structure/template or css for the resulting article to add styling as you desire.

Another way to try would be to style the articles with Javascript (e.g. jquery selectors), but I believe that this is "wrong": The icon is that of the portlet, not that of the content.
Senthil Chockalingam, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Portlet Icon

Junior Member Beiträge: 58 Beitrittsdatum: 18.01.10 Neueste Beiträge
Hi,

I have one more doubt, Using Css we have fixed the width for the page, but how to fix the portlet content width?. For Example if the Poll display portlet width is expanded than Page Layout Width
thumbnail
Olaf Kock, geändert vor 14 Jahren.

RE: Portlet Name, Css, and Portlet Icon

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
Do you want to expand the portlet to the available space (e.g. width 100%, relative to surrounding div) or is it too wide to fit into the surrounding content (e.g. because of an image). In the later case you might want to look into the "overflow" options of css (like: scroll, cut, expand). I'm not certain about the vocabulary plus I'm on a flaky internet connection, so you'll have to look it up yourself.
Senthil Chockalingam, geändert vor 14 Jahren.

RE: Calendar Portlet (Editing)

Junior Member Beiträge: 58 Beitrittsdatum: 18.01.10 Neueste Beiträge
Hi Friend,

I want only the Year Tab and Event Tab in Calendar Portlet.

Can you help me on this ....