Forums de discussion

Default Edit Controls to invisible

Monte Glenn Gardner, modifié il y a 15 années.

Default Edit Controls to invisible

Junior Member Publications: 37 Date d'inscription: 11/07/08 Publications récentes
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
Jeffrey Handa, modifié il y a 15 années.

RE: Default Edit Controls to invisible

Liferay Master Publications: 541 Date d'inscription: 01/12/08 Publications récentes
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"))
Monte Glenn Gardner, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Junior Member Publications: 37 Date d'inscription: 11/07/08 Publications récentes
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
Jeffrey Handa, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Master Publications: 541 Date d'inscription: 01/12/08 Publications récentes
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.
Paul Brennan, modifié il y a 14 années.

RE: Default Edit Controls to invisible

New Member Publications: 4 Date d'inscription: 05/08/09 Publications récentes
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
Florent Teuber, modifié il y a 14 années.

RE: Default Edit Controls to invisible

New Member Publications: 4 Date d'inscription: 21/01/09 Publications récentes
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
Monte Glenn Gardner, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Junior Member Publications: 37 Date d'inscription: 11/07/08 Publications récentes
(this is for liferay 5.1.1 and 5.1.2
thumbnail
Jeffrey Handa, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Master Publications: 541 Date d'inscription: 01/12/08 Publications récentes
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.
Monte Glenn Gardner, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Junior Member Publications: 37 Date d'inscription: 11/07/08 Publications récentes
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
Jeffrey Handa, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Master Publications: 541 Date d'inscription: 01/12/08 Publications récentes
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.
Baris Sener, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 278 Date d'inscription: 23/06/09 Publications récentes
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
Dhrutika parekh, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 435 Date d'inscription: 09/02/09 Publications récentes
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
Baris Sener, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 278 Date d'inscription: 23/06/09 Publications récentes
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
Dhrutika parekh, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 435 Date d'inscription: 09/02/09 Publications récentes
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
Victor Zorin, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Legend Publications: 1228 Date d'inscription: 14/04/08 Publications récentes
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.
Baris Sener, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 278 Date d'inscription: 23/06/09 Publications récentes
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
Victor Zorin, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Legend Publications: 1228 Date d'inscription: 14/04/08 Publications récentes
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
Baris Sener, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 278 Date d'inscription: 23/06/09 Publications récentes
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
Victor Zorin, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Liferay Legend Publications: 1228 Date d'inscription: 14/04/08 Publications récentes
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.
Baris Sener, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Expert Publications: 278 Date d'inscription: 23/06/09 Publications récentes
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
Gonzalo Jimenez, modifié il y a 14 années.

RE: Default Edit Controls to invisible

New Member Envoyer: 1 Date d'inscription: 22/10/09 Publications récentes
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")
John Croft, modifié il y a 14 années.

RE: Default Edit Controls to invisible

New Member Publications: 11 Date d'inscription: 15/02/10 Publications récentes
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"
atul patel, modifié il y a 14 années.

RE: Default Edit Controls to invisible

Regular Member Publications: 192 Date d'inscription: 18/11/06 Publications récentes
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
Debasis Padhi, modifié il y a 10 années.

RE: Default Edit Controls to invisible

Junior Member Publications: 54 Date d'inscription: 23/03/12 Publications récentes
try this

$("body").removeClass("controls-visible").addClass("controls-hidden");
Saroj Nayak, modifié il y a 10 années.

RE: Default Edit Controls to invisible

New Member Publications: 9 Date d'inscription: 16/05/12 Publications récentes
thanks ....
I tryed this It is reflecting in my desktop but not reflecting in iPad...
thumbnail
Debasis Padhi, modifié il y a 10 années.

RE: Default Edit Controls to invisible

Junior Member Publications: 54 Date d'inscription: 23/03/12 Publications récentes
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
Chí Văn Ngô, modifié il y a 9 années.

RE: Default Edit Controls to invisible

New Member Publications: 2 Date d'inscription: 12/07/11 Publications récentes
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
Ettore Perri, modifié il y a 7 années.

RE: Default Edit Controls to invisible

New Member Envoyer: 1 Date d'inscription: 10/08/16 Publications récentes
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