Ignacio
Ignacio

Reputation: 8035

How to prevent users from deleting a liferay portlet?

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?

Upvotes: 4

Views: 2855

Answers (2)

Inwe
Inwe

Reputation: 41

You always can do that:

    $theme.iconMinimize()
    $theme.iconMaximize()               
#if ($permissionChecker.isOmniadmin())
    $theme.iconClose()
#end    

Upvotes: 4

Gerhard Dinhof
Gerhard Dinhof

Reputation: 1320

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.

Upvotes: 4

Related Questions