cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Dialog in WCM

vijay_alfresco
Champ in-the-making
Champ in-the-making
Hi,

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 AddAvmContentDialog.java
      

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 AVMEditContentPropertiesDialog.java 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;
  
  
   @Override
   public void init(Map<String, String> parameters)
   {
      super.init(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


   <managed-bean>
      <description>
         The bean that backs up the AVM Add Content Dialog
      </description>
      <managed-bean-name>AVMEditContentPropertiesDialog</managed-bean-name>
      <managed-bean-class>org.alfresco.web.bean.wcm.AVMEditContentPropertiesDialog</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>dictionaryService</property-name>
         <value>#{DictionaryService}</value>
      </managed-property>
      <managed-property>
         <property-name>avmService</property-name>
         <value>#{AVMLockingAwareService}</value>
      </managed-property>
      <managed-property>
         <property-name>avmBrowseBean</property-name>
         <value>#{AVMBrowseBean}</value>
      </managed-property>
   </managed-bean>

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">
            <permissions>
               <permission allow="true">CreateChildren</permission>
            </permissions>
            <label-id>edit_content</label-id>
            <image>/images/icons/add.gif</image>
            <action>dialog:editContentProperties1</action>
            <action-listener>#{AvmEditContentPropertiesDialog.start}</action-listener>
         </action>

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.

Thanks,
Vijay
1 REPLY 1

vijay_alfresco
Champ in-the-making
Champ in-the-making
Could any one put some light on this,


Please, help me out…..I need this to be working ASAP