Foren

How do I hide a portlet

Evan Valenca, geändert vor 12 Jahren.

How do I hide a portlet

New Member Beitrag: 1 Beitrittsdatum: 28.04.11 Neueste Beiträge
Hello,
I am using liferay 6.0.6 with Tomcat 6.0.29 and MySQL

I would like to completly hide a portlet when the user is not logged in. Once the user logs in, I would like to show the portlets. The portlet is visible with the message "You do not have the roles required to access this portlet. " before I login. I would like to hide the whole portlet. When I do login I'm able to see the portlet as desired.

I do have layout.show.portlet.access.denied=false in my portal-ext.properties file. However, the portlet is still visible.

What am I doing wrong?

Thanks,
Evandro
thumbnail
Raju OO7, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 239 Beitrittsdatum: 27.04.10 Neueste Beiträge
Evan Valenca:
Hello,
I am using liferay 6.0.6 with Tomcat 6.0.29 and MySQL

I would like to completly hide a portlet when the user is not logged in. Once the user logs in, I would like to show the portlets. The portlet is visible with the message "You do not have the roles required to access this portlet. " before I login. I would like to hide the whole portlet. When I do login I'm able to see the portlet as desired.

I do have layout.show.portlet.access.denied=false in my portal-ext.properties file. However, the portlet is still visible.

What am I doing wrong?

Thanks,
Evandro



if it is custom portlet u can set this function in liferay-portlet.xml file

<icon>/icon.png</icon>
<show-portlet-access-denied>false</show-portlet-access-denied>
thumbnail
manasa chandri, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 152 Beitrittsdatum: 28.09.10 Neueste Beiträge
Hi Raju,

I have configured the
<icon>/icon.png</icon>
<show-portlet-access-denied>false</show-portlet-access-denied>
in liferay-portlet.xml file,
but it is not working in plugin portlet?

Can anybody know the solution, Please send me as soon as possible.

Thank You In Advance.

Thanks & Regards
Manasa.chandri
thumbnail
srikanth velugoti, geändert vor 12 Jahren.

RE: How do I hide a portlet

Junior Member Beiträge: 79 Beitrittsdatum: 24.04.09 Neueste Beiträge
go to the page where u deployed u r portlet and place the below script in javascript
it will hide the portlet when not logged in , and shows the portlet when user logged in...



AUI().ready('',function(A) {

var loggedin= themeDisplay.isSignedIn();

if(!loggedin) {
document.getElementById("portlet_id").style.display = 'none';
}

});
thumbnail
manasa chandri, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 152 Beitrittsdatum: 28.09.10 Neueste Beiträge
Hi srikanth velugoti,

Thank you for giving reply to me.
I kept this code in my view page,but it is not working?


i keep the code like below:
<script type="text/javascript">
AUI().ready('',function(A) {

var loggedin= themeDisplay.isSignedIn();
if(!loggedin) {
document.getElementById("mylogin").style.display = 'none';
}

});


</script>

I search forums i keep this below code also, it is also not working

<icon>/icon.png</icon>
<show-portlet-access-denied>false</show-portlet-access-denied>
<show-portlet-inactive>false</show-portlet-inactive>





Please send the reply to me.
Thank you in advance

Thanks & Regards
Manasa.chandri
thumbnail
srikanth velugoti, geändert vor 12 Jahren.

RE: How do I hide a portlet

Junior Member Beiträge: 79 Beitrittsdatum: 24.04.09 Neueste Beiträge
hi , go to -> managepages-> select the page where u deployed u r portlet.
now you will find javascript block , paste the above code ...

changes : you have to give portlet id below

document.getElementById("portlet_79").style.display



regards,
thumbnail
manasa chandri, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 152 Beitrittsdatum: 28.09.10 Neueste Beiträge
Hi srikanth velugoti,

Thank you very much, I got that one.

Thanks & Regards
Manasa.chandri
thumbnail
manasa chandri, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 152 Beitrittsdatum: 28.09.10 Neueste Beiträge
Hi srikanth velugoti,

That script is working fine, but one problem is there,
Suppose war is deployed in another system, directly from control panel through plugin installation.
In that system also we have to write this script (or) it is not required?
plug in portlet directly we will give to the client as a war file,at that time, we get problem the portlet hiding is not possible.
Again open the client system and we have copy this script?


Any solution is there, like configured in the liferay-portlet.xml fileor anything.


Please help me.


Thanks & Regards
Manasa.chandri
thumbnail
Raju OO7, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 239 Beitrittsdatum: 27.04.10 Neueste Beiträge
manasa chandri:
Hi srikanth velugoti,

That script is working fine, but one problem is there,
Suppose war is deployed in another system, directly from control panel through plugin installation.
In that system also we have to write this script (or) it is not required?
plug in portlet directly we will give to the client as a war file,at that time, we get problem the portlet hiding is not possible.
Again open the client system and we have copy this script?


Any solution is there, like configured in the liferay-portlet.xml fileor anything.


Please help me.


Thanks & Regards
Manasa.chandri


there are two options..
1. through liferay-portal.xml
2. through portal.properties file

i dont know why first method is not working in ur case..

anyway u try to add layout.show.portlet.access.denied=false in portal.properties file
thumbnail
manasa chandri, geändert vor 12 Jahren.

RE: How do I hide a portlet

Regular Member Beiträge: 152 Beitrittsdatum: 28.09.10 Neueste Beiträge
Hi Raju,

Thank you for giving reply
It is working only for the bundle portlet's, It is not working for the plugin portlet(i have created)

Please give me solution.

Thank you in advance.

Thanks & Regards
Manasa.chandri
raghu batchu, geändert vor 12 Jahren.

RE: How do I hide a portlet

New Member Beiträge: 9 Beitrittsdatum: 23.08.09 Neueste Beiträge
You have many possibilities, depending on what your "condition" is

for example you can use portlet permission according to Role.

also you can use page leavel script like

Depending on the condition

<script>
JQuery(document).ready(function(){
document.getElementById('portletID').style.display = 'none';
});
</script>

I think this would help...

Thanks
Raghu