Recent Bloggers

David H Nebinger

21 Mensagens
6 de Julho de 2015

Angela Wu

7 Mensagens
2 de Julho de 2015

Martin Yan

17 Mensagens
1 de Julho de 2015

Mike Macauley

1 Mensagens
30 de Junho de 2015

Jorge Ferrer

62 Mensagens
30 de Junho de 2015

Shannon Chang

5 Mensagens
29 de Junho de 2015

Olaf Kock

100 Mensagens
26 de Junho de 2015

Ken Dong

8 Mensagens
24 de Junho de 2015

Zeno Rocha

11 Mensagens
17 de Junho de 2015

Neha Goyal

6 Mensagens
4 de Junho de 2015

Mobile Device Recognition beyond the UI

Company Blogs 27 de Junho de 2013 Por Milen Dyankov Staff

As you probably know in version 6.1 Liferay introduced the mobile device rules feature. However if you haven't followed the discussions and presentations about it, you may be under the wrong impression that is't very limited. Some people even claim it doesn't work. Judging by the number and type of questions I still get asked now days, I think I know where most of the confusion comes from - the user interface.

The first problem is that the UI will let you create rules even if there is no plug-in capable of actually detecting the device. Yes, you do need a plug-in for that. The API, data model and the UI are provided with the portal, but similarly to workflow and search (just to name a few) functionalities, the actual work of detecting the device is delegated to an external plugin. At the time of writing there is only one such plugin in Marketplace - Device Recognition Provider which internally uses WURFL. However if other providers become available in the future (or you create your own one), you will still be able to seamlessly hook them in.

Now, as I mentioned earlier, the UI will not warn you if the plugin is not installed. It will let you create a rule and the rule of course will never match as long as the plugin is missing! Of course all this is explained in the documentation but for those very few people who don't have the time to read it, in Liferay 6.2 we added a very visible warning message!

The second problem is about answering the "how much is not too much?" question properly. I guess we can have an endless discussion on this one but the fact is that at some point of time a decision was made that the only criterias that need to be available in the UI are operating system and whether the device is a tablet. In Liferay 6.2 you will be also able to specify ranges of screen resolutions and display sizes. I understand this still may be too limited for some of you, but the truth is, everyone has his needs and there is no way to make an user friendly interface that will cover all WURFL capabilities! Well, may be there is - a DSL (Domain Specific Language) on top of some rule engine will actually fit nice in here. Unfortunately there were more important things in the 6.2 road map so you'll have to wait a bit longer for this one or help us implement it!

The good news is you can use all of the capabilities in your custom portlets. You can use DeviceDetectionUtil to get the current user's Device. Once you get the Device object you can get the value of any WURFL capability by calling getCapability(java.lang.String) method. Actually you can do the same even from web content templates. Here is a simple example that will render some phone numbers as links if the device is capable of doing phone calls or sending text messages.


<?xml version="1.0"?> 
  <dynamic-element name="phone_number" type="text" index-type="" repeatable="false"/>   
  <dynamic-element name="sms_number" type="text" index-type="" repeatable="false"/>  
  <dynamic-element name="email" type="text" index-type="" repeatable="false"/>

Template in Velocity:

#set( $callPrefix = $device.getCapability("xhtml_make_phone_call_string") )
#set( $smsPrefix = $device.getCapability("xhtml_send_sms_string") )
#set( $canDoPhoneCalls = $callPrefix != "none" )
#set( $canSendSMS = $smsPrefix != "none")

<h3>Contact us!</h3>

You can
  <li>call us at  
    #if( $canDoPhoneCalls )
      <a href="$callPrefix$phone_number.getData()">$phone_number.getData()</a> 
  <li>or send an SMS message to 
    #if( $canSendSMS )  
      <a href="$smsPrefix$sms_number.getData()">$sms_number.getData()</a> 
    and we'll call you back  
  <li>or <a href="mailto:$email.getData()">e-mail us </li>

Template in Freemarker:

<#assign callPrefix = device.getCapability("xhtml_make_phone_call_string")>
<#assign smsPrefix = device.getCapability("xhtml_send_sms_string")>
<#assign canDoPhoneCalls = (callPrefix != "none")>
<#assign canSendSMS = (smsPrefix != "none")> 

<h3>Contact us!</h3>

You can
  <li>call us at
    <#if canDoPhoneCalls >
      <a href="${callPrefix + phone_number.getData()}">${phone_number.getData()}</a>
  <li>or send an SMS message to
    <#if canSendSMS >
      <a href="${smsPrefix + sms_number.getData()}">${sms_number.getData()}</a>
   and we'll call you back
  <li>or <a href="mailto:${email.getData()}">e-mail us </li>

I hope the above proved to you the device recognition functionality in Liferay is not as limited as it may seem on the first look! And I certainly hope more will come in upcoming versions.

The power (user) is back

Company Blogs 22 de Janeiro de 2013 Por Milen Dyankov Staff

The title will probably make some people argue that it was never gone on the first place. That's true. But there are some resources out there trying to convince you that  User and Power User roles are basically the same thing. Some even state that Power User is there for legacy reasons but it's not and will not be used by Liferay in a future. While I'll refrain from making any statements as to what Liferay will do in the future, I think you shold know that currently (which is Liferay version 6.1) User and Power User roles provide different permissions set! 
The confusion comes partly from the fact that by default all users are assigned to both roles. Thus from user perspective it would theoretically make no difference in which role given permission is set. But keep in mind that users can be removed from Power User role at any time. So before you do set a permission please think whether it should apply to all users ever (then add it to the User role) or it should only apply to given group of users (if so add it to a specific role - for example Power User)

To add to the confusion, in 6.1 a new button called "Clean Up Permissions" showed up in Control Panel. While the description tries its best to describe what it does, it may not be very clear if you believed that User and Power User are the same. To help you better understand, I generated the following table which shows what are the default permissions for Guest, User and Power User roles before and after you click on "Clean Up Permissions"  (click on the screenshot below to download the PDF):         

Liferay 6.1 default permissions (screenshot)

Liferay source code history - a piece of art

Company Blogs 14 de Janeiro de 2013 Por Milen Dyankov Staff

Ever wandered what it takes to build a product like Liferay? Let me show you in a ... very visual way. Please sit comfortably and watch how the time flies (not to mention the developers) and several years of source code history draws an extraordinary picture in just  8 minutes:

For those of you who are more concerned about how the video was made then what it represents (and also to comply with some of the licences) here is the information:
  • animation created by Gource - tool which displays software projects as an animated tree with the root directory of the project at its centre. Directories appear as branches with files as leaves. Developers can be seen working on the tree at the times they contributed to the project.
  • source code history based on commits in Liferay's master branch
  • the developers avatars comes from Gravatar
  • Background music by
  • everything put together in OpenShot


Mostrando 3 resultados.