cancel
Showing results for 
Search instead for 
Did you mean: 

Use of Aikau widgets into the documentLibray

douglascrp
World-Class Innovator
World-Class Innovator
Hello everyone.

I'm trying to figure out if it is possible to create a custom action, to be used through the multi-selection actions list.
My idea is to create a custom "folder picker", but I'm thinking about using the Aikau one instead of the YUI one.

So, my question is, is ito possible to use Aikau widgets inside pages not created using Aikau?

If that is possible, how could I create such action?

Thank you in advance.
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Hi douglascrp,

luckily I spotted your post among all the spam that is currently flooding this forums.

Technically, there shouldn't be issues with using Aikau in non-Aikau pages. But you need to be mindful of some core aspects of how Aikau dependencies are loaded.

One thing I have learnt is to avoid having two web scripts on the same non-Aikau page (i.e. a page not served by a single full-page web script) call the processJsonModel FreeMarker directive. Since both calls are processed independantly from each other, you are likely to end up loading the same widgets or instantiating the same services twice at runtime. Maybe the service instantiation would not occur with the latest changes to Aikau that were blogged about a few days ago, but I am not sure of this

I think the best way would be to add a custom service that you want to call from a doclib action into the jsonModel of the share-header web script, which executes processJsonModel on all out-of-the-box non-Aikau pages. Any runtime widgets that you may require should be referenced (directly or transitively) by defining a "widgets" property in your custom service module (client) JS. The Dojo dependency handler should pick up those dependencies in the JS source and include them into the aggregated JS file.
In my current project I have even added some custom dependency rules to enhance how Aikau picks up dependencies from code in custom source files.

The only thing you should need to do then would be to fire a publication from your doclib action in such a way that your service can react to it. Theoretically, that should be as simple as writing this in your YUI action code:
<blockcode>
require(['alfresco/core/Core'], function(Core){
   var myCore = new Core();
   myCore.alfPublish('topic', payload);
});
</blockcode>

"require" should be globally available in any page that includes share-header.

Using an extension module with an evaluator should allow you to modify the jsonModel of share-header only on those pages where you actually need those widgets / services.

Regards
Axel

douglascrp
World-Class Innovator
World-Class Innovator
Thank you Axel

Hi douglascrp,

Were you able to achieve it? Can you please put some sample here?

Hey Gaurav.
I haven't even tried to follow that path Smiley Very Happy

To be honest, I can't even remember why I was doing the research on this topic.

krutik_jayswal
Elite Collaborator
Elite Collaborator
There is no need to create folder picker widget in aikau.
It is already available.

alfresco/forms/controls/ContainerPicker

Below is example

{
         name : "alfresco/forms/Form",
         config : {
            okButtonPublishTopic : "FORM_CONTENTS",
            widgets : [ {
               name : "alfresco/forms/controls/ContainerPicker",
               config : {
                  label : "Choose afolders",
                  name : "Folder"
               }
            } ]
         }
      }