Fórum

Removing Dockbar Items

Aaron Bryenton, modificado 13 Anos atrás.

Removing Dockbar Items

Junior Member Postagens: 53 Data de Entrada: 28/05/10 Postagens Recentes
Hi again,

I was wondering if it was possible to remove some things from the dockbar (toggle edit controls, control panel) just for the members? The admin side will still have all of it.

There was a thread asking the same thing but the only answer was "design a new theme". I searched through all of my files but I can't seem to locate where the file is for the dockbar.

I'm using version 6.0.2.

Thanks,
Aaron
Patrick Stackpoole, modificado 13 Anos atrás.

RE: Removing Dockbar Items

New Member Postagens: 21 Data de Entrada: 10/06/10 Postagens Recentes
Hey Aaron,

I'm trying to do something similar, to retain one link and trash the rest, in converse to what you're trying to do.

In Liferay 6.x I've found "the file" here, as a jsp file: \liferay\appserver\webapps\ROOT\html\portlet\dockbar\view.jsp

In my 5.2.3 theme, dock.vm was editable as a template within the theme. I don't know if the dock is as easily edited from the theme now. Maybe there's some css magic but if so, I have yet to find it.
thumbnail
Samuel Liu, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Expert Postagens: 301 Data de Entrada: 27/05/10 Postagens Recentes
Hi guys,

Here's how to do it: if you just want to remove the dock completely in v6, open up portal_normal.vm in the templates folder (which is within the specific theme folder). There's a line of code like this:

#if($is_signed_in)
	#dockbar()
#end


Delete or comment it out to remove the dockbar.

If you want to style the dockbar on the other hand, go into the CSS folder for your theme and edit dockbar.css.

emoticon Hope this has been helpful!

Warm regards,
Sam
Aaron Bryenton, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Junior Member Postagens: 53 Data de Entrada: 28/05/10 Postagens Recentes
Hey Sam,

Thanks for the reply.

Is there a way to remove specific items from the dockbar? For example, I want to remove the "Toggle items" and "Control Panel" option from the user dockbar only... the admin dockbar will retain all features.

Thanks,
Aaron
thumbnail
Samuel Liu, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Expert Postagens: 301 Data de Entrada: 27/05/10 Postagens Recentes
Hi Aaron,

There technically is, but I'm not entirely sure about the proper way to do it. There's supposed to be some sort of logic in a function called themeDisplay.isShowControlPanelIcon() for the control panel. The toggle display one is also weird.

At any rate, I've figured out a hacky way to accomplish what you're looking for.

Dockbar is a portlet: so go to

{Liferay Directory}/tomcat-{version}/webapps/ROOT/html/portlet/dockbar/view.jsp


and open the file in a text editor.

Find the portion of code that goes like


<c:if test="<%= themeDisplay.isShowControlPanelIcon() %>">
[indent]<li class="control-panel last" id="<portlet:namespace />controlPanel">
[indent]<aui:a href="<%= themeDisplay.getURLControlPanel() %>" label="control-panel" />[/indent]</li>[/indent]</c:if>


and change it to:


<c:if test="<%= themeDisplay.isShowControlPanelIcon() && themeDisplay.isShowPageSettingsIcon()%>">
[indent]<li class="control-panel last" id="<portlet:namespace />controlPanel">
[indent]<aui:a href="<%= themeDisplay.getURLControlPanel() %>" label="control-panel" />[/indent]</li>[/indent]</c:if>


This should make the control panel icon show only if you have permission to edit the page settings (which is by default not for the community member role -- I'm not sure if some higher-level roles can do it, but I know that community members can't and that admin members can).

You can do the same to the toggle icons code, which looks like this:


<c:if test="<%= !group.isControlPanel() && themeDisplay.isSignedIn() && themeDisplay.isShowPageSettingsIcon() %>">
[indent] <li class="toggle-controls" id="<portlet:namespace />toggleControls">
[indent] <a href="javascript:;">
[indent]<liferay-ui:message key="toggle-edit-controls" />[/indent]</a>[/indent]</li>[/indent]</c:if>


replace it with this:


<c:if test="<%= !group.isControlPanel() && themeDisplay.isSignedIn() && themeDisplay.isShowPageSettingsIcon() && themeDisplay.isShowPageSettingsIcon()%>">
[indent] <li class="toggle-controls" id="<portlet:namespace />toggleControls">
[indent] <a href="javascript:;">
[indent]<liferay-ui:message key="toggle-edit-controls" />[/indent]</a>[/indent]</li>[/indent]</c:if>



I'm sure there's a better way to do it, but right now I'm not aware of it. I will talk to some people and see if I can find a better way to do this. Apologies for the hackiness of this solution!

Warm regards,
Sam
Aaron Bryenton, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Junior Member Postagens: 53 Data de Entrada: 28/05/10 Postagens Recentes
Hi Sam,

That is great! Thank you so much!

Aaron
Britton Dodd, modificado 13 Anos atrás.

RE: Removing Dockbar Items

New Member Postagens: 6 Data de Entrada: 23/07/10 Postagens Recentes
Actually I'm doing the exact same thing for my work. You dont want to modify the actual deployed instance in liferay, you want something in the form of a plugin that you can deploy on top of a bundle or whatever (think about what happens when you do an upgrade to 6.0.4 for example)

Grab the src package and look through that to find where the file you need to edit is.. In my example it was the dockbar.js

Then create an ext plugin and create the exact directory structure matching the file you need to edit. Then when you build the ext plugin, the file you create is used instead of the file in liferay, AND you are able to use that for multiple instances, etc.

I was looking for a week or more trying to find the answer, yesterday it was found that the only way to modify the dockbar with complete control is to do a ext plugin (not a theme)
thumbnail
Samuel Liu, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Expert Postagens: 301 Data de Entrada: 27/05/10 Postagens Recentes
Thanks Britton for the actual solution emoticon

@Aaron -- my method was super hacky and Britton's method is definitely the appropriate way to do it!
thumbnail
Samuel Liu, modificado 13 Anos atrás.

RE: Removing Dockbar Items

Expert Postagens: 301 Data de Entrada: 27/05/10 Postagens Recentes
Britton Dodd, modificado 13 Anos atrás.

RE: Removing Dockbar Items

New Member Postagens: 6 Data de Entrada: 23/07/10 Postagens Recentes
Hey no problem!

Actually the file is html/portlet/dockbar/view.jsp

Glad to help any way I can.

Oh, and the other note I had was that the ext plugin does NOT get un-deployed automatically, so you have to grab the file from your ext-plugin and manually copy it to see your changes after the initial deploy of the ext-plugin.

Or, you could trash the bundle and re-download it everytime, but that got old really quick.

EDIT: Actually its more like the ext-plugin wont un-deploy/re-deploy automatically or manually. Somehow, liferay knows that ive already applied the ext-plugin and refuses to re-deploy the ext plugin after the initial deploy. No worries, just copy the file and refresh/restart
ia web, modificado 13 Anos atrás.

RE: Removing Dockbar Items

New Member Mensagem: 1 Data de Entrada: 18/08/10 Postagens Recentes
hello,

Though I am little late here in this discussion. I fount another interesting thing, that might be helpful too.

http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/hooks

here, go for the "Overriding a JSP".

Cheers
thumbnail
Rohit Salecha, modificado 12 Anos atrás.

RE: Removing Dockbar Items

Junior Member Postagens: 50 Data de Entrada: 21/02/11 Postagens Recentes
Here Hope this Helps you

http://liferaydemystified.blogspot.com/