This is a working DekiScript block to list the files attached to the Extensions page.
{{
var page = wiki.getpage( '/MindTouch_Deki/Extensions' );
if( #map.values( page.files ) == 0 ) {
web.html( "<p>No files are attached to page " .. page.name .. "</p>" );
}
else {
web.html( "<p>" .. #map.values( page.files ) .. " files are attached to page " .. page.name .. "</p>" );
foreach( var file in map.values( page.files ) ) {
web.html(
"<p>" ..
__count + 1 .. ") <b>" .. file.name .. "</b><br />" ..
"<i>Description:</i> " .. file.description .. "<br />" ..
"<i>Date:</i> " .. file.date .. "<br />" ..
"<i>Size:</i> " .. file.size .. " bytes<br />" ..
"<i>URI:</i> <a href='" .. file.uri .. "'>" .. file.uri .. "</a><br />" ..
"<i>API:</i> <a href='" .. file.api .. "'>" .. file.api .. "</a><br />" ..
"<i>Mime:</i> " .. file.mime .. "<br />" ..
"<i>Author:</i> " .. file.author .. "<br />" ..
"<i>Page:</i> " .. file.page .. "<br />" ..
"</p>"
);
}
}
}}
2 files are attached to page How_do_I..._Display_a_list_of_files_attached_to_a_page?
1) dir300_v1.05_93gb.bin
Description: Simple description
Date: Sat, 02 May 2009 16:32:44 GMT
Size: 2416768 bytes
URI: http://developer.mindtouch.com/@api/deki/files/4307/=dir300_v1.05_93gb.bin
API: http://developer.mindtouch.com/@api/deki/files/4307
Mime: text/plain
Author: aldago
Page: How do I... Display a list of files attached to a page?
2) dir300.release.note.txt
Description: Simple description
Date: Sat, 02 May 2009 16:32:13 GMT
Size: 30865 bytes
URI: http://developer.mindtouch.com/@api/deki/files/4306/=dir300.release.note.txt
API: http://developer.mindtouch.com/@api/deki/files/4306
Mime: text/plain
Author: aldago
Page: How do I... Display a list of files attached to a page?
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| dir300.release.note.txt Simple description | 30.14 kB | 16:32, 2 May 2009 | aldago | Actions | ||
| dir300_v1.05_93gb.bin Simple description | 2.3 MB | 16:32, 2 May 2009 | aldago | Actions | ||
good function!
Is there any way to sort it by Name or date?
regards!
It works Perfect!
regards!!