Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Alfresco Share provide any mecanism for Inter Dashlet Communication?

Tags:

share

alfresco

I am trying to figure out how to perform some inter dashlet communication with Alfresco Share. Here a simple use case:

We do have 2 dashlets, let's call them A and B. I want to be able to fill in a field "name" (let's say with value "Toto") in A and click on submit button. After clicking on submit button in A. B should be updated with greeting like " Good Morning Toto".

Thank you for you answers.

Thanks for your answer. Can you elaborate a bit regarding "let dashlet_b.get.html.ftl post something to dashlet_a.post.html.ftl" ?

In dashlet_b.get.html.ftl you have something like that I guess :

<form id="..." action="" method="POST">
     <input  id="name" type="text" name="name" value=""/>
     <input type="submit" id="send" value="Send" /></form>

When you submit the form it's gonna look for dashlet_b.post.js right ? How do you actually tell to send the form to dashlet_a.post.js ?

like image 955
Karl Estop Avatar asked Oct 19 '11 16:10

Karl Estop


1 Answers

To create these dynamic dashlets it is not enough to use the server side dashlet webscript. You need javascript logic in the browser to notify the other dashlet of changes. This is how Alfresco usually does that:

Browser Javascript Dashlet A:

YAHOO.Bubbling.fire("interDashletMessage",
{
    message: "Hello World."
});

Browser Javascript Dashlet B:

YAHOO.Bubbling.on("interDashletMessage", function(layer, args) {
    var message = args[1].message;
    alert(message); // or write it to the dashlets HTML content
});

This will send the message from dashlet A to dashlet B using a custom event called "interDashletMessage".

If your dashlet B only displays a few messages it could be enough to send the data over using the events. If it is more complex your dashlet A needs to post it's data to the repository first, then trigger the "refresh" event and have dashlet B refresh it's content from the repository. This will involve multiple webscripts you may need to write.

like image 148
Florian Avatar answered Oct 02 '22 21:10

Florian