TIP ListMeUpPlugin is not installed on Foswiki.org.

List Me Up Plugin

This plugin offers a REST interface and is usually called in a XHR environment. It is used to add/remove items to/from a list stored in the meta data of a topic (formfields, topic settings etc).

Using this plugin you have to perform only a single step to manipulate a list instead of ping-pong data between the webserver and the webbrowser.

Motivation

Let's say you have a DataForm named EventForm and a field called Attendees within that form which holds a comma-separated list of names. You want to offer an "Add me" button for your users to put themselves onto the list of Attendees.

Your javascript behind the button has to perform three steps:
  1. get the current list of attendees,
  2. manipulate the list within the browser and
  3. write back the new compiled list.
If there is a delay between step 1 and 3 (for whatever reason), another user may interfere and raise an update anomaly.

Example

See PluginTestListMeUpPlugin (JQueryPlugin needed).

REST interface

IDEA! Note: You have to be authenticated and use HTTP POST requests for all verbs.

add / remove verb

Parameter Description Default
webtopic Web.Topic, location where the list is stored. none
name Name of the list (ie. field name of preference name) none
type List type (FIELD, PREFERENCE or any custom type) FIELD
item Value to be added/removed to/from the list.
On remove all instances of item will be removed. Empty entries will be removed.
none
separator Seperator between items in the list
split Regex how to split up the list [,\s]+
duplicate Allow duplicate items to be added to the list. This does not affect duplicates which are already there. off
sort Sort the list. off

Possible return codes:

Code Text
200 Ok
400 Missing parameter 'webtopic'.
400 Missing parameter 'name'.
400 Missing parameter 'item'.
403 Forbidden.
404 Topic not found.
404 Metadata not found.
500 Error saving topic.

The handler may return a 200 Ok even if nothing was changed (due to a duplicate).

Installation

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Info

Author: Foswiki:Main.OliverKrueger
Copyright: © 2011, Foswiki Contributors
License: GPL (GNU General Public License)
Release: 1.0.0
Version: 12246 (2011-07-28)
Change History:  
1.0.0 (20 Jul 2011): Initial version
Home: http://foswiki.org/Extensions/ListMeUpPlugin
Support: http://foswiki.org/Support/ListMeUpPlugin
Topic revision: r1 - 28 Jul 2011, OliverKrueger - This page was cached on 03 Dec 2016 - 10:39.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License