AnsweredAssumed Answered

Using Share dashlets in 3rd party apps

Question asked by smcardle on Apr 10, 2012
Hi All.

I am building some integration to Alfresco in our web application. So far we are using a bunch of the pre-built and some custom built web scripts from the Alfresco repository layer via their REST URI's.

What I would like to do is now use some of the Share dashlets in our application home page, such as the my-tasks dashlet. However, I call these dashlet - web scripts I get server error 500 responses.

In a browser I use the URL http://localhost:8080/share/page/components/dashlets/my-tasks and get the following error

An error has occured in the Share component: /share/page/components/dashlets/my-tasks.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 03110002 Failed to process template org/alfresco/components/dashlets/my-tasks.get.html.ftl
Server: Alfresco Spring WebScripts - v1.0.0 (Release 958) schema 1,000
Time: Apr 11, 2012 9:21:51 AM
Click here to view full technical information on the error.
Exception: freemarker.core.InvalidReferenceException - Error on line 1, column 1 in org/alfresco/components/dashlets/my-tasks.get.html.ftl args.htmlid is undefined. It cannot be assigned to id
freemarker.core.Assignment.accept(Assignment.java:111)
freemarker.core.Environment.visit(Environment.java:221)
….


So the problem here is to do with the htmlid not being specified (this is done by the framework normally), this allows a dashlet to be placed more than once on a page. I appended htmlid as a query parameter to the URL to fix this but then I get another server 500 error (see below).

http://localhost:8080/share/page/components/dashlets/my-tasks?htmlid=test

An error has occured in the Share component: /share/page/components/dashlets/my-tasks.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 03110004 Failed to process template org/alfresco/components/dashlets/my-tasks.get.html.ftl
Server: Alfresco Spring WebScripts - v1.0.0 (Release 958) schema 1,000
Time: Apr 11, 2012 9:25:57 AM
Click here to view full technical information on the error.
Exception: freemarker.template.TemplateModelException - get(id) failed on instance of org.springframework.extensions.webscripts.ScriptModelObject
freemarker.ext.beans.BeanModel.get(BeanModel.java:224)
Exception: org.springframework.extensions.webscripts.WebScriptException - 03110004 Failed to process template org/alfresco/components/dashlets/my-tasks.get.html.ftl
org.springframework.extensions.webscripts.processor.FTLTemplateProcessor.process(FTLTemplateProcessor.java:175)

The problem would seem to be that I don't have a full list of dependencies i.e. java script files required by the alfresco my-tasks dashlets in my projects html pages head section and I don't know how to get past this problem without downloading the source for 4.0 community and debugging (looking at the generated html source of the share page just gives me to much info).

What I probably really need is a way to get the output of the my-tasks.get.head.ftl template ???? Any ideas…. I may also need some extra common java script files such as alfresco-min.js (if this is not already part of the head.ftl output).

I was hoping that somebody had already done this and could point me in the right direction. Or better still I hoped somebody maybe had already created a web script that allowed us to get the output of the head.ftl template.

Alternatively this may not be possible…. If not why not? OR what would be the preferred way to reuse the share UI web scripts. I can't see why we can't use the presentation web scripts in this way as they just generate html divs, it just means we have to use our own styling for layout based on the generated classes and id's.


Regards

Steve

Outcomes