AnsweredAssumed Answered

Custom dialog disappears

Question asked by pau.carre on Sep 19, 2008
Latest reply on Oct 28, 2008 by libman
Hi, I am developing an add-in for Alfresco. This add-in is a custom dialog linked to each document. I have had no problem since the dialog icon disappeared from all documents. After a lot of "trial and error" I finally had to reinstall Alfresco and then the new icon appeared. But, lately it disappeared again. I did not change any relevant file from the add in (just som JSPs). So I do not know why the icon disappears. I restart the server each time I deploy a new version and I do not see any error in the apache tomcat log.

Any idea of how to identify the problem?

thanks,
Pau Carré Cardona


source/alfresco.extension/web-client-config-custom.xml

<alfresco-config>

   <config>
      <actions>
         <!– Launch Add Aspect Dialog –>
         <action id="afegir_signatura">
            <label>Afegir signatura</label>
            <image>/images/icons/sign.png</image>
            <action>dialog:afegirSignatura</action>
            <action-listener>#{BrowseBean.setupContentAction}</action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>
        
         <!– Add action to more actions menu for each space –>
         <action-group id="document_browse">
            <action idref="afegir_signatura" />
         </action-group>
      </actions>
     
      <dialogs>
         <dialog name="afegirSignatura" page="/jsp/extension/add-signature.jsp" managed-bean="AddSignatureDialog"
                 icon="/images/icons/sign.png" title="Afegir signatura"
                 description="Afegeix una signatura al document actual" />
      </dialogs>
   </config>

</alfresco-config>

AddSignatureDialog.java

package org.alfresco.sample;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.repo.content.RoutingContentService;
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;

import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.Node;

public class AddSignatureDialog extends BaseDialogBean {
   protected String url = null;
   
   @Override
   protected String finishImpl(FacesContext context, String outcome)
         throws Exception {      
      return outcome;      
   }

   @Override
   public boolean getFinishButtonDisabled() {
      return false;
   }

   public String getURL() {
      if (url == null) {
         Node documentNode = browseBean.getDocument();
         NodeRef documentNodeRef = documentNode.getNodeRef();
         url = DownloadContentServlet.generateDownloadURL(documentNodeRef,
               "document");
      }
      return url;
   }

   public void setURL(String url) {
      this.url = url;
   }

FacesConfig.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

   <managed-bean>
      <managed-bean-name>AddSignatureDialog</managed-bean-name>
      <managed-bean-class>org.alfresco.sample.AddSignatureDialog</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
   </managed-bean>

</faces-config>

add-signature.jsp


<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ include file="base.jspf" %>
           
<%
  String target=base + "/jsp/extension/receive.jsp";
  String codebase = "../extension/signatureapplet.jar,../extension/signaturaapi-2.2.jar";
  String width = "700";
  String height = "300";
%>
<applet width="<%=width%>" height="<%=height%>" align="baseline"
           code="es.caib.signatura.client.applet.SignApplet"
           archive="<%=codebase%>"
           source="<%=base%><c:out value="${DialogManager.bean.URL}"/>;jsesssionid=<%=session.getId()%>"
           target="<%=target%>"
/>

Outcomes