cancel
Showing results for 
Search instead for 
Did you mean: 

html file with a clickable list of documents in a folder

icarrara
Champ in-the-making
Champ in-the-making
Hi!  I'm new to Alfresco.
I deployed the 1.4 version and I'm using it without problems.

Now I'm trying to automatically generate an index.html file in every folder.

This html file have to include a list of all files in that folder.
So I can use this index.html in other client or website to reach the documents in the folder and download it.

I'm thinking that I have to use the template mechanism but I need more help to start. 

I read the Template Guide from the Wiki but I'm not able to start my job.

Please, there is someone that can help me to start?

Thank you in advance!!

Ivano C.
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
If you want to generate and modify a file then you would be best to use the JavaScript API. You can create and modify files, list the contents of folders and build up any output you like using it:
http://wiki.alfresco.com/wiki/JavaScript_API

Take a look at the installed scripts in your Alfresco installation that do something similar to what you want as an example:
'Company Home/Data Dictionary/Scripts/backup and log.js'
you'll see that the example creates and modifies a file in the current directory.

You simply need to create an INBOUND rule in the folder that you want to create your index.html file in and select the script you want to execute in the Create Rule wizard.

Hope this helps,

Kevin

icarrara
Champ in-the-making
Champ in-the-making
Dear Kevin, thank you for your reply!

I'll to go more in deep about my needs…

I'm trying to integrate the contents of my Alfresco 1.4 Server with a Liferay Portal Server 4.2.1.

As you know, Liferay released a Alfresco Content Portlet - this portlet displays one file from an Alfresco's folder.

I'll automatically create a Html file in all folders of the Alfresco Server so I can point this Html file from the Liferay Content Portlet.

In the body of this Html I need a download link to any files in this folder, so the user of the portlet can download the file directly from the Alfresco's folder.

Can I do that with JavaScript API?

Thank you in advance for your more help!

Sincerely,
Ivano C.

kevinr
Star Contributor
Star Contributor
Yes the JavaScript API can be used to generate links or any other HTML you want in the destination file. It is easy to build up links to documents - take a look at some of the example templates in 'Company Home/Data Dictionary/Presentation Templates' such as the RSS one as that builds up links - you can use similar techniques when outputing your page in JavaScript.

Thanks,

Kevin