You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by gaurav goel <sa...@gmail.com> on 2006/05/31 09:13:28 UTC

Deploying portlet in portal header

Hi,
How can  a portlet be deployed on the portal header??I want to deploy a
login portlet on top of the page i.e on the portal header.How can this be
done?

-- 
Regards,
Gaurav Goel.

Re: Deploying portlet in portal header

Posted by David Sean Taylor <da...@bluesunrise.com>.
gaurav goel wrote:
> Hi,
> How can  a portlet be deployed on the portal header??I want to deploy a
> login portlet on top of the page i.e on the portal header.How can this be
> done?
> 

I think this may be achieved via the portlet pipeline, as long as you 
don't need any user-specific preferences, we can get by without psml

using a portlet pipeline in your page decorator's top.vm like:

/jetspeed/portlet?entity=login-portlet&portlet=j2-admin::LoginPortlet

on a javascript controlled <div>

The entity does not have to be defined in PSML.
If it doe not exist it will be created.
The portlet parameter is optional if the entity value refers to a known 
portlet entity.

Note I have not tried this approach, but I think it should work
I think a better solution would be to actually support this kind of 
thing in the JetspeedPowerTool, such as:

$jetspeed.RenderEntity(entityId)

or

$jetspeed.RenderPortletEntity(entityId, portletId)

I should really provide an example since its requested enough
I'll add it to my todo list for 2.1....



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Deploying portlet in portal header

Posted by Aaron Evans <aa...@gmail.com>.
This question has been asked before and there is really no easy way to
include a portal as a fragment of the header or footer at the moment.

What you could do (in theory) is leave visible markup out of your
header.vm and create a nested layout structure in which the first
layout is a one column layout where the first row is the login portlet
that has been modified to include your header.  Then the second row is
a two or three-column layout with regular portlets.  Doesn't sound
very pretty though.

All that being said, if it is just the login you need in the header
(not other portlets) I'll describe a little trick that you can use.

First, put a form in the markup of your header.vm.  At a minumum, it
should contain:

<form name="loginForm" method="post" action="/jetspeed/login/proxy">
 <input name="org.apache.jetspeed.login.username" type="text" size="15">
 <input name="org.apache.jetspeed.login.password" type="password" size="15">
 <input type="submit" value="Login">
</form>

Incorporate this and mark it up as you need in your header.vm.

This will work no problem provided the user provides a correct
username and password.

If they do not, you'll need to setup a page to redirect them to when
it fails.  So second, you'll need to create a portal psml page, say in
pages/login.psml that contains the actual login portlet.

And third and finally, you'll need to modify
org.apache.jetspeed.login.LoginErrorServlet and change:

if (destination == null)
            destination = request.getContextPath() + "/";

to

if (destination == null)
            destination = request.getContextPath() + "/login.psml";

Then, if the user uses an incorrect username/password combination,
they'll get redirected to /login.psml with the usual login failure
messages, etc.

This *should* work in theory.  I have only needed to do the first step
because of my situation.  In my situation, pretty much all portal
pages are protected from unlogged in users except to pages in
pages/_user/guest:

default-page.psml - this is the same as the login.psml that I describe above
forgot-password.psml - a publicly accessible forgot password page
containing a custom forgot password portlet.

We have a public corporate website which has in the header, the login
form described in step one.  If a user successfully authenticates
against it, they are immediately sent to pages/default-page.psml
(which is the portal splash page).  If the login is unsuccessful, they
are redirected to pages/_user/guest/default-page.psml because they are
the "guest" user.  Because of this, I didn't have to modify the
LoginErrorServlet, but the basic principal is the same.

In fact, if you wanted to avoid having to modify that servlet, I guess
you could use the same method as me, just put all your publicly
accessible pages under pages/_user/guest.

HTH,
aaron

On 5/31/06, gaurav goel <sa...@gmail.com> wrote:
> Hi,
> How can  a portlet be deployed on the portal header??I want to deploy a
> login portlet on top of the page i.e on the portal header.How can this be
> done?
>
> --
> Regards,
> Gaurav Goel.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org