My Linux Stuff - Complete Blog For Linux Articles

My Linux Stuff - Complete Blog For Linux Articles

A Website For Complete Linux OS,Step by Step linux Installtion, Linux Tips and Tricks and Linux Stuff and so on... Connect and sharing here....

TOP 50 ENGINEERING COLLEGES IN INDIA 2014

TOP 50 ENGINEERING COLLEGES IN INDIA 2014

This below survey was taken many form many colleges in India. These Top 50 Engineering Colleges in India have Good Infrastructure, Good Environment, Educations , Staff, Placement , Research Activities and other Facilities are good.

Top 10 Government Engineering Colleges in India

Top 10 Government Engineering Colleges in India

These Government Engineering Colleges in India are really good for all kind of stuff like Education , research , Placement and New Innovation Ideas etc... But Getting seat in these colleges are heavy competition in students .....

Top 10 Colleges In India 2014

Top 10 Colleges In India 2014

Indian Institute Of Technology Delhi,Indian Institute Of Technology Bombay,Indian Institute Of Technology Kanpur,Indian Institute Of Technology Madras,Indian Institute Of Technology Kharagpur,Indian Institute Of Technology Roorkee,University Of Delhi,Indian Institute Of Technology Guwahati,University Of Calcutta,University Of Mumbai, National Institute Of Technology,Trichy.

2014 LATEST SURVEY TOP RANKING ENGINEERING COLLEGES IN INDIA

2014 LATEST SURVEY TOP RANKING ENGINEERING COLLEGES IN INDIA

This below survey was taken many form many colleges in India. These Top 100 Engineering Colleges in India have Good Infrastructure, Good Environment, Educations , Staff, Placement , Research Activities and other Facilities are good. If you want to do Engineering as your dream and try out these colleges

Subscribe Now!

Enter your email address:

Thursday, March 29, 2012

Theme and layout in liferay


1)Create a folder under plugins\themes\your-theme\docroot (e.g layout).
2)Add all the files Under your folder (e.g layout).
a.your_layout.tpl
b.your_layout.wap.tpl
c.your_layout.png
3)Add the files of your theme directly under the docroot/WEB-INF.
a.liferay-layout-templates.xml
4)Edit the file liferay-look-and-feel.xml present in the WEB-INF directory and add the following XML fragment.
<layout-templates>
<custom>
<layout-template id=" your_layout_Id" name=" your_layout_name">
<template-path>/layout/ your_layout.tpl</template-path>
<wap-template-path>/layout/your_layout.wap.tpl</wap-template-path>
<thumbnail-path>/layout/your_layout.png</thumbnail-path>
</layout-template>
</custom>
</layout-templates>
5)Then ant deploy from your theme level.


How to create liferay hook


Using hooks customizing jsp page of a existing liferay portlet. In this example I am taking portlet asset-publisher.

Step 1: Go to plugins/hooks create a folder with any name. eg asset-publisher-hook

Step 2: Go to asset-publisher-hook create folder docroot and build.xml file.

Content of build.xml should be like this:









Step 3:

Go to asset-publisher-hook/docroot create folder with name WEB-INF.

Step 4:

Now under WEB-INF create a file liferay-hook.xml and a folder with name jsps.

Step 5:

In liferay-hook.xml write following code.





/WEB-INF/jsps


Step 6:

Under jsps create folders html/portlet/portlet_name in our case portlet_name is asset-publisher.

Step 7:

Under portlet_name create the same structure for the page which we want to modify.

Eg. In asset-publisher we will try to modify full_content.jsp then structure will be

html/portlet/asset-publisher/display/full_content.jsp

Step 8:

Customize the jsp file.

Step 9:

Go to plugins/hook

Do ant deploy

Step 10:Check the changes on server

Recommended Tools For Liferay


The following instructions willhelp you get your development environment ready for working with the

source code. These instructionsare specific to setting up for deployment to Orion server and Tomcat 5.5


developing with Java JDK 1.5.Liferay Portal is compatible with Java 1.4 also and a wide array of

application servers andcontainers. You will need to adjust your development environment according to

your platform.

Before we can get started, thefollowing components must be installed on your machine.

3.1. JDK 1.5.0or JDK 1.4.2

1. Download and install JDK 1.5.0[http://java.sun.com/j2se/1.5.0/download.jsp]. JDK 1.4 is also

supported.

2. Set an environment variablecalled JAVA_HOME to point to your JDK directory.

3.2. Jikes 1.22or Jikes 1.21

Jikes is a Java compiler by IBMthat is much faster than the original one provided by the JDK.

1. Download and unzip Jikes 1.22[http://www-124.ibm.com/developerworks/oss/jikes]. If using JDK

1.4 you have to use Jikes 1.21instead.

2. Set an environment variablecalled JIKES_HOME to point to your Jikes directory.

3. Add JIKES_HOME\bintoyour PATH environment variable.

3.3. Ant 1.6.5

1. Download and unzip the latestversion of Ant [http://ant.apache.org/].

2. Set an environment variablecalled ANT_HOME to point to your Ant directory.

3. Add ANT_HOME\bin to your PATHenvironment variable.

3.4. Subversionor a Similar Version Control System

We recommend that you put allyour code and configuration files into a version control system.

Subversion is free and opensource and can be used through a set of commands, by installing a

subversion client such asSmartSVN [http://www.smartsvn.com/], TortoiseSVN [http://tortoisesvn.net/]

or through the integrationmechanisms provided by most IDEs.

Liferay UI Tabs

Creating Tabs is a really Cool feature and Liferay has an inbuilt functionality to do so.
Here is how it can be done.
1) In your Project , first create the following files under the following path
/docroot/jsps by creating a new folder called jsps
view.jsp
sunday.jsp
monday.jsp
tuesday.jsp
admin.jsp
code for view.jsp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
35
36
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<liferay-theme:defineObjects />
 
//A renderURL is created because we need to render a jsp page you need to use //renderURL we can also  pass parameters if required
 
<liferay-portlet:renderURL var="portletURL"/>
 
<%
//We must Specify a default value for tabs. In this example it is sunday. Else it //will throw an error.
String tabValue = ParamUtil.getString(request, "tab", "sunday");
String tabsURL = "/jsps/" + tabValue.trim() + ".jsp";
String tabNames="Sunday,Monday,Tuesday" ;
String tabVal="sunday,monday,tuesday" ;
if(permissionChecker.isCompanyAdmin(themeDisplay.getCompanyId())){
tabNames+=",Admin" ;
tabVal+=",admin" ;
}
%>
 
<liferay-ui:tabs
names="<%=tabNames%>"
tabsValues="<%=tabVal%>"
param="tab"
url="<%= portletURL %>"
/>
 
//this wud render the tab page
<c:import url="<%= tabsURL %>"></c:import>

Here is how it would Look Like 


The Admin Page Will be Visible only if an Admin Logs in. 



To Download the Project click here

How to install Liferay


First download the community version with tomcat server from the liferay websiteor Click Here
Unzip the contents to a suitable location.
Open the bin directory


And click on the startup.bat file to start and shutdown.bat file to shutdown.



To change the server standard time.

Open the setenv.bat in an editor and change the –Duser.timezone 
-Duser.timezone=Asia/Calcutta
Restart the Server .



For Database Settings 

log into the MySql command line editor. 

mysql> create database `lportal` CHARACTER SET utf8 COLLATE utf8_general_ci;

 create a portal-ext.properties file in \liferay-portal-6.0.6 

Add the following Lines to connect to MySql Database. 

#
# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEn
coding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=root

save and restart.

Check installation success in MySql 

mysql>use lportal ;
mysql>show tables ; A total of 185 rows indicating 185 tables must be shown.  

There is another way  to connect Tomcat to the database. Here is how it is done. Assuming that lportal schema is available in MySQL.

goto this path ${TOMCAT_HOME}\conf\Catalina\localhost
Open the root.xml and add the following lines in it.

<Context path="" crossContext="true">

<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/lportal?useUnicode=true&amp;amp;characterEncoding=UTF-8"
username="root"
password="root"
maxActive="20"
/>
</Context>

while configuring your database do make sure the corresponding jar file of the database is present in the lib directory of tomcat. Liferay Bundled wit tomcat has mysql.jar in it by default in the lib/ext folder.
More Liferay 6.0.5 Properties.

Now ,some fine tuning must be done if you are going to start development in liferay , so that everything runs faster and smoother , without much of ui customization.

Here is what you've got to do.

Open setenv.bat again , and add the following lines to it
-Dexternal-properties=portal-developer.properties 

Thats it, You are done and now you can start development on Liferay !!!

What is portlet Content and Portlet Template


Portlet Content: theinternal area that shows the meatof the portal.


 Portlet Template:the external area and can be customized for each theme.

Defining a new theme in Liferay


Before digging into these folders, the next step is to registerthe theme in Liferay. Edit the file


liferay-look-and-feel.xmlpresent in the WEB-INF directory and add the followingXML

fragment:

<theme id="my-theme" name="My theme">

<root-path>/html/themes/my-theme</root-path>

<templates-path>/html/themes/my-theme/templates</templates-path>

<images-path>/html/themes/my-theme/images</images-path>

<template-extension >jsp</template-extension>

<settings>

<setting key="my-setting" value="example-value"/>

</settings>

<color-scheme id="gen-color" name="DarkBlue">

<![CDATA[

-- Content omitted for clarity --

]]>

</color-scheme>

</theme>

The root-path element must point to the root theme folder. Theelements templates-path

contains the path to the JSP templates, and images-path pointsto the subfolder that contains the

images for this theme. Note that you can choose any subdirectoryname you want or point to

subdirectories in other directories. However, it is recommendedthat you keep the default

convention unless you have a good reason to change it.

The template-extension element specifies the language in which thetemplates of the theme are

written. JSPs and velocity (specifying vm as the template extension) aresupported. Liferay

comes with examples of both. In this article we will assume JSPtemplates, but they are very

_

Page 5 of 11 Created by Jorge Ferrer


similar.

Finally the settings element and its inner setting sub elementsallow you to specify any number

of custom settings of the theme (note that this is optional). Thesesettings can be retrieved from

the templates of the theme by calling the getSetting() method ofthe current theme object. For

example using JSP scripting:

<% String value =themeDisplay.getTheme()getSetting(“my-setting”); %>

Each theme must also have at least one color-scheme which controlsthe colors of the theme.

The color scheme is defined using the color-scheme element in the liferay-look-and-feel.xml.

By specifying several color schemes, it is possible to have onesingle theme with more than one

combination of colors. An example of a combination of colors forthe previous theme would be:

<color-scheme id="gen-color" name="DarkBlue">

<![CDATA[

body-bg=#666666

layout-bg=#666666

layout-text=#FFFFFF

layout-tab-bg=#666666

layout-tab-text=#FFFFFF

layout-tab-selected-bg=#666666

layout-tab-selected-text=#FFFFFF

portlet-title-bg=#666666

portlet-title-text=#FFFFFF

portlet-menu-bg=#666666

portlet-menu-text=#FFFFFF

portlet-bg=#666666

portlet-font=#FFFFFF

portlet-font-dim=#FFFFFF

portlet-msg-status=#FFFFFF

portlet-msg-info=#FFFFFF

portlet-msg-error=#FFFFFF

portlet-msg-alert=#FFFFFF

portlet-msg-success=#FFFFFF

portlet-section-header=#FFFFFF

portlet-section-header-bg=#666666

portlet-section-subheader=#FFFFFF

portlet-section-subheader-bg=#666666

portlet-section-body=#FFFFFF

portlet-section-body-bg=#666666

portlet-section-body-hover=#000000

portlet-section-body-hover-bg=#F4F4F4

portlet-section-alternate=#FFFFFF

portlet-section-alternate-bg=#333333

portlet-section-alternate-hover=#000000

portlet-section-alternate-hover-bg=#F4F4F4

_

Page 6 of 11 Created by Jorge Ferrer

portlet-section-selected=#FFFFFF

portlet-section-selected-bg=#666666

portlet-section-selected-hover=#FFFFFF

portlet-section-selected-hover-bg=#666666

]]>

</color-scheme>

The values of these colors will be used by a file called css.jsp.

Liferay acknowledges that the format of a theme may need to changein the future and provides

a mechanism to prevent errors should that happen. You can specifyfor which versions of

Liferay your theme is designed for:

<look-and-feel>

<compatibility>

<version>3.5.0</version>

<version>3.5.1</version>

</compatibility>

...

After covering how to define a new theme we are ready to explaineach of its components in

moredetail.

Liferay Workflow System


Liferay Portal is one of the leadingopen source portal frameworks.Liferay have the following features


                       Runson all major application servers and Servlet containers, databases, andoperating systems, and over 700 deployment combinations.
                       Usesthe latest in Java, J2EE, and Web 2.0 technologies.
                       Usesan open SOA framework.
                       JSR-168/JSR-286compliant.
                       Outof the box usability over 60 portlets.
                       AJAX-enableduser interface.
                       FullLDAP synchronization and secure Single Sign On (SSO) support.

Liferay portal includes adefault workflow engined called Kaleo. Kaleo workflow allows todefine any number of simple to complex business processes/workflowsbydefining everything inside a single XML file.Liferay 6 also provide integrationmechanism with the JBPM workflow engine. The workflow is applied out-of-the-boxto the following Liferay entities:
1.     WikiPage
2.     WebContent
3.     DocumentLibrary Document
4.     BlogsEntry
5.     Comments
6.     MessageBoards Message

There are four portlets related to the workflow that allows theusers to manage this system.
                       My Submissions
                       My Workflow Tasks
                       Workflow Configuration
WorkflowPortlet.

How to Implement a Simple Workflow


In this example I create two user acontent creator who will create content and a content publisher who willpublish the content.


sendrequest

backto creator for modification
ProcessDefinitions
Each workflow definitions isdefined by a single XML file.The XML file has several parts which define theworkflow. The key parts of the workflow definition are the asset, states,transitions, and tasks. The asset is whatever piece of content is being reviewedand approved in the workflow. States represent stages of the workflow; forexample: created, rejected, or approved. Transitions occur between states, andindicate what the next state should be. Tasks are steps in the workflow thatrequire user action.
Enhancing the portlet
This portlet is of coursevery basic and it could easily be enhanced in several
ways. Some suggestions:
_ Submit toa condor pool or Sun Grid Engine.
_ Let theuser choose which computational resource to submit to.
_ Add persistence by saving state to _le or database.

Liferay Theme


what can you do with a theme?

A theme can control the whole look and feelof the pages generated by Liferay. The portal-side

of the page can be completely customized.Even the appearance of the portlets that come with

Liferay can be customized using CSS, images, JavaScripts, and specialtemplates.

Related Posts Plugin for WordPress, Blogger...