Lockie wrote:
Okay I got it working and I'm very happy with the result! I'll share what I did incase anyone else is interested in doing this. Note that the links don't work in Firefox (the file:// part doesn't seem to generate). My users only use IE so I didn't really explore this problem, but you can play around with it to get it working. Also, the user has to have access to the directory so this is only useful on an Intranet with networked drives.
First step install the PHP Macro, then copy/paste this code in your page making sure you change the desired drive.
{{velocity}} $xwiki.jsfx.use("js/xwiki/table/tablefilterNsort.js") $xwiki.ssfx.use("js/xwiki/table/table.css") {{/velocity}}
{{php}} {{html}} <table id="formList" class="grid sortable filterable doOddEven" cellpadding="0" cellspacing="0" border="0"> <tr class="sortHeader"> <th>Form Name</th> <th>Path</th> </tr> <?php $dirname = "R:/Quality/FORMS/"; $dir = opendir($dirname);
while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..")) { echo("<tr> <td>$file </td>"); echo("<td> $dirname$file Open Form </td> </tr>"); } } ?> </table> {{/html}} {{/php}}
This results in a filterable table with a list of all the files in the directory and subfolders of it with the file names in the left column and a link to open the file in the right column.
Regards,
----- ---- Lockie
Thanks, Lockie. I've not used this yet. If I'm not wrong, I think that some PHP developer here will be happy to use some of the scripts they have programmed within XWiki :-) Greetings, Ricardo -- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems