Added feature #16295: Optimize stdWrap usage for TypoScript content element FORM...
authorSteffen Kamper <info@sk-typo3.de>
Wed, 17 Nov 2010 14:54:16 +0000 (14:54 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 17 Nov 2010 14:54:16 +0000 (14:54 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9460 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/tslib/content/class.tslib_content_form.php
typo3/sysext/css_styled_content/static/setup.txt

index 21ef089..e01a236 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
 
 2010-11-17  Steffen Kamper  <steffen@typo3.org>
 
+       * Added feature #16295: Optimize stdWrap usage for TypoScript content element FORM (Thanks to Jo Hasenau)
        * Added feature #16287: Optimize stdWrap usage for TypoScript content element IMGTEXT (Thanks to Jo Hasenau)
        * Added feature #16382: Optimize stdWrap usage for TypoScript content element MULTIMEDIA (Thanks to Jo Hasenau)
        * Added feature #16381: Optimize stdWrap usage for TypoScript content element MEDIA (Thanks to Jo Hasenau)
index 2215e37..6c5b71c 100644 (file)
@@ -57,49 +57,75 @@ class tslib_content_Form extends tslib_content_Abstract {
        public function render($conf = array(), $formData = '') {
                $content = '';
                if (is_array($formData)) {
-                       $dataArr = $formData;
+                       $dataArray = $formData;
                } else {
-                       $data = $this->cObj->stdWrap($conf['data'], $conf['data.']);
+                       $data = isset($conf['data.'])
+                               ? $this->cObj->stdWrap($conf['data'], $conf['data.'])
+                               : $conf['data'];
                                // Clearing dataArr
-                       $dataArr = array();
+                       $dataArray = array();
                                // Getting the original config
                        if (trim($data)) {
                                $data = str_replace(LF, '||', $data);
-                               $dataArr = explode('||', $data);
+                               $dataArray = explode('||', $data);
                        }
                                // Adding the new dataArray config form:
                        if (is_array($conf['dataArray.'])) { // dataArray is supplied
-                               $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
-                               foreach ($sKeyArray as $theKey) {
-                                       $dAA = $conf['dataArray.'][$theKey . '.'];
-                                       if (is_array($dAA)) {
+                               $sortedKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
+                               foreach ($sortedKeyArray as $theKey) {
+                                       $singleKeyArray = $conf['dataArray.'][$theKey . '.'];
+                                       if (is_array($singleKeyArray)) {
                                                $temp = array();
-                                               list ($temp[0]) = explode('|', $dAA['label.'] ? $this->cObj->stdWrap($dAA['label'], $dAA['label.']) : $dAA['label']);
-                                               list ($temp[1]) = explode('|', $dAA['type']);
-                                               if ($dAA['required']) {
+                                               $label = isset($singleKeyArray['label.'])
+                                                       ? $this->cObj->stdWrap($singleKeyArray['label'], $singleKeyArray['label.'])
+                                                       : $singleKeyArray['label'];
+                                               list ($temp[0]) = explode('|', $label);
+                                               $type = isset($singleKeyArray['type.'])
+                                                       ? $this->cObj->stdWrap($singleKeyArray['type'],$singleKeyArray['type.'])
+                                                       : $singleKeyArray['type'];
+                                               list ($temp[1]) = explode('|', $type);
+                                               $required = isset($singleKeyArray['required.'])
+                                                       ? $this->cObj->stdWrap($singleKeyArray['required'], $singleKeyArray['required.'])
+                                                       : $singleKeyArray['required'];
+                                               if ($required) {
                                                        $temp[1] = '*' . $temp[1];
                                                }
-                                               list ($temp[2]) = explode('|', $dAA['value.'] ? $this->cObj->stdWrap($dAA['value'], $dAA['value.']) : $dAA['value']);
+                                               $singleValue = isset($singleKeyArray['value.'])
+                                                       ? $this->cObj->stdWrap($singleKeyArray['value'], $singleKeyArray['value.'])
+                                                       : $singleKeyArray['value'];
+                                               list ($temp[2]) = explode('|', $singleValue);
                                                        // If value array is set, then implode those values.
-                                               if (is_array($dAA['valueArray.'])) {
-                                                       $temp_accum = array();
-                                                       foreach ($dAA['valueArray.'] as $dAKey_vA => $dAA_vA) {
-                                                               if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA) . '.', $dAKey_vA)) {
-                                                                       $temp_vA = array();
-                                                                       list ($temp_vA[0]) = explode('=', $dAA_vA['label.'] ? $this->cObj->stdWrap($dAA_vA['label'], $dAA_vA['label.']) : $dAA_vA['label']);
-                                                                       if ($dAA_vA['selected']) {
-                                                                               $temp_vA[0] = '*' . $temp_vA[0];
+                                               if (is_array($singleKeyArray['valueArray.'])) {
+                                                       $temp_accumulated = array();
+                                                       foreach ($singleKeyArray['valueArray.'] as $singleKey => $singleKey_valueArray) {
+                                                               if (is_array($singleKey_valueArray) && !strcmp(intval($singleKey) . '.', $singleKey)) {
+                                                                       $temp_valueArray = array();
+                                                                       $valueArrayLabel = isset($singleKey_valueArray['label.'])
+                                                                               ? $this->cObj->stdWrap($singleKey_valueArray['label'], $singleKey_valueArray['label.'])
+                                                                               : $singleKey_valueArray['label'];
+                                                                       list ($temp_valueArray[0]) = explode('=', $valueArrayLabel);
+                                                                       $selected = isset($singleKeyArray['selected.'])
+                                                                               ? $this->cObj->stdWrap($singleKeyArray['selected'], $singleKeyArray['selected.'])
+                                                                               : $singleKeyArray['selected'];
+                                                                       if ($selected) {
+                                                                               $temp_valueArray[0] = '*' . $temp_valueArray[0];
                                                                        }
-                                                                       list ($temp_vA[1]) = explode(',', $dAA_vA['value']);
+                                                                       $singleKeyValue = isset($singleKey_valueArray['value.'])
+                                                                               ? $this->cObj->stdWrap($singleKey_valueArray['value'], $singleKey_valueArray['value.'])
+                                                                               : $singleKey_valueArray['value'];
+                                                                       list ($temp_valueArray[1]) = explode(',', $singleKeyValue);
                                                                }
-                                                               $temp_accum[] = implode('=', $temp_vA);
+                                                               $temp_accumulated[] = implode('=', $temp_valueArray);
                                                        }
-                                                       $temp[2] = implode(',', $temp_accum);
+                                                       $temp[2] = implode(',', $temp_accumulated);
                                                }
-                                               list ($temp[3]) = explode('|', $dAA['specialEval.'] ? $this->cObj->stdWrap($dAA['specialEval'], $dAA['specialEval.']) : $dAA['specialEval']);
+                                               $specialEval = isset($singleKeyArray['specialEval.'])
+                                                       ? $this->cObj->stdWrap($singleKeyArray['specialEval'], $singleKeyArray['specialEval.'])
+                                                       : $singleKeyArray['specialEval'];
+                                               list ($temp[3]) = explode('|', $specialEval);
 
                                                        // adding the form entry to the dataArray
-                                               $dataArr[] = implode('|', $temp);
+                                               $dataArray[] = implode('|', $temp);
                                        }
                                }
                        }
@@ -110,39 +136,44 @@ class tslib_content_Form extends tslib_content_Abstract {
                $fieldlist = array();
                $propertyOverride = array();
                $fieldname_hashArray = array();
-               $cc = 0;
+               $counter = 0;
 
                $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype);
                        // Formname
-               if ($conf['formName']) {
-                       $formname = $this->cObj->cleanFormName($conf['formName']);
+               $formName = isset($conf['formName.'])
+                       ? $this->cObj->stdWrap($conf['formName'], $conf['formName.'])
+                       : $conf['formName'];
+               if ($formName) {
+                       $formName = $this->cObj->cleanFormName($formName);
                } else {
-                       $formname = $GLOBALS['TSFE']->uniqueHash();
-                       $formname = 'a' . $formname; // form name has to start with a letter to reach XHTML compliance
+                       $formName = 'a' . $GLOBALS['TSFE']->uniqueHash(); // form name has to start with a letter to reach XHTML compliance
                }
 
-               if (isset($conf['fieldPrefix'])) {
-                       if ($conf['fieldPrefix']) {
-                               $prefix = $this->cObj->cleanFormName($conf['fieldPrefix']);
+               $fieldPrefix = isset($conf['fieldPrefix.'])
+                       ? $this->cObj->stdWrap($conf['fieldPrefix'], $conf['fieldPrefix.'])
+                       : $conf['fieldPrefix'];
+               if (isset($conf['fieldPrefix']) || isset($conf['fieldPrefix.'])) {
+                       if ($fieldPrefix) {
+                               $prefix = $this->cObj->cleanFormName($fieldPrefix);
                        } else {
                                $prefix = '';
                        }
                } else {
-                       $prefix = $formname;
+                       $prefix = $formName;
                }
 
-               foreach ($dataArr as $val) {
+               foreach ($dataArray as $dataValue) {
 
-                       $cc++;
+                       $counter++;
                        $confData = array();
                        if (is_array($formData)) {
-                               $parts = $val;
-                               $val = 1; // TRUE...
+                               $parts = $dataValue;
+                               $dataValue = 1; // TRUE...
                        } else {
-                               $val = trim($val);
-                               $parts = explode('|', $val);
+                               $dataValue = trim($dataValue);
+                               $parts = explode('|', $dataValue);
                        }
-                       if ($val && strcspn($val, '#/')) {
+                       if ($dataValue && strcspn($dataValue, '#/')) {
                                        // label:
                                $confData['label'] = trim($parts[0]);
                                        // field:
@@ -161,7 +192,7 @@ class tslib_content_Form extends tslib_content_Abstract {
                                        }
                                                // Duplicate fieldnames resolved
                                        if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
-                                               $confData['fieldname'] .= '_' . $cc;
+                                               $confData['fieldname'] .= '_' . $counter;
                                        }
                                        $fieldname_hashArray[md5($confData['fieldname'])] = $confData['fieldname'];
                                                // Attachment names...
@@ -174,8 +205,11 @@ class tslib_content_Form extends tslib_content_Abstract {
                                }
                                $fieldCode = '';
 
-                               if ($conf['wrapFieldName']) {
-                                       $confData['fieldname'] = $this->cObj->wrap($confData['fieldname'], $conf['wrapFieldName']);
+                               $wrapFieldName = isset($conf['wrapFieldName'])
+                                       ? $this->cObj->stdWrap($conf['wrapFieldName'], $conf['wrapFieldName.'])
+                                       : $conf['wrapFieldName'];
+                               if ($wrapFieldName) {
+                                       $confData['fieldname'] = $this->cObj->wrap($confData['fieldname'], $wrapFieldName);
                                }
 
                                        // Set field name as current:
@@ -183,9 +217,14 @@ class tslib_content_Form extends tslib_content_Abstract {
 
                                        // Additional parameters
                                if (trim($confData['type'])) {
-                                       $addParams = trim($conf['params']);
-                                       if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
-                                               $addParams = trim($conf['params.'][$confData['type']]);
+                                       if (isset($conf['params.'][$confData['type']])) {
+                                               $addParams = isset($conf['params.'][$confData['type'] . '.'])
+                                                       ? trim($this->cObj->stdWrap($conf['params.'][$confData['type']], $conf['params.'][$confData['type'] . '.']))
+                                                       : trim($conf['params.'][$confData['type']]);
+                                       } else {
+                                               $addParams = isset($conf['params.'])
+                                                       ? trim($this->cObj->stdWrap($conf['params'], $conf['params.']))
+                                                       : trim($conf['params']);
                                        }
                                        if (strcmp('', $addParams)) {
                                                $addParams = ' ' . $addParams;
@@ -193,14 +232,20 @@ class tslib_content_Form extends tslib_content_Abstract {
                                } else
                                        $addParams = '';
 
-                               if ($conf['dontMd5FieldNames']) {
+                               $dontMd5FieldNames = isset($conf['dontMd5FieldNames.'])
+                                       ? $this->cObj->stdWrap($conf['dontMd5FieldNames'], $conf['dontMd5FieldNames.'])
+                                       : $conf['dontMd5FieldNames'];
+                               if ($dontMd5FieldNames) {
                                        $fName = $confData['fieldname'];
                                } else {
                                        $fName = md5($confData['fieldname']);
                                }
 
                                        // Accessibility: Set id = fieldname attribute:
-                               if ($conf['accessibility'] || $xhtmlStrict) {
+                               $accessibility = isset($conf['accessibility.'])
+                                       ? $this->cObj->stdWrap($conf['accessibility'], $conf['accessibility.'])
+                                       : $conf['accessibility'];
+                               if ($accessibility || $xhtmlStrict) {
                                        $elementIdAttribute = ' id="' . $prefix . $fName . '"';
                                } else {
                                        $elementIdAttribute = '';
@@ -210,8 +255,11 @@ class tslib_content_Form extends tslib_content_Abstract {
                                switch ($confData['type']) {
                                        case 'textarea' :
                                                $cols = trim($fParts[1]) ? intval($fParts[1]) : 20;
-                                               $compWidth = doubleval($conf['compensateFieldWidth']
-                                                                               ? $conf['compensateFieldWidth']
+                                               $compensateFieldWidth = isset($conf['compensateFieldWidth.'])
+                                                       ? $this->cObj->stdWrap($conf['compensateFieldWidth'], $conf['compensateFieldWidth.'])
+                                                       : $conf['compensateFieldWidth'];
+                                               $compWidth = doubleval($compensateFieldWidth
+                                                                               ? $compensateFieldWidth
                                                                                : $GLOBALS['TSFE']->compensateFieldWidth
                                                                        );
                                                $compWidth = $compWidth ? $compWidth : 1;
@@ -219,13 +267,19 @@ class tslib_content_Form extends tslib_content_Abstract {
 
                                                $rows = trim($fParts[2]) ? t3lib_div::intInRange($fParts[2], 1, 30) : 5;
                                                $wrap = trim($fParts[3]);
-                                               if ($conf['noWrapAttr'] || $wrap === 'disabled') {
+                                               $noWrapAttr = isset($conf['noWrapAttr.'])
+                                                       ? $this->cObj->stdWrap($conf['noWrapAttr'], $conf['noWrapAttr.'])
+                                                       : $conf['noWrapAttr'];
+                                               if ($noWrapAttr || $wrap === 'disabled') {
                                                        $wrap = '';
                                                } else {
                                                        $wrap = $wrap ? ' wrap="' . $wrap . '"' : ' wrap="virtual"';
                                                }
+                                               $noValueInsert = isset($conf['noValueInsert.'])
+                                                       ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.'])
+                                                       : $conf['noValueInsert'];
                                                $default = $this->cObj->getFieldDefaultValue(
-                                                       $conf['noValueInsert'],
+                                                       $noValueInsert,
                                                        $confData['fieldname'],
                                                        str_replace('\n', LF, trim($parts[2]))
                                                );
@@ -243,13 +297,23 @@ class tslib_content_Form extends tslib_content_Abstract {
                                        case 'input' :
                                        case 'password' :
                                                $size = trim($fParts[1]) ? intval($fParts[1]) : 20;
-                                               $compWidth = doubleval($conf['compensateFieldWidth']
-                                                                               ? $conf['compensateFieldWidth']
+                                               $compensateFieldWidth = isset($conf['compensateFieldWidth.'])
+                                                       ? $this->cObj->stdWrap($conf['compensateFieldWidth'], $conf['compensateFieldWidth.'])
+                                                       : $conf['compensateFieldWidth'];
+                                               $compWidth = doubleval($compensateFieldWidth
+                                                                               ? $compensateFieldWidth
                                                                                : $GLOBALS['TSFE']->compensateFieldWidth
                                                                        );
                                                $compWidth = $compWidth ? $compWidth : 1;
                                                $size = t3lib_div::intInRange($size * $compWidth, 1, 120);
-                                               $default = $this->cObj->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
+                                               $noValueInsert = isset($conf['noValueInsert.'])
+                                                       ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.'])
+                                                       : $conf['noValueInsert'];
+                                               $default = $this->cObj->getFieldDefaultValue(
+                                                       $noValueInsert,
+                                                       $confData['fieldname'],
+                                                       trim($parts[2])
+                                               );
 
                                                if ($confData['type'] == 'password') {
                                                        $default = '';
@@ -282,7 +346,14 @@ class tslib_content_Form extends tslib_content_Abstract {
                                        break;
                                        case 'check' :
                                                        // alternative default value:
-                                               $default = $this->cObj->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
+                                               $noValueInsert = isset($conf['noValueInsert.'])
+                                                       ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.'])
+                                                       : $conf['noValueInsert'];
+                                               $default = $this->cObj->getFieldDefaultValue(
+                                                       $noValueInsert,
+                                                       $confData['fieldname'],
+                                                       trim($parts[2])
+                                               );
                                                $checked = $default ? ' checked="checked"' : '';
                                                $fieldCode = sprintf(
                                                        '<input type="checkbox" value="%s" name="%s"%s%s%s />',
@@ -323,7 +394,14 @@ class tslib_content_Form extends tslib_content_Abstract {
                                                        } // Sets the default value if value/label pair is marked as default.
                                                }
                                                        // alternative default value:
-                                               $default = $this->cObj->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
+                                               $noValueInsert = isset($conf['noValueInsert.'])
+                                                       ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.'])
+                                                       : $conf['noValueInsert'];
+                                               $default = $this->cObj->getFieldDefaultValue(
+                                                       $noValueInsert,
+                                                       $confData['fieldname'],
+                                                       $defaults
+                                               );
                                                if (!is_array($default)) {
                                                        $defaults = array();
                                                        $defaults[] = $default;
@@ -373,13 +451,20 @@ class tslib_content_Form extends tslib_content_Abstract {
                                                        } // Sets the default value if value/label pair is marked as default.
                                                }
                                                        // alternative default value:
-                                               $default = $this->cObj->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
+                                               $noValueInsert = isset($conf['noValueInsert.'])
+                                                       ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.'])
+                                                       : $conf['noValueInsert'];
+                                               $default = $this->cObj->getFieldDefaultValue(
+                                                       $noValueInsert,
+                                                       $confData['fieldname'],
+                                                       $default
+                                               );
                                                        // Create the select-box:
                                                $iCount = count($items);
                                                for ($a = 0; $a < $iCount; $a++) {
                                                        $optionParts = '';
                                                        $radioId = $prefix . $fName . $this->cObj->cleanFormName($items[$a][0]);
-                                                       if ($conf['accessibility']) {
+                                                       if ($accessibility) {
                                                                $radioLabelIdAttribute = ' id="' . $radioId . '"';
                                                        } else {
                                                                $radioLabelIdAttribute = '';
@@ -387,27 +472,37 @@ class tslib_content_Form extends tslib_content_Abstract {
                                                        $optionParts .= '<input type="radio" name="' . $confData['fieldname'] . '"' .
                                                                        $radioLabelIdAttribute . ' value="' . $items[$a][1] . '"' .
                                                                        (!strcmp($items[$a][1], $default) ? ' checked="checked"' : '') . $addParams . ' />';
-                                                       if ($conf['accessibility']) {
-                                                               $optionParts .= '<label for="' . $radioId . '">' . $this->cObj->stdWrap(trim($items[$a][0]),
-                                                                       $conf['radioWrap.']) . '</label>';
+                                                       if ($accessibility) {
+                                                               $label = isset($conf['radioWrap.'])
+                                                                       ? $this->cObj->stdWrap(trim($items[$a][0]), $conf['radioWrap.'])
+                                                                       : trim($items[$a][0]);
+                                                               $optionParts .= '<label for="' . $radioId . '">' . $label  . '</label>';
                                                        } else {
-                                                               $optionParts .= $this->cObj->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
+                                                               $optionParts .= isset($conf['radioWrap.'])
+                                                                       ? $this->cObj->stdWrap(trim($items[$a][0]), $conf['radioWrap.'])
+                                                                       : trim($items[$a][0]);
                                                        }
-                                                       $option .= $this->cObj->stdWrap($optionParts, $conf['radioInputWrap.']);
+                                                       $option .= isset($conf['radioInputWrap.'])
+                                                               ? $this->cObj->stdWrap($optionParts, $conf['radioInputWrap.'])
+                                                               : $optionParts;
                                                }
 
-                                               if ($conf['accessibility']) {
-                                                       $accessibilityWrap = $conf['radioWrap.']['accessibilityWrap'];
-
-                                                       $search = array(
-                                                               '###RADIO_FIELD_ID###', '###RADIO_GROUP_LABEL###'
-                                                       );
-                                                       $replace = array(
-                                                               $elementIdAttribute, $confData['label']
-                                                       );
-                                                       $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap);
-
-                                                       $option = $this->cObj->wrap($option, $accessibilityWrap);
+                                               if ($accessibility) {
+                                                       $accessibilityWrap = isset($conf['radioWrap.']['accessibilityWrap.'])
+                                                               ? $this->cObj->stdWrap($conf['radioWrap.']['accessibilityWrap'], $conf['radioWrap.']['accessibilityWrap.'])
+                                                               : $conf['radioWrap.']['accessibilityWrap.'];
+
+                                                       if($accessibilityWrap) {
+                                                               $search = array(
+                                                                       '###RADIO_FIELD_ID###', '###RADIO_GROUP_LABEL###'
+                                                               );
+                                                               $replace = array(
+                                                                       $elementIdAttribute, $confData['label']
+                                                               );
+                                                               $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap);
+
+                                                               $option = $this->cObj->wrap($option, $accessibilityWrap);
+                                                       }
                                                }
 
                                                $fieldCode = $option;
@@ -529,35 +624,69 @@ class tslib_content_Form extends tslib_content_Abstract {
 
                                                // Field:
                                        $fieldLabel = $confData['label'];
-                                       if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/', $confData['type'])) {
+                                       if ($accessibility && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/', $confData['type'])) {
                                                $fieldLabel = '<label for="' . $prefix . $fName . '">' . $fieldLabel . '</label>';
                                        }
 
                                                // Getting template code:
-                                       $fieldCode = $this->cObj->stdWrap($fieldCode, $conf['fieldWrap.']);
-                                       $labelCode = $this->cObj->stdWrap($fieldLabel, $conf['labelWrap.']);
-                                       $commentCode = $this->cObj->stdWrap($confData['label'], $conf['commentWrap.']); // RTF
+                                       if(isset($conf['fieldWrap.'])) {
+                                               $fieldCode = $this->cObj->stdWrap($fieldCode, $conf['fieldWrap.']);
+                                       }
+                                       $labelCode = isset($conf['labelWrap.'])
+                                               ? $this->cObj->stdWrap($fieldLabel, $conf['labelWrap.'])
+                                               : $fieldLabel;
+                                       $commentCode = isset($conf['commentWrap.'])
+                                               ? $this->cObj->stdWrap($confData['label'], $conf['commentWrap.']) // RTF
+                                               : $confData['label'];
                                        $result = $conf['layout'];
-                                       if ($conf['REQ'] && $confData['required']) {
-                                               if (is_array($conf['REQ.']['fieldWrap.']))
+                                       $req = isset($conf['REQ.'])
+                                               ? $this->cObj->stdWrap($conf['REQ'], $conf['REQ.'])
+                                               : $conf['REQ'];
+                                       if ($req && $confData['required']) {
+                                               if (isset($conf['REQ.']['fieldWrap.'])) {
                                                        $fieldCode = $this->cObj->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
-                                               if (is_array($conf['REQ.']['labelWrap.']))
+                                               }
+                                               if (isset($conf['REQ.']['labelWrap.'])) {
                                                        $labelCode = $this->cObj->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
-                                               if ($conf['REQ.']['layout']) {
-                                                       $result = $conf['REQ.']['layout'];
+                                               }
+                                               $reqLayout = isset($conf['REQ.']['layout.'])
+                                                       ? $this->cObj->stdWrap($conf['REQ.']['layout'], $conf['REQ.']['layout.'])
+                                                       : $conf['REQ.']['layout'];
+                                               if ($reqLayout) {
+                                                       $result = $reqLayout;
                                                }
                                        }
-                                       if ($confData['type'] == 'comment' && $conf['COMMENT.']['layout']) {
-                                               $result = $conf['COMMENT.']['layout'];
+                                       if ($confData['type'] == 'comment') {
+                                               $commentLayout = isset($conf['COMMENT.']['layout.'])
+                                                       ? $this->cObj->stdWrap($conf['COMMENT.']['layout'], $conf['COMMENT.']['layout.'])
+                                                       : $conf['COMMENT.']['layout'];
+                                               if ($commentLayout) {
+                                                       $result = $commentLayout;
+                                               }
                                        }
-                                       if ($confData['type'] == 'check' && $conf['CHECK.']['layout']) {
-                                               $result = $conf['CHECK.']['layout'];
+                                       if ($confData['type'] == 'check') {
+                                               $checkLayout = isset($conf['CHECK.']['layout.'])
+                                                       ? $this->cObj->stdWrap($conf['CHECK.']['layout'], $conf['CHECK.']['layout.'])
+                                                       : $conf['CHECK.']['layout'];
+                                               if ($checkLayout) {
+                                                       $result = $checkLayout;
+                                               }
                                        }
-                                       if ($confData['type'] == 'radio' && $conf['RADIO.']['layout']) {
-                                               $result = $conf['RADIO.']['layout'];
+                                       if ($confData['type'] == 'radio') {
+                                               $radioLayout = isset($conf['RADIO.']['layout.'])
+                                                       ? $this->cObj->stdWrap($conf['RADIO.']['layout'], $conf['RADIO.']['layout.'])
+                                                       : $conf['RADIO.']['layout'];
+                                               if ($radioLayout) {
+                                                       $result = $radioLayout;
+                                               }
                                        }
-                                       if ($confData['type'] == 'label' && $conf['LABEL.']['layout']) {
-                                               $result = $conf['LABEL.']['layout'];
+                                       if ($confData['type'] == 'label') {
+                                               $labelLayout = isset($conf['LABEL.']['layout.'])
+                                                       ? $this->cObj->stdWrap($conf['LABEL.']['layout'], $conf['LABEL.']['layout.'])
+                                                       : $conf['CHECK.']['layout'];
+                                               if ($labelLayout) {
+                                                       $result = $labelLayout;
+                                               }
                                        }
                                        $result = str_replace('###FIELD###', $fieldCode, $result);
                                        $result = str_replace('###LABEL###', $labelCode, $result);
@@ -566,19 +695,27 @@ class tslib_content_Form extends tslib_content_Abstract {
                                }
                        }
                }
-               if ($conf['stdWrap.']) {
+               if (isset($conf['stdWrap.'])) {
                        $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
                }
 
 
                        // redirect (external: where to go afterwards. internal: where to submit to)
-               $theRedirect = $this->cObj->stdWrap($conf['redirect'], $conf['redirect.']); // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
+               $theRedirect = isset($conf['redirect.'])
+                       ? $this->cObj->stdWrap($conf['redirect'], $conf['redirect.'])
+                       : $conf['redirect']; // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
+               $target = isset($conf['target.'])
+                       ? $this->cObj->stdWrap($conf['target'], $conf['target.'])
+                       : $conf['target']; // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
+               $noCache = isset($conf['no_cache.'])
+                       ? $this->cObj->stdWrap($conf['no_cache'], $conf['no_cache.'])
+                       : $conf['no_cache']; // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
                $page = $GLOBALS['TSFE']->page;
                if (!$theRedirect) { // Internal: Just submit to current page
                        $LD = $GLOBALS['TSFE']->tmpl->linkData(
                                $page,
-                               $conf['target'],
-                               $conf['no_cache'],
+                               $target,
+                               $noCache,
                                'index.php',
                                '',
                                $this->cObj->getClosestMPvalueForPage($page['uid'])
@@ -587,8 +724,8 @@ class tslib_content_Form extends tslib_content_Abstract {
                        $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
                        $LD = $GLOBALS['TSFE']->tmpl->linkData(
                                $page,
-                               $conf['target'],
-                               $conf['no_cache'],
+                               $target,
+                               $noCache,
                                'index.php',
                                '',
                                $this->cObj->getClosestMPvalueForPage($page['uid'])
@@ -596,8 +733,8 @@ class tslib_content_Form extends tslib_content_Abstract {
                } else { // External URL, redirect-hidden field is rendered!
                        $LD = $GLOBALS['TSFE']->tmpl->linkData(
                                $page,
-                               $conf['target'],
-                               $conf['no_cache'],
+                               $target,
+                               $noCache,
                                '',
                                '',
                                $this->cObj->getClosestMPvalueForPage($page['uid'])
@@ -607,13 +744,19 @@ class tslib_content_Form extends tslib_content_Abstract {
                }
 
                        // Formtype (where to submit to!):
-               $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->cObj->stdWrap($conf['type'], $conf['type.']);
+               if($propertyOverride['type']) {
+                       $formtype = $propertyOverride['type'];
+               } else {
+                       $formtype = isset($conf['type.'])
+                               ? $this->cObj->stdWrap($conf['type'], $conf['type.'])
+                               : $conf['type'];
+               }
                if (t3lib_div::testInt($formtype)) { // Submit to a specific page
                        $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
                        $LD_A = $GLOBALS['TSFE']->tmpl->linkData(
                                $page,
-                               $conf['target'],
-                               $conf['no_cache'],
+                               $target,
+                               $noCache,
                                '',
                                '',
                                $this->cObj->getClosestMPvalueForPage($page['uid'])
@@ -628,8 +771,8 @@ class tslib_content_Form extends tslib_content_Abstract {
                } else { // Submit to "nothing" - which is current page
                        $LD_A = $GLOBALS['TSFE']->tmpl->linkData(
                                $GLOBALS['TSFE']->page,
-                               $conf['target'],
-                               $conf['no_cache'],
+                               $target,
+                               $noCache,
                                '',
                                '',
                                $this->cObj->getClosestMPvalueForPage($page['uid'])
@@ -638,15 +781,20 @@ class tslib_content_Form extends tslib_content_Abstract {
                }
 
                        // Recipient:
-               $theEmail = $this->cObj->stdWrap($conf['recipient'], $conf['recipient.']);
+               $theEmail = isset($conf['recipient.'])
+                       ? $this->cObj->stdWrap($conf['recipient'], $conf['recipient.'])
+                       : $conf['recipient'];
                if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
                        $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
                        $hiddenfields .= '<input type="hidden" name="recipient" value="' . htmlspecialchars($theEmail) . '" />';
                }
 
                        // location data:
-               if ($conf['locationData']) {
-                       if ($conf['locationData'] == 'HTTP_POST_VARS' && isset($_POST['locationData'])) {
+               $location = isset($conf['locationData.'])
+                       ? $this->cObj->stdWrap($conf['locationData'], $conf['locationData.'])
+                       : $conf['locationData'];
+               if ($location) {
+                       if ($location == 'HTTP_POST_VARS' && isset($_POST['locationData'])) {
                                $locationData = t3lib_div::_POST('locationData');
                        } else {
                                        // locationData is [hte page id]:[tablename]:[uid of record]. Indicates on which page the record (from tablename with uid) is shown. Used to check access.
@@ -672,13 +820,24 @@ class tslib_content_Form extends tslib_content_Abstract {
                }
 
                        // Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678)
-               $hiddenfields = '<div style="display:none;">' . $hiddenfields . '</div>';
+               $hiddenfields = isset($conf['hiddenFields.']['stdWrap.'])
+                       ? $this->cObj->stdWrap($hiddenfields, $conf['hiddenFields.']['stdWrap.'])
+                       : '<div style="display:none;">' . $hiddenfields . '</div>';
 
                if ($conf['REQ']) {
-                       $validateForm = ' onsubmit="return validateForm(\'' . $formname . '\',\'' . implode(',', $fieldlist)
-                               . '\',' . t3lib_div::quoteJSvalue($conf['goodMess']) . ',' .
-                               t3lib_div::quoteJSvalue($conf['badMess']) . ',' .
-                               t3lib_div::quoteJSvalue($conf['emailMess']) . ')"';
+                       $goodMess = isset($conf['goodMess.'])
+                               ? $this->cObj->stdWrap($conf['goodMess'], $conf['goodMess.'])
+                               : $conf['goodMess'];
+                       $badMess = isset($conf['badMess.'])
+                               ? $this->cObj->stdWrap($conf['badMess'], $conf['badMess.'])
+                               : $conf['badMess'];
+                       $emailMess = isset($conf['emailMess.'])
+                               ? $this->cObj->stdWrap($conf['emailMess'], $conf['emailMess.'])
+                               : $conf['emailMess'];
+                       $validateForm = ' onsubmit="return validateForm(\'' . $formName . '\',\'' . implode(',', $fieldlist)
+                               . '\',' . t3lib_div::quoteJSvalue($goodMess) . ',' .
+                               t3lib_div::quoteJSvalue($badMess) . ',' .
+                               t3lib_div::quoteJSvalue($emailMess) . ')"';
                        $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="' .
                                t3lib_div::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix .
                                't3lib/jsfunc.validateform.js') . '"></script>';
@@ -688,19 +847,25 @@ class tslib_content_Form extends tslib_content_Abstract {
 
                        // Create form tag:
                $theTarget = ($theRedirect ? $LD['target'] : $LD_A['target']);
+               $method = isset($conf['method.'])
+                       ? $this->cObj->stdWrap($conf['method'], $conf['method.'])
+                       : $conf['method'];
                $content = array(
                        '<form' . ' action="' . htmlspecialchars($action) . '"' . ' id="' .
-                       $formname . '"' . ($xhtmlStrict ? '' : ' name="' . $formname . '"') .
+                       $formName . '"' . ($xhtmlStrict ? '' : ' name="' . $formName . '"') .
                        ' enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"' .
-                       ' method="' . ($conf['method'] ? $conf['method'] : 'post') . '"' .
+                       ' method="' . ($method ? $method : 'post') . '"' .
                        ($theTarget ? ' target="' . $theTarget . '"' : '') .
                        $validateForm . '>', $hiddenfields . $content,
                        '</form>'
                );
 
-               if ($conf['arrayReturnMode']) {
+               $arrayReturnMode = isset($conf['arrayReturnMode.'])
+                       ? $this->cObj->stdWrap($conf['arrayReturnMode'], $conf['arrayReturnMode.'])
+                       : $conf['arrayReturnMode'];
+               if ($arrayReturnMode) {
                        $content['validateForm'] = $validateForm;
-                       $content['formname'] = $formname;
+                       $content['formname'] = $formName;
                        return $content;
                } else {
                        return implode('', $content);
index 2409d16..873f98a 100644 (file)
@@ -120,7 +120,7 @@ lib.parseFunc_RTE {
                        addChr10BetweenParagraphs=1
                }
                div.stripNL = 1
-               div.callRecursive = 1 
+               div.callRecursive = 1
        }
        nonTypoTagStdWrap.encapsLines {
                encapsTagList = p,pre,h1,h2,h3,h4,h5,h6
@@ -304,7 +304,7 @@ tt_content.stdWrap {
 
                                        stdWrap {
                                                prioriCalc = intval
-                                               wrap = margin-bottom:|px; 
+                                               wrap = margin-bottom:|px;
                                                required = 1
                                                ifEmpty.value =
                                        }
@@ -316,7 +316,7 @@ tt_content.stdWrap {
                        30 = TEXT
                        30.value = >|</div>
                }
-               
+
                1 =< tt_content.stdWrap.innerWrap.cObject.default
                1.15.value = csc-frame csc-frame-invisible
 
@@ -340,7 +340,7 @@ tt_content.stdWrap {
 
                21 =< tt_content.stdWrap.innerWrap.cObject.default
                21.15.value = csc-frame csc-frame-frame2
-               
+
                66 = COA
                66 {
                        10 = TEXT
@@ -348,7 +348,7 @@ tt_content.stdWrap {
                                value = <a id="c{field:uid}"></a>
                                insertData = 1
                        }
-                       
+
                        20 = COA
                        20 {
                                10 = TEXT
@@ -371,12 +371,12 @@ tt_content.stdWrap {
                                        wrap2 = <div style="|"></div>
                                }
                        }
-                       
+
                        30 = TEXT
                        30 {
                                value = |
                        }
-                       
+
                        40 < .20
                        40 {
                                10 {
@@ -387,13 +387,13 @@ tt_content.stdWrap {
                                stdWrap.wrap = margin-bottom:|px;
                        }
                }
-               
+
        }
-       
+
        innerWrap2 = | <p class="csc-linkToTop"><a href="#">{LLL:EXT:css_styled_content/pi1/locallang.xml:label.toTop}</a></p>
        innerWrap2.insertData = 1
        innerWrap2.fieldRequired = linkToTop
-       
+
        prepend = TEXT
        prepend.dataWrap = <a id="c{field:_LOCALIZED_UID}"></a>
        prepend.if.isTrue.field = _LOCALIZED_UID
@@ -505,7 +505,7 @@ tt_content.image.20 {
                        typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
                        typolink.target = {$styles.content.links.target}
                        typolink.extTarget = {$styles.content.links.extTarget}
-                       
+
                        linkParams.ATagParams.dataWrap =  class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"
                }
 
@@ -656,7 +656,7 @@ tt_content.image.20 {
                                        }
                                        value = ul
                                }
-                               
+
                                # Multiple images and no caption at all => "ul"
                                30 = TEXT
                                30 {
@@ -768,7 +768,7 @@ tt_content.bullets {
                        1.current = 1
                        1.parseFunc =< lib.parseFunc
                        1.wrap = <li class="odd">|</li>
-       
+
                        2.current = 1
                        2.parseFunc =< lib.parseFunc
                        2.wrap = <li class="even">|</li>
@@ -777,7 +777,7 @@ tt_content.bullets {
                editIcons = tt_content: bodytext, [layout]
                editIcons.beforeLastTag = 1
                editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.php:eIcon.bullets
-       
+
                prefixComment = 2 | Bullet list:
        }
 }
@@ -965,22 +965,22 @@ tt_content.swfobject {
 
        20 = SWFOBJECT
        20 {
-               file = 
-               width = 
+               file =
+               width =
                height =
-               
+
                flexParams.field = pi_flexform
-               
+
                alternativeContent.field = bodytext
-               
+
                layout = ###SWFOBJECT###
-               
+
                video {
                        player = {$styles.content.media.videoPlayer}
-                       
+
                        defaultWidth  = {$styles.content.media.defaultVideoWidth}
                        defaultHeight  = {$styles.content.media.defaultVideoHeight}
-                       
+
                        default {
                                params.quality = high
                                params.menu = false
@@ -988,16 +988,16 @@ tt_content.swfobject {
                                params.allowFullScreen = true
                        }
                        mapping {
-                               
+
                        }
                }
-               
+
                audio {
                        player = {$styles.content.media.audioPlayer}
-                       
+
                        defaultWidth = {$styles.content.media.defaultAudioWidth}
                        defaultHeight = {$styles.content.media.defaultAudioHeight}
-                       
+
                        default {
                                params.quality = high
                                params.allowScriptAccess = sameDomain
@@ -1007,14 +1007,14 @@ tt_content.swfobject {
                                flashvars.file = soundFile
                        }
                }
-               
+
        }
        20.stdWrap {
                editIcons = tt_content: multimedia, imagewidth, imageheight, pi_flexform, bodytext
                editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
 
                prefixComment = 2 | SWFobject element:
-       }       
+       }
 }
 
 # *****************
@@ -1026,22 +1026,22 @@ tt_content.qtobject {
 
        20 = QTOBJECT
        20 {
-               file = 
-               width = 
+               file =
+               width =
                height =
-               
-               flexParams.field = pi_flexform 
-               
+
+               flexParams.field = pi_flexform
+
                alternativeContent.field = bodytext
-               
+
                layout = ###QTOBJECT###
-               
+
                video {
                        player = {$styles.content.media.videoPlayer}
-                       
+
                        defaultWidth  = {$styles.content.media.defaultVideoWidth}
                        defaultHeight  = {$styles.content.media.defaultVideoHeight}
-                       
+
                        default {
                                params.quality = high
                                params.menu = false
@@ -1049,16 +1049,16 @@ tt_content.qtobject {
                                params.allowFullScreen = true
                        }
                        mapping {
-                               
+
                        }
                }
-               
+
                audio {
                        player = {$styles.content.media.audioPlayer}
-                       
+
                        defaultWidth = {$styles.content.media.defaultAudioWidth}
                        defaultHeight = {$styles.content.media.defaultAudioHeight}
-                       
+
                        default {
                                params.quality = high
                                params.allowScriptAccess = sameDomain
@@ -1074,7 +1074,7 @@ tt_content.qtobject {
                editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
 
                prefixComment = 2 | QTobject element:
-       }       
+       }
 }
 
 # *****************
@@ -1086,16 +1086,16 @@ tt_content.media {
 
        20 = MEDIA
        20 {
-               
+
                flexParams.field = pi_flexform
                alternativeContent < tt_content.text.20
                alternativeContent.field = bodytext
-               
+
                type = video
                renderType = auto
                allowEmptyUrl = 0
                forcePlayer = 1
-               
+
                fileExtHandler {
                        default = MEDIA
                        avi = MEDIA
@@ -1112,17 +1112,17 @@ tt_content.media {
                        m4v = QT
                        m4a = QT
                }
-               
+
                mimeConf.swfobject < tt_content.swfobject.20
                mimeConf.qtobject < tt_content.qtobject.20
-               
+
        }
        20.stdWrap {
                editIcons = tt_content: pi_flexform, bodytext
                editIcons.iconTitle.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.multimedia
 
                prefixComment = 2 | Media element:
-       }       
+       }
 }
 
 # ******************
@@ -1154,7 +1154,8 @@ tt_content.mailform.20 {
        recipient.field = subheader
        data.field = bodytext
        locationData = 1
-       
+       hiddenFields.stdWrap.wrap = <div style="display:none;">|</div>
+
        params.radio = class="csc-mailform-radio"
        params.check = class="csc-mailform-check"
        params.submit = class="csc-mailform-submit"
@@ -1422,7 +1423,7 @@ tt_content.menu {
                        special = directory
                        wrap = <ul class="csc-menu csc-menu-1">|</ul>
                }
-       
+
                # "Sitemap - liststyle"
                2 = HMENU
                2 {
@@ -1446,7 +1447,7 @@ tt_content.menu {
                        6 < .1
                        7 < .1
                }
-       
+
                # "Section index (pagecontent w/Index checked - liststyle)"
                3 < styles.content.get
                3 {
@@ -1465,7 +1466,7 @@ tt_content.menu {
                                typolink.section.field = uid
                        }
                }
-       
+
                # "Menu of subpages to these pages (with abstract)"
                4 < .1
                4 {
@@ -1482,7 +1483,7 @@ tt_content.menu {
                                ATagTitle.field = description // title
                        }
                }
-       
+
                # "Recently updated pages"
                5 < .default
                5 {
@@ -1493,7 +1494,7 @@ tt_content.menu {
                                excludeNoSearchPages = 1
                        }
                }
-       
+
                # "Related pages (based on keywords)"
                6 < .default
                6 {
@@ -1503,7 +1504,7 @@ tt_content.menu {
                                excludeNoSearchPages = 1
                        }
                }
-       
+
                # "Menu of subpages to these pages + sections - liststyle"
                7 < .1
                7 {
@@ -1764,7 +1765,7 @@ plugin.tx_cssstyledcontent._CSS_DEFAULT_STYLE (
        DIV.csc-textpic DIV.csc-textpic-imagerow { clear: both; }
        DIV.csc-textpic DIV.csc-textpic-single-image IMG { margin-bottom: {$styles.content.imgtext.rowSpace}px; }
 
-       /* IE7 hack for margin between image rows */    
+       /* IE7 hack for margin between image rows */
        *+html DIV.csc-textpic DIV.csc-textpic-imagerow .csc-textpic-image { margin-bottom: 0; }
        *+html DIV.csc-textpic DIV.csc-textpic-imagerow { margin-bottom: {$styles.content.imgtext.rowSpace}px; }
 
@@ -1820,7 +1821,7 @@ plugin.tx_cssstyledcontent._CSS_DEFAULT_STYLE (
        * html .csc-textpic-intext-left ol,
        * html .csc-textpic-intext-left ul { height: 1%; }
        /* End hide from IE5/mac */
-       
+
        DIV.csc-textpic DIV.csc-textpic-imagerow-last { margin-bottom: 0; }
 
        /* Browser fixes: */