Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

AjaxEditSupport

Summary: Adds a wikipage/attachment/category AJAX browser to Edit pages
Version: 20110223
Prerequisites: PmWiki 2.2.8+ (others may work, untested). PHP 5.0+. jQuery, included
Status: WIP
Maintainer: Esteve Boix
Categories: Editing Ajax

Questions answered by this recipe

This recipe helps in editing pages, since it allows the user to browse for existing pages, and to add a link with a couple of mouse clicks.

Not only you can browse for existing pages, but attachments and categories also.
In v1.0+, you can browse the current page (tables, headers, etc...) and you can define templates to insert them easily.

I've set up a test page in http://www.esteveb.com/Software/AjaxEditSupport.

Features:
  • Lists wiki pages, attachments and categories.
  • Caches pages (just the list of wiki pages and the most used rendered pages), so it tries not to overload the server.
  • Retrieves parts of the current page (links, attachments, tables...) and offers them as a list. The user just clicks and the text is highlighted.
  • The administrator can define template pages (site-wide, group-wide and one in the profile page of the user, for example). The user can easily insert the snippets found there.

Current limitations:

  • Caches pages, so changes to other wiki pages during the editing session are invisible to the user.
  • The attach-list considers that you're working with per-page attachments. Other configurations are currently not supported nor tested.

Description

Adds a wikipage/attachment/category AJAX browser to edit pages.

Notes

To install: download the recipeΔ, unpack, and copy the files into your current installation of PmWiki.

Now edit "config/local.php" and add:

include_once("$FarmD/cookbook/ajaxeditsupport.php");

NOTE: You must also have $EnableGUIButtons = 1; set for AjaxEditSupport to work (AES relies on some functions defined in guiedit.js)

You can then set some config variables, to control some aspects of the recipe:

  • $AjaxEditSupportPageBrowser (0|1): Enables the pages browser. Defaults to 1 (enabled).
  • $AjaxEditSupportAttachmentBrowser (0|1): Enables the attachments browser. Defaults to 1 (enabled).
  • $AjaxEditSupportCategoryBrowser (0|1): Enables the categories browser. Defaults to 1 (enabled).
  • $AjaxEditSupportEditBrowser (0|1): Enables the "current page" browser. Defaults to 1 (enabled).
  • $AjaxEditSupportTemplatesBrowser (0|1): Enables the templates browser. Defaults to 1 (enabled).
  • $AjaxEditSupportBrowserWidth: Sets the width in pixels of the browsers. Defaults to 450.
  • $AjaxEditSupportBrowserHeight: Sets the height in pixels of the browsers. Defaults to 300.
  • $AjaxEditSupportHidePages: Sets a RegExp of pages the pages browser will ignore. Defaults to "/(.*(GroupHeader|GroupFooter|RecentChanges)|Site.*)/" (it won't list GroupHeader, GroupFooter, RecentChanges and anything that starts with "Site").

Finally, you have to edit your edit form (usually "Site/EditForm"). You have to add "(:ajaxeditsupport:)" whereever you want the buttons to appear.

There you go !

Release notes

23/2/2011 - Fourth release (1.0a):

  • Solved a problem with Internet Explorer 8 which caused all the source of the page to appear as a single line in the textarea if the "Current page" browser was enabled.
    Thanks to Ricard NĂ cher for finding the problem and the solution.

20/2/2011 - Third release (1.0):

  • New "Current page" browser.
  • New "Templates" browser.
  • Click anywhere to close a browser.
  • New config options.

23/1/2010 - Second release (0.6):

  • Solved a problem when direct download was enabled.
  • Added config options for:
    • $AjaxEditSupportPageBrowser (0|1): Enables page browser. Defaults to 1 (enabled).
    • $AjaxEditSupportAttachmentBrowser (0|1): Enables attachments browser. Defaults to 1 (enabled).
    • $AjaxEditSupportCategoryBrowser (0|1): Enables categories browser. Defaults to 1 (enabled).
    • $AjaxEditSupportBrowserWidth: Sets the width in pixels of the browsers. Defaults to 450.
    • $AjaxEditSupportBrowserHeight: Sets the height in pixels of the browsers. Defaults to 300.

28/12/2009 - First release (0.5)

See also

Contributors

Esteve Boix

Comments

See discussion at AjaxEditSupport-Talk

User notes +2 -1: 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 July 08, 2014, at 08:16 AM