Summary: List all uploaded files in RecentUploads pages
Version: 2009-09-03
Questions answered by this recipe
How do I track every uploaded file in the RecentChanges and AllRecentChanges pages and easily review it?
Description
Every uploaded file is logged in the Group.RecentUploads pages with a link from (All)RecentChanges for easy review.
The format of what is printed in the RecentChanges and RecentUploads pages, is defined with the $RecentUploadsFmt variable in config.php. It is the same as $RecentChangesFmt and will be used as an indication where to write the log and what information to include.
Initially, the variable $RecentUploadsFmt is not set. An administrator needs to define it in config.php to enable the logging of uploaded files.
Configuration examples
Currently, the PmWiki.org site logs every upload to the page Site.AllRecentChanges with the following command line:
$RecentUploadsFmt['$SiteGroup.AllRecentChanges'] =
'* [[{$Group}/]] / [[(Path:/pmwiki/uploads/{$Group}/)$upname]] '
.'. . . $CurrentTime Uploaded by $AuthorLink to [[{$Group}/{$Name}]] ($upsize $[bytes])';
One could use $RecentUploadsFmt['$SiteGroup.AllRecentUploads'] to log the files to a page named Site.AllRecentUploads instead.
The format used by the standalone recipe in the past, before inclusion to the core, was:
$RecentUploadsFmt['$Group.RecentUploads'] =
'* [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]]'
.' . . . $CurrentTime $[by] $AuthorLink ($upsize bytes)';
$RecentUploadsFmt['$Group.RecentChanges'] =
'* [[{$Group}/RecentUploads]] . . . $CurrentTime $AuthorLink :'
.' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize bytes)';
$RecentUploadsFmt['$SiteGroup.AllRecentChanges'] =
'* [[{$Group}.RecentUploads]] . . . $CurrentTime $AuthorLink :'
.' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize bytes)';
This logs every upload to the page Group.RecentUploads, and adds a link to that page both to Group.RecentChanges and Site.AllRecentChanges. Only the latest upload for a Group is displayed in (All)RecentChanges, however, clicking on the link Group.RecentUploads will show you all uploaded files for the Group.
Note that in the current PmWiki core, a page named RecentUploads will be excluded from page lists (with list=normal).
Notes
- The recipe may not work as expected if you have different settings for the
$UploadPrefixFmt variable in different pages or groups.
- Only files uploaded after the installation of this recipe will be logged.
- The older recipe should no longer be used with PmWiki version 2.2.6 and newer. This same functionality was added to the PmWiki core.
If you are using the old recipe and upgrade to PmWiki 2.2.6 or newer, please uninstall it. Then, to enable the recent uploads as before add to config.php the code shown at the section format used by the standalone recipe above. If you experience any difficulty, contact me (Petko).
Release Notes
Comments
You may also want to add a link to your RecentUploads pages from action=upload pages by adding something like the following near the top of your Site.UploadQuickReference page: --Eemeli Aro April 18, 2009, at 07:41 AM
(:if exists {*$Group}.RecentUploads:)
View log of [[{*$Group}.RecentUploads|recent uploads]] to this group
(:ifend:)
Questions
If I understand the feature correctly, in case the upload structure varies between uploads per group and uploads per page, the above example code does not always create working links. The same also seems to apply if some groups use directories not in the uploads path structure. Is there perhaps a way to query each group's specific upload location to get consistently working links? (Great feature anyhow! :-) --Henning December 15, 2009, at 01:07 PM
No, the link will be saved with the settings of the page where you upload the file, and will be displayed with the settings of the Group.RecentUploads or RecentChanges page when you browse it. --Petko December 15, 2009, at 02:18 PM
See Also
Contributors
User notes +3: If you use, used or reviewed this recipe, you can
add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date
These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.