tags:

views:

162

answers:

1

I have an IFrame portlet in a liferay page. I want some quick fix to prevent logged in users from deleting that portlet. It can be done via user roles, css, code, or whatever. Is this possible?

+1  A: 

I would suggest modifying your themes portlet.vm template. It's pretty straight forward, if you take a quick look at the sevencogs theme:

#if ($portlet_display.isShowBackIcon())
    <a href="$portlet_back_url" class="portlet-icon-back">#language ("return-to-full-page")</a>
#else
    $theme.iconOptions()
    $theme.iconMinimize()
    $theme.iconMaximize()
    $theme.iconClose()
#end

Just remove $theme.iconClose() and your users won't be able to close/remove portlets anymore. Note that this applies to all portlets (since its a template).

If you'd like to deactivate the close button for some portlets only, I would simply do it by CSS. Do a display: none on the class .portlet-close-icon which is inherited by the div holding the iFrame. In particular

.portlet-iframe .portlet-close-icon {
     display: none;
}

will do the job for the liferay iFrame portlet.

Gerhard Dinhof