Fórumok

My Places Portlet {RESOLVED}

thumbnail
Chris Whittle, módosítva 15 év-val korábban

My Places Portlet {RESOLVED}

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
Id like to take the my places that is on the dock and put it in a portlet and reformat it.... Has anyone done that or something similar?
Giuseppe Cinque, módosítva 15 év-val korábban

RE: My Places Portlet

Junior Member Bejegyzések: 36 Csatlakozás dátuma: 2007.06.21. Legújabb bejegyzések
Hello,
I too am interested in a my places porltet.

H
Chris Whittle:
Id like to take the my places that is on the dock and put it in a portlet and reformat it.... Has anyone done that or something similar?


Are there news?

A starting point could be the my community portlet.

Regards
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
We've made one and found that it is extremely popular with all clients. Based on MyPlaces but has few customisations, such as community icon, layout (horizontal/vertical), access rights, etc. I've made screendumps for 2 communities with our MyPlaces portlet deployed, here and here. Icons are defined using Community description field within Communities portlet.
thumbnail
Chris Whittle, módosítva 15 év-val korábban

RE: My Places Portlet

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
Any way we could talk you out of the source code? 8^)
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
It is fairly straightforward, but I'll prepare and post some code extracts tonight (Aussie time).
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
Below is an extract from the code.
JSP snippet, this one renders images and links of available (non-empty) communities for given user:

<logic:iterate id="thisPlace" name="staffPlacesList">
		</logic:iterate><table>
	<tbody><tr>
			<td valign="middle" align="right" style="padding: 2px">
			<logic:equal name="thisPlace" property="currentPlaceFlag" value="true">
			<img src="/myoffice-user/images/current_place.png">
			</logic:equal>
			</td>
			<td valign="middle" align="center" style="padding: 2px">
				<a href="<bean:write name=" thisPlace" property="placeUrl"></a>"&gt;
				<img border="0" src="<bean:write name=" thisPlace" property="imageUrl">"/&gt;
				
			</td>
			<td valign="middle" align="left" style="padding: 2px">
				<a href="<bean:write name=" thisPlace" property="placeUrl"></a>"&gt;
					<bean:write name="thisPlace" property="placeName" />
				
			</td>
		</tr>
	
</tbody></table>


RenderAction snippet, a bit too long but self-explanatory:

package com.myoffice.user.portlet.myplaces.action;

// http://www.myoffice24x7.com
// ViewPlacesAction

// ...
	public ActionForward render(ActionMapping mapping, ActionForm form,
			PortletConfig config, RenderRequest req, RenderResponse res)
			throws Exception {
		java.util.Collection<staffplacebean> staffPlacesList = new java.util.ArrayList<staffplacebean>();
		if (req.getRemoteUser() != null) {
			try {
				long companyId = PortalUtil.getCompanyId(req);
				long userId = PortalUtil.getUserId(req);
				long currentGroupId = PortalUtil.getPortletGroupId(req);
				LinkedHashMap groupParams = new LinkedHashMap();
				groupParams.put("usersGroups", new Long(userId));
				// find all communities for this user
				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 = (Group) iterator.next();
					if(community.getName().startsWith("Guest") == false)
					{
					StaffPlaceBean place = new StaffPlaceBean();
					if (community.getGroupId() == currentGroupId) {
						place.setCurrentPlaceFlag(true);
					} else {
						place.setCurrentPlaceFlag(false);
					}
					community = community.toEscapedModel();
					place.setPlaceName(community.getName());
					// fetch community icon url from its' description
					try {
						java.util.Properties props = new java.util.Properties();
						java.io.InputStream stream = new java.io.StringBufferInputStream(
								community.getDescription());
						props.load(stream);
						// logger.info("props=" + props);
						String imageUrl = props.getProperty("icon");
						if (imageUrl != null &amp;&amp; imageUrl.length() &gt; 0) {
							place.setImageUrl(imageUrl);
						} else {
							logger
									.warn("Use community description to set 'icon=' for "
											+ community.getName());
							if (place.getCurrentPlaceFlag()) {
								place
										.setImageUrl("/myoffice-user/images/default_place_selected.png");
							} else {
								place
										.setImageUrl("/myoffice-user/images/default_place.png");
							}
						}
					} catch (Exception e) {
					}
					int publicCount = community.getPublicLayoutsPageCount();
					int privateCount = community.getPrivateLayoutsPageCount();
					if (publicCount &gt; 0) {
						place.setPlaceUrl("/web" + community.getFriendlyURL());
						staffPlacesList.add(place);
					} else if (privateCount &gt; 0) {
						place
								.setPlaceUrl("/group"
										+ community.getFriendlyURL());
						staffPlacesList.add(place);
					} else {
						logger.warn("Community '" + community.getName()
								+ "' does not have any pages configured");
					}
}
					else
					{
						// this is Guest community =, not to be displayed
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		req.setAttribute("staffPlacesList", staffPlacesList);
		return mapping.findForward("view");
	}				
</group></group></staffplacebean></staffplacebean>
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
And for clarity, one more class, StaffPlaceBean:

package com.myoffice.user.portlet.myplaces.form;
// http://www.myoffice24x7.com
// StaffPlaceBean
public class StaffPlaceBean {	
  private String placeUrl;	
  private String placeName;	
  private String imageUrl;	
  private boolean currentPlaceFlag = false;

// ... getters and setters

}
thumbnail
Chris Whittle, módosítva 15 év-val korábban

RE: My Places Portlet

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
ok I'm missing something... I'm able to get it to compile and display but it's not doing anything... It's probably due to my limited experience with struts and struts portlets but here is what I got... Maybe you can fill in the blank... Thanks again for your help(and code)!!!
liferay-portlet-ext.xml
<portlet>
		<portlet-name>my_places_display</portlet-name>
		<icon>/html/portlet/my_places_display/icon.png</icon>
		<struts-path>my_places_display</struts-path>
		<restore-current-view>false</restore-current-view>
		<private-request-attributes>false</private-request-attributes>
		<private-session-attributes>false</private-session-attributes>
		<render-weight>1</render-weight>
		<css-class-wrapper>portlet-my_places_display</css-class-wrapper>
	</portlet>

Portlet-ext.xml
<portlet>
		<portlet-name>my_places_display</portlet-name>
		<display-name>My Places Display</display-name>
		<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
		<init-param>
			<name>view-action</name>
			<value>/my_places_display/view</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
		</supports>
		<resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
	</portlet>

Struts-config.xml
<action path="/my_places_display/view" type="com.ext.portlet.myplaces_display.ViewPlacesAction">
			<forward name="portlet.my_places_display.view" path="portlet.my_places_display.view" />
		</action>

Tiles-def.xml
<definition name="portlet.my_places_display.view" path="/portlet/my_places_display/view.jsp" />


ViewPlacesAction.java
package com.ext.portlet.myplaces_display;

import com.liferay.portal.struts.PortletAction;
import com.liferay.portal.model.Group;
import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;

import java.util.LinkedHashMap;

import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
// http://www.myoffice24x7.com
// ViewPlacesAction

public class ViewPlacesAction extends PortletAction {
    public ActionForward render(ActionMapping mapping, ActionForm form,
            PortletConfig config, RenderRequest req, RenderResponse res)
            throws Exception {
        java.util.Collection<staffplacebean> staffPlacesList = new java.util.ArrayList<staffplacebean>();
        if (req.getRemoteUser() != null) {
            try {
                long companyId = PortalUtil.getCompanyId(req);
                long userId = PortalUtil.getUserId(req);
                long currentGroupId = PortalUtil.getPortletGroupId(req);
                LinkedHashMap<string, object> groupParams = new LinkedHashMap<string, object>();
                groupParams.put("usersGroups", new Long(userId));
                // find all communities for this user
                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 = (Group) iterator.next();
                    if(community.getName().startsWith("Guest") == false)
                    {
                    StaffPlaceBean place = new StaffPlaceBean();
                    if (community.getGroupId() == currentGroupId) {
                        place.setCurrentPlaceFlag(true);
                    } else {
                        place.setCurrentPlaceFlag(false);
                    }
                    community = community.toEscapedModel();
                    place.setPlaceName(community.getName());
                    // fetch community icon url from its' description
                    try {
                        java.util.Properties props = new java.util.Properties();
                        java.io.InputStream stream = new java.io.StringBufferInputStream(community.getDescription());
                        props.load(stream);
                        // logger.info("props=" + props);
                        String imageUrl = props.getProperty("icon");
                        if (imageUrl != null &amp;&amp; imageUrl.length() &gt; 0) {
                            place.setImageUrl(imageUrl);
                        } else {
                            _log.warn("Use community description to set 'icon=' for "
                                            + community.getName());
                           if (place.getCurrentPlaceFlag()) {
                                place
                                        .setImageUrl("/myoffice-user/images/default_place_selected.png");
                            } else {
                                place
                                        .setImageUrl("/myoffice-user/images/default_place.png");
                            }
                        }
                    } catch (Exception e) {
                    }
                    int publicCount = community.getPublicLayoutsPageCount();
                    int privateCount = community.getPrivateLayoutsPageCount();
                    if (publicCount &gt; 0) {
                        place.setPlaceUrl("/web" + community.getFriendlyURL());
                        staffPlacesList.add(place);
                    } else if (privateCount &gt; 0) {
                        place
                                .setPlaceUrl("/group"
                                        + community.getFriendlyURL());
                        staffPlacesList.add(place);
                    } else {
                        _log.warn("Community '" + community.getName()
                                + "' does not have any pages configured");
                    }
}
                    else
                    {
                        // this is Guest community =, not to be displayed
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        req.setAttribute("staffPlacesList", staffPlacesList);
       return mapping.findForward("portlet.my_places_display.view");
  }     
    private static Log _log = LogFactory.getLog(ViewPlacesAction.class);

}</group></group></string,></string,></staffplacebean></staffplacebean>
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
C'mon Chris the Jedi, you can do it!
My apologies, but I've got customised devel.environment and would not be able to do a quick replication of the setup that suits generic deployment. I might make simplified MyPlaces for public downloading, but not within several weeks.
thumbnail
Chris Whittle, módosítva 15 év-val korábban

RE: My Places Portlet

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
LOL, I know I'm so close... I'll keep messing with it and repost something if I can get it figured out.... Thanks again on the code Victor!!!
thumbnail
Victor Zorin, módosítva 15 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
Correction: If using jsp listed above, please add parameter filter="false" to every <bean:write/> tag.

This will prevent character escaping. Eg. if community name is 'Chris - Whittle', ie. contains dash, community name within MyPlaces would contain funky characters. Making filer=false will render it properly.
thumbnail
Chris Whittle, módosítva 15 év-val korábban

RE: My Places Portlet

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
thanks again Victor..... also what I had worked fine all along.. i had just killed my dev db and forgot to recreate my communities so all I had was the default organizations and the guest community (which to all you just tuning in don't show)...
thumbnail
Victor Zorin, módosítva 14 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
Public version of MyPlaces portlet has been placed into Liferay Community Plugins section.

To maintain a uniform 'single space' navigational and look-and-feel experience, reciprocal groupwise MyPlaces plugins are also under development for related web applications, such as Alfresco CMS, Bedework calendars, LMS, etc. Will give a link when demo deployments become available.
thumbnail
Chris Whittle, módosítva 14 év-val korábban

RE: My Places Portlet

Expert Bejegyzések: 462 Csatlakozás dátuma: 2008.09.17. Legújabb bejegyzések
Nice saw the screenshot and once we get to 5.2 we'll retire ours...
Hany Morris Mesha, módosítva 14 év-val korábban

RE: My Places Portlet

New Member Bejegyzések: 4 Csatlakozás dátuma: 2009.07.28. Legújabb bejegyzések
I saw this portlet and it's wonderful. That's exactly what I was looking for. Can I use it with version 4.3?

Thanks,

Hany
thumbnail
Victor Zorin, módosítva 14 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
Hi Hany, there is no specific reliance on portal version features in a portlet, Portal Service APIs that are used in the portlet have not been modified substantially since v4 , but deployment have changed a bit. You may try to modify files in WEB-INF to lower the spec numbers and see if it deploys. I suppose a special backward build can be made for 4.3 but you would have to go through the ordering process.
thumbnail
Victor Zorin, módosítva 12 év-val korábban

RE: My Places Portlet

Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
Downloads for MyPlaces portlet and associated hooks for Liferay V6.0.1+ and Liferay V6.1.0+ have been made available at http://www.myoffice24x7.com/web/myplaces-portlet. It will also be moved out from Liferay Plugins repository.
Akshata Joshi, módosítva 12 év-val korábban

My Places Portlet

New Member Bejegyzések: 4 Csatlakozás dátuma: 2011.08.25. Legújabb bejegyzések
Hello,

I am a newbee for liferay.. i am currently using 4.2 version. I login as admin, click on MY Places --> Guest--> Private pages(1)....

it gets logout.. I am not able to fix this issue...

Please guide me.. It is a very critical iisue...

Thank you