Wednesday, June 18, 2008 5:50:11 PM
portal.properties is located in portal-impl.jar. To overwrite properties, create a file called portal-ext.properties in <context root>/WEB-INF/classes/.
To make sure your properties have been applied, go to Admin->Server->Portal Properties.
Useful properties:
User layouts
default.user.layout.column-1 (Portlet ids to be placed in layout column)
default.user.layout.column-2
default.user.layout.column-3
default.user.layout.column-4
default.user.layout.name
default.user.layout.template.id
Default theme
default.regular.theme.id
Post-login page
default.landing.page.path
To get theme and portlet plugin ids, go to the Enterprise Admin->Plugins->(Portlet/Theme)-><Portlet in the plugin>. In the entry there should be Portlet ID with an id after it.
Wednesday, June 18, 2008 5:32:42 PM
I'll make this short since it is pretty much the same as setting up a portlet plugin, except they are created in the theme directory. More so than the portlets, copying an existing one is very easy since there are fewer configuration files to edit.
Important note:
Changes to anything, templates, images, css, etc, are done in the _diff directory. These changes are supposed to be changes from the Classic theme. Do not change anything in non _diff directories except for WEB-INF. These changes will get overwritten on build. It appears that the build copies the Classic theme then overwrites files with those in _diff.
Wednesday, June 4, 2008 5:45:22 PM
I wasn't able to find many examples or other documentation on using jQuery in plugins, so it was more or less guess and hope it works. In the end, I got it working. Here are the steps:
1. Nothing! jQuery is already set up in Liferay.
A bit more serious: How to get jQuery plugins working in a Liferay plugin.
1. Modify the jQuery plugin by searching for all uses of the $ variable and replacing them with jQuery (Ignore uses of variables with $ in them, as in $document etc, so be careful doing find-replace.). If this is not done, you will likely disable the functionality of all other javascript in the portal.
2. In ${Plugin_Root}/docroot/WEB-INF/liferay-portlet.xml, add a <header-portlet-css> entry that points to the location of every css file needed for the plugin.
3. In ${Plugin_Root}/docroot/WEB-INF/liferay-portlet.xml, add a <header-portlet-javascript> entry that points to the location of every javascript file for the plugin. Note, you do not need to add references to jQuery scripts, they are already present.
Issues:
- Only issue I've seen so far is that $ is not supported by Liferay at all, plugin or not.
Wednesday, June 4, 2008 5:04:02 PM
Most of this pdf for the 4.3.0 plugin SDK applies to 5.0.1
http://docs.liferay.com/4.3/official/liferay-43-plugins-guide.pdfPlugin SDK setup
- Download and extract the plugins SDK to a directory of your choosing, referred to as ${SDK_Root}.
- Create ${SDK_Root}/build.${User_Name}.properties
- Override needed properties in your new .properties file. See ${SDK_Root}/build.properties for properties you can override. Read substeps for properties you will likely change
- app.server.parent.dir -> Points to your Tomcat home directory.
- javac.memoryMaximumSize -> default of 256m may be enough, increase if you get out of memory errors building plugins.
Plugin PortletCreating portlet: 2 options (${Plugin_Root} refers to plugin's root directory. All portlet plugins reside in ${SDK_Root}/portlet. ${portlet_id}(1 word) and ${portlet_name}(1+ words) are as their names imply).
- For a blank portlet, run this:
- ${SDK_Root}/portlet/create.(bat or sh depending on OS) ${project_id} "${project_name}"
- Copy an existing portlet plugin. See substeps for a list of additional steps. All these files are located in ${Plugin_Root}/docroot/WEB-INF/
- liferay-display.xml -> set the portlet's id to ${portlet_id}
- liferay-plugin-package.properties -> set the name to ${portlet_name}
- liferay-portlet.xml -> set portlet-name tag to ${portlet_id}
- portlet.xml -> set portlet-name to ${portlet_id} and display-name to ${portlet_name}
- portlet.xml -> set portlet-info properties to desired values, often ${portlet_name} for title, sort-title, and keywords
NOTE: in ${Plugin_Root}/build.xml it may be useful to change the project tag's name property to something descriptive. Some IDEs that integrate Ant will end up displaying "portlet" for all the build files rather than telling which portlet the build file belongs to.
Struts portlet - I strongly recommend using the provided sample-struts-portlet from Liferay as a base to avoid 1 and 2.
- Set up a normal struts webapp. I wont go into detail about the steps, I will assume the user already knows them if they are creating a struts portlet from scratch.
- ${Plugin_Root}/docroot/WEB-INF/web.xml
- Define the struts servlet class as com.liferay.util.bridges.struts.LiferayPortletServlet
- Add a taglib where the uri is "http://portals.apache.org/bridges/struts/tags-portlet.html" and location is "/WEB-INF/tld/struts-portlet-html.tld", without quotes.
- ${Plugin_Root}/docroot/WEB-INF/liferay-plugin-package.properties, add to portal.dependency.jars if not present
antlr.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-io.jar
commons-lang.jar
commons-validator.jar
jcommon.jar
jfreechart.jar
oro.jar
portals-bridges.jar
struts-jar
- ${Plugin_Root}/docroot/WEB-INF/liferay-plugin-package.properties, add to portal.dependency.tlds if not present
struts-bean.tld
struts-bean-el.tld
struts-html.tld
struts-html-el.tld
struts-logic.tld
struts-logic-el.tld
struts-nested.tld
struts-tiles.tld
struts-tiles-el.tld
Struts portlet - Important notes for a struts portlet plugin
- Do not use Liferay's PortletAction class for actions. Doing so causes a class cast exception from a subclass to its parent class, which should not normally happen. This is a known issue that has to do with how plugins work. Instead use the normal struts Action class or create your own in the plugin.
- JSPs in the plugin do not normally have access to Liferay local variables like User user or Layout layout as you would in the ext environment. To gain access to these, insert:
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<liferay-theme:defineobjects />
- Insert these lines for portlet functionality. It is usually located in an init file when creating portlets in Liferay:
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineobjects />
- All other steps to creating the portlet should match steps done in the ext environment.
ServiceBuilder portlet - See sample-service-builder-portlet for an example, I assume the user knows how the Service Builder works in the ext environment. If not, look at the reference or the Reports portlet in the ext environment.
- Create your service.xml file in WEB-INF
- Run build-common-portlet.build-service from the ant build.xml. This will automatically generate the service classes and configurations.
- Add these entries to ${Plugin_Root}/docroot/WEB-INF/liferay-plugin-package.properties portal.dependency.jars if they are not already there:
backport-concurrent.jar
commons-beanutils.jar
commons-collections.jar
commons.configuration.jar
commons-digester.jar
commons-lang.jar
dom4j.jar
easyconf.jar
ehchache.jar
hibernate3.jar
jst1.jar
jst1-impl.jar
spring.jar
xstream.jar
- Creating the rest of the service works the same way as the ext environment.
Important Notes
- Be careful of Liferay dependencies. Some calls to Liferay libraries may work in the ext environment, but may throw exceptions, particularly class cast exceptions, as a portlet.
- Non-Liferay jar dependencies can be included in ${Plugin_Root}/docroot/WEB-INF/lib, tlds to ${Plugin_Root}/docroot/WEB-INF/tld.
- Dependencies to jars and tlds that belong to Liferay should be included using liferay-plugin-package.properties
Friday, May 9, 2008 5:35:25 PM
Major problem:
portal-ext.properties and other non-java files that used to be in the ext-impl/classes directory are no longer being copied to the proper deploy directory. These files were moved to ext-impl/src but the build files don't take this into account and they are skipped during build. Basically, any changes to those files don't get reflected in the portal when run.
Solutions- Manually copy the needed non-java files from ext-impl/src to ext-impl/classes when you are building, or modify the Ant build files to copy those files when building ext-impl/src.
Plugin development:
Plugins don't get access to every library Liferay has access to, so class not found exceptions may occur frequently. This can be fixed by using the dependencies properties file in the plugin
Monday, March 3, 2008 7:16:12 PM
It appears there was a bug with the services that caused Liferay to not start up properly. A solution was found by Jason Robinson on the Liferay forums:
In {ext-directory}\ext-impl\src\com\ext\portlet\reports\service.xml
Change: add "Impl" to the end of "persistence-class="com.ext.portlet.reports.service.persistence.ReportsEntryPersistence""
In {ext-directory}\ext-impl\classes\META-INF\ext-spring.xml
Change: add "Impl" to the end of "class="com.ext.portlet.reports.service.persistence.ReportsEntryPersistence""
Thursday, November 8, 2007 3:23:05 PM
In the original Liferay source code under portal-impl/classes/content are files that define what keys map to when using LanguageUtil.format(). The programmer types in some key that Liferay will take and look up in the files for the user's specified language. To add your own keys goto ext-impl/classes/content and modify the language files there.
Tuesday, July 10, 2007 10:09:41 PM
Getting online users:
To actually find out who was online, we had to use the LiveUsers class. Main problem was that LiveUsers only returns the users in your company that are online. At first I tried to write the code myself but it quickly became confusing since there was no documentation on WebAppPool, which LiveUsers ultimately used to get online users. WebAppPool looks up a map from a company Id and a constant telling what to get, in this case WebKeys.LIVE_USERS. This map appears to be of all online users with a group ID as the key and a Map as the value. LiveUsers just creates a Long object with value 0 for the key. The value is another map, and I didn't figure out what the key was. The values were UserTracker objects that contain user IDs. I tried several attempts, but I kept getting parse errors alternating between Map and Set on the same line, changing to the other when I changed the parse to one of them. I just copied the given code with minor modifications and it works.
Findings on using IM and finding collaborators:
com.liferay.portlet.messaging.util.MessagingUtil.java provides methods to see who is in your buddy list. This would allow us to check with the currently online list to see which names to put the collaborator icon next to. Also, the chatbox.jsp appears to be the source for displaying the chat box. Need to figure out how to create a link to launch the chat box.
Findings on view profile feature:
The previous suggestion of using the Directory portlet to view user profiles does not appear to be correct. The Directory allows you to view the active users, but it does not let you look at more details. Clicking on a user will take you to an edit user screen(Regardless of your assigned role), which most users have no access to.
Friday, July 6, 2007 2:24:28 PM
http://wiki.liferay.com/index.php/Access_to_Liferay_services_in_VelocityThe wiki entry gives the code to get a layout in Velocity. This is also useful for other services in Liferay like user and company.
Tuesday, June 26, 2007 9:02:32 PM
For the themes I'm using Velocity instead of JSP files.
Current features:"user bar"
The bar on the left hand side of the screen is currently defined in a few seperate files. The contents of the bar itself is in user_bar.vm. The right side contains all of the portlets and is defined in body.vm. Both of these are included in portal_normal.vm. The userbar.css file defines css styles specific to user_bar.vm. This is included by custom.css. At the moment custom.css includes the rest of the styles for defining the body, including the positioning of part of the body containing the portlets. Cleaning up and changing the behavior and appearance to closer match the mockups will follow soon.
Modified Navigation
There will be 2 links in the bar (I will remove the Collaborators tab soon). The actual URLs for them are set at the top of the portal_normal.vm file.
Other Notes:http://www.liferay.com/c/document_library/get_file?folderId=882&name=DLFE-1101.xlsThis spreadsheet contains basically a dump of all the values of Velocity variables that were present. The format is the variable name followed by = and the value, either a string or a Java object. This is a very useful resource since as of right now there is no proper documentation of the API for 4.3.0. This file lets us find the source code easily for the needed Java objects.
http://www.liferay.com/c/document_library/get_file?folderId=882&name=DLFE-1102.htmlThis contains some of the Velocity variables in a more easy to read format.
com.liferay.portal.velocity.VelocityVariables is the class that defines all the Velocity variables in the instance. The source for it can be found in the portal-impl directory of the Liferay source.
1 2 Next »