Hacking Alfresco, III

In last article I wrote about defining custom actions in Alfresco, in this one i want to continue with simple custom dialog triggered by this action.

So, like actions, dialogs are defined in web-client-config-custom.xml too. Definition is simple:

<dialog name="createSession" page="/jsp/extension/create-session.jsp" managed-bean="CreateSessionDialog"
icon="/images/icons/add_content_large.gif" title="Create session"
description="Create a new user session" />

Name is name of the dialog, referenced by action tag (<action>dialog:createSession</action>) in action definition. Page is a .jsp page with some content and managed-bean is an managed bean 🙂 defined in faces-config-beans.xml. So, lets add some bean to the session scope:

<value>bomdigibom :-)</value>

Now we need to create cz.shmoula.CreateSessionDialog class, which extends the BaseDialogBean:

public class CreateSessionDialog extends BaseDialogBean{
protected String aspect;
protected String retezec;

protected String finishImpl(FacesContext context, String outcome) throws Exception{
return outcome;

public boolean getFinishButtonDisabled(){
return false;

public void setRetezec(String retezec){
this.retezec = retezec;

public String getRetezec(){
return this.retezec;

This bean implements two buttons (see Dialog Framework wiki): OK button action and visibility (ie isDisabled) of OK button, in this case it is not disabled, so it is possible to click it and ends this dialog without any intervention to system ;-).

The Retezec variable is set by bean definition to some funny string, so after creating a .jsp page and packing together all this stuff do following: In case of click on space_browse_menu it compares name of that space and if it equals with "Archivace" string, it displays "Create session" action link. After click on this link a custom dialog is opened, as you can see on image below.

Free Image Hosting at www.ImageShack.us

displayed simple dialog


.jsp page is very simple too, it doesn't need no headers due to viewing inside of Alfresco UI:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:outputText value="#{CreateSessionDialog.retezec} " />

Jeden komentář: “Hacking Alfresco, III”

  1. Thanks a lot for this useful tutorial 🙂

    It is funny to show „bomdigibom“, but how to show the name of the document the user started the action on?

    For instance  if the user clicks on the „Create session“ menu item of myfile.odt, then the custom dialog would show „myfile.odt“. How to do this? Thanks a lot!

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *