[FEATURE] TCA-record-collection based on collection interfaces
authorSteffen Ritter <info@rs-websystems.de>
Tue, 29 Nov 2011 06:30:23 +0000 (07:30 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Sun, 18 Dec 2011 12:01:48 +0000 (13:01 +0100)
Use the possibility to create collections of tca-records with
TYPO3 core functionality in a table sys_collection.
To deal with these record-collections in TCA a collection class
using the new collection interfaces is to be introduced.

This relies on #32148

Change-Id: I371a6ba354855651048445075464c032ddd4647b
Resolves: #32147
Releases: 4.7
Reviewed-on: http://review.typo3.org/6968
Reviewed-by: Dominik Mathern
Tested-by: Dominik Mathern
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/collection/AbstractRecordCollection.php [new file with mode: 0644]
t3lib/collection/StaticRecordCollection.php [new file with mode: 0644]
t3lib/stddb/tables.php
t3lib/stddb/tables.sql
t3lib/stddb/tbl_be.php
typo3/sysext/lang/locallang_tca.xlf

diff --git a/t3lib/collection/AbstractRecordCollection.php b/t3lib/collection/AbstractRecordCollection.php
new file mode 100644 (file)
index 0000000..4f3d16c
--- /dev/null
@@ -0,0 +1,429 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Steffen Ritter <typo3@steffen-ritter.net>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+
+/**
+ * Abstract implementation of a RecordCollection
+ *
+ * RecordCollection is a collections of TCA-Records.
+ * The collection is meant to be stored in TCA-table sys_collections and is manageable
+ * via TCEforms.
+ *
+ * A RecordCollection might be used to group a set of records (e.g. news, images, contentElements)
+ * for output in frontend
+ *
+ * The AbstractRecordCollection uses SplDoublyLinkedList for internal storage
+ *
+ * @author Steffen Ritter <typo3@steffen-ritter.net>
+ * @abstract
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_collection_AbstractRecordCollection implements t3lib_collection_RecordCollection, t3lib_collection_Persistable, t3lib_collection_Sortable {
+
+       /**
+        * The table name collections are stored to
+        *
+        * @var string
+        */
+       protected static $storageTableName = 'sys_collection';
+
+       /**
+        * The table name collections are stored to
+        *
+        * @var string
+        */
+       protected static $storageItemsField = 'items';
+
+       /**
+        * Uid of the storage
+        *
+        * @var int
+        */
+       protected $uid = 0;
+
+       /**
+        * Collection title
+        *
+        * @var string
+        */
+       protected $title;
+
+       /**
+        * Collection description
+        *
+        * @var string
+        */
+       protected $description;
+
+       /**
+        * Table name of the records stored in this collection
+        *
+        * @var string
+        */
+       protected $itemTableName;
+
+
+       /**
+        * The local storage
+        *
+        * @var SplDoublyLinkedList
+        */
+       protected $storage;
+
+       public function __construct() {
+               $this->storage = new SplDoublyLinkedList();
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Return the current element
+        *
+        * @link http://php.net/manual/en/iterator.current.php
+        * @return mixed Can return any type.
+        */
+       public function current() {
+               return $this->storage->current();
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Move forward to next element
+        *
+        * @link http://php.net/manual/en/iterator.next.php
+        * @return void Any returned value is ignored.
+        */
+       public function next() {
+               $this->storage->next();
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Return the key of the current element
+        *
+        * @link http://php.net/manual/en/iterator.key.php
+        * @return scalar scalar on success, integer
+        * 0 on failure.
+        */
+       public function key() {
+               $currentRecord = $this->storage->current();
+               return $currentRecord['uid'];
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Checks if current position is valid
+        *
+        * @link http://php.net/manual/en/iterator.valid.php
+        * @return boolean The return value will be casted to boolean and then evaluated.
+        * Returns true on success or false on failure.
+        */
+       public function valid() {
+               return $this->storage->valid();
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Rewind the Iterator to the first element
+        *
+        * @link http://php.net/manual/en/iterator.rewind.php
+        * @return void Any returned value is ignored.
+        */
+       public function rewind() {
+               $this->storage->rewind();
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * String representation of object
+        *
+        * @link http://php.net/manual/en/serializable.serialize.php
+        * @return string the string representation of the object or &null;
+        */
+       public function serialize() {
+               $data = array(
+                       'uid' => $this->getIdentifier(),
+               );
+               return serialize($data);
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Constructs the object
+        *
+        * @link http://php.net/manual/en/serializable.unserialize.php
+        * @param string $serialized <p>
+        * The string representation of the object.
+        * </p>
+        * @return mixed the original value unserialized.
+        */
+       public function unserialize($serialized) {
+               $data = unserialize($serialized);
+               return self::load($data['uid']);
+       }
+
+       /**
+        * (PHP 5 &gt;= 5.1.0)<br/>
+        * Count elements of an object
+        *
+        * @link http://php.net/manual/en/countable.count.php
+        * @return int The custom count as an integer.
+        * </p>
+        * <p>
+        * The return value is cast to an integer.
+        */
+       public function count() {
+               return $this->storage->count();
+       }
+
+       /**
+        * Getter for the title
+        *
+        * @return string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * Getter for the description
+        *
+        * @return string
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+
+       /**
+        * Setter for the title
+        *
+        * @param string $title
+        * @return void
+        */
+       public function setTitle($title) {
+               $this->title = $title;
+       }
+
+       /**
+        * Setter for the description
+        *
+        * @param string $desc
+        * @return void
+        */
+       public function setDescription($desc) {
+               $this->description = $desc;
+       }
+
+
+       /**
+        * Setter for the name of the data-source table
+        *
+        * @return string
+        */
+       public function getItemTableName() {
+               return $this->itemTableName;
+       }
+
+       /**
+        * Setter for the name of the data-source table
+        *
+        * @param string $tableName
+        * @return void
+        */
+       public function setItemTableName($tableName) {
+               $this->itemTableName = $tableName;
+       }
+
+       /**
+        * Sorts collection via given callBackFunction
+        *
+        * The comparison function given as must return an integer less than, equal to, or greater than
+        * zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
+        *
+        * @param $callbackFunction
+        * @see http://www.php.net/manual/en/function.usort.php
+        * @return void
+        */
+       public function usort($callbackFunction) {
+               // TODO: Implement usort() method with TCEforms in mind
+               throw new RuntimeException('This method is not yet supported.', 1322545589);
+       }
+
+       /**
+        * Moves the item within the collection
+        *
+        * the item at $currentPosition will be moved to
+        * $newPosition. Ommiting $newPosition will move to top.
+        *
+        * @param int $currentPosition
+        * @param int $newPosition
+        * @return void
+        */
+       public function moveItemAt($currentPosition, $newPosition = 0) {
+               // TODO: Implement usort() method with TCEforms in mind
+               throw new RuntimeException('This method is not yet supported.', 1322545626);
+       }
+
+
+       /**
+        * Returns the uid of the collection
+        *
+        * @return integer
+        */
+       public function getIdentifier() {
+               return $this->uid;
+       }
+
+       /**
+        * Sets the identifier of the collection
+        *
+        * @param int $id
+        * @return void
+        */
+       public function setIdentifier($id) {
+               $this->uid = intval($id);
+       }
+
+
+       /**
+        * Loads the collections with the given id from persistence
+        *
+        * For memory reasons, per default only f.e. title, database-table,
+        * identifier (what ever static data is defined) is loaded.
+        * Entries can be load on first access.
+        *
+        * @static
+        * @param int|string $id
+        * @param boolean $fillItems Populates the entries directly on load, might be bad for memory on large collections
+        * @return t3lib_collection_Collection
+        */
+       public static function load($id, $fillItems = FALSE) {
+               $collection = new static();
+               t3lib_div::loadTCA(static::$storageTableName);
+
+               $collectionRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
+                       '*',
+                       static::$storageTableName,
+                       'uid=' . intval($id) . t3lib_BEfunc::deleteClause(static::$storageTableName)
+               );
+
+               $collection->fromArray($collectionRecord);
+
+               if ($fillItems) {
+                       $collection->loadContents();
+               }
+
+               return $collection;
+       }
+
+       /**
+        * Persists current collection state to underlying storage
+        *
+        * @return void
+        */
+       public function persist() {
+               $uid = $this->getIdentifier() == 0 ? 'NEW' . rand(100000, 999999) : $this->getIdentifier();
+               $data = array(
+                       trim(static::$storageTableName) => array(
+                               $uid => $this->getPersistableDataArray()
+                       )
+               );
+                       // new records always must have a pid
+               if ($this->getIdentifier() == 0) {
+                       $data[trim(static::$storageTableName)][$uid]['pid'] = 0;
+               }
+
+               /** @var t3lib_TCEmain $tce */
+               $tce = t3lib_div::makeInstance('t3lib_TCEmain');
+               $tce->stripslashes_values = 0;
+               $tce->start($data, array());
+               $tce->process_datamap();
+       }
+
+       /**
+        * Returns an array of the persistable properties and contents
+        * which are processable by TCEmain.
+        *
+        * for internal usage in persist only.
+        *
+        * @abstract
+        * @return array
+        */
+       abstract protected function getPersistableDataArray();
+
+       /**
+        * Generates comma-separated list of entry uids for usage in TCEmain
+        *
+        * also allow to add table name, if it might be needed by TCEmain for
+        * storing the relation
+        *
+        * @param bool $includeTableName
+        * @return string
+        */
+       protected function getItemUidList($includeTableName = FALSE) {
+               $list = array();
+               foreach($this->storage AS $entry) {
+                       $list[] = $this->getItemTableName() . '_' . $entry['uid'];
+               }
+               return implode(',', $list);
+       }
+
+       /**
+        * Builds an array representation of this collection
+        *
+        * @return array
+        */
+       public function toArray() {
+               $itemArray = array();
+               foreach ($this->storage as $item) {
+                       $itemArray[] = $item;
+               }
+               return array(
+                       'uid' => $this->getIdentifier(),
+                       'title' => $this->getTitle(),
+                       'description' => $this->getDescription(),
+                       'table_name' => $this->getItemTableName(),
+                       'items' => $itemArray
+               );
+       }
+
+       /**
+        * Loads the properties of this collection from an array
+        *
+        * @param array $array
+        * @return void
+        */
+       public function fromArray(array $array) {
+               $this->uid                      = $array['uid'];
+               $this->title            = $array['title'];
+               $this->description      = $array['description'];
+               $this->itemTableName= $array['table_name'];
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/t3lib/collection/StaticRecordCollection.php b/t3lib/collection/StaticRecordCollection.php
new file mode 100644 (file)
index 0000000..79d9205
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Steffen Ritter <typo3@steffen-ritter.net>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+
+/**
+ * implementation of a RecordCollection for static TCA-Records
+ *
+ * @author Steffen Ritter <typo3@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_collection_StaticRecordCollection extends t3lib_collection_AbstractRecordCollection implements t3lib_collection_Editable {
+
+       /**
+        * Populates the content-entries of the storage
+        *
+        * Queries the underlying storage for entries of the collection
+        * and adds them to the collection data.
+        *
+        * If the content entries of the storage had not been loaded on creation
+        * ($fillItems = false) this function is to be used for loading the contents
+        * afterwards.
+        *
+        * @return void
+        */
+       public function loadContents() {
+               /** @var t3lib_TcaRelationService $relationService */
+               $relationService = t3lib_div::makeInstance('t3lib_TcaRelationService', self::$storageTableName, self::$storageItemsField, $this->itemTableName);
+
+               $entries = $relationService->getRecordsWithRelationFromCurrentRecord($this->toArray());
+               $this->removeAll();
+               foreach ($entries as $entry) {
+                       $this->add($entry);
+               }
+       }
+
+       /**
+        * Returns an array of the persistable properties and contents
+        * which are processable by TCEmain.
+        *
+        * for internal usage in persist only.
+        *
+        * @return array
+        */
+       protected function getPersistableDataArray() {
+               return array(
+                       'title' => $this->getTitle(),
+                       'description' => $this->getDescription(),
+                       'items' => $this->getItemUidList(TRUE),
+                       'type' => 'static',
+                       'table_name' => $this->getItemTableName(),
+               );
+       }
+
+       /**
+        * Adds on entry to the collection
+        *
+        * @param mixed $data
+        * @return void
+        */
+       public function add($data) {
+               $this->storage->push($data);
+       }
+
+       /**
+        * Adds a set of entries to the collection
+        *
+        * @param t3lib_collection_Collection $other
+        * @return void
+        */
+       public function addAll(t3lib_collection_Collection $other) {
+               foreach ($other as $value) {
+                       $this->add($value);
+               }
+       }
+
+       /**
+        * Removes the given entry from collection
+        *
+        * Note: not the given "index"
+        *
+        * @param mixed $data
+        * @return void
+        */
+       public function remove($data) {
+               $offset = 0;
+               foreach ($this->storage as $value) {
+                       if ($value == $data) {
+                               break;
+                       }
+                       $offset++;
+               }
+               $this->storage->offsetUnset($offset);
+       }
+
+       /**
+        * Removes all entries from the collection
+        *
+        * collection will be empty afterwards
+        *
+        * @abstract
+        * @return void
+        */
+       public function removeAll() {
+               $this->storage = new SplDoublyLinkedList();
+       }
+
+
+}
+
+?>
\ No newline at end of file
index 8ce3122..d619033 100644 (file)
@@ -275,6 +275,41 @@ $TCA['sys_filemounts'] = array(
        )
 );
 
+/**
+ * Table "sys_collection":
+ */
+$TCA['sys_collection'] = array(
+       'ctrl' => array(
+               'title'     => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection',
+               'label'     => 'title',
+               'tstamp'    => 'tstamp',
+               'crdate'    => 'crdate',
+               'cruser_id' => 'cruser_id',
+               'versioningWS' => TRUE,
+               'origUid' => 't3_origuid',
+               'languageField'            => 'sys_language_uid',
+               'transOrigPointerField'    => 'l10n_parent',
+               'transOrigDiffSourceField' => 'l10n_diffsource',
+               'default_sortby' => 'ORDER BY crdate',
+               'delete' => 'deleted',
+               'type' => 'type',
+               'rootLevel' => -1,
+               'searchFields' => 'title,description',
+               'typeicon_column' => 'type',
+               'typeicon_classes' => array(
+                       'default' => 'apps-clipboard-list',
+                       'static' => 'apps-clipboard-list',
+                       'filter' => 'actions-system-tree-search-open'
+               ),
+               'enablecolumns' => array(
+                       'disabled' => 'hidden',
+                       'starttime' => 'starttime',
+                       'endtime' => 'endtime',
+                       'fe_group' => 'fe_group',
+               ),
+               'dynamicConfigFile' => 'T3LIB:tbl_be.php',
+       ),
+);
 
 /**
  * Table "sys_languages":
index 22a6f89..8c97d9c 100644 (file)
@@ -248,6 +248,62 @@ CREATE TABLE sys_filemounts (
 );
 
 #
+# Table structure for table 'sys_collection'
+#
+CREATE TABLE sys_collection (
+       uid int(11) NOT NULL auto_increment,
+       pid int(11) DEFAULT '0' NOT NULL,
+       tstamp int(11) DEFAULT '0' NOT NULL,
+       crdate int(11) DEFAULT '0' NOT NULL,
+       cruser_id int(11) DEFAULT '0' NOT NULL,
+       t3ver_oid int(11) DEFAULT '0' NOT NULL,
+       t3ver_id int(11) DEFAULT '0' NOT NULL,
+       t3ver_wsid int(11) DEFAULT '0' NOT NULL,
+       t3ver_label varchar(30) DEFAULT '' NOT NULL,
+       t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
+       t3ver_stage int(11) DEFAULT '0' NOT NULL,
+       t3ver_count int(11) DEFAULT '0' NOT NULL,
+       t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
+       t3ver_move_id int(11) DEFAULT '0' NOT NULL,
+       t3_origuid int(11) DEFAULT '0' NOT NULL,
+       sys_language_uid int(11) DEFAULT '0' NOT NULL,
+       l10n_parent int(11) DEFAULT '0' NOT NULL,
+       l10n_diffsource mediumtext,
+       deleted tinyint(4) DEFAULT '0' NOT NULL,
+       hidden tinyint(4) DEFAULT '0' NOT NULL,
+       starttime int(11) DEFAULT '0' NOT NULL,
+       endtime int(11) DEFAULT '0' NOT NULL,
+       fe_group int(11) DEFAULT '0' NOT NULL,
+
+       title tinytext,
+       description text,
+       type varchar(6) DEFAULT 'static' NOT NULL,
+       table_name tinytext,
+       items int(11) DEFAULT '0' NOT NULL,
+       criteria text NOT NULL,
+
+       PRIMARY KEY (uid),
+       KEY parent (pid),
+       KEY t3ver_oid (t3ver_oid,t3ver_wsid)
+);
+
+#
+# mm-table for entries of sys_collection
+#
+CREATE TABLE sys_collection_entries (
+
+       uid int(11) NOT NULL auto_increment,
+       uid_local int(11) DEFAULT '0' NOT NULL,
+       uid_foreign int(11) DEFAULT '0' NOT NULL,
+       tablenames varchar(30) DEFAULT '' NOT NULL,
+       sorting int(11) DEFAULT '0' NOT NULL,
+
+       KEY uid_local (uid_local),
+       KEY uid_foreign (uid_foreign),
+       PRIMARY KEY (uid),
+);
+
+#
 # Table structure for table 'sys_history'
 #
 CREATE TABLE sys_history (
index 3fbc82b..426b554 100644 (file)
@@ -700,6 +700,173 @@ $TCA['sys_filemounts'] = array(
        )
 );
 
+/**
+ * tca-record collections
+ */
+$TCA['sys_collection'] = array(
+       'ctrl' => $TCA['sys_collection']['ctrl'],
+       'interface' => array (
+               'showRecordFieldList' => 'title, description, table_name, items'
+       ),
+       'feInterface' => $TCA['sys_collection']['feInterface'],
+       'columns' => array(
+               't3ver_label' => array(
+                       'label'  => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '30',
+                               'max'  => '30',
+                       )
+               ),
+               'sys_language_uid' => array(
+                       'exclude' => 1,
+                       'label'  => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
+                       'config' => array(
+                               'type'                => 'select',
+                               'foreign_table'       => 'sys_language',
+                               'foreign_table_where' => 'ORDER BY sys_language.title',
+                               'items' => array(
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
+                               )
+                       )
+               ),
+               'l10n_parent' => array (
+                       'displayCond' => 'FIELD:sys_language_uid:>:0',
+                       'exclude'     => 1,
+                       'label'       => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
+                       'config'      => array(
+                               'type'  => 'select',
+                               'items' => array(
+                                       array('', 0),
+                               ),
+                               'foreign_table'       => 'sys_file_collection',
+                               'foreign_table_where' => 'AND sys_file_collection.pid=###CURRENT_PID### AND sys_file_collection.sys_language_uid IN (-1,0)',
+                       )
+               ),
+               'l10n_diffsource' => array(
+                       'config' => array (
+                               'type' => 'passthrough'
+                       )
+               ),
+               'hidden' => array(
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
+                       'config'  => array (
+                               'type'    => 'check',
+                               'default' => '0'
+                       )
+               ),
+               'starttime' => array(
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
+                       'config'  => array (
+                               'type'     => 'input',
+                               'size'     => '8',
+                               'max'      => '20',
+                               'eval'     => 'date',
+                               'default'  => '0',
+                               'checkbox' => '0'
+                       )
+               ),
+               'endtime' => array(
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
+                       'config'  => array (
+                               'type'     => 'input',
+                               'size'     => '8',
+                               'max'      => '20',
+                               'eval'     => 'date',
+                               'checkbox' => '0',
+                               'default'  => '0',
+                               'range'    => array(
+                                       'upper' => mktime(3, 14, 7, 1, 19, 2038),
+                                       'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
+                               )
+                       )
+               ),
+               'fe_group' => array(
+                       'exclude' => 1,
+                       'label'   => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
+                       'config'  => array(
+                               'type'  => 'select',
+                               'items' => array(
+                                       array('', 0),
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1),
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2),
+                                       array('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--')
+                               ),
+                               'foreign_table' => 'fe_groups'
+                       )
+               ),
+               'table_name' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection.table_name',
+                       'config' => array (
+                               'type' => 'select',
+                               'special' => 'tables'
+                       )
+               ),
+               'items' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection.items',
+                       'config' => array(
+                               'type' => 'group',
+                               'internal_type' => 'db',
+                               'prepend_tname' => TRUE,
+                               'allowed' => '*',
+                               'MM' => 'sys_collection_entries',
+                               'MM_hasUidField' => TRUE,
+                               'multiple' => TRUE,
+
+                       )
+               ),
+               'title' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection.title',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '60',
+                               'eval' => 'required'
+                       )
+               ),
+               'description' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection.description',
+                       'config' => array(
+                               'type' => 'text',
+                               'cols' => '60',
+                               'rows' => '5'
+                       )
+               ),
+               'type' => array(
+                       'exclude' => 0,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_collection.type',
+                       'config' => array(
+                               'type' => 'select',
+                               'items' => array(
+                                       array('LLL:EXT:lang/locallang_tca.xlf:sys_collection.type.static', 'static'),
+                                       array('LLL:EXT:lang/locallang_tca.xlf:sys_collection.type.filter', 'filter')
+                               ),
+                               'default' => 'static'
+                       )
+               ),
+               'criteria' => array(
+                       'exclude' => 0,
+                       'label' => '[filter]',
+                       'config' => array(
+                               'type' => 'passthrough'
+                       )
+               )
+       ),
+       'types' => array (
+               'static' => array('showitem' => 'title;;1,type, description,table_name, items'),
+               'filter' => array('showitem' => 'title;;1,type, description,table_name')
+       ),
+       'palettes' => array (
+               '1' => array('showitem' => 'starttime, endtime, fe_group, sys_language_uid, l10n_parent, l10n_diffsource, hidden')
+       )
+);
 
 /**
  * System languages - Defines possible languages used for translation of records in the system
index 87b0693..c769d01 100644 (file)
                        <trans-unit id="sys_filemounts" xml:space="preserve">
                                <source>Filemount</source>
                        </trans-unit>
+                       <trans-unit id="sys_collection" xml:space="preserve">
+                               <source>Record Collection</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.title" xml:space="preserve">
+                               <source>Collection-Name</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.description" xml:space="preserve">
+                               <source>Description</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.table_name" xml:space="preserve">
+                               <source>Record Type of Collection</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.items" xml:space="preserve">
+                               <source>Items</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.type" xml:space="preserve">
+                               <source>Type of collection</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.type.static" xml:space="preserve">
+                               <source>static record composition</source>
+                       </trans-unit>
+                       <trans-unit id="sys_collection.type.filter" xml:space="preserve">
+                               <source>dynamic record filter</source>
+                       </trans-unit>
                        <trans-unit id="sys_language" xml:space="preserve">
                                <source>Website Language</source>
                        </trans-unit>