Foren

Access to available Communities in the theme

thumbnail
Brett Conoly, geändert vor 14 Jahren.

Access to available Communities in the theme

Regular Member Beiträge: 130 Beitrittsdatum: 19.07.07 Neueste Beiträge
Hey all,
We're working on a design that involves many different functional communities. Some users will have access to some communities while others will have access to different communities. We've taken out the menu in the top right out of our theme and we're trying to create a menuing system for the navigation. This menuing system needs access to all of the communities that the user has access to and then all of the pages within those communities. Does anyone know if liferay theme variables can get us access to these requirements, an easy way to implement this, etc?
Thanks in advance
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
thumbnail
Brett Conoly, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Regular Member Beiträge: 130 Beitrittsdatum: 19.07.07 Neueste Beiträge
Hmmm, I checked out your links and your my places portlet looks much like the code in the page.jsp used for the myPlaces tag. Currently I can get the list of communities using the $user.myPlaces field but what I really need if at all possible are the list of private pages within each community.

I've been looking all over and I'm guessing there's a utility class somewhere that I can pass a group to in order to get its pages but I still can't seem to find that. I'm officially stuck here, I can get the communities and I can get the pages if I'm in a community but I'd like to allow the user to navigate from any page in one community to any page in another community (part of our product design to support a pleasant user experience).

If I can find a utility to get the communities private pages I plan on adding what I need to the ServicePreAction so I can access them in the theme.

Thanks for the help, looking forward to a response,
Brett
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
what I really need if at all possible are the list of private pages within each community

Below I have put a sample code that builds up a list of pages for a community, it is an extract from MyTabs portlet, that
has been released to Community Plugins. This should give a basic idea of how to iterate through available pages for private and public areas of a liferay Group, which could be an organization, user pages, community, etc.

	private void buildLayouts(
			Group community, boolean isPrivate, 
			Locale locale, 
			java.util.ArrayList<mytabconfigdisplay> list,
			ConfigForm cform) throws Exception
	{
		java.util.Iterator<layout> it = LayoutLocalServiceUtil.getLayouts(community.getGroupId(), isPrivate).iterator();
		while(it.hasNext())
		{
			Layout page = it.next();
			if(page.getParentLayoutId() == 0)
			{
				String name = page.getName(locale);
				String path = community.getName();
				if(isPrivate)
				{
					path += "(private)";
				} else
				{
					path += "(public)";
				}
				path += " &gt; " + name;
				MyTabConfigDisplay tab = new MyTabConfigDisplay();	
				tab.setPath(path);
				tab.setGroupId(page.getGroupId());
				tab.setGroupName(community.getName());
				tab.setLinkId(page.getLayoutId());
				tab.setLinkUrl(page.getFriendlyURL());
				tab.setName(name);
				tab.setPrivateFlag(isPrivate);
				tab.setSelectedFlag(cform.contains(tab));
				list.add(tab);
				this.getSubpages(
						community.getName(), tab.getPrivateFlag(), path, page, locale, 
						list, cform);
			}
		}		
	}
	
	private void getSubpages(
			String communityName, boolean privateFlag, 
			String path, Layout parent, Locale locale, 
			java.util.ArrayList<mytabconfigdisplay> list,
			ConfigForm cform) throws Exception
	{
		java.util.Iterator<layout> it = parent.getChildren().iterator();
		while(it.hasNext())
		{
			Layout page = it.next();
			String pageName = page.getName(locale);
			String newPath = path + " &gt; " + pageName;
			MyTabConfigDisplay tab = new MyTabConfigDisplay();		
			tab.setPath(newPath);
			tab.setGroupId(page.getGroupId());
			tab.setGroupName(communityName);
			tab.setLinkId(page.getLayoutId());
			tab.setLinkUrl(page.getFriendlyURL());
			tab.setName(pageName);
			tab.setPrivateFlag(privateFlag);
			list.add(tab);
			getSubpages(communityName, privateFlag, newPath, page, locale, list, cform);
		}		
	}
</layout></mytabconfigdisplay></layout></mytabconfigdisplay>
thumbnail
Brett Conoly, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Regular Member Beiträge: 130 Beitrittsdatum: 19.07.07 Neueste Beiträge
Awesome, that looks like it'll be exactly what I was looking for. Thanks for the help
thumbnail
Victor Zorin, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
This code is executed when community owner goes through MyTabs->Preferences. An Ajax popup provides a list of pages for selection. Have a look at online manual for this portlet, screendump is at Step 4.
By the way, simplified public version of MyPlaces portlet is scheduled for community plugins release this week.
thumbnail
leandro s smal, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

New Member Beiträge: 17 Beitrittsdatum: 17.03.08 Neueste Beiträge
Since communities are totally public for a single instance ,anyone can be member of any instance.
We also needed the same requirement : (Quote) "We're working on a design that involves many different functional communities. Some users will have access to some communities while others will have access to different communities".

As we weren't able to achieve that, we choose to use the multiple instance approach where each instance will have a group of communities.Can you please describe what is you implementation so far?.
You modified the communities portlet to only allow certain users?.What about the other functionality?.
Any help will be appreciated.
thumbnail
Brett Conoly, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

Regular Member Beiträge: 130 Beitrittsdatum: 19.07.07 Neueste Beiträge
We don't have too much implemented so far but I do know that users need to be added to the communities in order to have access to them. The plan for our structure involves:

Communities (functional products) -> Organizations (Business Customers) -> Users (Customer employees)

The communities that the organizations belong to will determine what "places" the users see in their navigation. When the user hovers over a community name the plan is to show them the pages within that community so that they can navigate directly to a subpage of another product.

We're also planning on using only private pages, if the user doesn't have any private pages available in the community we won't display that community in the navigation.

Hope this helps,
Brett
thumbnail
leandro s smal, geändert vor 14 Jahren.

RE: Access to available Communities in the theme

New Member Beiträge: 17 Beitrittsdatum: 17.03.08 Neueste Beiträge
One approach we thought of was to filter users in the entry point of a community. Creating our own communities portlet where only certain communities will be listed.
But If the user tries to access directly the community ,for example someone ping him the url, the liferay core wont prevent that for user who are not supposed to see it.
I think a private page as you did will do this task but will not allow anyone ,excepting the ones who are already members.Remember we want to allow foreign users, if they are allowed, to see ,for example a post in the community.

Since we try to avoid modifying core code ,the multiple instance approach was so far the only doable.