cancel
Showing results for 
Search instead for 
Did you mean: 

New page on a document action

jamilnour
Star Contributor
Star Contributor
Hello,


In my application I have this working scenario:
- document details
- action to open a dialog
- before open the dialog a Get request call to the server is done to get some needed values
- An instance of SimpleDialog is created and show the corresponding FTL control
- on save a post call to server is doing the job using a java backbend web script

As I said everything is working fine with this scenario

Now what I have to do is for some actions I have to open a new page and not a dialog. How to achieve this?

I know how to create a new page and I did but where and how to call the Get request to the server to get the values before showing the page?

And how to call the Post request on the save button of the page form?

Any help is appreciated

Best regards
Jamil
1 REPLY 1

s_palyukh
Star Contributor
Star Contributor
Hello.


You should make custom page + custom page component where you will call Get Request.

For example you can to look at the /share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/download. There is component to archive and download. As you will see archive-and-download.get.js contains Alfresco.ArchiveAndDownload widget.

Alfresco.ArchiveAndDownload is located in /webapps/share/components/download/archive-and-download.js. It is Share UI javascript that will be called when component is loaded. This js contains ajax request.

You need to do the same.

To call Alfresco from Share UI js (http://sharextras.org/jsdoc/share/community-4.2.b/symbols/Alfresco.util.Ajax.html😞





Alfresco.util.Ajax.request(
                      {
                          url: actionUrl,
                          method: Alfresco.util.Ajax.GET,
                          responseContentType: Alfresco.util.Ajax.JSON,
                          successCallback:
                          {
                             fn: me._successHandler,
                              scope: me
                          },
                          failureCallback:
                          {
                              fn: me.__failureHandler,
                              scope: me
                          },
                          scope: me,
                          noReloadOnAuthFailure: me
                     });      




Also you can call Alfresco from share webscript:



var connector = remote.connect("alfresco");
var data = connector.get("/sample/some/url");

// create json object from data
var result = eval('(' + data + ')');