掲示板

Default Edit Controls to invisible

15年前 に Monte Glenn Gardner によって更新されました。

Default Edit Controls to invisible

Junior Member 投稿: 37 参加年月日: 08/07/11 最新の投稿
My boss has asked that I modify our them so that the edit controls are toggled off by default.
Here's what I think I know so far:
-When you click the 'toggle edit controls' checkbox in the dock, it calls an AJAX routine which notifies the server that you want to toggle the edit controls.
- The on/off state is stored within session scope, tied to the string key "liferay_toggle_controls"
- When each page is loaded, the server side checks the session variable and then writes out some javascript to store the on/off state in the javascript variable Liferay._editControlsState
- It then calls the function Liferay.util.toggleControls() to add a class "controls-hidden" or "controls-visible" to the <body> tag.
- The base CSS then makes controls hidden if the hidden class is set.

How could I modify the theme so that the default settting, when you first start the session, is that the controls are hidden?
thumbnail
15年前 に Jeffrey Handa によって更新されました。

RE: Default Edit Controls to invisible

Liferay Master 投稿: 541 参加年月日: 08/12/01 最新の投稿
Hi Monte,

You will need to add the following line of code to your theme’s init_custom.vm file. If this file doesn’t already exist, you can create it and save it to the docroot\_diffs\templates directory.

#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "invisible"))
14年前 に Monte Glenn Gardner によって更新されました。

RE: Default Edit Controls to invisible

Junior Member 投稿: 37 参加年月日: 08/07/11 最新の投稿
I tried that solution and it didn't work . The controls still default to visible, even after clearing cookies and logging out and then back in again. I modified the custum_init code to this:
#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", null))

and then printed out the $liferay_toggle_controls variable later in the theme. It still evaluated to visible. So, the defaulting to visible seems to occuring somewhere deeper in the system.
thumbnail
14年前 に Jeffrey Handa によって更新されました。

RE: Default Edit Controls to invisible

Liferay Master 投稿: 541 参加年月日: 08/12/01 最新の投稿
Have you tried this with a new user? If you were previously logged in, it will remember your preferences, even if you clear the cache and cookies.
14年前 に Paul Brennan によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 4 参加年月日: 09/08/05 最新の投稿
I had this problem, but managed to solve it.
I have some custom css that makes toggle edit controls style various divs and wanted this to be OFF when a user is not signed in.
Although $liferay_toggle_controls was being set to invisible, the styles wern't being applied and so digged into init.vm, which contained the lines:

#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible"))

#if ($liferay_toggle_controls == "visible")
#set ($css_class = $css_class + " controls-visible")
#else
#set ($css_class = $css_class + " controls-hidden")
#end

So the $css_class was being set before the init_custom.vm was being called. I replicated these lines in init_custom.vm and changed visible to invisible in the first line:

#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "invisible"))

#if ($liferay_toggle_controls == "visible")
#set ($css_class = $css_class + " controls-visible")
#else
#set ($css_class = $css_class + " controls-hidden")
#end


Hope this helps some people
14年前 に Florent Teuber によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 4 参加年月日: 09/01/21 最新の投稿
Hi,
how can this work? $liferay_toggle_controls is used at the beginning of init.vm to build the CSS styles (controls-visible or controls-hidden). init_custom.vm is invoked from the last line of init.vm. So I do not see how this could change anything - but maybe there is something magically going on emoticon
14年前 に Monte Glenn Gardner によって更新されました。

RE: Default Edit Controls to invisible

Junior Member 投稿: 37 参加年月日: 08/07/11 最新の投稿
(this is for liferay 5.1.1 and 5.1.2
thumbnail
14年前 に Jeffrey Handa によって更新されました。

RE: Default Edit Controls to invisible

Liferay Master 投稿: 541 参加年月日: 08/12/01 最新の投稿
Monte Glenn Gardner:
(this is for liferay 5.1.1 and 5.1.2


I tested this with 5.1.2, but it should also work with 5.1.1.
14年前 に Monte Glenn Gardner によって更新されました。

RE: Default Edit Controls to invisible

Junior Member 投稿: 37 参加年月日: 08/07/11 最新の投稿
What is the relationship of init.vm to init_custom.vm. If I have a theme with no init.vm in its templates folder, does the system execute an init.vm from some other location before executing my init_custom.vm?
thumbnail
14年前 に Jeffrey Handa によって更新されました。

RE: Default Edit Controls to invisible

Liferay Master 投稿: 541 参加年月日: 08/12/01 最新の投稿
Monte Glenn Gardner:
What is the relationship of init.vm to init_custom.vm. If I have a theme with no init.vm in its templates folder, does the system execute an init.vm from some other location before executing my init_custom.vm?


When you deploy a theme, the build script first applies the _unstyled theme, then the _styled theme and finally the _diffs folder from your custom theme. If you have downloaded the portal source code, you can see the contents of the _unstyled and _styled themes in the following directory:

src\portal-web\docroot\html\themes\

You can take a look at the deployed war to see the result of this process.
14年前 に Baris Sener によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
Hello,

When you turn toggle edit controls on, users can also see the "This portlet has been undeployed. Please redeploy it or remove it from the page" notification. I want users to see the icons (edit,configuration, look and feel, close) in the portlet windows, but I don't want to show them the notification.

Is there a way to hide this notification? Or is there a way to turn toggle edit controls but still make the icons (edit,configuration, look and feel, close) visible?

Baris
thumbnail
14年前 に Dhrutika parekh によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 435 参加年月日: 09/02/09 最新の投稿
Baris Sener:
Hello,

When you turn toggle edit controls on, users can also see the "This portlet has been undeployed. Please redeploy it or remove it from the page" notification. I want users to see the icons (edit,configuration, look and feel, close) in the portlet windows, but I don't want to show them the notification.

Is there a way to hide this notification? Or is there a way to turn toggle edit controls but still make the icons (edit,configuration, look and feel, close) visible?

Baris



Hi Baris,
You can try this.go to configuration and unmark remove border.

Thanks,
Dhrutika Parekh

Cignex Technologies Pvt Ltd
14年前 に Baris Sener によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
I'm not sure if I follow; Do you mean the portlet's configuration? There is no remove border under configuration. If you mean look&feel, and then unclick show borders; it wouldn't be a good solution since I'll have to locate all the pages the notifications appear. What if there are undeploy notifications I haven't seen?

Baris
thumbnail
14年前 に Dhrutika parekh によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 435 参加年月日: 09/02/09 最新の投稿
Hi Baris,
I mean to uncheck show border's through portlet configuration.
But as per your requirement it's not useful to you.

Thanks,
Dhrutika Parekh
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Default Edit Controls to invisible

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
Hey Baris, you probably can get rid of this notification one way or another, but it just tells you that the portlet is not available in a system. Is this a portlet which you forgot to deploy, or an old portlet which you no longer need? Why would you want to keep place for this portlet on the page?

May be for later deployment? If that's the case and for whatever reason you would like to reserve space for portlets to be developed and deployed later, make dummy ones that produce zero rendering.
14年前 に Baris Sener によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
Hello Victor,

It usually appears when I remove a portlet from a page, even though it is still deployed in the portal. I don't want the notification to appear, or keep a place for the portlet on the page.

Do you know where I can find the portlet that outputs the notification?

Baris
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Default Edit Controls to invisible

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
it should not appear if portlet was legitimately removed from the page, only when page constructed but portlet with given id is not found in a system.
- Definition of a message is in content/Language(_en).propeties
- Jsp responsible for rendering this message is html/portal/undeployed_portlet.jsp
14年前 に Baris Sener によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
Thank you Victor. I'll look into those.

I have one more problem emoticon Is there a way to hide the requests portlets when toggle edit controls are visible? When toggle edit controls are invisible, and there are no requests; the requests portlets is hidden. But if I turn toggle edit controls are on, then users can see the portlet.

Baris
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Default Edit Controls to invisible

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
What do you mean by 'request portlets' ?

Baris, by looking at your questions, I suspect you need to get some clarity on your page layouts and portlet use. If you do not want users to see some portlets, why would those portlets be deployed on a page?

If you have very special setup and still do not want to see portlet controls in some specific cases, you will have to dig into your theme and redesign portlet.vm. There you can make smart on-the-fly decisions whether to display controls or not.
14年前 に Baris Sener によって更新されました。

RE: Default Edit Controls to invisible

Expert 投稿: 278 参加年月日: 09/06/23 最新の投稿
I meant "Requests Portlet". It shows you if you have any friendship requests, or if you are an admin/owner of a community it shows you pending membership requests. The problem is; it comes without borders by default, so if you do toggle edit controls on, it shows everything in writing. Just like web content display.

Basically I want to have toggle edit controls on, but I don't want to display the portlet options if show borders in unchecked.

Is there a way to override how toggle edit controls work and what it turns on and off?

Baris
thumbnail
14年前 に Gonzalo Jimenez によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 1 参加年月日: 09/10/22 最新の投稿
If you need to solve this on 5.2.2 you can do it adding this lines to init_custom.vm

#set ($liferay_toggle_controls = "hidden")
#set ($css_class = $theme_display.getColorScheme().getCssClass() + " controls-hidden")
14年前 に John Croft によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 11 参加年月日: 10/02/15 最新の投稿
I tried this and ended up with both classes on the body tag...

body class=" controls-hidden controls-visible"

How about adding your own class to the body tag in portal_normal.vm

<body class="$css_class #if($is_signed_in)loggedin #else notloggedin #end"
14年前 に atul patel によって更新されました。

RE: Default Edit Controls to invisible

Regular Member 投稿: 192 参加年月日: 06/11/18 最新の投稿
Sounds like you have a portlet that has additional functionality and should only be visible when toggle edit is on.

You will probably need to add the same $css-class that the toggled controls have to the content in your portlet, or the portlet itself depending on what you are doing. I believe liferay via jQuery search for objects with that class and toggles them class-visible and class-hidden. (Sorry i don't recall the name of the exact classes. )

Hope that helps.
thumbnail
10年前 に Debasis Padhi によって更新されました。

RE: Default Edit Controls to invisible

Junior Member 投稿: 54 参加年月日: 12/03/23 最新の投稿
try this

$("body").removeClass("controls-visible").addClass("controls-hidden");
10年前 に Saroj Nayak によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 9 参加年月日: 12/05/16 最新の投稿
thanks ....
I tryed this It is reflecting in my desktop but not reflecting in iPad...
thumbnail
10年前 に Debasis Padhi によって更新されました。

RE: Default Edit Controls to invisible

Junior Member 投稿: 54 参加年月日: 12/03/23 最新の投稿
try this



#set ($isIpad = $request.getHeader("User-Agent").indexOf("iPad")!=-1)
#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "visible"))
#if ($liferay_toggle_controls == "visible")
#set ($css_class = $css_class + " controls-visible")
#else
#set ($css_class = $css_class + " controls-hidden")
#end
#if($isIpad)
#set ($liferay_toggle_controls = "invisible")
#end

or else you can try

.portlet-borderless-bar, .portlet-topper-toolbar{display: none;} inside your css file for ipad ...
thumbnail
9年前 に Chí Văn Ngô によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 2 参加年月日: 11/07/12 最新の投稿
I have an easy way to resolve your problem.
In your theme, opening "portla_normal.vm" or "portla_normal.ftl". Before body tag, add "#set ($css_class = $css_class + " controls-hidden")". To specify, your code as:

#set ($css_class = $css_class + " controls-hidden")

<body class="$css_class">

After loading, liferay_toggle_controls is off
7年前 に Ettore Perri によって更新されました。

RE: Default Edit Controls to invisible

New Member 投稿: 1 参加年月日: 16/08/10 最新の投稿
Hello, this is my solution:
Into init_custom.vm I've added this code:

#set ($liferay_toggle_controls = $sessionClicks.get($request, "liferay_toggle_controls", "hidden"))

#if ($liferay_toggle_controls != "visible")
&nbsp;&nbsp;&nbsp;&nbsp;#set ($css_class = $css_class.replaceAll("controls-visible", "controls-hidden") )
#end