Tuesday 28 November 2017

Navigation bar and content parallel

In theme level we can make navigation bar and content parallel
Its by modifying in portal_normal.vm file
Use table concept and put navigation and content in same <tr> and different <td>
ie.
<table>
<tr>
<td>
navigation bar items
</td>
<td>
content items
</td>
</tr>
</table>

PORTAL_NORMAL.VM FILE EXAMPLE:

<table width="100%">
<tr>
<td style="background:#F2F7FA;width: 182px;">
#if ($has_navigation || $is_signed_in)
#parse ("$full_templates_path/navigation.vm")
#end
</td>
<td valign="top">
<div id="content">
#if ($selectable)
$theme.include($content_include)
#else
$portletDisplay.recycle()
$portletDisplay.setTitle($the_title)
$theme.wrapPortlet("portlet.vm",
$content_include)
</td>
</tr>
</table>
#end
</div>

Alloy UI Validator

1--><aui:validator name="required" />
Usage:Field should not be empty.

2--><aui:validator name="digits" />
Usage:Only digits allowed in this field.

3--><aui:validator name=”range”>
[1,20]
</aui:validator>
Usage:Only digits between 1 and 20 allowed.

4--><aui:validator name="equalTo">
'#<portlet:namespace />password1'
</aui:validator>
Usage:It compares two field passwords.

5--><aui:validator name="alpha" />
Usage:Only alphabets allowed in this field.

6--><aui:validator name="date" />
Usage:Only date allowed in this field.

7--><aui:validator name="alphanum" />
Usage:Only alphanumeric characters allowed in this field.

8--><aui:validator name="email" />
Usage:Only email address allowed in this field.

9--><aui:validator name="max">
'5'
</aui:validator>
Usage:Only value digits less than or equal to 5.

10--><aui:validator name="min">
'5'
</aui:validator>
Usage:Only allow value greater than or equal to 5.

11--><aui:validator name="maxLength">
'10'
</aui:validator>
Usage:Only allow maximum length of 10 characters.

12--><aui:validator name="minLength">
'10'
</aui:validator>
Usage:Only allow minimum length of 10 characters.

13.<aui:validator name="rangeLength" >
[2,10]
</aui:validator>
Usage:No of characters should be between 2 and 10.

14.<aui:validator name="url" />
Usage:Only URL is allowed in this field.

15.<aui:validator name="acceptFiles">
'jpeg, png'
</aui:validator>
Usage:Only allow files of the specified type.If all of these validation rules don't meet your needs, you can write custom rules, too.
This can be accomplished by using the "custom" rule name, custom "errorMessage"
attribute (more on this attribute further down), and a short Alloy Javascript function.
Your custom rule can do anything inside the curly braces as long as the return result
is a boolean. "val" is the value of the field (what the user typed in), "fieldNode" is
the node the validator is attached to, and ruleValue is what's inside the tag (in this
case, it's irrelevant because it is the script itself).


16--><aui:validator name="custom"
errorMessage="value-cannot-be-test">
function(val, fieldNode, ruleValue) { return (val !=
'test') }
</aui:validator>



NOTE:DEFAULT ERROR MESSAGE WE GET CAN BE SEEN IN

SERVER/TOMCAT/WEBAPPS/ROOT/HTML/JS/LIFERAY/FORM.JS

DEFAULT ERROR MESSGAES:

acceptFiles:
Liferay.Language.get(‘please-enter-a-file-with-a-valid-extens
ion-x’),

alpha:
Liferay.Language.get(‘please-enter-only-alpha-characters’),

alphanum:
Liferay.Language.get(‘please-enter-only-alphanumeric-characte
rs’),

date: Liferay.Language.get(‘please-enter-a-valid-date’),

digits: Liferay.Language.get(‘please-enter-only-digits’),

email:
Liferay.Language.get(‘please-enter-a-valid-email-address’),

equalTo:
Liferay.Language.get(‘please-enter-the-same-value-again’),

max:
Liferay.Language.get(‘please-enter-a-value-less-than-or-equal
-to-x’),

maxLength:
Liferay.Language.get(‘please-enter-no-more-than-x-characters’
),

min:
Liferay.Language.get(‘please-enter-a-value-greater-than-or-equal-to-x’),

minLength:
Liferay.Language.get(‘please-enter-at-list-x-characters’),

number: Liferay.Language.get(‘please-enter-a-valid-number’),

range:
Liferay.Language.get(‘please-enter-a-value-between-x-and-x’),

rangeLength:
Liferay.Language.get(‘please-enter-a-value-between-x-and-x-ch
aracters-long’),

required: Liferay.Language.get(‘this-field-is-required’),

url: Liferay.Language.get(‘please-enter-a-valid-url’)
We can also custom error message by writing errorMessage in validator.

For Ex:
<aui:validator name="url"
errorMessage="this-field-must-be-a-valid-url" />

Monday 27 November 2017

Liferay Document and Media Features

Liferay Document management system has many in-built features

·         Document Management System in liferay
·         Supports many document formats.And also we can restrict the end user from uploading some document formats  like .exe,etc..from admin panel.
·         Supports different size and also we can also restrict the size anytime from admin panel.
·         Checkin/Checkout option is there.You can work on versions
·         Document type/Metadata customization is available.


·         Workflow for folder level is available.
·         Document Rating is available by default.It includes a type of voting.
·         Version History is available.Based on version users can download/view the documents.
·         Copy Feature is available.
·         Move documents is available.
·         Download option is available.
·         Uploading multiple documents in a shot.
·         No.of file downloads.
·         Comments can be given.
·         Subscribe/Unsubscribe to the asset.
·         Sharing in social networks like google plus,tweets available.
·         Thumbnail view
·         Form builders for metadata set.




Alternative Repositories:
·         Advanced File System Store
·         CMIS Store (Content Management Interoperability Services)
·         DBStore (Database Storage)
·         File System Store
·         JCRStore (Java Content Repository)
·         S3Store (Amazon Simple Storage)
·         Sharepoint as repository




Microsoft Office Integration
Access from Desktop
Liferay Sync
Liferay Sync is an add-on product for liferay that synchronizes files between your Liferay server and users’ desktop and mobile environments. With Liferay Sync, your users can publish and access shared documents and files from their native environments without using a browser. 

Also all the files can be accessed easily using apis.

Search Functionality
Sorting Documents


Recycle bin features.

Sunday 26 November 2017

Encrypted Passwords in Liferay

Basically when you create a user programmatically we may face issue in password creation.

To avoid that its always better to go with the default APIs of liferay.

For Ex:

UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);


But you may come across some place where you may need to use

UserLocalServiceUtil.addUser(user);

So at that time We need to encrypt the plain text password

So we can use Liferay's PasswordEncryptorUtil to encrypt our plain text.

user.setPassword(PasswordEncryptorUtil.encrypt("test"));
user.setPasswordUnencrypted("test");
user.setPasswordEncrypted(true);

UserLocalServiceUtil.addUser(user);

Even we can use

PasswordEncryptorUtil.encrypt(algorithm, plainTextPassword, encryptedPassword);

to select the algorithm.

Saturday 25 November 2017

Liferay Single Sign-On option - Facebook SSO

Sign into your liferay portal using facebook credentials


Liferay Single Sign-On option - Facebook SSO
Step 1:
Log into http://developers.facebook.com with your facebook credentials

Step 2:
Click on apps->Register as a developer


Step 3:
Register by giving your mobile number and sms verification code

 

Copyright @ 2017 Liferay Article.