Thursday, December 27, 2012

Removing the Portlet Borders Through out Portal From Theme Level , Liferay

To Remove the Portlet Borders from theme Level ,

You need to write a simple code in "liferay-look-and-feel.xml " file which is in ur "Theme/docroot/WEB-INF" folder

code :-
                 <theme id="Your-Theme-Id" name="Your Theme Name">
       <settings>
            <setting key="portlet-setup-show-borders-default" value="false" />
        </settings>
    </theme>

Role checking in Template/vm file , Liferay

To perform the accesing of the service layers in web content we need to add the propertie in the portal-ext.properties file

journal.template.velocity.restricted.variables=

#set($roleLocalServiceUtil = $serviceLocator.findService("com.liferay.portal.service.RoleLocalService"))
#set($adminrole = $roleLocalServiceUtil.getRole($company_id, "Administrator"))

#set($hasadminrole = $roleLocalServiceUtil.hasUserRole($user_id, $getterUtil.getLong($adminrole.getRoleId())))

How to Identify that SignedIn User is having particualr Role or Not in Liferay

Here i am writing example code which is used to check that the signedIn User is having the Administrator Role or Not

<%@page import="com.liferay.portal.model.Role"% ><%@page import="com.liferay.portal.service.RoleLocalServiceUtil"%>
      long companyId = themeDisplay.getCompanyId();
       Role roleAdmin = RoleLocalServiceUtil.getRole(companyId, "Administrator");
    
      if(RoleLocalServiceUtil.hasUserRole(themeDisplay.getUserId(), roleAdmin.getRoleId())) {

       }

The Above Code is to check that the SignedIn User is having 'Administrator'  Role or Not

Thursday, December 20, 2012

Toggle / Collapse and Expand using JQuery

 <script src="http://code.jquery.com/jquery-1.8.2.min.js" >  </script>

<script type="text/javascript">
    jQuery('#clickme').click(function() {     //this line is for to work onclick functionality
    jQuery('#content').toggle();                  // thsi line is for toggle option
    jQuery('#minus').toggleClass('minus');  //this line is for plus and minus image
});
</script>

<div id="clickme"> <a href="javascript:void(0);"> Click Me </a> </div>
<div id="content">
<p>
        This content will be collapse and expanded
</p>
<p>
      For plus and minus symbols u need to apply css
</p>
</div>

Note : For any clarification just post a comment 

Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...