cancel
Showing results for 
Search instead for 
Did you mean: 

Repository in Dashlet

aitbenmouh
Champ in-the-making
Champ in-the-making
Hello,

Is there a method to developp a Dashlet that browse the repository ? if yess so how to do it thinks for your answers .
8 REPLIES 8

jpotts
World-Class Innovator
World-Class Innovator
The Share web app consists of dashlets that fetch data from the repository, so it is full of examples. Aside from that, here is a simplified example:

Part One: http://ecmarchitect.com/archives/2012/05/08/1592
Part Two: http://ecmarchitect.com/archives/2012/05/15/1599

You should also look at the dashlets in <a href="http://code.google.com/p/share-extras/">Share Extras</a> as examples.

Jeff

aitbenmouh
Champ in-the-making
Champ in-the-making
Thanks for this answer i will test it .

aitbenmouh
Champ in-the-making
Champ in-the-making
I have a question for you Jeff why almost prefer to code the controler of webscript with javascript API and little do java backend ?

zladuric
Champ on-the-rise
Champ on-the-rise
I think this is because of the fast deploy. You do not need to restart alfresco, you do not need to do serious configuration changes or manage dependencies. Everyhing needed is already (well almost) in the javascript API, so it is the easiest way to work. + changes are a breeze.

jpotts
World-Class Innovator
World-Class Innovator
I agree, that is definitely one reason. I think another is that, in general, many devs find JavaScript more accessible. It is just faster to develop with.

There are times when Java is preferred. Maybe for API gaps or operations where performance is critical. But for web scripts, I almost always start with JavaScript and only go to Java when needed.

Jeff

aitbenmouh
Champ in-the-making
Champ in-the-making
Thanks very much for this infomation, i read many things about web-script and i get how it works, but i still have a problem in coding javascript and java, because i i can't find a way to compile, debug, test my code before to deploy it in share for example.

I still looking for an IDE for javascript that know the syntax of alfresco javascript API, and then can help me to correct my code and test it.

We need so your help in this point .

zladuric
Champ on-the-rise
Champ on-the-rise
Well, building an alfresco-specific javascript syntax recognition might be a bit tricky. You see, there are at least three different tiers to it:
- Repository controller - server side - scripts (for repo webscripts) - those are javascript, and have access to stuff like companyhome, people, group, userhome and similar objects tied to the repository and content itself.

- Share controller scripts - these are used in components for /share webapp. Like a frontend. So they have a bit of a frontendy root-scoped objects - like url, page, context.

- Share UI, client-side javascript - your regular javascript, but specific by including a lot of YUI 2 elements, and few alfresco-specific. Alfresco.constants is one such object, Alfresco.util.Ajax is another, Alfresco.util.PopupManager is yet another useful in building UI.

What I did is I used Eclipse a lot, but it felt clunky. It's not necessarily an overkill, but it can definitely get slow sometimes.
But since I prefer git over svn, and since Eclipse broke my .git repository a few times, I ditched it.

I now use vim and I'm pretty satisfied, especially when paired to ucompleteme plugin.

Regarding your question about "compile, debug, test code before deploying it", again I can't give you an answer, but I can give you an example.

What I have on my local workstation is a git repository, named after whatever project I'm working on. Something like $HOME/projects/MyNewAlfrescoProject. There are usually 4-5 subfolders: alfresco (for repository code), share for share, shared for the extensions directory, doc sometimes and if I need to also do Java, then src. The first two would simply be the exploded war archives.

Since it's linux, I keep my tomcat installation in /opt/tomcat or something like that. And I either configure tomcat to look directly in the folders I am working on.

So when I edit some code, I usually just have to refresh the webscripts - I have a tab open for alfresco and share webscripts. Of course, when you're working with data model changes, you might need to restart tomcat, but that's usually done fast, just to fix your usual typos Smiley Happy Almost anything else (well, most of the time it's share frontent), you don't need to refresh, just reload the new javascript.



aitbenmouh
Champ in-the-making
Champ in-the-making
Thanks very much for this explanation it's so useful .