Forums de discussion

Link to community page

fastbob fastbob, modifié il y a 15 années.

Link to community page

Regular Member Publications: 221 Date d'inscription: 16/05/05 Publications récentes
Greetings,
I've figured out how to create private communities from my code, but I'm still a bit confused in another area. I need to create a link to the private community from another location, similar to the link found under "My Places" for that community's private pages. Do I use the Layout, Portlet, Group, or something else? I'm also not clear whether I want to retrieve a friendly or unfriendly URL.

Thanks.
thumbnail
Rishi Dev Gupta, modifié il y a 15 années.

RE: Link to community page

Expert Publications: 255 Date d'inscription: 23/11/08 Publications récentes
Hi fastbob

While creating the link to communities, you should know the friendlyURL for the community that is available in _group liferay table, after that you need to give the friendly url of the page on which you wont to redirect otherwise you will be shown the first page of the community by default.
It would be something like this

/web/{community friendly url}/{friendly url of page}


or

if you don't know the page name

/web/{community friendly url}/
fastbob fastbob, modifié il y a 15 années.

RE: Link to community page

Regular Member Publications: 221 Date d'inscription: 16/05/05 Publications récentes
Thanks for responding. I was actually hoping there was a method call that would return the entire URL string, but I guess I'll have to add the prefix myself.
thumbnail
Rishi Dev Gupta, modifié il y a 15 années.

RE: Link to community page

Expert Publications: 255 Date d'inscription: 23/11/08 Publications récentes
Hey fastbob

I misunderstood your query and infact I replied on how to create the link to some liferay page.

The answer to you query is
If you see the init.vm under theme, you will find the following lines of code


      #set ($community_name = $page_group.getDescriptiveName())

	#set ($my_places_portlet_url = $portletURLFactory.create($request, "49", $page.getPlid(), "ACTION_PHASE"))

	$my_places_portlet_url.setWindowState("normal")
	$my_places_portlet_url.setPortletMode("view")

	$my_places_portlet_url.setParameter("struts_action", "/my_places/view")
	$my_places_portlet_url.setParameter("groupId", "$page.getGroupId()")
	$my_places_portlet_url.setParameter("privateLayout", "false")

	#set ($community_default_public_url = $my_places_portlet_url.toString())

	$my_places_portlet_url.setParameter("privateLayout", "true")

	#set ($community_default_private_url = $my_places_portlet_url.toString())



The above defined velocity variables are used in dock.vm which is responsible for showing the links for my places and the code is

             #if ($show_my_places)
			<li class="my-places">
				<a>$my_places_text</a>

				$theme.myPlaces()
			</li>
		#end


Using this code will allow you to create the link to private pages of community

hope this will help!

Regards
Rishi
fastbob fastbob, modifié il y a 15 années.

RE: Link to community page

Regular Member Publications: 221 Date d'inscription: 16/05/05 Publications récentes
Rishi,
Thanks for the help. Although I'm not coding this in Velocity, the method calls give me some leads to follow up.

Bob
thumbnail
Victor Zorin, modifié il y a 15 années.

RE: Link to community page

Liferay Legend Publications: 1228 Date d'inscription: 14/04/08 Publications récentes
Sample of code to find out which communities the user belongs to and making URLs for them. You may also look into portal.properties to check whether /web and /group is defined their.

// htpp://www.MyOffice24x7.com
// Liferay4.1.2 - Liferay5.1.2
// com.myoffice.erms.tier.presentation.portlet.groups.action.RenderViewAction
// ....
public ActionForward render(ActionMapping mapping, ActionForm form,	PortletConfig config, RenderRequest req, RenderResponse res)	throws Exception {
  long companyId = PortalUtil.getCompanyId(req);
  long userId = PortalUtil.getUserId(req);
  LinkedHashMap<string, object> groupParams = 	new LinkedHashMap<string, object>();
  groupParams.put("usersGroups", new Long(userId));
  java.util.List<group> communities = 	GroupLocalServiceUtil.search(	companyId, null, null, groupParams, -1, -1);
  java.util.Iterator<group> iterator = communities.iterator();
  while (iterator.hasNext()) {
    Group community = iterator.next();
    community = community.toEscapedModel();
    logger.info("community name " + community.getName());
    int publicCount = community.getPublicLayoutsPageCount();
    int privateCount = community.getPrivateLayoutsPageCount();
    if(publicCount &gt; 0)
    {
      logger.info("public area URL : " + "/web" + community.getFriendlyURL());
    }
    if(privateCount &gt; 0)
    {
      logger.info("private area URL : " + "/group" + community.getFriendlyURL());
    }
  }
  // ....
}
</group></group></string,></string,>
fastbob fastbob, modifié il y a 15 années.

RE: Link to community page

Regular Member Publications: 221 Date d'inscription: 16/05/05 Publications récentes
A belated thanks!

Bob
Bala raju G, modifié il y a 15 années.

RE: Link to community page

New Member Publications: 10 Date d'inscription: 08/01/09 Publications récentes
hi all,

me also facing the same problem,

in my web application, in every page i have a footer with four links,

each link has to redirect to some other page,
likewise when you click on "feedback" link it has to navigate to other portlet (which is physically not present)

for that i am generating the url using portletURLFactory.create() method,

finally, when you click on the feedback link it is showing the same page where you are now

can any one tell me the solution to navigate to the correct page

thanks
balu
John Croft, modifié il y a 14 années.

RE: Link to community page

New Member Publications: 11 Date d'inscription: 15/02/10 Publications récentes
I'm looking for the same information, how do I get the default private page for a user.

It appears that the velocity variable $community_default_private_url should get me what I want.

So based on a demo (Joe Bloggs) setup I would like the user to end up on /user/test/home. However the url looks like...

/web/guest/home?p_p_id=49&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&_49_struts_action=%2Fmy_places%2Fview&_49_groupId=10137&_49_privateLayout=true

and simply makes the page refresh.

How do I get the link that I want?