Extension:InlineTable

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manual - list
Crystal Clear action run.png
InlineTable

Release status: unknown

Description InlineTable is a DHTML widget of table that can be edited via Javascript(Ajax).
Author(s) ikyo.org (ikyoTalk)
Last version 0.1.1 (2010-09-20)
License GPL
Download http://sourceforge.net/projects/inlinetable/files/MediaWiki-Extension/InlineTable-MediaWiki-Extension-0.1.1.zip/download
Example http://wiki.ikyo.org/index.php/InlineTableMediaWikiExtension

Check usage (experimental)

Contents

[edit] What can this extension do?

InlineTable is a DHTML widget of table that can be edited via Javascript(Ajax). The table has the following six main features or purposes:

  • Define database table, we can use this extension to define a database table, and then store the data in to database. At the moment, it only supports MySQL.
  • Define template, we can define a template in a page and then use this template in anywhere.
  • Editable, the cell's content in table can be edited. Each column can have the special type of data (string, int, double, date or boolean) and special widget (label, text, textarea, checkbox, select(combox)). Depending on its data type and widget, the editor for cell can do the simple vary, for example string, integer number and date column will show textbox for editing, and boolen column will show checkbox.
  • Navigable: because of the first feature, it does not make sense if the table is not navigable. This means that the active cell can be changed into another cell by pressing the arrow key on the keyboard or by using the mouse to click on another cell. The active cell is the cell in which we can edit its content. When the cell is edited, we cannot move the active cell into another one. The editing state must be ended first, if one wants to move the active cell.
  • Submittable: is a very special feature. 'Submittable' means that the content of the table can be submitted to the web server via the usual web HTTP protocol. One can easily understand that the table contains elements of FORM. Why should it be submittable? In most cases, we want the user to submit what he/she inserted in the table. For example, the user makes up a list of purchased items and assigns different properties to each of those items, such as the code, the quantity, etc. Such a list is usually visualized by a table, one column containing the code of each purchased item, another one containing the quantity, etc. Each row, of course, represents different items. This function supports PHP, JSP and so on. The 'submit' action relies on AJAX to post the request, so that one does not need to refresh the page.
  • User permission control, if user has not permission to edit the current page, then the InlineTable also be disabled directly.


[edit] Usage

For more information, please visit Document & Examples page.

[edit] Create Database Table

Use the following code to define a database table(This is a full features example for InlineTable):

<inlinetable definetable="user">
  <column name="first_name" type="string" length="100" required="yes" unique="yes" />  
  <column name="last_name" type="string" length="50" />
  <column name="age" type="int" />
  <column name="height" type="double" />
  <column name="birthday" type="date" />
  <column name="register_date" type="datetime" />
  <column name="sex" type="string" length="1" />
  <column name="online" type="boolean" required="yes" />
  <column name="remark" type="text" />
</inlinetable>

[edit] Create Template

Use the following code to define a template base on a database table:

<inlinetable definetemplate="template1" tablename="user" sort="first_name DESC" condition="" enable="yes" insertable="yes" deleteable="yes" displayrowindex="yes" styleclass="" style="" >
  <column tablefield="first_name" caption="First Name" widget="text"  />
  <column tablefield="last_name" caption="Last Name" widget="text" />
  <column tablefield="age" caption="Age" widget="text" />
  <column tablefield="height" caption="Height(m)" widget="text" digits="2" />
  <column tablefield="birthday" caption="Birthday" widget="date"  />
  <column tablefield="register_date" caption="Register Date" widget="datetime"  />
  <column tablefield="sex" caption="Sex" widget="select" options="M:Male,F:Female"  />
  <column tablefield="online" caption="Online" widget="checkbox" />
  <column tablefield="remark" caption="Remark" widget="textarea" /> 
  <column name="crt_dt" tablefield="__crt_dt" caption="Create Date" widget="label" />
  <column name="crt_usr" tablefield="__crt_usr" caption="Create User" styleclass="" style="color:red;" />
</inlinetable>

[edit] Use Template

Use the following code to use template and edit table data:

<inlinetable name="abc" usetemplate="template1" sort="first_name" condition="" enable="yes" insertable="yes" deleteable="yes" />

[edit] Table and Template Maintenance

Use code <inlinetable list="definetable, definetemplate, usetemplate" /> to manage the objects user created.

[edit] Installation

To install this extension, unzip the extension to $IP/extensions folder(It should be like this: $IP/extensions/InlineTable). And then add the following to LocalSettings.php:

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/InlineTable/InlineTable.php");

[edit] Configuration parameters

[edit] User rights

[edit] See also

JsInlineTable
Document & Examples

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox