Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Will Henry
Prevent portlets from being moved even as admin
July 15, 2013 12:40 PM
Answer

Will Henry

Rank: New Member

Posts: 15

Join Date: July 11, 2012

Recent Posts

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?
David H Nebinger
RE: Prevent portlets from being moved even as admin
July 15, 2013 1:26 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11464

Join Date: September 1, 2006

Recent Posts

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...
Sandeep Nair
RE: Prevent portlets from being moved even as admin
July 15, 2013 1:40 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

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).

 1#
 2    # Specify static portlets that cannot be moved and will always appear on
 3    # every layout. Static portlets will take precedence over portlets that may
 4    # have been dynamically configured for the layout.
 5    #
 6    # For example, if you want the Hello World portlet to always appear at the
 7    # start of the iteration of the first column for user layouts, set the
 8    # property "layout.static.portlets.start.column-1[user]" to "47". If you
 9    # want the Hello World portlet to always appear at the end of the second
10    # column for user layouts, set the property
11    # "layout.static.portlets.end.column-2[user]" to "47". You can input a
12    # list of comma delimited portlet ids to specify more than one portlet. If
13    # the portlet is instanceable, add the suffix "_INSTANCE_abcd" to the
14    # portlet id, where "abcd" is any random alphanumeric string.
15    #
16    # The static portlets are fetched based on the properties controlled by
17    # custom filters using EasyConf. By default, the available filters are
18    # user, community, and organization.
19    #
20    #layout.static.portlets.start.column-1[user]=3,6
21    #layout.static.portlets.end.column-1[user]=14
22    #layout.static.portlets.start.column-2[user]=71_INSTANCE_abcd,7
23    #layout.static.portlets.end.column-2[user]=34,70
24    #layout.static.portlets.start.column-3[user]=
25    #layout.static.portlets.end.column-3[user]=
26
27    #
28    # It is also possible to set static portlets based on the layout's friendly
29    # URL.
30    #
31    #layout.static.portlets.start.column-1[user][/home]=3,6
32    #layout.static.portlets.end.column-2[regular-site][/home]=14
33
34    #
35    # Set the static portlets for the pages of regular sites.
36    #
37    #layout.static.portlets.start.column-1[regular-site]=
38    #layout.static.portlets.end.column-1[regular-site]=
39    #layout.static.portlets.start.column-2[regular-site]=
40    #layout.static.portlets.end.column-2[regular-site]=
41    #layout.static.portlets.start.column-3[regular-site]=
42    #layout.static.portlets.end.column-3[regular-site]=
43
44    #
45    # Set the static portlets for the pages of organization sites.
46    #
47    #layout.static.portlets.start.column-1[organization]=
48    #layout.static.portlets.end.column-1[organization]=
49    #layout.static.portlets.start.column-2[organization]=
50    #layout.static.portlets.end.column-2[organization]=
51    #layout.static.portlets.start.column-3[organization]=
52    #layout.static.portlets.end.column-3[organization]=
53
54    #
55    # Set the static portlets that will appear for every layout. See
56    # /html/portal/layout/view/portlet.jsp for the logic of when these portlets
57    # will be shown. For example, these portlets will only show for layouts that
58    # can contain portlets and are not in a pop up state.
59    #
60    layout.static.portlets.all=


Regards,
Sandeep
Victor Zorin
RE: Prevent portlets from being moved even as admin
July 15, 2013 4:25 PM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1178

Join Date: April 14, 2008

Recent Posts

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.:

1header.portlet-topper {
2  pointer-events: none;
3}
4
5/* but enable drop-downs for look-and-feel, preferences, etc, if you need them */
6header.portlet-topper > .portlet-topper-toolbar > span {
7  pointer-events: all;
8}


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
RE: Prevent portlets from being moved even as admin
July 22, 2013 10:51 AM
Answer

Will Henry

Rank: New Member

Posts: 15

Join Date: July 11, 2012

Recent Posts

Your approach worked exactly as I desired. Thank you!