Home | Gifts

Edit Table Plugin

Edit TWiki tables using edit fields, date pickers and drop down boxes

Introduction

Edit TWiki tables in place, using edit fields and drop down boxes, without having to edit the complete topic.

Simply add an [ Edit table ] button to an existing table by writing %EDITTABLE{}% directly above the table. This can be added to tables that are formatted with TablePlugin: add the EDITTABLE variable just above or below the TABLE tag. It can also be used without any TABLE tag.

Customize entry fields by specifying the format: use a text field, a drop down box, a date field, radio buttons or checkboxes.

Multiple tables per topic are editable, but only one at a time can be edited.

ALERT! ATTENTION: This plugin version depends on the new TWiki:Plugins.DatePickerPlugin; the JSCalendarContrib is no longer needed and must be upgraded or uninstalled. Before uninstalling JSCalendarContrib check if you use any extensions that depend on the JSCalendarContrib as described in that contrib package.

Per Table Settings

Add a %EDITTABLE{...}% variable just before an existing table to make it editable, or add the variable anywhere in a topic to start a new table.

Using TWiki Variables in the Format Parameter

By default, variables in <initial value> (of text input field) and <label text> (of fixed label) get expanded when a new row is added. This can be used for example to add a timestamp to a label. You can escape characters with format tokens if you do not want that.

Any TWiki variable inside a table cell will be preserved. For instance, %TOPIC% will not get expanded to the current topic name.

The format tokens are the same as with FormattedSearch:

Escape: Expands To:
$n or $n() New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar
$nop or $nop() Is a "no operation".
$quot Double quote (")
$percnt Percent sign (%)
$dollar Dollar sign ($)

Date Field Type

The date field type allows one to choose a date with a popup calendar. Popup calendar works with all modern browsers. The date picker button is inactive if the browser cannot support the popup calendar or if Javascript is disabled.

The date format can be defined; the default is taken from the {Plugins}{DatePickerPlugin}{Format} configure setting. Date specifiers are described in DatePickerPlugin. Example format for ISO date: format="| date, 10, , %Y-%m-%d |".

Edit Table Calendar Example

Per Cell Settings

An individual edit field type can be defined for each table cell. Place an %EDITCELL{ "type, ..." }% variable at the end of the cell content. This is useful to override the per column %EDITTABLE{ format="..." }% settings, or to create tables with key/value rows. All edit field types of the format="..." parameter are supported. For example, to define a text field, type: | cell content %EDITCELL{ "text, 20" }% |

It is also possible to place the edit button inside a cell instead of default location below the table. Type | %EDITCELL{ "editbutton, 1, Edit this table" }% | to show a button, or | %EDITCELL{ "editbutton, 1, Edit table, Image-URL" }% | to show a button image with alternate text.

Note: The %EDITCELL{ }%=variable cannot be used by itself; place an =%EDITTABLE{ }%=variable at the beginning of a table where you want to use =%EDITCELL{ }% variables.

Table Buttons

Examples

Line before table: %EDITTABLE{ format="| row, -1 | text, 20, init | select, 1, one, two, three, four | radio, 3,:-),:-I,:-( | label, 0, %SERVERTIME{"$day $mon $year $hour:$min"}% |" changerows="on" }%

Nr Text field Drop down Mood Timestamp
1 hello table one smile 26 Jun 2002 12:30
2   two frown 27 Jun 2002 12:40

Note: Please do not save this example table! Use TWiki:Sandbox.EditTablePluginTesting if you want to try out this Plugin

If this plugin is installed you will see an [ Edit table ] button above; if you were to click on it (please don't, use TWiki:Sandbox.EditTablePluginTesting for testing) you get this form:

Nr Text field Drop down Mood Timestamp
1 smile indifferent frown 26 Jun 2002 12:30
2 smile indifferent frown 27 Jun 2002 12:40

The following example shows a simple table with key/value rows. The default edit field type for the value column is a text field. This is overloaded by a selector for the Gender, and a date picker for the DOB. This is typically used by TWiki applications where new topics with tables are created based on a template topic.

You type: You get: Table in edit mode:
%TABLE{"headerrows="1"}%
%EDITTABLE{ format="| label | text, 40 |" changerows="off" }%
|*Key*|*Value*|
| Name: | John Smith |
| Gender: | M %EDITCELL{select, 1, , F, M}% |
| DOB: | 1999/12/31 %EDITCELL{date, 10}% |
| City: | New York |
EDITCELL Example in view mode EDITCELL Example in edit mode

Limitations and Known Issues

Plugin Settings

Show details toggleopen.gif Hide details toggleclose.gif

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, for example, %EDITTABLEPLUGIN_SHORTDESCRIPTION%

Note: The Plugin uses base settings like date format, language and style from the DatePickerPlugin.

Installation Instructions

This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.

Show details toggleopen.gif Hide details toggleclose.gif

ALERT! ATTENTION: This plugin version depends on the new TWiki:Plugins.DatePickerPlugin; the JSCalendarContrib is no longer needed and must be uninstalled. Before uninstalling JSCalendarContrib check if you use dependent extensions ChecklistTablePlugin, DateFieldPlugin, EditTablerowPlugin, FormPlugin, RenderFormPlugin.

Plugin Info

Plugin Author: Arthur Clemens, TWiki:Main.PeterThoeny
Copyright: © 2008 Arthur Clemens;
© 2002-2018 TWiki:Main.PeterThoeny, TWiki.org;
© 2002-2018 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2018-07-05

Show Change History toggleopen.gif Hide Change History toggleclose.gif
2018-07-05: TWikibug:Item7841: Copyright update to 2018
2016-11-14: TWikibug:Item7759: using viewauth unnecessarily, bringing down TWiki if headerrows and footerrows are inapprropriate -- TWiki:HideyoImazu
2016-01-08: TWikibug:Item7708: Copyright update to 2016
2015-01-10: TWikibug:Item7604: Switch to GPL v3
2013-12-03: TWikibug:Item7394: EditTablePlugin is not showing space characters correctly in date fields. -- TWiki:Main.YaojunFei
2013-12-01: TWikibug:Item7392: EditTablePlugin executes "ASSERT(0) if DEBUG;" statement when clicking on "canel" button. -- TWiki:Main.YaojunFei
2013-11-12: TWikibug:Item7379: Clicking an edit table button and then saving it may add a blank row -- TWiki:Main.YaojunFei
2013-11-05: TWikibug:Item7377: EditTablePlugin may eat table rows -- TWiki:Main.YaojunFei
2013-10-18: TWikibug:Item7373: EDITTABLE can't handle HTML comments in table cells -- TWiki:Main.PeterThoeny
2013-01-13: TWikibug:Item7091: Use TWISTY in plugin settings section, installation instructions and change history -- TWiki:Main.PeterThoeny
2012-12-12: TWikibug:Item7077: Make EditTablePlugin dependent on DatePickerPlugin instead of deprecated JSCalendarContrib -- TWiki:Main.PeterThoeny
2012-11-12: TWikibug:Item7020: Categorize TWiki Variable EDITTABLE -- TWiki:Main.PeterThoeny
2012-11-06: TWikibug:Item7025: Return to base page after saving changes.
2012-11-06: TWikibug:Item7024: Make EditTable read-only when current site mode is readonly or slave
2012-07-11: TWikibug:Item6900: Fix for warning: "my" variable %regex masks earlier declaration -- TWiki:Main.JudBarron
2011-07-07: TWikibug:Item6725: Change global package variables from "use vars" to "our"
2010-05-25: 5.1: TWikibug:Item6324 - Fix for editing a table removing EDITCELL from another table - patch by TWiki:Main/NickThorpe
2010-05-16: 5.0: TWikibug:Item6433 - doc improvements; replacing TWIKIWEB with SYSTEMWEB
17 Apr 2009: 4.9.1: Save of table can only be done with http POST method, not GET
01 Nov 2008: 4.9: Arthur Clemens: Fixed rendering of verbatim blocks when editing. Added parameter buttonrow="top" to allow the buttons to be positioned at the top of the table.
26 Sep 2008: 4.8.7: Arthur Clemens: Let empty table initialize more than one column from header parameter
24 Sep 2008: 4.8.6: Arthur Clemens: Fix parsing of header labels
21 Sep 2008: 4.8.5: Arthur Clemens: Fix rendering of TML inside label
03 Aug 2008: 4.8.4: TWiki 4.2.1 release version
19 Jul 2008: 4.8.3: Bugfix release
20 Mar 2008: 4.8: Arthur Clemens: Code refactoring; disabled table sort when editing; removed usage of $percnt to prevent variable expansion (is now done automatically); made Javascript interface aware of headers and footers, and of changerows="off"; improved feedback on row move.
25 Dec 2007: 4.7.1: Arthur Clemens: Added warning if include parameter topic does not exist.
22 Dec 2007: 4.7: Arthur Clemens: Changed handling of escaped variables. To escape TWiki variable, use formatting tokens such as $percnt.
16 Dec 2007: 4.6: Kenneth Lavrsen: The plugin prevents TablePlugin from initsorting the table being edited. This is done by temporarily appending the attribute disableallsort="on" to the TABLE tag of a table being edited. Additionally all header sorting is disabled while editing a table by setting a hidden formfield sort to "off". Disabling sorting while editing is needed now that the EditTablePlugin supports moving rows up and down.
01 Dec 2007: 4.3: Arthur Clemens: added support for TablePlugin headerrows and footerrows; updated edit button
16 Oct 2007: 4.2: Arthur Clemens: refactoring, bug fixes.
07 Oct 2007: 15182: PTh: Added VarEDITTABLE to have it listed in TWikiVariables
15 Mar 2007: Arthur Clemens: Fixed eating of double newlines; icons for Javascript buttons and interface improvements. By default the Javascript interface is turned off, set JAVASCRIPTINTERFACE to use it in edit mode.
05 Mar 2007: Byron Darrah: Added ability to dynamically move and delete rows.
12 Oct 2006: Item2982 Use default date format from JSCalendarContrib
02 Oct 2006: Item2884 Check also for access permission in meta data; proper fix to not warn if oneself has a lock on topic
30 Aug 2006: Item2829 Remove whitespace from select, radio and checkbox items; restored topic lock if $TWiki::Plugins::VERSION < 1.1
29 Jul 2006: Item2684 - Quietly ignore topic edit locks on table edit
21 Jan 2006: TWiki:Main.CrawfordCurrie ported to TWiki-4.0.0, changed to use JSCalendarContrib
16 Sep 2004: Added radio buttons and checkbox controls; escaped "|" pipe symbol found in input fields to preserve tables
01 Aug 2004: Fixed bug where edittable did not work if at the end of a topic
07 Apr 2004: Fixed bug where two tables got updated when you edit and save a table included into a topic containing other edit tables
02 Mar 2004: Default for %EDITCELL{editbutton}% is EDITBUTTON preference
27 Feb 2004: Added QUIETSAVE setting and quietsave parameter; image for Edit button
18 Feb 2004: Doc fixes; allow edit button anywhere in a cell not just at the end of a cell
17 Feb 2004: Added per cell definition of edit field types with %EDITCELL{}% variable; added headerislabel and editbutton parameters
20 Dec 2003: Fixed bug where calendar did not work after adding a row (TWiki:Main/PaulineCheung); added all language files of Mishoo DHTML calendar 0.9.5
13 Dec 2003: Added CHANGEROWS, JSCALENDARDATEFORMAT, JSCALENDARLANGUAGE, JSCALENDAROPTIONS settings
16 Oct 2003: small typo fixed (garbled if ---+ header on top)
15 Oct 2003: new date field type with Javascript calendar - CN
14 Oct 2003: docfix: the documentation page was an old one - CN
13 Oct 2003: bugfix: %-vars in select were resetted to first on add/del row - CN
18 Sep 2003: incompatibility: changed default of changerows to on; support for %-vars, Quiet save for saving without notification; all other fixes in Dev topic integrated - CN
08 Nov 2002: Prevent variable expansion in label text; added escape characters
27 Jun 2002: New helptopic parameter
26 Jun 2002: Support for variables in included EDITTABLE parameters; fixed problem with HTML in cells
21 May 2002: Added fixed label format; new changerows="add" parameter
27 Apr 2002: Fixed bug where text after a double quote in a cell disappeared
18 Apr 2002: Fixed bug where table was breaking when pasting multiple lines into an edit field using Netscape on Unix
08 Apr 2002: Check for change permission and edit lock of topic
05 Apr 2002: Initial version
Dependencies:
NameVersionDescription
TWiki::Plugins::DatePickerPlugin>=0Required. Used to select a date when using type date.
Perl Version: 5.0
TWiki:Plugins/Benchmark: GoodStyle 98%, FormattedSearch 98%, EditTablePlugin 95%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/EditTablePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/EditTablePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/EditTablePluginAppraisal

Related Topics: VarEDITTABLE, DatePickerPlugin, TWikiPreferences, TWikiPlugins

Revision r27 - 2018-07-06 - 01:11:20 - TWikiContributor Edit