AnsweredAssumed Answered

Adding a Custom Dialog: does not appear

Question asked by nicolasraoul on Jan 25, 2010
Latest reply on Jan 26, 2010 by nicolasraoul

I want to create a dialog so I followed the tutorial:

I created the files and deployed them as explained by the tutorial, then I restarted Alfresco (3.2).
But the item action does not appear. Not even in the "More actions" menu.

No error in the log either (log4j: all debug).
What did I do wrong?

Here is the content of the ZIP file I uncompress in a fresh Alfresco 3.2's tomcat/webapps/alfresco:

> jsp
   > extension
      > add-aspect.jsp
   > lib
      > custom-dialog.jar

Here is the content of custom-dialog.jar:

> alfresco
   > extension
      > web-client-config-custom.xml
   > faces-config.xml
> org 
   > alfresco
      > sample
         > AddAspectDialog.class


<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>

<h:outputText value="#{msg.aspect}: " />
<h:selectOneMenu value="#{DialogManager.bean.aspect}">
   <f:selectItems value="#{RunActionWizard.testableAspects}" />

web-client-config-custom.xml (I am sure this file is read, because if I break the XML then Alfresco complains):

         <!– Launch Add Aspect Dialog –>
         <action id="add_aspect">
            <label>Add Aspect</label>
               <param name="id">#{}</param>
         <!– Add action to more actions menu for each space –>
         <action-group id="space_browse_menu">
            <action idref="add_aspect" />
         <dialog name="addAspect" page="/jsp/extension/add-aspect.jsp" managed-bean="AddAspectDialog"
                 icon="/images/icons/add_content_large.gif" title="Add Aspect"
                 description="Adds an aspect to the selected node" />

faces-config.xml (I am sure this file is read, because if I break the XML then Alfresco complains):

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"


Manifest-Version: 1.0
Created-By: Nicolas
Class-Path: web-client-config-custom.xml

package org.alfresco.sample;

import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;

public class AddAspectDialog extends BaseDialogBean
   protected String aspect;

   protected String finishImpl(FacesContext context, String outcome) throws Exception
      // get the space the action will apply to
      NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();

      // resolve the fully qualified aspect name
      QName aspectToAdd = Repository.resolveToQName(this.aspect);

      // add the aspect to the space
      getNodeService().addAspect(nodeRef, aspectToAdd, null);

      // return the default outcome
      return outcome;

   public boolean getFinishButtonDisabled()
      return false;

   public String getAspect()
      return aspect;

   public void setAspect(String aspect)
      this.aspect = aspect;

Strangely, if instead of deploying this ZIP I just copy web-client-config-custom.xml to shared, then the item action appears (but of course it does not go further). However, I am sure this file is read in both cases, because if I break the XML then Alfresco complains.

Thanks a lot!