%META:TOPICINFO{author="TWikiContributor" date="1272705187" format="1.1" version="$Rev$"}%
---+!! !RestPlugin
<!--
   Contributions to this plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/RestPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/RestPluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.

   * Set SHORTDESCRIPTION = Full implementation of REST - starting with !FormFields
-->
<div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div>
%SHORTDESCRIPTION%

<img src="%PUBURL%/%WEB%/%TOPIC%/formfield_example.png" style="padding:6px" />

---++ 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 TWiki.IfStatements and TWiki.QuerySearch syntax, 
and then enable both the retriving and setting / creation of topics and parts of topics.

Initially, it will be implemented using [[http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/inlineeditbox][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.

---++ 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 Sandbox.BugItem1 (from TWiki:Plugins.BugsContrib) - by just clicking on the text, changing it, and then hitting ENTER

%FORMFIELD{
    "Summary" 
    topic="Sandbox.BugItem1" 
    default="(not set)" 
    alttext="Summary field not found"
    format="<span id='Sandbox.BugItem1:FIELD.Summary' class='RestPluginEditable' title='click to edit !Sandbox.BugItem1 Summary' dojoType='dijit.InlineEditBox' onChange='myHandler(this.id,arguments[0])'>$value</span>"
}%
<verbatim>
%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>"
}%
</verbatim>

---+++ Inline edit of forms in topic.

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

<img src="%PUBURL%/%WEB%/%TOPIC%/restplugin-viewform.png" style="padding:6px" />

---++ 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.

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 Build<nop>Contrib.
   * If you have TWiki 4.2 or later, you can install from the =configure= interface (Go to Plugins->Find More Extensions)
      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.
   * If you have any problems, then you can still install manually from the command-line:
      1 Download one of the =.zip= or =.tgz= archives
      1 Unpack the archive in the root directory of your TWiki installation.
      1 Run the installer script ( =perl &lt;module&gt;_installer= )
      1 Run =configure= and enable the module, if it is a plugin.
      1 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.
      1 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)
      1 Manually edit !LocalSite.cfg to set any configuration variables.

%IF{"defined 'SYSTEMWEB'" else="<div class='twikiAlert'>%X% WARNING: SYSTEMWEB is not defined in this TWiki. Please add these definitions to your %MAINWEB%.TWikiPreferences, if they are not already there:<br><pre>   * <nop>Set SYSTEMWEB = %<nop>TWIKIWEB%<br>   * <nop>Set USERSWEB = %<nop>MAINWEB%</pre></div>"}%


%IF{"defined 'SYSTEMWEB'" else="<div class='twikiAlert'>%X% WARNING: SYSTEMWEB is not defined in this TWiki. Please add these definitions to your %MAINWEB%.TWikiPreferences, if they are not already there:<br><pre>   * <nop>Set SYSTEMWEB = %<nop>TWIKIWEB%<br>   * <nop>Set USERSWEB = %<nop>MAINWEB%</pre></div>"}%

---++ Plugin Info

|  Plugin Author: | TWiki:Main.SvenDowideit - http://distributedINFORMATION.com a !WikiRing founding partner  |
|  Copyright: | &copy; 2008 SvenDowideit@distributedINFORMATION.com; <br /> &copy; 2008-2010, TWiki:TWiki/TWikiContributor |
|  Gear Icon | based on eXperience Crystal, by David Christian Berg |
|  License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] |
|  Plugin Version: | 2010-05-26 v1.1 |
|  Change History: | <!-- versions below in reverse order -->&nbsp; |
|  2010-05-26: | TWikibug:Item6433 - doc improvements |
|  2008-03-19: | Initial version |
|  Dependencies: | <table border="1"><tr><th>Name</th><th>Version</th><th>Description</th></tr><tr><td align="left">TWiki::Contrib::DojoToolkitContrib</td><td align="left">&gt;=1.0</td><td align="left">DojoToolkit release 1.0</td></tr></table> |
|  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:__ %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.TWikiPreferences
