A good feature of GateIn is that the skin is divided in modules. You can therefore update the skin of just a part of the site, for example the toolbar, the breadcrumbs, the logo, or the footer. The build of the skin is highly complex, so in this recipe, we will describe how to create a skin and how to take an existing skin from a site and import it. We will use the Google toolbar as an example.
A skin is a graphic work, so you will need a graphic tool. The open source software program GIMP is recommended. As an example, we will use the theme of iGoogle simply by connecting to http://www.google.com.
GIMP is the GNU Image Manipulation Program. It is a freely distributed piece of software for tasks such as photo retouching, image composition, and image authoring. It works on many operating systems, and in many languages. For more information visit http://www.gimp.org
Follow these steps to create a new toolbar to add in your portal:
deploy
directory of the application server as WAR file. This is the scheme of the application:web.xml
file is needed for GateIn applications:<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>google-skin</display-name>
<filter>
<filter-name>ResourceRequestFilter</filter-name>
<filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResourceRequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>GateInServlet</servlet-name>
<servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>GateInServlet</servlet-name>
<url-pattern>/gateinservlet</url-pattern>
</servlet-mapping>
</web-app>
gatein-resources.xml
: …
<portal-skin>
<skin-name>GoogleSkin</skin-name>
<css-path>/skin/Stylesheet.css</css-path>
<css-priority>0</css-priority>
</portal-skin>
<portlet-skin>
<application-name>web</application-name>
<portlet-name>BannerPortlet</portlet-name>
<skin-name>GoogleSkin</skin-name>
<css-path>
/skin/webPortlet/webui/component/
UIBannerPortlet/Stylesheet.css
</css-path>
</portlet-skin>
…
/skin/Stylesheet.css
:@import url(/eXoResources/skin/DefaultSkin/webui/component/Stylesheet.css); @import url(/eXoResources/skin/PortletThemes/Stylesheet.css); @import url(GoogleSkin/portal/webui/component/UIPortalApplicationSkin.css);
/skin/GoogleSkin/portal/webui/component/UIPortalApplicationSkin.css
:@import url(/eXoResources/skin/DefaultSkin/portal/webui/component/control/Stylesheet.css); @import url(/eXoResources/skin/DefaultSkin/portal/webui/component/customization/Stylesheet.css); @import url(/eXoResources/skin/DefaultSkin/portal/webui/component/view/Stylesheet.css); @import url(view/Stylesheet.css); body { background: #eeeeee; margin: 0px; padding: 0px; font-family: Tahoma,Verdana, Arial, Helvetica, sans-serif; font-size: 11px; overflow-x: hidden; } a { text-decoration: none; color: black; }
/skin/GoogleSkin/portal/webui/component/view/UIToolbarContainer/background
.This directory contains the images used for the UIToolbarContainer
, the tool bar that we are customizing.
/eXoResources/skin/DefaultSkin/portal/webui/component/view/UIToolbarContainer/background
to a new folder:ToolbarContainer.jpg
: Contains all the images used by the toolbar.UserIcon.png
: An image for the logged-in user.GateinLogo.jpg
: The button used to change the language and the skin. Google doesn't support these features in the toolbar so you will see nothing if this is omitted.Google shows the personal user image while GateIn, by default, is configured with an image that represents all users, so the UserIcon.png
will not be modified.
ToolbarContainer.jpg
using GIMP, the image-manipulation tool. In the end, the result will be something like the following screenshot:Google has only one image in the toolbar, so you must delete the other images shown above to make it similar. The Google image can be taken from: http://ssl.gstatic.com/gb/images/h_bedf916a.png
This will be used as the cover when you will choose the skin in GateIn. Name it GoogleTheme.jpg
.
/eXoResources/skin/DefaultSkin/portal/webui/component/customization/UIChangeSkinForm
and create a new image named GoogleSkinForm.jpg
. This image must be divided in 4 parts of the same dimension, with respect to the ChangeSkinForm.jpg
file but with a different theme. Using GIMP, you must substitute the four skins with the image created earlier. Here is an example of the two images: ChangeSkinForm.jpg
on the left and GoogleSkinForm.jpg
on the right:GoogleSkinImage
cover in the UIChangeSkinForm
page using the file /eXoResources/skin/DefaultSkin/portal/webui/component/customization/UIChangeSkinForm/Stylesheet.css
, and add it under the old cover, SimpleSkinImage
:.UIChangeSkinForm .UIItemSelector .TemplateContainer .SimpleSkinImage { margin: auto; width: 329px; height: 204px; background: url('background/ChangeSkinForm.jpg') no-repeat center -615px; cursor: pointer ; } .UIChangeSkinForm .UIItemSelector .TemplateContainer .GoogleSkinImage { margin: auto; width: 329px; height: 204px; background: url('background/GoogleSkinForm.jpg') no-repeat center -615px; cursor: pointer ; }
We created a theme similar to iGoogle. The world of web graphics is too complex to demand a plugged import of a theme. It is important to study all the relevant components of the portal and the related CSS files before organizing a migration.
3.137.188.201