Extension:TableEdit

From MediaWiki.org
Jump to: navigation, search
TableEdit2 is in the planning stages. If you would like to help out, feel free to edit Extension:TableEdit2, or its talk page.
MediaWiki extensions manual
Crystal Clear action run.png
TableEdit

Release status: stable

Implementation Database, Tag, Special page
Description Add table creation and editing for simple tables
Author(s) JimHu
Latest version 1.0.13 (2014-01-20)
MediaWiki 1.21+
License MIT
Download
Example EcoliWiki Gene Page

GONUTS Protein Page

Translate the TableEdit extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
Warning Warning: Versions prior to 1.0.5 contain a security hole. It is strongly recommended that you update to TableEdit-v1.0.8 or later

Rationale and Features[edit | edit source]

Wiki markup can be challenging. Tables are one of the harder things for new users. TableEdit provides a simple table creation and editing system.

TableEdit replaces <newTableEdit/> tags in wikitext with a "Create Table Here" link. Following this link goes to a Special page that creates HTML comment-delimited tables The content is controlled by an external mysql database, but the tables are saved back to the wiki in normal wikitext surrounded by HTML comments with the id number of the table in the database. Users can

  • Insert rows
  • Append columns
  • Change styles for tables, heading rows, and rows
  • Use template-defined lists of column headings

See EcoliWiki for more about the TableEdit features and how to use them.

Status[edit | edit source]

So far, TableEdit 1.0.0 has been tested with MediaWiki 1.21 on MacOSX and Ubuntu. Help testing this extension on other versions will be appreciated! Note: If you are using different versions MediaWiki or of operating systems, expect quite a number of issues. Also, expect a number of bugs in the enclosed README and INSTALL files!

Changes in Version 1.0.0[edit | edit source]

  • Support for DataTables (http://datatables.net) was added in version 1.0.
  • modules/TableMarkerUpper.php
    • This script adds a necessary <thead> tag to any tables in $wgOut.
  • addition of the (optional) <datatable> parameter in templated tables
  • addition of class="" and id="" attributes on wiki tables
  • CSS and JS specific to tableEdit
  • TableEdit::reorder_columns
  • TableEdit::reorder_template

See the README and README.dataTables files for more info.

Installation[edit | edit source]

  • See the INSTALL file in the package for these directions. Also check the discussion page of this article for quite a number of bugs!

To do a fresh install (rather than an upgrade):

  • Download the TableEdit extension.
  • Unpack the downloaded file using gunzip or another unpacking program.
  • Move the unpacked TableEdit directory to your MediaWiki extensions directory.
    • Note: Because we run multiple wikis from the same set of extensions at EcoliWiki, we consolidated our extensions into a common directory. (i.e. we don't use the extensions/ directory within each installation.) This is why TableEdit includes the CSS and JS directly into the page instead of linking out to them (yes, I know it's better to cache them.)
  • If you don't already have an AdminSettings.php file in your MediaWiki installation directory, create one. This contains the database admin username and password for your MediaWiki database. TableEdit needs this information to create some tables in the database.
  • Backup your MediaWiki database. This is an important step in case anything goes wrong.
  • Get to your extensions/TableEdit directory (or wherever TableEdit lives) and run the install.php.
    On a *nix-like system with PHP installed (PHP v5.3 may have problems...)
    php install.php -w /path/to/your/wiki
    
    The -w parameter is the path to your MediaWiki installation. This is usually "../.." from the extensions/TableEdit directory. Right now TableEdit has only been tested with MySQL. If you are using a different database server, you may want to have a look in the sql/ directory for the sql files and create these tables by hand.
  • Add the following lines to your LocalSettings.php file: (making sure the paths are correct)
# TableEdit extension
require_once( "$IP/extensions/TableEdit/TableEdit.php" );


Also Install ProtectSection Extension[edit | edit source]

You are strongly encouraged to also install the ProtectSection extension.

Directly editing TableEdit definitions in the page source will usually break the table's definition. TableEdit generates inline comments telling editors not to edit the table, but TableEdit by itself does not prevent it.

To prevent this from happening you need to also install the ProtectSection extension. ProtectSection prevents anything enclosed in <protect> </protect> tags from being edited by regular users.

If both TableEdit and ProtectSection are installed, TableEdit will detect this and automatically wrap TableEdit table definitions in protect tags, thus preventing your users from directly editing the table definitions.


Other helpful pages[edit | edit source]

contains some information about how to create a template, specify column-rules, etc.
defines a tab-delimited format for loading data into tables. (Yes, we thought about using XML.)
describes the PHP script used to load information (in IFALT) into tables.

Alternatives[edit | edit source]

Known Issues[edit | edit source]

  • TableEdit has problems if you try to create a table on a new page that has not been saved yet.
    • A page must be saved in order to get a page_id value in the database that is needed by TableEdit.
  • Can't get the content back if the table is edited directly in the wiki. This can be prevented by combining TableEdit with the ProtectSection extension.
  • Can't sort (without Javascript)
  • Can't insert columns in the middle
  • Preview doesn't display initial empty table properly
  • Can't have empty heading - although having a "space" as a heading overcomes this. Empty headings are truncated when editing after first saved.

Dumps[edit | edit source]

While tables will be preserved when importing a dump from a wiki that uses TableEdit, when a user tries to click on the Edit link, bad things are likely to happen. In the best case, the recipient wiki will not have TableEdit installed and there will just be a 404 error. If TableEdit is installed, the most likely outcome is that the box_id and pagename will not match what is stored in the database and TableEdit will refuse to do the edit on the imported page. Suggestions for how to solve this are welcomed!

Bug Reporting[edit | edit source]

Please report bugs on the discussion page. Please sign your entries with your Name/IP and date using ~~~~.

For example: JimHu 22:14, 27 August 2008 (UTC)

Revision History[edit | edit source]

Version of this page with patches for revisions prior to 0.8.