[TASK] Move JavaScript files out of t3lib 03/20903/3
authorFelix Kopp <felix-source@phorax.com>
Sat, 18 May 2013 21:32:00 +0000 (23:32 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 11 Jun 2013 09:30:33 +0000 (11:30 +0200)
t3lib folder should diminish and finally dissolve itself.
Moves JS files out of t3lib to corresponding extension folders.

Change-Id: Iffdbd1a919dadae923034d38dedafa68a902da26
Resolves: #48379
Releases: 6.2
Reviewed-on: https://review.typo3.org/20903
Tested-by: Wouter Wolters
Reviewed-by: Wouter Wolters
Reviewed-by: Markus Klein
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
33 files changed:
t3lib/js/extjs/components/slider/ValueSlider.js [deleted file]
t3lib/js/extjs/contexthelp.js [deleted file]
t3lib/js/extjs/tree/tree.js [deleted file]
t3lib/js/extjs/util.js [deleted file]
t3lib/js/jsfunc.tceforms_suggest.js [deleted file]
t3lib/jsfunc.evalfield.js [deleted file]
t3lib/jsfunc.inline.js [deleted file]
t3lib/jsfunc.menu.js [deleted file]
t3lib/jsfunc.updateform.js [deleted file]
t3lib/jsfunc.validateform.js [deleted file]
typo3/js/jsfunc.evalfield.js [new file with mode: 0644]
typo3/js/jsfunc.updateform.js [new file with mode: 0644]
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Form/Element/TreeElement.php
typo3/sysext/backend/Classes/Form/Element/ValueSlider.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Resources/Public/JavaScript/ValueSlider.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/tree.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/util.js [new file with mode: 0644]
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/FormContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/JavaScriptMenuContentObject.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/frontend/Resources/Public/JavaScript/jsfunc.menu.js [new file with mode: 0644]
typo3/sysext/frontend/Resources/Public/JavaScript/jsfunc.validateform.js [new file with mode: 0644]
typo3/sysext/perm/Classes/Controller/PermissionModuleController.php

diff --git a/t3lib/js/extjs/components/slider/ValueSlider.js b/t3lib/js/extjs/components/slider/ValueSlider.js
deleted file mode 100644 (file)
index 46d466b..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
- *  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!
- ***************************************************************/
-
-Ext.ns('TYPO3.Components');
-
-TYPO3.Components.TcaValueSlider = Ext.extend(Ext.slider.SingleSlider, {
-       itemName: null,
-       getField: null,
-       changeCallback: null,
-       valueItems: null,
-       itemElement: null,
-       elementType: null,
-
-       initComponent: function() {
-               var items, step, n;
-               var step = this.increment || 1;
-               if (step < 1) {
-                       this.type = 'float';
-                       this.increment = 1;
-                       this.floatValue = 1 / step;
-                       this.maxValue *= this.floatValue;
-               }
-
-               Ext.apply(this, {
-                       minValue: this.minValue || 0,
-                       maxValue: this.maxValue || 10000,
-                       keyIncrement: step,
-                       increment: step,
-                       type: this.type,
-                       plugins: new Ext.slider.Tip({
-                               getText: function(thumb) {
-                                       return thumb.slider.renderValue(thumb.value);
-                               }
-                       }),
-                       listeners: {
-                               beforerender: function(slider) {
-                                       var items = Ext.query(this.elementType);
-                                       items.each(function(item) {
-                                               var n = item.getAttribute('name');
-                                               if (n == this.itemName) {
-                                                       this.itemElement = item;
-                                               }
-                                       }, this);
-
-                                       if (this.elementType == 'select') {
-                                               this.minValue = 0;
-                                               this.maxValue = this.itemElement.options.length - 1;
-                                               step = 1;
-                                       }
-                               },
-                               changecomplete: function(slider, newValue, thumb) {
-                                       if (slider.itemName) {
-                                               if (slider.elementType == 'input') {
-                                                       slider.itemElement.value = slider.renderValue(thumb.value);
-                                               }
-                                               if (slider.elementType == 'select') {
-                                                       slider.itemElement.options[thumb.value].selected = '1';
-                                               }
-                                       }
-                                       if (slider.getField) {
-                                               eval(slider.getField);
-                                       }
-                                       if (slider.changeCallback) {
-                                               eval(slider.changeCallback);
-                                       }
-                               },
-                               scope: this
-                       }
-               });
-               TYPO3.Components.TcaValueSlider.superclass.initComponent.call(this);
-       },
-
-       /**
-       * Render value for tooltip
-       *
-       * @param {string} value
-       * @return string
-       */
-       renderValue: function(value) {
-               switch (this.type) {
-                       case 'array':
-                               return this.itemElement.options[value].text;
-                       break;
-                       case 'time':
-                               return this.renderValueFromTime(value);
-                       break;
-                       case 'float':
-                               return this.renderValueFromFloat(value);
-                       break;
-                       case 'int':
-                       default:
-                               return value;
-               }
-       },
-
-       /**
-       * Render value for tooltip as float
-       *
-       * @param {string} value
-       * @return string
-       */
-       renderValueFromFloat: function(value) {
-               var v = value / this.floatValue;
-               return v;
-       },
-
-       /**
-       * Render value for tooltip as time
-       *
-       * @param {string} value
-       * @return string
-       */
-       renderValueFromTime: function(value) {
-               var hours = Math.floor(value / 3600);
-               var rest = value - (hours * 3600);
-               var minutes = Math.round(rest / 60);
-               minutes = minutes < 10 ? '0' + minutes : minutes;
-               return hours + ':' + minutes;
-       }
-
-});
-
-Ext.reg('TYPO3.Components.TcaValueSlider', TYPO3.Components.TcaValueSlider);
\ No newline at end of file
diff --git a/t3lib/js/extjs/contexthelp.js b/t3lib/js/extjs/contexthelp.js
deleted file mode 100644 (file)
index e98d534..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
- *  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!
- ***************************************************************/
-
-Ext.ns('TYPO3', 'TYPO3.CSH.ExtDirect');
-
-/**
- * Class to show tooltips for links that have the css t3-help-link
- * need the tags data-table and data-field (HTML5)
- */
-
-
-TYPO3.ContextHelp = function() {
-
-       /**
-        * Cache for CSH
-        * @type {Ext.util.MixedCollection}
-        */
-       var cshHelp = new Ext.util.MixedCollection(true),
-       tip;
-
-       /**
-        * Shows the tooltip, triggered from mouseover event handler
-        *
-        */
-       function showToolTipHelp() {
-               var link = tip.triggerElement;
-               if (!link) {
-                       return false;
-               }
-               var table = link.getAttribute('data-table');
-               var field = link.getAttribute('data-field');
-               var key = table + '.' + field;
-               var response = cshHelp.key(key);
-               tip.target = tip.triggerElement;
-               if (response) {
-                       updateTip(response);
-               } else {
-                               // If a table is defined, use ExtDirect call to get the tooltip's content
-                       if (table) {
-                                       // Clear old tooltip contents
-                               updateTip({
-                                       description: top.TYPO3.LLL.core.csh_tooltip_loading,
-                                       cshLink: '',
-                                       moreInfo: '',
-                                       title: ''
-                               });
-                                       // Load content
-                               TYPO3.CSH.ExtDirect.getTableContextHelp(table, function(response, options) {
-                                       Ext.iterate(response, function(key, value){
-                                               cshHelp.add(value);
-                                               if (key === field) {
-                                                       updateTip(value);
-                                                               // Need to re-position because the height may have increased
-                                                       tip.show();
-                                               }
-                                       });
-                               }, this);
-
-                               // No table was given, use directly title and description
-                       } else {
-                               updateTip({
-                                       description: link.getAttribute('data-description'),
-                                       cshLink: '',
-                                       moreInfo: '',
-                                       title: link.getAttribute('data-title')
-                               });
-                       }
-               }
-       }
-
-       /**
-        * Update tooltip message
-        *
-        * @param {Object} response
-        */
-       function updateTip(response) {
-               tip.body.dom.innerHTML = response.description;
-               tip.cshLink = response.id;
-               tip.moreInfo = response.moreInfo;
-               if (tip.moreInfo) {
-                       tip.addClass('tipIsLinked');
-               }
-               tip.setTitle(response.title);
-               tip.doAutoWidth();
-       }
-
-       return {
-               /**
-                * Constructor
-                */
-               init: function() {
-                       tip = new Ext.ToolTip({
-                               title: 'CSH', // needs a title for init because of the markup
-                               html: '',
-                                       // The tooltip will appear above the label, if viewport allows
-                               anchor: 'bottom',
-                               minWidth: 160,
-                               maxWidth: 240,
-                               target: Ext.getBody(),
-                               delegate: 'span.t3-help-link',
-                               renderTo: Ext.getBody(),
-                               cls: 'typo3-csh-tooltip',
-                               shadow: false,
-                               dismissDelay: 0, // tooltip stays while mouse is over target
-                               autoHide: true,
-                               showDelay: 1000, // show after 1 second
-                               hideDelay: 300, // hide after 0.3 seconds
-                               closable: true,
-                               isMouseOver: false,
-                               listeners: {
-                                       beforeshow: showToolTipHelp,
-                                       render: function(tip) {
-                                               tip.body.on({
-                                                       'click': {
-                                                               fn: function(event) {
-                                                                       event.stopEvent();
-                                                                       if (tip.moreInfo) {
-                                                                               try {
-                                                                                       top.TYPO3.ContextHelpWindow.open(tip.cshLink);
-                                                                               } catch(e) {
-                                                                                       // do nothing
-                                                                               }
-                                                                       }
-                                                                       tip.hide();
-                                                               }
-                                                       }
-                                               });
-                                               tip.el.on({
-                                                       'mouseover': {
-                                                               fn: function() {
-                                                                       if (tip.moreInfo) {
-                                                                               tip.isMouseOver = true;
-                                                                       }
-                                                               }
-                                                       },
-                                                       'mouseout': {
-                                                               fn: function() {
-                                                                       if (tip.moreInfo) {
-                                                                               tip.isMouseOver = false;
-                                                                               tip.hide.defer(tip.hideDelay, tip, []);
-                                                                       }
-                                                               }
-                                                       }
-                                               });
-                                       },
-                                       hide: function(tip) {
-                                               tip.setTitle('');
-                                               tip.body.dom.innerHTML = '';
-                                       },
-                                       beforehide: function(tip) {
-                                               return !tip.isMouseOver;
-                                       },
-                                       scope: this
-                               }
-                       });
-
-                       Ext.getBody().on({
-                               'keydown': {
-                                       fn: function() {
-                                               tip.hide();
-                                       }
-                               },
-                               'click': {
-                                       fn: function() {
-                                               tip.hide();
-                                       }
-                               }
-                       });
-
-                       /**
-                        * Adds a sequence to Ext.TooltTip::showAt so as to increase vertical offset when anchor position is 'botton'
-                        * This positions the tip box closer to the target element when the anchor is on the bottom side of the box
-                        * When anchor position is 'top' or 'bottom', the anchor is pushed slightly to the left in order to align with the help icon, if any
-                        *
-                        */
-                       Ext.ToolTip.prototype.showAt = Ext.ToolTip.prototype.showAt.createSequence(
-                               function() {
-                                       var ap = this.getAnchorPosition().charAt(0);
-                                       if (this.anchorToTarget && !this.trackMouse) {
-                                               switch (ap) {
-                                                       case 'b':
-                                                               var xy = this.getPosition();
-                                                               this.setPagePosition(xy[0]-10, xy[1]+5);
-                                                               break;
-                                                       case 't':
-                                                               var xy = this.getPosition();
-                                                               this.setPagePosition(xy[0]-10, xy[1]);
-                                                               break;
-                                               }
-                                       }
-                               }
-                       );
-
-               },
-
-               /**
-                * Opens the help window, triggered from click event handler
-                *
-                * @param {Event} event
-                * @param {Node} link
-                */
-               openHelpWindow: function(event, link) {
-                       var id = link.getAttribute('data-table') + '.' + link.getAttribute('data-field');
-                       event.stopEvent();
-                       top.TYPO3.ContextHelpWindow.open(id);
-               }
-       }
-}();
-
-/**
- * Calls the init on Ext.onReady
- */
-Ext.onReady(TYPO3.ContextHelp.init, TYPO3.ContextHelp);
diff --git a/t3lib/js/extjs/tree/tree.js b/t3lib/js/extjs/tree/tree.js
deleted file mode 100644 (file)
index 955da3d..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
- *  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!
- ***************************************************************/
-
-Ext.ns('TYPO3.Components', 'TYPO3.Components.Tree');
-
-/**
- * TYPO3window - General TYPO3 tree component
- */
-
-TYPO3.Components.Tree = {};
-TYPO3.Components.Tree.StandardTreeItemData = [];
-
-TYPO3.Components.Tree.StandardTree = function(config) {
-       var conf = Ext.apply({
-               header: false,
-               width: 280,
-               rootVisible: false,
-               useArrows: false,
-               lines: true,
-               autoScroll: true,
-               containerScroll: true,
-               exclusiveSelectedKey: null,
-               stateful: true,
-               filterOptionStartsWith: true,
-               countSelectedNodes: 0,
-               loader: new Ext.tree.TreeLoader({
-                       preloadChildren: true,
-                       clearOnLoad: false
-               }),
-               root: new Ext.tree.AsyncTreeNode({
-                       text: TYPO3.l10n.localize('tcatree'),
-                       id: 'root',
-                       expanded: true,
-                       children: TYPO3.Components.Tree.StandardTreeItemData[config.id]
-               }),
-               collapseFirst: false,
-               listeners: {
-                       'checkchange': function(checkedNode, checked) {
-                               if (Ext.isFunction(this.checkChangeHandler)) {
-                                       this.checkChangeHandler.call(this, checkedNode, checked);
-                               }
-                       },
-                       scope: this
-               }
-       }, config);
-       TYPO3.Components.Tree.StandardTree.superclass.constructor.call(this, conf);
-};
-
-
-Ext.extend(TYPO3.Components.Tree.StandardTree, Ext.tree.TreePanel, {
-
-       initComponent: function() {
-               Ext.apply(this, {
-                       tbar: this.initialConfig.showHeader ? TYPO3.Components.Tree.Toolbar([], this) : null
-               });
-               TYPO3.Components.Tree.StandardTree.superclass.initComponent.call(this);
-       },
-       filterTree: function(filterText) {
-               var text = filterText.getValue();
-               Ext.each(this.hiddenNodes, function(node) {
-                       node.ui.show();
-                       node.ui.removeClass('bgColor6');
-               });
-               if (!text) {
-                       this.filter.clear();
-                       return;
-               }
-               this.expandAll();
-               var regText = (this.filterOptionStartsWith ? '^' : '') + Ext.escapeRe(text);
-               var re = new RegExp(regText, 'i');
-
-                       // hide empty nodes that weren't filtered
-               this.hiddenNodes = [];
-               var me = this;
-               this.root.cascade(function(node) {
-                       if (node.ui.ctNode.offsetHeight < 3) {
-                               if (!re.test(node.text)) {
-                                       node.ui.hide();
-                                       me.hiddenNodes.push(node);
-                               } else {
-                                       node.ui.addClass('bgColor6');
-                               }
-                       }
-               }, this);
-       }
-});
-
-TYPO3.Components.Tree.Toolbar = function(items, scope) {
-       items = items || [];
-       items.push([
-               ' ',
-               {
-                       iconCls: 't3-icon t3-icon-actions t3-icon-actions-system t3-icon-system-tree-search-open',
-                       menu: {
-                               items: [
-                                       {
-                                               text: TYPO3.l10n.localize('tcatree.filter.startsWith'),
-                                               checked: true,
-                                               group: 'searchStartsWith',
-                                               handler: function(item) {
-                                                       scope.filterOptionStartsWith = true;
-                                                       scope.filterTree(scope.getTopToolbar().getComponent('filterText'));
-                                               },
-                                               scope: scope
-                                       },
-                                       {
-                                               text: TYPO3.l10n.localize('tcatree.filter.contains'),
-                                               checked: false,
-                                               group: 'searchStartsWith',
-                                               handler: function(item) {
-                                                       scope.filterOptionStartsWith = false;
-                                                       scope.filterTree(scope.getTopToolbar().getComponent('filterText'));
-                                               },
-                                               scope: scope
-                                       }
-                               ]
-                       }
-               },
-               new Ext.form.TextField({
-                       width: 150,
-                       emptyText: TYPO3.l10n.localize('tcatree.findItem'),
-                       enableKeyEvents: true,
-                       itemId: 'filterText',
-                       listeners:{
-                               render: function(f) {
-                                       this.filter = new Ext.tree.TreeFilter(this, {
-                                               clearBlank: true,
-                                               autoClear: true
-                                       });
-                               },
-                               keydown: {
-                                       fn: scope.filterTree,
-                                       buffer: 350,
-                                       scope: scope
-                               },
-                               scope: scope
-                       }
-               }),
-               '->',
-               {
-                       iconCls: 't3-icon t3-icon-apps t3-icon-apps-tcatree t3-icon-tcatree-select-recursive',
-                       tooltip: TYPO3.lang['tcatree.enableRecursiveSelection'],
-                       enableToggle: true,
-                       disable: scope.tcaSelectRecursive,
-                       toggleHandler: function(btn, state) {
-                               this.tcaSelectRecursive = state;
-                       },
-                       scope: scope
-               },
-               {
-                       iconCls: 'icon-expand-all',
-                       tooltip: TYPO3.l10n.localize('tcatree.expandAll'),
-                       handler: function() {
-                                       this.root.expand(true);
-                       },
-                       scope: scope
-               }, {
-                       iconCls: 'icon-collapse-all',
-                       tooltip: TYPO3.l10n.localize('tcatree.collapseAll'),
-                       handler: function() {
-                               this.root.collapse(true);
-                       },
-                       scope: scope
-               }
-       ]);
-       return items;
-};
-
-TYPO3.Components.Tree.EmptySelectionModel = new Ext.tree.DefaultSelectionModel({
-       select: Ext.emptyFn
-})
-
-TYPO3.Components.Tree.TcaCheckChangeHandler = function(checkedNode, checked) {
-       var exclusiveKeys = this.tcaExclusiveKeys.split(','),
-               uid = '' + checkedNode.attributes.uid;
-
-       this.suspendEvents();
-
-       if (this.tcaExclusiveKeys.length) {
-               if (checked === true && exclusiveKeys.indexOf(uid) > -1) {
-                               // this key is exclusive, so uncheck all others
-                       this.root.cascade(function(node) {
-                               if (node !== checkedNode && node.attributes.checked) {
-                                       node.attributes.checked = false;
-                                       node.ui.toggleCheck(false);
-                               }
-                       });
-                       this.exclusiveSelectedKey = uid;
-               } else if (checked === true && exclusiveKeys.indexOf(uid) === -1 && !Ext.isEmpty(this.exclusiveSelectedKey)) {
-                               // this key is exclusive, so uncheck all others
-                       this.root.cascade(function(node) {
-                               if (exclusiveKeys.indexOf('' + node.attributes.uid) > -1) {
-                                       node.attributes.checked = false;
-                                       node.ui.toggleCheck(false);
-                               }
-                       });
-                       this.exclusiveSelectedKey = null;
-               }
-       }
-
-       if (checked === true && this.countSelectedNodes >= this.tcaMaxItems) {
-               checkedNode.attributes.checked = false;
-               checkedNode.getUI().toggleCheck(false);
-               this.resumeEvents();
-               return false;
-       }
-       if (checked) {
-               checkedNode.getUI().addClass('complete');
-       } else {
-               checkedNode.getUI().removeClass('complete');
-       }
-               // if recursive selection is asked, hand over selection
-       if(this.tcaSelectRecursive) {
-               checkedNode.cascade(function(node) {
-                       node.attributes.checked = checkedNode.attributes.checked;
-                       node.ui.toggleCheck(checkedNode.attributes.checked);
-               })
-       }
-       var selected = [];
-       this.root.cascade(function(node) {
-               if (node.ui.isChecked()) {
-                       selected.push(node.attributes.uid);
-               }
-       });
-       this.countSelectedNodes = selected.length;
-       Ext.fly('treeinput' + this.id).dom.value = selected.join(',');
-       eval(this.onChange);
-
-       this.resumeEvents();
-};
diff --git a/t3lib/js/extjs/util.js b/t3lib/js/extjs/util.js
deleted file mode 100644 (file)
index b6f8470..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2010-2011 Stefan Galinski <stefan.galinski@gmail.com>
-*  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!
-***************************************************************/
-Ext.namespace('TYPO3');
-
-/**
- * @class TYPO3.Utility
- *
- * Generic utility methods that are not provided by ExtJs
- *
- * @namespace TYPO3
- * @author Stefan Galinski <stefan.galinski@gmail.com>
- */
-TYPO3.Utility = {
-       /**
-        * Checks if a given number is really a number
-        *
-        * Taken from:
-        * http://dl.dropbox.com/u/35146/js/tests/isNumber.html
-        *
-        * @param {String} number
-        * @return {Boolean}
-        */
-       isNumber: function(number) {
-               return !isNaN(parseFloat(number)) && isFinite(number);
-       },
-
-       /**
-        * Gets a parameter from a given url
-        *
-        * @param {string} url
-        * @param {string} parameter
-        * @return {string}
-        */
-       getParameterFromUrl: function(url, parameter) {
-         var parts = url.split('?'),
-                 value = '';
-
-         if (parts.length >= 2) {
-                 var urlBase = parts.shift();
-                 var queryString = parts.join('?');
-
-                 var prefix = encodeURIComponent(parameter) + '=';
-                 var parameters = queryString.split(/[&;]/g);
-                 for (var i = parameters.length; i-- > 0;) {
-                         if (parameters[i].lastIndexOf(prefix, 0) !== -1) {
-                                 value = parameters[i].split('=')[1];
-                                 break;
-                         }
-                 }
-         }
-
-         return value;
-       }
-};
diff --git a/t3lib/js/jsfunc.tceforms_suggest.js b/t3lib/js/jsfunc.tceforms_suggest.js
deleted file mode 100644 (file)
index 0f59806..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************
-*  AJAX selectors for TCEforms
-*
-*  Copyright notice
-*
-*  (c) 2007-2011 Andreas Wolf <andreas.wolf@ikt-werk.de>
-*  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.
-*
-*  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!
-***************************************************************/
-
-/**
- * Class for JS handling of suggest fields in TCEforms.
- *
- * @author  Andreas Wolf <andreas.wolf@ikt-werk.de>
- * @author  Benni Mack <benni@typo3.org>
- */
-if (!TCEForms) {
-       var TCEForms = {};
-}
-
-TCEForms.Suggest = Class.create({
-       objectId: '',
-       suggestField: '',
-       suggestResultList: '',
-       minimumCharacters: 2,
-       defaultValue: '',
-
-       /**
-        * Wrapper for script.aculo.us' Autocompleter functionality: Assigns a new autocompletion object to
-        * the input field of a given Suggest selector.
-        *
-        * @param  string  objectId  The ID of the object to assign the completer to
-        * @param  string  table     The table of the record which is currently edited
-        * @param  string  field     The field which is currently edited
-        * @param  integer uid       The uid of the record which is currently edited
-        * @param  integer pid       The pid of the record which is currently edited
-        * @param  integer minimumCharacters the minimum characaters that is need to trigger the initial search
-        */
-       initialize: function(objectId, table, field, uid, pid, minimumCharacters) {
-               var PATH_typo3 = top.TS.PATH_typo3 || window.opener.top.TS.PATH_typo3;
-               this.objectId = objectId;
-               this.suggestField = objectId + 'Suggest';
-               this.suggestResultList = objectId + 'SuggestChoices';
-
-               new Ajax.Autocompleter(this.suggestField, this.suggestResultList, PATH_typo3 + 'ajax.php', {
-                               paramName: 'value',
-                               minChars: (minimumCharacters ? minimumCharacters : this.minimumCharacters),
-                               updateElement: this.addElementToList.bind(this),
-                               parameters: 'ajaxID=t3lib_TCEforms_suggest::searchRecord&table=' + table + '&field=' + field + '&uid=' + uid + '&pid=' + pid,
-                               indicator: objectId + 'SuggestIndicator'
-                       }
-               );
-
-               $(this.suggestField).observe('focus', this.checkDefaultValue.bind(this));
-               $(this.suggestField).observe('keydown', this.checkDefaultValue.bind(this));
-       },
-
-       /**
-        * check for default value of the input field and set it to empty once somebody wants to type something in
-        */
-       checkDefaultValue: function() {
-               if ($(this.suggestField).value == this.defaultValue) {
-                       $(this.suggestField).value = '';
-               }
-       },
-
-       /**
-        * Adds an element to the list of items in a group selector.
-        *
-        * @param  object  item  The item to add to the list (usually an li element)
-        * @return void
-        */
-       addElementToList: function(item) {
-               if (item.className.indexOf('noresults') == -1) {
-                       var arr = item.id.split('-');
-                       var ins_table = arr[0];
-                       var ins_uid = arr[1];
-                       var rec_table = arr[2];
-                       var rec_uid = arr[3];
-                       var rec_field = arr[4];
-
-                       var formEl = 'data[' + rec_table + '][' + rec_uid + '][' + rec_field + ']';
-                       var suggestLabelNode = Element.select(this.escapeObjectId(item.id), '.suggest-label')[0];
-                       var label = (suggestLabelNode.textContent ? suggestLabelNode.textContent : suggestLabelNode.innerText)
-                       setFormValueFromBrowseWin(formEl, ins_table + '_' + ins_uid, label);
-                       TBE_EDITOR.fieldChanged(rec_table, rec_uid, rec_field, formEl);
-
-                       $(this.suggestField).value = this.defaultValue;
-               }
-       },
-
-       /**
-        * Escapes object identifiers of e.g. Flexform CSS IDs
-        *
-        * @param string objectId
-        * @return string
-        */
-       escapeObjectId: function(objectId) {
-               var escapedObjectId;
-               escapedObjectId = objectId.replace(/:/g, '\\:');
-               escapedObjectId = objectId.replace(/\./g, '\\.');
-               escapedObjectId = objectId.replace(/\[/g, '\\[');
-               escapedObjectId = objectId.replace(/\]/g, '\\]');
-               return escapedObjectId;
-       }
-});
diff --git a/t3lib/jsfunc.evalfield.js b/t3lib/jsfunc.evalfield.js
deleted file mode 100644 (file)
index 0666c54..0000000
+++ /dev/null
@@ -1,530 +0,0 @@
-/***************************************************************
-*
-*  Evaluation of TYPO3 form field content
-*
-*
-*
-*  Copyright notice
-*
-*  (c) 1998-2011 Kasper Skaarhoj
-*  All rights reserved
-*
-*  This script is part of the TYPO3 t3lib/ library provided by
-*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
-*
-*  Released under GNU/GPL (see license file in typo3/sysext/cms/tslib/)
-*
-*  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.
-*
-*  This copyright notice MUST APPEAR in all copies of this script
-***************************************************************/
-
-
-function evalFunc() {
-       this.input = evalFunc_input;
-       this.output = evalFunc_output;
-       this.parseInt = evalFunc_parseInt;
-       this.getNumChars = evalFunc_getNumChars;
-       this.parseDouble = evalFunc_parseDouble;
-       this.noSpace = evalFunc_noSpace;
-       this.getSecs = evalFunc_getSecs;
-       this.getYear = evalFunc_getYear;
-       this.getTimeSecs = evalFunc_getTimeSecs;
-       this.getTime = evalFunc_getTime;
-       this.getDate = evalFunc_getDate;
-       this.getTimestamp = evalFunc_getTimestamp;
-       this.caseSwitch = evalFunc_caseSwitch;
-       this.evalObjValue = evalFunc_evalObjValue;
-       this.outputObjValue = evalFunc_outputObjValue;
-       this.split = evalFunc_splitStr;
-       this.pol = evalFunc_pol;
-       this.convertClientTimestampToUTC = evalFunc_convertClientTimestampToUTC;
-
-       this.ltrim = evalFunc_ltrim;
-       this.btrim = evalFunc_btrim;
-       var today = new Date();
-       this.lastYear = this.getYear(today);
-       this.lastDate = this.getDate(today);
-       this.lastTime = 0;
-       this.refDate = today;
-       this.isInString = '';
-       this.USmode = 0;
-}
-function evalFunc_pol(fortegn, value) {
-       return eval (((fortegn=="-")?'-':'')+value);
-}
-function evalFunc_evalObjValue(FObj,value) {
-       var evallist = FObj.evallist;
-       this.isInString = (FObj.is_in) ? ''+FObj.is_in : '';
-       var index=1;
-       var theEvalType = (FObj.evallist) ? this.split(evallist, ",", index) : false;
-       var newValue=value;
-       while (theEvalType) {
-               if (theEvalType.slice(0, 3) == 'tx_' || theEvalType.slice(0, 3) == 'Tx_') {
-                       if(typeof window[theEvalType] == 'function') {
-                               newValue = window[theEvalType](newValue);       // variable function call, calling functions like tx_myext_myeval(value)
-                       }
-               } else {
-                       newValue = evalFunc.input(theEvalType, newValue);
-               }
-               index++;
-               theEvalType = this.split(evallist, ",", index);
-       }
-       return newValue;
-}
-function evalFunc_outputObjValue(FObj,value) {
-       var evallist = FObj.evallist;
-       var index=1;
-       var theEvalType = this.split(evallist, ",", index);
-       var newValue=value;
-       while (theEvalType) {
-               if (theEvalType != 'required') {
-                       newValue = evalFunc.output(theEvalType, value, FObj);
-               }
-               index++;
-               theEvalType = this.split(evallist, ",", index);
-       }
-       return newValue;
-}
-function evalFunc_caseSwitch(type,inVal) {
-       var theVal = ''+inVal;
-       var newString = '';
-       switch (type) {
-               case "alpha":
-               case "num":
-               case "alphanum":
-               case "alphanum_x":
-                       for (var a=0;a<theVal.length;a++) {
-                               var theChar = theVal.substr(a,1);
-                               var special = (theChar == '_' || theChar == '-');
-                               var alpha = (theChar >= 'a' && theChar <= 'z') || (theChar >= 'A' && theChar <= 'Z');
-                               var num = (theChar>='0' && theChar<='9');
-                               switch(type) {
-                                       case "alphanum":        special=0;              break;
-                                       case "alpha":   num=0; special=0;               break;
-                                       case "num":     alpha=0; special=0;             break;
-                               }
-                               if (alpha || num || theChar==' ' || special) {
-                                       newString+=theChar;
-                               }
-                       }
-               break;
-               case "is_in":
-                       if (this.isInString) {
-                               for (var a=0;a<theVal.length;a++) {
-                                       var theChar = theVal.substr(a,1);
-                                       if (this.isInString.indexOf(theChar)!=-1) {
-                                               newString+=theChar;
-                                       }
-                               }
-                       } else {newString = theVal;}
-               break;
-               case "nospace":
-                       newString = this.noSpace(theVal);
-               break;
-               case "upper":
-                       newString = theVal.toUpperCase();
-               break;
-               case "lower":
-                       newString = theVal.toLowerCase();
-               break;
-               default:
-                       return inVal;
-       }
-       return newString;
-}
-function evalFunc_parseInt(value) {
-       var theVal = ''+value;
-       if (!value) {
-               return 0;
-       }
-       for (var a = 0; a < theVal.length; a++) {
-               if (theVal.substr(a,1)!='0') {
-                       return parseInt(theVal.substr(a,theVal.length)) || 0;
-               }
-       }
-       return 0;
-}
-function evalFunc_getNumChars(value) {
-       var theVal = ''+value;
-       if (!value) {
-               return 0;
-       }
-       var outVal="";
-       for (var a = 0; a < theVal.length; a++) {
-               if (theVal.substr(a,1)==parseInt(theVal.substr(a,1))) {
-                       outVal+=theVal.substr(a,1);
-               }
-       }
-       return outVal;
-}
-function evalFunc_parseDouble(value) {
-       var theVal = "" + value;
-       theVal = theVal.replace(/[^0-9,\.-]/g, "");
-       var negative = theVal.substring(0, 1) === '-';
-       theVal = theVal.replace(/-/g, "");
-       theVal = theVal.replace(/,/g, ".");
-       if (theVal.indexOf(".") == -1) {
-               theVal += ".0";
-       }
-       var parts = theVal.split(".");
-       var dec = parts.pop();
-       theVal = Number(parts.join("") + "." + dec);
-       if (negative) {
-           theVal *= -1;
-       }
-       theVal = theVal.toFixed(2);
-
-       return theVal;
-}
-function evalFunc_noSpace(value) {
-       var theVal = ''+value;
-       var newString="";
-       for (var a=0;a<theVal.length;a++) {
-               var theChar = theVal.substr(a,1);
-               if (theChar!=' ') {
-                       newString+=theChar;
-               }
-       }
-       return newString;
-}
-function evalFunc_ltrim(value) {
-       var theVal = ''+value;
-       if (!value) {
-               return '';
-       }
-       for (var a = 0; a < theVal.length; a++) {
-               if (theVal.substr(a,1)!=' ') {
-                       return theVal.substr(a,theVal.length);
-               }
-       }
-       return '';
-}
-function evalFunc_btrim(value) {
-       var theVal = ''+value;
-       if (!value) {
-               return '';
-       }
-       for (var a = theVal.length; a > 0; a--) {
-               if (theVal.substr(a-1,1)!=' ') {
-                       return theVal.substr(0,a);
-               }
-       }
-       return '';
-}
-function evalFunc_splitSingle(value) {
-       var theVal = ''+value;
-       this.values = new Array();
-       this.pointer = 3;
-       this.values[1]=theVal.substr(0,2);
-       this.values[2]=theVal.substr(2,2);
-       this.values[3]=theVal.substr(4,10);
-}
-function evalFunc_split(value) {
-       this.values = new Array();
-       this.valPol = new Array();
-       this.pointer = 0;
-       var numberMode = 0;
-       var theVal = "";
-       value+=" ";
-       for (var a=0;a<value.length;a++) {
-               var theChar = value.substr(a,1);
-               if (theChar<"0" || theChar>"9") {
-                       if (numberMode) {
-                               this.pointer++;
-                               this.values[this.pointer]=theVal;
-                               theVal = "";
-                               numberMode=0;
-                       }
-                       if (theChar=="+" || theChar=="-") {
-                               this.valPol[this.pointer+1] = theChar;
-                       }
-               } else {
-                       theVal+=theChar;
-                       numberMode=1;
-               }
-       }
-}
-function evalFunc_input(type,inVal) {
-       if (type=="md5") {
-               return MD5(inVal);
-       }
-       if (type=="trim") {
-               return this.ltrim(this.btrim(inVal));
-       }
-       if (type=="int") {
-               return this.parseInt(inVal);
-       }
-       if (type=="double2") {
-               return this.parseDouble(inVal);
-       }
-
-       var today = new Date();
-       var add=0;
-       var value = this.ltrim(inVal);
-       var values = new evalFunc_split(value);
-       var theCmd = value.substr(0,1);
-       value = this.caseSwitch(type,value);
-       if (value=="") {
-               return "";
-               return 0;       // Why would I ever return a zero??? (20/12/01)
-       }
-       switch (type) {
-               case "datetime":
-                       switch (theCmd) {
-                               case "d":
-                               case "t":
-                               case "n":
-                                       this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               case "+":
-                               case "-":
-                                       if (this.lastTime == 0) {
-                                               this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
-                                       }
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               default:
-                                       var index = value.indexOf(' ');
-                                       if (index!=-1) {
-                                               var dateVal = this.input("date",value.substr(index,value.length));
-                                                       // set refDate so that evalFunc_input on time will work with correct DST information
-                                               this.refDate = new Date(dateVal*1000);
-                                               this.lastTime = dateVal + this.input("time",value.substr(0,index));
-                                       } else  {
-                                                       // only date, no time
-                                               this.lastTime = this.input("date", value);
-                                       }
-                       }
-                       this.lastTime+=add*24*60*60;
-                       return this.lastTime;
-               break;
-               case "year":
-                       switch (theCmd) {
-                               case "d":
-                               case "t":
-                               case "n":
-                                       this.lastYear = this.getYear(today);
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               case "+":
-                               case "-":
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               default:
-                                       if (values.valPol[2]) {
-                                               add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
-                                       }
-                                       var year = (values.values[1])?this.parseInt(values.values[1]):this.getYear(today);
-                                       if ((year >= 0 && year < 38) || (year >= 70 && year<100) || (year >= 1902 && year < 2038)) {
-                                               if (year<100) {
-                                                       year = (year<38) ? year+=2000 : year+=1900;
-                                               }
-                                       } else {
-                                               year = this.getYear(today);
-                                       }
-                                       this.lastYear = year;
-                       }
-                       this.lastYear+=add;
-                       return this.lastYear;
-               break;
-               case "date":
-                       switch (theCmd) {
-                               case "d":
-                               case "t":
-                               case "n":
-                                       this.lastDate = this.getTimestamp(today);
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               case "+":
-                               case "-":
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               default:
-                                       var index = 4;
-                                       if (values.valPol[index]) {
-                                               add = this.pol(values.valPol[index],this.parseInt(values.values[index]));
-                                       }
-                                       if (values.values[1] && values.values[1].length>2) {
-                                               if (values.valPol[2]) {
-                                                       add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
-                                               }
-                                               var temp = values.values[1];
-                                               values = new evalFunc_splitSingle(temp);
-                                       }
-
-                                       var year = (values.values[3])?this.parseInt(values.values[3]):this.getYear(today);
-                                       if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year<2038)) {
-                                               if (year<100) {
-                                                       year = (year<38) ? year+=2000 : year+=1900;
-                                               }
-                                       } else {
-                                               year = this.getYear(today);
-                                       }
-                                       var month = (values.values[this.USmode?1:2])?this.parseInt(values.values[this.USmode?1:2]):today.getUTCMonth()+1;
-                                       var day = (values.values[this.USmode?2:1])?this.parseInt(values.values[this.USmode?2:1]):today.getUTCDate();
-
-                                       var theTime = new Date(parseInt(year), parseInt(month)-1, parseInt(day));
-
-                                               // Substract timezone offset from client
-                                       this.lastDate = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 0);
-                       }
-                       this.lastDate+=add*24*60*60;
-                       return this.lastDate;
-               break;
-               case "time":
-               case "timesec":
-                       switch (theCmd) {
-                               case "d":
-                               case "t":
-                               case "n":
-                                       this.lastTime = this.getTimeSecs(today);
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               case "+":
-                               case "-":
-                                       if (this.lastTime == 0) {
-                                               this.lastTime = this.getTimeSecs(today);
-                                       }
-                                       if (values.valPol[1]) {
-                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
-                                       }
-                               break;
-                               default:
-                                       var index = (type=="timesec")?4:3;
-                                       if (values.valPol[index]) {
-                                               add = this.pol(values.valPol[index],this.parseInt(values.values[index]));
-                                       }
-                                       if (values.values[1] && values.values[1].length>2) {
-                                               if (values.valPol[2]) {
-                                                       add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
-                                               }
-                                               var temp = values.values[1];
-                                               values = new evalFunc_splitSingle(temp);
-                                       }
-                                       var sec = (values.values[3])?this.parseInt(values.values[3]):today.getUTCSeconds();
-                                       if (sec > 59)   {sec=59;}
-                                       var min = (values.values[2])?this.parseInt(values.values[2]):today.getUTCMinutes();
-                                       if (min > 59)   {min=59;}
-                                       var hour = (values.values[1])?this.parseInt(values.values[1]):today.getUTCHours();
-                                       if (hour >= 24) {hour=0;}
-
-                                       var theTime = new Date(this.getYear(this.refDate), this.refDate.getUTCMonth(), this.refDate.getUTCDate(), hour, min, ((type=="timesec")?sec:0));
-
-                                               // Substract timezone offset from client
-                                       this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 1);
-                       }
-                       this.lastTime+=add*60;
-                       if (this.lastTime<0) {this.lastTime+=24*60*60;}
-                       return this.lastTime;
-               break;
-               default:
-                       return value;
-       }
-}
-function evalFunc_output(type,value,FObj) {
-       var theString = "";
-       switch (type) {
-               case "date":
-                       if (!parseInt(value))   {return '';}
-                       var theTime = new Date(parseInt(value) * 1000);
-                       if (this.USmode) {
-                               theString = (theTime.getUTCMonth()+1)+'-'+theTime.getUTCDate()+'-'+this.getYear(theTime);
-                       } else {
-                               theString = theTime.getUTCDate()+'-'+(theTime.getUTCMonth()+1)+'-'+this.getYear(theTime);
-                       }
-               break;
-               case "datetime":
-                       if (!parseInt(value))   {return '';}
-                       theString = this.output("time",value)+' '+this.output("date",value);
-               break;
-               case "time":
-               case "timesec":
-                       if (!parseInt(value))   {return '';}
-                       var theTime = new Date(parseInt(value) * 1000);
-                       var h = theTime.getUTCHours();
-                       var m = theTime.getUTCMinutes();
-                       var s = theTime.getUTCSeconds();
-                       theString = h+':'+((m<10)?'0':'')+m + ((type=="timesec")?':'+((s<10)?'0':'')+s:'');
-               break;
-               case "password":
-                       theString = (value)     ? TS.passwordDummy : "";
-               break;
-               case "int":
-                       theString = (FObj.checkbox && value==FObj.checkboxValue)?'':value;
-               break;
-               default:
-                       theString = value;
-       }
-       return theString;
-}
-function evalFunc_getSecs(timeObj) {
-       return timeObj.getUTCSeconds();
-}
-// Seconds since midnight:
-function evalFunc_getTime(timeObj) {
-       return timeObj.getUTCHours() * 60 * 60 + timeObj.getUTCMinutes() * 60 + this.getSecs(timeObj);
-}
-function evalFunc_getYear(timeObj) {
-       return timeObj.getUTCFullYear();
-}
-// Seconds since midnight with client timezone offset:
-function evalFunc_getTimeSecs(timeObj) {
-       return timeObj.getHours()*60*60+timeObj.getMinutes()*60+timeObj.getSeconds();
-}
-function evalFunc_getDate(timeObj) {
-       var theTime = new Date(this.getYear(timeObj), timeObj.getUTCMonth(), timeObj.getUTCDate());
-       return this.getTimestamp(theTime);
-}
-function evalFunc_dummy (evallist,is_in,checkbox,checkboxValue) {
-       this.evallist = evallist;
-       this.is_in = is_in;
-       this.checkboxValue = checkboxValue;
-       this.checkbox = checkbox;
-}
-function evalFunc_splitStr(theStr1, delim, index) {
-       var theStr = ''+theStr1;
-       var lengthOfDelim = delim.length;
-       sPos = -lengthOfDelim;
-       if (index<1) {index=1;}
-       for (a=1; a<index; a++) {
-               sPos = theStr.indexOf(delim, sPos+lengthOfDelim);
-               if (sPos==-1)   {return null;}
-       }
-       ePos = theStr.indexOf(delim, sPos+lengthOfDelim);
-       if(ePos == -1)  {ePos = theStr.length;}
-       return (theStr.substring(sPos+lengthOfDelim,ePos));
-}
-function evalFunc_getTimestamp(timeObj) {
-       return Date.parse(timeObj)/1000;
-}
-
-// Substract timezone offset from client to a timestamp to get UTC-timestamp to be send to server
-function evalFunc_convertClientTimestampToUTC(timestamp, timeonly) {
-       var timeObj = new Date(timestamp*1000);
-       timeObj.setTime((timestamp - timeObj.getTimezoneOffset()*60)*1000);
-       if (timeonly) {
-                       // only seconds since midnight
-               return this.getTime(timeObj);
-       } else  {
-                       // seconds since the "unix-epoch"
-               return this.getTimestamp(timeObj);
-       }
-}
\ No newline at end of file
diff --git a/t3lib/jsfunc.inline.js b/t3lib/jsfunc.inline.js
deleted file mode 100644 (file)
index 1583938..0000000
+++ /dev/null
@@ -1,1245 +0,0 @@
-/*<![CDATA[*/
-
-/***************************************************************
-*  Inline-Relational-Record Editing
-*
-*
-*
-*  Copyright notice
-*
-*  (c) 2006-2011 Oliver Hader <oh@inpublica.de>
-*  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.
-*
-*  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!
-***************************************************************/
-
-var inline = {
-       classVisible: 't3-form-field-container-inline-visible',
-       classCollapsed: 't3-form-field-container-inline-collapsed',
-       structureSeparator: '-',
-       flexFormSeparator: '---',
-       flexFormSubstitute: ':',
-       prependFormFieldNames: 'data',
-       noTitleString: '[No title]',
-       lockedAjaxMethod: {},
-       sourcesLoaded: {},
-       data: {},
-       isLoading: false,
-
-       addToDataArray: function(object) {
-               $H(object).each(function(pair) {
-                       inline.data[pair.key] = $H(inline.data[pair.key]).merge(pair.value).toObject();
-               });
-       },
-       setPrependFormFieldNames: function(value) {
-               this.prependFormFieldNames = value;
-       },
-       setNoTitleString: function(value) {
-               this.noTitleString = value;
-       },
-       toggleEvent: function(event) {
-               var triggerElement = TYPO3.jQuery(event.target);
-               if (triggerElement.parents('.t3-form-field-header-inline-ctrl').length == 1) {
-                       return;
-               }
-
-               var recordHeader = TYPO3.jQuery(this);
-               inline.expandCollapseRecord(
-                       recordHeader.attr('id').replace('_header', ''),
-                       recordHeader.attr('data-expandSingle'),
-                       recordHeader.attr('data-returnURL')
-               );
-       },
-       expandCollapseRecord: function(objectId, expandSingle, returnURL) {
-               var currentUid = this.parseObjectId('none', objectId, 1);
-               var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
-               var escapedObjectId = this.escapeObjectId(objectId);
-
-               var currentObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
-                       // if content is not loaded yet, get it now from server
-               if((TYPO3.jQuery('#' + escapedObjectId + '_fields') && $("irre-loading-indicator" + objectId)) || inline.isLoading) {
-                       return false;
-               } else if ($(objectId + '_fields') && $(objectId + '_fields').innerHTML.substr(0,16) == '<!--notloaded-->') {
-                       inline.isLoading = true;
-                               // add loading-indicator
-                       if (TYPO3.jQuery('#' + escapedObjectId + '_icon')) {
-                               TYPO3.jQuery('#' + escapedObjectId + '_icon').hide();
-                               TYPO3.jQuery('#' + escapedObjectId + '_iconcontainer').addClass('loading-indicator');
-                       }
-                       return this.getRecordDetails(objectId, returnURL);
-               }
-
-               var isCollapsed = currentObject.hasClass(this.classCollapsed);
-               var collapse = new Array();
-               var expand = new Array();
-
-                       // if only a single record should be visibly for that set of records
-                       // and the record clicked itself is no visible, collapse all others
-               if (expandSingle && currentObject.hasClass(this.classCollapsed)) {
-                       collapse = this.collapseAllRecords(objectId, objectPrefix, currentUid);
-               }
-
-               inline.toggleElement(objectId);
-
-               if (this.isNewRecord(objectId)) {
-                       this.updateExpandedCollapsedStateLocally(objectId, isCollapsed);
-               } else if (isCollapsed) {
-                       expand.push(currentUid);
-               } else if (!isCollapsed) {
-                       collapse.push(currentUid);
-               }
-
-               this.setExpandedCollapsedState(objectId, expand.join(','), collapse.join(','));
-
-               return false;
-       },
-
-       toggleElement: function(objectId) {
-               var escapedObjectId = this.escapeObjectId(objectId);
-               var jQueryObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
-
-               if (jQueryObject.hasClass(this.classCollapsed)) {
-                       jQueryObject.removeClass(this.classCollapsed).addClass(this.classVisible);
-                       jQueryObject.find('#' + escapedObjectId + '_header .t3-icon-irre-collapsed').removeClass('t3-icon-irre-collapsed').addClass('t3-icon-irre-expanded');
-               } else {
-                       jQueryObject.removeClass(this.classVisible).addClass(this.classCollapsed);
-                       jQueryObject.find('#' + escapedObjectId + '_header .t3-icon-irre-expanded').addClass('t3-icon-irre-collapsed').removeClass('t3-icon-irre-expanded');
-               }
-       },
-       collapseAllRecords: function(objectId, objectPrefix, callingUid) {
-                       // get the form field, where all records are stored
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
-               var formObj = document.getElementsByName(objectName);
-               var collapse = [];
-
-               if (formObj.length) {
-                               // the uid of the calling object (last part in objectId)
-                       var recObjectId = '', escapedRecordObjectId;
-
-                       var records = formObj[0].value.split(',');
-                       for (var i=0; i<records.length; i++) {
-                               recObjectId = objectPrefix + this.structureSeparator + records[i];
-                               escapedRecordObjectId = this.escapeObjectId(recObjectId);
-
-                               var recordEntry = TYPO3.jQuery('#' + escapedRecordObjectId);
-                               if (records[i] != callingUid && recordEntry.hasClass(this.classVisible)) {
-                                       TYPO3.jQuery('#' + escapedRecordObjectId + '_div').removeClass(this.classVisible).addClass(this.classCollapsed);
-                                       if (this.isNewRecord(recObjectId)) {
-                                               this.updateExpandedCollapsedStateLocally(recObjectId, 0);
-                                       } else {
-                                               collapse.push(records[i]);
-                                       }
-                               }
-                       }
-               }
-
-               return collapse;
-       },
-
-       updateExpandedCollapsedStateLocally: function(objectId, value) {
-               var ucName = 'uc[inlineView]'+this.parseObjectId('parts', objectId, 3, 2, true);
-               var ucFormObj = document.getElementsByName(ucName);
-               if (ucFormObj.length) {
-                       ucFormObj[0].value = value;
-               }
-       },
-
-       getRecordDetails: function(objectId, returnURL) {
-               var context = this.getContext(this.parseObjectId('full', objectId, 0, 1));
-               inline.makeAjaxCall('getRecordDetails', [inline.getNumberOfRTE(), objectId, returnURL], true, context);
-               return false;
-       },
-
-       createNewRecord: function(objectId, recordUid) {
-               if (this.isBelowMax(objectId)) {
-                       var context = this.getContext(objectId);
-                       if (recordUid) {
-                               objectId += this.structureSeparator + recordUid;
-                       }
-                       this.makeAjaxCall('createNewRecord', [this.getNumberOfRTE(), objectId], true, context);
-               } else {
-                       alert('There are no more relations possible at this moment!');
-               }
-               return false;
-       },
-
-       synchronizeLocalizeRecords: function(objectId, type) {
-               var context = this.getContext(objectId);
-               var parameters = [this.getNumberOfRTE(), objectId, type];
-               this.makeAjaxCall('synchronizeLocalizeRecords', parameters, true, context);
-       },
-
-       setExpandedCollapsedState: function(objectId, expand, collapse) {
-               var context = this.getContext(objectId);
-               this.makeAjaxCall('setExpandedCollapsedState', [objectId, expand, collapse], false, context);
-       },
-
-       makeAjaxCall: function(method, params, lock, context) {
-               var max, url='', urlParams='', options={};
-               if (method && params && params.length && this.lockAjaxMethod(method, lock)) {
-                       url = TBE_EDITOR.getBackendPath() + 'ajax.php';
-                       urlParams = '&ajaxID=t3lib_TCEforms_inline::'+method;
-                       for (var i=0, max=params.length; i<max; i++) {
-                               urlParams += '&ajax['+i+']='+params[i];
-                       }
-                       if (context) {
-                               urlParams += '&ajax[context]=' + Object.toJSON(context);
-                       }
-                       options = {
-                               method:         'post',
-                               parameters:     urlParams,
-                               onSuccess:      function(xhr) { inline.isLoading = false; inline.processAjaxResponse(method, xhr); },
-                               onFailure:      function(xhr) { inline.isLoading = false; inline.showAjaxFailure(method, xhr); }
-                       };
-
-                       new Ajax.Request(url, options);
-               }
-       },
-
-       lockAjaxMethod: function(method, lock) {
-               if (!lock || !inline.lockedAjaxMethod[method]) {
-                       inline.lockedAjaxMethod[method] = true;
-                       return true;
-               } else {
-                       return false;
-               }
-       },
-
-       unlockAjaxMethod: function(method) {
-               inline.lockedAjaxMethod[method] = false;
-       },
-
-       processAjaxResponse: function(method, xhr, json) {
-               var addTag=null, restart=false, processedCount=0, element=null, errorCatch=[], sourcesWaiting=[];
-               if (!json && xhr) {
-                       json = xhr.responseJSON;
-               }
-                       // If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea):
-               if (json.headData) {
-                       var head = inline.getDomHeadTag();
-                       var headTags = inline.getDomHeadChildren(head);
-                       $A(json.headData).each(function(addTag) {
-                               if (!restart) {
-                                       if (addTag && (addTag.innerHTML || !inline.searchInDomTags(headTags, addTag))) {
-                                               if (addTag.name=='SCRIPT' && addTag.innerHTML && processedCount) {
-                                                       restart = true;
-                                                       return false;
-                                               } else {
-                                                       if (addTag.name=='SCRIPT' && addTag.innerHTML) {
-                                                               try {
-                                                                       eval(addTag.innerHTML);
-                                                               } catch(e) {
-                                                                       errorCatch.push(e);
-                                                               }
-                                                       } else {
-                                                               element = inline.createNewDomElement(addTag);
-                                                                       // Set onload handler for external JS scripts:
-                                                               if (addTag.name=='SCRIPT' && element.src) {
-                                                                       element.onload = inline.sourceLoadedHandler(element);
-                                                                       sourcesWaiting.push(element.src);
-                                                               }
-                                                               head.appendChild(element);
-                                                               processedCount++;
-                                                       }
-                                                       json.headData.shift();
-                                               }
-                                       }
-                               }
-                       });
-               }
-               if (restart || processedCount) {
-                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
-               } else {
-                       if (method) {
-                               inline.unlockAjaxMethod(method);
-                       }
-                       if (json.scriptCall && json.scriptCall.length) {
-                               $A(json.scriptCall).each(function(value) { eval(value); });
-                       }
-                       TYPO3.TCEFORMS.convertDateFieldsToDatePicker();
-               }
-       },
-
-               // Check if dynamically added scripts are loaded and restart inline.processAjaxResponse():
-       reprocessAjaxResponse: function (method, json, sourcesWaiting) {
-               var sourcesLoaded = true;
-               if (sourcesWaiting && sourcesWaiting.length) {
-                       $A(sourcesWaiting).each(function(source) {
-                               if (!inline.sourcesLoaded[source]) {
-                                       sourcesLoaded = false;
-                                       return false;
-                               }
-                       });
-               }
-               if (sourcesLoaded) {
-                       $A(sourcesWaiting).each(function(source) {
-                               delete(inline.sourcesLoaded[source]);
-                       });
-                       window.setTimeout(function() { inline.processAjaxResponse(method, null, json); }, 80);
-               } else {
-                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
-               }
-       },
-
-       sourceLoadedHandler: function(element) {
-               if (element && element.src) {
-                       inline.sourcesLoaded[element.src] = true;
-               }
-       },
-
-       showAjaxFailure: function(method, xhr) {
-               inline.unlockAjaxMethod(method);
-               alert('Error: '+xhr.status+"\n"+xhr.statusText);
-       },
-
-               // foreign_selector: used by selector box (type='select')
-       importNewRecord: function(objectId) {
-               var selector = $(objectId+'_selector');
-               if (selector.selectedIndex != -1) {
-                       var context = this.getContext(objectId);
-                       var selectedValue = selector.options[selector.selectedIndex].value;
-                       if (!this.data.unique || !this.data.unique[objectId]) {
-                               selector.options[selector.selectedIndex].selected = false;
-                       }
-                       this.makeAjaxCall('createNewRecord', [this.getNumberOfRTE(), objectId, selectedValue], true, context);
-               }
-               return false;
-       },
-
-               // foreign_selector: used by element browser (type='group/db')
-       importElement: function(objectId, table, uid, type) {
-               var context = this.getContext(objectId);
-               inline.makeAjaxCall('createNewRecord', [inline.getNumberOfRTE(), objectId, uid], true, context);
-       },
-
-       importElementMultiple: function(objectId, table, uidArray, type) {
-               uidArray.each(function(uid) {
-                       inline.delayedImportElement(objectId, table, uid, type);
-               });
-       },
-       delayedImportElement: function(objectId, table, uid, type) {
-               if (inline.lockedAjaxMethod['createNewRecord'] == true) {
-                       window.setTimeout("inline.delayedImportElement('" + objectId + "','" + table + "'," +  uid + ", null );", 300);
-               } else {
-                       inline.importElement(objectId, table, uid, type);
-               }
-       },
-               // Check uniqueness for element browser:
-       checkUniqueElement: function(objectId, table, uid, type) {
-               if (this.checkUniqueUsed(objectId, uid, table)) {
-                       return {passed: false,message: 'There is already a relation to the selected element!'};
-               } else {
-                       return {passed: true};
-               }
-       },
-
-               // Checks if a record was used and should be unique:
-       checkUniqueUsed: function(objectId, uid, table) {
-               if (this.data.unique && this.data.unique[objectId]) {
-                       var unique = this.data.unique[objectId];
-                       var values = $H(unique.used).values();
-
-                               // for select: only the uid is stored
-                       if (unique['type'] == 'select') {
-                               if (values.indexOf(uid) != -1) {
-                                       return true;
-                               }
-
-                               // for group/db: table and uid is stored in a assoc array
-                       } else if (unique.type == 'groupdb') {
-                               for (var i=values.length-1; i>=0; i--) {
-                                               // if the pair table:uid is already used:
-                                       if (values[i].table==table && values[i].uid==uid) {
-                                               return true;
-                                       }
-                               }
-                       }
-               }
-               return false;
-       },
-
-       setUniqueElement: function(objectId, table, uid, type, elName) {
-               var recordUid = this.parseFormElementName('none', elName, 1, 1);
-               // alert(objectId+'/'+table+'/'+uid+'/'+recordUid);
-               this.setUnique(objectId, recordUid, uid);
-       },
-               // Remove all select items already used
-               // from a newly retrieved/expanded record
-       removeUsed: function(objectId, recordUid) {
-               if (this.data.unique && this.data.unique[objectId]) {
-                       var unique = this.data.unique[objectId];
-                       if (unique.type == 'select') {
-                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
-                               var formObj = document.getElementsByName(formName);
-                               var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
-                               var values = $H(unique.used).values();
-                               if (recordObj.length) {
-                                       var selectedValue = recordObj[0].options[recordObj[0].selectedIndex].value;
-                                       for (var i=0; i<values.length; i++) {
-                                               if (values[i] != selectedValue) {
-                                                       this.removeSelectOption(recordObj[0], values[i]);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       },
-               // this function is applied to a newly inserted record by AJAX
-               // it removes the used select items, that should be unique
-       setUnique: function(objectId, recordUid, selectedValue) {
-               if (this.data.unique && this.data.unique[objectId]) {
-                       var unique = this.data.unique[objectId];
-                       if (unique.type == 'select') {
-                               if (!(unique.selector && unique.max == -1)) {
-                                       var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
-                                       var formObj = document.getElementsByName(formName);
-                                       var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
-                                       var values = $H(unique.used).values();
-                                       var selector = $(objectId+'_selector');
-                                       if (selector.length) {
-                                                       // remove all items from the new select-item which are already used in other children
-                                               if (recordObj.length) {
-                                                       for (var i=0; i<values.length; i++) {
-                                                               this.removeSelectOption(recordObj[0], values[i]);
-                                                       }
-                                                               // set the selected item automatically to the first of the remaining items if no selector is used
-                                                       if (!unique.selector) {
-                                                               selectedValue = recordObj[0].options[0].value;
-                                                               recordObj[0].options[0].selected = true;
-                                                               this.updateUnique(recordObj[0], objectId, formName, recordUid);
-                                                               this.handleChangedField(recordObj[0], objectId+'['+recordUid+']');
-                                                       }
-                                               }
-                                               for (var i=0; i<values.length; i++) {
-                                                       this.removeSelectOption(selector, values[i]);
-                                               }
-                                               if (typeof this.data.unique[objectId].used.length != 'undefined') {
-                                                       this.data.unique[objectId].used = {};
-                                               }
-                                               this.data.unique[objectId].used[recordUid] = selectedValue;
-                                       }
-                                               // remove the newly used item from each select-field of the child records
-                                       if (formObj.length && selectedValue) {
-                                               var records = formObj[0].value.split(',');
-                                               for (var i=0; i<records.length; i++) {
-                                                       recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
-                                                       if (recordObj.length && records[i] != recordUid) {
-                                                               this.removeSelectOption(recordObj[0], selectedValue);
-                                                       }
-                                               }
-                                       }
-                               }
-                       } else if (unique.type == 'groupdb') {
-                                       // add the new record to the used items:
-                               this.data.unique[objectId].used[recordUid] = {'table':unique.elTable, 'uid':selectedValue};
-                       }
-
-                               // remove used items from a selector-box
-                       if (unique.selector == 'select' && selectedValue) {
-                               var selector = $(objectId+'_selector');
-                               this.removeSelectOption(selector, selectedValue);
-                               this.data.unique[objectId]['used'][recordUid] = selectedValue;
-                       }
-               }
-       },
-
-       domAddNewRecord: function(method, insertObject, objectPrefix, htmlData) {
-               if (this.isBelowMax(objectPrefix)) {
-                       if (method == 'bottom') {
-                               new Insertion.Bottom(insertObject, htmlData);
-                       } else if (method == 'after') {
-                               new Insertion.After(insertObject, htmlData);
-                       }
-               }
-       },
-       domAddRecordDetails: function(objectId, objectPrefix, expandSingle, htmlData) {
-               var hiddenValue, formObj, valueObj;
-               var objectDiv = $(objectId + '_fields');
-               if (!objectDiv || objectDiv.innerHTML.substr(0,16) != '<!--notloaded-->') {
-                       return;
-               }
-
-               var elName = this.parseObjectId('full', objectId, 2, 0, true);
-
-               formObj = $$('[name="' + elName + '[hidden]_0"]');
-               valueObj = $$('[name="' + elName + '[hidden]"]');
-
-                       // It might be the case that a child record
-                       // cannot be hidden at all (no hidden field)
-               if (formObj.length && valueObj.length) {
-                       hiddenValue = formObj[0].checked;
-                       formObj[0].remove();
-                       valueObj[0].remove();
-               }
-
-                       // Update DOM
-               objectDiv.update(htmlData);
-
-               formObj = document.getElementsByName(elName + '[hidden]_0');
-               valueObj = document.getElementsByName(elName + '[hidden]');
-
-                       // Set the hidden value again
-               if (formObj.length && valueObj.length) {
-                       valueObj[0].value = hiddenValue ? 1 : 0;
-                       formObj[0].checked = hiddenValue;
-               }
-
-                       // remove loading-indicator
-               if ($(objectId + '_icon')) {
-                       $(objectId + '_iconcontainer').removeClassName('loading-indicator');
-                       $(objectId + '_icon').show();
-               }
-
-                       // now that the content is loaded, set the expandState
-               this.expandCollapseRecord(objectId, expandSingle);
-       },
-
-               // Get script and link elements from head tag:
-       getDomHeadChildren: function(head) {
-               var headTags = [];
-               $$('head script', 'head link').each(function(tag) {
-                       headTags.push(tag);
-               });
-               return headTags;
-       },
-
-       getDomHeadTag: function() {
-               if (document && document.head) {
-                       return document.head;
-               } else {
-                       var head = $$('head');
-                       if (head.length) {
-                               return head[0];
-                       }
-               }
-               return false;
-       },
-
-               // Search whether elements exist in a given haystack:
-       searchInDomTags: function(haystack, needle) {
-               var result = false;
-               $A(haystack).each(function(element) {
-                       if (element.nodeName.toUpperCase()==needle.name) {
-                               var attributesCount = $H(needle.attributes).keys().length;
-                               var attributesFound = 0;
-                               $H(needle.attributes).each(function(attribute) {
-                                       if (element.getAttribute && element.getAttribute(attribute.key)==attribute.value) {
-                                               attributesFound++;
-                                       }
-                               });
-                               if (attributesFound==attributesCount) {
-                                       result = true;
-                                       return true;
-                               }
-                       }
-               });
-               return result;
-       },
-
-               // Create a new DOM element:
-       createNewDomElement: function(addTag) {
-               var element = document.createElement(addTag.name);
-               if (addTag.attributes) {
-                       $H(addTag.attributes).each(function(attribute) {
-                               element[attribute.key] = attribute.value;
-                       });
-               }
-               return element;
-       },
-
-       changeSorting: function(objectId, direction) {
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
-               var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
-               var formObj = document.getElementsByName(objectName);
-
-               if (formObj.length) {
-                               // the uid of the calling object (last part in objectId)
-                       var callingUid = this.parseObjectId('none', objectId, 1);
-                       var records = formObj[0].value.split(',');
-                       var current = records.indexOf(callingUid);
-                       var changed = false;
-
-                               // move up
-                       if (direction > 0 && current > 0) {
-                               records[current] = records[current-1];
-                               records[current-1] = callingUid;
-                               changed = true;
-
-                               // move down
-                       } else if (direction < 0 && current < records.length-1) {
-                               records[current] = records[current+1];
-                               records[current+1] = callingUid;
-                               changed = true;
-                       }
-
-                       if (changed) {
-                               formObj[0].value = records.join(',');
-                               var cAdj = direction > 0 ? 1 : 0; // adjustment
-                               $(objectId+'_div').parentNode.insertBefore(
-                                       $(objectPrefix + this.structureSeparator + records[current-cAdj] + '_div'),
-                                       $(objectPrefix + this.structureSeparator + records[current+1-cAdj] + '_div')
-                               );
-                               this.redrawSortingButtons(objectPrefix, records);
-                       }
-               }
-
-               return false;
-       },
-
-       dragAndDropSorting: function(element) {
-               var objectId = element.getAttribute('id').replace(/_records$/, '');
-               var objectName = inline.prependFormFieldNames+inline.parseObjectId('parts', objectId, 3, 0, true);
-               var formObj = document.getElementsByName(objectName);
-
-               if (formObj.length) {
-                       var checked = new Array();
-                       var order = Sortable.sequence(element);
-                       var records = formObj[0].value.split(',');
-
-                               // check if ordered uid is really part of the records
-                               // virtually deleted items might still be there but ordering shouldn't saved at all on them
-                       for (var i=0; i<order.length; i++) {
-                               if (records.indexOf(order[i]) != -1) {
-                                       checked.push(order[i]);
-                               }
-                       }
-
-                       formObj[0].value = checked.join(',');
-
-                       if (inline.data.config && inline.data.config[objectId]) {
-                               var table = inline.data.config[objectId].table;
-                               inline.redrawSortingButtons(objectId + inline.structureSeparator + table, checked);
-                       }
-               }
-       },
-
-       createDragAndDropSorting: function(objectId) {
-               Position.includeScrollOffsets = true;
-               Sortable.create(
-                       objectId,
-                       {
-                               format: /^[^_\-](?:[A-Za-z0-9\-\_\.]*)-(.*)_div$/,
-                               onUpdate: inline.dragAndDropSorting,
-                               tag: 'div',
-                               handle: 'sortableHandle',
-                               overlap: 'vertical',
-                               constraint: 'vertical'
-                       }
-               );
-       },
-
-       destroyDragAndDropSorting: function(objectId) {
-               Sortable.destroy(objectId);
-       },
-
-       redrawSortingButtons: function(objectPrefix, records) {
-               var i;
-               var headerObj;
-               var sortingObj = new Array();
-
-                       // if no records were passed, fetch them from form field
-               if (typeof records == 'undefined') {
-                       records = new Array();
-                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
-                       var formObj = document.getElementsByName(objectName);
-                       if (formObj.length) {
-                               records = formObj[0].value.split(',');
-                       }
-               }
-
-               for (i=0; i<records.length; i++) {
-                       if (!records[i].length) {
-                               continue;
-                       }
-
-                       headerObj = $(objectPrefix + this.structureSeparator + records[i] + '_header');
-                       sortingObj[0] = Element.select(headerObj, '.sortingUp');
-                       sortingObj[1] = Element.select(headerObj, '.sortingDown');
-
-                       if (sortingObj[0].length) {
-                               sortingObj[0][0].style.visibility = (i == 0 ? 'hidden' : 'visible');
-                       }
-                       if (sortingObj[1].length) {
-                               sortingObj[1][0].style.visibility = (i == records.length-1 ? 'hidden' : 'visible');
-                       }
-               }
-       },
-
-       memorizeAddRecord: function(objectPrefix, newUid, afterUid, selectedValue) {
-               if (this.isBelowMax(objectPrefix)) {
-                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
-                       var formObj = document.getElementsByName(objectName);
-
-                       if (formObj.length) {
-                               var records = new Array();
-                               if (formObj[0].value.length) records = formObj[0].value.split(',');
-
-                               if (afterUid) {
-                                       var newRecords = new Array();
-                                       for (var i=0; i<records.length; i++) {
-                                               if (records[i].length) {
-                                                       newRecords.push(records[i]);
-                                               }
-                                               if (afterUid == records[i]) {
-                                                       newRecords.push(newUid);
-                                               }
-                                       }
-                                       records = newRecords;
-                               } else {
-                                       records.push(newUid);
-                               }
-                               formObj[0].value = records.join(',');
-                       }
-
-                       this.redrawSortingButtons(objectPrefix, records);
-
-                       if (this.data.unique && this.data.unique[objectPrefix]) {
-                               var unique = this.data.unique[objectPrefix];
-                               this.setUnique(objectPrefix, newUid, selectedValue);
-                       }
-               }
-
-                       // if we reached the maximum off possible records after this action, hide the new buttons
-               if (!this.isBelowMax(objectPrefix)) {
-                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
-                       var md5 = this.getObjectMD5(objectParent);
-                       this.hideElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
-               }
-
-               if (TBE_EDITOR) {
-                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
-               }
-       },
-
-       memorizeRemoveRecord: function(objectName, removeUid) {
-               var formObj = document.getElementsByName(objectName);
-               if (formObj.length) {
-                       var parts = new Array();
-                       if (formObj[0].value.length) {
-                               parts = formObj[0].value.split(',');
-                               parts = parts.without(removeUid);
-                               formObj[0].value = parts.join(',');
-                               if (TBE_EDITOR) {
-                                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
-                               }
-                               return parts.length;
-                       }
-               }
-               return false;
-       },
-
-       updateUnique: function(srcElement, objectPrefix, formName, recordUid) {
-               if (this.data.unique && this.data.unique[objectPrefix]) {
-                       var unique = this.data.unique[objectPrefix];
-                       var oldValue = unique.used[recordUid];
-
-                       if (unique.selector == 'select') {
-                               var selector = $(objectPrefix+'_selector');
-                               this.removeSelectOption(selector, srcElement.value);
-                               if (typeof oldValue != 'undefined') {
-                                       this.readdSelectOption(selector, oldValue, unique);
-                               }
-                       }
-
-                       if (!(unique.selector && unique.max == -1)) {
-                               var formObj = document.getElementsByName(formName);
-                               if (unique && formObj.length) {
-                                       var records = formObj[0].value.split(',');
-                                       var recordObj;
-                                       for (var i=0; i<records.length; i++) {
-                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
-                                               if (recordObj.length && recordObj[0] != srcElement) {
-                                                       this.removeSelectOption(recordObj[0], srcElement.value);
-                                                       if (typeof oldValue != 'undefined') {
-                                                               this.readdSelectOption(recordObj[0], oldValue, unique);
-                                                       }
-                                               }
-                                       }
-                                       this.data.unique[objectPrefix].used[recordUid] = srcElement.value;
-                               }
-                       }
-               }
-       },
-
-       revertUnique: function(objectPrefix, elName, recordUid) {
-               if (this.data.unique && this.data.unique[objectPrefix]) {
-                       var unique = this.data.unique[objectPrefix];
-                       var fieldObj = elName ? document.getElementsByName(elName+'['+unique.field+']') : null;
-
-                       if (unique.type == 'select') {
-                               if (fieldObj && fieldObj.length) {
-                                       delete(this.data.unique[objectPrefix].used[recordUid])
-
-                                       if (unique.selector == 'select') {
-                                               if (!isNaN(fieldObj[0].value)) {
-                                                       var selector = $(objectPrefix+'_selector');
-                                                       this.readdSelectOption(selector, fieldObj[0].value, unique);
-                                               }
-                                       }
-
-                                       if (!(unique.selector && unique.max == -1)) {
-                                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
-                                               var formObj = document.getElementsByName(formName);
-                                               if (formObj.length) {
-                                                       var records = formObj[0].value.split(',');
-                                                       var recordObj;
-                                                               // walk through all inline records on that level and get the select field
-                                                       for (var i=0; i<records.length; i++) {
-                                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
-                                                               if (recordObj.length) {
-                                                                       this.readdSelectOption(recordObj[0], fieldObj[0].value, unique);
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       } else if (unique.type == 'groupdb') {
-                               // alert(objectPrefix+'/'+recordUid);
-                               delete(this.data.unique[objectPrefix].used[recordUid])
-                       }
-               }
-       },
-
-       enableDisableRecord: function(objectId) {
-               var elName = this.parseObjectId('full', objectId, 2, 0, true) + '[hidden]';
-               var formObj = document.getElementsByName(elName + '_0');
-               var valueObj = document.getElementsByName(elName);
-               var icon = $(objectId + '_disabled');
-
-               var $container = TYPO3.jQuery('#' + objectId + '_div');
-
-                       // It might be the case that there's no hidden field
-               if (formObj.length && valueObj.length) {
-                       formObj[0].click();
-                       valueObj[0].value = formObj[0].checked ? 1 : 0;
-                       TBE_EDITOR.fieldChanged_fName(elName, elName);
-               }
-
-               if (icon) {
-                       if (icon.hasClassName('t3-icon-edit-hide')) {
-                               icon.removeClassName ('t3-icon-edit-hide');
-                               icon.addClassName('t3-icon-edit-unhide');
-                               $container.addClass('t3-form-field-container-inline-hidden');
-                       } else {
-                               icon.removeClassName ('t3-icon-edit-unhide');
-                               icon.addClassName('t3-icon-edit-hide');
-                               $container.removeClass('t3-form-field-container-inline-hidden');
-                       }
-               }
-
-               return false;
-       },
-
-       deleteRecord: function(objectId, options) {
-               var i, j, inlineRecords, records, childObjectId, childTable;
-               var objectPrefix = this.parseObjectId('full', objectId, 0 , 1);
-               var elName = this.parseObjectId('full', objectId, 2, 0, true);
-               var shortName = this.parseObjectId('parts', objectId, 2, 0, true);
-               var recordUid = this.parseObjectId('none', objectId, 1);
-               var beforeDeleteIsBelowMax = this.isBelowMax(objectPrefix);
-
-                       // revert the unique settings if available
-               this.revertUnique(objectPrefix, elName, recordUid);
-
-                       // Remove from TBE_EDITOR (required fields, required range, etc.):
-               if (TBE_EDITOR && TBE_EDITOR.removeElement) {
-                       var removeStack = [];
-                       // Iterate over all child records:
-                       inlineRecords = Element.select(objectId+'_div', '.inlineRecord');
-                               // Remove nested child records from TBE_EDITOR required/range checks:
-                       for (i=inlineRecords.length-1; i>=0; i--) {
-                               if (inlineRecords[i].value.length) {
-                                       records = inlineRecords[i].value.split(',');
-                                       childObjectId = this.data.map[inlineRecords[i].name];
-                                       childTable = this.data.config[childObjectId].table;
-                                       for (j=records.length-1; j>=0; j--) {
-                                               removeStack.push(this.prependFormFieldNames+'['+childTable+']['+records[j]+']');
-                                       }
-                               }
-                       }
-                       removeStack.push(this.prependFormFieldNames+shortName);
-                       TBE_EDITOR.removeElementArray(removeStack);
-               }
-
-                       // Mark this container as deleted
-               var deletedRecordContainer = $(objectId + '_div');
-               if (deletedRecordContainer) {
-                       deletedRecordContainer.addClassName('inlineIsDeletedRecord');
-               }
-
-                       // If the record is new and was never saved before, just remove it from DOM:
-               if (this.isNewRecord(objectId) || options && options.forceDirectRemoval) {
-                       this.fadeAndRemove(objectId+'_div');
-                       // If the record already exists in storage, mark it to be deleted on clicking the save button:
-               } else {
-                       document.getElementsByName('cmd'+shortName+'[delete]')[0].disabled = false;
-                       new Effect.Fade(objectId+'_div');
-               }
-
-               var recordCount = this.memorizeRemoveRecord(
-                       this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true),
-                       recordUid
-               );
-
-               if (recordCount <= 1) {
-                       this.destroyDragAndDropSorting(this.parseObjectId('full', objectId, 0 , 2)+'_records');
-               }
-               this.redrawSortingButtons(objectPrefix);
-
-                       // if the NEW-button was hidden and now we can add again new children, show the button
-               if (!beforeDeleteIsBelowMax && this.isBelowMax(objectPrefix)) {
-                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
-                       var md5 = this.getObjectMD5(objectParent);
-                       this.showElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
-               }
-               return false;
-       },
-
-       parsePath: function(path) {
-               var backSlash = path.lastIndexOf('\\');
-               var normalSlash = path.lastIndexOf('/');
-
-               if (backSlash > 0) {
-                       path = path.substring(0,backSlash+1);
-               } else if (normalSlash > 0) {
-                       path = path.substring(0,normalSlash+1);
-               } else {
-                       path = '';
-               }
-
-               return path;
-       },
-
-       parseFormElementName: function(wrap, formElementName, rightCount, skipRight) {
-               var idParts = this.splitFormElementName(formElementName);
-
-               if (!wrap) {
-                       wrap = 'full';
-               }
-               if (!skipRight) {
-                       skipRight = 0;
-               }
-
-               var elParts = new Array();
-               for (var i=0; i<skipRight; i++) {
-                       idParts.pop();
-               }
-
-               if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) {
-                               elParts.unshift(idParts.pop());
-                       }
-               } else {
-                       for (var i=0; i<-rightCount; i++) {
-                               idParts.shift();
-                       }
-                       elParts = idParts;
-               }
-
-               var elReturn = this.constructFormElementName(wrap, elParts);
-
-               return elReturn;
-       },
-
-       splitFormElementName: function(formElementName) {
-               // remove left and right side "data[...|...]" -> '...|...'
-               formElementName = formElementName.substr(0, formElementName.lastIndexOf(']')).substr(formElementName.indexOf('[')+1);
-               var parts = objectId.split('][');
-
-               return parts;
-       },
-
-       splitObjectId: function(objectId) {
-               objectId = objectId.substr(objectId.indexOf(this.structureSeparator)+1);
-               objectId = objectId.split(this.flexFormSeparator).join(this.flexFormSubstitute);
-               var parts = objectId.split(this.structureSeparator);
-
-               return parts;
-       },
-
-       constructFormElementName: function(wrap, parts) {
-               var elReturn;
-
-               if (wrap == 'full') {
-                       elReturn = this.prependFormFieldNames+'['+parts.join('][')+']';
-                       elReturn = elReturn.split(this.flexFormSubstitute).join('][');
-               } else if (wrap == 'parts') {
-                       elReturn = '['+parts.join('][')+']';
-                       elReturn = elReturn.split(this.flexFormSubstitute).join('][');
-               } else if (wrap == 'none') {
-                       elReturn = parts.length > 1 ? parts : parts.join('');
-               }
-
-               return elReturn;
-       },
-
-       constructObjectId: function(wrap, parts) {
-               var elReturn;
-
-               if (wrap == 'full') {
-                       elReturn = this.prependFormFieldNames+this.structureSeparator+parts.join(this.structureSeparator);
-                       elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
-               } else if (wrap == 'parts') {
-                       elReturn = this.structureSeparator+parts.join(this.structureSeparator);
-                       elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
-               } else if (wrap == 'none') {
-                       elReturn = parts.length > 1 ? parts : parts.join('');
-               }
-
-               return elReturn;
-       },
-
-       parseObjectId: function(wrap, objectId, rightCount, skipRight, returnAsFormElementName) {
-               var idParts = this.splitObjectId(objectId);
-
-               if (!wrap) {
-                       wrap = 'full';
-               }
-               if (!skipRight) {
-                       skipRight = 0;
-               }
-
-               var elParts = new Array();
-               for (var i=0; i<skipRight; i++) {
-                       idParts.pop();
-               }
-
-               if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) {
-                               elParts.unshift(idParts.pop());
-                       }
-               } else {
-                       for (var i=0; i<-rightCount; i++) {
-                               idParts.shift();
-                       }
-                       elParts = idParts;
-               }
-
-               if (returnAsFormElementName) {
-                       var elReturn = this.constructFormElementName(wrap, elParts);
-               } else {
-                       var elReturn = this.constructObjectId(wrap, elParts);
-               }
-
-               return elReturn;
-       },
-
-       handleChangedField: function(formField, objectId) {
-               var formObj;
-               if (typeof formField == 'object') {
-                       formObj = formField;
-               } else {
-                       formObj = document.getElementsByName(formField);
-                       if (formObj.length) {
-                               formObj = formObj[0];
-                       }
-               }
-
-               if (formObj != undefined) {
-                       var value;
-                       if (formObj.nodeName == 'SELECT') {
-                               value = formObj.options[formObj.selectedIndex].text;
-                       } else {
-                               value = formObj.value;
-                       }
-                       $(objectId+'_label').innerHTML = value.length ? value : this.noTitleString;
-               }
-               return true;
-       },
-
-       arrayAssocCount: function(object) {
-               var count = 0;
-               if (typeof object.length != 'undefined') {
-                       count = object.length;
-               } else {
-                       for (var i in object) {
-                               count++;
-                       }
-               }
-               return count;
-       },
-
-       isBelowMax: function(objectPrefix) {
-               var isBelowMax = true;
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
-               var formObj = document.getElementsByName(objectName);
-
-               if (this.data.config && this.data.config[objectPrefix] && formObj.length) {
-                       var recordCount = formObj[0].value ? formObj[0].value.split(',').length : 0;
-                       if (recordCount >= this.data.config[objectPrefix].max) {
-                               isBelowMax = false;
-                       }
-               }
-               if (isBelowMax && this.data.unique && this.data.unique[objectPrefix]) {
-                       var unique = this.data.unique[objectPrefix];
-                       if (this.arrayAssocCount(unique.used) >= unique.max && unique.max >= 0) {
-                               isBelowMax = false;
-                       }
-               }
-               return isBelowMax;
-       },
-
-       getOptionsHash: function(selectObj) {
-               var optionsHash = {};
-               for (var i=0; i<selectObj.options.length; i++) {
-                       optionsHash[selectObj.options[i].value] = i;
-               }
-               return optionsHash;
-       },
-
-       removeSelectOption: function(selectObj, value) {
-               var optionsHash = this.getOptionsHash(selectObj);
-               if (optionsHash[value] != undefined) {
-                       selectObj.options[optionsHash[value]] = null;
-               }
-       },
-
-       readdSelectOption: function(selectObj, value, unique) {
-               var index = null;
-               var optionsHash = this.getOptionsHash(selectObj);
-               var possibleValues = $H(unique.possible).keys();
-
-               for (var possibleValue in unique.possible) {
-                       if (possibleValue == value) {
-                               break;
-                       }
-                       if (optionsHash[possibleValue] != undefined) {
-                               index = optionsHash[possibleValue];
-                       }
-               }
-
-               if (index == null) {
-                       index = 0;
-               } else if (index < selectObj.options.length) {
-                       index++;
-               }
-                       // recreate the <option> tag
-               var readdOption = document.createElement('option');
-               readdOption.text = unique.possible[value];
-               readdOption.value = value;
-                       // add the <option> at the right position
-               selectObj.add(readdOption, document.all ? index : selectObj.options[index]);
-       },
-
-       hideElementsWithClassName: function(selector, parentElement) {
-               this.setVisibilityOfElementsWithClassName('hide', selector, parentElement);
-       },
-
-       showElementsWithClassName: function(selector, parentElement) {
-               this.setVisibilityOfElementsWithClassName('show', selector, parentElement);
-       },
-
-       setVisibilityOfElementsWithClassName: function(action, selector, parentElement) {
-               var domObjects = Selector.findChildElements($(parentElement), [selector]);
-               if (action == 'hide') {
-                       $A(domObjects).each(function(domObject) { new Effect.Fade(domObject); });
-               } else if (action == 'show') {
-                       $A(domObjects).each(function(domObject) { new Effect.Appear(domObject); });
-               }
-       },
-
-       fadeOutFadeIn: function(objectId) {
-               var optIn = { duration:0.5, transition:Effect.Transitions.linear, from:0.50, to:1.00 };
-               var optOut = { duration:0.5, transition:Effect.Transitions.linear, from:1.00, to:0.50 };
-               optOut.afterFinish = function() {
-                       new Effect.Opacity(objectId, optIn);
-               };
-               new Effect.Opacity(objectId, optOut);
-       },
-
-       isNewRecord: function(objectId) {
-               return $(objectId+'_div') && $(objectId+'_div').hasClassName('inlineIsNewRecord')
-                       ? true
-                       : false;
-       },
-
-               // Find and fix nested of inline and tab levels if a new element was created dynamically (it doesn't know about its nesting):
-       findContinuedNestedLevel: function(nested, objectId) {
-               if (this.data.nested && this.data.nested[objectId]) {
-                               // Remove the first element from the new nested stack, it's just a hint:
-                       nested.shift();
-                       nested = this.data.nested[objectId].concat(nested);
-                       return nested;
-               } else {
-                       return nested;
-               }
-       },
-
-       getNumberOfRTE: function() {
-               var number = 0;
-               if (typeof RTEarea != 'undefined' && RTEarea.length > 0) {
-                       number = RTEarea.length-1;
-               }
-               return number;
-       },
-
-       getObjectMD5: function(objectPrefix) {
-               var md5 = false;
-               if (this.data.config && this.data.config[objectPrefix] && this.data.config[objectPrefix].md5) {
-                       md5 = this.data.config[objectPrefix].md5;
-               }
-               return md5
-       },
-
-       fadeAndRemove: function(element) {
-               if ($(element)) {
-                       new Effect.Fade(element, { afterFinish: function() { Element.remove(element); } });
-               }
-       },
-
-       getContext: function(objectId) {
-               var result = null;
-
-               if (objectId !== '' && typeof this.data.config[objectId] !== 'undefined' && typeof this.data.config[objectId].context !== 'undefined') {
-                       result = this.data.config[objectId].context;
-               }
-
-               return result;
-       },
-
-       /**
-        * Escapes object identifiers to be used in jQuery.
-        *
-        * @param string objectId
-        * @return string
-        */
-       escapeObjectId: function(objectId) {
-               var escapedObjectId;
-               escapedObjectId = objectId.replace(/:/g, '\\:');
-               escapedObjectId = objectId.replace(/\./g, '\\.');
-               return escapedObjectId;
-       }
-}
-
-Object.extend(Array.prototype, {
-       diff: function(current) {
-               var diff = new Array();
-               if (this.length == current.length) {
-                       for (var i=0; i<this.length; i++) {
-                               if (this[i] !== current[i]) diff.push(i);
-                       }
-               }
-               return diff;
-       }
-});
-
-/*]]>*/
-(function($) {
-       $(function() {
-               $(document).delegate('div.t3-form-field-header-inline', 'click', inline.toggleEvent);
-       });
-})(TYPO3.jQuery);
\ No newline at end of file
diff --git a/t3lib/jsfunc.menu.js b/t3lib/jsfunc.menu.js
deleted file mode 100644 (file)
index 71cb6d1..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/***************************************************************
-*
-*  JavaScript menu
-*
-*
-*
-*  Copyright notice
-*
-*  (c) 1998-2011 Kasper Skaarhoj
-*  All rights reserved
-*
-*  This script is part of the TYPO3 t3lib/ library provided by
-*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
-*
-*  Released under GNU/GPL (see license file in tslib/)
-*
-*  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.
-*
-*  This copyright notice MUST APPEAR in all copies of this script
-***************************************************************/
-
-
-function JSmenuItem (owner, id, nextItem, parent, openID, title, url, target) {
-       this.owner = owner;
-       this.id = id;
-       this.nextItem = nextItem;
-       this.child = 0;
-       this.openID = openID;
-       this.parent = parent;
-       this.title = title;
-       this.url = url;
-       this.target = target;
-}
-function JSmenu (levels,formname) {
-       this.name = name,
-       this.levels = levels;
-       this.formname = formname;
-
-       this.openID = 0;
-
-       this.entry = new JSmenuItem (this);
-       this.count = 0;
-       this.defTopTitle = new Array();
-       this.add = JSmenuAddItem;                       // Tilføjer Item
-       this.writeOut = JSmenuWrite;
-       this.act = JSactivate;
-}
-function JSmenuAddItem (parent,prevItem,openID,title,url,target) {
-       this.count++;
-       var entryID = this.count;
-       this.entry[entryID] = new JSmenuItem (this, entryID, 0, parent, openID, title, url, target);
-       if (prevItem) {
-               this.entry[prevItem].nextItem = entryID;
-       } else if(parent) {
-               this.entry[parent].child = entryID;
-       }
-       return entryID;
-}
-function JSmenuWrite(theEntryID,openID,theLevel) {
-       var level=theLevel;
-       if (level<=this.levels) {
-               var entryID = theEntryID;
-               var firstEntryID = theEntryID;
-               var selectorBox = document[this.formname]["selector"+level];
-               var index=0;
-               selectorBox.length=0;
-               selectorBox.length++;
-               selectorBox.options[index].text = this.defTopTitle[theLevel] ? this.defTopTitle[theLevel] : "                   ";
-               selectorBox.options[index].value = 0;
-               index++;
-               var indexSet=0;
-               if (entryID && this.entry[entryID])     {
-                       var ids = "";
-                       while(entryID)  {
-                       ids+="-"+entryID;
-                               selectorBox.length++;
-                               selectorBox.options[index].text = this.entry[entryID].title;
-                               selectorBox.options[index].value = entryID;
-                               if (openID==entryID)    {
-                                       var indexSet = 1;
-                                       selectorBox.selectedIndex = index;
-                                       if (level<this.levels)  {
-                                               this.writeOut(this.entry[entryID].child, this.entry[entryID].openID,level+1);
-                                       }
-                               }
-                               index++;
-                               entryID=this.entry[entryID].nextItem;
-                       }
-                       if (!indexSet) {
-                               selectorBox.selectedIndex=0;
-                               this.writeOut(this.entry[firstEntryID].child, this.entry[firstEntryID].openID,level+1);
-                       }
-               } else if (level<this.levels)   {
-                       this.writeOut(0, 0,level+1);
-               }
-       }
-}
-function JSactivate(level) {
-       var selectorBox = document[this.formname]["selector"+level];
-       var entryID = selectorBox.options[selectorBox.selectedIndex].value;
-       if (this.entry[entryID])        {
-               this.writeOut(this.entry[entryID].child,this.entry[entryID].openID,level+1);
-               if (this.entry[this.entry[entryID].parent])     {
-                       this.entry[this.entry[entryID].parent].openID = entryID;
-               }
-               if (this.entry[entryID].url)    {
-                       var baseURLs = document.getElementsByTagName('base');
-                       if (baseURLs.length && baseURLs[0].href.length > 0) {
-                               if (this.entry[entryID].url.search(/^http[s]?:\/\//))   {
-                                       this.entry[entryID].url = baseURLs[0].href + this.entry[entryID].url;
-                               }
-                       }
-                       if (!this.entry[entryID].target || this.entry[entryID].target=="_self") {
-                               window.location.href = this.entry[entryID].url;
-                       } else if (this.entry[entryID].target=="_top") {
-                               top.location.href = this.entry[entryID].url;
-                       } else {
-                               var test = eval ("parent."+this.entry[entryID].target);
-                               if (!test) {
-                                       test = eval ("top."+this.entry[entryID].target);
-                               }
-                               if (test && test.document) {
-                                       test.location.href = this.entry[entryID].url;
-                               } else {
-                                       window.open(this.entry[entryID].url,this.entry[entryID].target,"status=yes,menubar=yes,resizable=yes,location=yes,directories=yes,scrollbars=yes,toolbar=yes");
-                               }
-                       }
-               }
-       }
-}
diff --git a/t3lib/jsfunc.updateform.js b/t3lib/jsfunc.updateform.js
deleted file mode 100644 (file)
index 4f56270..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/***************************************************************
-*
-*  Universal formupdate-function
-*
-*
-*
-*  Copyright notice
-*
-*  (c) 1998-2011 Kasper Skaarhoj
-*  All rights reserved
-*
-*  This script is part of the TYPO3 t3lib/ library provided by
-*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
-*
-*  Released under GNU/GPL (see license file in tslib/)
-*
-*  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.
-*
-*  This copyright notice MUST APPEAR in all copies of this script
-***************************************************************/
-
-
-function updateForm(formname,fieldname,value) {
-       if (document[formname] && document[formname][fieldname]) {
-               var fObj = document[formname][fieldname];
-               var type=fObj.type;
-               if (!fObj.type) {
-                       type="radio";
-               }
-               switch(type) {
-                       case "text":
-                       case "textarea":
-                       case "hidden":
-                       case "password":
-                               fObj.value = value;
-                       break;
-                       case "checkbox":
-                               fObj.checked = ((value && value!=0) ? "on":"");
-                       break;
-                       case "select-one":
-                               var l=fObj.length;
-                               for (a=0;a<l;a++) {
-                                       if (fObj.options[a].value == value) {
-                                               fObj.selectedIndex = a;
-                                       }
-                               }
-                       break;
-                       case "select-multiple":
-                               var l=fObj.length;
-                               for (a=0;a<l;a++) {
-                                       if (fObj.options[a].value == value) {
-                                               fObj.options[a].selected = 1;
-                                       }
-                               }
-                       break;
-                       case "radio":
-                               var l=fObj.length;
-                               for (a=0; a<l;a++) {
-                                       if (fObj[a].value==value) {
-                                               fObj[a].checked = 1;
-                                       }
-                               }
-                       break;
-                       default:
-               }
-       }
-}
diff --git a/t3lib/jsfunc.validateform.js b/t3lib/jsfunc.validateform.js
deleted file mode 100644 (file)
index 6f46da4..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/***************************************************************
-*
-*  Universal validate-form
-*
-*  Copyright notice
-*
-*  (c) 1998-2011 Kasper Skaarhoj
-*  All rights reserved
-*
-*  This script is part of the TYPO3 t3lib/ library provided by
-*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
-*
-*  Released under GNU/GPL (see license file in tslib/)
-*
-*  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.
-*
-*  This copyright notice MUST APPEAR in all copies of this script
-***************************************************************/
-
-
-function validateForm(theFormname,theFieldlist,goodMess,badMess,emailMess) {
-       var formObject = document[theFormname];
-       if (!formObject) {
-               formObject = document.getElementById(theFormname);
-       }
-       if (formObject && theFieldlist) {
-               var index=1;
-               var theField = split(theFieldlist, ",", index);
-               var msg="";
-               var theEreg = '';
-               var theEregMsg = '';
-               var specialMode = '';
-               var theLabel, a;
-
-               while (theField) {
-                       theEreg = '';
-                       specialMode = '';
-
-                               // Check special modes:
-                       if (theField == '_EREG')        {       // EREG mode: _EREG,[error msg],[JS ereg],[fieldname],[field Label]
-                               specialMode = theField;
-
-                               index++;
-                               theEregMsg = split(theFieldlist, ",", index);
-                               index++;
-                               theEreg = split(theFieldlist, ",", index);
-                       } else if (theField == '_EMAIL') {
-                               specialMode = theField;
-                       }
-
-                               // Get real field name if special mode has been set:
-                       if (specialMode) {
-                               index++;
-                               theField = split(theFieldlist, ",", index);
-                       }
-
-                       index++;
-                       theLabel = split(theFieldlist, ",", index);
-                       theField = theField;
-                       if (formObject[theField]) {
-                               var fObj = formObject[theField];
-                               var type=fObj.type;
-                               if (!fObj.type) {
-                                       type="radio";
-                               }
-                               var value="";
-                               switch(type) {
-                                       case "text":
-                                       case "textarea":
-                                       case "password":
-                                       case "file":
-                                               value = fObj.value;
-                                       break;
-                                       case "select-one":
-                                               if (fObj.selectedIndex>=0) {
-                                                       value = fObj.options[fObj.selectedIndex].value;
-                                               }
-                                       break;
-                                       case "select-multiple":
-                                               var l=fObj.length;
-                                               for (a=0;a<l;a++) {
-                                                       if (fObj.options[a].selected) {
-                                                                value+= fObj.options[a].value;
-                                                       }
-                                               }
-                                       break;
-                                       case "radio":
-                                       case "checkbox":
-                                               var len=fObj.length;
-                                               if (len) {
-                                                       for (a=0;a<len;a++) {
-                                                               if (fObj[a].checked) {
-                                                                       value = fObj[a].value;
-                                                               }
-                                                       }
-                                               } else {
-                                                       if (fObj.checked) {
-                                                               value = fObj.value;
-                                                       }
-                                               }
-                                       break;
-                                       default:
-                                               value = 1;
-                               }
-
-                               switch(specialMode) {
-                                       case "_EMAIL":
-                                               var theRegEx_notValid = new RegExp("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", "gi");
-                                               var theRegEx_isValid = new RegExp("^.+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})$","");
-                                               if (!theRegEx_isValid.test(value))      {       // This part was supposed to be a part of the condition: " || theRegEx_notValid.test(value)" - but I couldn't make it work (Mozilla Firefox, linux) - Anyone knows why?
-                                                       msg+="\n"+theLabel+' ('+(emailMess ? emailMess : 'Email address not valid!')+')';
-                                               }
-                                       break;
-                                       case "_EREG":
-                                               var theRegEx_isValid = new RegExp(theEreg,"");
-                                               if (!theRegEx_isValid.test(value)) {
-                                                       msg+="\n"+theLabel+' ('+theEregMsg+')';
-                                               }
-                                       break;
-                                       default:
-                                               if (!value) {
-                                                       msg+="\n"+theLabel;
-                                               }
-                               }
-                       }
-                       index++;
-                       theField = split(theFieldlist, ",", index);
-               }
-               if (msg) {
-                       var theBadMess = badMess;
-                       if (!theBadMess) {
-                               theBadMess = "You must fill in these fields:";
-                       }
-                       theBadMess+="\n";
-                       alert(theBadMess+msg);
-                       return false;
-               } else {
-                       var theGoodMess = goodMess;
-                       if (theGoodMess) {
-                               alert(theGoodMess);
-                       }
-                       return true;
-               }
-       }
-}
-function split(theStr1, delim, index) {
-       var theStr = ''+theStr1;
-       var lengthOfDelim = delim.length;
-       var sPos = -lengthOfDelim;
-       var a, ePos;
-       if (index<1) {index=1;}
-       for (a=1; a<index; a++) {
-               sPos = theStr.indexOf(delim, sPos+lengthOfDelim);
-               if (sPos==-1)   {return null;}
-       }
-       ePos = theStr.indexOf(delim, sPos+lengthOfDelim);
-       if(ePos == -1)  {ePos = theStr.length;}
-       return (theStr.substring(sPos+lengthOfDelim,ePos));
-}
diff --git a/typo3/js/jsfunc.evalfield.js b/typo3/js/jsfunc.evalfield.js
new file mode 100644 (file)
index 0000000..0666c54
--- /dev/null
@@ -0,0 +1,530 @@
+/***************************************************************
+*
+*  Evaluation of TYPO3 form field content
+*
+*
+*
+*  Copyright notice
+*
+*  (c) 1998-2011 Kasper Skaarhoj
+*  All rights reserved
+*
+*  This script is part of the TYPO3 t3lib/ library provided by
+*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
+*
+*  Released under GNU/GPL (see license file in typo3/sysext/cms/tslib/)
+*
+*  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.
+*
+*  This copyright notice MUST APPEAR in all copies of this script
+***************************************************************/
+
+
+function evalFunc() {
+       this.input = evalFunc_input;
+       this.output = evalFunc_output;
+       this.parseInt = evalFunc_parseInt;
+       this.getNumChars = evalFunc_getNumChars;
+       this.parseDouble = evalFunc_parseDouble;
+       this.noSpace = evalFunc_noSpace;
+       this.getSecs = evalFunc_getSecs;
+       this.getYear = evalFunc_getYear;
+       this.getTimeSecs = evalFunc_getTimeSecs;
+       this.getTime = evalFunc_getTime;
+       this.getDate = evalFunc_getDate;
+       this.getTimestamp = evalFunc_getTimestamp;
+       this.caseSwitch = evalFunc_caseSwitch;
+       this.evalObjValue = evalFunc_evalObjValue;
+       this.outputObjValue = evalFunc_outputObjValue;
+       this.split = evalFunc_splitStr;
+       this.pol = evalFunc_pol;
+       this.convertClientTimestampToUTC = evalFunc_convertClientTimestampToUTC;
+
+       this.ltrim = evalFunc_ltrim;
+       this.btrim = evalFunc_btrim;
+       var today = new Date();
+       this.lastYear = this.getYear(today);
+       this.lastDate = this.getDate(today);
+       this.lastTime = 0;
+       this.refDate = today;
+       this.isInString = '';
+       this.USmode = 0;
+}
+function evalFunc_pol(fortegn, value) {
+       return eval (((fortegn=="-")?'-':'')+value);
+}
+function evalFunc_evalObjValue(FObj,value) {
+       var evallist = FObj.evallist;
+       this.isInString = (FObj.is_in) ? ''+FObj.is_in : '';
+       var index=1;
+       var theEvalType = (FObj.evallist) ? this.split(evallist, ",", index) : false;
+       var newValue=value;
+       while (theEvalType) {
+               if (theEvalType.slice(0, 3) == 'tx_' || theEvalType.slice(0, 3) == 'Tx_') {
+                       if(typeof window[theEvalType] == 'function') {
+                               newValue = window[theEvalType](newValue);       // variable function call, calling functions like tx_myext_myeval(value)
+                       }
+               } else {
+                       newValue = evalFunc.input(theEvalType, newValue);
+               }
+               index++;
+               theEvalType = this.split(evallist, ",", index);
+       }
+       return newValue;
+}
+function evalFunc_outputObjValue(FObj,value) {
+       var evallist = FObj.evallist;
+       var index=1;
+       var theEvalType = this.split(evallist, ",", index);
+       var newValue=value;
+       while (theEvalType) {
+               if (theEvalType != 'required') {
+                       newValue = evalFunc.output(theEvalType, value, FObj);
+               }
+               index++;
+               theEvalType = this.split(evallist, ",", index);
+       }
+       return newValue;
+}
+function evalFunc_caseSwitch(type,inVal) {
+       var theVal = ''+inVal;
+       var newString = '';
+       switch (type) {
+               case "alpha":
+               case "num":
+               case "alphanum":
+               case "alphanum_x":
+                       for (var a=0;a<theVal.length;a++) {
+                               var theChar = theVal.substr(a,1);
+                               var special = (theChar == '_' || theChar == '-');
+                               var alpha = (theChar >= 'a' && theChar <= 'z') || (theChar >= 'A' && theChar <= 'Z');
+                               var num = (theChar>='0' && theChar<='9');
+                               switch(type) {
+                                       case "alphanum":        special=0;              break;
+                                       case "alpha":   num=0; special=0;               break;
+                                       case "num":     alpha=0; special=0;             break;
+                               }
+                               if (alpha || num || theChar==' ' || special) {
+                                       newString+=theChar;
+                               }
+                       }
+               break;
+               case "is_in":
+                       if (this.isInString) {
+                               for (var a=0;a<theVal.length;a++) {
+                                       var theChar = theVal.substr(a,1);
+                                       if (this.isInString.indexOf(theChar)!=-1) {
+                                               newString+=theChar;
+                                       }
+                               }
+                       } else {newString = theVal;}
+               break;
+               case "nospace":
+                       newString = this.noSpace(theVal);
+               break;
+               case "upper":
+                       newString = theVal.toUpperCase();
+               break;
+               case "lower":
+                       newString = theVal.toLowerCase();
+               break;
+               default:
+                       return inVal;
+       }
+       return newString;
+}
+function evalFunc_parseInt(value) {
+       var theVal = ''+value;
+       if (!value) {
+               return 0;
+       }
+       for (var a = 0; a < theVal.length; a++) {
+               if (theVal.substr(a,1)!='0') {
+                       return parseInt(theVal.substr(a,theVal.length)) || 0;
+               }
+       }
+       return 0;
+}
+function evalFunc_getNumChars(value) {
+       var theVal = ''+value;
+       if (!value) {
+               return 0;
+       }
+       var outVal="";
+       for (var a = 0; a < theVal.length; a++) {
+               if (theVal.substr(a,1)==parseInt(theVal.substr(a,1))) {
+                       outVal+=theVal.substr(a,1);
+               }
+       }
+       return outVal;
+}
+function evalFunc_parseDouble(value) {
+       var theVal = "" + value;
+       theVal = theVal.replace(/[^0-9,\.-]/g, "");
+       var negative = theVal.substring(0, 1) === '-';
+       theVal = theVal.replace(/-/g, "");
+       theVal = theVal.replace(/,/g, ".");
+       if (theVal.indexOf(".") == -1) {
+               theVal += ".0";
+       }
+       var parts = theVal.split(".");
+       var dec = parts.pop();
+       theVal = Number(parts.join("") + "." + dec);
+       if (negative) {
+           theVal *= -1;
+       }
+       theVal = theVal.toFixed(2);
+
+       return theVal;
+}
+function evalFunc_noSpace(value) {
+       var theVal = ''+value;
+       var newString="";
+       for (var a=0;a<theVal.length;a++) {
+               var theChar = theVal.substr(a,1);
+               if (theChar!=' ') {
+                       newString+=theChar;
+               }
+       }
+       return newString;
+}
+function evalFunc_ltrim(value) {
+       var theVal = ''+value;
+       if (!value) {
+               return '';
+       }
+       for (var a = 0; a < theVal.length; a++) {
+               if (theVal.substr(a,1)!=' ') {
+                       return theVal.substr(a,theVal.length);
+               }
+       }
+       return '';
+}
+function evalFunc_btrim(value) {
+       var theVal = ''+value;
+       if (!value) {
+               return '';
+       }
+       for (var a = theVal.length; a > 0; a--) {
+               if (theVal.substr(a-1,1)!=' ') {
+                       return theVal.substr(0,a);
+               }
+       }
+       return '';
+}
+function evalFunc_splitSingle(value) {
+       var theVal = ''+value;
+       this.values = new Array();
+       this.pointer = 3;
+       this.values[1]=theVal.substr(0,2);
+       this.values[2]=theVal.substr(2,2);
+       this.values[3]=theVal.substr(4,10);
+}
+function evalFunc_split(value) {
+       this.values = new Array();
+       this.valPol = new Array();
+       this.pointer = 0;
+       var numberMode = 0;
+       var theVal = "";
+       value+=" ";
+       for (var a=0;a<value.length;a++) {
+               var theChar = value.substr(a,1);
+               if (theChar<"0" || theChar>"9") {
+                       if (numberMode) {
+                               this.pointer++;
+                               this.values[this.pointer]=theVal;
+                               theVal = "";
+                               numberMode=0;
+                       }
+                       if (theChar=="+" || theChar=="-") {
+                               this.valPol[this.pointer+1] = theChar;
+                       }
+               } else {
+                       theVal+=theChar;
+                       numberMode=1;
+               }
+       }
+}
+function evalFunc_input(type,inVal) {
+       if (type=="md5") {
+               return MD5(inVal);
+       }
+       if (type=="trim") {
+               return this.ltrim(this.btrim(inVal));
+       }
+       if (type=="int") {
+               return this.parseInt(inVal);
+       }
+       if (type=="double2") {
+               return this.parseDouble(inVal);
+       }
+
+       var today = new Date();
+       var add=0;
+       var value = this.ltrim(inVal);
+       var values = new evalFunc_split(value);
+       var theCmd = value.substr(0,1);
+       value = this.caseSwitch(type,value);
+       if (value=="") {
+               return "";
+               return 0;       // Why would I ever return a zero??? (20/12/01)
+       }
+       switch (type) {
+               case "datetime":
+                       switch (theCmd) {
+                               case "d":
+                               case "t":
+                               case "n":
+                                       this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               case "+":
+                               case "-":
+                                       if (this.lastTime == 0) {
+                                               this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(today), 0);
+                                       }
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               default:
+                                       var index = value.indexOf(' ');
+                                       if (index!=-1) {
+                                               var dateVal = this.input("date",value.substr(index,value.length));
+                                                       // set refDate so that evalFunc_input on time will work with correct DST information
+                                               this.refDate = new Date(dateVal*1000);
+                                               this.lastTime = dateVal + this.input("time",value.substr(0,index));
+                                       } else  {
+                                                       // only date, no time
+                                               this.lastTime = this.input("date", value);
+                                       }
+                       }
+                       this.lastTime+=add*24*60*60;
+                       return this.lastTime;
+               break;
+               case "year":
+                       switch (theCmd) {
+                               case "d":
+                               case "t":
+                               case "n":
+                                       this.lastYear = this.getYear(today);
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               case "+":
+                               case "-":
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               default:
+                                       if (values.valPol[2]) {
+                                               add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
+                                       }
+                                       var year = (values.values[1])?this.parseInt(values.values[1]):this.getYear(today);
+                                       if ((year >= 0 && year < 38) || (year >= 70 && year<100) || (year >= 1902 && year < 2038)) {
+                                               if (year<100) {
+                                                       year = (year<38) ? year+=2000 : year+=1900;
+                                               }
+                                       } else {
+                                               year = this.getYear(today);
+                                       }
+                                       this.lastYear = year;
+                       }
+                       this.lastYear+=add;
+                       return this.lastYear;
+               break;
+               case "date":
+                       switch (theCmd) {
+                               case "d":
+                               case "t":
+                               case "n":
+                                       this.lastDate = this.getTimestamp(today);
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               case "+":
+                               case "-":
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               default:
+                                       var index = 4;
+                                       if (values.valPol[index]) {
+                                               add = this.pol(values.valPol[index],this.parseInt(values.values[index]));
+                                       }
+                                       if (values.values[1] && values.values[1].length>2) {
+                                               if (values.valPol[2]) {
+                                                       add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
+                                               }
+                                               var temp = values.values[1];
+                                               values = new evalFunc_splitSingle(temp);
+                                       }
+
+                                       var year = (values.values[3])?this.parseInt(values.values[3]):this.getYear(today);
+                                       if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year<2038)) {
+                                               if (year<100) {
+                                                       year = (year<38) ? year+=2000 : year+=1900;
+                                               }
+                                       } else {
+                                               year = this.getYear(today);
+                                       }
+                                       var month = (values.values[this.USmode?1:2])?this.parseInt(values.values[this.USmode?1:2]):today.getUTCMonth()+1;
+                                       var day = (values.values[this.USmode?2:1])?this.parseInt(values.values[this.USmode?2:1]):today.getUTCDate();
+
+                                       var theTime = new Date(parseInt(year), parseInt(month)-1, parseInt(day));
+
+                                               // Substract timezone offset from client
+                                       this.lastDate = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 0);
+                       }
+                       this.lastDate+=add*24*60*60;
+                       return this.lastDate;
+               break;
+               case "time":
+               case "timesec":
+                       switch (theCmd) {
+                               case "d":
+                               case "t":
+                               case "n":
+                                       this.lastTime = this.getTimeSecs(today);
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               case "+":
+                               case "-":
+                                       if (this.lastTime == 0) {
+                                               this.lastTime = this.getTimeSecs(today);
+                                       }
+                                       if (values.valPol[1]) {
+                                               add = this.pol(values.valPol[1],this.parseInt(values.values[1]));
+                                       }
+                               break;
+                               default:
+                                       var index = (type=="timesec")?4:3;
+                                       if (values.valPol[index]) {
+                                               add = this.pol(values.valPol[index],this.parseInt(values.values[index]));
+                                       }
+                                       if (values.values[1] && values.values[1].length>2) {
+                                               if (values.valPol[2]) {
+                                                       add = this.pol(values.valPol[2],this.parseInt(values.values[2]));
+                                               }
+                                               var temp = values.values[1];
+                                               values = new evalFunc_splitSingle(temp);
+                                       }
+                                       var sec = (values.values[3])?this.parseInt(values.values[3]):today.getUTCSeconds();
+                                       if (sec > 59)   {sec=59;}
+                                       var min = (values.values[2])?this.parseInt(values.values[2]):today.getUTCMinutes();
+                                       if (min > 59)   {min=59;}
+                                       var hour = (values.values[1])?this.parseInt(values.values[1]):today.getUTCHours();
+                                       if (hour >= 24) {hour=0;}
+
+                                       var theTime = new Date(this.getYear(this.refDate), this.refDate.getUTCMonth(), this.refDate.getUTCDate(), hour, min, ((type=="timesec")?sec:0));
+
+                                               // Substract timezone offset from client
+                                       this.lastTime = this.convertClientTimestampToUTC(this.getTimestamp(theTime), 1);
+                       }
+                       this.lastTime+=add*60;
+                       if (this.lastTime<0) {this.lastTime+=24*60*60;}
+                       return this.lastTime;
+               break;
+               default:
+                       return value;
+       }
+}
+function evalFunc_output(type,value,FObj) {
+       var theString = "";
+       switch (type) {
+               case "date":
+                       if (!parseInt(value))   {return '';}
+                       var theTime = new Date(parseInt(value) * 1000);
+                       if (this.USmode) {
+                               theString = (theTime.getUTCMonth()+1)+'-'+theTime.getUTCDate()+'-'+this.getYear(theTime);
+                       } else {
+                               theString = theTime.getUTCDate()+'-'+(theTime.getUTCMonth()+1)+'-'+this.getYear(theTime);
+                       }
+               break;
+               case "datetime":
+                       if (!parseInt(value))   {return '';}
+                       theString = this.output("time",value)+' '+this.output("date",value);
+               break;
+               case "time":
+               case "timesec":
+                       if (!parseInt(value))   {return '';}
+                       var theTime = new Date(parseInt(value) * 1000);
+                       var h = theTime.getUTCHours();
+                       var m = theTime.getUTCMinutes();
+                       var s = theTime.getUTCSeconds();
+                       theString = h+':'+((m<10)?'0':'')+m + ((type=="timesec")?':'+((s<10)?'0':'')+s:'');
+               break;
+               case "password":
+                       theString = (value)     ? TS.passwordDummy : "";
+               break;
+               case "int":
+                       theString = (FObj.checkbox && value==FObj.checkboxValue)?'':value;
+               break;
+               default:
+                       theString = value;
+       }
+       return theString;
+}
+function evalFunc_getSecs(timeObj) {
+       return timeObj.getUTCSeconds();
+}
+// Seconds since midnight:
+function evalFunc_getTime(timeObj) {
+       return timeObj.getUTCHours() * 60 * 60 + timeObj.getUTCMinutes() * 60 + this.getSecs(timeObj);
+}
+function evalFunc_getYear(timeObj) {
+       return timeObj.getUTCFullYear();
+}
+// Seconds since midnight with client timezone offset:
+function evalFunc_getTimeSecs(timeObj) {
+       return timeObj.getHours()*60*60+timeObj.getMinutes()*60+timeObj.getSeconds();
+}
+function evalFunc_getDate(timeObj) {
+       var theTime = new Date(this.getYear(timeObj), timeObj.getUTCMonth(), timeObj.getUTCDate());
+       return this.getTimestamp(theTime);
+}
+function evalFunc_dummy (evallist,is_in,checkbox,checkboxValue) {
+       this.evallist = evallist;
+       this.is_in = is_in;
+       this.checkboxValue = checkboxValue;
+       this.checkbox = checkbox;
+}
+function evalFunc_splitStr(theStr1, delim, index) {
+       var theStr = ''+theStr1;
+       var lengthOfDelim = delim.length;
+       sPos = -lengthOfDelim;
+       if (index<1) {index=1;}
+       for (a=1; a<index; a++) {
+               sPos = theStr.indexOf(delim, sPos+lengthOfDelim);
+               if (sPos==-1)   {return null;}
+       }
+       ePos = theStr.indexOf(delim, sPos+lengthOfDelim);
+       if(ePos == -1)  {ePos = theStr.length;}
+       return (theStr.substring(sPos+lengthOfDelim,ePos));
+}
+function evalFunc_getTimestamp(timeObj) {
+       return Date.parse(timeObj)/1000;
+}
+
+// Substract timezone offset from client to a timestamp to get UTC-timestamp to be send to server
+function evalFunc_convertClientTimestampToUTC(timestamp, timeonly) {
+       var timeObj = new Date(timestamp*1000);
+       timeObj.setTime((timestamp - timeObj.getTimezoneOffset()*60)*1000);
+       if (timeonly) {
+                       // only seconds since midnight
+               return this.getTime(timeObj);
+       } else  {
+                       // seconds since the "unix-epoch"
+               return this.getTimestamp(timeObj);
+       }
+}
\ No newline at end of file
diff --git a/typo3/js/jsfunc.updateform.js b/typo3/js/jsfunc.updateform.js
new file mode 100644 (file)
index 0000000..4f56270
--- /dev/null
@@ -0,0 +1,69 @@
+/***************************************************************
+*
+*  Universal formupdate-function
+*
+*
+*
+*  Copyright notice
+*
+*  (c) 1998-2011 Kasper Skaarhoj
+*  All rights reserved
+*
+*  This script is part of the TYPO3 t3lib/ library provided by
+*  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
+*
+*  Released under GNU/GPL (see license file in tslib/)
+*
+*  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.
+*
+*  This copyright notice MUST APPEAR in all copies of this script
+***************************************************************/
+
+
+function updateForm(formname,fieldname,value) {
+       if (document[formname] && document[formname][fieldname]) {
+               var fObj = document[formname][fieldname];
+               var type=fObj.type;
+               if (!fObj.type) {
+                       type="radio";
+               }
+               switch(type) {
+                       case "text":
+                       case "textarea":
+                       case "hidden":
+                       case "password":
+                               fObj.value = value;
+                       break;
+                       case "checkbox":
+                               fObj.checked = ((value && value!=0) ? "on":"");
+                       break;
+                       case "select-one":
+                               var l=fObj.length;
+                               for (a=0;a<l;a++) {
+                                       if (fObj.options[a].value == value) {
+                                               fObj.selectedIndex = a;
+                                       }
+                               }
+                       break;
+                       case "select-multiple":
+                               var l=fObj.length;
+                               for (a=0;a<l;a++) {
+                                       if (fObj.options[a].value == value) {
+                                               fObj.options[a].selected = 1;
+                                       }
+                               }
+                       break;
+                       case "radio":
+                               var l=fObj.length;
+                               for (a=0; a<l;a++) {
+                                       if (fObj[a].value==value) {
+                                               fObj[a].checked = 1;
+                                       }
+                               }
+                       break;
+                       default:
+               }
+       }
+}
index f867947..e89c7be 100644 (file)
@@ -106,7 +106,7 @@ class BackendController {
                        'toolbarmanager' => 'sysext/backend/Resources/Public/JavaScript/toolbarmanager.js',
                        'modulemenu' => 'sysext/backend/Resources/Public/JavaScript/modulemenu.js',
                        'iecompatibility' => 'sysext/backend/Resources/Public/JavaScript/iecompatibility.js',
-                       'evalfield' => '../t3lib/jsfunc.evalfield.js',
+                       'evalfield' => 'js/jsfunc.evalfield.js',
                        'flashmessages' => '../t3lib/js/extjs/ux/flashmessages.js',
                        'tabclosemenu' => '../t3lib/js/extjs/ux/ext.ux.tabclosemenu.js',
                        'notifications' => '../t3lib/js/extjs/notifications.js',
@@ -118,7 +118,7 @@ class BackendController {
                        'backendcontentiframe' => 'js/extjs/backendcontentiframe.js',
                        'modulepanel' => 'js/extjs/modulepanel.js',
                        'viewportConfiguration' => 'js/extjs/viewportConfiguration.js',
-                       'util' => '../t3lib/js/extjs/util.js'
+                       'util' => 'sysext/backend/Resources/Public/JavaScript/util.js'
                );
                if ($this->debug) {
                        unset($this->jsFiles['loginrefresh']);
index f64c01d..aabe744 100644 (file)
@@ -423,7 +423,7 @@ class PageLayoutController {
                        $this->doc->backPath = $GLOBALS['BACK_PATH'];
                        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
                        // JavaScript:
-                       $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . GeneralUtility::createVersionNumberedFilename(($GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.updateform.js')) . '">' . '</script>';
+                       $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . GeneralUtility::createVersionNumberedFilename(($GLOBALS['BACK_PATH'] . 'js/jsfunc.updateform.js')) . '">' . '</script>';
                        $this->doc->JScode .= $this->doc->wrapScriptTags('
                                if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
                                if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . ';
index 12b95d9..232631b 100644 (file)
@@ -150,7 +150,7 @@ class TreeElement {
                /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
                $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
                $pageRenderer->loadExtJs();
-               $pageRenderer->addJsFile('../t3lib/js/extjs/tree/tree.js');
+               $pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/tree.js');
                $pageRenderer->addInlineLanguageLabelFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('lang') . 'locallang_csh_corebe.xlf', 'tcatree');
                $pageRenderer->addExtOnReadyCode('
                        TYPO3.Components.Tree.StandardTreeItemData["' . $id . '"] = ' . $treeData . ';
index 59f0c91..8b531ff 100644 (file)
@@ -46,8 +46,7 @@ class ValueSlider {
         * @todo Define visibility
         */
        public function renderWizard(&$params, &$pObj) {
-               $jsPath = '../t3lib/js/extjs/components/slider/';
-               $pObj->loadJavascriptLib($jsPath . 'ValueSlider.js');
+               $pObj->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/ValueSlider.js');
                $field = $params['field'];
                $value = $params['row'][$field];
                // If Slider is used in a flexform
index 63548ea..34304a1 100644 (file)
@@ -5308,7 +5308,7 @@ function ' . $evalData . '(value) {
                                'textareaResize' => !$GLOBALS['BE_USER']->uc['resizeTextareas'] == '0'
                        );
                        $pageRenderer->addInlineSettingArray('', $resizableSettings);
-                       $this->loadJavascriptLib('../t3lib/jsfunc.evalfield.js');
+                       $this->loadJavascriptLib('js/jsfunc.evalfield.js');
                        $this->loadJavascriptLib('jsfunc.tbe_editor.js');
                        $this->loadJavascriptLib('jsfunc.placeholder.js');
                        // Needed for tceform manipulation (date picker)
@@ -5323,18 +5323,18 @@ function ' . $evalData . '(value) {
                        // If IRRE fields were processed, add the JavaScript functions:
                        if ($this->inline->inlineCount) {
                                $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous();
-                               $this->loadJavascriptLib('../t3lib/jsfunc.inline.js');
+                               $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js');
                                $out .= '
                                inline.setPrependFormFieldNames("' . $this->inline->prependNaming . '");
                                inline.setNoTitleString("' . addslashes(BackendUtility::getNoRecordTitle(TRUE)) . '");
                                ';
                                // Always include JS functions for Suggest fields as we don't know what will come
-                               $this->loadJavascriptLib('../t3lib/js/jsfunc.tceforms_suggest.js');
+                               $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
                        } else {
                                // If Suggest fields were processed, add the JS functions
                                if ($this->suggest->suggestCount > 0) {
                                        $pageRenderer->loadScriptaculous();
-                                       $this->loadJavascriptLib('../t3lib/js/jsfunc.tceforms_suggest.js');
+                                       $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js');
                                }
                        }
                        // Toggle icons:
index c211596..b9bff67 100644 (file)
@@ -1581,7 +1581,7 @@ class DocumentTemplate {
         */
        protected function loadCshJavascript() {
                $this->pageRenderer->loadExtJS();
-               $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/contexthelp.js');
+               $this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/contexthelp.js');
                $this->pageRenderer->addExtDirectCode();
        }
 
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ValueSlider.js b/typo3/sysext/backend/Resources/Public/JavaScript/ValueSlider.js
new file mode 100644 (file)
index 0000000..46d466b
--- /dev/null
@@ -0,0 +1,146 @@
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
+ *  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!
+ ***************************************************************/
+
+Ext.ns('TYPO3.Components');
+
+TYPO3.Components.TcaValueSlider = Ext.extend(Ext.slider.SingleSlider, {
+       itemName: null,
+       getField: null,
+       changeCallback: null,
+       valueItems: null,
+       itemElement: null,
+       elementType: null,
+
+       initComponent: function() {
+               var items, step, n;
+               var step = this.increment || 1;
+               if (step < 1) {
+                       this.type = 'float';
+                       this.increment = 1;
+                       this.floatValue = 1 / step;
+                       this.maxValue *= this.floatValue;
+               }
+
+               Ext.apply(this, {
+                       minValue: this.minValue || 0,
+                       maxValue: this.maxValue || 10000,
+                       keyIncrement: step,
+                       increment: step,
+                       type: this.type,
+                       plugins: new Ext.slider.Tip({
+                               getText: function(thumb) {
+                                       return thumb.slider.renderValue(thumb.value);
+                               }
+                       }),
+                       listeners: {
+                               beforerender: function(slider) {
+                                       var items = Ext.query(this.elementType);
+                                       items.each(function(item) {
+                                               var n = item.getAttribute('name');
+                                               if (n == this.itemName) {
+                                                       this.itemElement = item;
+                                               }
+                                       }, this);
+
+                                       if (this.elementType == 'select') {
+                                               this.minValue = 0;
+                                               this.maxValue = this.itemElement.options.length - 1;
+                                               step = 1;
+                                       }
+                               },
+                               changecomplete: function(slider, newValue, thumb) {
+                                       if (slider.itemName) {
+                                               if (slider.elementType == 'input') {
+                                                       slider.itemElement.value = slider.renderValue(thumb.value);
+                                               }
+                                               if (slider.elementType == 'select') {
+                                                       slider.itemElement.options[thumb.value].selected = '1';
+                                               }
+                                       }
+                                       if (slider.getField) {
+                                               eval(slider.getField);
+                                       }
+                                       if (slider.changeCallback) {
+                                               eval(slider.changeCallback);
+                                       }
+                               },
+                               scope: this
+                       }
+               });
+               TYPO3.Components.TcaValueSlider.superclass.initComponent.call(this);
+       },
+
+       /**
+       * Render value for tooltip
+       *
+       * @param {string} value
+       * @return string
+       */
+       renderValue: function(value) {
+               switch (this.type) {
+                       case 'array':
+                               return this.itemElement.options[value].text;
+                       break;
+                       case 'time':
+                               return this.renderValueFromTime(value);
+                       break;
+                       case 'float':
+                               return this.renderValueFromFloat(value);
+                       break;
+                       case 'int':
+                       default:
+                               return value;
+               }
+       },
+
+       /**
+       * Render value for tooltip as float
+       *
+       * @param {string} value
+       * @return string
+       */
+       renderValueFromFloat: function(value) {
+               var v = value / this.floatValue;
+               return v;
+       },
+
+       /**
+       * Render value for tooltip as time
+       *
+       * @param {string} value
+       * @return string
+       */
+       renderValueFromTime: function(value) {
+               var hours = Math.floor(value / 3600);
+               var rest = value - (hours * 3600);
+               var minutes = Math.round(rest / 60);
+               minutes = minutes < 10 ? '0' + minutes : minutes;
+               return hours + ':' + minutes;
+       }
+
+});
+
+Ext.reg('TYPO3.Components.TcaValueSlider', TYPO3.Components.TcaValueSlider);
\ No newline at end of file
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/contexthelp.js
new file mode 100644 (file)
index 0000000..e98d534
--- /dev/null
@@ -0,0 +1,236 @@
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
+ *  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!
+ ***************************************************************/
+
+Ext.ns('TYPO3', 'TYPO3.CSH.ExtDirect');
+
+/**
+ * Class to show tooltips for links that have the css t3-help-link
+ * need the tags data-table and data-field (HTML5)
+ */
+
+
+TYPO3.ContextHelp = function() {
+
+       /**
+        * Cache for CSH
+        * @type {Ext.util.MixedCollection}
+        */
+       var cshHelp = new Ext.util.MixedCollection(true),
+       tip;
+
+       /**
+        * Shows the tooltip, triggered from mouseover event handler
+        *
+        */
+       function showToolTipHelp() {
+               var link = tip.triggerElement;
+               if (!link) {
+                       return false;
+               }
+               var table = link.getAttribute('data-table');
+               var field = link.getAttribute('data-field');
+               var key = table + '.' + field;
+               var response = cshHelp.key(key);
+               tip.target = tip.triggerElement;
+               if (response) {
+                       updateTip(response);
+               } else {
+                               // If a table is defined, use ExtDirect call to get the tooltip's content
+                       if (table) {
+                                       // Clear old tooltip contents
+                               updateTip({
+                                       description: top.TYPO3.LLL.core.csh_tooltip_loading,
+                                       cshLink: '',
+                                       moreInfo: '',
+                                       title: ''
+                               });
+                                       // Load content
+                               TYPO3.CSH.ExtDirect.getTableContextHelp(table, function(response, options) {
+                                       Ext.iterate(response, function(key, value){
+                                               cshHelp.add(value);
+                                               if (key === field) {
+                                                       updateTip(value);
+                                                               // Need to re-position because the height may have increased
+                                                       tip.show();
+                                               }
+                                       });
+                               }, this);
+
+                               // No table was given, use directly title and description
+                       } else {
+                               updateTip({
+                                       description: link.getAttribute('data-description'),
+                                       cshLink: '',
+                                       moreInfo: '',
+                                       title: link.getAttribute('data-title')
+                               });
+                       }
+               }
+       }
+
+       /**
+        * Update tooltip message
+        *
+        * @param {Object} response
+        */
+       function updateTip(response) {
+               tip.body.dom.innerHTML = response.description;
+               tip.cshLink = response.id;
+               tip.moreInfo = response.moreInfo;
+               if (tip.moreInfo) {
+                       tip.addClass('tipIsLinked');
+               }
+               tip.setTitle(response.title);
+               tip.doAutoWidth();
+       }
+
+       return {
+               /**
+                * Constructor
+                */
+               init: function() {
+                       tip = new Ext.ToolTip({
+                               title: 'CSH', // needs a title for init because of the markup
+                               html: '',
+                                       // The tooltip will appear above the label, if viewport allows
+                               anchor: 'bottom',
+                               minWidth: 160,
+                               maxWidth: 240,
+                               target: Ext.getBody(),
+                               delegate: 'span.t3-help-link',
+                               renderTo: Ext.getBody(),
+                               cls: 'typo3-csh-tooltip',
+                               shadow: false,
+                               dismissDelay: 0, // tooltip stays while mouse is over target
+                               autoHide: true,
+                               showDelay: 1000, // show after 1 second
+                               hideDelay: 300, // hide after 0.3 seconds
+                               closable: true,
+                               isMouseOver: false,
+                               listeners: {
+                                       beforeshow: showToolTipHelp,
+                                       render: function(tip) {
+                                               tip.body.on({
+                                                       'click': {
+                                                               fn: function(event) {
+                                                                       event.stopEvent();
+                                                                       if (tip.moreInfo) {
+                                                                               try {
+                                                                                       top.TYPO3.ContextHelpWindow.open(tip.cshLink);
+                                                                               } catch(e) {
+                                                                                       // do nothing
+                                                                               }
+                                                                       }
+                                                                       tip.hide();
+                                                               }
+                                                       }
+                                               });
+                                               tip.el.on({
+                                                       'mouseover': {
+                                                               fn: function() {
+                                                                       if (tip.moreInfo) {
+                                                                               tip.isMouseOver = true;
+                                                                       }
+                                                               }
+                                                       },
+                                                       'mouseout': {
+                                                               fn: function() {
+                                                                       if (tip.moreInfo) {
+                                                                               tip.isMouseOver = false;
+                                                                               tip.hide.defer(tip.hideDelay, tip, []);
+                                                                       }
+                                                               }
+                                                       }
+                                               });
+                                       },
+                                       hide: function(tip) {
+                                               tip.setTitle('');
+                                               tip.body.dom.innerHTML = '';
+                                       },
+                                       beforehide: function(tip) {
+                                               return !tip.isMouseOver;
+                                       },
+                                       scope: this
+                               }
+                       });
+
+                       Ext.getBody().on({
+                               'keydown': {
+                                       fn: function() {
+                                               tip.hide();
+                                       }
+                               },
+                               'click': {
+                                       fn: function() {
+                                               tip.hide();
+                                       }
+                               }
+                       });
+
+                       /**
+                        * Adds a sequence to Ext.TooltTip::showAt so as to increase vertical offset when anchor position is 'botton'
+                        * This positions the tip box closer to the target element when the anchor is on the bottom side of the box
+                        * When anchor position is 'top' or 'bottom', the anchor is pushed slightly to the left in order to align with the help icon, if any
+                        *
+                        */
+                       Ext.ToolTip.prototype.showAt = Ext.ToolTip.prototype.showAt.createSequence(
+                               function() {
+                                       var ap = this.getAnchorPosition().charAt(0);
+                                       if (this.anchorToTarget && !this.trackMouse) {
+                                               switch (ap) {
+                                                       case 'b':
+                                                               var xy = this.getPosition();
+                                                               this.setPagePosition(xy[0]-10, xy[1]+5);
+                                                               break;
+                                                       case 't':
+                                                               var xy = this.getPosition();
+                                                               this.setPagePosition(xy[0]-10, xy[1]);
+                                                               break;
+                                               }
+                                       }
+                               }
+                       );
+
+               },
+
+               /**
+                * Opens the help window, triggered from click event handler
+                *
+                * @param {Event} event
+                * @param {Node} link
+                */
+               openHelpWindow: function(event, link) {
+                       var id = link.getAttribute('data-table') + '.' + link.getAttribute('data-field');
+                       event.stopEvent();
+                       top.TYPO3.ContextHelpWindow.open(id);
+               }
+       }
+}();
+
+/**
+ * Calls the init on Ext.onReady
+ */
+Ext.onReady(TYPO3.ContextHelp.init, TYPO3.ContextHelp);
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js
new file mode 100644 (file)
index 0000000..1583938
--- /dev/null
@@ -0,0 +1,1245 @@
+/*<![CDATA[*/
+
+/***************************************************************
+*  Inline-Relational-Record Editing
+*
+*
+*
+*  Copyright notice
+*
+*  (c) 2006-2011 Oliver Hader <oh@inpublica.de>
+*  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.
+*
+*  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!
+***************************************************************/
+
+var inline = {
+       classVisible: 't3-form-field-container-inline-visible',
+       classCollapsed: 't3-form-field-container-inline-collapsed',
+       structureSeparator: '-',
+       flexFormSeparator: '---',
+       flexFormSubstitute: ':',
+       prependFormFieldNames: 'data',
+       noTitleString: '[No title]',
+       lockedAjaxMethod: {},
+       sourcesLoaded: {},
+       data: {},
+       isLoading: false,
+
+       addToDataArray: function(object) {
+               $H(object).each(function(pair) {
+                       inline.data[pair.key] = $H(inline.data[pair.key]).merge(pair.value).toObject();
+               });
+       },
+       setPrependFormFieldNames: function(value) {
+               this.prependFormFieldNames = value;
+       },
+       setNoTitleString: function(value) {
+               this.noTitleString = value;
+       },
+       toggleEvent: function(event) {
+               var triggerElement = TYPO3.jQuery(event.target);
+               if (triggerElement.parents('.t3-form-field-header-inline-ctrl').length == 1) {
+                       return;
+               }
+
+               var recordHeader = TYPO3.jQuery(this);
+               inline.expandCollapseRecord(
+                       recordHeader.attr('id').replace('_header', ''),
+                       recordHeader.attr('data-expandSingle'),
+                       recordHeader.attr('data-returnURL')
+               );
+       },
+       expandCollapseRecord: function(objectId, expandSingle, returnURL) {
+               var currentUid = this.parseObjectId('none', objectId, 1);
+               var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
+               var escapedObjectId = this.escapeObjectId(objectId);
+
+               var currentObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
+                       // if content is not loaded yet, get it now from server
+               if((TYPO3.jQuery('#' + escapedObjectId + '_fields') && $("irre-loading-indicator" + objectId)) || inline.isLoading) {
+                       return false;
+               } else if ($(objectId + '_fields') && $(objectId + '_fields').innerHTML.substr(0,16) == '<!--notloaded-->') {
+                       inline.isLoading = true;
+                               // add loading-indicator
+                       if (TYPO3.jQuery('#' + escapedObjectId + '_icon')) {
+                               TYPO3.jQuery('#' + escapedObjectId + '_icon').hide();
+                               TYPO3.jQuery('#' + escapedObjectId + '_iconcontainer').addClass('loading-indicator');
+                       }
+                       return this.getRecordDetails(objectId, returnURL);
+               }
+
+               var isCollapsed = currentObject.hasClass(this.classCollapsed);
+               var collapse = new Array();
+               var expand = new Array();
+
+                       // if only a single record should be visibly for that set of records
+                       // and the record clicked itself is no visible, collapse all others
+               if (expandSingle && currentObject.hasClass(this.classCollapsed)) {
+                       collapse = this.collapseAllRecords(objectId, objectPrefix, currentUid);
+               }
+
+               inline.toggleElement(objectId);
+
+               if (this.isNewRecord(objectId)) {
+                       this.updateExpandedCollapsedStateLocally(objectId, isCollapsed);
+               } else if (isCollapsed) {
+                       expand.push(currentUid);
+               } else if (!isCollapsed) {
+                       collapse.push(currentUid);
+               }
+
+               this.setExpandedCollapsedState(objectId, expand.join(','), collapse.join(','));
+
+               return false;
+       },
+
+       toggleElement: function(objectId) {
+               var escapedObjectId = this.escapeObjectId(objectId);
+               var jQueryObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
+
+               if (jQueryObject.hasClass(this.classCollapsed)) {
+                       jQueryObject.removeClass(this.classCollapsed).addClass(this.classVisible);
+                       jQueryObject.find('#' + escapedObjectId + '_header .t3-icon-irre-collapsed').removeClass('t3-icon-irre-collapsed').addClass('t3-icon-irre-expanded');
+               } else {
+                       jQueryObject.removeClass(this.classVisible).addClass(this.classCollapsed);
+                       jQueryObject.find('#' + escapedObjectId + '_header .t3-icon-irre-expanded').addClass('t3-icon-irre-collapsed').removeClass('t3-icon-irre-expanded');
+               }
+       },
+       collapseAllRecords: function(objectId, objectPrefix, callingUid) {
+                       // get the form field, where all records are stored
+               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
+               var formObj = document.getElementsByName(objectName);
+               var collapse = [];
+
+               if (formObj.length) {
+                               // the uid of the calling object (last part in objectId)
+                       var recObjectId = '', escapedRecordObjectId;
+
+                       var records = formObj[0].value.split(',');
+                       for (var i=0; i<records.length; i++) {
+                               recObjectId = objectPrefix + this.structureSeparator + records[i];
+                               escapedRecordObjectId = this.escapeObjectId(recObjectId);
+
+                               var recordEntry = TYPO3.jQuery('#' + escapedRecordObjectId);
+                               if (records[i] != callingUid && recordEntry.hasClass(this.classVisible)) {
+                                       TYPO3.jQuery('#' + escapedRecordObjectId + '_div').removeClass(this.classVisible).addClass(this.classCollapsed);
+                                       if (this.isNewRecord(recObjectId)) {
+                                               this.updateExpandedCollapsedStateLocally(recObjectId, 0);
+                                       } else {
+                                               collapse.push(records[i]);
+                                       }
+                               }
+                       }
+               }
+
+               return collapse;
+       },
+
+       updateExpandedCollapsedStateLocally: function(objectId, value) {
+               var ucName = 'uc[inlineView]'+this.parseObjectId('parts', objectId, 3, 2, true);
+               var ucFormObj = document.getElementsByName(ucName);
+               if (ucFormObj.length) {
+                       ucFormObj[0].value = value;
+               }
+       },
+
+       getRecordDetails: function(objectId, returnURL) {
+               var context = this.getContext(this.parseObjectId('full', objectId, 0, 1));
+               inline.makeAjaxCall('getRecordDetails', [inline.getNumberOfRTE(), objectId, returnURL], true, context);
+               return false;
+       },
+
+       createNewRecord: function(objectId, recordUid) {
+               if (this.isBelowMax(objectId)) {
+                       var context = this.getContext(objectId);
+                       if (recordUid) {
+                               objectId += this.structureSeparator + recordUid;
+                       }
+                       this.makeAjaxCall('createNewRecord', [this.getNumberOfRTE(), objectId], true, context);
+               } else {
+                       alert('There are no more relations possible at this moment!');
+               }
+               return false;
+       },
+
+       synchronizeLocalizeRecords: function(objectId, type) {
+               var context = this.getContext(objectId);
+               var parameters = [this.getNumberOfRTE(), objectId, type];
+               this.makeAjaxCall('synchronizeLocalizeRecords', parameters, true, context);
+       },
+
+       setExpandedCollapsedState: function(objectId, expand, collapse) {
+               var context = this.getContext(objectId);
+               this.makeAjaxCall('setExpandedCollapsedState', [objectId, expand, collapse], false, context);
+       },
+
+       makeAjaxCall: function(method, params, lock, context) {
+               var max, url='', urlParams='', options={};
+               if (method && params && params.length && this.lockAjaxMethod(method, lock)) {
+                       url = TBE_EDITOR.getBackendPath() + 'ajax.php';
+                       urlParams = '&ajaxID=t3lib_TCEforms_inline::'+method;
+                       for (var i=0, max=params.length; i<max; i++) {
+                               urlParams += '&ajax['+i+']='+params[i];
+                       }
+                       if (context) {
+                               urlParams += '&ajax[context]=' + Object.toJSON(context);
+                       }
+                       options = {
+                               method:         'post',
+                               parameters:     urlParams,
+                               onSuccess:      function(xhr) { inline.isLoading = false; inline.processAjaxResponse(method, xhr); },
+                               onFailure:      function(xhr) { inline.isLoading = false; inline.showAjaxFailure(method, xhr); }
+                       };
+
+                       new Ajax.Request(url, options);
+               }
+       },
+
+       lockAjaxMethod: function(method, lock) {
+               if (!lock || !inline.lockedAjaxMethod[method]) {
+                       inline.lockedAjaxMethod[method] = true;
+                       return true;
+               } else {
+                       return false;
+               }
+       },
+
+       unlockAjaxMethod: function(method) {
+               inline.lockedAjaxMethod[method] = false;
+       },
+
+       processAjaxResponse: function(method, xhr, json) {
+               var addTag=null, restart=false, processedCount=0, element=null, errorCatch=[], sourcesWaiting=[];
+               if (!json && xhr) {
+                       json = xhr.responseJSON;
+               }
+                       // If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea):
+               if (json.headData) {
+                       var head = inline.getDomHeadTag();
+                       var headTags = inline.getDomHeadChildren(head);
+                       $A(json.headData).each(function(addTag) {
+                               if (!restart) {
+                                       if (addTag && (addTag.innerHTML || !inline.searchInDomTags(headTags, addTag))) {
+                                               if (addTag.name=='SCRIPT' && addTag.innerHTML && processedCount) {
+                                                       restart = true;
+                                                       return false;
+                                               } else {
+                                                       if (addTag.name=='SCRIPT' && addTag.innerHTML) {
+                                                               try {
+                                                                       eval(addTag.innerHTML);
+                                                               } catch(e) {
+                                                                       errorCatch.push(e);
+                                                               }
+                                                       } else {
+                                                               element = inline.createNewDomElement(addTag);
+                                                                       // Set onload handler for external JS scripts:
+                                                               if (addTag.name=='SCRIPT' && element.src) {
+                                                                       element.onload = inline.sourceLoadedHandler(element);
+                                                                       sourcesWaiting.push(element.src);
+                                                               }
+                                                               head.appendChild(element);
+                                                               processedCount++;
+                                                       }
+                                                       json.headData.shift();
+                                               }
+                                       }
+                               }
+                       });
+               }
+               if (restart || processedCount) {
+                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
+               } else {
+                       if (method) {
+                               inline.unlockAjaxMethod(method);
+                       }
+                       if (json.scriptCall && json.scriptCall.length) {
+                               $A(json.scriptCall).each(function(value) { eval(value); });
+                       }
+                       TYPO3.TCEFORMS.convertDateFieldsToDatePicker();
+               }
+       },
+
+               // Check if dynamically added scripts are loaded and restart inline.processAjaxResponse():
+       reprocessAjaxResponse: function (method, json, sourcesWaiting) {
+               var sourcesLoaded = true;
+               if (sourcesWaiting && sourcesWaiting.length) {
+                       $A(sourcesWaiting).each(function(source) {
+                               if (!inline.sourcesLoaded[source]) {
+                                       sourcesLoaded = false;
+                                       return false;
+                               }
+                       });
+               }
+               if (sourcesLoaded) {
+                       $A(sourcesWaiting).each(function(source) {
+                               delete(inline.sourcesLoaded[source]);
+                       });
+                       window.setTimeout(function() { inline.processAjaxResponse(method, null, json); }, 80);
+               } else {
+                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
+               }
+       },
+
+       sourceLoadedHandler: function(element) {
+               if (element && element.src) {
+                       inline.sourcesLoaded[element.src] = true;
+               }
+       },
+
+       showAjaxFailure: function(method, xhr) {
+               inline.unlockAjaxMethod(method);
+               alert('Error: '+xhr.status+"\n"+xhr.statusText);
+       },
+
+               // foreign_selector: used by selector box (type='select')
+       importNewRecord: function(objectId) {
+               var selector = $(objectId+'_selector');
+               if (selector.selectedIndex != -1) {
+                       var context = this.getContext(objectId);
+                       var selectedValue = selector.options[selector.selectedIndex].value;
+                       if (!this.data.unique || !this.data.unique[objectId]) {
+                               selector.options[selector.selectedIndex].selected = false;
+                       }
+                       this.makeAjaxCall('createNewRecord', [this.getNumberOfRTE(), objectId, selectedValue], true, context);
+               }
+               return false;
+       },
+
+               // foreign_selector: used by element browser (type='group/db')
+       importElement: function(objectId, table, uid, type) {
+               var context = this.getContext(objectId);
+               inline.makeAjaxCall('createNewRecord', [inline.getNumberOfRTE(), objectId, uid], true, context);
+       },
+
+       importElementMultiple: function(objectId, table, uidArray, type) {
+               uidArray.each(function(uid) {
+                       inline.delayedImportElement(objectId, table, uid, type);
+               });
+       },
+       delayedImportElement: function(objectId, table, uid, type) {
+               if (inline.lockedAjaxMethod['createNewRecord'] == true) {
+                       window.setTimeout("inline.delayedImportElement('" + objectId + "','" + table + "'," +  uid + ", null );", 300);
+               } else {
+                       inline.importElement(objectId, table, uid, type);
+               }
+       },
+               // Check uniqueness for element browser:
+       checkUniqueElement: function(objectId, table, uid, type) {
+               if (this.checkUniqueUsed(objectId, uid, table)) {
+                       return {passed: false,message: 'There is already a relation to the selected element!'};
+               } else {
+                       return {passed: true};
+               }
+       },
+
+               // Checks if a record was used and should be unique:
+       checkUniqueUsed: function(objectId, uid, table) {
+               if (this.data.unique && this.data.unique[objectId]) {
+                       var unique = this.data.unique[objectId];
+                       var values = $H(unique.used).values();
+
+                               // for select: only the uid is stored
+                       if (unique['type'] == 'select') {
+                               if (values.indexOf(uid) != -1) {
+                                       return true;
+                               }
+
+                               // for group/db: table and uid is stored in a assoc array
+                       } else if (unique.type == 'groupdb') {
+                               for (var i=values.length-1; i>=0; i--) {
+                                               // if the pair table:uid is already used:
+                                       if (values[i].table==table && values[i].uid==uid) {
+                                               return true;
+                                       }
+                               }
+                       }
+               }
+               return false;
+       },
+
+       setUniqueElement: function(objectId, table, uid, type, elName) {
+               var recordUid = this.parseFormElementName('none', elName, 1, 1);
+               // alert(objectId+'/'+table+'/'+uid+'/'+recordUid);
+               this.setUnique(objectId, recordUid, uid);
+       },
+               // Remove all select items already used
+               // from a newly retrieved/expanded record
+       removeUsed: function(objectId, recordUid) {
+               if (this.data.unique && this.data.unique[objectId]) {
+                       var unique = this.data.unique[objectId];
+                       if (unique.type == 'select') {
+                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
+                               var formObj = document.getElementsByName(formName);
+                               var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
+                               var values = $H(unique.used).values();
+                               if (recordObj.length) {
+                                       var selectedValue = recordObj[0].options[recordObj[0].selectedIndex].value;
+                                       for (var i=0; i<values.length; i++) {
+                                               if (values[i] != selectedValue) {
+                                                       this.removeSelectOption(recordObj[0], values[i]);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       },
+               // this function is applied to a newly inserted record by AJAX
+               // it removes the used select items, that should be unique
+       setUnique: function(objectId, recordUid, selectedValue) {
+               if (this.data.unique && this.data.unique[objectId]) {
+                       var unique = this.data.unique[objectId];
+                       if (unique.type == 'select') {
+                               if (!(unique.selector && unique.max == -1)) {
+                                       var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
+                                       var formObj = document.getElementsByName(formName);
+                                       var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
+                                       var values = $H(unique.used).values();
+                                       var selector = $(objectId+'_selector');
+                                       if (selector.length) {
+                                                       // remove all items from the new select-item which are already used in other children
+                                               if (recordObj.length) {
+                                                       for (var i=0; i<values.length; i++) {
+                                                               this.removeSelectOption(recordObj[0], values[i]);
+                                                       }
+                                                               // set the selected item automatically to the first of the remaining items if no selector is used
+                                                       if (!unique.selector) {
+                                                               selectedValue = recordObj[0].options[0].value;
+                                                               recordObj[0].options[0].selected = true;
+                                                               this.updateUnique(recordObj[0], objectId, formName, recordUid);
+                                                               this.handleChangedField(recordObj[0], objectId+'['+recordUid+']');
+                                                       }
+                                               }
+                                               for (var i=0; i<values.length; i++) {
+                                                       this.removeSelectOption(selector, values[i]);
+                                               }
+                                               if (typeof this.data.unique[objectId].used.length != 'undefined') {
+                                                       this.data.unique[objectId].used = {};
+                                               }
+                                               this.data.unique[objectId].used[recordUid] = selectedValue;
+                                       }
+                                               // remove the newly used item from each select-field of the child records
+                                       if (formObj.length && selectedValue) {
+                                               var records = formObj[0].value.split(',');
+                                               for (var i=0; i<records.length; i++) {
+                                                       recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                                       if (recordObj.length && records[i] != recordUid) {
+                                                               this.removeSelectOption(recordObj[0], selectedValue);
+                                                       }
+                                               }
+                                       }
+                               }
+                       } else if (unique.type == 'groupdb') {
+                                       // add the new record to the used items:
+                               this.data.unique[objectId].used[recordUid] = {'table':unique.elTable, 'uid':selectedValue};
+                       }
+
+                               // remove used items from a selector-box
+                       if (unique.selector == 'select' && selectedValue) {
+                               var selector = $(objectId+'_selector');
+                               this.removeSelectOption(selector, selectedValue);
+                               this.data.unique[objectId]['used'][recordUid] = selectedValue;
+                       }
+               }
+       },
+
+       domAddNewRecord: function(method, insertObject, objectPrefix, htmlData) {
+               if (this.isBelowMax(objectPrefix)) {
+                       if (method == 'bottom') {
+                               new Insertion.Bottom(insertObject, htmlData);
+                       } else if (method == 'after') {
+                               new Insertion.After(insertObject, htmlData);
+                       }
+               }
+       },
+       domAddRecordDetails: function(objectId, objectPrefix, expandSingle, htmlData) {
+               var hiddenValue, formObj, valueObj;
+               var objectDiv = $(objectId + '_fields');
+               if (!objectDiv || objectDiv.innerHTML.substr(0,16) != '<!--notloaded-->') {
+                       return;
+               }
+
+               var elName = this.parseObjectId('full', objectId, 2, 0, true);
+
+               formObj = $$('[name="' + elName + '[hidden]_0"]');
+               valueObj = $$('[name="' + elName + '[hidden]"]');
+
+                       // It might be the case that a child record
+                       // cannot be hidden at all (no hidden field)
+               if (formObj.length && valueObj.length) {
+                       hiddenValue = formObj[0].checked;
+                       formObj[0].remove();
+                       valueObj[0].remove();
+               }
+
+                       // Update DOM
+               objectDiv.update(htmlData);
+
+               formObj = document.getElementsByName(elName + '[hidden]_0');
+               valueObj = document.getElementsByName(elName + '[hidden]');
+
+                       // Set the hidden value again
+               if (formObj.length && valueObj.length) {
+                       valueObj[0].value = hiddenValue ? 1 : 0;
+                       formObj[0].checked = hiddenValue;
+               }
+
+                       // remove loading-indicator
+               if ($(objectId + '_icon')) {
+                       $(objectId + '_iconcontainer').removeClassName('loading-indicator');
+                       $(objectId + '_icon').show();
+               }
+
+                       // now that the content is loaded, set the expandState
+               this.expandCollapseRecord(objectId, expandSingle);
+       },
+
+               // Get script and link elements from head tag:
+       getDomHeadChildren: function(head) {
+               var headTags = [];
+               $$('head script', 'head link').each(function(tag) {
+                       headTags.push(tag);
+               });
+               return headTags;
+       },
+
+       getDomHeadTag: function() {
+               if (document && document.head) {
+                       return document.head;
+               } else {
+                       var head = $$('head');
+                       if (head.length) {
+                               return head[0];
+                       }
+               }
+               return false;
+       },
+
+               // Search whether elements exist in a given haystack:
+       searchInDomTags: function(haystack, needle) {
+               var result = false;
+               $A(haystack).each(function(element) {
+                       if (element.nodeName.toUpperCase()==needle.name) {
+                               var attributesCount = $H(needle.attributes).keys().length;
+                               var attributesFound = 0;
+                               $H(needle.attributes).each(function(attribute) {
+                                       if (element.getAttribute && element.getAttribute(attribute.key)==attribute.value) {
+                                               attributesFound++;
+                                       }
+                               });
+                               if (attributesFound==attributesCount) {
+                                       result = true;
+                                       return true;
+                               }
+                       }
+               });
+               return result;
+       },
+
+               // Create a new DOM element:
+       createNewDomElement: function(addTag) {
+               var element = document.createElement(addTag.name);
+               if (addTag.attributes) {
+                       $H(addTag.attributes).each(function(attribute) {
+                               element[attribute.key] = attribute.value;
+                       });
+               }
+               return element;
+       },
+
+       changeSorting: function(objectId, direction) {
+               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
+               var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
+               var formObj = document.getElementsByName(objectName);
+
+               if (formObj.length) {
+                               // the uid of the calling object (last part in objectId)
+                       var callingUid = this.parseObjectId('none', objectId, 1);
+                       var records = formObj[0].value.split(',');
+                       var current = records.indexOf(callingUid);
+                       var changed = false;
+
+                               // move up
+                       if (direction > 0 && current > 0) {
+                               records[current] = records[current-1];
+                               records[current-1] = callingUid;
+                               changed = true;
+
+                               // move down
+                       } else if (direction < 0 && current < records.length-1) {
+                               records[current] = records[current+1];
+                               records[current+1] = callingUid;
+                               changed = true;
+                       }
+
+                       if (changed) {
+                               formObj[0].value = records.join(',');
+                               var cAdj = direction > 0 ? 1 : 0; // adjustment
+                               $(objectId+'_div').parentNode.insertBefore(
+                                       $(objectPrefix + this.structureSeparator + records[current-cAdj] + '_div'),
+                                       $(objectPrefix + this.structureSeparator + records[current+1-cAdj] + '_div')
+                               );
+                               this.redrawSortingButtons(objectPrefix, records);
+                       }
+               }
+
+               return false;
+       },
+
+       dragAndDropSorting: function(element) {
+               var objectId = element.getAttribute('id').replace(/_records$/, '');
+               var objectName = inline.prependFormFieldNames+inline.parseObjectId('parts', objectId, 3, 0, true);
+               var formObj = document.getElementsByName(objectName);
+
+               if (formObj.length) {
+                       var checked = new Array();
+                       var order = Sortable.sequence(element);
+                       var records = formObj[0].value.split(',');
+
+                               // check if ordered uid is really part of the records
+                               // virtually deleted items might still be there but ordering shouldn't saved at all on them
+                       for (var i=0; i<order.length; i++) {
+                               if (records.indexOf(order[i]) != -1) {
+                                       checked.push(order[i]);
+                               }
+                       }
+
+                       formObj[0].value = checked.join(',');
+
+                       if (inline.data.config && inline.data.config[objectId]) {
+                               var table = inline.data.config[objectId].table;
+                               inline.redrawSortingButtons(objectId + inline.structureSeparator + table, checked);
+                       }
+               }
+       },
+
+       createDragAndDropSorting: function(objectId) {
+               Position.includeScrollOffsets = true;
+               Sortable.create(
+                       objectId,
+                       {
+                               format: /^[^_\-](?:[A-Za-z0-9\-\_\.]*)-(.*)_div$/,
+                               onUpdate: inline.dragAndDropSorting,
+                               tag: 'div',
+                               handle: 'sortableHandle',
+                               overlap: 'vertical',
+                               constraint: 'vertical'
+                       }
+               );
+       },
+
+       destroyDragAndDropSorting: function(objectId) {
+               Sortable.destroy(objectId);
+       },
+
+       redrawSortingButtons: function(objectPrefix, records) {
+               var i;
+               var headerObj;
+               var sortingObj = new Array();
+
+                       // if no records were passed, fetch them from form field
+               if (typeof records == 'undefined') {
+                       records = new Array();
+                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                       var formObj = document.getElementsByName(objectName);
+                       if (formObj.length) {
+                               records = formObj[0].value.split(',');
+                       }
+               }
+
+               for (i=0; i<records.length; i++) {
+                       if (!records[i].length) {
+                               continue;
+                       }
+
+                       headerObj = $(objectPrefix + this.structureSeparator + records[i] + '_header');
+                       sortingObj[0] = Element.select(headerObj, '.sortingUp');
+                       sortingObj[1] = Element.select(headerObj, '.sortingDown');
+
+                       if (sortingObj[0].length) {
+                               sortingObj[0][0].style.visibility = (i == 0 ? 'hidden' : 'visible');
+                       }
+                       if (sortingObj[1].length) {
+                               sortingObj[1][0].style.visibility = (i == records.length-1 ? 'hidden' : 'visible');
+                       }
+               }
+       },
+
+       memorizeAddRecord: function(objectPrefix, newUid, afterUid, selectedValue) {
+               if (this.isBelowMax(objectPrefix)) {
+                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                       var formObj = document.getElementsByName(objectName);
+
+                       if (formObj.length) {
+                               var records = new Array();
+                               if (formObj[0].value.length) records = formObj[0].value.split(',');
+
+                               if (afterUid) {
+                                       var newRecords = new Array();
+                                       for (var i=0; i<records.length; i++) {
+                                               if (records[i].length) {
+                                                       newRecords.push(records[i]);
+                                               }
+                                               if (afterUid == records[i]) {
+                                                       newRecords.push(newUid);
+                                               }
+                                       }
+                                       records = newRecords;
+                               } else {
+                                       records.push(newUid);
+                               }
+                               formObj[0].value = records.join(',');
+                       }
+
+                       this.redrawSortingButtons(objectPrefix, records);
+
+                       if (this.data.unique && this.data.unique[objectPrefix]) {
+                               var unique = this.data.unique[objectPrefix];
+                               this.setUnique(objectPrefix, newUid, selectedValue);
+                       }
+               }
+
+                       // if we reached the maximum off possible records after this action, hide the new buttons
+               if (!this.isBelowMax(objectPrefix)) {
+                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
+                       var md5 = this.getObjectMD5(objectParent);
+                       this.hideElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
+               }
+
+               if (TBE_EDITOR) {
+                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+               }
+       },
+
+       memorizeRemoveRecord: function(objectName, removeUid) {
+               var formObj = document.getElementsByName(objectName);
+               if (formObj.length) {
+                       var parts = new Array();
+                       if (formObj[0].value.length) {
+                               parts = formObj[0].value.split(',');
+                               parts = parts.without(removeUid);
+                               formObj[0].value = parts.join(',');
+                               if (TBE_EDITOR) {
+                                       TBE_EDITOR.fieldChanged_fName(objectName, formObj);
+                               }
+                               return parts.length;
+                       }
+               }
+               return false;
+       },
+
+       updateUnique: function(srcElement, objectPrefix, formName, recordUid) {
+               if (this.data.unique && this.data.unique[objectPrefix]) {
+                       var unique = this.data.unique[objectPrefix];
+                       var oldValue = unique.used[recordUid];
+
+                       if (unique.selector == 'select') {
+                               var selector = $(objectPrefix+'_selector');
+                               this.removeSelectOption(selector, srcElement.value);
+                               if (typeof oldValue != 'undefined') {
+                                       this.readdSelectOption(selector, oldValue, unique);
+                               }
+                       }
+
+                       if (!(unique.selector && unique.max == -1)) {
+                               var formObj = document.getElementsByName(formName);
+                               if (unique && formObj.length) {
+                                       var records = formObj[0].value.split(',');
+                                       var recordObj;
+                                       for (var i=0; i<records.length; i++) {
+                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                               if (recordObj.length && recordObj[0] != srcElement) {
+                                                       this.removeSelectOption(recordObj[0], srcElement.value);
+                                                       if (typeof oldValue != 'undefined') {
+                                                               this.readdSelectOption(recordObj[0], oldValue, unique);
+                                                       }
+                                               }
+                                       }
+                                       this.data.unique[objectPrefix].used[recordUid] = srcElement.value;
+                               }
+                       }
+               }
+       },
+
+       revertUnique: function(objectPrefix, elName, recordUid) {
+               if (this.data.unique && this.data.unique[objectPrefix]) {
+                       var unique = this.data.unique[objectPrefix];
+                       var fieldObj = elName ? document.getElementsByName(elName+'['+unique.field+']') : null;
+
+                       if (unique.type == 'select') {
+                               if (fieldObj && fieldObj.length) {
+                                       delete(this.data.unique[objectPrefix].used[recordUid])
+
+                                       if (unique.selector == 'select') {
+                                               if (!isNaN(fieldObj[0].value)) {
+                                                       var selector = $(objectPrefix+'_selector');
+                                                       this.readdSelectOption(selector, fieldObj[0].value, unique);
+                                               }
+                                       }
+
+                                       if (!(unique.selector && unique.max == -1)) {
+                                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                                               var formObj = document.getElementsByName(formName);
+                                               if (formObj.length) {
+                                                       var records = formObj[0].value.split(',');
+                                                       var recordObj;
+                                                               // walk through all inline records on that level and get the select field
+                                                       for (var i=0; i<records.length; i++) {
+                                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                                               if (recordObj.length) {
+                                                                       this.readdSelectOption(recordObj[0], fieldObj[0].value, unique);
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       } else if (unique.type == 'groupdb') {
+                               // alert(objectPrefix+'/'+recordUid);
+                               delete(this.data.unique[objectPrefix].used[recordUid])
+                       }
+               }
+       },
+
+       enableDisableRecord: function(objectId) {
+               var elName = this.parseObjectId('full', objectId, 2, 0, true) + '[hidden]';
+               var formObj = document.getElementsByName(elName + '_0');
+               var valueObj = document.getElementsByName(elName);
+               var icon = $(objectId + '_disabled');
+
+               var $container = TYPO3.jQuery('#' + objectId + '_div');
+
+                       // It might be the case that there's no hidden field
+               if (formObj.length && valueObj.length) {
+                       formObj[0].click();
+                       valueObj[0].value = formObj[0].checked ? 1 : 0;
+                       TBE_EDITOR.fieldChanged_fName(elName, elName);
+               }
+
+               if (icon) {
+                       if (icon.hasClassName('t3-icon-edit-hide')) {
+                               icon.removeClassName ('t3-icon-edit-hide');
+                               icon.addClassName('t3-icon-edit-unhide');
+                               $container.addClass('t3-form-field-container-inline-hidden');
+                       } else {
+                               icon.removeClassName ('t3-icon-edit-unhide');
+                               icon.addClassName('t3-icon-edit-hide');
+                               $container.removeClass('t3-form-field-container-inline-hidden');
+                       }
+               }
+
+               return false;
+       },
+
+       deleteRecord: function(objectId, options) {
+               var i, j, inlineRecords, records, childObjectId, childTable;
+               var objectPrefix = this.parseObjectId('full', objectId, 0 , 1);
+               var elName = this.parseObjectId('full', objectId, 2, 0, true);
+               var shortName = this.parseObjectId('parts', objectId, 2, 0, true);
+               var recordUid = this.parseObjectId('none', objectId, 1);
+               var beforeDeleteIsBelowMax = this.isBelowMax(objectPrefix);
+
+                       // revert the unique settings if available
+               this.revertUnique(objectPrefix, elName, recordUid);
+
+                       // Remove from TBE_EDITOR (required fields, required range, etc.):
+               if (TBE_EDITOR && TBE_EDITOR.removeElement) {
+                       var removeStack = [];
+                       // Iterate over all child records:
+                       inlineRecords = Element.select(objectId+'_div', '.inlineRecord');
+                               // Remove nested child records from TBE_EDITOR required/range checks:
+                       for (i=inlineRecords.length-1; i>=0; i--) {
+                               if (inlineRecords[i].value.length) {
+                                       records = inlineRecords[i].value.split(',');
+                                       childObjectId = this.data.map[inlineRecords[i].name];
+                                       childTable = this.data.config[childObjectId].table;
+                                       for (j=records.length-1; j>=0; j--) {
+                                               removeStack.push(this.prependFormFieldNames+'['+childTable+']['+records[j]+']');
+                                       }
+                               }
+                       }
+                       removeStack.push(this.prependFormFieldNames+shortName);
+                       TBE_EDITOR.removeElementArray(removeStack);
+               }
+
+                       // Mark this container as deleted
+               var deletedRecordContainer = $(objectId + '_div');
+               if (deletedRecordContainer) {
+                       deletedRecordContainer.addClassName('inlineIsDeletedRecord');
+               }
+
+                       // If the record is new and was never saved before, just remove it from DOM:
+               if (this.isNewRecord(objectId) || options && options.forceDirectRemoval) {
+                       this.fadeAndRemove(objectId+'_div');
+                       // If the record already exists in storage, mark it to be deleted on clicking the save button:
+               } else {
+                       document.getElementsByName('cmd'+shortName+'[delete]')[0].disabled = false;
+                       new Effect.Fade(objectId+'_div');
+               }
+
+               var recordCount = this.memorizeRemoveRecord(
+                       this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true),
+                       recordUid
+               );
+
+               if (recordCount <= 1) {
+                       this.destroyDragAndDropSorting(this.parseObjectId('full', objectId, 0 , 2)+'_records');
+               }
+               this.redrawSortingButtons(objectPrefix);
+
+                       // if the NEW-button was hidden and now we can add again new children, show the button
+               if (!beforeDeleteIsBelowMax && this.isBelowMax(objectPrefix)) {
+                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
+                       var md5 = this.getObjectMD5(objectParent);
+                       this.showElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
+               }
+               return false;
+       },
+
+       parsePath: function(path) {
+               var backSlash = path.lastIndexOf('\\');
+               var normalSlash = path.lastIndexOf('/');
+
+               if (backSlash > 0) {
+                       path = path.substring(0,backSlash+1);
+               } else if (normalSlash > 0) {
+                       path = path.substring(0,normalSlash+1);
+               } else {
+                       path = '';
+               }
+
+               return path;
+       },
+
+       parseFormElementName: function(wrap, formElementName, rightCount, skipRight) {
+               var idParts = this.splitFormElementName(formElementName);
+
+               if (!wrap) {
+                       wrap = 'full';
+               }
+               if (!skipRight) {
+                       skipRight = 0;
+               }
+
+               var elParts = new Array();
+               for (var i=0; i<skipRight; i++) {
+                       idParts.pop();
+               }
+
+               if (rightCount > 0) {
+                       for (var i=0; i<rightCount; i++) {
+                               elParts.unshift(idParts.pop());
+                       }
+               } else {
+                       for (var i=0; i<-rightCount; i++) {
+                               idParts.shift();
+                       }
+                       elParts = idParts;
+               }
+
+               var elReturn = this.constructFormElementName(wrap, elParts);
+
+               return elReturn;
+       },
+
+       splitFormElementName: function(formElementName) {
+               // remove left and right side "data[...|...]" -> '...|...'
+               formElementName = formElementName.substr(0, formElementName.lastIndexOf(']')).substr(formElementName.indexOf('[')+1);
+               var parts = objectId.split('][');
+
+               return parts;
+       },
+
+       splitObjectId: function(objectId) {
+               objectId = objectId.substr(objectId.indexOf(this.structureSeparator)+1);
+               objectId = objectId.split(this.flexFormSeparator).join(this.flexFormSubstitute);
+               var parts = objectId.split(this.structureSeparator);
+
+               return parts;
+       },
+
+       constructFormElementName: function(wrap, parts) {
+               var elReturn;
+
+               if (wrap == 'full') {
+                       elReturn = this.prependFormFieldNames+'['+parts.join('][')+']';
+                       elReturn = elReturn.split(this.flexFormSubstitute).join('][');
+               } else if (wrap == 'parts') {
+                       elReturn = '['+parts.join('][')+']';
+                       elReturn = elReturn.split(this.flexFormSubstitute).join('][');
+               } else if (wrap == 'none') {
+                       elReturn = parts.length > 1 ? parts : parts.join('');
+               }
+
+               return elReturn;
+       },
+
+       constructObjectId: function(wrap, parts) {
+               var elReturn;
+
+               if (wrap == 'full') {
+                       elReturn = this.prependFormFieldNames+this.structureSeparator+parts.join(this.structureSeparator);
+                       elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
+               } else if (wrap == 'parts') {
+                       elReturn = this.structureSeparator+parts.join(this.structureSeparator);
+                       elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
+               } else if (wrap == 'none') {
+                       elReturn = parts.length > 1 ? parts : parts.join('');
+               }
+
+               return elReturn;
+       },
+
+       parseObjectId: function(wrap, objectId, rightCount, skipRight, returnAsFormElementName) {
+               var idParts = this.splitObjectId(objectId);
+
+               if (!wrap) {
+                       wrap = 'full';
+               }
+               if (!skipRight) {
+                       skipRight = 0;
+               }
+
+               var elParts = new Array();
+               for (var i=0; i<skipRight; i++) {
+                       idParts.pop();
+               }
+
+               if (rightCount > 0) {
+                       for (var i=0; i<rightCount; i++) {
+                               elParts.unshift(idParts.pop());
+                       }
+               } else {
+                       for (var i=0; i<-rightCount; i++) {
+                               idParts.shift();
+                       }
+                       elParts = idParts;
+               }
+
+               if (returnAsFormElementName) {
+                       var elReturn = this.constructFormElementName(wrap, elParts);
+               } else {
+                       var elReturn = this.constructObjectId(wrap, elParts);
+               }
+
+               return elReturn;
+       },
+
+       handleChangedField: function(formField, objectId) {
+               var formObj;
+               if (typeof formField == 'object') {
+                       formObj = formField;
+               } else {
+                       formObj = document.getElementsByName(formField);
+                       if (formObj.length) {
+                               formObj = formObj[0];
+                       }
+               }
+
+               if (formObj != undefined) {
+                       var value;
+                       if (formObj.nodeName == 'SELECT') {
+                               value = formObj.options[formObj.selectedIndex].text;
+                       } else {
+                               value = formObj.value;
+                       }
+                       $(objectId+'_label').innerHTML = value.length ? value : this.noTitleString;
+               }
+               return true;
+       },
+
+       arrayAssocCount: function(object) {
+               var count = 0;
+               if (typeof object.length != 'undefined') {
+                       count = object.length;
+               } else {
+                       for (var i in object) {
+                               count++;
+                       }
+               }
+               return count;
+       },
+
+       isBelowMax: function(objectPrefix) {
+               var isBelowMax = true;
+               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+               var formObj = document.getElementsByName(objectName);
+
+               if (this.data.config && this.data.config[objectPrefix] && formObj.length) {
+                       var recordCount = formObj[0].value ? formObj[0].value.split(',').length : 0;
+                       if (recordCount >= this.data.config[objectPrefix].max) {
+                               isBelowMax = false;
+                       }
+               }
+               if (isBelowMax && this.data.unique && this.data.unique[objectPrefix]) {
+                       var unique = this.data.unique[objectPrefix];
+                       if (this.arrayAssocCount(unique.used) >= unique.max && unique.max >= 0) {
+                               isBelowMax = false;
+                       }
+               }
+               return isBelowMax;
+       },
+
+       getOptionsHash: function(selectObj) {
+               var optionsHash = {};
+               for (var i=0; i<selectObj.options.length; i++) {
+                       optionsHash[selectObj.options[i].value] = i;
+               }
+               return optionsHash;
+       },
+
+       removeSelectOption: function(selectObj, value) {
+               var optionsHash = this.getOptionsHash(selectObj);
+               if (optionsHash[value] != undefined) {
+                       selectObj.options[optionsHash[value]] = null;
+               }
+       },
+
+       readdSelectOption: function(selectObj, value, unique) {
+               var index = null;
+               var optionsHash = this.getOptionsHash(selectObj);
+               var possibleValues = $H(unique.possible).keys();
+
+               for (var possibleValue in unique.possible) {
+                       if (possibleValue == value) {
+                               break;
+                       }
+                       if (optionsHash[possibleValue] != undefined) {
+                               index = optionsHash[possibleValue];
+                       }
+               }
+
+               if (index == null) {
+                       index = 0;
+               } else if (index < selectObj.options.length) {
+                       index++;
+               }
+                       // recreate the <option> tag
+               var readdOption = document.createElement('option');
+               readdOption.text = unique.possible[value];
+               readdOption.value = value;
+                       // add the <option> at the right position
+               selectObj.add(readdOption, document.all ? index : selectObj.options[index]);
+       },
+
+       hideElementsWithClassName: function(selector, parentElement) {
+               this.setVisibilityOfElementsWithClassName('hide', selector, parentElement);
+       },
+
+       showElementsWithClassName: function(selector, parentElement) {
+               this.setVisibilityOfElementsWithClassName('show', selector, parentElement);
+       },
+
+       setVisibilityOfElementsWithClassName: function(action, selector, parentElement) {
+               var domObjects = Selector.findChildElements($(parentElement), [selector]);
+               if (action == 'hide') {
+                       $A(domObjects).each(function(domObject) { new Effect.Fade(domObject); });
+               } else if (action == 'show') {
+                       $A(domObjects).each(function(domObject) { new Effect.Appear(domObject); });
+               }
+       },
+
+       fadeOutFadeIn: function(objectId) {
+               var optIn = { duration:0.5, transition:Effect.Transitions.linear, from:0.50, to:1.00 };
+               var optOut = { duration:0.5, transition:Effect.Transitions.linear, from:1.00, to:0.50 };
+               optOut.afterFinish = function() {
+                       new Effect.Opacity(objectId, optIn);
+               };
+               new Effect.Opacity(objectId, optOut);
+       },
+
+       isNewRecord: function(objectId) {
+               return $(objectId+'_div') && $(objectId+'_div').hasClassName('inlineIsNewRecord')
+                       ? true
+                       : false;
+       },
+
+               // Find and fix nested of inline and tab levels if a new element was created dynamically (it doesn't know about its nesting):
+       findContinuedNestedLevel: function(nested, objectId) {
+               if (this.data.nested && this.data.nested[objectId]) {
+                               // Remove the first element from the new nested stack, it's just a hint:
+                       nested.shift();
+                       nested = this.data.nested[objectId].concat(nested);
+                       return nested;
+               } else {
+                       return nested;
+               }
+       },
+
+       getNumberOfRTE: function() {
+               var number = 0;
+               if (typeof RTEarea != 'undefined' && RTEarea.length > 0) {
+                       number = RTEarea.length-1;
+               }
+               return number;
+       },
+
+       getObjectMD5: function(objectPrefix) {
+               var md5 = false;
+               if (this.data.config && this.data.config[objectPrefix] && this.data.config[objectPrefix].md5) {
+                       md5 = this.data.config[objectPrefix].md5;
+               }
+               return md5
+       },
+
+       fadeAndRemove: function(element) {
+               if ($(element)) {
+                       new Effect.Fade(element, { afterFinish: function() { Element.remove(element); } });
+               }
+       },
+
+       getContext: function(objectId) {
+               var result = null;
+
+               if (objectId !== '' && typeof this.data.config[objectId] !== 'undefined' && typeof this.data.config[objectId].context !== 'undefined') {
+                       result = this.data.config[objectId].context;
+               }
+
+               return result;
+       },
+
+       /**
+        * Escapes object identifiers to be used in jQuery.
+        *
+        * @param string objectId
+        * @return string
+        */
+       escapeObjectId: function(objectId) {
+               var escapedObjectId;
+               escapedObjectId = objectId.replace(/:/g, '\\:');
+               escapedObjectId = objectId.replace(/\./g, '\\.');
+               return escapedObjectId;
+       }
+}
+
+Object.extend(Array.prototype, {
+       diff: function(current) {
+               var diff = new Array();
+               if (this.length == current.length) {
+                       for (var i=0; i<this.length; i++) {
+                               if (this[i] !== current[i]) diff.push(i);
+                       }
+               }
+               return diff;
+       }
+});
+
+/*]]>*/
+(function($) {
+       $(function() {
+               $(document).delegate('div.t3-form-field-header-inline', 'click', inline.toggleEvent);
+       });
+})(TYPO3.jQuery);
\ No newline at end of file
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tceforms_suggest.js
new file mode 100644 (file)
index 0000000..0f59806
--- /dev/null
@@ -0,0 +1,121 @@
+/***************************************************************
+*  AJAX selectors for TCEforms
+*
+*  Copyright notice
+*
+*  (c) 2007-2011 Andreas Wolf <andreas.wolf@ikt-werk.de>
+*  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.
+*
+*  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!
+***************************************************************/
+
+/**
+ * Class for JS handling of suggest fields in TCEforms.
+ *
+ * @author  Andreas Wolf <andreas.wolf@ikt-werk.de>
+ * @author  Benni Mack <benni@typo3.org>
+ */
+if (!TCEForms) {
+       var TCEForms = {};
+}
+
+TCEForms.Suggest = Class.create({
+       objectId: '',
+       suggestField: '',
+       suggestResultList: '',
+       minimumCharacters: 2,
+       defaultValue: '',
+
+       /**
+        * Wrapper for script.aculo.us' Autocompleter functionality: Assigns a new autocompletion object to
+        * the input field of a given Suggest selector.
+        *
+        * @param  string  objectId  The ID of the object to assign the completer to
+        * @param  string  table     The table of the record which is currently edited
+        * @param  string  field     The field which is currently edited
+        * @param  integer uid       The uid of the record which is currently edited
+        * @param  integer pid       The pid of the record which is currently edited
+        * @param  integer minimumCharacters the minimum characaters that is need to trigger the initial search
+        */
+       initialize: function(objectId, table, field, uid, pid, minimumCharacters) {
+               var PATH_typo3 = top.TS.PATH_typo3 || window.opener.top.TS.PATH_typo3;
+               this.objectId = objectId;
+               this.suggestField = objectId + 'Suggest';
+               this.suggestResultList = objectId + 'SuggestChoices';
+
+               new Ajax.Autocompleter(this.suggestField, this.suggestResultList, PATH_typo3 + 'ajax.php', {
+                               paramName: 'value',
+                               minChars: (minimumCharacters ? minimumCharacters : this.minimumCharacters),
+                               updateElement: this.addElementToList.bind(this),
+                               parameters: 'ajaxID=t3lib_TCEforms_suggest::searchRecord&table=' + table + '&field=' + field + '&uid=' + uid + '&pid=' + pid,
+                               indicator: objectId + 'SuggestIndicator'
+                       }
+               );
+
+               $(this.suggestField).observe('focus', this.checkDefaultValue.bind(this));
+               $(this.suggestField).observe('keydown', this.checkDefaultValue.bind(this));
+       },
+
+       /**
+        * check for default value of the input field and set it to empty once somebody wants to type something in
+        */
+       checkDefaultValue: function() {
+               if ($(this.suggestField).value == this.defaultValue) {
+                       $(this.suggestField).value = '';
+               }
+       },
+
+       /**
+        * Adds an element to the list of items in a group selector.
+        *
+        * @param  object  item  The item to add to the list (usually an li element)
+        * @return void
+        */
+       addElementToList: function(item) {
+               if (item.className.indexOf('noresults') == -1) {
+                       var arr = item.id.split('-');
+                       var ins_table = arr[0];
+                       var ins_uid = arr[1];
+                       var rec_table = arr[2];
+                       var rec_uid = arr[3];
+                       var rec_field = arr[4];
+
+                       var formEl = 'data[' + rec_table + '][' + rec_uid + '][' + rec_field + ']';
+                       var suggestLabelNode = Element.select(this.escapeObjectId(item.id), '.suggest-label')[0];
+                       var label = (suggestLabelNode.textContent ? suggestLabelNode.textContent : suggestLabelNode.innerText)
+                       setFormValueFromBrowseWin(formEl, ins_table + '_' + ins_uid, label);
+                       TBE_EDITOR.fieldChanged(rec_table, rec_uid, rec_field, formEl);
+
+                       $(this.suggestField).value = this.defaultValue;
+               }
+       },
+
+       /**
+        * Escapes object identifiers of e.g. Flexform CSS IDs
+        *
+        * @param string objectId
+        * @return string
+        */
+       escapeObjectId: function(objectId) {
+               var escapedObjectId;
+               escapedObjectId = objectId.replace(/:/g, '\\:');
+               escapedObjectId = objectId.replace(/\./g, '\\.');
+               escapedObjectId = objectId.replace(/\[/g, '\\[');
+