Chapter 4. Creating Your Own Portal

Create your extension project
Portal, pages and menus structure
Page layout
Visibility of pages
Customize your portal

When working with eXo, it is important to not modify the source code. This will ensure compatibility with future upgrades, and will simplify support.

To customize your portal, you need to create an extension project by providing your own artifacts as a set of wars/jars/ears.

A custom extension contains two mandatory items:

A sample extension package is provided here: http://anonsvn.jboss.org/repos/gatein/portal/trunk/examples/extension/

Once you have modified the sample extension to build your own, use "maven clean install" to create the archive files.

To deploy your extension in Tomcat, follow these steps:

  • Add the file sample-ext.war from sample/extension/war/target/ to the tomcat/webapps directory.

  • Add the folder starter from starter/war/target/ to the tomcat/webapps directory.

  • Rename the directory (unzipped folder) starter to starter.war.

Note

This will only work if the starter.war is the last war file to be loaded, so you may need to rename it if your war files are loaded in alphabetical order.

  • Add the jar file exo.portal.sample.extension.config-X.Y.Z.jar from sample/extension/config/target/ to the tomcat/lib directory.

  • Add the jar file exo.portal.sample.extension.jar-X.Y.Z.jar from sample/extension/jar/target/ to the tomcat/lib directory.

For JBoss deployment and more details, refer to the Reference Guide.

You can create as many pages as you want within a single portal. Permissions can be defined to make them visible only to specific groups and/or users. This chapter describes how to define this structure.

The configuration of the "classic" portal can be found in the directory /src/main/webapp/WEB-INF/conf/sample-ext/portal/portal/classic of your extension webapp.

The portal.xml file describes the layout and portlets common to all the pages of the portal.

As you can see, each portlet can be configured with a set of preferences, which will be further detailed.

The pages.xml file is used to describe the content of the pages of your portal. In other words, what will be inside the <page-body> tag of the portal.xml file above. Here is an example of the classic portal pages.xml.

The navigation.xml is used to associate the links in your navigation (called page-node) with your portal pages.

If the pattern #{} is used then the label of the link will be loaded from the portal resource bundle (link to the ref guide about resource bundles

<?xml version="1.0" encoding="UTF-8"?>
<node-navigation>
<owner-type>portal</owner-type>
<owner-id>classic</owner-id>
<priority>1</priority>
<page-nodes>
<node>
<uri>home</uri>
<name>home</name>
<label>#{portal.classic.home}</label>
<page-reference>portal::classic::homepage</page-reference>
</node>
<node>
<uri>webexplorer</uri>
<name>webexplorer</name>
<label>#{portal.classic.webexplorer}</label>
<page-reference>portal::classic::webexplorer</page-reference>
</node>
</page-nodes>
</node-navigation>

This navigation tree can have multiple views inside portliest, such as breadcrumbs that render the current view node, the site map or the menu portlets.

Note

For top nodes, the URI and the navigation node name must have the same value. For the other nodes, the URI is composed like <uri>contentmanagement/fileexplorer</uri> where 'contentmanagement' is the name of the parent node and 'fileexplorer' the name of the node (<name>fileexplorer</name>).

One of the first steps in any web project is to integrate a graphic chart. This can be done entirely within your extension, by customizing the portal configuration.

In order to add a JavaScript library (for example JQuery), follow these steps:

For example: