cancel
Showing results for 
Search instead for 
Did you mean: 

changing 'add content' logic

friedman30
Champ in-the-making
Champ in-the-making
hi,

I need to change the "add content" logic in a way that after uploading a file, Alfresco will skip the dialog with the general properties and go directly to the extended properties dialog (titled: "Modify Content Properties").

I'll try to simplify my task - when pressing the "upload" button - Alfresco will not show the "file was uploaded successfully" message and the rest of this page, but navigate directly to the "Modify Content Properties" page

I checked AddContentDialog.java and add-content-dialog.jsp files, but could not find the logic that calls this page….

what should i do to achieve  this?
:?:  :?:  :?:

thanks,

Dror
9 REPLIES 9

gavinc
Champ in-the-making
Champ in-the-making
It's the doPostCommitProcessing() method in AddContentDialog that decides whether the properties page is shown or not at the end.

The problem with what your suggesting is that currently the file upload is done in a different form (than the one the main page is using), this is the reason for the 2 step process i.e. file is uploaded then outer form is posted with general properties.

A potential solution is to make the page auto submit when it returns from uploading the file i.e. inside the
<% if (fileUploaded) { %>
section in the JSP.

friedman30
Champ in-the-making
Champ in-the-making
Thanks Gavin!

Are you suggesting that i should replace all the code inside <% if (fileUploaded) { %> with an auto-submit code that triggers the "OK" button? 

Is there anything else that should be done to navigate to the next jsp page without messing everything on the way?
How do i do make the page auto-submit? :?

Thanks,

Dror

friedman30
Champ in-the-making
Champ in-the-making
I tried everything i could imagine…

the content is loaded and saved, but i am not getting navigated to the properties page…. not only that - the "OK" button is now not functioning anymore…

I believe i am missing something here…
  :evil:

gavinc
Champ in-the-making
Champ in-the-making
I was suggesting just to add some javascript within the <% if (fileUploaded) { %> block so that the form gets submitted as soon as the page loads, for example:


<% if (fileUploaded) { %>
<script>
   window.onload = submitForm;
   function submitForm()
   {
      document.getElementById(""add-content-upload-end").submit();
   }
</script>
….
<% } %>

If you still don't have any luck try turning on debug for the AlfrescoNavigationHandler and post the output, you do this as follows:

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

Hope this helps.

friedman30
Champ in-the-making
Champ in-the-making
Hi Gavin.

I've tried exactly what you suggested but still, the form was not submitted.
this is what i get in the log file:

11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=dialog:addContent)
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/browse/browse.jsp
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Opening dialog 'addContent'
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using dialog container: /jsp/dialog/container.jsp
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/wizard/container.jsp
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Pushed item to view stack: /jsp/browse/browse.jsp
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Looking up dialog in global config
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No dispatch context found
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'addContent' to original navigation handler
11:44:40,417 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/jsp/browse/browse.jsp]

:?:  :?:  :?:
any ideas?

thanks,

Dror

friedman30
Champ in-the-making
Champ in-the-making
hey guys.

I'm back on this mission of mine, but still have no idea on how to solve this…

  :shock:

Dror

kevinr
Star Contributor
Star Contributor
This can be done. We have something very similar in the WCM wizard code. See the Create Web Form wizard. On the first page there is an Upload component that performs the upload and refresh in one step - that should help:
projects\web-client\source\web\jsp\wcm\create-form-wizard\details.jsp

Thanks,

Kevin

friedman30
Champ in-the-making
Champ in-the-making
Hi kevin.

could you please be more specific regrading your solution?
should i change the .jsp file so that it would look like details.jsp ?
should i change anything in the wizard (xml) itself?

:?:   :?:   :?:
thanks.

Dror

friedman30
Champ in-the-making
Champ in-the-making
Hi again.

I recently got back to the subject, and managed to acheive some progress. i have followed gavin's advice and what happens is that the page submits itself recursively without continuing to the modify properties page. i can see that the modify properties belongs to the same jsp according to the browser, but cannot see the references in the jsp, so i cannot understand what variable decides what page to show and thus cannot handle my problem. any help?

i hope it is understandable, please tell me if not.

thanks,

Dror