* rewrote TBE_EDITOR Javascript functions to use JS "objects"
authorSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Tue, 9 Jan 2007 12:55:52 +0000 (12:55 +0000)
committerSebastian Kurfürst <sebastian.kurfuerst@typo3.org>
Tue, 9 Jan 2007 12:55:52 +0000 (12:55 +0000)
and outsourced them to an external file
        * !!! Removed the variables TBE_EDITOR_isChanged and
TBE_EDITOR_loadTime in TBE_EDITOR javascript
        * change in getRecordTitle: a too long title is wrapped in a
<span title="..."> tag to show a tooltip

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1899 709f56b5-9817-0410-a4d7-c38de5d9e867

15 files changed:
ChangeLog
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_db.php
t3lib/class.t3lib_querygenerator.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tceforms_inline.php
t3lib/class.t3lib_tstemplate.php
t3lib/jsfunc.inline.js
typo3/alt_doc.php
typo3/jsfunc.tbe_editor.js [new file with mode: 0644]
typo3/mod/user/ws/workspaceforms.php
typo3/sysext/cms/layout/db_layout.php
typo3/sysext/cms/tslib/class.tslib_content.php
typo3/template.php
typo3/wizard_rte.php

index f5b1873..6ddc1ee 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-09  Sebastian Kurfuerst  <sebastian@typo3.org> (Thanks to Oliver Hader)
+
+       * rewrote TBE_EDITOR Javascript functions to use JS "objects" and outsourced them to an external file
+       * !!! Removed the variables TBE_EDITOR_isChanged and TBE_EDITOR_loadTime in TBE_EDITOR javascript
+       * change in getRecordTitle: a too long title is wrapped in a <span title="..."> tag to show a tooltip
+
 2007-01-03  Thorsten Kahler  <thorsten.kahler@dkd.de>
 
        * Fixed bug 931: Typolink to a page with certain type doesn't work if type is zero
index b8e8a33..ee5fdb0 100755 (executable)
@@ -1851,8 +1851,16 @@ class t3lib_BEfunc       {
 
                                // If the current result is empty, set it to '[No title]' (localized) and prepare for output if requested
                        if ($prep || $forceResult)      {
-                               if (!strcmp(trim($t),''))       $t='['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']';
-                               if ($prep)      $t = '<em>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($t,$GLOBALS['BE_USER']->uc['titleLen'])).'</em>';                          
+                               if ($prep) {
+                                       $tOrig = htmlspecialchars($t);
+                                       $t = htmlspecialchars(t3lib_div::fixed_lgd_cs($t,$GLOBALS['BE_USER']->uc['titleLen']));
+                                       if ($tOrig != $t) {
+                                               $t = '<span title="'.$tOrig.'">'.$t.'</span>';
+                                       }
+                               }
+                               if (!strcmp(trim($t),'')) {
+                                       $t = t3lib_BEfunc::getNoRecordTitle($prep);
+                               }
                        }
 
                        return $t;
@@ -1860,6 +1868,18 @@ class t3lib_BEfunc       {
        }
 
        /**
+        * Get a localized [No title] string, wrapped in <em>|</em> if $prep is true.
+        *
+        * @param       boolean         $prep: Wrap result in <em>|</em>
+        * @return      string          Localized [No title] string
+        */
+       function getNoRecordTitle($prep=FALSE) {
+               $noTitle = '['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']';
+               if ($prep) $noTitle = '<em>'.$noTitle.'</em>';
+               return $noTitle;
+       }
+
+       /**
         * Returns a human readable output of a value from a record
         * For instance a database record relation would be looked up to display the title-value of that record. A checkbox with a "1" value would be "Yes", etc.
         * $table/$col is tablename and fieldname
index 4422bf9..a2e5fb9 100755 (executable)
@@ -854,6 +854,26 @@ class t3lib_DB {
        }
 
        /**
+        * Returns some information about actions that were performed
+        * after an UPDATE or DELETE query was sent to the database.
+        * All keys of the array are lowercased and whitspaces are removed.
+        * The returned array looks like this:
+        * Array('rowsmatched' => 1, 'changed' => 1, 'warnings' => 0)
+        *
+        * @return      array           And accociative array with information about the performed actions.
+        */
+       function sql_info() {
+               $info = array();
+               $sql_info = strtolower(mysql_info($this->link));
+               while (preg_match('/(\w[\w\s]+):\s+(\d+)\s*/', $sql_info, $matches)) {
+                       $sql_info = str_replace($matches[0], '', $sql_info);
+                       $matches[1] = str_replace(' ', '', $matches[1]);
+                       $info[$matches[1]] = $matches[2];
+               }
+               return $info;
+       }
+
+       /**
         * Move internal result pointer
         * mysql_data_seek() wrapper function
         * Usage count/core: 3
index a4d580d..7ebc3c0 100755 (executable)
@@ -627,13 +627,13 @@ class t3lib_queryGenerator        {
                                        $lineHTML.='<input type="checkbox"'.($conf['negate']?' checked':'').' name="'.$this->name.$subscript.'[negate]'.'" onClick="submit();">';
 
                                        if ($conf['comparison']==100 || $conf['comparison']==101)       {       // between
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue1]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue1']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue1']).'" name="'.$this->name.$subscript.'[inputValue1]'.'">';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue]", '.date.', "", 0,0);';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue1]", '.date.', "", 0,0);';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue1]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue1']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue1']).'" name="'.$this->name.$subscript.'[inputValue1]'.'">';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", '.date.', "", 0,0);';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue1]", '.date.', "", 0,0);';
                                        } else {
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue]", '.date.', "", 0,0);';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", '.date.', "", 0,0);';
                                        }
                                break;
                                case 'time':
@@ -642,13 +642,13 @@ class t3lib_queryGenerator        {
 
                                        $lineHTML.='<input type="checkbox"'.($conf['negate']?' checked':'').' name="'.$this->name.$subscript.'[negate]'.'" onClick="submit();">';
                                        if ($conf['comparison']==100 || $conf['comparison']==101)       {       // between:
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue1]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue1']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue1']).'" name="'.$this->name.$subscript.'[inputValue1]'.'">';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue]", '.datetime.', "", 0,0);';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue1]", '.datetime.', "", 0,0);';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue1]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue1']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue1]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue1']).'" name="'.$this->name.$subscript.'[inputValue1]'.'">';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", '.datetime.', "", 0,0);';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue1]", '.datetime.', "", 0,0);';
                                        } else {
-                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3FormFieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
-                                               $this->extJSCODE.='typo3FormFieldSet("'.$this->name.$subscript.'[inputValue]", '.datetime.', "", 0,0);';
+                                               $lineHTML.='<input type="text" name="'.$this->name.$subscript.'[inputValue]_hr'.'" value="'.strftime('%H:%M %e-%m-%Y', $conf['inputValue']).'" '.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' onChange="typo3form.fieldGet(\''.$this->name.$subscript.'[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="'.htmlspecialchars($conf['inputValue']).'" name="'.$this->name.$subscript.'[inputValue]'.'">';
+                                               $this->extJSCODE.='typo3form.fieldSet("'.$this->name.$subscript.'[inputValue]", '.datetime.', "", 0,0);';
                                        }
                                break;
                                case 'multiple':
@@ -1505,36 +1505,7 @@ class t3lib_queryGenerator       {
                if ($this->extJSCODE)   {
                        $out.='
                        <script language="javascript" type="text/javascript" src="'.$GLOBALS['BACK_PATH'].'../t3lib/jsfunc.evalfield.js"></script>
-                       <script language="javascript" type="text/javascript">
-                               var evalFunc = new evalFunc;
-                               function typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)  {
-                                       var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
-                                       var theValue = document.'.$formname.'[theField].value;
-                                       if (checkbox && theValue==checkboxValue)        {
-                                               document.'.$formname.'[theField+"_hr"].value="";
-                                               if (document.'.$formname.'[theField+"_cb"])     document.'.$formname.'[theField+"_cb"].checked = "";
-                                       } else {
-                                               document.'.$formname.'[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
-                                               if (document.'.$formname.'[theField+"_cb"])     document.'.$formname.'[theField+"_cb"].checked = "on";
-                                       }
-                               }
-
-       /**
-        * [Describe function...]
-        *
-        * @param       [type]          $theField, evallist, is_in, checkbox, checkboxValue, checkbox_off: ...
-        * @return      [type]          ...
-        */
-                               function typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)    {
-                                       var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
-                                       if (checkbox_off)       {
-                                               document.'.$formname.'[theField].value=checkboxValue;
-                                       }else{
-                                               document.'.$formname.'[theField].value = evalFunc.evalObjValue(theFObj, document.'.$formname.'[theField+"_hr"].value);
-                                       }
-                                       typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
-                               }
-                       </script>
+                       <script language="javascript" type="text/javascript" src="'.$GLOBALS['BACK_PATH'].'jsfunc.tbe_editor.js"></script>
                        <script language="javascript" type="text/javascript">'.$this->extJSCODE.'</script>';
                        return $out;
                }
index 699e128..41bd919 100755 (executable)
@@ -804,9 +804,9 @@ class t3lib_TCEforms        {
                                        ($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) ||
                                        ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) {
                                        if($GLOBALS['BE_USER']->jsConfirmation(1))      {
-                                               $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };';
+                                               $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                        } else {
-                                               $alertMsgOnChange = 'if (TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };';
+                                               $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                        }
                                } else {
                                        $alertMsgOnChange = '';
@@ -835,7 +835,7 @@ class t3lib_TCEforms        {
                                        $PA['label'] = $this->sL($PA['label']);
                                                // JavaScript code for event handlers:
                                        $PA['fieldChangeFunc']=array();
-                                       $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR_fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');";
+                                       $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR.fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');";
                                        $PA['fieldChangeFunc']['alert']=$alertMsgOnChange;
                                                // if this is the child of an inline type and it is the field creating the label
                                        if ($this->inline->isInlineChildAndLabelField($table, $field)) {
@@ -1029,16 +1029,16 @@ class t3lib_TCEforms    {
                        $checkSetValue = in_array('date',$evalList) ? $thisMidnight : '';
                        $checkSetValue = in_array('datetime',$evalList) ? time() : $checkSetValue;
 
-                       $cOnClick = 'typo3FormFieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
+                       $cOnClick = 'typo3form.fieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
                        $item.='<input type="checkbox"'.$this->insertDefStyle('check').' name="'.$PA['itemFormElName'].'_cb" onclick="'.htmlspecialchars($cOnClick).'" />';
                }
 
-               $PA['fieldChangeFunc'] = array_merge(array('typo3FormFieldGet'=>'typo3FormFieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
+               $PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
                $mLgd = ($config['max']?$config['max']:256);
                $iOnChange = implode('',$PA['fieldChangeFunc']);
                $item.='<input type="text" name="'.$PA['itemFormElName'].'_hr" value=""'.$this->formWidth($size).' maxlength="'.$mLgd.'" onchange="'.htmlspecialchars($iOnChange).'"'.$PA['onFocus'].' />';     // This is the EDITABLE form field.
                $item.='<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';                 // This is the ACTUAL form field - values from the EDITABLE field must be transferred to this field which is the one that is written to the database.
-               $this->extJSCODE.='typo3FormFieldSet('.$paramsList.');';
+               $this->extJSCODE.='typo3form.fieldSet('.$paramsList.');';
 
                        // going through all custom evaluations configured for this field
                foreach ($evalList as $evalData) {
@@ -2247,9 +2247,9 @@ class t3lib_TCEforms      {
                $pct = round(100/count($sArr));
                foreach($sArr as $sKey => $sheetCfg)    {
                        if ($GLOBALS['BE_USER']->jsConfirmation(1))     {
-                               $onClick = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm()};";
+                               $onClick = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){'.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR.submitForm()};";
                        } else {
-                               $onClick = 'if(TBE_EDITOR_checkSubmit(-1)){ '.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR_submitForm();}";
+                               $onClick = 'if(TBE_EDITOR.checkSubmit(-1)){ '.$this->elName($elName).".value='".$sKey."'; TBE_EDITOR.submitForm();}";
                        }
 
 
@@ -2412,9 +2412,9 @@ class t3lib_TCEforms      {
                                                                        ($GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key,$GLOBALS['TCA'][$table]['ctrl']['type'])) ||
                                                                        ($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'],$key))) {
                                                                        if ($GLOBALS['BE_USER']->jsConfirmation(1))     {
-                                                                               $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };';
+                                                                               $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
                                                                        } else {
-                                                                               $alertMsgOnChange = 'if(TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm();}';
+                                                                               $alertMsgOnChange = 'if(TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}';
                                                                        }
                                                                } else {
                                                                        $alertMsgOnChange = '';
@@ -3298,7 +3298,7 @@ class t3lib_TCEforms      {
                                                                        // If "script" type, create the links around the icon:
                                                                if ((string)$wConf['type']=='script')   {
                                                                        $aUrl = $url.t3lib_div::implodeArrayForUrl('',array('P'=>$params));
-                                                                       $outArr[]='<a href="'.htmlspecialchars($aUrl).'" onclick="'.$this->blur().'return !TBE_EDITOR_isFormChanged();">'.
+                                                                       $outArr[]='<a href="'.htmlspecialchars($aUrl).'" onclick="'.$this->blur().'return !TBE_EDITOR.isFormChanged();">'.
                                                                                $icon.
                                                                                '</a>';
                                                                } else {
@@ -3312,11 +3312,11 @@ class t3lib_TCEforms    {
                                                                                case 'popup':
                                                                                case 'colorbox':
                                                                                                // Current form value is passed as P[currentValue]!
-                                                                                       $addJS = $wConf['popup_onlyOpenIfSelected']?'if (!TBE_EDITOR_curSelected(\''.$itemName.$listFlag.'\')){alert('.$GLOBALS['LANG']->JScharCode($this->getLL('m_noSelItemForEdit')).'); return false;}':'';
-                                                                                       $curSelectedValues='+\'&P[currentSelectedValues]=\'+TBE_EDITOR_curSelected(\''.$itemName.$listFlag.'\')';
+                                                                                       $addJS = $wConf['popup_onlyOpenIfSelected']?'if (!TBE_EDITOR.curSelected(\''.$itemName.$listFlag.'\')){alert('.$GLOBALS['LANG']->JScharCode($this->getLL('m_noSelItemForEdit')).'); return false;}':'';
+                                                                                       $curSelectedValues='+\'&P[currentSelectedValues]=\'+TBE_EDITOR.curSelected(\''.$itemName.$listFlag.'\')';
                                                                                        $aOnClick=      $this->blur().
                                                                                                                $addJS.
-                                                                                                               'vHWin=window.open(\''.$url.t3lib_div::implodeArrayForUrl('',array('P'=>$params)).'\'+\'&P[currentValue]=\'+TBE_EDITOR_rawurlencode('.$this->elName($itemName).'.value,200)'.$curSelectedValues.',\'popUp'.$md5ID.'\',\''.$wConf['JSopenParams'].'\');'.
+                                                                                                               'vHWin=window.open(\''.$url.t3lib_div::implodeArrayForUrl('',array('P'=>$params)).'\'+\'&P[currentValue]=\'+TBE_EDITOR.rawurlencode('.$this->elName($itemName).'.value,200)'.$curSelectedValues.',\'popUp'.$md5ID.'\',\''.$wConf['JSopenParams'].'\');'.
                                                                                                                'vHWin.focus();return false;';
                                                                                                // Setting "colorBoxLinks" - user LATER to wrap around the color box as well:
                                                                                        $colorBoxLinks = Array('<a href="#" onclick="'.htmlspecialchars($aOnClick).'">','</a>');
@@ -3497,7 +3497,7 @@ class t3lib_TCEforms      {
                $fieldL=array();
                if (!is_array($this->palFieldArr[$palette]))    {$this->palFieldArr[$palette]=array();}
                $palFieldN = is_array($this->palFieldArr[$palette]) ? count($this->palFieldArr[$palette]) : 0;
-               $palJSFunc = 'TBE_EDITOR_palUrl(\''.($table.':'.$row['uid'].':'.$palette).'\',\''.implode(',',$this->palFieldArr[$palette]).'\','.$palFieldN.',\''.$table.'\',\''.$row['uid'].'\',1);';
+               $palJSFunc = 'TBE_EDITOR.palUrl(\''.($table.':'.$row['uid'].':'.$palette).'\',\''.implode(',',$this->palFieldArr[$palette]).'\','.$palFieldN.',\''.$table.'\',\''.$row['uid'].'\',1);';
 
                $aOnClick = $this->blur().substr($palJSFunc,0,-3).'0);return false;';
 
@@ -4549,333 +4549,117 @@ class t3lib_TCEforms  {
         *
         *              Example use:
         *
-        *              $msg.='Distribution time (hh:mm dd-mm-yy):<br /><input type="text" name="send_mail_datetime_hr" onchange="typo3FormFieldGet(\'send_mail_datetime\', \'datetime\', \'\', 0,0);"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /><input type="hidden" value="'.time().'" name="send_mail_datetime" /><br />';
-        *              $this->extJSCODE.='typo3FormFieldSet("send_mail_datetime", "datetime", "", 0,0);';
+        *              $msg.='Distribution time (hh:mm dd-mm-yy):<br /><input type="text" name="send_mail_datetime_hr" onchange="typo3form.fieldGet(\'send_mail_datetime\', \'datetime\', \'\', 0,0);"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /><input type="hidden" value="'.time().'" name="send_mail_datetime" /><br />';
+        *              $this->extJSCODE.='typo3form.fieldSet("send_mail_datetime", "datetime", "", 0,0);';
         *
         *              ... and then include the result of this function after the form
         *
-        * @param       string          The identification of the form on the page.
-        * @return      string          A <script></script> section with JavaScript.
+        * @param       string          $formname: The identification of the form on the page.
+        * @param       boolean         $update: Just extend/update existing settings, e.g. for AJAX call
+        * @return      string          A section with JavaScript - if $update is false, embedded in <script></script>
         */
-       function JSbottom($formname='forms[0]') {
-                               // add JS needed for inline fields
-                       if ($this->inline->inlineCount > 0) {
-                               if (count($this->inline->inlineData)) {
-                                       $inlineData = 'inline.addToDataArray('.$this->inline->getJSON($this->inline->inlineData).');';
-                               }
-
-                               $out .= $this->inline->addJavaScript();
-                               $out .= t3lib_div::wrapJS('
-                                       inline.setPrependFormFieldNames("'.$this->inline->prependNaming.'");
-                                       inline.setNoTitleString("'.addslashes($this->noTitle('')).'");
-                                       '.$inlineData.'
-                               ');
+       function JSbottom($formname='forms[0]', $update = false)        {
+               $jsFile = array();
+               $elements = array();
+
+                       // required:
+               foreach ($this->requiredFields as $itemImgName => $itemName) {
+                       if (preg_match('/^(.+)\[((\w|\d|_)+)\]$/', $itemName, $match)) {
+                               $record = $match[1];
+                               $field = $match[2];
+                               $elements[$record][$field]['required'] = 1;
+                               $elements[$record][$field]['requiredImg'] = $itemImgName;
                        }
-
-                               // required
-                       $reqLines=array();
-                       $reqLinesCheck=array();
-                       $reqLinesSet=array();
-                       reset($this->requiredFields);
-                       while(list($itemImgName,$itemName)=each($this->requiredFields)) {
-                               $reqLines[]="                                   TBE_REQUIRED['".$itemName."']=1;";
-                               $reqLinesCheck[]="                                      if (!document.".$formname."['".$itemName."'].value)     {OK=0;}";
-                               $reqLinesSet[]="                                        if (!document.".$formname."['".$itemName."'].value)     {TBE_EDITOR_setImage('req_".$itemImgName."','TBE_EDITOR_req');}";
-                       }
-
-                       $reqRange=array();
-                       $reqRangeCheck=array();
-                       $reqRangeSet=array();
-                       reset($this->requiredElements);
-                       while(list($itemName,$range)=each($this->requiredElements))     {
-                               $reqRange[]="                                   TBE_RANGE['".$itemName."']=1;";
-                               $reqRange[]="                                   TBE_RANGE_lower['".$itemName."']=".$range[0].";";
-                               $reqRange[]="                                   TBE_RANGE_upper['".$itemName."']=".$range[1].";";
-                               $reqRangeCheck[]="                                      if (!TBE_EDITOR_checkRange(document.".$formname."['".$itemName."_list'],".$range[0].",".$range[1]."))   {OK=0;}";
-                               $reqRangeSet[]="                                        if (!TBE_EDITOR_checkRange(document.".$formname."['".$itemName."_list'],".$range[0].",".$range[1]."))   {TBE_EDITOR_setImage('req_".$range['imgName']."','TBE_EDITOR_req');}";
+               }
+                       // range:
+               foreach ($this->requiredElements as $itemName => $range) {
+                       if (preg_match('/^(.+)\[((\w|\d|_)+)\]$/', $itemName, $match)) {
+                               $record = $match[1];
+                               $field = $match[2];
+                               $elements[$record][$field]['range'] = array($range[0], $range[1]);
+                               $elements[$record][$field]['rangeImg'] = $range['imgName'];
                        }
+               }
 
-                       $this->TBE_EDITOR_fieldChanged_func='TBE_EDITOR_fieldChanged_fName(fName,formObj[fName+"_list"]);';
+               $this->TBE_EDITOR_fieldChanged_func='TBE_EDITOR.fieldChanged_fName(fName,formObj[fName+"_list"]);';
 
-                       if ($this->loadMD5_JS)  {
-                       $out.='
-                       <script type="text/javascript" src="'.$this->backPath.'md5.js"></script>';
+               if (!$update) {
+                       if ($this->loadMD5_JS) {
+                               $jsFile[] =     '<script type="text/javascript" src="'.$this->backPath.'md5.js"></script>';
                        }
-                       $out.='
-                       <script type="text/javascript" src="'.$this->backPath.'../t3lib/jsfunc.evalfield.js"></script>
-                       <script type="text/javascript">
-                               /*<![CDATA[*/
 
-                               var TBE_EDITOR_req=new Image();         TBE_EDITOR_req.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/required_h.gif','',1).'";
-                               var TBE_EDITOR_cm=new Image();          TBE_EDITOR_cm.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/content_client.gif','',1).'";
-                               var TBE_EDITOR_sel=new Image();         TBE_EDITOR_sel.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/content_selected.gif','',1).'";
-                               var TBE_EDITOR_clear=new Image();       TBE_EDITOR_clear.src = "'.$this->backPath.'clear.gif";
-                               var TBE_REQUIRED=new Array();
-'.implode(chr(10),$reqLines).'
-
-                               var TBE_RANGE=new Array();
-                               var TBE_RANGE_lower=new Array();
-                               var TBE_RANGE_upper=new Array();
-'.implode(chr(10),$reqRange).'
-
-                               // $this->additionalJS_post:
-'.implode(chr(10),$this->additionalJS_post).'
-
-                               var TBE_EDITOR_loadTime = 0;
-                               var TBE_EDITOR_isChanged = 0;
-
-                               function TBE_EDITOR_loginRefreshed()    {       //
-                                       var date = new Date();
-                                       TBE_EDITOR_loadTime = Math.floor(date.getTime()/1000);
-                                       if (top.busy && top.busy.loginRefreshed)        {top.busy.loginRefreshed();}
-                               }
-                               function TBE_EDITOR_checkLoginTimeout() {       //
-                                       var date = new Date();
-                                       var theTime = Math.floor(date.getTime()/1000);
-                                       if (theTime > TBE_EDITOR_loadTime+'.intval($GLOBALS['BE_USER']->auth_timeout_field).'-10)       {
-                                               return true;
-                                       }
-                               }
-                               function TBE_EDITOR_setHiddenContent(RTEcontent,theField)       {       //
-                                       document.'.$formname.'[theField].value = RTEcontent;
-                                       alert(document.'.$formname.'[theField].value);
-                               }
-                               function TBE_EDITOR_fieldChanged_fName(fName,el)        {       //
-                                       var idx='.(2+substr_count($this->prependFormFieldNames,'[')).';
-                                       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);
-                               }
-                               function TBE_EDITOR_fieldChanged(table,uid,field,el)    {       //
-                                       var theField = "'.$this->prependFormFieldNames.'["+table+"]["+uid+"]["+field+"]";
-                                       TBE_EDITOR_isChanged = 1;
-
-                                               // Set change image:
-                                       var imgObjName = "cm_"+table+"_"+uid+"_"+field;
-                                       TBE_EDITOR_setImage(imgObjName,"TBE_EDITOR_cm");
-
-                                               // Set change image
-                                       if (document.'.$formname.'[theField] && document.'.$formname.'[theField].type=="select-one" && document.'.$formname.'[theField+"_selIconVal"])  {
-                                               var imgObjName = "selIcon_"+table+"_"+uid+"_"+field+"_";
-                                               TBE_EDITOR_setImage(imgObjName+document.'.$formname.'[theField+"_selIconVal"].value,"TBE_EDITOR_clear");
-                                               document.'.$formname.'[theField+"_selIconVal"].value = document.'.$formname.'[theField].selectedIndex;
-                                               TBE_EDITOR_setImage(imgObjName+document.'.$formname.'[theField+"_selIconVal"].value,"TBE_EDITOR_sel");
-                                       }
-
-                                               // Set required flag:
-                                       var imgReqObjName = "req_"+table+"_"+uid+"_"+field;
-                                       if (TBE_REQUIRED[theField] && document.'.$formname.'[theField]) {
-                                               if (document.'.$formname.'[theField].value)     {
-                                                       TBE_EDITOR_setImage(imgReqObjName,"TBE_EDITOR_clear");
-                                               } else {
-                                                       TBE_EDITOR_setImage(imgReqObjName,"TBE_EDITOR_req");
-                                               }
-                                       }
-                                       if (TBE_RANGE[theField] && document.'.$formname.'[theField])    {
-                                               if (TBE_EDITOR_checkRange(document.'.$formname.'[theField+"_list"],TBE_RANGE_lower[theField],TBE_RANGE_upper[theField]))        {
-                                                       TBE_EDITOR_setImage(imgReqObjName,"TBE_EDITOR_clear");
-                                               } else {
-                                                       TBE_EDITOR_setImage(imgReqObjName,"TBE_EDITOR_req");
-                                               }
-                                       }
-                                       '.(!$this->isPalettedoc?'':'
-                                       TBE_EDITOR_setOriginalFormFieldValue(theField);
-                                       ').'
-                               }
-                               '.($this->isPalettedoc?'
-                               function TBE_EDITOR_setOriginalFormFieldValue(theField) {       //
-                                       if ('.$this->isPalettedoc.' && '.$this->isPalettedoc.'.document.'.$formname.' && '.$this->isPalettedoc.'.document.'.$formname.'[theField]) {
-                                               '.$this->isPalettedoc.'.document.'.$formname.'[theField].value = document.'.$formname.'[theField].value;
-                                       }
-                               }
-                               ':'').'
-                               function TBE_EDITOR_isFormChanged(noAlert)      {       //
-                                       if (TBE_EDITOR_isChanged && !noAlert && confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsChanged')).'))        {
-                                               return 0;
-                                       }
-                                       return TBE_EDITOR_isChanged;
-                               }
-                               function TBE_EDITOR_checkAndDoSubmit(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...)
-                                */
-                               function TBE_EDITOR_checkSubmit(sendAlert)      {       //
-                                       if (TBE_EDITOR_checkLoginTimeout() && confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_refresh_login')).'))       {
-                                               vHWin=window.open(\''.$this->backPath.'login_frameset.php?\',\'relogin\',\'height=300,width=400,status=0,menubar=0\');
-                                               vHWin.focus();
-                                               return false;
-                                       }
-                                       var OK=1;
-
-                                       // $this->additionalJS_post:
-'.implode(chr(10),$this->additionalJS_submit).'
+                       $jsFile[] = '<script type="text/javascript" src="'.$this->backPath.'prototype.js"></script>';
+                       $jsFile[] =     '<script type="text/javascript" src="'.$this->backPath.'../t3lib/jsfunc.evalfield.js"></script>';
+                       $jsFile[] =     '<script type="text/javascript" src="'.$this->backPath.'jsfunc.tbe_editor.js"></script>';
+
+                               // if IRRE fields were processed, add the JavaScript functions:
+                       if ($this->inline->inlineCount) {
+                               $jsFile[] = '<script src="'.$this->backPath.'scriptaculous/scriptaculous.js" type="text/javascript"></script>';
+                               $jsFile[] = '<script src="'.$this->backPath.'../t3lib/jsfunc.inline.js" type="text/javascript"></script>';
+                               $out .= '
+                               inline.setPrependFormFieldNames("'.$this->inline->prependNaming.'");
+                               inline.setNoTitleString("'.addslashes(t3lib_BEfunc::getNoRecordTitle(true)).'");
+                               ';
+                       }
 
-                                       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;
-                                               }
-                                       }
+                       $out .= '
+                       TBE_EDITOR.images.req.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/required_h.gif','',1).'";
+                       TBE_EDITOR.images.cm.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/content_client.gif','',1).'";
+                       TBE_EDITOR.images.sel.src = "'.t3lib_iconWorks::skinImg($this->backPath,'gfx/content_selected.gif','',1).'";
+                       TBE_EDITOR.images.clear.src = "'.$this->backPath.'clear.gif";
+
+                       TBE_EDITOR.auth_timeout_field = '.intval($GLOBALS['BE_USER']->auth_timeout_field).';
+                       TBE_EDITOR.formname = "'.$formname.'";
+                       TBE_EDITOR.formnameUENC = "'.rawurlencode($formname).'";
+                       TBE_EDITOR.backPath = "'.addslashes($this->backPath).'";
+                       TBE_EDITOR.prependFormFieldNames = "'.$this->prependFormFieldNames.'";
+                       TBE_EDITOR.prependFormFieldNamesUENC = "'.rawurlencode($this->prependFormFieldNames).'";
+                       TBE_EDITOR.prependFormFieldNamesCnt = '.substr_count($this->prependFormFieldNames,'[').';
+                       TBE_EDITOR.isPalettedoc = '.($this->isPalettedoc ? addslashes($this->isPalettedoc) : 'null').';
+                       TBE_EDITOR.doSaveFieldName = "'.($this->doSaveFieldName ? addslashes($this->doSaveFieldName) : '').'";
+                       TBE_EDITOR.labels.fieldsChanged = '.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsChanged')).';
+                       TBE_EDITOR.labels.fieldsMissing = '.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsMissing')).';
+                       TBE_EDITOR.labels.refresh_login = '.$GLOBALS['LANG']->JScharCode($this->getLL('m_refresh_login')).';
+                       TBE_EDITOR.labels.onChangeAlert = '.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).';
+                       evalFunc.USmode = '.($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat']?'1':'0').';
+                       ';
+               }
 
-'.implode(chr(10),$reqLinesCheck).'
-'.implode(chr(10),$reqRangeCheck).'
+                       // add JS required for inline fields
+               if (count($this->inline->inlineData)) {
+                       $out .= '
+                       inline.addToDataArray('.$this->inline->getJSON($this->inline->inlineData).');
+                       ';
+               }
+                       // elements which are required or have a range definition:
+               if (count($elements)) {
+                       $out .= '
+                       TBE_EDITOR.addElements('.$this->inline->getJSON($elements).');
+                       TBE_EDITOR.initRequired()
+                       ';
+               }
+                       // $this->additionalJS_post:
+               if ($this->additionalJS_submit) {
+                       $additionalJS_submit = implode('', $this->additionalJS_submit);
+                       $additionalJS_submit = str_replace("\r", '', $additionalJS_submit);
+                       $additionalJS_submit = str_replace("\n", '', $additionalJS_submit);
+                       $out .= '
+                       TBE_EDITOR.addActionChecks("submit", "'.addslashes($additionalJS_submit).'");
+                       ';
+               }
 
-                                       if (OK || sendAlert==-1)        {
-                                               return true;
-                                       } else {
-                                               if(sendAlert)   alert('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.fieldsMissing')).');
-                                               return false;
-                                       }
-                               }
-                               function TBE_EDITOR_checkRange(el,lower,upper)  {       //
-                                       if (el && el.length>=lower && el.length<=upper) {
-                                               return true;
-                                       } else {
-                                               return false;
-                                       }
-                               }
-                               function TBE_EDITOR_initRequired()      {       //
-'.implode(chr(10),$reqLinesSet).'
-'.implode(chr(10),$reqRangeSet).'
-                               }
-                               function TBE_EDITOR_setImage(name,imgName)      {       //
-                                       if (document[name]) {document[name].src = eval(imgName+".src");}
-                               }
-                               function TBE_EDITOR_submitForm()        {       //
-                                       '.($this->doSaveFieldName?'document.'.$this->formName."['".$this->doSaveFieldName."'].value=1;":'').'
-                                       document.'.$this->formName.'.submit();
-                               }
-                               function typoSetup      ()      {       //
-                                       this.passwordDummy = "********";
-                                       this.decimalSign = ".";
-                               }
-                               var TS = new typoSetup();
-                               var evalFunc = new evalFunc();
-                               evalFunc.USmode = '.($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat']?'1':'0').';
-
-                               function typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)  {       //
-                                       if (document.'.$formname.'[theField])   {
-                                               var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
-                                               var theValue = document.'.$formname.'[theField].value;
-                                               if (checkbox && theValue==checkboxValue)        {
-                                                       document.'.$formname.'[theField+"_hr"].value="";
-                                                       if (document.'.$formname.'[theField+"_cb"])     document.'.$formname.'[theField+"_cb"].checked = "";
-                                               } else {
-                                                       document.'.$formname.'[theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
-                                                       if (document.'.$formname.'[theField+"_cb"])     document.'.$formname.'[theField+"_cb"].checked = "on";
-                                               }
-                                       }
-                               }
-                               function typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off, checkSetValue)     {       //
-                                       if (document.'.$formname.'[theField])   {
-                                               var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);
-                                               if (checkbox_off)       {
-                                                       if (document.'.$formname.'[theField+"_cb"].checked)     {
-                                                               document.'.$formname.'[theField].value=checkSetValue;
-                                                       } else {
-                                                               document.'.$formname.'[theField].value=checkboxValue;
-                                                       }
-                                               }else{
-                                                       document.'.$formname.'[theField].value = evalFunc.evalObjValue(theFObj, document.'.$formname.'[theField+"_hr"].value);
-                                               }
-                                               typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue);
-                                       }
-                               }
-                               function TBE_EDITOR_split(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));
-                               }
-                               function TBE_EDITOR_palUrl(inData,fieldList,fieldNum,table,uid,isOnFocus) {             //
-                                       var url = "'.$this->backPath.'alt_palette.php?inData="+inData+"&formName='.rawurlencode($this->formName).'"+"&prependFormFieldNames='.rawurlencode($this->prependFormFieldNames).'";
-                                       var field = "";
-                                       var theField="";
-                                       for (var a=0; a<fieldNum;a++)   {
-                                               field = TBE_EDITOR_split(fieldList, ",", a+1);
-                                               theField = "'.$this->prependFormFieldNames.'["+table+"]["+uid+"]["+field+"]";
-                                               if (document.'.$formname.'[theField])           url+="&rec["+field+"]="+TBE_EDITOR_rawurlencode(document.'.$formname.'[theField].value);
-                                       }
-                                       if (top.topmenuFrame)   {
-                                               top.topmenuFrame.location.href = url+"&backRef="+(top.content.list_frame ? (top.content.list_frame.view_frame ? "top.content.list_frame.view_frame" : "top.content.list_frame") : "top.content");
-                                       } else if (!isOnFocus) {
-                                               var vHWin=window.open(url,"palette","height=300,width=200,status=0,menubar=0,scrollbars=1");
-                                               vHWin.focus();
-                                       }
-                               }
-                               function TBE_EDITOR_curSelected(theField)       {       //
-                                       var fObjSel = document.'.$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;
-                               }
-                               function TBE_EDITOR_rawurlencode(str,maxlen)    {       //
-                                       var output = str;
-                                       if (maxlen)     output = output.substr(0,200);
-                                       output = escape(output);
-                                       output = TBE_EDITOR_str_replace("*","%2A", output);
-                                       output = TBE_EDITOR_str_replace("+","%2B", output);
-                                       output = TBE_EDITOR_str_replace("/","%2F", output);
-                                       output = TBE_EDITOR_str_replace("@","%40", output);
-                                       return output;
-                               }
-                               function TBE_EDITOR_str_replace(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;
-                               }
-                               /*]]>*/
-                       </script>
-                       <script type="text/javascript">
-                               /*<![CDATA[*/
+               $out .= chr(10).implode(chr(10),$this->additionalJS_post).chr(10).$this->extJSCODE;
+               $out .= '
+                       TBE_EDITOR.loginRefreshed();
+               ';
 
-                               '.$this->extJSCODE.'
+                       // Regular direct output:
+               if (!$update) {
+                       $spacer = chr(10).chr(9);
+                       $out  = $spacer.implode($spacer, $jsFile).t3lib_div::wrapJS($out);
+               }
 
-                               TBE_EDITOR_initRequired();
-                               TBE_EDITOR_loginRefreshed();
-                               /*]]>*/
-                       </script>';
-                       return $out;
+               return $out;
        }
 
        /**
@@ -4885,6 +4669,7 @@ class t3lib_TCEforms      {
         * @return      string          JavaScript functions/code (NOT contained in a <script>-element)
         */
        function dbFileCon($formObj='document.forms[0]')        {
+                       // @TODO: Export this to an own file, it is more static than dynamic JavaScript -- olly
                $str='
 
                        // ***************
index fe5b07f..cf6771c 100755 (executable)
@@ -115,7 +115,6 @@ class t3lib_TCEforms_inline {
                $this->backPath =& $tceForms->backPath;
                $this->prependFormFieldNames =& $this->fObj->prependFormFieldNames;
                $this->prependCmdFieldNames =& $this->fObj->prependCmdFieldNames;
-               
                $this->inlineStyles['margin-right'] = '5';
        }
 
@@ -141,11 +140,13 @@ class t3lib_TCEforms_inline {
                $config = $PA['fieldConf']['config'];
                $foreign_table = $config['foreign_table'];
 
-               // @TODO: Minitems müssen unterstüzt werden und intInRange mit maxitems immer mindestens minItems
                $minitems = t3lib_div::intInRange($config['minitems'],0);
                $maxitems = t3lib_div::intInRange($config['maxitems'],0);
                if (!$maxitems) $maxitems=100000;
 
+                       // Register the required number of elements:
+               $this->fObj->requiredElements[$PA['itemFormElName']] = array($minitems,$maxitems,'imgName'=>$table.'_'.$row['uid'].'_'.$field);
+
                        // remember the page id (pid of record) where inline editing started first
                        // we need that pid for ajax calls, so that they would know where the action takes place on the page structure
                if (!isset($this->inlineFirstPid)) {
@@ -219,9 +220,9 @@ class t3lib_TCEforms_inline {
                $item .= '<div id="'.$nameObject.'">';
 
                        // define how to show the "Create new record" link - if there are more than maxitems, hide it
-               if (count($recordList) >= $maxitems || ($uniqueMax > 0 && count($recordList) >= $uniqueMax))
+               if (count($recordList) >= $maxitems || ($uniqueMax > 0 && count($recordList) >= $uniqueMax)) {
                        $config['inline']['inlineNewButtonStyle'] = 'display: none;';
-
+               }
                        // add the "Create new record" link before all child records
                if ($config['appearance']['newRecordLinkPosition'] != 'bottom') {
                        $item .= $this->getNewRecordLink($nameObject.'['.$foreign_table.']', $config);
@@ -246,7 +247,7 @@ class t3lib_TCEforms_inline {
                if (count($relationList) > 1 && $config['appearance']['useSortable'])
                        $this->addJavaScriptSortable($nameObject.'_records');
                        // publish the uids of the child records in the given order to the browser
-               $item .= '<input type="hidden" name="'.$nameForm.'" value="'.implode(',', $relationList).'" />';
+               $item .= '<input type="hidden" name="'.$nameForm.'" value="'.implode(',', $relationList).'" class="inlineRecord" />';
                        // close the wrap for all inline fields (container)
                $item .= '</div>';
 
@@ -319,7 +320,6 @@ class t3lib_TCEforms_inline {
                                // set additional field for processing for saving
                        $fields .= '<input type="hidden" name="'.$this->prependCmdFieldNames.$appendFormFieldNames.'[delete]" value="1" disabled="disabled" />';
                }
-               
                        // if this record should be shown collapsed
                if (!$isExpanded) $appearanceStyleFields = ' style="display: none;"';
 
@@ -353,9 +353,7 @@ class t3lib_TCEforms_inline {
                $isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $config, $rec);
                $hasForeignLabel = !$isOnSymmetricSide && $config['foreign_label'] ? true : false;
                $hasSymmetricLabel = $isOnSymmetricSide && $config['symmetric_label'] ? true : false;
-               
                        // Get the record title/label for a record:
-                       
                        // render using a self-defined user function
                if ($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc']) {
                        $params = array(
@@ -367,14 +365,12 @@ class t3lib_TCEforms_inline {
                        $null = null;   // callUserFunction requires a third parameter, but we don't want to give $this as reference!
                        t3lib_div::callUserFunction($GLOBALS['TCA'][$foreign_table]['ctrl']['label_userFunc'], $params, $null);
                        $recTitle = $params['title'];
-                       
                        // render the special alternative title
                } elseif ($hasForeignLabel || $hasSymmetricLabel) {
                        $titleCol = $hasForeignLabel ? $config['foreign_label'] : $config['symmetric_label'];
                        $recTitle = t3lib_BEfunc::getProcessedValueExtra($foreign_table, $titleCol, $rec[$titleCol]);
                        $recTitle = t3lib_BEfunc::getRecordTitlePrep($recTitle);
                        $recTitle = $this->fObj->noTitle($recTitle);
-                       
                        // render the standard
                } else {
                        $recTitle = t3lib_BEfunc::getRecordTitle($foreign_table, $rec, true);
@@ -422,11 +418,11 @@ class t3lib_TCEforms_inline {
 
                $tcaTableCtrl =& $GLOBALS['TCA'][$foreign_table]['ctrl'];
                $tcaTableCols =& $GLOBALS['TCA'][$foreign_table]['columns'];
-               
+
                $isPagesTable = $foreign_table == 'pages' ? true : false;
                $isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $config, $rec);
                $enableManualSorting = $tcaTableCtrl['sortby'] || $config['MM'] || (!$isOnSymmetricSide && $config['foreign_sortby']) || ($isOnSymmetricSide && $config['symmetric_sortby']) ? true : false;
-               
+
                $nameObjectFt = $this->inlineNames['object'].'['.$foreign_table.']';
                $nameObjectFtId = $nameObjectFt.'['.$rec['uid'].']';
 
@@ -464,7 +460,8 @@ class t3lib_TCEforms_inline {
                                        )       {
                                        if ($showNewRecLink)    {
                                                $onClick = "return inline.createNewRecord('".$nameObjectFt."','".$rec['uid']."')";
-                                               $cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'" class="inlineNewButton"'.$config['inline']['inlineNewButtonStyle'].'>'.
+                                               if ($config['inline']['inlineNewButtonStyle']) $style = ' style="'.$config['inline']['inlineNewButtonStyle'].'"';
+                                               $cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'" class="inlineNewButton"'.$style.'>'.
                                                                '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($isPagesTable?'page':'el').'.gif','width="'.($isPagesTable?13:11).'" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:new'.($isPagesTable?'Page':'Record'),1).'" alt="" />'.
                                                                '</a>';
                                        }
@@ -652,17 +649,17 @@ class t3lib_TCEforms_inline {
 
                return $itemsToSelect;
        }
-       
+
 
        /**
         * Creates a link/button to create new records
         *
         * @param       string          $objectPrefix: The "path" to the child record to create (e.g. '[parten_table][parent_uid][parent_field][child_table]')
-        * @param       string          $style: If a style should be added to the link (e.g. 'display: none;')
+        * @param       array           $conf: TCA configuration of the parent(!) field
         * @return      string          The HTML code for the new record link
         */
        function getNewRecordLink($objectPrefix, $conf = array()) {
-               if ($conf['inline']['inlineNewButtonStyle']) $style = ' style="'.$style.'"';
+               if ($conf['inline']['inlineNewButtonStyle']) $style = ' style="'.$conf['inline']['inlineNewButtonStyle'].'"';
 
                $onClick = "return inline.createNewRecord('$objectPrefix')";
                $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.createnew',1);
@@ -679,25 +676,7 @@ class t3lib_TCEforms_inline {
                                </div>';
                return $out;
        }
-       
-       
-       /**
-        * Get the <script type="text/javascript" src="..."> tags of:
-        * - prototype.js
-        * - script.acolo.us
-        *
-        * @return      string          The HTML code of the <script type="text/javascript" src="..."> tags
-        */
-       function addJavaScript() {
-               $jsCode = array(
-                       '<script src="prototype.js" type="text/javascript"></script>',
-                       '<script src="scriptaculous/scriptaculous.js" type="text/javascript"></script>',
-                       '<script src="../t3lib/jsfunc.inline.js" type="text/javascript"></script>',
-               );
 
-               return implode("\n", $jsCode);
-       }
-       
 
        /**
         * Add Sortable functionality using script.acolo.us "Sortable".
@@ -789,9 +768,8 @@ class t3lib_TCEforms_inline {
                        );
                }
 
-                       // if a new level of child records (child of children) was created, send the JSON array
-               if (count($this->inlineData))
-                       $jsonArray['scriptCall'][] = 'inline.addToDataArray('.$this->getJSON($this->inlineData).');';
+                       // add the JavaScript data that would have been added at the bottom of a regular TCEforms calls
+               $jsonArray['scriptCall'][] = $this->fObj->JSbottom($this->fObj->formName, true);
                        // if script.aculo.us Sortable is used, update the Observer to know the the record
                if ($config['appearance']['useSortable'])
                        $jsonArray['scriptCall'][] = "inline.createDragAndDropSorting('".$this->inlineNames['object']."_records');";
@@ -812,7 +790,8 @@ class t3lib_TCEforms_inline {
         * Save the expanded/collapsed state of a child record in the BE_USER->uc.
         *
         * @param       string          $domObjectId: The calling object in hierarchy, that requested a new record.
-        * @param       integer         $expanded: Whether this record is expanded or collapsed.
+        * @param       string          $expand: Whether this record is expanded.
+        * @param       string          $collapse: Whether this record is collapsed.
         * @return      void
         */
        function setExpandedCollapsedState($domObjectId, $expand, $collapse) {
@@ -827,19 +806,19 @@ class t3lib_TCEforms_inline {
                if (t3lib_div::testInt($top['uid'])) {
                        $inlineView = unserialize($GLOBALS['BE_USER']->uc['inlineView']);
                        $inlineViewCurrent =& $inlineView[$top['table']][$top['uid']];
-                       
-                       $expandUid = t3lib_div::trimExplode(',', $expand);
-                       $collapseUid = t3lib_div::trimExplode(',', $collapse);
-                       
+
+                       $expandUids = t3lib_div::trimExplode(',', $expand);
+                       $collapseUids = t3lib_div::trimExplode(',', $collapse);
+
                                // set records to be expanded
-                       foreach ($expandUid as $uid) {
+                       foreach ($expandUids as $uid) {
                                $inlineViewCurrent[$current['table']][] = $uid;
                        }
                                // set records to be collapsed
-                       foreach ($collapseUid as $uid) {
+                       foreach ($collapseUids as $uid) {
                                $inlineViewCurrent[$current['table']] = $this->removeFromArray($uid, $inlineViewCurrent[$current['table']]);
                        }
-                       
+
                                // save states back to database
                        if (is_array($inlineViewCurrent[$current['table']])) {
                                $GLOBALS['BE_USER']->uc['inlineView'] = serialize($inlineView);
@@ -847,7 +826,7 @@ class t3lib_TCEforms_inline {
                        }
                }
        }
-       
+
 
        /*******************************************************
         *
@@ -1420,14 +1399,15 @@ class t3lib_TCEforms_inline {
                        ? true
                        : false;
        }
-       
+
 
        /**
         * Remove an element from an array.
         *
-        * @param       mixed   $needle: The element to be removed.
-        * @param       array   $haystack: The array the element should be removed from.
-        * @return      mixed   $strict: Search elements strictly.
+        * @param       mixed           $needle: The element to be removed.
+        * @param       array           $haystack: The array the element should be removed from.
+        * @param       mixed           $strict: Search elements strictly.
+        * @return      array           The array $haystack without the $needle
         */
        function removeFromArray($needle, $haystack, $strict=null) {
                $pos = array_search($needle, $haystack, $strict);
@@ -1452,7 +1432,6 @@ class t3lib_TCEforms_inline {
        }
 
 
-
        /**
         * Check, if a field should be skipped, that was defined to be handled as foreign_field or foreign_sortby of
         * the parent record of the "inline"-type - if so, we have to skip this field - the rendering is done via "inline" as hidden field
@@ -1510,8 +1489,8 @@ class t3lib_TCEforms_inline {
 
                return $skipThisField;
        }
-       
-       
+
+
        /**
         * Creates recursively a JSON literal from a mulidimensional associative array.
         * Uses Services_JSON (http://mike.teczno.com/JSON/doc/)
@@ -1527,7 +1506,7 @@ class t3lib_TCEforms_inline {
                return $GLOBALS['JSON']->encode($jsonArray);
        }
 
-       
+
        /**
         * Checks if a uid of a child table is in the inline view settings.
         *
@@ -1541,8 +1520,8 @@ class t3lib_TCEforms_inline {
                }
                return false;
        }
-       
-       
+
+
        /**
         * Update expanded/collapsed states on new inline records if any.
         *
@@ -1553,7 +1532,7 @@ class t3lib_TCEforms_inline {
        function updateInlineView(&$uc, &$tce) {
                if (is_array($uc) && $uc['inlineView']) {
                        $inlineView = unserialize($GLOBALS['BE_USER']->uc['inlineView']);
-                       
+
                        foreach ($uc['inlineView'] as $topTable => $topRecords) {
                                foreach ($topRecords as $topUid => $childElements) {
                                        foreach ($childElements as $childTable => $childRecords) {
@@ -1569,12 +1548,13 @@ class t3lib_TCEforms_inline {
                                        }
                                }
                        }
-                       
+
                        $GLOBALS['BE_USER']->uc['inlineView'] = serialize($inlineView);
                        $GLOBALS['BE_USER']->writeUC();
                }
        }
 
+
        /**
         * Returns the the margin in pixels, that is used for each new inline level.
         *
index a230217..637b79e 100755 (executable)
@@ -362,7 +362,9 @@ class t3lib_TStemplate      {
                                );
                                $mpvar_hash = t3lib_div::md5int($GLOBALS['TSFE']->MP);
                                $GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_pagesection', 'page_id=' . intval($GLOBALS['TSFE']->id) . ' AND mpvar_hash=' . $mpvar_hash, $dbFields);
-                               if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
+                                       // get some information about the last performed SQL query
+                               $sql_info = $GLOBALS['TYPO3_DB']->sql_info();
+                               if ($sql_info['rowsmatched'] == 0) {
                                        $dbFields['page_id'] = intval($GLOBALS['TSFE']->id);
                                        $dbFields['mpvar_hash'] = $mpvar_hash;
                                        $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $dbFields);
index 474696f..a5061a4 100755 (executable)
@@ -32,7 +32,7 @@
 var inline = {
        prependFormFieldNames: 'data',
        noTitleString: '[No title]',
-       data: [],
+       data: {},
        
        addToDataArray: function(object) {
                for (var i in object) {
@@ -342,6 +342,8 @@ var inline = {
                        // if we reached the maximum off possible records after this action, hide the new buttons
                if (!this.isBelowMax(objectPrefix))
                        this.hideElementsWithClassName('inlineNewButton',  this.parseFormElementName('full', objectPrefix, 0 , 1));
+
+               if (TBE_EDITOR) TBE_EDITOR.fieldChanged_fName(objectName, formObj);
        },
        
        memorizeRemoveRecord: function(objectName, removeUid) {
@@ -352,6 +354,7 @@ var inline = {
                                parts = formObj[0].value.split(',');
                                parts = parts.without(removeUid);
                                formObj[0].value = parts.join(',');
+                               if (TBE_EDITOR) TBE_EDITOR.fieldChanged_fName(objectName, formObj);
                                return parts.length;
                        }
                }
@@ -452,6 +455,11 @@ var inline = {
                        new Effect.Fade(objectId+'_div');
                }
 
+                       // remove from TBE_EDITOR (required fields, required range, etc.):
+               if (TBE_EDITOR && TBE_EDITOR.removeElement) {
+                       TBE_EDITOR.removeElement(this.prependFormFieldNames+shortName);
+               }
+
                var recordCount = this.memorizeRemoveRecord(
                        this.prependFormFieldNames+this.parseFormElementName('parts', objectId, 3, 2),
                        recordUid
@@ -526,7 +534,7 @@ var inline = {
                        var value;
                        if (formObj.nodeName == 'SELECT') value = formObj.options[formObj.selectedIndex].text;
                        else value = formObj.value;
-                       $(objectId+'_label').innerHTML = value != undefined ? value : this.noTitleString;
+                       $(objectId+'_label').innerHTML = value.length ? value : this.noTitleString;
                }
                return true;
        },
@@ -547,7 +555,7 @@ var inline = {
                var formObj = document.getElementsByName(objectName);
 
                if (this.data.config && this.data.config[objectPrefix] && formObj.length) {
-                       var recordCount = formObj[0].value.split(',').length;
+                       var recordCount = formObj[0].value ? formObj[0].value.split(',').length : 0;
                        if (recordCount >= this.data.config[objectPrefix].max) isBelowMax = false;
                }
                if (isBelowMax && this.data.unique && this.data.unique[objectPrefix]) {
index 9b78529..a68f3ee 100755 (executable)
@@ -435,11 +435,11 @@ class SC_alt_doc {
                $this->doc->backPath = $BACK_PATH;
                $this->doc->docType = 'xhtml_trans';
 
-               $this->doc->form='<form action="'.htmlspecialchars($this->R_URI).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
+               $this->doc->form='<form action="'.htmlspecialchars($this->R_URI).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
 
                $this->doc->JScode = $this->doc->wrapScriptTags('
                        function jumpToUrl(URL,formEl)  {       //
-                               if (!TBE_EDITOR_isFormChanged())        {
+                               if (!TBE_EDITOR.isFormChanged())        {
                                        window.location.href = URL;
                                } else if (formEl && formEl.type=="checkbox") {
                                        formEl.checked = formEl.checked ? 0 : 1;
@@ -896,7 +896,7 @@ class SC_alt_doc {
                                }
 
                                        // Compile the selector box finally:
-                               $onChange = 'if(this.options[this.selectedIndex].value && !TBE_EDITOR_isFormChanged()){window.location.href=(this.options[this.selectedIndex].value);}';
+                               $onChange = 'if(this.options[this.selectedIndex].value && !TBE_EDITOR.isFormChanged()){window.location.href=(this.options[this.selectedIndex].value);}';
                                $docSel='<select name="_docSelector" onchange="'.htmlspecialchars($onChange).'">'.implode('',$opt).'</select>';
 
                                        // Add CSH:
diff --git a/typo3/jsfunc.tbe_editor.js b/typo3/jsfunc.tbe_editor.js
new file mode 100644 (file)
index 0000000..5ce3f67
--- /dev/null
@@ -0,0 +1,447 @@
+/***************************************************************\r
+*  Copyright notice\r
+*\r
+*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)\r
+*  All rights reserved\r
+*\r
+*  This script is part of the TYPO3 project. The TYPO3 project is\r
+*  free software; you can redistribute it and/or modify\r
+*  it under the terms of the GNU General Public License as published by\r
+*  the Free Software Foundation; either version 2 of the License, or\r
+*  (at your option) any later version.\r
+*\r
+*  The GNU General Public License can be found at\r
+*  http://www.gnu.org/copyleft/gpl.html.\r
+*  A copy is found in the textfile GPL.txt and important notices to the license\r
+*  from the author is found in LICENSE.txt distributed with these scripts.\r
+*\r
+*\r
+*  This script is distributed in the hope that it will be useful,\r
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+*  GNU General Public License for more details.\r
+*\r
+*  This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+/**\r
+ * Contains JavaScript for TYPO3 Core Form generator - AKA "TCEforms"\r
+ *\r
+ * $Id: $\r
+ *\r
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>\r
+ * @coauthor   Oliver Hader <oh@inpublica.de>\r
+ */\r
+\r
+\r
+var TBE_EDITOR = {\r
+       /* Example:\r
+               elements: {\r
+                       'data[table][uid]': {\r
+                               'field': {\r
+                                       'range':                [0, 100],\r
+                                       'rangeImg':             '',\r
+                                       'required':             true,\r
+                                       'requiredImg':  ''\r
+                               }\r
+                       }\r
+               \r
+               },\r
+       */\r
+       \r
+       elements: {},\r
+       recentUpdatedElements: {},\r
+       actionChecks: { submit: [] },\r
+       \r
+       formname: '',\r
+       formnameUENC: '',\r
+       loadTime: 0,\r
+       isChanged: 0,\r
+       auth_timeout_field: 0,\r
+\r
+       backPath: '',\r
+       prependFormFieldNames: 'data',\r
+       prependFormFieldNamesUENC: 'data',\r
+       prependFormFieldNamesCnt: 0,\r
+       \r
+       isPalettedoc: null,\r
+       doSaveFieldName: 0,\r
+       \r
+       labels: {},\r
+       images: {\r
+               req: new Image(),\r
+               cm: new Image(),\r
+               sel: new Image(),\r
+               clear: new Image()\r
+       },      \r
+\r
+       // Handling of data structures:\r
+       addElements: function(elements) {\r
+               TBE_EDITOR.recentUpdatedElements = elements;\r
+               TBE_EDITOR.elements = $H(TBE_EDITOR.elements).merge(elements);\r
+       },\r
+       removeElement: function(record) {\r
+               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record]) {\r
+                       delete(TBE_EDITOR.elements[record]);\r
+               }\r
+       },\r
+       getElement: function(record, field, type) {\r
+               var result = null;\r
+               var element;\r
+               \r
+               if (TBE_EDITOR.elements && TBE_EDITOR.elements[record] && TBE_EDITOR.elements[record][field]) {\r
+                       element = TBE_EDITOR.elements[record][field];\r
+                       if (type) {\r
+                               if (element[type]) result = element;\r
+                       } else {\r
+                               result = element;\r
+                       }\r
+               }\r
+               \r
+               return result;\r
+       },\r
+       checkElements: function(type, recentUpdated, record, field) {\r
+               var result = 1;\r
+               var elementName, elementData, elementRecord, elementField;\r
+               var source = recentUpdated ? TBE_EDITOR.recentUpdatedElements : TBE_EDITOR.elements;\r
+\r
+               if (type) {\r
+                       if (record && field) {\r
+                               elementName = record+'['+field+']';\r
+                               elementData = TBE_EDITOR.getElement(record, field, type);\r
+                               if (elementData) {\r
+                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData)) result = 0;\r
+                               }\r
+                               \r
+                       } else {\r
+                               var elementFieldList, elRecIndex, elRecCnt, elFldIndex, elFldCnt;\r
+                               var elementRecordList = $H(source).keys();\r
+                               for (elRecIndex=0, elRecCnt=elementRecordList.length; elRecIndex<elRecCnt; elRecIndex++) {\r
+                                       elementRecord = elementRecordList[elRecIndex];\r
+                                       elementFieldList = $H(source[elementRecord]).keys();\r
+                                       for (elFldIndex=0, elFldCnt=elementFieldList.length; elFldIndex<elFldCnt; elFldIndex++) {\r
+                                               elementField = elementFieldList[elFldIndex];\r
+                                               elementData = TBE_EDITOR.getElement(elementRecord, elementField, type);\r
+                                               if (elementData) {\r
+                                                       elementName = elementRecord+'['+elementField+']';\r
+                                                       if (!TBE_EDITOR.checkElementByType(type, elementName, elementData)) result = 0;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               return result;\r
+       },\r
+       checkElementByType: function(type, elementName, elementData) {\r
+               var result = 1;\r
+               \r
+               if (type) {\r
+                       if (type == 'required') {\r
+                               if (!document[TBE_EDITOR.formname][elementName].value) {\r
+                                       result = 0;\r
+                                       TBE_EDITOR.setImage('req_'+elementData.requiredImg, TBE_EDITOR.images.req);\r
+                               }\r
+                       } else if (type == 'range' && elementData.range) {\r
+                               var formObj = document[TBE_EDITOR.formname][elementName+'_list'];\r
+                               if (!formObj) {\r
+                                               // special treatment for IRRE fields:\r
+                                       var tempObj = document[TBE_EDITOR.formname][elementName];\r
+                                       if (tempObj && Element.hasClassName(tempObj, 'inlineRecord')) {\r
+                                               formObj = tempObj.value ? tempObj.value.split(',') : [];\r
+                                       }\r
+                               }\r
+                               if (!TBE_EDITOR.checkRange(formObj, elementData.range[0], elementData.range[1])) {\r
+                                       result = 0;\r
+                                       TBE_EDITOR.setImage('req_'+elementData.rangeImg, TBE_EDITOR.images.req);\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               return result;\r
+       },\r
+       addActionChecks: function(type, checks) {\r
+               TBE_EDITOR.actionChecks[type].push(checks);\r
+       },\r
+       \r
+       // Regular TCEforms JSbottom scripts:\r
+       loginRefreshed: function() {\r
+               var date = new Date();\r
+               TBE_EDITOR.loadTime = Math.floor(date.getTime()/1000);\r
+               if (top.busy && top.busy.loginRefreshed) { top.busy.loginRefreshed(); }\r
+       },\r
+       checkLoginTimeout: function() {\r
+               var date = new Date();\r
+               var theTime = Math.floor(date.getTime()/1000);\r
+               if (theTime > TBE_EDITOR.loadTime+TBE_EDITOR.auth_timeout_field-10) {\r
+                       return true;\r
+               }\r
+       },\r
+       setHiddenContent: function(RTEcontent,theField) {\r
+               document[TBE_EDITOR.formname][theField].value = RTEcontent;\r
+               alert(document[TBE_EDITOR.formname][theField].value);\r
+       },\r
+       fieldChanged_fName: function(fName,el) {\r
+               var idx=2+TBE_EDITOR.prependFormFieldNamesCnt;\r
+               var table = TBE_EDITOR.split(fName, "[", idx);\r
+               var uid = TBE_EDITOR.split(fName, "[", idx+1);\r
+               var field = TBE_EDITOR.split(fName, "[", idx+2);\r
+\r
+               table = table.substr(0,table.length-1);\r
+               uid = uid.substr(0,uid.length-1);\r
+               field = field.substr(0,field.length-1);\r
+               TBE_EDITOR.fieldChanged(table,uid,field,el);\r
+       },\r
+       fieldChanged: function(table,uid,field,el) {\r
+               var theField = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']['+field+']';\r
+               var theRecord = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']';\r
+               TBE_EDITOR.isChanged = 1;\r
+\r
+                       // Set change image:\r
+               var imgObjName = "cm_"+table+"_"+uid+"_"+field;\r
+               TBE_EDITOR.setImage(imgObjName,TBE_EDITOR.images.cm);\r
+\r
+                       // Set change image\r
+               if (document[TBE_EDITOR.formname][theField] && document[TBE_EDITOR.formname][theField].type=="select-one" && document[TBE_EDITOR.formname][theField+"_selIconVal"])     {\r
+                       var imgObjName = "selIcon_"+table+"_"+uid+"_"+field+"_";\r
+                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.clear);\r
+                       document[TBE_EDITOR.formname][theField+"_selIconVal"].value = document[TBE_EDITOR.formname][theField].selectedIndex;\r
+                       TBE_EDITOR.setImage(imgObjName+document[TBE_EDITOR.formname][theField+"_selIconVal"].value,TBE_EDITOR.images.sel);\r
+               }\r
+\r
+                       // Set required flag:\r
+               var imgReqObjName = "req_"+table+"_"+uid+"_"+field;\r
+               if (TBE_EDITOR.getElement(theRecord,field,'required') && document[TBE_EDITOR.formname][theField])       {\r
+                       if (TBE_EDITOR.checkElements('required', false, theRecord, field)) {\r
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);\r
+                       } else {\r
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);\r
+                       }\r
+               }\r
+               if (TBE_EDITOR.getElement(theRecord,field,'range') && document[TBE_EDITOR.formname][theField]) {\r
+                       if (TBE_EDITOR.checkElements('range', false, theRecord, field)) {\r
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.clear);\r
+                       } else {\r
+                               TBE_EDITOR.setImage(imgReqObjName,TBE_EDITOR.images.req);\r
+                       }\r
+               }\r
+               \r
+               if (TBE_EDITOR.isPalettedoc) { TBE_EDITOR.setOriginalFormFieldValue(theField) };\r
+       },\r
+       setOriginalFormFieldValue: function(theField) {\r
+               if (TBE_EDITOR.isPalettedoc && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname] && (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField]) {\r
+                       (TBE_EDITOR.isPalettedoc).document[TBE_EDITOR.formname][theField].value = document[TBE_EDITOR.formname][theField].value;\r
+               }\r
+       },\r
+       isFormChanged: function(noAlert) {\r
+               if (TBE_EDITOR.isChanged && !noAlert && confirm(TBE_EDITOR.labels.fieldsChanged)) {\r
+                       return 0;\r
+               }\r
+               return TBE_EDITOR.isChanged;\r
+       },\r
+       checkAndDoSubmit: function(sendAlert) {\r
+               if (TBE_EDITOR.checkSubmit(sendAlert)) { TBE_EDITOR.submitForm(); }\r
+       },\r
+       /**\r
+        * Checks if the form can be submitted according to any possible restrains like required values, item numbers etc.\r
+        * Returns true if the form can be submitted, otherwise false (and might issue an alert message, if "sendAlert" is 1)\r
+        * If "sendAlert" is false, no error message will be shown upon false return value (if "1" then it will).\r
+        * 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...)\r
+        */\r
+       checkSubmit: function(sendAlert) {\r
+               var funcIndex, funcMax, funcRes;\r
+               if (TBE_EDITOR.checkLoginTimeout() && confirm(TBE_EDITOR.labels.refresh_login)) {\r
+                       vHWin=window.open(TBE_EDITOR.backPath+'login_frameset.php?','relogin','height=300,width=400,status=0,menubar=0');\r
+                       vHWin.focus();\r
+                       return false;\r
+               }\r
+               var OK=1;\r
+\r
+               // $this->additionalJS_submit:\r
+               if (TBE_EDITOR.actionChecks && TBE_EDITOR.actionChecks.submit) {\r
+                       for (funcIndex=0, funcMax=TBE_EDITOR.actionChecks.submit.length; funcIndex<funcMax; funcIndex++) {\r
+                               eval(TBE_EDITOR.actionChecks.submit[funcIndex]);\r
+                       }\r
+               }\r
+\r
+               if(!OK) {\r
+                       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.")))  {\r
+                               return false;\r
+                       } else {\r
+                               OK = 1;\r
+                       }\r
+               }\r
+               // $reqLinesCheck\r
+               if (!TBE_EDITOR.checkElements('required', false)) { OK = 0; }\r
+               // $reqRangeCheck\r
+               if (!TBE_EDITOR.checkElements('range', false)) { OK = 0; }\r
+                               \r
+               if (OK || sendAlert==-1) {\r
+                       return true;\r
+               } else {\r
+                       if(sendAlert) alert(TBE_EDITOR.labels.fieldsMissing);\r
+                       return false;\r
+               }\r
+       },\r
+       checkRange: function(el,lower,upper) {\r
+               if (el && el.length>=lower && el.length<=upper) {\r
+                       return true;\r
+               } else {\r
+                       return false;\r
+               }\r
+       },\r
+       initRequired: function() {\r
+               // $reqLinesCheck\r
+               TBE_EDITOR.checkElements('required', true);\r
+\r
+               // $reqRangeCheck\r
+               TBE_EDITOR.checkElements('range', true);\r
+       },\r
+       setImage: function(name,image) {\r
+               if (document[name]) {\r
+                       if (typeof image == 'object') {\r
+                               document[name].src = image.src;\r
+                       } else {\r
+                               document[name].src = eval(image+'.src');\r
+                       }\r
+               }\r
+       },\r
+       submitForm: function() {\r
+               if (TBE_EDITOR.doSaveFieldName) {\r
+                       document[TBE_EDITOR.formname][TBE_EDITOR.doSaveFieldName].value=1;                      \r
+               }\r
+               document[TBE_EDITOR.formname].submit();\r
+       },\r
+       split: function(theStr1, delim, index) {\r
+               var theStr = ""+theStr1;\r
+               var lengthOfDelim = delim.length;\r
+               sPos = -lengthOfDelim;\r
+               if (index<1) {index=1;}\r
+               for (var a=1; a<index; a++)     {\r
+                       sPos = theStr.indexOf(delim, sPos+lengthOfDelim);\r
+                       if (sPos==-1) { return null; }\r
+               }\r
+               ePos = theStr.indexOf(delim, sPos+lengthOfDelim);\r
+               if(ePos == -1) { ePos = theStr.length; }\r
+               return (theStr.substring(sPos+lengthOfDelim,ePos));\r
+       },\r
+       palUrl: function(inData,fieldList,fieldNum,table,uid,isOnFocus) {\r
+               var url = TBE_EDITOR.backPath+'alt_palette.php?inData='+inData+'&formName='+TBE_EDITOR.formnameUENC+'&prependFormFieldNames='+TBE_EDITOR.prependFormFieldNamesUENC;\r
+               var field = "";\r
+               var theField="";\r
+               for (var a=0; a<fieldNum;a++)   {\r
+                       field = TBE_EDITOR.split(fieldList, ",", a+1);\r
+                       theField = TBE_EDITOR.prependFormFieldNames+'['+table+']['+uid+']['+field+']';\r
+                       if (document[TBE_EDITOR.formname][theField]) url+="&rec["+field+"]="+TBE_EDITOR.rawurlencode(document[TBE_EDITOR.formname][theField].value);\r
+               }\r
+               if (top.topmenuFrame)   {\r
+                       top.topmenuFrame.location.href = url+"&backRef="+(top.content.list_frame ? (top.content.list_frame.view_frame ? "top.content.list_frame.view_frame" : "top.content.list_frame") : "top.content");\r
+               } else if (!isOnFocus) {\r
+                       var vHWin=window.open(url,"palette","height=300,width=200,status=0,menubar=0,scrollbars=1");\r
+                       vHWin.focus();\r
+               }\r
+       },\r
+       curSelected: function(theField) {\r
+               var fObjSel = document[TBE_EDITOR.formname][theField];\r
+               var retVal="";\r
+               if (fObjSel)    {\r
+                       if (fObjSel.type=='select-multiple' || fObjSel.type=='select-one')      {\r
+                               var l=fObjSel.length;\r
+                               for (a=0;a<l;a++)       {\r
+                                       if (fObjSel.options[a].selected==1)     {\r
+                                               retVal+=fObjSel.options[a].value+",";\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               return retVal;\r
+       },\r
+       rawurlencode: function(str,maxlen) {\r
+               var output = str;\r
+               if (maxlen)     output = output.substr(0,200);\r
+               output = escape(output);\r
+               output = TBE_EDITOR.str_replace("*","%2A", output);\r
+               output = TBE_EDITOR.str_replace("+","%2B", output);\r
+               output = TBE_EDITOR.str_replace("/","%2F", output);\r
+               output = TBE_EDITOR.str_replace("@","%40", output);\r
+               return output;\r
+       },\r
+       str_replace: function(match,replace,string) {\r
+               var input = ''+string;\r
+               var matchStr = ''+match;\r
+               if (!matchStr) { return string; }\r
+               var output = '';\r
+               var pointer=0;\r
+               var pos = input.indexOf(matchStr);\r
+               while (pos!=-1) {\r
+                       output+=''+input.substr(pointer, pos-pointer)+replace;\r
+                       pointer=pos+matchStr.length;\r
+                       pos = input.indexOf(match,pos+1);\r
+               }\r
+               output+=''+input.substr(pointer);\r
+               return output;\r
+       }\r
+};\r
+\r
+function typoSetup     () {\r
+       this.passwordDummy = '********';\r
+       this.decimalSign = '.';\r
+}\r
+var TS = new typoSetup();\r
+var evalFunc = new evalFunc();\r
+\r
+// backwards compatibility for extensions\r
+var TBE_EDITOR_loginRefreshed = TBE_EDITOR.loginRefreshed;\r
+var TBE_EDITOR_checkLoginTimeout = TBE_EDITOR.checkLoginTimeout;\r
+var TBE_EDITOR_setHiddenContent = TBE_EDITOR.setHiddenContent;\r
+var TBE_EDITOR_isChanged = TBE_EDITOR.isChanged;\r
+var TBE_EDITOR_fieldChanged_fName = TBE_EDITOR.fieldChanged_fName;\r
+var TBE_EDITOR_fieldChanged = TBE_EDITOR.fieldChanged;\r
+var TBE_EDITOR_setOriginalFormFieldValue = TBE_EDITOR.setOriginalFormFieldValue;\r
+var TBE_EDITOR_isFormChanged = TBE_EDITOR.isFormChanged;\r
+var TBE_EDITOR_checkAndDoSubmit = TBE_EDITOR.checkAndDoSubmit;\r
+var TBE_EDITOR_checkSubmit = TBE_EDITOR.checkSubmit;\r
+var TBE_EDITOR_checkRange = TBE_EDITOR.checkRange;\r
+var TBE_EDITOR_initRequired = TBE_EDITOR.initRequired;\r
+var TBE_EDITOR_setImage = TBE_EDITOR.setImage;\r
+var TBE_EDITOR_submitForm = TBE_EDITOR.submitForm;\r
+var TBE_EDITOR_split = TBE_EDITOR.split;\r
+var TBE_EDITOR_palUrl = TBE_EDITOR.palUrl;\r
+var TBE_EDITOR_curSelected = TBE_EDITOR.curSelected;\r
+var TBE_EDITOR_rawurlencode = TBE_EDITOR.rawurlencode;\r
+var TBE_EDITOR_str_replace = TBE_EDITOR.str_replace;\r
+\r
+\r
+var typo3form = {\r
+       fieldSet: function(theField, evallist, is_in, checkbox, checkboxValue) {\r
+               if (document[TBE_EDITOR.formname][theField])    {\r
+                       var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);\r
+                       var theValue = document[TBE_EDITOR.formname][theField].value;\r
+                       if (checkbox && theValue==checkboxValue)        {\r
+                               document[TBE_EDITOR.formname][theField+"_hr"].value="";\r
+                               if (document[TBE_EDITOR.formname][theField+"_cb"])      document[TBE_EDITOR.formname][theField+"_cb"].checked = "";\r
+                       } else {\r
+                               document[TBE_EDITOR.formname][theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);\r
+                               if (document[TBE_EDITOR.formname][theField+"_cb"])      document[TBE_EDITOR.formname][theField+"_cb"].checked = "on";\r
+                       }\r
+               }\r
+       },\r
+       fieldGet: function(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off, checkSetValue) {\r
+               if (document[TBE_EDITOR.formname][theField])    {\r
+                       var theFObj = new evalFunc_dummy (evallist,is_in, checkbox, checkboxValue);\r
+                       if (checkbox_off)       {\r
+                               if (document[TBE_EDITOR.formname][theField+"_cb"].checked)      {\r
+                                       document[TBE_EDITOR.formname][theField].value=checkSetValue;\r
+                               } else {\r
+                                       document[TBE_EDITOR.formname][theField].value=checkboxValue;\r
+                               }\r
+                       }else{\r
+                               document[TBE_EDITOR.formname][theField].value = evalFunc.evalObjValue(theFObj, document[TBE_EDITOR.formname][theField+"_hr"].value);\r
+                       }\r
+                       typo3.formFieldSet(theField, evallist, is_in, checkbox, checkboxValue);\r
+               }\r
+       }\r
+};\r
+\r
+// backwards compatibility for extensions\r
+var typo3FormFieldSet = typo3form.fieldSet;\r
+var typo3FormFieldGet = typo3form.fieldGet;\r
index c754251..69cb6ba 100644 (file)
@@ -128,7 +128,7 @@ class SC_mod_user_ws_workspaceForms extends t3lib_SCbase {
                $this->doc = t3lib_div::makeInstance('mediumDoc');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->docType = 'xhtml_trans';
-               $this->doc->form = '<form action="' . t3lib_div::getIndpEnv('SCRIPT_NAME').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
+               $this->doc->form = '<form action="' . t3lib_div::getIndpEnv('SCRIPT_NAME').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
 
                $CMparts = $this->doc->getContextMenuCode();
                $this->doc->JScode.= $CMparts[0];
index 73e7fa0..71370ae 100755 (executable)
@@ -407,8 +407,8 @@ class SC_db_layout {
                                if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
                                if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).';
                                function jumpToUrl(URL,formEl)  {       //
-                                       if (document.editform && document.TBE_EDITOR_isFormChanged)     {       // Check if the function exists... (works in all browsers?)
-                                               if (!TBE_EDITOR_isFormChanged())        {       //
+                                       if (document.editform && document.TBE_EDITOR.isFormChanged)     {       // Check if the function exists... (works in all browsers?)
+                                               if (!TBE_EDITOR.isFormChanged())        {       //
                                                        window.location.href = URL;
                                                } else if (formEl) {
                                                        if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
@@ -490,7 +490,7 @@ class SC_db_layout {
                global $LANG,$BE_USER,$BACK_PATH;
 
                        // Alternative form tag; Quick Edit submits its content to tce_db.php.
-               $this->doc->form='<form action="'.htmlspecialchars($BACK_PATH.'tce_db.php?&prErr=1&uPT=1').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
+               $this->doc->form='<form action="'.htmlspecialchars($BACK_PATH.'tce_db.php?&prErr=1&uPT=1').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
 
                        // Setting up the context sensitive menu:
                $CMparts = $this->doc->getContextMenuCode();
@@ -641,7 +641,7 @@ class SC_db_layout {
 
                        '<input class="c-inputButton" type="image" name="savedok"'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" alt="" />'.
 
-                       '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR_checkAndDoSubmit(1); return false;').'">'.
+                       '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;').'">'.
                                '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/savedokshow.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" alt="" />'.
                                '</a>'.
 
index ca9d755..dbd0a66 100755 (executable)
@@ -6899,7 +6899,7 @@ class tslib_cObj {
                if ($GLOBALS['TSFE']->displayEditIcons && $table && $mayEdit)   {
                        $GLOBALS['TSFE']->set_no_cache();               // Special content is about to be shown, so the cache must be disabled.
                        $formName = 'TSFE_EDIT_FORM_'.substr($GLOBALS['TSFE']->uniqueHash(),0,4);
-                       $formTag = '<form name="'.$formName.'" action="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" onsubmit="return TBE_EDITOR_checkSubmit(1);" style="margin: 0 0 0 0;">';
+                       $formTag = '<form name="'.$formName.'" action="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" onsubmit="return TBE_EDITOR.checkSubmit(1);" style="margin: 0 0 0 0;">';
                        $sortField = $TCA[$table]['ctrl']['sortby'];
                        $labelField = $TCA[$table]['ctrl']['label'];
                        $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
index 227306e..0f975a3 100755 (executable)
@@ -1212,9 +1212,9 @@ $str.=$this->docBodyTagBegin().
                $opt=array();
                if ($addSaveOptions)    {
                        $opt[]='<option value="">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.menu',1).'</option>';
-                       $opt[]='<option value="TBE_EDITOR_checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'</option>';
-                       $opt[]='<option value="document.editform.closeDoc.value=-2; TBE_EDITOR_checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'</option>';
-                       if ($BE_USER->uc['allSaveFunctions'])   $opt[]='<option value="document.editform.closeDoc.value=-3; TBE_EDITOR_checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseAllDocs',1).'</option>';
+                       $opt[]='<option value="TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'</option>';
+                       $opt[]='<option value="document.editform.closeDoc.value=-2; TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'</option>';
+                       if ($BE_USER->uc['allSaveFunctions'])   $opt[]='<option value="document.editform.closeDoc.value=-3; TBE_EDITOR.checkAndDoSubmit(1);">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseAllDocs',1).'</option>';
                        $opt[]='<option value="document.editform.closeDoc.value=2; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'</option>';
                        $opt[]='<option value="document.editform.closeDoc.value=3; document.editform.submit();">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeAllDocs',1).'</option>';
                        $opt[]='<option value=""></option>';
index d2c8622..d937730 100755 (executable)
@@ -110,7 +110,7 @@ class SC_wizard_rte {
                $this->doc = t3lib_div::makeInstance('mediumDoc');
                $this->doc->docType = 'xhtml_trans';
                $this->doc->divClass = '';      // Need to NOT have the page wrapped in DIV since if we do that we destroy the feature that the RTE spans the whole height of the page!!!
-               $this->doc->form='<form action="tce_db.php" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR_checkSubmit(1);">';
+               $this->doc->form='<form action="tce_db.php" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
                $this->doc->backPath = $BACK_PATH;
 
        }
@@ -139,7 +139,7 @@ class SC_wizard_rte {
                        $this->doc->JScode = $this->doc->wrapScriptTags('
                                        function jumpToUrl(URL,formEl)  {       //
                                                if (document.editform)  {
-                                                       if (!TBE_EDITOR_isFormChanged())        {
+                                                       if (!TBE_EDITOR.isFormChanged())        {
                                                                window.location.href = URL;
                                                        } else if (formEl) {
                                                                if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
@@ -201,19 +201,19 @@ class SC_wizard_rte {
 
                                // Save:
                        $toolBarButtons[]=
-                               '<a href="#" onclick="TBE_EDITOR_checkAndDoSubmit(1); return false;">'.
+                               '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">'.
                                '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" alt="" />'.
                                '</a>';
 
                                // Save/View:
                        if (t3lib_extMgm::isLoaded('cms'))      {
                                $toolBarButtons[]=
-                                       '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR_checkAndDoSubmit(1); return false;').'">'.
+                                       '<a href="#" onclick="'.htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;').'">'.
                                        '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedokshow.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow',1).'" alt="" />'.
                                        '</a>';
                        }
                                // Save/Close:
-                       $toolBarButtons[] = '<input type="image" class="c-inputButton" onclick="'.htmlspecialchars('document.editform.redirect.value=\''.$closeUrl.'\'; TBE_EDITOR_checkAndDoSubmit(1); return false;').'" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
+                       $toolBarButtons[] = '<input type="image" class="c-inputButton" onclick="'.htmlspecialchars('document.editform.redirect.value=\''.$closeUrl.'\'; TBE_EDITOR.checkAndDoSubmit(1); return false;').'" name="_saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
                                // Close:
                        $toolBarButtons[]=
                                        '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($closeUrl).'\')); return false;').'">'.