Extension:TableEdit/Details

...using a template
 Template:PageName 
 * The name of the template should be put in-between the tags, including the Template: prefix. See the section below for defining a template.

...without a template
 Heading1 Heading2 Heading3 So Forth... 


 * Put the headings for the row/columns you want to create in-between the tags. You must specify a heading for a column.

Template Definitions
TableEdit is extensively template-driven. Most of the tables on EcoliWiki.net are managed by templates, meaning all the information about the table is defined in a wikipage in the Template namespace. This includes all the headings, the heading-styles, if the table is horizontal or vertically oriented, and other variables.

Exhaustive List of Variables
Style to apply to table as a whole. For example: {| class="wikitable" A newline (carriage-return) delimited list of the headings.
 * TableEdit template text

Sets the default style for the headings. For example:


 * 0 indicates a vertical-type table -- with the headings going across the page left to right. This is the defualt.
 * 1 indicates a horizontal-type table -- with the headings running down the left side of the table.


 * As of TableEdit-v1.0 there is a directive to add the class  to a table. This allows custom JavaScript to be bound to a set of tables, or a specific table on a page. See the code in js/init_datatables.js for an example. Also there is some information in the READMEs.
 * As of TableEdit-v1.0 there is a directive to add the class  to a table. This allows custom JavaScript to be bound to a set of tables, or a specific table on a page. See the code in js/init_datatables.js for an example. Also there is some information in the READMEs.

You can also display text in specific situations when displaying and editing a table. This text can use any MediaWiki markup.


 * This text shows up above the box view on the general view and when you edit a row.
 * This text shows up above the box view on the general view and when you edit a row.


 * Above the table on the general view when you are editing a table.
 * Above the table on the general view when you are editing a table.


 * Below the table on the general edit view.
 * Below the table on the general edit view.


 * On the very right hand side when you edit a row.
 * On the very right hand side when you edit a row.


 * Goes right above the table in the wiki page.
 * Goes right above the table in the wiki page.


 * This is the counterpart to  tag. The text in this field gets put right below the table in the wiki page.
 * This is the counterpart to  tag. The text in this field gets put right below the table in the wiki page.

Example
Standard name Mnemonic Synonyms  1
 * Here is the Template:Gene_nomenclature_table from EcoliWiki.

Qualifier||qualifier|select| |NOT|Contributes to|Colocalizes with|Obsolete GO term|Under review GO ID||go_id|text Reference(s)||refs Evidence Code||evidence|select| |IC: Inferred by Curator|IDA: Inferred from Direct Assay \ with/from||with|text Notes||Notes Status||status|calc|reqcomplete|go_id|refs|go_term|evidence 
 * Here is a more complicated example that makes use of column rules. This comes from Template:GO_table_product in EcoliWiki. Long lines have been broken and have a backslash to indicate an inserted line-break.
 * IEA: Inferred from Electronic Annotation|IEP: Inferred from Expression Pattern \
 * IGC: Inferred from Genomic Context|IGI: Inferred from Genetic Interaction \
 * IMP: Inferred from Mutant Phenotype|IPI: Inferred from Physical Interaction \
 * ISS: Inferred from Sequence or Structural Similarity|ISO: Inferred from Sequence Orthology \
 * ISA: Inferred from Sequence Alignment|ISM: Inferred from Sequence Model \
 * IGC: Inferred from Genomic Context|RCA: inferred from Reviewed Computational Analysis \
 * TAS: Traceable Author Statement|NAS: Non-traceable Author Statement \
 * ND: No biological Data available|NR: Not Recorded

Column Rules
By default, TableEdit will accept any text in table cells. Column rules allow you more control over what can be placed in a given column. Column rules are included in the  section of TableEdit templates. They are defined on the same line as the column they apply to.

The basic syntax for a creating a column rule is Where

These are defined in TableEdit::apply_column_rules in SpecialTableEdit.body.php''.

The  column rule specifies a pull down menu of values that the column can have. The format is: Column Heading||column_id|select|Default Option|Other Option 1|Other Option 2|...

The default option will be preselected when a new row is created. If you don't want a default option, then insert a space here. The default may not be empty.

For example, this gives editors a pulldown menu listing 4 years, with a default of blank. Year||year|select| |2010|2011|2012|2013

And this gives editors a pulldown menu listing 5 choices, with a default of "Before 2010": Year||year|select|Before 2010|2010|2011|2012|2013

The pull-down menu is only shown when the table is being edited. Once the table is saved, only the selected option is shown.

The  column rule allows editors to select multiple values. lumn rule specifies a pull down menu of values that the column can have. The format is: Column Heading||column_id|checkbox|Item 1|Item 2|Item 3|...

For example, to allow an editor to select 0, 1, or many favorite vegetables: Favorite vegetables||fav_veg|checkbox|Corn|Green beans|Broccoli|Lettuce|Celery

When editing a row, this would show all 5 choices, with a checkbox to the right of each. Editors could 0, 1, some or all choices. Once the table is saved, the choices are displayed as a space separated list.

The  column rule creates a text box one line high, 40 characters wide, and with a maximum length of 255 characters. The format is: Column Heading||column_id|text

When editing, the edit window is 40 characters wide. After saving the edits, the full-length value will be shown.

The  column rule automatically populates the column with the date the row was last updated. The date is in the format. The format is: Column Heading||column_id|timestamp

When editing, the date of the previous update is shown. After saving any edits, the date of the newly saved edits is shown.

The foreign table type allows you to show data from another table/row in a table. This was originally created for the Quickview Tables on EcoliWiki. We needed a way to mirror the data from the Gene and Product pages on the Quickview page dynamically, so the user wouldn't have to edit the same information in two different places. The syntax is:

Column Heading||column_id|foreign|foreign_page|foreign_table_template|foreign_heading

Anything in italics should be changed. For gene pages we needed a way to tell the table to look on the corresponding gene/product page, so we added the  magic word. For example, the following line would pull information from the nomenclature table on the corresponding Gene page. (If this was used on the lacZ:Quickview page, it would pull from the lacZ:Gene page.)

Gene Synonym(s)||syns|foreign|:Gene|Gene_nomenclature_table|Synonyms

The code executes in the following manner:
 * 1) sets a row property specifying this is a foreign row
 * 2) breaks the definition (coming from the template) into variables
 * 3) does   magic word processing
 * 4) uses variables to search the database for the corresponding foreign row/box
 * 5) creates a box object from the returned database info
 * 6) crawls through the box, and when the right row is found, it saves the foreign row_data to this row_data
 * 7) looks for any existing relations in the db
 * 8) if none are found, it creates a relation in the db
 * 9) creates display version & raw version to be shown in the view
 * 10) returns view string

Object Classes
TableEdit has undergone major changes trying to make it more like the MVC model. This cannot always be accomplished due to programmer style and historical reasons, but where possible we've tried to seperate the three.


 * A  object consists of a series of attributes that control the behavior and appearance of the table and a collection of row objects that hold the actual data.  The   also has methods to manipulate rows, serialize and unserialize its contents, and for interacting with the MySQL database that controls the tables. Most of the manipulation of the tables can be done through this method. It (not so transparently) handles the wikiBoxRow objects (see below.)
 * A  object consists of a series of attributes that control the behavior and appearance of the table and a collection of row objects that hold the actual data.  The   also has methods to manipulate rows, serialize and unserialize its contents, and for interacting with the MySQL database that controls the tables. Most of the manipulation of the tables can be done through this method. It (not so transparently) handles the wikiBoxRow objects (see below.)


 * A  object holds the actual data.  This is also defined in  .  The   has methods for loading and saving etc. This class also carries methods that cannot/are not called from class wikiBox, such as the methods dealing with the relations database table ( .)
 * A  object holds the actual data.  This is also defined in  .  The   has methods for loading and saving etc. This class also carries methods that cannot/are not called from class wikiBox, such as the methods dealing with the relations database table ( .)


 * Class  is defined in   and is an extension of the  class.  However, it can be invoked without generating a special page to handle interactions between  es and Article objects in MediaWiki.
 * Class  is defined in   and is an extension of the  class.  However, it can be invoked without generating a special page to handle interactions between  es and Article objects in MediaWiki.


 * These classes are defined in  and handle the saving and retreiving of metadata from their respective database tables.
 * These classes are defined in  and handle the saving and retreiving of metadata from their respective database tables.


 * Defined in, this class is devoted to loading data into pre-existing tables. There is a whole page devoted to the loader, with all the options and usage explained there.
 * Defined in, this class is devoted to loading data into pre-existing tables. There is a whole page devoted to the loader, with all the options and usage explained there.

Semantics
Don't know what people are talking about? Brush up on the TableEdit lingo and impress your friends.

table

 * 1) The table as displayed when you first visit a wiki page.
 * 2) A table in the database that stores data. (Ex. ext_TableEdit_box or ext_TableEdit_relations.)

box/box object

 * 1) The complex data structure representing the table. This consists of an object with sub-objects/arrays, etc.
 * 2) Sometimes used in place of "table."