Skip to content

Commit

Permalink
[!!!][TASK] Remove TBE_EDITOR.typo3form
Browse files Browse the repository at this point in the history
This patch removes the TBE_EDITOR.typo3form object, which is unused for
a long time now. This "API" was used to either get or set values of
form fields in a very old iteration of the FormEngine.

Resolves: #88411
Releases: master
Change-Id: If7d6e1d13c89944383d06c42d63f2f3a3b40d999
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60791
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
andreaskienast committed May 24, 2019
1 parent 3c275ff commit c870cbe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,60 +272,3 @@ var TBE_EDITOR_split = TBE_EDITOR.split;
var TBE_EDITOR_curSelected = TBE_EDITOR.curSelected;
var TBE_EDITOR_rawurlencode = TBE_EDITOR.rawurlencode;
var TBE_EDITOR_str_replace = TBE_EDITOR.str_replace;


var typo3form = {
fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {
if (document[TBE_EDITOR.formname][theField]) {
var theFObj = new evalFunc_dummy(evallist, is_in, checkbox, checkboxValue);
var theValue = document[TBE_EDITOR.formname][theField].value;
if (checkbox && theValue == checkboxValue) {
document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value = "";
if (document[TBE_EDITOR.formname][theField + "_cb"]) document[TBE_EDITOR.formname][theField + "_cb"].checked = "";
} else {
document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value = evalFunc.outputObjValue(theFObj, theValue);
if (document[TBE_EDITOR.formname][theField + "_cb"]) document[TBE_EDITOR.formname][theField + "_cb"].checked = "on";
}
}
},
fieldGet: function(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off, checkSetValue) {
if (document[TBE_EDITOR.formname][theField]) {
var theFObj = new evalFunc_dummy(evallist, is_in, checkbox, checkboxValue);
if (checkbox_off) {
if (document[TBE_EDITOR.formname][theField + "_cb"].checked) {
var split = evallist.split(',');
for (var i = 0; split.length > i; i++) {
var el = split[i].replace(/ /g, '');
if (el == 'datetime' || el == 'date') {
var now = new Date();
checkSetValue = Date.parse(now) / 1000 - now.getTimezoneOffset() * 60;
break;
} else if (el == 'time' || el == 'timesec') {
checkSetValue = evalFunc_getTimeSecs(new Date());
break;
}
}
document[TBE_EDITOR.formname][theField].value = checkSetValue;
} else {
document[TBE_EDITOR.formname][theField].value = checkboxValue;
}
} else {
document[TBE_EDITOR.formname][theField].value = evalFunc.evalObjValue(theFObj, document.querySelector('form[name="' + TBE_EDITOR.formname + '"] [data-formengine-input-name="' + theField + '"]').value);
}
typo3form.fieldSet(theField, evallist, is_in, checkbox, checkboxValue);
}
}
};

// @TODO: This function is a copy from jsfunc.evalfield.js
// @TODO: Remove it later, after TBE_EDITOR is not used anymore.
function evalFunc_dummy(evallist, is_in, checkbox, checkboxValue) {
this.evallist = evallist;
this.is_in = is_in;
this.checkboxValue = checkboxValue;
this.checkbox = checkbox;
}

// backwards compatibility for extensions
var typo3FormFieldSet = typo3form.fieldSet;
var typo3FormFieldGet = typo3form.fieldGet;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.. include:: ../../Includes.txt

===============================================
Breaking: #88411 - TBE_EDITOR.typo3form removed
===============================================

See :issue:`88411`

Description
===========

The global object :js:`TBE_EDITOR.typo3form` and its backward layers :js:`typo3FormFieldSet` and :js:`typo3FormFieldGet`
have been removed.


Impact
======

Any extension relying on this code will stop working.


Affected Installations
======================

All installations using the removed code are affected.


Migration
=========

No direct migration possible. Refer to the FormEngine JavaScript API.

.. index:: Backend, JavaScript, NotScanned, ext:backend

0 comments on commit c870cbe

Please sign in to comment.