cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Add Content

vbaudry
Champ in-the-making
Champ in-the-making
Hi !

I'm trying to customize the Add Content Wizard/Dialog, to do some special processing for some file types.

I successfully created a AddCustomContentDialog for the "addContent" navigation case.

But now I want to customize the "Modify Content Properties" bean to do some stuff in the finishImpl(). So I created an EditContentPropertiesCustomDialog on the EditContentPropertiesDialog model.

I put it in my custom jar.

For configuration, I just created a web-client-config-custom.xml with the lines below :

<config>
      <dialog-container>/jsp/dialog/container.jsp</dialog-container>

      <dialogs>  
         <dialog name="editContentProperties" page="/jsp/content/edit-content-properties.jsp"
                 managed-bean="EditContentPropertiesCustomDialog" icon="/images/icons/details_large.gif"
                 title-id="modify_content_properties" description-id="edit_content_description" />  
                
      </dialogs>
     
   </config>

I didn't want to change the jsp that handles the bean for now.

I also put that in the faces-config-custom.xml to handle the bean :

<managed-bean>
      <description>
         The bean that backs up the Edit Content Properties Dialog
      </description>
      <managed-bean-name>EditContentPropertiesCustomDialog</managed-bean-name>
      <managed-bean-class>org.alfresco.sample.EditContentPropertiesCustomDialog</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>fileFolderService</property-name>
         <value>#{FileFolderService}</value>
      </managed-property>
      <managed-property>
         <property-name>dictionaryService</property-name>
         <value>#{DictionaryService}</value>
      </managed-property>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
   </managed-bean>

But when I try to test it, it seems that my CustomDialog isn't used … I put a System.out.println in it and it's never shown.

Any Idea ? Am I missing something ? Or doing something wrong ?

Please help !
10 REPLIES 10

vbaudry
Champ in-the-making
Champ in-the-making
Anyone ??

Is it possible to customize existing dialog to change only the managed bean ? Am I doing it wrong ??

Can't find documentation about overriding dialogs …

gavinc
Champ in-the-making
Champ in-the-making
It all looks to be configured correctly to me.

Where have you placed your web-client-config-custom.xml? Do you have another web-client-config-custom.xml anywhere in your setup?

vbaudry
Champ in-the-making
Champ in-the-making
I only have one web-client-config-custom.xml placed in the shared/extension folder.

I know that it's read because I got custom types I defined in it and they work well.

gavinc
Champ in-the-making
Champ in-the-making
Can you turn on debugging in log4j.properties for the following classes and post the contents of the alfresco.log file after you have tried opening your custom edit properties page?

log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=info

vbaudry
Champ in-the-making
Champ in-the-making
I got no additional output …

Did you notice the fact that I want to use a custom managed bean but the original jsp ?? Could it be the reason it doesn't work ?

gavinc
Champ in-the-making
Champ in-the-making
Yes I did, it shouldn't make any difference to be honest.

My mistake the line should have been the following:

log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug

vbaudry
Champ in-the-making
Champ in-the-making
Here is the result :

10:22:56,999 DEBUG [web.app.AlfrescoNavigationHandler] Passing outcome 'addConte
nt' to original navigation handler
10:22:56,999 DEBUG [web.app.AlfrescoNavigationHandler] view stack: []
10:23:36,417 DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAct
ion=#{AddCustomDialog.finish}, outcome=dialog:setContentProperties)
10:23:36,417 DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/ext
ension/add-custom-content-dialog.jsp
10:23:36,433 DEBUG [web.app.AlfrescoNavigationHandler] Opening dialog 'setConten
tProperties'
10:23:36,433 DEBUG [web.app.AlfrescoNavigationHandler] Pushed current view to st
ack: /jsp/extension/add-custom-content-dialog.jsp
10:23:36,433 DEBUG [web.app.AlfrescoNavigationHandler] Found config for dialog '
setContentProperties': org.alfresco.web.config.DialogsConfigElement$DialogConfig
@795d5f (name=setContentProperties page=/jsp/content/edit-content-properties.jsp
managed-bean=SetContentPropertiesDialog actions-config-id=null icon=/images/ico
ns/details_large.gif title=null titleId=modify_content_properties description=nu
ll descriptionId=edit_content_description errorMsgId=error_dialog)
10:23:36,480 DEBUG [web.app.AlfrescoNavigationHandler] view stack: [/jsp/extensi
on/add-custom-content-dialog.jsp]
10:23:59,649 DEBUG [web.app.AlfrescoNavigationHandler] handleNavigation (fromAct
ion=#{DialogManager.finish}, outcome=dialog:close:browse)
10:23:59,649 DEBUG [web.app.AlfrescoNavigationHandler] Current view id: /jsp/dia
log/container.jsp
10:23:59,649 DEBUG [web.app.AlfrescoNavigationHandler] Closing dialog with an ov
erridden outcome of 'browse'
10:23:59,649 DEBUG [web.app.AlfrescoNavigationHandler] Passing outcome 'browse'
to original navigation handler
10:23:59,649 DEBUG [web.app.AlfrescoNavigationHandler] view stack: []

As I thought, the navigationHandler doesn't see my overridden configuration for this jsp…

vbaudry
Champ in-the-making
Champ in-the-making
Is there a way with log4j to see if the reading of the web-client-config-custom is ok for this section ???

gavinc
Champ in-the-making
Champ in-the-making
Ahh, I see the problem.

When the wizard finishes creating the node the "setContentProperties" dialog is called not the "editContentProperties" dialog indicated by the line below:

10:23:36,433 DEBUG [web.app.AlfrescoNavigationHandler] Opening dialog 'setContentProperties' 

You'll therefore need to extend SetContentPropertiesDialog instead and override the config for "setContentProperties".