Wellcome!

In Cms Howto you'll find updated tutorials to work with Alfresco, Liferay, and other cms software. In a world without information, Cms Howto is the solution.

Tuesday, November 17, 2009

Changing the LifeRay context

In LifeRay we can found different types of urls, such as /c, /d, /theme, etc. It would be useful that all urls began by the same string, for example /portal. In that case we´ll have:

/portal/c../
/portal/d../
/portal/theme../

This allows Apache to handle easily the Liferay urls. To do that:

1.- Firstly, shutdown LifeRay.

2.- Edit portal-ext.properties, and add:

portal.ctx=/portal
portlet.virtual.path=/portal

3.- Rename the /ROOT folder to /portal in TOMCAT_HOME/webapps.

4.- Rename "tomcat-6.0.18/conf/Catalina/localhost/ROOT.xml"  to "tomcat-6.0.18/conf/Catalina/localhost/portal.xml".

5.- Delete the content of the folders /temp and /work in TOMCAT_HOME (delete the tomcat cache).

6.- Restart LifeRay.

Probably we must redo the Lucene Index in LifeRay control panel. Finally we can go to the LifeRay home page at:

http://localhost/portal

Monday, November 9, 2009

Api JavaScript samples in Alfresco

Alfresco allows us to perform actions when an event occurs, such as content creation, modification, and so on. Here are some examples of use:

Js that sent mails:

  // create mail action
  var mail = actions.create("mail");
  mail.parameters.to = "user@mail.com";
  mail.parameters.subject = "News Letter Title";
  mail.parameters.from = "alfresco@society.com";
  mail.parameters.template = search.findNode("workspace://SpacesStore/9c74d256-ff43-4437-rio5-3098c54fbc7a");
  mail.parameters.text = "Sorry, but the news letter is not available this week due to maintenance needs. Please apologize for disturbance";
  // execute action against a document
  mail.execute(document);

Js that start and advanced pooled workflow:

  var workflow = actions.create("start-workflow");
  workflow.parameters.workflowName = "jbpm$wf:reviewpooled";
  workflow.parameters["bpm:workflowDescription"] = document.name;
  workflow.parameters["bpm:groupAssignee"] = people.getGroup("GROUP_myGroup");
  var futureDate = new Date();
  futureDate.setDate(futureDate.getDate() + 7);
  workflow.parameters["bpm:workflowDueDate"] = futureDate;
  workflow.execute(document);

Js that change the name of an inbound document:

  // change the name of this document
  document.properties.name = "Backup of " + document.properties.name;
  // add a new property string
  document.properties["cm:locale"] = mylocalenode;
  // save the property modifications
  document.save();

More examples here:
Alfresco Js Api 



Saturday, November 7, 2009

Adding portlets to a theme/layout

If we want to include some portlet in all the pages of our web, we must include it into a theme or layout file (.vm or .tpl).

For example, it would be useful to have a breadcrumb portlet in the layout and not have to manually include it on every page. Even we could establish a default configuration.

Other portlets which should be included on the theme could be the language portlet, content search, navigation, etc.

The following examples show how to add a language portlet, to do that we have two posibilities:

a) Adding the portlet to portal_normal.vm with the xml configuration:








b) Adding the portlet to a hidden page, configure it and instance his portlet-id from portal_normal.vm: