Foren

Default Edit Controls to invisible

Monte Glenn Gardner, geändert vor 14 Jahren.

Default Edit Controls to invisible

Junior Member Beiträge: 37 Beitrittsdatum: 11.07.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Junior Member Beiträge: 37 Beitrittsdatum: 11.07.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

New Member Beiträge: 4 Beitrittsdatum: 05.08.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

New Member Beiträge: 4 Beitrittsdatum: 21.01.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Junior Member Beiträge: 37 Beitrittsdatum: 11.07.08 Neueste Beiträge
(this is for liferay 5.1.1 and 5.1.2
thumbnail
Jeffrey Handa, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Junior Member Beiträge: 37 Beitrittsdatum: 11.07.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Master Beiträge: 541 Beitrittsdatum: 01.12.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 435 Beitrittsdatum: 09.02.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 435 Beitrittsdatum: 09.02.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Expert Beiträge: 278 Beitrittsdatum: 23.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

New Member Beitrag: 1 Beitrittsdatum: 22.10.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

New Member Beiträge: 11 Beitrittsdatum: 15.02.10 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: Default Edit Controls to invisible

Regular Member Beiträge: 192 Beitrittsdatum: 18.11.06 Neueste Beiträge
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, geändert vor 10 Jahren.

RE: Default Edit Controls to invisible

Junior Member Beiträge: 54 Beitrittsdatum: 23.03.12 Neueste Beiträge
try this

$("body").removeClass("controls-visible").addClass("controls-hidden");
Saroj Nayak, geändert vor 10 Jahren.

RE: Default Edit Controls to invisible

New Member Beiträge: 9 Beitrittsdatum: 16.05.12 Neueste Beiträge
thanks ....
I tryed this It is reflecting in my desktop but not reflecting in iPad...
thumbnail
Debasis Padhi, geändert vor 10 Jahren.

RE: Default Edit Controls to invisible

Junior Member Beiträge: 54 Beitrittsdatum: 23.03.12 Neueste Beiträge
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ô, geändert vor 9 Jahren.

RE: Default Edit Controls to invisible

New Member Beiträge: 2 Beitrittsdatum: 12.07.11 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Default Edit Controls to invisible

New Member Beitrag: 1 Beitrittsdatum: 10.08.16 Neueste Beiträge
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