11/21/2012

Liferay Europe Symposium 2012 : The Video

The folks at liferay created this little video for you to enjoy the Liferay Europe Symposium 2012. 
Have fun !





If you have any questions, feel free to leave a comment.

10/26/2012

First Infos about Liferay 6.2

On the liferay symposium, the liferay guys gave us some insight in 4 new features they are currently developing that will make it into Liferay 6.2. Release date is fall 2013.

Recycle bin


Whatever you delete will be moved into a recycle bin - just like the one you know from Windows. You can see your content in there, you can delete it permanently and you can also restore your content. The recycle bin will be (for example) integrated in wikis and allows an instant undo of your operation.

Until now the recycle bin doesn´t care for versions - let´s hope they will add in it the future.

App Display templates

App display templates allow to apply templates to certain portlet types. Sounds good and productive to me.

Web Content Folders

Web Content folder are exactly what their name implies: Folder that contain Web Contents which allows authors to structure and organize their content better.

New Calendar

The Calendar portlet will be greatly reworked in Liferay 6.2. It will offer a better UI, outlook-like functions like booking of ressources and a possibility to add more than one calendar per User. So if you want to differentiate between private and business meetings you can do so.
Sadly, in the version we´ve seen there is no synchronisation mechanism for google calendar or exchange, so for those of you who are only using Liferay calendar those features are great and the rest of you just has to wait for the sync feature.



If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

10/11/2012

Liferay Europe Symposium 2012

Ok, two minutes ago I got my ticket to the Liferay europe symposium in Wiesbaden next week on the 16th and 17th. Who´s with me ?


If you have any questions, feel free to leave a comment.

7/26/2012

Creating the URL of a community or organization

Ok, this is a short one and it is more like a reminder for myself.
This is how you get the relative URL that points directly to a community or organization page:


public static String createLinkToGroup(Group group, Layout layout){
  boolean privateLayout = layout.isPrivateLayout(); 
  String privateSelector = privateLayout ? "group" : "web";
  String link ="/" + privateSelector + group.getFriendlyURL() + layout.getFriendlyURL(); 
  return link;
}


If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

7/24/2012

AlloyUI: How to get the parent in TreeViewDD

If you are using the AlloyUI TreeViewDD component to visualize a hierarchic structure, you might come to the point that you want to process the information that is created when you drag and drop items in your tree. One question that kept bugging me for days was how to get the information that Node A was dropped into Node B.
Well, here is the solution:


var tree1 = new A.TreeViewDD({
  boundingBox : '#tree1',
  children : children,
  on: {
    drop: function(event) {
      var selectedNode = tree1.getNodeById(selected);
      var parent = selectedNode.get('parentNode');
      var parentId = parent.get('id');
    },
    lastSelectedChange: function(event){
      var id = event.newVal.get('id');
      selected = id;
    }
}

If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

AlloyUI: How to send an AJAX request

Just a short instruction on how to send an AJAX - request with AlloyUI. First you need to create an MVCPortlet so that you can fire to distinct methods.


Create an action method like this:

public void somethingHappensHere(
  ActionRequest actionRequest, 
  ActionResponse actionResponse) throws IOException, PortletException {
}
In your AlloyUI page add the following to a button of your choice. The variable "myActionURL" should point to your "somethingHappensHere" method in your portlet.
var url = '<%= myActionURL.toString() %>';
A.io.request(url,{
//this is the data that you are sending to the action method
data: {
   <portlet:namespace />id: selected,
   <portlet:namespace />name: name,
},
dataType: 'json',
on: {
  failure: function() { //do something },
  success: function(event, id, obj) { //do something else}
}
});



If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

7/23/2012

How to get the configured SMTP Host of Liferay

This is a simple one but I want to keep it so that I don´t have to look it up again in the future.
This is how you get the SMTP host that is configured in Liferay
String smtpHost = PrefsPropsUtil.getString(PropsKeys.MAIL_SESSION_MAIL_SMTP_HOST);


If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

7/19/2012

What to do when Liferay´s PDF function doesn´t render the images

When you´ve successfully installed Open office on your machine and you activated the Liferay - OpenOffice integration you are able to let users convert your Web Contents to PDF.


This works more or less, the PDFs you get won´t win a price. But at least they contain the pictures you´ve included. They don´t ? Well ... read on.


If your PDF files don´t contain any pictures then the reason might be that your OpenOffice is installed on a machine behind a proxy. To solve this, simply add the following snippet to the file


/usr/lib/openoffice/basis3.2/share/registry/data/org/openoffice/Inet.xcu

<prop oor:name="ooInetProxyType" oor:type="xs:int">
   <value>2</value>
  </prop>
  <prop oor:name="ooInetHTTPProxyName" oor:type="xs:string">
   <value>YOUR_PROXY</value>
  </prop>
  <prop oor:name="ooInetHTTPProxyPort" oor:type="xs:int">
   <value>80</value>
  </prop>
  <prop oor:name="ooInetNoProxy" oor:type="xs:string">
   <value>localhost;127.0.0.1;YOUR_PROXY;YOUR_MACHINES</value>
  </prop>
If you do this then liferay should be able to render its PDFs with pictures included :)


If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

6/24/2012

Uploading files with Liferay

This is a short tutorial for those of you who want to upload a file using Liferay portlets. First you need to give your form in your JSP the correct encoding type:
<form name="<portlet:namespace/>fm" method="post" enctype="multipart/form-data" action="<portlet:actionURL />">

This makes sure that the data you upload is really uploaded. Next you should add the upload button like this :

<input type="file" name="<portlet:namespace/>yourfile" id="<portlet:namespace/>yourfile" />


That´s all in the JSP. If you now add the following in your processAction method, you have access to your uploaded file:

public void processAction(ActionRequest request, ActionResponse response)throws PortletException, IOException {


UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);

String sourceFileName = uploadRequest.getFileName("yourfile");
File file = uploadRequest.getFile("yourfile");


That´s all. Have fun :)



If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

6/01/2012

How to get the JournalStructure data

If you create a WebContent that is based on a structure / template combination and you want to get the value of one of the structure fields programmatically, you can do it like this:


Imagine, that your WebContent has the ID 21623 and you are looking for a field that has the name "Text1".


JournalArticle article = JournalArticleLocalServiceUtil.getArticle(21623);

Document document = SAXReaderUtil.read(article.getContentByLocale(Locale.ENGLISH.toString()));
Node node = document.selectSingleNode("/root/dynamic-element[@name='Text1']/dynamic-content");
String value = node.getText();

That´s all :) 

 If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

3/28/2012

Liferay And Solr: SolrException: can not sort on multivalued field:

If you get this Exception:

org.apache.solr.common.SolrException: can not sort on multivalued field: modified
at org.apache.solr.schema.SchemaField.checkSortability(SchemaField.java:161)
at org.apache.solr.schema.FieldType.getStringSort(FieldType.java:527)
at org.apache.solr.schema.StrField.getSortField(StrField.java:40)
at org.apache.solr.schema.SchemaField.getSortField(SchemaField.java:144)
at org.apache.solr.search.QueryParsing.parseSort(QueryParsing.java:385)
at org.apache.solr.search.QParser.getSort(QParser.java:251)
at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:82)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)



then you might be using the liferay solr plugin together with Liferay 6.0.6. Right ?
If so, then continue reading.


Please add the following field to the schema.xml file of the index you are trying to access:
<field name="modified" type="text" indexed="true" stored="true" />


Please also change your SolrIndexSearchImpl and add this to the method "subset", replacing the original code:
 for (String name : names) {
        Field field = new Field(name, 
ArrayUtil.toStringArray(solrDocument.getFieldValues(name).toArray()), false);
document.add(field);
}


There are some posts that helped me on my way to find the solution.
Here they come:


http://issues.liferay.com/browse/LPS-17569
http://www.liferay.com/community/forums/-/message_boards/message/9532150
http://www.liferay.com/community/forums/-/message_boards/message/9024087



If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

3/08/2012

ICEfaces radio buttons done right

When you are using ICEfaces then you have powerful features to display radio buttons on your page. 


ICEfaces allows you to separate the definition of the radio buttons from their placement, which makes it ideal to place them in complex UIs such as data tables, popups etc. This little tutorial will show you how to define radio buttons, how to place them and how to react to user interactions.


What you need to do first is to define your "selectOneRadio" elements. Those elements define the radio buttons that you can place anywhere on your page later. You have the possibility to define them statically in your xhtml or you can let a backing bean create  as many radio buttons as you want to have.


Here is a simple example of the finition part of two radio buttons:

<ice:selectOneRadio id="def" layout="spread" >

 <f:selectItem itemLabel="FirstChoice" itemValue="1"></f:selectItem>
 <f:selectItem itemLabel="SecondChoice" itemValue="2"></f:selectItem>


</ice:selectOneRadio>
This creates two radio buttons, labelled as "FirstChoice" and "SecondChoice" and "tells" ICEfaces, that those buttons may appear anywhere on the page by setting the layout type to "spread". But beware: This definition doesn´t display the radio buttons. To display them, you need to add the following :

<ice:radio for="def"   index="1"/>

<ice:radio for="def"   index="2"/>

Those tags actually display the radio buttons and you can put them wherever you like in the page. It also works great with dataTables.


This was the static part : displaying two predefined radio buttons.
But what if you want to display 1..n radio buttons ? Use the following to define your radio buttons:

<ice:selectOneRadio id="def" layout="spread" >

 <f:selectItems value="#{yourBean.radioButtonList}"></f:selectItem>
 
</ice:selectOneRadio>
And let it point to a simple List of SelectItems:
private List<SelectItem> firstList = new ArrayList<SelectItem>();
You can predefine this list with values and labels just as you always do, but remember the values you assign: You can use them to preselect a radio button. What you need to do now is to iterate over this list and display all the radio buttons:

<ice:radio for="def" index="#{yourBean.counter}"/>


If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

2/01/2012

Liferay goes Dropbox: Liferay Sync

Liferay today announced a powerful feature that reminds me of Dropbox: Document synchronization.


It will allow you to access your files on- and offline on a various list of devices. Read the press release here: Liferay Sync



If you like this postit would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

1/18/2012

How to clean / delete your solr index

If you want to wipe / clean / delete / recreate your local index you will notice that you can´t do that using your solr admin and luke also doesn´t help.


What helps is sending this statement to your solr server:


http://localhost:8083/solr/your-index-name/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true


This command deletes everything and performs a commit. If you are using luke you need to re-open your index to see that the changes took effect.


If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

1/09/2012

1/07/2012

ICEFaces selectInputDate Not working

If you have been using ice:selectInputDate and have been struggeling to get it working, here is a hint:


The calendar icon of the selectInputDate element will not show if you have not added this line to your liferay-plugin-package.properties:


speed-filters-enabled= false

Don´t ask me why, but it seems to mess with the javascript created by ICEfaces that the date popup needs to appear. Add this line and it should work.


If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.

Can only redirect during ACTION_PHASE: Redirect and ICEfaces

If you are using ICEFaces 2 and you wonder why you can´t use this to perform a redirect in your backing bean action method:

FacesContext.getCurrentInstance().getExternalContext().redirect("http://www.somewhere.com");

and you are getting the following Exception:


java.io.UnsupportedEncodingException: 
Can only redirect during ACTION_PHASE at org.portletfaces.bridge.container.liferay.PortletContainerLiferayImpl.redirect(PortletContainerLiferayImpl.java:233) 
at org.portletfaces.bridge.context.ExternalContextImpl.redirect(ExternalContextImpl.java:412) 
at com.brightsky.bean.WorkBasketModelBean.navigateToPage(WorkBasketModelBean.java:39) 
at com.brightsky.bean.WorkBasketBackingBean.navigateToPage(WorkBasketBackingBean.java:65) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)




Then you might want to update your portlet faces bridge to version 2.0.1. 
They added support for redirecting outside the Action Phase.
You can get it here: http://www.portletfaces.org/portletfaces-bridge/downloads


If you like this post it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.