Forums de discussion

Prevent portlets from being moved even as admin

Will Henry, modifié il y a 10 années.

Prevent portlets from being moved even as admin

New Member Publications: 15 Date d'inscription: 11/07/12 Publications récentes
I'm sure this is answered somewhere else, I just couldn't seem to search for the right keywords. I have created a mobile theme and I want to lock the portlets on the page in place. As the admin, when I scroll up and down on the page with my thumb, I sometimes click portlet titles and move the portlets around the page. Is there away to set in my theme, in one of the velocity templates, or elsewhere where portlets cannot be moved?
thumbnail
David H Nebinger, modifié il y a 10 années.

RE: Prevent portlets from being moved even as admin

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
No, the portal is designed to be this flexible.

However, portlets embedded in the theme cannot be added, moved, or removed, if you're willing to go down that road...
thumbnail
Sandeep Nair, modifié il y a 10 années.

RE: Prevent portlets from being moved even as admin

Liferay Legend Publications: 1744 Date d'inscription: 06/11/08 Publications récentes
You can have static portlets on page. There is a whole bunch of properties to set the static portlets for various cases(for example static portlets on user pages, organization pages, regular sites, pages with specific friendly URL).

#
    # Specify static portlets that cannot be moved and will always appear on
    # every layout. Static portlets will take precedence over portlets that may
    # have been dynamically configured for the layout.
    #
    # For example, if you want the Hello World portlet to always appear at the
    # start of the iteration of the first column for user layouts, set the
    # property "layout.static.portlets.start.column-1[user]" to "47". If you
    # want the Hello World portlet to always appear at the end of the second
    # column for user layouts, set the property
    # "layout.static.portlets.end.column-2[user]" to "47". You can input a
    # list of comma delimited portlet ids to specify more than one portlet. If
    # the portlet is instanceable, add the suffix "_INSTANCE_abcd" to the
    # portlet id, where "abcd" is any random alphanumeric string.
    #
    # The static portlets are fetched based on the properties controlled by
    # custom filters using EasyConf. By default, the available filters are
    # user, community, and organization.
    #
    #layout.static.portlets.start.column-1[user]=3,6
    #layout.static.portlets.end.column-1[user]=14
    #layout.static.portlets.start.column-2[user]=71_INSTANCE_abcd,7
    #layout.static.portlets.end.column-2[user]=34,70
    #layout.static.portlets.start.column-3[user]=
    #layout.static.portlets.end.column-3[user]=

    #
    # It is also possible to set static portlets based on the layout's friendly
    # URL.
    #
    #layout.static.portlets.start.column-1[user][/home]=3,6
    #layout.static.portlets.end.column-2[regular-site][/home]=14

    #
    # Set the static portlets for the pages of regular sites.
    #
    #layout.static.portlets.start.column-1[regular-site]=
    #layout.static.portlets.end.column-1[regular-site]=
    #layout.static.portlets.start.column-2[regular-site]=
    #layout.static.portlets.end.column-2[regular-site]=
    #layout.static.portlets.start.column-3[regular-site]=
    #layout.static.portlets.end.column-3[regular-site]=

    #
    # Set the static portlets for the pages of organization sites.
    #
    #layout.static.portlets.start.column-1[organization]=
    #layout.static.portlets.end.column-1[organization]=
    #layout.static.portlets.start.column-2[organization]=
    #layout.static.portlets.end.column-2[organization]=
    #layout.static.portlets.start.column-3[organization]=
    #layout.static.portlets.end.column-3[organization]=

    #
    # Set the static portlets that will appear for every layout. See
    # /html/portal/layout/view/portlet.jsp for the logic of when these portlets
    # will be shown. For example, these portlets will only show for layouts that
    # can contain portlets and are not in a pop up state.
    #
    layout.static.portlets.all=


Regards,
Sandeep
thumbnail
Victor Zorin, modifié il y a 10 années.

RE: Prevent portlets from being moved even as admin

Liferay Legend Publications: 1228 Date d'inscription: 14/04/08 Publications récentes
You can probably address this requirement by modifying css styles within your look-and-feel theme.

Briefly, what you would need is to disable portlet-topper mouse actions whenever the mobile device is detected, e.g.:

header.portlet-topper {
  pointer-events: none;
}

/* but enable drop-downs for look-and-feel, preferences, etc, if you need them */
header.portlet-topper > .portlet-topper-toolbar > span {
  pointer-events: all;
}


How to detect the mobile device is a different story, '@media handheld' or '@media only screen and (max-device-width:480px) ' may well work on your specific handheld...

Modifying portlet.vm file will provide additional control possibilities as you would be able to style portlet header using data from velocity variables and HTTP session attributes.
Will Henry, modifié il y a 10 années.

RE: Prevent portlets from being moved even as admin

New Member Publications: 15 Date d'inscription: 11/07/12 Publications récentes
Your approach worked exactly as I desired. Thank you!