[TASK] Move JavaScript files to EXT: backend 21/21721/2
authorFelix Kopp <felix-source@phorax.com>
Sat, 29 Jun 2013 10:20:24 +0000 (12:20 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 1 Jul 2013 16:07:07 +0000 (18:07 +0200)
This patch moves few JavaScript files to EXT: backend.

Still few JavaScript files remain in /typo3 and /js folder.
Those JavaScript files are used within the backend and
therefore should be moved to EXT: backend.

Change-Id: I62b9861d66f219f34e53afa5dd7a1d9c20073a98
Resolves: #49507
Releases: 6.2
Reviewed-on: https://review.typo3.org/21721
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
18 files changed:
typo3/js/jsfunc.evalfield.js [deleted file]
typo3/jsfunc.placeholder.js [deleted file]
typo3/jsfunc.tbe_editor.js [deleted file]
typo3/md5.js [deleted file]
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.placeholder.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/md5.js [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/tab.js [new file with mode: 0644]
typo3/sysext/core/Classes/Database/QueryGenerator.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/sv/Classes/LoginFormHook.php
typo3/sysext/t3skin/Resources/Private/Templates/login.html
typo3/tab.js [deleted file]

diff --git a/typo3/js/jsfunc.evalfield.js b/typo3/js/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/typo3/jsfunc.placeholder.js b/typo3/jsfunc.placeholder.js
deleted file mode 100644 (file)
index 12e8219..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2011 Tobias Liebig <tobias.liebig@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.onReady(function() {
-       // Only use placeholder JavaScript fallback in Internet Explorer
-       if (!Ext.isIE) {
-               return;
-       }
-
-       // TODO rewrite in ExtJS
-       $$('[placeholder]').each(function(el) {
-               if (el.getAttribute('placeholder') != "") {
-                       el.observe('TYPO3:focus', function() {
-                               var input = Ext.get(this);
-                               if (this.getValue() == this.getAttribute('placeholder')) {
-                                       this.setValue('');
-                                       input.removeClass('placeholder');
-                               }
-                       });
-                       el.observe('focus', function() { el.fire('TYPO3:focus'); });
-                       el.observe('TYPO3:blur', function() {
-                               var input = Ext.get(this);
-                               if (input.getValue() == '' || this.getValue() == this.getAttribute('placeholder')) {
-                                       this.setValue(this.getAttribute('placeholder'));
-                                       input.addClass('placeholder');
-                               }
-                       });
-                       el.observe('blur', function() { el.fire('TYPO3:blur'); });
-                       el.fire('TYPO3:blur');
-               }
-       });
-});
\ No newline at end of file
diff --git a/typo3/jsfunc.tbe_editor.js b/typo3/jsfunc.tbe_editor.js
deleted file mode 100644 (file)
index 953d0e5..0000000
+++ /dev/null
@@ -1,654 +0,0 @@
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.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!
-***************************************************************/
-/**
- * Contains JavaScript for TYPO3 Core Form generator - AKA "TCEforms"
- *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @coauthor   Oliver Hader <oh@inpublica.de>
- */
-
-
-var TBE_EDITOR = {
-       /* Example:
-               elements: {
-                       'data-parentPid-table-uid': {
-                               'field': {
-                                       'range':                [0, 100],
-                                       'rangeImg':             '',
-                                       'required':             true,
-                                       'requiredImg':  ''
-                               }
-                       }
-               },
-       */
-
-       elements: {},
-       nested: {'field':{}, 'level':{}},
-       ignoreElements: [],
-       recentUpdatedElements: {},
-       actionChecks: { submit: [] },
-
-       formname: '',
-       formnameUENC: '',
-       loadTime: 0,
-       isChanged: 0,
-       auth_timeout_field: 0,
-
-       backPath: '',
-       prependFormFieldNames: 'data',
-       prependFormFieldNamesUENC: 'data',
-       prependFormFieldNamesCnt: 0,
-
-       isPalettedoc: null,
-       doSaveFieldName: 0,
-
-       labels: {},
-       images: {
-               req: new Image(),
-               cm: new Image(),
-               sel: new Image(),
-               clear: new Image()
-       },
-
-       clearBeforeSettingFormValueFromBrowseWin: [],
-
-       // Handling of data structures:
-       addElements: function(elements) {
-               TBE_EDITOR.recentUpdatedElements = elements;
-               TBE_EDITOR.elements = $H(TBE_EDITOR.elements).merge(elements).toObject();
-       },
-       addNested: function(elements) {
-               // Merge data structures:
-               if (elements) {
-                       $H(elements).each(function(element) {
-                               var levelMax, i, currentLevel, subLevel;
-                               var nested = element.value;
-                               if (nested.level && nested.level.length) {
-                                               // If the first level is of type 'inline', it could be created by a AJAX request to IRRE.
-                                               // So, try to get the upper levels this dynamic level is nested in:
-                                       if (typeof inline!='undefined' && nested.level[0][0]=='inline') {
-                                               nested.level = inline.findContinuedNestedLevel(nested.level, nested.level[0][1]);
-                                       }
-                                       levelMax = nested.level.length-1;
-                                       for (i=0; i<=levelMax; i++) {
-                                               currentLevel = TBE_EDITOR.getNestedLevelIdent(nested.level[i]);
-                                               if (typeof TBE_EDITOR.nested.level[currentLevel] == 'undefined') {
-                                                       TBE_EDITOR.nested.level[currentLevel] = { 'clean': true, 'item': {}, 'sub': {} };
-                                               }
-                                                       // Add next sub level to the current level:
-                                               if (i<levelMax) {
-                                                       subLevel = TBE_EDITOR.getNestedLevelIdent(nested.level[i+1]);
-                                                       TBE_EDITOR.nested.level[currentLevel].sub[subLevel] = true;
-                                                       // Add the current item to the last level in nesting:
-                                               } else {
-                                                       TBE_EDITOR.nested.level[currentLevel].item[element.key] = nested.parts;
-                                               }
-                                       }
-                               }
-                       });
-                               // Merge the nested fields:
-                       TBE_EDITOR.nested.field = $H(TBE_EDITOR.nested.field).merge(elements).toObject();
-               }
-       },
-       removeElement: function(record) {
-               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record]) {
-                               // Inform envolved levels the this record is removed and the missing requirements are resolved:
-                       $H(TBE_EDITOR.elements[record]).each(
-                               function(pair) {
-                                       TBE_EDITOR.notifyNested(record+'['+pair.key+']', true);
-                               }
-                       );
-                       delete(TBE_EDITOR.elements[record]);
-               }
-       },
-       removeElementArray: function(removeStack) {
-               if (removeStack && removeStack.length) {
-                       TBE_EDITOR.ignoreElements = removeStack;
-                       for (var i=removeStack.length; i>=0; i--) {
-                               TBE_EDITOR.removeElement(removeStack[i]);
-                       }
-                       TBE_EDITOR.ignoreElements = [];
-               }
-       },
-       getElement: function(record, field, type) {
-               var result = null;
-               var element;
-
-               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record] && TBE_EDITOR.elements[record][field]) {
-                       element = TBE_EDITOR.elements[record][field];
-                       if (type) {
-                               if (element[type]) result = element;
-                       } else {
-                               result = element;
-                       }
-               }
-
-               return result;
-       },
-       checkElements: function(type, recentUpdated, record, field) {
-               var result = 1;
-               var elementName, elementData, elementRecord, elementField;
-               var source = (recentUpdated ? TBE_EDITOR.recentUpdatedElements : TBE_EDITOR.elements);
-
-               if (TBE_EDITOR.ignoreElements.length && TBE_EDITOR.ignoreElements.indexOf(record)!=-1) {
-                       return result;
-               }
-
-               if (type) {
-                       if (record && field) {
-                               elementName = record+'['+field+']';
-                               elementData = TBE_EDITOR.getElement(record, field, type);
-                               if (elementData) {
-                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData, recentUpdated)) {
-                                               result = 0;
-                                       }
-                               }
-
-                       } else {
-                               var elementFieldList, elRecIndex, elRecCnt, elFldIndex, elFldCnt;
-                               var elementRecordList = $H(source).keys();
-                               for (elRecIndex=0, elRecCnt=elementRecordList.length; elRecIndex<elRecCnt; elRecIndex++) {
-                                       elementRecord = elementRecordList[elRecIndex];
-                                       elementFieldList = $H(source[elementRecord]).keys();
-                                       for (elFldIndex=0, elFldCnt=elementFieldList.length; elFldIndex<elFldCnt; elFldIndex++) {
-                                               elementField = elementFieldList[elFldIndex];
-                                               elementData = TBE_EDITOR.getElement(elementRecord, elementField, type);
-                                               if (elementData) {
-                                                       elementName = elementRecord+'['+elementField+']';
-                                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData, recentUpdated)) {
-                                                               result = 0;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               return result;
-       },
-       checkElementByType: function(type, elementName, elementData, autoNotify) {
-               var form, result = 1;
-
-               if (type) {
-                       if (type == 'required') {
-                               form = document[TBE_EDITOR.formname][elementName];
-                               if (form) {
-                                               // Check if we are within a deleted inline element
-                                       var testNode = $(form.parentNode);
-                                       while(testNode) {
-                                               if (testNode.hasClassName && testNode.hasClassName('inlineIsDeletedRecord')) {
-                                                       return result;
-                                               }
-                                               testNode = $(testNode.parentNode);
-                                       }
-
-                                       var value = form.value;
-                                       if (!value || elementData.additional && elementData.additional.isPositiveNumber && (isNaN(value) || Number(value) <= 0)) {
-                                               result = 0;
-                                               if (autoNotify) {
-                                                       TBE_EDITOR.setImage('req_'+elementData.requiredImg, TBE_EDITOR.images.req);
-                                                       TBE_EDITOR.notifyNested(elementName, false);
-                                               }
-                                       }
-                               }
-                       } else if (type == 'range' && elementData.range) {
-                               var numberOfElements = 0;
-                               form = document[TBE_EDITOR.formname][elementName+'_list'];
-                               if (!form) {
-                                               // special treatment for IRRE fields:
-                                       var tempObj = document[TBE_EDITOR.formname][elementName];
-                                       if (tempObj && (Element.hasClassName(tempObj, 'inlineRecord') || Element.hasClassName(tempObj, 'treeRecord'))) {
-                                               form = tempObj.value ? tempObj.value.split(',') : [];
-                                               numberOfElements = form.length;
-                                       }
-
-                               } else {
-                                               // special treatment for file uploads
-                                       var tempObj = document[TBE_EDITOR.formname][elementName.replace(/^data/, 'data_files')];
-                                       numberOfElements = form.length;
-
-                                       if (tempObj && tempObj.type == 'file' && tempObj.value) {
-                                               numberOfElements++; // Add new uploaded file to the number of elements
-                                       }
-                               }
-
-                               if (!TBE_EDITOR.checkRange(numberOfElements, elementData.range[0], elementData.range[1])) {
-                                       result = 0;
-                                       if (autoNotify) {
-                                               TBE_EDITOR.setImage('req_'+elementData.rangeImg, TBE_EDITOR.images.req);
-                                               TBE_EDITOR.notifyNested(elementName, false);
-                                       }
-                               }
-                       }
-               }
-
-               return result;
-       },
-       // Notify tabs and inline levels with nested requiredFields/requiredElements:
-       notifyNested: function(elementName, resolved) {
-               if (TBE_EDITOR.nested.field[elementName]) {
-                       var i, nested, element, fieldLevels, fieldLevelIdent, nestedLevelType, nestedLevelName;
-                       fieldLevels = TBE_EDITOR.nested.field[elementName].level;
-                       TBE_EDITOR.nestedCache = {};
-
-                       for (i=fieldLevels.length-1; i>=0; i--) {
-                               nestedLevelType = fieldLevels[i][0];
-                               nestedLevelName = fieldLevels[i][1];
-                               fieldLevelIdent = TBE_EDITOR.getNestedLevelIdent(fieldLevels[i]);
-                                       // Construct the CSS id strings of the image/icon tags showing the notification:
-                               if (nestedLevelType == 'tab') {
-                                       element = nestedLevelName+'-REQ';
-                               } else if (nestedLevelType == 'inline') {
-                                       element = nestedLevelName+'_req';
-                               } else {
-                                       continue;
-                               }
-                                       // Set the icons:
-                               if (resolved) {
-                                       if (TBE_EDITOR.checkNested(fieldLevelIdent)) {
-                                               TBE_EDITOR.setImage(element, TBE_EDITOR.images.clear);
-                                       } else {
-                                               break;
-                                       }
-                               } else {
-                                       if (TBE_EDITOR.nested.level && TBE_EDITOR.nested.level[fieldLevelIdent]) {
-                                               TBE_EDITOR.nested.level[fieldLevelIdent].clean = false;
-                                       }
-                                       TBE_EDITOR.setImage(element, TBE_EDITOR.images.req);
-                               }
-                       }
-               }
-       },
-       // Check all the input fields on a given level of nesting - if only on is unfilled, the whole level is marked as required:
-       checkNested: function(nestedLevelIdent) {
-               var nestedLevel, isClean;
-               if (nestedLevelIdent && TBE_EDITOR.nested.level && TBE_EDITOR.nested.level[nestedLevelIdent]) {
-                       nestedLevel = TBE_EDITOR.nested.level[nestedLevelIdent];
-                       if (!nestedLevel.clean) {
-                               if (typeof nestedLevel.item == 'object') {
-                                       $H(nestedLevel.item).each(
-                                               function(pair) {
-                                                       if (isClean || typeof isClean == 'undefined') {
-                                                               isClean = (
-                                                                       TBE_EDITOR.checkElements('required', false, pair.value[0], pair.value[1]) &&
-                                                                       TBE_EDITOR.checkElements('range', false, pair.value[0], pair.value[1])
-                                                               );
-                                                       }
-                                               }
-                                       );
-                                       if (typeof isClean != 'undefined' && !isClean) {
-                                               return false;
-                                       }
-                               }
-                               if (typeof nestedLevel.sub == 'object') {
-                                       $H(nestedLevel.sub).each(
-                                               function(pair) {
-                                                       if (isClean || typeof isClean == 'undefined') {
-                                                               isClean = TBE_EDITOR.checkNested(pair.key);
-                                                       }
-                                               }
-                                       );
-                                       if (typeof isClean != 'undefined' && !isClean) {
-                                               return false;
-                                       }
-                               }
-                                       // Store the result, that this level (the fields on this and the sub levels) are clean:
-                               nestedLevel.clean = true;
-                       }
-               }
-               return true;
-       },
-       getNestedLevelIdent: function(level) {
-               return level.join('::');
-       },
-       addActionChecks: function(type, checks) {
-               TBE_EDITOR.actionChecks[type].push(checks);
-       },
-
-       // Regular TCEforms JSbottom scripts:
-       loginRefreshed: function() {
-               var date = new Date();
-               TBE_EDITOR.loadTime = Math.floor(date.getTime()/1000);
-               if (top.busy && top.busy.loginRefreshed) { top.busy.loginRefreshed(); }
-       },
-       checkLoginTimeout: function() {
-               var date = new Date();
-               var theTime = Math.floor(date.getTime()/1000);
-               if (theTime > TBE_EDITOR.loadTime+TBE_EDITOR.auth_timeout_field-10) {
-                       return true;
-               }
-       },
-       fieldChanged_fName: function(fName,el) {
-               var idx=2+TBE_EDITOR.prependFormFieldNamesCnt;
-               var table = TBE_EDITOR.split(fName, "[", idx);
-               var uid = TBE_EDITOR.split(fName, "[", idx+1);
-               var field = TBE_EDITOR.split(fName, "[", idx+2);
-
-               table = table.substr(0,table.length-1);
-               uid = uid.substr(0,uid.length-1);
-               field = field.substr(0,field.length-1);
-               TBE_EDITOR.fieldChanged(table,uid,field,el);
-       },
-       fieldChanged: function(table,uid,field,el) {
-               var theField = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']['+field+']';
-               var theRecord = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']';
-               TBE_EDITOR.isChanged = 1;
-
-                       // Set change image:
-               var imgObjName = "cm_"+table+"_"+uid+"_"+field;
-               TBE_EDITOR.setImage(imgObjName,TBE_EDITOR.images.cm);
-
-                       // Set change image
-               if (document[TBE_EDITOR.formname][theField] && document[TBE_EDITOR.formname][theField].type=="select-one" && document[TBE_EDITOR.formname][theField+"_selIconVal"]) {
-                       var imgObjName = "selIcon_"+table+"_"+uid+"_"+field+"_";
-                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.clear);
-                       document[TBE_EDITOR.formname][theField+"_selIconVal"].value = document[TBE_EDITOR.formname][theField].selectedIndex;
-                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.sel);
-               }
-
-                       // Set required flag:
-               var imgReqObjName = "req_"+table+"_"+uid+"_"+field;
-               if (TBE_EDITOR.getElement(theRecord,field,'required') && document[TBE_EDITOR.formname][theField]) {
-                       if (TBE_EDITOR.checkElements('required', false, theRecord, field)) {
-                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);
-                               TBE_EDITOR.notifyNested(theField, true);
-                       } else {
-                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);
-                               TBE_EDITOR.notifyNested(theField, false);
-                       }
-               }
-               if (TBE_EDITOR.getElement(theRecord,field,'range') && document[TBE_EDITOR.formname][theField]) {
-                       if (TBE_EDITOR.checkElements('range', false, theRecord, field)) {
-                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);
-                               TBE_EDITOR.notifyNested(theField, true);
-                       } else {
-                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);
-                               TBE_EDITOR.notifyNested(theField, false);
-                       }
-               }
-
-               if (TBE_EDITOR.isPalettedoc) { TBE_EDITOR.setOriginalFormFieldValue(theField) };
-       },
-       setOriginalFormFieldValue: function(theField) {
-               if (TBE_EDITOR.isPalettedoc && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname] && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField]) {
-                       (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField].value = document[TBE_EDITOR.formname][theField].value;
-               }
-       },
-       isFormChanged: function(noAlert) {
-               if (TBE_EDITOR.isChanged && !noAlert && confirm(TBE_EDITOR.labels.fieldsChanged)) {
-                       return 0;
-               }
-               return TBE_EDITOR.isChanged;
-       },
-       checkAndDoSubmit: function(sendAlert) {
-               if (TBE_EDITOR.checkSubmit(sendAlert)) { TBE_EDITOR.submitForm(); }
-       },
-       /**
-        * Checks if the form can be submitted according to any possible restrains like required values, item numbers etc.
-        * Returns true if the form can be submitted, otherwise false (and might issue an alert message, if "sendAlert" is 1)
-        * If "sendAlert" is false, no error message will be shown upon false return value (if "1" then it will).
-        * If "sendAlert" is "-1" then the function will ALWAYS return true regardless of constraints (except if login has expired) - this is used in the case where a form field change requests a form update and where it is accepted that constraints are not observed (form layout might change so other fields are shown...)
-        */
-       checkSubmit: function(sendAlert) {
-               var funcIndex, funcMax, funcRes;
-               var OK=1;
-
-               // $this->additionalJS_submit:
-               if (TBE_EDITOR.actionChecks && TBE_EDITOR.actionChecks.submit) {
-                       for (funcIndex=0, funcMax=TBE_EDITOR.actionChecks.submit.length; funcIndex<funcMax; funcIndex++) {
-                               try {
-                                       eval(TBE_EDITOR.actionChecks.submit[funcIndex]);
-                               } catch(error) {}
-                       }
-               }
-
-               if(!OK) {
-                       if (!confirm(unescape("SYSTEM ERROR: One or more Rich Text Editors on the page could not be contacted. This IS an error, although it should not be regular.\nYou can save the form now by pressing OK, but you will loose the Rich Text Editor content if you do.\n\nPlease report the error to your administrator if it persists."))) {
-                               return false;
-                       } else {
-                               OK = 1;
-                       }
-               }
-               // $reqLinesCheck
-               if (!TBE_EDITOR.checkElements('required', false)) { OK = 0; }
-               // $reqRangeCheck
-               if (!TBE_EDITOR.checkElements('range', false)) { OK = 0; }
-
-               if (OK || sendAlert==-1) {
-                       return true;
-               } else {
-                       if(sendAlert) alert(TBE_EDITOR.labels.fieldsMissing);
-                       return false;
-               }
-       },
-       checkRange: function(numberOfElements, lower, upper) {
-                       // for backwards compatibility, check if we're dealing with an element as first parameter
-               if(typeof numberOfElements == 'object') {
-                       numberOfElements = numberOfElements.length;
-               }
-
-               if (numberOfElements >= lower && numberOfElements <= upper) {
-                       return true;
-               } else {
-                       return false;
-               }
-       },
-       initRequired: function() {
-               // $reqLinesCheck
-               TBE_EDITOR.checkElements('required', true);
-
-               // $reqRangeCheck
-               TBE_EDITOR.checkElements('range', true);
-       },
-       setImage: function(name,image) {
-               var object;
-               if (document[name]) {
-                       object = document[name];
-               } else if (document.getElementById(name)) {
-                       object = document.getElementById(name);
-               }
-               if (object) {
-                       if (typeof image == 'object') {
-                               document[name].src = image.src;
-                       } else {
-                               document[name].src = eval(image+'.src');
-                       }
-               }
-       },
-       submitForm: function() {
-               if (TBE_EDITOR.doSaveFieldName) {
-                       document[TBE_EDITOR.formname][TBE_EDITOR.doSaveFieldName].value=1;
-               }
-               document[TBE_EDITOR.formname].submit();
-       },
-       split: function(theStr1, delim, index) {
-               var theStr = ""+theStr1;
-               var lengthOfDelim = delim.length;
-               sPos = -lengthOfDelim;
-               if (index<1) {index=1;}
-               for (var 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));
-       },
-       curSelected: function(theField) {
-               var fObjSel = document[TBE_EDITOR.formname][theField];
-               var retVal="";
-               if (fObjSel) {
-                       if (fObjSel.type=='select-multiple' || fObjSel.type=='select-one') {
-                               var l=fObjSel.length;
-                               for (a=0;a<l;a++) {
-                                       if (fObjSel.options[a].selected==1) {
-                                               retVal+=fObjSel.options[a].value+",";
-                                       }
-                               }
-                       }
-               }
-               return retVal;
-       },
-       rawurlencode: function(str,maxlen) {
-               var output = str;
-               if (maxlen)     output = output.substr(0,200);
-               output = encodeURIComponent(output);
-               return output;
-       },
-       str_replace: function(match,replace,string) {
-               var input = ''+string;
-               var matchStr = ''+match;
-               if (!matchStr) { return string; }
-               var output = '';
-               var pointer=0;
-               var pos = input.indexOf(matchStr);
-               while (pos!=-1) {
-                       output+=''+input.substr(pointer, pos-pointer)+replace;
-                       pointer=pos+matchStr.length;
-                       pos = input.indexOf(match,pos+1);
-               }
-               output+=''+input.substr(pointer);
-               return output;
-       },
-       toggle_display_states: function(id, state_1, state_2) {
-               var node = document.getElementById(id);
-               if (node) {
-                       switch (node.style.display) {
-                               case state_1:
-                                       node.style.display = state_2;
-                                       break;
-                               case state_2:
-                                       node.style.display = state_1;
-                                       break;
-                       }
-               }
-               return false;
-       },
-
-       /**
-        * Determines backend path to be used for e.g. ajax.php
-        * @return string
-        */
-       getBackendPath: function() {
-               var backendPath = '';
-               if (TYPO3) {
-                       if (TYPO3.configuration && TYPO3.configuration.PATH_typo3) {
-                               backendPath = TYPO3.configuration.PATH_typo3;
-                       } else if (TYPO3.settings && TYPO3.settings.PATH_typo3) {
-                               backendPath = TYPO3.settings.PATH_typo3;
-                       }
-               }
-               return backendPath;
-       }
-};
-
-function typoSetup     () {
-       this.passwordDummy = '********';
-       this.decimalSign = '.';
-}
-var TS = new typoSetup();
-var evalFunc = new evalFunc();
-
-// backwards compatibility for extensions
-var TBE_EDITOR_loginRefreshed = TBE_EDITOR.loginRefreshed;
-var TBE_EDITOR_checkLoginTimeout = TBE_EDITOR.checkLoginTimeout;
-var TBE_EDITOR_setHiddenContent = TBE_EDITOR.setHiddenContent;
-var TBE_EDITOR_isChanged = TBE_EDITOR.isChanged;
-var TBE_EDITOR_fieldChanged_fName = TBE_EDITOR.fieldChanged_fName;
-var TBE_EDITOR_fieldChanged = TBE_EDITOR.fieldChanged;
-var TBE_EDITOR_setOriginalFormFieldValue = TBE_EDITOR.setOriginalFormFieldValue;
-var TBE_EDITOR_isFormChanged = TBE_EDITOR.isFormChanged;
-var TBE_EDITOR_checkAndDoSubmit = TBE_EDITOR.checkAndDoSubmit;
-var TBE_EDITOR_checkSubmit = TBE_EDITOR.checkSubmit;
-var TBE_EDITOR_checkRange = TBE_EDITOR.checkRange;
-var TBE_EDITOR_initRequired = TBE_EDITOR.initRequired;
-var TBE_EDITOR_setImage = TBE_EDITOR.setImage;
-var TBE_EDITOR_submitForm = TBE_EDITOR.submitForm;
-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 = {
-       fieldSetNull: function(fieldName, isNull) {
-               if (document[TBE_EDITOR.formname][fieldName]) {
-                       var formFieldItemWrapper = Element.up(document[TBE_EDITOR.formname][fieldName], '.t3-form-field-item');
-
-                       if (isNull) {
-                               formFieldItemWrapper.addClassName('disabled');
-                       } else {
-                               formFieldItemWrapper.removeClassName('disabled');
-                       }
-               }
-       },
-       fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {
-               var i;
-
-               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[TBE_EDITOR.formname][theField+"_hr"].value="";
-                               if (document[TBE_EDITOR.formname][theField+"_cb"])      document[TBE_EDITOR.formname][theField+"_cb"].checked = "";
-                       } else {
-                               document[TBE_EDITOR.formname][theField+"_hr"].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[TBE_EDITOR.formname][theField+"_hr"].value);
-                       }
-                       typo3form.fieldSet(theField, evallist, is_in, checkbox, checkboxValue);
-               }
-       }
-};
-
-// backwards compatibility for extensions
-var typo3FormFieldSet = typo3form.fieldSet;
-var typo3FormFieldGet = typo3form.fieldGet;
diff --git a/typo3/md5.js b/typo3/md5.js
deleted file mode 100644 (file)
index 8ed0ad0..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
-*
-*  MD5 (Message-Digest Algorithm)
-*  http://www.webtoolkit.info/
-*
-**/
-
-function MD5(string) {
-
-       function RotateLeft(lValue, iShiftBits) {
-               return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
-       }
-
-       function AddUnsigned(lX,lY) {
-               var lX4,lY4,lX8,lY8,lResult;
-               lX8 = (lX & 0x80000000);
-               lY8 = (lY & 0x80000000);
-               lX4 = (lX & 0x40000000);
-               lY4 = (lY & 0x40000000);
-               lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
-               if (lX4 & lY4) {
-                       return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
-               }
-               if (lX4 | lY4) {
-                       if (lResult & 0x40000000) {
-                               return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
-                       } else {
-                               return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
-                       }
-               } else {
-                       return (lResult ^ lX8 ^ lY8);
-               }
-       }
-
-       function F(x,y,z) { return (x & y) | ((~x) & z); }
-       function G(x,y,z) { return (x & z) | (y & (~z)); }
-       function H(x,y,z) { return (x ^ y ^ z); }
-       function I(x,y,z) { return (y ^ (x | (~z))); }
-
-       function FF(a,b,c,d,x,s,ac) {
-               a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
-               return AddUnsigned(RotateLeft(a, s), b);
-       };
-
-       function GG(a,b,c,d,x,s,ac) {
-               a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
-               return AddUnsigned(RotateLeft(a, s), b);
-       };
-
-       function HH(a,b,c,d,x,s,ac) {
-               a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
-               return AddUnsigned(RotateLeft(a, s), b);
-       };
-
-       function II(a,b,c,d,x,s,ac) {
-               a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
-               return AddUnsigned(RotateLeft(a, s), b);
-       };
-
-       function ConvertToWordArray(string) {
-               var lWordCount;
-               var lMessageLength = string.length;
-               var lNumberOfWords_temp1=lMessageLength + 8;
-               var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
-               var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
-               var lWordArray=Array(lNumberOfWords-1);
-               var lBytePosition = 0;
-               var lByteCount = 0;
-               while ( lByteCount < lMessageLength ) {
-                       lWordCount = (lByteCount-(lByteCount % 4))/4;
-                       lBytePosition = (lByteCount % 4)*8;
-                       lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
-                       lByteCount++;
-               }
-               lWordCount = (lByteCount-(lByteCount % 4))/4;
-               lBytePosition = (lByteCount % 4)*8;
-               lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
-               lWordArray[lNumberOfWords-2] = lMessageLength<<3;
-               lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
-               return lWordArray;
-       };
-
-       function WordToHex(lValue) {
-               var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
-               for (lCount = 0;lCount<=3;lCount++) {
-                       lByte = (lValue>>>(lCount*8)) & 255;
-                       WordToHexValue_temp = "0" + lByte.toString(16);
-                       WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
-               }
-               return WordToHexValue;
-       };
-
-       function Utf8Encode(string) {
-               string = string.replace(/\r\n/g,"\n");
-               var utftext = "";
-
-               for (var n = 0; n < string.length; n++) {
-
-                       var c = string.charCodeAt(n);
-
-                       if (c < 128) {
-                               utftext += String.fromCharCode(c);
-                       }
-                       else if((c > 127) && (c < 2048)) {
-                               utftext += String.fromCharCode((c >> 6) | 192);
-                               utftext += String.fromCharCode((c & 63) | 128);
-                       }
-                       else {
-                               utftext += String.fromCharCode((c >> 12) | 224);
-                               utftext += String.fromCharCode(((c >> 6) & 63) | 128);
-                               utftext += String.fromCharCode((c & 63) | 128);
-                       }
-
-               }
-
-               return utftext;
-       };
-
-       var x=Array();
-       var k,AA,BB,CC,DD,a,b,c,d;
-       var S11=7, S12=12, S13=17, S14=22;
-       var S21=5, S22=9 , S23=14, S24=20;
-       var S31=4, S32=11, S33=16, S34=23;
-       var S41=6, S42=10, S43=15, S44=21;
-
-       string = Utf8Encode(string);
-
-       x = ConvertToWordArray(string);
-
-       a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
-
-       for (k=0;k<x.length;k+=16) {
-               AA=a; BB=b; CC=c; DD=d;
-               a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
-               d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
-               c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
-               b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
-               a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
-               d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
-               c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
-               b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
-               a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
-               d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
-               c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
-               b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
-               a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
-               d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
-               c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
-               b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
-               a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
-               d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
-               c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
-               b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
-               a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
-               d=GG(d,a,b,c,x[k+10],S22,0x2441453);
-               c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
-               b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
-               a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
-               d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
-               c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
-               b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
-               a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
-               d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
-               c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
-               b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
-               a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
-               d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
-               c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
-               b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
-               a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
-               d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
-               c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
-               b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
-               a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
-               d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
-               c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
-               b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
-               a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
-               d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
-               c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
-               b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
-               a=II(a,b,c,d,x[k+0], S41,0xF4292244);
-               d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
-               c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
-               b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
-               a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
-               d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
-               c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
-               b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
-               a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
-               d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
-               c=II(c,d,a,b,x[k+6], S43,0xA3014314);
-               b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
-               a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
-               d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
-               c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
-               b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
-               a=AddUnsigned(a,AA);
-               b=AddUnsigned(b,BB);
-               c=AddUnsigned(c,CC);
-               d=AddUnsigned(d,DD);
-       }
-
-       var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
-
-       return temp.toLowerCase();
-}
\ No newline at end of file
index 824bcf9..8ab290b 100644 (file)
@@ -102,11 +102,11 @@ class BackendController {
                        'common' => 'sysext/backend/Resources/Public/JavaScript/common.js',
                        'locallang' => $this->getLocalLangFileName(),
                        'modernizr' => 'contrib/modernizr/modernizr.min.js',
-                       'md5' => 'md5.js',
+                       'md5' => 'sysext/backend/Resources/Public/JavaScript/md5.js',
                        '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' => 'js/jsfunc.evalfield.js',
+                       'evalfield' => 'sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js',
                        'flashmessages' => 'sysext/backend/Resources/Public/JavaScript/flashmessages.js',
                        'tabclosemenu' => 'js/extjs/ux/ext.ux.tabclosemenu.js',
                        'notifications' => 'sysext/backend/Resources/Public/JavaScript/notifications.js',
index cf6e520..f803d6e 100644 (file)
@@ -5290,7 +5290,7 @@ function ' . $evalData . '(value) {
                $this->TBE_EDITOR_fieldChanged_func = 'TBE_EDITOR.fieldChanged_fName(fName,formObj[fName+"_list"]);';
                if (!$update) {
                        if ($this->loadMD5_JS) {
-                               $this->loadJavascriptLib('md5.js');
+                               $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
                        }
                        /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
                        $pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
@@ -5308,9 +5308,9 @@ function ' . $evalData . '(value) {
                                'textareaResize' => !$GLOBALS['BE_USER']->uc['resizeTextareas'] == '0'
                        );
                        $pageRenderer->addInlineSettingArray('', $resizableSettings);
-                       $this->loadJavascriptLib('js/jsfunc.evalfield.js');
-                       $this->loadJavascriptLib('jsfunc.tbe_editor.js');
-                       $this->loadJavascriptLib('jsfunc.placeholder.js');
+                       $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js');
+                       $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
+                       $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/jsfunc.placeholder.js');
                        // Needed for tceform manipulation (date picker)
                        $typo3Settings = array(
                                'datePickerUSmode' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? 1 : 0,
index 4330338..e4c419f 100644 (file)
@@ -804,7 +804,7 @@ class DocumentTemplate {
                // This loads the tabulator-in-textarea feature. It automatically modifies
                // every textarea which is found.
                if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) {
-                       $this->loadJavascriptLib('tab.js');
+                       $this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tab.js');
                }
                // Include the JS for the Context Sensitive Help
                if ($includeCsh) {
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js b/typo3/sysext/backend/Resources/Public/JavaScript/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/sysext/backend/Resources/Public/JavaScript/jsfunc.placeholder.js b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.placeholder.js
new file mode 100644 (file)
index 0000000..12e8219
--- /dev/null
@@ -0,0 +1,55 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2011 Tobias Liebig <tobias.liebig@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.onReady(function() {
+       // Only use placeholder JavaScript fallback in Internet Explorer
+       if (!Ext.isIE) {
+               return;
+       }
+
+       // TODO rewrite in ExtJS
+       $$('[placeholder]').each(function(el) {
+               if (el.getAttribute('placeholder') != "") {
+                       el.observe('TYPO3:focus', function() {
+                               var input = Ext.get(this);
+                               if (this.getValue() == this.getAttribute('placeholder')) {
+                                       this.setValue('');
+                                       input.removeClass('placeholder');
+                               }
+                       });
+                       el.observe('focus', function() { el.fire('TYPO3:focus'); });
+                       el.observe('TYPO3:blur', function() {
+                               var input = Ext.get(this);
+                               if (input.getValue() == '' || this.getValue() == this.getAttribute('placeholder')) {
+                                       this.setValue(this.getAttribute('placeholder'));
+                                       input.addClass('placeholder');
+                               }
+                       });
+                       el.observe('blur', function() { el.fire('TYPO3:blur'); });
+                       el.fire('TYPO3:blur');
+               }
+       });
+});
\ No newline at end of file
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js b/typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js
new file mode 100644 (file)
index 0000000..953d0e5
--- /dev/null
@@ -0,0 +1,654 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.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!
+***************************************************************/
+/**
+ * Contains JavaScript for TYPO3 Core Form generator - AKA "TCEforms"
+ *
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
+ * @coauthor   Oliver Hader <oh@inpublica.de>
+ */
+
+
+var TBE_EDITOR = {
+       /* Example:
+               elements: {
+                       'data-parentPid-table-uid': {
+                               'field': {
+                                       'range':                [0, 100],
+                                       'rangeImg':             '',
+                                       'required':             true,
+                                       'requiredImg':  ''
+                               }
+                       }
+               },
+       */
+
+       elements: {},
+       nested: {'field':{}, 'level':{}},
+       ignoreElements: [],
+       recentUpdatedElements: {},
+       actionChecks: { submit: [] },
+
+       formname: '',
+       formnameUENC: '',
+       loadTime: 0,
+       isChanged: 0,
+       auth_timeout_field: 0,
+
+       backPath: '',
+       prependFormFieldNames: 'data',
+       prependFormFieldNamesUENC: 'data',
+       prependFormFieldNamesCnt: 0,
+
+       isPalettedoc: null,
+       doSaveFieldName: 0,
+
+       labels: {},
+       images: {
+               req: new Image(),
+               cm: new Image(),
+               sel: new Image(),
+               clear: new Image()
+       },
+
+       clearBeforeSettingFormValueFromBrowseWin: [],
+
+       // Handling of data structures:
+       addElements: function(elements) {
+               TBE_EDITOR.recentUpdatedElements = elements;
+               TBE_EDITOR.elements = $H(TBE_EDITOR.elements).merge(elements).toObject();
+       },
+       addNested: function(elements) {
+               // Merge data structures:
+               if (elements) {
+                       $H(elements).each(function(element) {
+                               var levelMax, i, currentLevel, subLevel;
+                               var nested = element.value;
+                               if (nested.level && nested.level.length) {
+                                               // If the first level is of type 'inline', it could be created by a AJAX request to IRRE.
+                                               // So, try to get the upper levels this dynamic level is nested in:
+                                       if (typeof inline!='undefined' && nested.level[0][0]=='inline') {
+                                               nested.level = inline.findContinuedNestedLevel(nested.level, nested.level[0][1]);
+                                       }
+                                       levelMax = nested.level.length-1;
+                                       for (i=0; i<=levelMax; i++) {
+                                               currentLevel = TBE_EDITOR.getNestedLevelIdent(nested.level[i]);
+                                               if (typeof TBE_EDITOR.nested.level[currentLevel] == 'undefined') {
+                                                       TBE_EDITOR.nested.level[currentLevel] = { 'clean': true, 'item': {}, 'sub': {} };
+                                               }
+                                                       // Add next sub level to the current level:
+                                               if (i<levelMax) {
+                                                       subLevel = TBE_EDITOR.getNestedLevelIdent(nested.level[i+1]);
+                                                       TBE_EDITOR.nested.level[currentLevel].sub[subLevel] = true;
+                                                       // Add the current item to the last level in nesting:
+                                               } else {
+                                                       TBE_EDITOR.nested.level[currentLevel].item[element.key] = nested.parts;
+                                               }
+                                       }
+                               }
+                       });
+                               // Merge the nested fields:
+                       TBE_EDITOR.nested.field = $H(TBE_EDITOR.nested.field).merge(elements).toObject();
+               }
+       },
+       removeElement: function(record) {
+               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record]) {
+                               // Inform envolved levels the this record is removed and the missing requirements are resolved:
+                       $H(TBE_EDITOR.elements[record]).each(
+                               function(pair) {
+                                       TBE_EDITOR.notifyNested(record+'['+pair.key+']', true);
+                               }
+                       );
+                       delete(TBE_EDITOR.elements[record]);
+               }
+       },
+       removeElementArray: function(removeStack) {
+               if (removeStack && removeStack.length) {
+                       TBE_EDITOR.ignoreElements = removeStack;
+                       for (var i=removeStack.length; i>=0; i--) {
+                               TBE_EDITOR.removeElement(removeStack[i]);
+                       }
+                       TBE_EDITOR.ignoreElements = [];
+               }
+       },
+       getElement: function(record, field, type) {
+               var result = null;
+               var element;
+
+               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record] && TBE_EDITOR.elements[record][field]) {
+                       element = TBE_EDITOR.elements[record][field];
+                       if (type) {
+                               if (element[type]) result = element;
+                       } else {
+                               result = element;
+                       }
+               }
+
+               return result;
+       },
+       checkElements: function(type, recentUpdated, record, field) {
+               var result = 1;
+               var elementName, elementData, elementRecord, elementField;
+               var source = (recentUpdated ? TBE_EDITOR.recentUpdatedElements : TBE_EDITOR.elements);
+
+               if (TBE_EDITOR.ignoreElements.length && TBE_EDITOR.ignoreElements.indexOf(record)!=-1) {
+                       return result;
+               }
+
+               if (type) {
+                       if (record && field) {
+                               elementName = record+'['+field+']';
+                               elementData = TBE_EDITOR.getElement(record, field, type);
+                               if (elementData) {
+                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData, recentUpdated)) {
+                                               result = 0;
+                                       }
+                               }
+
+                       } else {
+                               var elementFieldList, elRecIndex, elRecCnt, elFldIndex, elFldCnt;
+                               var elementRecordList = $H(source).keys();
+                               for (elRecIndex=0, elRecCnt=elementRecordList.length; elRecIndex<elRecCnt; elRecIndex++) {
+                                       elementRecord = elementRecordList[elRecIndex];
+                                       elementFieldList = $H(source[elementRecord]).keys();
+                                       for (elFldIndex=0, elFldCnt=elementFieldList.length; elFldIndex<elFldCnt; elFldIndex++) {
+                                               elementField = elementFieldList[elFldIndex];
+                                               elementData = TBE_EDITOR.getElement(elementRecord, elementField, type);
+                                               if (elementData) {
+                                                       elementName = elementRecord+'['+elementField+']';
+                                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData, recentUpdated)) {
+                                                               result = 0;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               return result;
+       },
+       checkElementByType: function(type, elementName, elementData, autoNotify) {
+               var form, result = 1;
+
+               if (type) {
+                       if (type == 'required') {
+                               form = document[TBE_EDITOR.formname][elementName];
+                               if (form) {
+                                               // Check if we are within a deleted inline element
+                                       var testNode = $(form.parentNode);
+                                       while(testNode) {
+                                               if (testNode.hasClassName && testNode.hasClassName('inlineIsDeletedRecord')) {
+                                                       return result;
+                                               }
+                                               testNode = $(testNode.parentNode);
+                                       }
+
+                                       var value = form.value;
+                                       if (!value || elementData.additional && elementData.additional.isPositiveNumber && (isNaN(value) || Number(value) <= 0)) {
+                                               result = 0;
+                                               if (autoNotify) {
+                                                       TBE_EDITOR.setImage('req_'+elementData.requiredImg, TBE_EDITOR.images.req);
+                                                       TBE_EDITOR.notifyNested(elementName, false);
+                                               }
+                                       }
+                               }
+                       } else if (type == 'range' && elementData.range) {
+                               var numberOfElements = 0;
+                               form = document[TBE_EDITOR.formname][elementName+'_list'];
+                               if (!form) {
+                                               // special treatment for IRRE fields:
+                                       var tempObj = document[TBE_EDITOR.formname][elementName];
+                                       if (tempObj && (Element.hasClassName(tempObj, 'inlineRecord') || Element.hasClassName(tempObj, 'treeRecord'))) {
+                                               form = tempObj.value ? tempObj.value.split(',') : [];
+                                               numberOfElements = form.length;
+                                       }
+
+                               } else {
+                                               // special treatment for file uploads
+                                       var tempObj = document[TBE_EDITOR.formname][elementName.replace(/^data/, 'data_files')];
+                                       numberOfElements = form.length;
+
+                                       if (tempObj && tempObj.type == 'file' && tempObj.value) {
+                                               numberOfElements++; // Add new uploaded file to the number of elements
+                                       }
+                               }
+
+                               if (!TBE_EDITOR.checkRange(numberOfElements, elementData.range[0], elementData.range[1])) {
+                                       result = 0;
+                                       if (autoNotify) {
+                                               TBE_EDITOR.setImage('req_'+elementData.rangeImg, TBE_EDITOR.images.req);
+                                               TBE_EDITOR.notifyNested(elementName, false);
+                                       }
+                               }
+                       }
+               }
+
+               return result;
+       },
+       // Notify tabs and inline levels with nested requiredFields/requiredElements:
+       notifyNested: function(elementName, resolved) {
+               if (TBE_EDITOR.nested.field[elementName]) {
+                       var i, nested, element, fieldLevels, fieldLevelIdent, nestedLevelType, nestedLevelName;
+                       fieldLevels = TBE_EDITOR.nested.field[elementName].level;
+                       TBE_EDITOR.nestedCache = {};
+
+                       for (i=fieldLevels.length-1; i>=0; i--) {
+                               nestedLevelType = fieldLevels[i][0];
+                               nestedLevelName = fieldLevels[i][1];
+                               fieldLevelIdent = TBE_EDITOR.getNestedLevelIdent(fieldLevels[i]);
+                                       // Construct the CSS id strings of the image/icon tags showing the notification:
+                               if (nestedLevelType == 'tab') {
+                                       element = nestedLevelName+'-REQ';
+                               } else if (nestedLevelType == 'inline') {
+                                       element = nestedLevelName+'_req';
+                               } else {
+                                       continue;
+                               }
+                                       // Set the icons:
+                               if (resolved) {
+                                       if (TBE_EDITOR.checkNested(fieldLevelIdent)) {
+                                               TBE_EDITOR.setImage(element, TBE_EDITOR.images.clear);
+                                       } else {
+                                               break;
+                                       }
+                               } else {
+                                       if (TBE_EDITOR.nested.level && TBE_EDITOR.nested.level[fieldLevelIdent]) {
+                                               TBE_EDITOR.nested.level[fieldLevelIdent].clean = false;
+                                       }
+                                       TBE_EDITOR.setImage(element, TBE_EDITOR.images.req);
+                               }
+                       }
+               }
+       },
+       // Check all the input fields on a given level of nesting - if only on is unfilled, the whole level is marked as required:
+       checkNested: function(nestedLevelIdent) {
+               var nestedLevel, isClean;
+               if (nestedLevelIdent && TBE_EDITOR.nested.level && TBE_EDITOR.nested.level[nestedLevelIdent]) {
+                       nestedLevel = TBE_EDITOR.nested.level[nestedLevelIdent];
+                       if (!nestedLevel.clean) {
+                               if (typeof nestedLevel.item == 'object') {
+                                       $H(nestedLevel.item).each(
+                                               function(pair) {
+                                                       if (isClean || typeof isClean == 'undefined') {
+                                                               isClean = (
+                                                                       TBE_EDITOR.checkElements('required', false, pair.value[0], pair.value[1]) &&
+                                                                       TBE_EDITOR.checkElements('range', false, pair.value[0], pair.value[1])
+                                                               );
+                                                       }
+                                               }
+                                       );
+                                       if (typeof isClean != 'undefined' && !isClean) {
+                                               return false;
+                                       }
+                               }
+                               if (typeof nestedLevel.sub == 'object') {
+                                       $H(nestedLevel.sub).each(
+                                               function(pair) {
+                                                       if (isClean || typeof isClean == 'undefined') {
+                                                               isClean = TBE_EDITOR.checkNested(pair.key);
+                                                       }
+                                               }
+                                       );
+                                       if (typeof isClean != 'undefined' && !isClean) {
+                                               return false;
+                                       }
+                               }
+                                       // Store the result, that this level (the fields on this and the sub levels) are clean:
+                               nestedLevel.clean = true;
+                       }
+               }
+               return true;
+       },
+       getNestedLevelIdent: function(level) {
+               return level.join('::');
+       },
+       addActionChecks: function(type, checks) {
+               TBE_EDITOR.actionChecks[type].push(checks);
+       },
+
+       // Regular TCEforms JSbottom scripts:
+       loginRefreshed: function() {
+               var date = new Date();
+               TBE_EDITOR.loadTime = Math.floor(date.getTime()/1000);
+               if (top.busy && top.busy.loginRefreshed) { top.busy.loginRefreshed(); }
+       },
+       checkLoginTimeout: function() {
+               var date = new Date();
+               var theTime = Math.floor(date.getTime()/1000);
+               if (theTime > TBE_EDITOR.loadTime+TBE_EDITOR.auth_timeout_field-10) {
+                       return true;
+               }
+       },
+       fieldChanged_fName: function(fName,el) {
+               var idx=2+TBE_EDITOR.prependFormFieldNamesCnt;
+               var table = TBE_EDITOR.split(fName, "[", idx);
+               var uid = TBE_EDITOR.split(fName, "[", idx+1);
+               var field = TBE_EDITOR.split(fName, "[", idx+2);
+
+               table = table.substr(0,table.length-1);
+               uid = uid.substr(0,uid.length-1);
+               field = field.substr(0,field.length-1);
+               TBE_EDITOR.fieldChanged(table,uid,field,el);
+       },
+       fieldChanged: function(table,uid,field,el) {
+               var theField = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']['+field+']';
+               var theRecord = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']';
+               TBE_EDITOR.isChanged = 1;
+
+                       // Set change image:
+               var imgObjName = "cm_"+table+"_"+uid+"_"+field;
+               TBE_EDITOR.setImage(imgObjName,TBE_EDITOR.images.cm);
+
+                       // Set change image
+               if (document[TBE_EDITOR.formname][theField] && document[TBE_EDITOR.formname][theField].type=="select-one" && document[TBE_EDITOR.formname][theField+"_selIconVal"]) {
+                       var imgObjName = "selIcon_"+table+"_"+uid+"_"+field+"_";
+                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.clear);
+                       document[TBE_EDITOR.formname][theField+"_selIconVal"].value = document[TBE_EDITOR.formname][theField].selectedIndex;
+                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.sel);
+               }
+
+                       // Set required flag:
+               var imgReqObjName = "req_"+table+"_"+uid+"_"+field;
+               if (TBE_EDITOR.getElement(theRecord,field,'required') && document[TBE_EDITOR.formname][theField]) {
+                       if (TBE_EDITOR.checkElements('required', false, theRecord, field)) {
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);
+                               TBE_EDITOR.notifyNested(theField, true);
+                       } else {
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);
+                               TBE_EDITOR.notifyNested(theField, false);
+                       }
+               }
+               if (TBE_EDITOR.getElement(theRecord,field,'range') && document[TBE_EDITOR.formname][theField]) {
+                       if (TBE_EDITOR.checkElements('range', false, theRecord, field)) {
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);
+                               TBE_EDITOR.notifyNested(theField, true);
+                       } else {
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);
+                               TBE_EDITOR.notifyNested(theField, false);
+                       }
+               }
+
+               if (TBE_EDITOR.isPalettedoc) { TBE_EDITOR.setOriginalFormFieldValue(theField) };
+       },
+       setOriginalFormFieldValue: function(theField) {
+               if (TBE_EDITOR.isPalettedoc && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname] && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField]) {
+                       (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField].value = document[TBE_EDITOR.formname][theField].value;
+               }
+       },
+       isFormChanged: function(noAlert) {
+               if (TBE_EDITOR.isChanged && !noAlert && confirm(TBE_EDITOR.labels.fieldsChanged)) {
+                       return 0;
+               }
+               return TBE_EDITOR.isChanged;
+       },
+       checkAndDoSubmit: function(sendAlert) {
+               if (TBE_EDITOR.checkSubmit(sendAlert)) { TBE_EDITOR.submitForm(); }
+       },
+       /**
+        * Checks if the form can be submitted according to any possible restrains like required values, item numbers etc.
+        * Returns true if the form can be submitted, otherwise false (and might issue an alert message, if "sendAlert" is 1)
+        * If "sendAlert" is false, no error message will be shown upon false return value (if "1" then it will).
+        * If "sendAlert" is "-1" then the function will ALWAYS return true regardless of constraints (except if login has expired) - this is used in the case where a form field change requests a form update and where it is accepted that constraints are not observed (form layout might change so other fields are shown...)
+        */
+       checkSubmit: function(sendAlert) {
+               var funcIndex, funcMax, funcRes;
+               var OK=1;
+
+               // $this->additionalJS_submit:
+               if (TBE_EDITOR.actionChecks && TBE_EDITOR.actionChecks.submit) {
+                       for (funcIndex=0, funcMax=TBE_EDITOR.actionChecks.submit.length; funcIndex<funcMax; funcIndex++) {
+                               try {
+                                       eval(TBE_EDITOR.actionChecks.submit[funcIndex]);
+                               } catch(error) {}
+                       }
+               }
+
+               if(!OK) {
+                       if (!confirm(unescape("SYSTEM ERROR: One or more Rich Text Editors on the page could not be contacted. This IS an error, although it should not be regular.\nYou can save the form now by pressing OK, but you will loose the Rich Text Editor content if you do.\n\nPlease report the error to your administrator if it persists."))) {
+                               return false;
+                       } else {
+                               OK = 1;
+                       }
+               }
+               // $reqLinesCheck
+               if (!TBE_EDITOR.checkElements('required', false)) { OK = 0; }
+               // $reqRangeCheck
+               if (!TBE_EDITOR.checkElements('range', false)) { OK = 0; }
+
+               if (OK || sendAlert==-1) {
+                       return true;
+               } else {
+                       if(sendAlert) alert(TBE_EDITOR.labels.fieldsMissing);
+                       return false;
+               }
+       },
+       checkRange: function(numberOfElements, lower, upper) {
+                       // for backwards compatibility, check if we're dealing with an element as first parameter
+               if(typeof numberOfElements == 'object') {
+                       numberOfElements = numberOfElements.length;
+               }
+
+               if (numberOfElements >= lower && numberOfElements <= upper) {
+                       return true;
+               } else {
+                       return false;
+               }
+       },
+       initRequired: function() {
+               // $reqLinesCheck
+               TBE_EDITOR.checkElements('required', true);
+
+               // $reqRangeCheck
+               TBE_EDITOR.checkElements('range', true);
+       },
+       setImage: function(name,image) {
+               var object;
+               if (document[name]) {
+                       object = document[name];
+               } else if (document.getElementById(name)) {
+                       object = document.getElementById(name);
+               }
+               if (object) {
+                       if (typeof image == 'object') {
+                               document[name].src = image.src;
+                       } else {
+                               document[name].src = eval(image+'.src');
+                       }
+               }
+       },
+       submitForm: function() {
+               if (TBE_EDITOR.doSaveFieldName) {
+                       document[TBE_EDITOR.formname][TBE_EDITOR.doSaveFieldName].value=1;
+               }
+               document[TBE_EDITOR.formname].submit();
+       },
+       split: function(theStr1, delim, index) {
+               var theStr = ""+theStr1;
+               var lengthOfDelim = delim.length;
+               sPos = -lengthOfDelim;
+               if (index<1) {index=1;}
+               for (var 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));
+       },
+       curSelected: function(theField) {
+               var fObjSel = document[TBE_EDITOR.formname][theField];
+               var retVal="";
+               if (fObjSel) {
+                       if (fObjSel.type=='select-multiple' || fObjSel.type=='select-one') {
+                               var l=fObjSel.length;
+                               for (a=0;a<l;a++) {
+                                       if (fObjSel.options[a].selected==1) {
+                                               retVal+=fObjSel.options[a].value+",";
+                                       }
+                               }
+                       }
+               }
+               return retVal;
+       },
+       rawurlencode: function(str,maxlen) {
+               var output = str;
+               if (maxlen)     output = output.substr(0,200);
+               output = encodeURIComponent(output);
+               return output;
+       },
+       str_replace: function(match,replace,string) {
+               var input = ''+string;
+               var matchStr = ''+match;
+               if (!matchStr) { return string; }
+               var output = '';
+               var pointer=0;
+               var pos = input.indexOf(matchStr);
+               while (pos!=-1) {
+                       output+=''+input.substr(pointer, pos-pointer)+replace;
+                       pointer=pos+matchStr.length;
+                       pos = input.indexOf(match,pos+1);
+               }
+               output+=''+input.substr(pointer);
+               return output;
+       },
+       toggle_display_states: function(id, state_1, state_2) {
+               var node = document.getElementById(id);
+               if (node) {
+                       switch (node.style.display) {
+                               case state_1:
+                                       node.style.display = state_2;
+                                       break;
+                               case state_2:
+                                       node.style.display = state_1;
+                                       break;
+                       }
+               }
+               return false;
+       },
+
+       /**
+        * Determines backend path to be used for e.g. ajax.php
+        * @return string
+        */
+       getBackendPath: function() {
+               var backendPath = '';
+               if (TYPO3) {
+                       if (TYPO3.configuration && TYPO3.configuration.PATH_typo3) {
+                               backendPath = TYPO3.configuration.PATH_typo3;
+                       } else if (TYPO3.settings && TYPO3.settings.PATH_typo3) {
+                               backendPath = TYPO3.settings.PATH_typo3;
+                       }
+               }
+               return backendPath;
+       }
+};
+
+function typoSetup     () {
+       this.passwordDummy = '********';
+       this.decimalSign = '.';
+}
+var TS = new typoSetup();
+var evalFunc = new evalFunc();
+
+// backwards compatibility for extensions
+var TBE_EDITOR_loginRefreshed = TBE_EDITOR.loginRefreshed;
+var TBE_EDITOR_checkLoginTimeout = TBE_EDITOR.checkLoginTimeout;
+var TBE_EDITOR_setHiddenContent = TBE_EDITOR.setHiddenContent;
+var TBE_EDITOR_isChanged = TBE_EDITOR.isChanged;
+var TBE_EDITOR_fieldChanged_fName = TBE_EDITOR.fieldChanged_fName;
+var TBE_EDITOR_fieldChanged = TBE_EDITOR.fieldChanged;
+var TBE_EDITOR_setOriginalFormFieldValue = TBE_EDITOR.setOriginalFormFieldValue;
+var TBE_EDITOR_isFormChanged = TBE_EDITOR.isFormChanged;
+var TBE_EDITOR_checkAndDoSubmit = TBE_EDITOR.checkAndDoSubmit;
+var TBE_EDITOR_checkSubmit = TBE_EDITOR.checkSubmit;
+var TBE_EDITOR_checkRange = TBE_EDITOR.checkRange;
+var TBE_EDITOR_initRequired = TBE_EDITOR.initRequired;
+var TBE_EDITOR_setImage = TBE_EDITOR.setImage;
+var TBE_EDITOR_submitForm = TBE_EDITOR.submitForm;
+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 = {
+       fieldSetNull: function(fieldName, isNull) {
+               if (document[TBE_EDITOR.formname][fieldName]) {
+                       var formFieldItemWrapper = Element.up(document[TBE_EDITOR.formname][fieldName], '.t3-form-field-item');
+
+                       if (isNull) {
+                               formFieldItemWrapper.addClassName('disabled');
+                       } else {
+                               formFieldItemWrapper.removeClassName('disabled');
+                       }
+               }
+       },
+       fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {
+               var i;
+
+               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[TBE_EDITOR.formname][theField+"_hr"].value="";
+                               if (document[TBE_EDITOR.formname][theField+"_cb"])      document[TBE_EDITOR.formname][theField+"_cb"].checked = "";
+                       } else {
+                               document[TBE_EDITOR.formname][theField+"_hr"].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[TBE_EDITOR.formname][theField+"_hr"].value);
+                       }
+                       typo3form.fieldSet(theField, evallist, is_in, checkbox, checkboxValue);
+               }
+       }
+};
+
+// backwards compatibility for extensions
+var typo3FormFieldSet = typo3form.fieldSet;
+var typo3FormFieldGet = typo3form.fieldGet;
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/md5.js b/typo3/sysext/backend/Resources/Public/JavaScript/md5.js
new file mode 100644 (file)
index 0000000..8ed0ad0
--- /dev/null
@@ -0,0 +1,207 @@
+/**
+*
+*  MD5 (Message-Digest Algorithm)
+*  http://www.webtoolkit.info/
+*
+**/
+
+function MD5(string) {
+
+       function RotateLeft(lValue, iShiftBits) {
+               return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
+       }
+
+       function AddUnsigned(lX,lY) {
+               var lX4,lY4,lX8,lY8,lResult;
+               lX8 = (lX & 0x80000000);
+               lY8 = (lY & 0x80000000);
+               lX4 = (lX & 0x40000000);
+               lY4 = (lY & 0x40000000);
+               lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
+               if (lX4 & lY4) {
+                       return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
+               }
+               if (lX4 | lY4) {
+                       if (lResult & 0x40000000) {
+                               return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
+                       } else {
+                               return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
+                       }
+               } else {
+                       return (lResult ^ lX8 ^ lY8);
+               }
+       }
+
+       function F(x,y,z) { return (x & y) | ((~x) & z); }
+       function G(x,y,z) { return (x & z) | (y & (~z)); }
+       function H(x,y,z) { return (x ^ y ^ z); }
+       function I(x,y,z) { return (y ^ (x | (~z))); }
+
+       function FF(a,b,c,d,x,s,ac) {
+               a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
+               return AddUnsigned(RotateLeft(a, s), b);
+       };
+
+       function GG(a,b,c,d,x,s,ac) {
+               a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
+               return AddUnsigned(RotateLeft(a, s), b);
+       };
+
+       function HH(a,b,c,d,x,s,ac) {
+               a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
+               return AddUnsigned(RotateLeft(a, s), b);
+       };
+
+       function II(a,b,c,d,x,s,ac) {
+               a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
+               return AddUnsigned(RotateLeft(a, s), b);
+       };
+
+       function ConvertToWordArray(string) {
+               var lWordCount;
+               var lMessageLength = string.length;
+               var lNumberOfWords_temp1=lMessageLength + 8;
+               var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
+               var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
+               var lWordArray=Array(lNumberOfWords-1);
+               var lBytePosition = 0;
+               var lByteCount = 0;
+               while ( lByteCount < lMessageLength ) {
+                       lWordCount = (lByteCount-(lByteCount % 4))/4;
+                       lBytePosition = (lByteCount % 4)*8;
+                       lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
+                       lByteCount++;
+               }
+               lWordCount = (lByteCount-(lByteCount % 4))/4;
+               lBytePosition = (lByteCount % 4)*8;
+               lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
+               lWordArray[lNumberOfWords-2] = lMessageLength<<3;
+               lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
+               return lWordArray;
+       };
+
+       function WordToHex(lValue) {
+               var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
+               for (lCount = 0;lCount<=3;lCount++) {
+                       lByte = (lValue>>>(lCount*8)) & 255;
+                       WordToHexValue_temp = "0" + lByte.toString(16);
+                       WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
+               }
+               return WordToHexValue;
+       };
+
+       function Utf8Encode(string) {
+               string = string.replace(/\r\n/g,"\n");
+               var utftext = "";
+
+               for (var n = 0; n < string.length; n++) {
+
+                       var c = string.charCodeAt(n);
+
+                       if (c < 128) {
+                               utftext += String.fromCharCode(c);
+                       }
+                       else if((c > 127) && (c < 2048)) {
+                               utftext += String.fromCharCode((c >> 6) | 192);
+                               utftext += String.fromCharCode((c & 63) | 128);
+                       }
+                       else {
+                               utftext += String.fromCharCode((c >> 12) | 224);
+                               utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+                               utftext += String.fromCharCode((c & 63) | 128);
+                       }
+
+               }
+
+               return utftext;
+       };
+
+       var x=Array();
+       var k,AA,BB,CC,DD,a,b,c,d;
+       var S11=7, S12=12, S13=17, S14=22;
+       var S21=5, S22=9 , S23=14, S24=20;
+       var S31=4, S32=11, S33=16, S34=23;
+       var S41=6, S42=10, S43=15, S44=21;
+
+       string = Utf8Encode(string);
+
+       x = ConvertToWordArray(string);
+
+       a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
+
+       for (k=0;k<x.length;k+=16) {
+               AA=a; BB=b; CC=c; DD=d;
+               a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
+               d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
+               c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
+               b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
+               a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
+               d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
+               c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
+               b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
+               a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
+               d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
+               c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
+               b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
+               a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
+               d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
+               c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
+               b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
+               a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
+               d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
+               c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
+               b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
+               a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
+               d=GG(d,a,b,c,x[k+10],S22,0x2441453);
+               c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
+               b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
+               a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
+               d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
+               c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
+               b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
+               a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
+               d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
+               c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
+               b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
+               a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
+               d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
+               c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
+               b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
+               a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
+               d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
+               c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
+               b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
+               a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
+               d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
+               c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
+               b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
+               a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
+               d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
+               c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
+               b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
+               a=II(a,b,c,d,x[k+0], S41,0xF4292244);
+               d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
+               c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
+               b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
+               a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
+               d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
+               c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
+               b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
+               a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
+               d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
+               c=II(c,d,a,b,x[k+6], S43,0xA3014314);
+               b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
+               a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
+               d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
+               c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
+               b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
+               a=AddUnsigned(a,AA);
+               b=AddUnsigned(b,BB);
+               c=AddUnsigned(c,CC);
+               d=AddUnsigned(d,DD);
+       }
+
+       var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
+
+       return temp.toLowerCase();
+}
\ No newline at end of file
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tab.js b/typo3/sysext/backend/Resources/Public/JavaScript/tab.js
new file mode 100644 (file)
index 0000000..145fab9
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * This code has been copied from Project_CMS
+ * Copyright (c) 2005 by Phillip Berndt (www.pberndt.com)
+ *
+ * Extended Textarea for IE and Firefox browsers
+ * Features:
+ *  - Possibility to place tabs in <textarea> elements using a simply <TAB> key
+ *  - Auto-indenting of new lines
+ *
+ * License: GNU General Public License
+ */
+
+function checkBrowser() {
+       browserName = navigator.appName;
+       browserVer = parseInt(navigator.appVersion);
+
+       ok = false;
+       if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {
+               ok = true;
+       } else if (browserName == "Netscape" && browserVer >= 3) {
+               ok = true;
+       }
+
+       return ok;
+}
+
+       // Automatically change all textarea elements
+function changeTextareaElements() {
+       if (!checkBrowser()) {
+                       // Stop unless we're using IE or Netscape (includes Mozilla family)
+               return false;
+       }
+
+       document.textAreas = document.getElementsByTagName("textarea");
+
+       for (i = 0; i < document.textAreas.length; i++) {
+                       // Only change if the class parameter contains "enable-tab"
+               if (document.textAreas[i].className && document.textAreas[i].className.search(/(^| )enable-tab( |$)/) != -1) {
+                       document.textAreas[i].textAreaID = i;
+                       makeAdvancedTextArea(document.textAreas[i]);
+               }
+       }
+}
+
+       // Wait until the document is completely loaded.
+       // Set a timeout instead of using the onLoad() event because it could be used by something else already.
+window.setTimeout("changeTextareaElements();", 200);
+
+       // Turn textarea elements into "better" ones. Actually this is just adding some lines of JavaScript...
+function makeAdvancedTextArea(textArea) {
+       if (textArea.tagName.toLowerCase() != "textarea") {
+               return false;
+       }
+
+               // On attempt to leave the element:
+               // Do not leave if this.dontLeave is true
+       textArea.onblur = function(e) {
+               if (!this.dontLeave) {
+                       return;
+               }
+               this.dontLeave = null;
+               window.setTimeout("document.textAreas[" + this.textAreaID + "].restoreFocus()", 1);
+               return false;
+       }
+
+               // Set the focus back to the element and move the cursor to the correct position.
+       textArea.restoreFocus = function() {
+               this.focus();
+
+               if (this.caretPos) {
+                       this.caretPos.collapse(false);
+                       this.caretPos.select();
+               }
+       }
+
+               // Determine the current cursor position
+       textArea.getCursorPos = function() {
+               if (this.selectionStart) {
+                       currPos = this.selectionStart;
+               } else if (this.caretPos) {     // This is very tricky in IE :-(
+                       oldText = this.caretPos.text;
+                       finder = "--getcurrpos" + Math.round(Math.random() * 10000) + "--";
+                       this.caretPos.text += finder;
+                       currPos = this.value.indexOf(finder);
+
+                       this.caretPos.moveStart('character', -finder.length);
+                       this.caretPos.text = "";
+
+                       this.caretPos.scrollIntoView(true);
+               } else {
+                       return;
+               }
+
+               return currPos;
+       }
+
+               // On tab, insert a tabulator. Otherwise, check if a slash (/) was pressed.
+       textArea.onkeydown = function(e) {
+               if (this.selectionStart == null &! this.createTextRange) {
+                       return;
+               }
+               if (!e) {
+                       e = window.event;
+               }
+
+                       // Tabulator
+               if (e.keyCode == 9) {
+                       this.dontLeave = true;
+                       this.textInsert(String.fromCharCode(9));
+               }
+
+                       // Newline
+               if (e.keyCode == 13) {
+                               // Get the cursor position
+                       currPos = this.getCursorPos();
+
+                               // Search the last line
+                       lastLine = "";
+                       for (i = currPos - 1; i >= 0; i--) {
+                               if(this.value.substring(i, i + 1) == '\n') {
+                                       break;
+                               }
+                       }
+                       lastLine = this.value.substring(i + 1, currPos);
+
+                               // Search for whitespaces in the current line
+                       whiteSpace = "";
+                       for (i = 0; i < lastLine.length; i++) {
+                               if (lastLine.substring(i, i + 1) == '\t') {
+                                       whiteSpace += "\t";
+                               } else if (lastLine.substring(i, i + 1) == ' ') {
+                                       whiteSpace += " ";
+                               } else {
+                                       break;
+                               }
+                       }
+
+                               // Another ugly IE hack
+                       if (navigator.appVersion.match(/MSIE/)) {
+                               whiteSpace = "\\n" + whiteSpace;
+                       }
+
+                               // Insert whitespaces
+                       window.setTimeout("document.textAreas["+this.textAreaID+"].textInsert(\""+whiteSpace+"\");", 1);
+               }
+       }
+
+               // Save the current cursor position in IE
+       textArea.onkeyup = textArea.onclick = textArea.onselect = function(e) {
+               if (this.createTextRange) {
+                       this.caretPos = document.selection.createRange().duplicate();
+               }
+       }
+
+               // Insert text at the current cursor position
+       textArea.textInsert = function(insertText) {
+               if (this.selectionStart != null) {
+                       var savedScrollTop = this.scrollTop;
+                       var begin = this.selectionStart;
+                       var end = this.selectionEnd;
+                       if (end > begin + 1) {
+                               this.value = this.value.substr(0, begin) + insertText + this.value.substr(end);
+                       } else {
+                               this.value = this.value.substr(0, begin) + insertText + this.value.substr(begin);
+                       }
+
+                       this.selectionStart = begin + insertText.length;
+                       this.selectionEnd = begin + insertText.length;
+                       this.scrollTop = savedScrollTop;
+               } else if (this.caretPos) {
+                       this.caretPos.text = insertText;
+                       this.caretPos.scrollIntoView(true);
+               } else {
+                       text.value += insertText;
+               }
+
+               this.focus();
+       }
+}
\ No newline at end of file
index 0c425a8..3c66a80 100644 (file)
@@ -1530,8 +1530,8 @@ class QueryGenerator {
                $out = '';
                if ($this->extJSCODE) {
                        $out .= '
-                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/jsfunc.evalfield.js"></script>
-                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'jsfunc.tbe_editor.js"></script>
+                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js"></script>
+                       <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'sysext/backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js"></script>
                        <script language="javascript" type="text/javascript">
                                TBE_EDITOR.formname = "' . $formname . '";
                                TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
index d1c5c4d..4629a7b 100644 (file)
@@ -289,7 +289,7 @@ class AdminPanelView {
 <a id="TSFE_ADMIN"></a>
 <form id="TSFE_ADMIN_PANEL_FORM" name="TSFE_ADMIN_PANEL_FORM" action="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . '#TSFE_ADMIN" method="get" onsubmit="document.forms.TSFE_ADMIN_PANEL_FORM[\'TSFE_ADMIN_PANEL[DUMMY]\'].value=Math.random().toString().substring(2,8)">' . $query . '<table class="typo3-adminPanel">' . $header . $moduleContent . $footer . '</table></form>';
                if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['display_top']) {
-                       $out .= '<script type="text/javascript" src="typo3/js/jsfunc.evalfield.js"></script>';
+                       $out .= '<script type="text/javascript" src="typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.evalfield.js"></script>';
                        $out .= '<script type="text/javascript">/*<![CDATA[*/' . \TYPO3\CMS\Core\Utility\GeneralUtility::minifyJavaScript('
                                var evalFunc = new evalFunc();
                                        // TSFEtypo3FormFieldSet()
index 88c7d97..69ba188 100644 (file)
@@ -330,7 +330,7 @@ class SetupModuleController {
                        \TYPO3\CMS\Backend\Utility\BackendUtility::setUpdateSignal('updatePageTree');
                }
                // Start page:
-               $this->doc->loadJavascriptLib('md5.js');
+               $this->doc->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
                // Use a wrapper div
                $this->content .= '<div id="user-setup-wrapper">';
                // Load available backend modules
index 2d084a7..71d7567 100644 (file)
@@ -68,7 +68,7 @@ class LoginFormHook {
                $content = '';
                if ($pObj->loginSecurityLevel == 'superchallenged' || $pObj->loginSecurityLevel == 'challenged') {
                        $content = '
-                               <script type="text/javascript" src="md5.js"></script>
+                               <script type="text/javascript" src="sysext/backend/Resources/Public/JavaScript/md5.js"></script>
                                ' . $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
                                        function doChallengeResponse(superchallenged) { //
                                                password = document.loginform.p_field.value;
index de0e383..eec27c2 100644 (file)
@@ -29,7 +29,7 @@
                </div>
        </div>
        <script type="text/javascript" src="sysext/t3skin/Resources/Public/JavaScript/login.js"></script>
-       <script type="text/javascript" src="jsfunc.placeholder.js"></script>
+       <script type="text/javascript" src="sysext/backend/Resources/Public/JavaScript/jsfunc.placeholder.js"></script>
 
        ###NEWS###
 
diff --git a/typo3/tab.js b/typo3/tab.js
deleted file mode 100644 (file)
index 145fab9..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * This code has been copied from Project_CMS
- * Copyright (c) 2005 by Phillip Berndt (www.pberndt.com)
- *
- * Extended Textarea for IE and Firefox browsers
- * Features:
- *  - Possibility to place tabs in <textarea> elements using a simply <TAB> key
- *  - Auto-indenting of new lines
- *
- * License: GNU General Public License
- */
-
-function checkBrowser() {
-       browserName = navigator.appName;
-       browserVer = parseInt(navigator.appVersion);
-
-       ok = false;
-       if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) {
-               ok = true;
-       } else if (browserName == "Netscape" && browserVer >= 3) {
-               ok = true;
-       }
-
-       return ok;
-}
-
-       // Automatically change all textarea elements
-function changeTextareaElements() {
-       if (!checkBrowser()) {
-                       // Stop unless we're using IE or Netscape (includes Mozilla family)
-               return false;
-       }
-
-       document.textAreas = document.getElementsByTagName("textarea");
-
-       for (i = 0; i < document.textAreas.length; i++) {
-                       // Only change if the class parameter contains "enable-tab"
-               if (document.textAreas[i].className && document.textAreas[i].className.search(/(^| )enable-tab( |$)/) != -1) {
-                       document.textAreas[i].textAreaID = i;
-                       makeAdvancedTextArea(document.textAreas[i]);
-               }
-       }
-}
-
-       // Wait until the document is completely loaded.
-       // Set a timeout instead of using the onLoad() event because it could be used by something else already.
-window.setTimeout("changeTextareaElements();", 200);
-
-       // Turn textarea elements into "better" ones. Actually this is just adding some lines of JavaScript...
-function makeAdvancedTextArea(textArea) {
-       if (textArea.tagName.toLowerCase() != "textarea") {
-               return false;
-       }
-
-               // On attempt to leave the element:
-               // Do not leave if this.dontLeave is true
-       textArea.onblur = function(e) {
-               if (!this.dontLeave) {
-                       return;
-               }
-               this.dontLeave = null;
-               window.setTimeout("document.textAreas[" + this.textAreaID + "].restoreFocus()", 1);
-               return false;
-       }
-
-               // Set the focus back to the element and move the cursor to the correct position.
-       textArea.restoreFocus = function() {
-               this.focus();
-
-               if (this.caretPos) {
-                       this.caretPos.collapse(false);
-                       this.caretPos.select();
-               }
-       }
-
-               // Determine the current cursor position
-       textArea.getCursorPos = function() {
-               if (this.selectionStart) {
-                       currPos = this.selectionStart;
-               } else if (this.caretPos) {     // This is very tricky in IE :-(
-                       oldText = this.caretPos.text;
-                       finder = "--getcurrpos" + Math.round(Math.random() * 10000) + "--";
-                       this.caretPos.text += finder;
-                       currPos = this.value.indexOf(finder);
-
-                       this.caretPos.moveStart('character', -finder.length);
-                       this.caretPos.text = "";
-
-                       this.caretPos.scrollIntoView(true);
-               } else {
-                       return;
-               }
-
-               return currPos;
-       }
-
-               // On tab, insert a tabulator. Otherwise, check if a slash (/) was pressed.
-       textArea.onkeydown = function(e) {
-               if (this.selectionStart == null &! this.createTextRange) {
-                       return;
-               }
-               if (!e) {
-                       e = window.event;
-               }
-
-                       // Tabulator
-               if (e.keyCode == 9) {
-                       this.dontLeave = true;
-                       this.textInsert(String.fromCharCode(9));
-               }
-
-                       // Newline
-               if (e.keyCode == 13) {
-                               // Get the cursor position
-                       currPos = this.getCursorPos();
-
-                               // Search the last line
-                       lastLine = "";
-                       for (i = currPos - 1; i >= 0; i--) {
-                               if(this.value.substring(i, i + 1) == '\n') {
-                                       break;
-                               }
-                       }
-                       lastLine = this.value.substring(i + 1, currPos);
-
-                               // Search for whitespaces in the current line
-                       whiteSpace = "";
-                       for (i = 0; i < lastLine.length; i++) {
-                               if (lastLine.substring(i, i + 1) == '\t') {
-                                       whiteSpace += "\t";
-                               } else if (lastLine.substring(i, i + 1) == ' ') {
-                                       whiteSpace += " ";
-                               } else {
-                                       break;
-                               }
-                       }
-
-                               // Another ugly IE hack
-                       if (navigator.appVersion.match(/MSIE/)) {
-                               whiteSpace = "\\n" + whiteSpace;
-                       }
-
-                               // Insert whitespaces
-                       window.setTimeout("document.textAreas["+this.textAreaID+"].textInsert(\""+whiteSpace+"\");", 1);
-               }
-       }
-
-               // Save the current cursor position in IE
-       textArea.onkeyup = textArea.onclick = textArea.onselect = function(e) {
-               if (this.createTextRange) {
-                       this.caretPos = document.selection.createRange().duplicate();
-               }
-       }
-
-               // Insert text at the current cursor position
-       textArea.textInsert = function(insertText) {
-               if (this.selectionStart != null) {
-                       var savedScrollTop = this.scrollTop;
-                       var begin = this.selectionStart;
-                       var end = this.selectionEnd;
-                       if (end > begin + 1) {
-                               this.value = this.value.substr(0, begin) + insertText + this.value.substr(end);
-                       } else {
-                               this.value = this.value.substr(0, begin) + insertText + this.value.substr(begin);
-                       }
-
-                       this.selectionStart = begin + insertText.length;
-                       this.selectionEnd = begin + insertText.length;
-                       this.scrollTop = savedScrollTop;
-               } else if (this.caretPos) {
-                       this.caretPos.text = insertText;
-                       this.caretPos.scrollIntoView(true);
-               } else {
-                       text.value += insertText;
-               }
-
-               this.focus();
-       }
-}
\ No newline at end of file