Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

FileAttachList

Summary: Adds a Ajax list of quickly attachable files to the edit page
Version: 0.2 May 21, 2009
Prerequisites: PmWiki
Status: Stable
Maintainer: Scotepi Timethy?
Categories: Editing, Files, Uploads, Ajax

Questions answered by this recipe

How can I view a list of attachable files on the edit page?

Description

Shows a link on the edit page to dynamically load a list of attachable files.

Install Instructions

  • Download jsfilelist.phpΔ to cookbook/jsfilelist.php
  • Add require_once("$FarmD/cookbook/jsfilelist.php"); to the end of local/config.php

Notes

  • To Change the look edit $Style in jsfilelist.php

Release Notes

  • 0.1 June 18, 2007
    • First Release
  • 0.2 May 21, 2009
    • Fix for pmwiki-2.2.1

See also

Comments

(2007-08-14) When I add the code above to local/config.php and copy to cookbook/jsfilelist.php, I get PHP code when loading pmwiki.php in edit mode. Also is it "require_once" or "include_once"? I tried both, but still got the echo of PHP code from jsfilelist.php.

(2007-08-21) Hi! I just tried it. The file you download when you click on the link is in fact the PHP source in HTML format. So what I did was to click on the link, this will show you the code in your browser. Just select all the code, copy-paste in a file named jsfilelist.php in your cookbook directory. Include this file in your local/config.php. Be sure that the skin you're using has a "<!--HTMLFooter-->" at the end of its code (mine hadn't), then you'll see the new link just before the buttons bar in edit mode. The only problem I found is that $uploaddir = FmtPageName("$jsflUploadDir$UploadPrefixFmt", $pagename); doesn't return the good directory if my page is in a PageGroup. I'll try to search why. (Jonathan Fretin)

(2007-08-26) Thanks Jonathan. However, now I although the ajax menu loads, my Save, Preview and Cancel buttons at the bottom of the edit window does not work. Advise?

(2009-05-21) Version 0.1 of this script is no longer compatible with the current version of PmWiki. The script reloads the page to get the filelist, and clobbers the URL in doing so, messing up the pagename variables. Here is a modified Version 0.2. Now it retains the original URL when loading the attachment list. Also it filters out thumbnails starting with th00. Works great with PmWiki pmwiki-2.2.1. timethy?

(2009-08-09) Very nifty recipe - thanks, just what I needed! It does not seem to work with group-based upload directories, though. It only lists files in $jsflUploadDir/$group/$name/, hardcoded. Would be neat if it honored $UploadPrefixFmt. Until then, just edit jsfilelist.php to $jsflUploadDir/$group/ to make it work for group-based uploads. Erich?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM