[TYPO3-core] RFC: Inline Relational Record Editing (IRRE)
Ingmar Schlecht
ingmar at typo3.org
Thu Nov 16 23:50:16 CET 2006
This is a SVN patch request.
This patch introduces Inline Relational Record Editing (IRRE) for
tceforms and is written by Oliver Hader as his diploma thesis. It has
been intensively reviewed by Sebastian and me during a real-life meeting
in Hof, Germany, last weekend.
Description:
The main feature of IRRE is as simple as editing sub-records inside the
parent record, and being able to add new sub-records just by clicking a
"+" icon, which then loads the form for the sub-record using AJAX,
without annoying form submits in between.
Examples of such 1:n sub-record relationships would be "products" that
have multiple "prices", or "persons" that have many "email-addresses".
However, IRRE doesn't only offer to manage those sub-record
relationships (1:n relations), but can also be used to manage m:n
relationships (with or without attributes) by treating the records of
the mm-table itself as exactly the same kind of sub-record table
mentioned above, with the slight addition of a uniqueness-check.
Example for a normal 1:n relationship:
Say you have two tables, products and prices and you want to be able to
add multiple prices to a product with the prices displayed inside of the
products form (inline). First you need to configure both of the tables
as usual in TCA, and then add a new field called "prices" of the type
"inline" to the products table with the foreign_table configured to be
"prices". The TCA-Configuration of the "prices" field of the "products"
table would look like this:
"prices" => Array (
"label" => "Prices",
"config" => Array (
"type" => "inline",
// Name of the child table:
"foreign_table" => "prices",
// Field of the prices table in which the uid of the
product it belongs to is stored:
"foreign_field" => "product",
)
)
Further reading:
http://wiki.typo3.org/index.php/Inline_Relational_Record_Editing (it's a
must-read for patch reviewers)
You can try the feature with the test extension and the source tarball
located at http://inpublica.de/typo3/
Branch: trunk
Now, for those who want to review the patch:
Changes have mainly been made to these four classes:
tcemain writing data
tceforms displaying the form, makes use of
the new class t3lib_tceforms_inline
transferdata preprocessing of relation data
loaddbgroup managing relations
New files are:
t3lib/jsfunc.inlinerelational.js
JavaScript for the AJAX stuff
t3lib/class.t3lib_tceforms_inline.php
New functions that could have been put into tceforms are
put to a separate file to not make tceforms even bigger
typo3/json.php
BSD-licensed PHP class to convert PHP arrays to
JavaScript JSON objects. Very handy for AJAX development
typo3/alt_doc_ajax.php
Script that's called by the AJAX request when you add a
new sub-item.
Still missing in the attached patch is support for refindex, but Oliver
has already added that in the meantime (see
http://svn.t3.digitaldistrict.de/cgi-bin/trac.cgi/changeset/5788) and
I'll include it when finally committing it.
I think this patch should go into trunk soon, so there is enough time to
test and fix it if needed.
cheers
Ingmar
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: latest_core_to_irre.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061116/e279dee4/attachment.pot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061116/e279dee4/attachment.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061116/e279dee4/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsfunc.inlinerelational.js
Type: application/x-javascript
Size: 18429 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061116/e279dee4/attachment.js
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20061116/e279dee4/attachment-0001.htm
More information about the TYPO3-team-core
mailing list