AnsweredAssumed Answered

Custom Dialog in WCM

Question asked by vijay_alfresco on Oct 8, 2007
Latest reply on Oct 9, 2007 by vijay_alfresco

I am trying to build my own custom dialog for WCM Add Content. I want this to be similar to the "Edit Properties Dialog" in alfresco CMS where you can edit the properties.

Following are the steps I followed, but the Edit Properties dialog is blank.

1. I Copied edit-content-properties from jsp/content folder to jsp/wcm folder

2. Added Following code in

protected String doPostCommitProcessing(FacesContext context, String outcome) {
this.showOtherProperties = true;
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.avmService.lookup(-1, this.path)));
return "dialog:avmEditContentProperties1";}

3. Created a new class and following is the code

package org.alfresco.web.bean.wcm;

import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.web.bean.content.EditContentPropertiesDialog;
import org.alfresco.web.bean.repository.Node;

public class AVMEditContentPropertiesDialog extends EditContentPropertiesDialog {

   /** AVM Browse Bean reference */
   protected AVMBrowseBean avmBrowseBean;
   protected AVMService avmService;
   public void init(Map<String, String> parameters)
      // setup the editable node
      this.editableNode = initEditableNode();
      // special case for Mimetype - since this is a sub-property of the ContentData object
      // we must extract it so it can be edited in the client, then we check for it later
      // and create a new ContentData object to wrap it and it's associated URL
      ContentData content = (ContentData)this.editableNode.getProperties().get(ContentModel.PROP_CONTENT);
      if (content != null)
         this.editableNode.getProperties().put(TEMP_PROP_MIMETYPE, content.getMimetype());
         this.editableNode.getProperties().put(TEMP_PROP_ENCODING, content.getEncoding());
    * Init the editable Node
   protected Node initEditableNode()
     //get the AVM path that will contain the content
     String parent = this.avmBrowseBean.getCurrentPath();

     return new AVMNode(this.avmService.lookup(-1, parent));
//   public void start(ActionEvent event)
//   {
//      // NOTE: this is a temporary solution to allow us to use the new dialog
//      //       framework beans outside of the dialog framework, we need to do
//      //       this because the uploading requires a separate non-JSF form, this
//      //       approach can not be used in the current dialog framework. Until
//      //       we have a pure JSF upload solution we need this initialisation
//      init(null);
//   }
    * @param avmService The AVMService to set.
   public void setAvmService(AVMService avmService)
      this.avmService = avmService;
    * @param avmBrowseBean    The AVMBrowseBean to set.
   public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
      this.avmBrowseBean = avmBrowseBean;

4. Entered Managed bean to faces-config-beans.xml as follows

         The bean that backs up the AVM Add Content Dialog

5. Added the dialog to web-client-config-dialogs.xml as follows

         <!– Definition of the edit content properties dialog –>
         <dialog name="editContentProperties1" page="/jsp/content/wcm/edit-content-properties.jsp"
                 managed-bean="AVMEditContentPropertiesDialog" icon="/images/icons/edit_properties_large.gif"
                 title-id="modify_content_properties" description-id="edit_content_description" />

6. Added action to web-client-config-wcm-actions.xml

         <action id="edit_content">
               <permission allow="true">CreateChildren</permission>

When I try to add the content and click on OK button in add dialog, I am getting Edit Properties screen with no details

Please let me know where I am wrong. I am new to Alfresco.