Index: typo3/sysext/cms/tslib/class.tslib_content.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/cms/tslib/class.tslib_content.php,v
retrieving revision 1.96
diff -u -r1.96 class.tslib_content.php
--- typo3/sysext/cms/tslib/class.tslib_content.php	27 Dec 2005 20:26:14 -0000	1.96
+++ typo3/sysext/cms/tslib/class.tslib_content.php	30 Dec 2005 11:22:20 -0000
@@ -1663,6 +1663,7 @@
 				}
 				$typeParts = explode('=',$fParts[0]);
 				$confData['type'] = trim(strtolower(end($typeParts)));
+				$confData['typeUpper'] = strtoupper($confData['type']);
 				if (count($typeParts)==1)	{
 					$confData['fieldname'] = $this->cleanFormName($parts[0]);
 					if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email')	{$confData['fieldname']='email';}
@@ -1691,7 +1692,10 @@
 					// Additional parameters
 				if (trim($confData['type']))	{
 					$addParams=trim($conf['params']);
-					if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']]))	{
+					if ($conf[$confData['typeUpper'].'.']['addParams'])	{
+						$addParams = trim($conf[$confData['typeUpper'].'.']['addParams']);
+					} elseif (is_array($conf['params.']) && isset($conf['params.'][$confData['type']]))	{
+							// Backwards compatibility
 						$addParams=trim($conf['params.'][$confData['type']]);
 					}
 					if (strcmp('',$addParams))	$addParams=' '.$addParams;
@@ -1702,13 +1706,9 @@
 				} else {
 					$fName = md5($confData['fieldname']);
 				}
+				$id = $prefix.$fName;
 
-					// Accessibility: Set id = fieldname attribute:
-				if ($conf['accessibility'] || $xhtmlStrict)	{
-					$elementIdAttribute = ' id="'.$prefix.$fName.'"';
-				} else {
-					$elementIdAttribute = '';
-				}
+				$addParams = str_replace('###ID###',$id,$addParams);
 
 					// Create form field based on configuration/type:
 				switch($confData['type'])	{
@@ -1726,7 +1726,7 @@
 							$wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
 						}
 						$default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
-						$fieldCode=sprintf('<textarea name="%s"'.$elementIdAttribute.' cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
+						$fieldCode=sprintf('<textarea name="%s" cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
 							$confData['fieldname'], $cols, $rows, $wrap, t3lib_div::formatForTextarea($default));
 					break;
 					case 'input':
@@ -1744,20 +1744,20 @@
 						$max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
 						$theType = $confData['type']=='input' ? 'text' : 'password';
 
-						$fieldCode=sprintf('<input type="'.$theType.'" name="%s"'.$elementIdAttribute.' size="%s"%s value="%s"'.$addParams.' />',
+						$fieldCode=sprintf('<input type="'.$theType.'" name="%s" size="%s"%s value="%s"'.$addParams.' />',
 							$confData['fieldname'], $size, $max, htmlspecialchars($default));
 
 					break;
 					case 'file':
 						$size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
-						$fieldCode=sprintf('<input type="file" name="%s"'.$elementIdAttribute.' size="%s"'.$addParams.' />',
+						$fieldCode=sprintf('<input type="file" name="%s" size="%s"'.$addParams.' />',
 							$confData['fieldname'], $size);
 					break;
 					case 'check':
 							// alternative default value:
 						$default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
 						$checked = $default ? ' checked="checked"' : '';
-						$fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"'.$elementIdAttribute.'%s'.$addParams.' />',
+						$fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s'.$addParams.' />',
 							1, $confData['fieldname'], $checked);
 					break;
 					case 'select':
@@ -1795,14 +1795,11 @@
 						}
 
 						if ($multiple)	$confData['fieldname'].='[]';	// The fieldname must be prepended '[]' if multiple select. And the reason why it's prepended is, because the required-field list later must also have [] prepended.
-						$fieldCode=sprintf('<select name="%s"'.$elementIdAttribute.' size="%s"%s'.$addParams.'>%s</select>',
+						$fieldCode=sprintf('<select name="%s" size="%s"%s'.$addParams.'>%s</select>',
 							$confData['fieldname'], $size, $multiple, $option); //RTF
 					break;
 					case 'radio':
 						$option='';
-						if ($conf['accessibility'])	{
-							$option.='<fieldset'.$elementIdAttribute.'><legend>'.$confData['label'].'</legend>';
-						}
 						$valueParts = explode(',',$parts[2]);
 						$items=array();		// Where the items will be
 						$default='';
@@ -1822,23 +1819,27 @@
 						$default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
 							// Create the select-box:
 						for($a=0;$a<count($items);$a++)	{
-							$radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
-							if ($conf['accessibility'])	{
-								$radioLabelIdAttribute = ' id="'.$radioId.'"';
-							} else {
-								$radioLabelIdAttribute = '';
+							$radioId = $id.$this->cleanFormName($items[$a][0]);
+							$itemAddParams = $conf['RADIO.']['item.']['addParams'];
+							$itemAddParams = str_replace('###RADIO_ID###',$radioId,$itemAddParams);
+							$radio = '<input type="radio" name="'.$confData['fieldname'].'" value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').''.$itemAddParams.' />';
+							if (is_array($conf['RADIO.']['item.']['labelWrap.']))	{
+								$radioLabel = $this->stdWrap(trim($items[$a][0]), $conf['RADIO.']['item.']['labelWrap.']);
+							} elseif (is_array($conf['radioWrap.']))	{
+									// Backwards compatibility
+								$radioLabel = $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
 							}
-							$option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').''.$addParams.' />';
-							if ($conf['accessibility'])	{
-								$option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
+							$radioLabel = str_replace('###RADIO_ID###',$radioId,$radioLabel);
+							if ($conf['RADIO.']['item.']['layout'])	{
+								$itemLayout = $conf['RADIO.']['item.']['layout'];
+								$itemLayout = str_replace('###RADIO###',$radio,$itemLayout);
+								$itemLayout = str_replace('###RADIO_LABEL###',$radioLabel,$itemLayout);
 							} else {
-								$option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
+									// Backwards compatibility
+								$itemLayout = $radio.$radioLabel.'<br />';
 							}
- 							$option .= '<br />';
+							$option .= $itemLayout;
  						}
-						if ($conf['accessibility'])	{
-							$option.='</fieldset>';
-						}
 						$fieldCode = $option;
 					break;
 					case 'hidden':
@@ -1849,7 +1850,7 @@
 						if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']))	{
 							$value = $GLOBALS['TSFE']->codeString($value);
 						}
-						$hiddenfields.=sprintf('<input type="hidden" name="%s"'.$elementIdAttribute.' value="%s" />',
+						$hiddenfields.=sprintf('<input type="hidden" name="%s" value="%s"'.$addParams.'/>',
 							$confData['fieldname'], htmlspecialchars($value));
 					break;
 					case 'property':
@@ -1868,13 +1869,13 @@
 						if($image)	{
 							$fieldCode = str_replace('<img','<input type="image"'.$addParams.' name="'.$confData['fieldname'].'"' ,$image);
 						} else	{
-							$fieldCode=sprintf('<input type="submit" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
+							$fieldCode=sprintf('<input type="submit" name="%s" value="%s"'.$addParams.' />',
 								$confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
 						}
 					break;
 					case 'reset':
 						$value=trim($parts[2]);
-						$fieldCode=sprintf('<input type="reset" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
+						$fieldCode=sprintf('<input type="reset" name="%s" value="%s"'.$addParams.' />',
 							$confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
 					break;
 					case 'label':
@@ -1882,6 +1883,7 @@
 					break;
 					default:
 						$confData['type'] = 'comment';
+						$confData['typeUpper'] = 'COMMENT';
 						$fieldCode = trim($parts[2]).'&nbsp;';
 					break;
 				}
@@ -1918,40 +1920,51 @@
 						break;
 					}
 
-						// Field:
+
+						// Getting template markers:
+						// ###FIELD###
+					$rawFieldCode = $fieldCode;
+					if (is_array($conf[$confData['typeUpper'].'.']['fieldWrap.']))	{
+						$fieldCode = $this->stdWrap($fieldCode, $conf[$confData['typeUpper'].'.']['fieldWrap.']);
+					} else	{
+						$fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
+					}
+						// ###LABEL###
 					$fieldLabel = $confData['label'];
-					if ($conf['accessibility'] && $confData['type']!='radio' && $confData['type'] != 'label')	{
-						$fieldLabel = '<label for="'.$prefix.$fName.'">'.$fieldLabel.'</label>';
+					if (is_array($conf[$confData['typeUpper'].'.']['labelWrap.']))	{
+						$labelCode = $this->stdWrap($fieldLabel, $conf[$confData['typeUpper'].'.']['labelWrap.']);
+					} else	{
+						$labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
 					}
+					$labelCode = str_replace('###ID###',$id,$labelCode);
 
-						// Getting template code:
-					$fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
-					$labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
+						// ###COMMENT### (alternative label wrapping)
 					$commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']); // RTF
+
+						// Getting template code
 					$result = $conf['layout'];
+					if (isset($conf[$confData['typeUpper'].'.']['layout']))	{
+						$result = $conf[$confData['typeUpper'].'.']['layout'];
+					}
 					if ($conf['REQ'] && $confData['required'])	{
-						if (is_array($conf['REQ.']['fieldWrap.']))
-							$fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
-						if (is_array($conf['REQ.']['labelWrap.']))
+						if (is_array($conf[$confData['typeUpper'].'.']['REQ.']['fieldWrap.']))
+							$fieldCode = $this->stdWrap($rawFieldCode, $conf[$confData['typeUpper'].'.']['REQ.']['fieldWrap.']);
+						elseif (is_array($conf['REQ.']['fieldWrap.']))
+							$fieldCode = $this->stdWrap($rawFieldCode, $conf['REQ.']['fieldWrap.']);
+
+						if (is_array($conf[$confData['typeUpper'].'.']['REQ.']['labelWrap.']))
+							$labelCode = $this->stdWrap($fieldLabel, $conf[$confData['typeUpper'].'.']['REQ.']['labelWrap.']);
+						elseif (is_array($conf['REQ.']['labelWrap.']))
 							$labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
-						if ($conf['REQ.']['layout'])	{
+
+						if (is_array($conf[$confData['typeUpper'].'.']['REQ.']['layout']))
+							$result = $conf[$confData['typeUpper'].'.']['REQ.']['layout'];
+						elseif (is_array($conf['REQ.']['layout']))
 							$result = $conf['REQ.']['layout'];
-						}
-					}
-					if ($confData['type']=='comment' && $conf['COMMENT.']['layout'])	{
-						$result = $conf['COMMENT.']['layout'];
-					}
-					if ($confData['type']=='check' && $conf['CHECK.']['layout'])	{
-						$result = $conf['CHECK.']['layout'];
-					}
-					if ($confData['type']=='radio' && $conf['RADIO.']['layout'])	{
-						$result = $conf['RADIO.']['layout'];
-					}
-					if ($confData['type']=='label' && $conf['LABEL.']['layout']) {
-						$result = $conf['LABEL.']['layout'];
 					}
 					$result = str_replace('###FIELD###',$fieldCode,$result);
 					$result = str_replace('###LABEL###',$labelCode,$result);
+					$result = str_replace('###ID###',$id,$result);
 					$result = str_replace('###COMMENT###',$commentCode,$result); //RTF
 					$content.= $result;
 				}
Index: typo3/sysext/css_styled_content/static/setup.txt
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/css_styled_content/static/setup.txt,v
retrieving revision 1.5
diff -u -r1.5 setup.txt
--- typo3/sysext/css_styled_content/static/setup.txt	26 Dec 2005 23:59:37 -0000	1.5
+++ typo3/sysext/css_styled_content/static/setup.txt	30 Dec 2005 11:22:20 -0000
@@ -1120,23 +1120,58 @@
 
 # change mailform to accesssible mode
 tt_content.mailform.20 {
-  accessibility = 1
-  noWrapAttr=1
+  noWrapAttr = 1
   formName = mailform
   dontMd5FieldNames = 1
-  REQ = 1
   layout = <div class="csc-mailform-field">###LABEL### ###FIELD###</div>
-  COMMENT.layout = <div class="csc-mailform-label">###LABEL###</div>
-  RADIO.layout = <div class="csc-mailform-field">###LABEL### <fieldset class="csc-mailform-radio" id="testform_radio">###FIELD###</fieldset></div>
-  LABEL.layout = <div class="csc-mailform-field">###LABEL### <span class="csc-mailform-label">###FIELD###</span></div>
-  labelWrap.wrap = |
+  labelWrap.wrap = <label for="###ID###" class="csc-mailform-label"> | </label>
   commentWrap.wrap = |
-  radioWrap.wrap = |
-  REQ.labelWrap.wrap = |
+  REQ = 1
+  REQ.labelWrap.wrap = <label for="###ID###" class="csc-mailform-label-req"> | </label>
+  COMMENT {
+    layout = <div class="csc-mailform-label">###LABEL###</div>
+    labelWrap.wrap = |
+  }
+  RADIO {
+    layout = <div class="csc-mailform-field">###LABEL### <fieldset class="csc-mailform-radio" id="###ID###"><legend>###COMMENT###</legend>###FIELD###</fieldset></div>
+    item {
+      layout = ###RADIO######RADIO_LABEL###<br />
+      addParams = id="###RADIO_ID###" class="csc-mailform-radio"
+      labelWrap.wrap = <label for="###RADIO_ID###"> | </label>
+    }
+  }
+  LABEL {
+    layout = <div class="csc-mailform-field"><span class="csc-mailform-label">###LABEL###</span></div>
+    labelWrap.wrap = |
+  }
+  CHECK {
+    addParams = id="###ID###" class="csc-mailform-check"
+  }
+  INPUT {
+    addParams = id="###ID###" class="csc-mailform-input"
+  }
+  HIDDEN {
+    addParams = id="###ID###"
+  }
+  PASSWORD {
+    addParams = id="###ID###" class="csc-mailform-password"
+  }
+  FILE {
+    addParams = id="###ID###" class="csc-mailform-file"
+  }
+  TEXTAREA {
+    addParams = id="###ID###" class="csc-mailform-textarea"
+  }
+  SELECT {
+    addParams = id="###ID###" class="csc-mailform-select"
+  }
+  SUBMIT {
+    addParams = id="###ID###" class="csc-mailform-submit"
+  }
+  RESET {
+    addParams = id="###ID###" class="csc-mailform-reset"
+  }
   stdWrap.wrap = <fieldset class="csc-mailform"> | </fieldset>
-  params.radio = class="csc-mailform-radio"
-  params.check = class="csc-mailform-check"
-  params.submit = class="csc-mailform-submit"
 }
 
 # accessible menu
