We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Plugins Web>RestPlugin (07 Jun 2008, SvenDowideit)
Tags:
create new tag
, view all tags

RestPlugin

Full implementation of REST - starting with FormFields

Usage

This plugin begins the task of creating a real REST URI engine for TWiki. It uses a TWiki:Codev.TopicObjectModel addressing scheme based on the IfStatements and QuerySearch syntax, and then enable both the retriving and setting / creation of topics and parts of topics.

Initially, it will be implemented using Dojotoolkit's Diji InlineEdit component, and apply just to formfields. This should give us a strong basis to extend the work to all topic fragments.

For this plugin to work, you need to make a small change to TWiki4.2 lib/TWiki.pm to enable ordering of js

Index: lib/TWiki.pm
===================================================================
--- lib/TWiki.pm   (revision 81)
+++ lib/TWiki.pm   (working copy)
@@ -584,7 +584,7 @@
         my $htmlHeader = join(
             "\n",
             map { '<!--'.$_.'-->'.$this->{_HTMLHEADERS}{$_} }
-              keys %{$this->{_HTMLHEADERS}} );
+              sort keys %{$this->{_HTMLHEADERS}} );
         $text =~ s!(</head>)!$htmlHeader$1!i if $htmlHeader;
         chomp($text);
     }

Examples

FORMFIELD

This allows you to change values in TWiki Forms without leaving the current topic - useful for reports and inline data-wiki applications. This syntax will be simplified in future.

This example alows you to view, and change the Summary Field in BugItem1? (from TWiki:Plugins.BugsContrib) - by just clicking on the text, changing it, and then hitting ENTER

Summary field not found

%FORMFIELD{
    "Summary" 
    topic="Sandbox.BugItem1" 
    default="(not set)" 
    alttext="Summary field not found"
    format="<span id='Sandbox.BugItem1:FIELD.Summary' class="RestPluginEditable" dojoType='dijit.InlineEditBox' onChange='myHandler(this.id,arguments[0])'>$value</span>"
}%

Inline edit of forms in topic.

If you have installed this plugin, enabled it, and set SKIN=dojo,pattern then you can also goto BugItem1? , and edit each of the formfields directly.

Customisation

To make customisation possible, the javascript, and the formtables rendering is defined using the restpluginscript.tmpl and formtables.dojo.tmpl templates. To create your own implementations, create a new TWiki Contrib that contains your javascript (in pub) and templates to activate them. Then set your SKIN to include your templates.

Installation Instructions

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 where TWiki is running.

Like many other TWiki extensions, this module is shipped with a fully automatic installer script written using the BuildContrib.

  • If you have TWiki 4.2 or later, you can install from the configure interface (Go to Plugins->Find More Extensions)
  • If you have any problems, then you can still install manually from the command-line:
    1. Download one of the .zip or .tgz archives
    2. Unpack the archive in the root directory of your TWiki installation.
    3. Run the installer script ( perl <module>_installer )
    4. Run configure and enable the module, if it is a plugin.
    5. Repeat for any missing dependencies.
  • If you are still having problems, then instead of running the installer script:
    1. Make sure that the file permissions allow the webserver user to access all files.
    2. Check in any installed files that have existing ,v files in your existing install (take care not to lock the files when you check in)
    3. Manually edit LocalSite.cfg to set any configuration variables.

Plugin Info

Plugin Author(s): TWiki:Main.SvenDowideit - http://distributedINFORMATION.com a wikiringlogo20x20.png WikiRing founding partner
Copyright: © SvenDowideit@distributedINFORMATIONPLEASENOSPAM.com
Gear Icon based on eXperience Crystal, by David Christian Berg
UniversalWikiEditButton? http://www.aboutus.org/UniversalWikiEditButton
License: GPL (Gnu General Public License)
Plugin Version: 64 (19 Mar 2008)
Change History:  
Dependencies:
NameVersionDescription
TWiki::Contrib::DojoToolkitContrib>=1.0DojoToolkit release 1.0
JSON>=1.0JSON CPAN module
Plugin Home: http://twiki.org/cgi-bin/view/Plugins/RestPlugin
Feedback: http://twiki.org/cgi-bin/view/Plugins/RestPluginDev
Appraisal: http://twiki.org/cgi-bin/view/Plugins/RestPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment Action Size Date Who Comment
elsemd5 RestPlugin.md5 manage 0.1 K 19 Mar 2008 - 03:17 SvenDowideit  
ziptgz RestPlugin.tgz manage 108.1 K 19 Mar 2008 - 03:17 SvenDowideit  
zipzip RestPlugin.zip manage 110.2 K 19 Mar 2008 - 03:16 SvenDowideit  
elseEXT RestPlugin_installer manage 3.9 K 19 Mar 2008 - 03:17 SvenDowideit  
Topic revision: r7 - 07 Jun 2008 - 01:39:22 - SvenDowideit
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback