Posts

Showing posts from October, 2019

Liferay 7.2 - MySQL connection

Image
Liferay 7.2 - MySQL connection To connect Liferay to MySQL DB - add the following lines to   portal-setup-wizard.properties   file: jdbc.default.driverClassName=com.mysql.cj.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost:3306/my_liferay_db?serverTimezone=Europe/Istanbul&useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password=my_root_password Replace   my_liferay_db   with your database name and   my_root_password   with your root's MySQL password. Hints Use   com.mysql.cj.jdbc.Driver   MySQL driver, as old one will not work 7.2; serverTimezone   parameter should be specified (as in sample above); you may use the same connection string for MySQL connection in IntelliJ IDEA:  

AUI Liferay Popup Example

AUI Liferay Popup Example Here is sample code, which shows popup window on click: AUI().ready('aui-base', function(A){ A.one('#my-btn-selector').on('click', function() { Liferay.Util.openWindow( { dialog: { //cssClass: 'aui-popup-example', destroyOnHide: true, height: 600, width: 800 }, dialogIframe: { //bodyCssClass: 'custom-css-class' }, title: 'My Popup Title', uri: '' } ); } ); }); Enjoy  😏

Liferay Keycloak integration

Image
Liferay Keycloak integration using OpenID Overview This tutorial explains how to configure OpenID SSO between Liferay 7.2 and Keycloak 7.0.1 Installation instructions KeyCloak Configuration 1. Install and startup Keycloak server Download latest Keycloak server:  https://www.keycloak.org/downloads.html Unzip keycloak-7.0.1.zip folder. Run  keycloak-7.0.1/bin/standalone.sh  (or  keycloak-7.0.1/bin/standalone.bat ) file. Keycloak should be started on 8080 port:  http://localhost:8080 2. Create default admin user: and sign in to Admin Console. 3. Check OpenID configuration Click on "OpenID Endpoint Configuration": JSON configuration should appear, like this: { "issuer": "http://localhost:8080/auth/realms/master", "authorization_endpoint": "http://localhost:8080/auth/realms/master/protocol/openid-connect/auth", "token_endpoint": "http://localhost:8080/auth/realms/master/protocol/openid-con

Fix Gradle workspace for OSGi configuration modules

If you are using Gradle workspace for Liferay 7.2 and developing a module with OSGi configuration, for example: @ExtendedObjectClassDefinition ( category = ConfigurationKeys. CATEGORY_KEY , scope = ExtendedObjectClassDefinition .Scope. COMPANY ) @Meta.OCD ( id = ConfigurationKeys. REST_CONFIGURATION , localization = "content/Language" , name = "rest-configuration" ) public interface RestConfiguration {     @Meta.AD ( deflt = "https://lifedev.com/api/v1" , name = "rest-endpoint" )     public String restEndpoint();     @Meta.AD ( deflt = "0 * * ? * *" , name = "cronjob-expression" )     public String cronjobExpression(); } , you may notice that your configuration does not appear in Control Panel, even if code/configuration seems to be correct. The issue may be related to gradle plugins workspace version. Check "com.liferay.gradle.plugins.workspace" property in settin gs. gradle file.

Include JQuery plugin into theme

To include jQuery plugin to a theme the following “magic trick” is required (here is an example for OwlCarousel): < script >    Liferay .Loader. define . _amd = Liferay .Loader. define . amd ;    Liferay .Loader. define . amd = false ; </ script > < script type ="text/javascript" src =" ${ javascript_folder } /owl-carousel/owl.carousel.js"  /> < script >    Liferay .Loader. define . amd = Liferay .Loader. define . _amd ; </ script > (add this code in ‘head’ section of portal_normal.ftl file) After this you can you your jQuery plugin in theme. For this example: var $slider = $( '#slider' ); $slider . owlCarousel ({     items : 1 ,     loop : true ,     margin : 10 ,     autoplay : true ,     autoplayTimeout : 3000 ,     autoplayHoverPause : true ,     pagination : true }); Hope, this will help :)