* Added feature #2421: CSC: Move static HTML from render_uploads to TypoScript, provi...
authorErnesto Baschny <ernst@cron-it.de>
Mon, 29 Jun 2009 09:43:30 +0000 (09:43 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Mon, 29 Jun 2009 09:43:30 +0000 (09:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5655 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php
typo3/sysext/css_styled_content/static/setup.txt
typo3/sysext/css_styled_content/static/v3.8/setup.txt
typo3/sysext/css_styled_content/static/v3.9/setup.txt
typo3/sysext/css_styled_content/static/v4.2/setup.txt

index b938513..e7425f9 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-06-29  Ernesto Baschny <ernst@cron-it.de>
 
-       * Fixed Bug #5381: Added htmlSpecialChars to rendering page titles in Sitemap/menu content elements
+       * Fixed Bug #5381: CSC: Added htmlSpecialChars to rendering page titles in Sitemap/menu content elements (Thanks to Susanne Moog)
+       * Added feature #2421: CSC: Move static HTML from render_uploads to TypoScript, providing flexible rendering of "Filelinks" content elements
 
 2009-06-29  Benjamin Mack <benni@typo3.org>
 
index 761a389..db12dff 100755 (executable)
@@ -322,6 +322,9 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
                                $conf['linkProc.']['icon.']['wrap'] = ' | //**//';      // Temporary, internal split-token!
                                $conf['linkProc.']['icon_link'] = 1;    // ALways link the icon
                                $conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';  // If the layout is type 2 or 3 we will render an image based icon if possible.
+                               if ($conf['labelStdWrap.']) {
+                                       $conf['linkProc.']['labelStdWrap.'] = $conf['labelStdWrap.'];
+                               }
 
                                        // Traverse the files found:
                                $filesData = array();
@@ -339,44 +342,43 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
 
                                                $this->cObj->setCurrentVal($path);
                                                $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
+                                               $GLOBALS['TSFE']->register['filename'] = $filesData[$key]['filename'];
+                                               $GLOBALS['TSFE']->register['path'] = $filesData[$key]['path'];
+                                               $GLOBALS['TSFE']->register['fileSize'] = $filesData[$key]['filesize'];
+                                               $GLOBALS['TSFE']->register['fileExtension'] = $filesData[$key]['fileextension'];
+                                               $GLOBALS['TSFE']->register['description'] = $filesData[$key]['description'];
                                                $filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.']));
                                        }
                                }
 
+                                       // optionSplit applied to conf to allow differnt settings per file
+                               $splitConf = $GLOBALS['TSFE']->tmpl->splitConfArray($conf, count($filesData));
+
                                        // Now, lets render the list!
-                               $tRows = array();
-                               foreach($filesData as $key => $fileD)   {
-
-                                               // Setting class of table row for odd/even rows:
-                                       $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
-
-                                               // Render row, based on the "layout" setting
-                                       $tRows[]='
-                                       <tr class="'.$oddEven.'">'.($type>0 ? '
-                                               <td class="csc-uploads-icon">
-                                                       '.$fileD['linkedFilenameParts'][0].'
-                                               </td>' : '').'
-                                               <td class="csc-uploads-fileName">
-                                                       <p>'.$fileD['linkedFilenameParts'][1].'</p>'.
-                                                       ($fileD['description'] ? '
-                                                       <p class="csc-uploads-description">'.htmlspecialchars($fileD['description']).'</p>' : '').'
-                                               </td>'.($this->cObj->data['filelink_size'] ? '
-                                               <td class="csc-uploads-fileSize">
-                                                       <p>' . $this->cObj->stdWrap($fileD['filesize'], $conf['filesize.']) . '</p>
-                                               </td>' : '').'
-                                       </tr>';
+                               $outputEntries = array();
+                               foreach($filesData as $key => $fileData)        {
+                                       $GLOBALS['TSFE']->register['linkedIcon'] = $fileData['linkedFilenameParts'][0];
+                                       $GLOBALS['TSFE']->register['linkedLabel'] = $fileData['linkedFilenameParts'][1];
+                                       $GLOBALS['TSFE']->register['filename'] = $fileData['filename'];
+                                       $GLOBALS['TSFE']->register['path'] = $fileData['path'];
+                                       $GLOBALS['TSFE']->register['description'] = $fileData['description'];
+                                       $GLOBALS['TSFE']->register['fileSize'] = $fileData['filesize'];
+                                       $GLOBALS['TSFE']->register['fileExtension'] = $fileData['fileextension'];
+                                       $outputEntries[] = $this->cObj->cObjGetSingle($splitConf[$key]['itemRendering'], $splitConf[$key]['itemRendering.']);
                                }
 
-                                       // Table tag params.
-                               $tableTagParams = $this->getTableAttributes($conf,$type);
-                               $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
-
+                               if (isset($conf['outerWrap']))  {
+                                               // Wrap around the whole content
+                                       $outerWrap = $conf['outerWrap'];
+                               } else  {
+                                               // Table tag params
+                                       $tableTagParams = $this->getTableAttributes($conf,$type);
+                                       $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
+                                       $outerWrap = '<table ' . t3lib_div::implodeAttributes($tableTagParams) . '>|</table>';
+                               }
 
                                        // Compile it all into table tags:
-                               $out = '
-                               <table '.t3lib_div::implodeAttributes($tableTagParams).'>
-                                       '.implode('',$tRows).'
-                               </table>';
+                               $out = $this->cObj->wrap(implode('',$outputEntries), $outerWrap);;
                        }
 
                                // Calling stdWrap:
index 1616025..0662976 100644 (file)
@@ -790,6 +790,40 @@ tt_content.uploads {
        20.field = media
        20.filePath.field = select_key
 
+       20 {
+               # Rendering for each file (e.g. rows of the table) as a cObject
+               itemRendering = COA
+               itemRendering {
+                       wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*|
+
+                       10 = TEXT
+                       10.data = register:linkedIcon
+                       10.wrap = <td class="csc-uploads-icon">|</td>
+                       10.if.isPositive.field = layout
+
+                       20 = COA
+                       20.wrap = <td class="csc-uploads-fileName">|</td>
+                       20.1 = TEXT
+                       20.1 {
+                               data = register:linkedLabel
+                               wrap = <p>|</p>
+                       }
+                       20.2 = TEXT
+                       20.2 {
+                               data = register:description
+                               wrap = <p class="csc-uploads-description">|</p>
+                               required = 1
+                       }
+
+                       30 = TEXT
+                       30.if.isTrue.field = filelink_size
+                       30.data = register:fileSize
+                       30.wrap = <td class="csc-uploads-fileSize">|</td>
+                       30.bytes = 1
+                       30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+               }
+       }
+
        20.color {
                default =
                1 = #EDEBF1
index 348d433..8d05e0c 100644 (file)
@@ -563,6 +563,40 @@ tt_content.uploads {
        20.userFunc = tx_cssstyledcontent_pi1->render_uploads
        20.field = media
 
+       20 {
+               # Rendering for each file (e.g. rows of the table) as a cObject
+               itemRendering = COA
+               itemRendering {
+                       wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*|
+
+                       10 = TEXT
+                       10.data = register:linkedIcon
+                       10.wrap = <td class="csc-uploads-icon">|</td>
+                       10.if.isPositive.field = layout
+
+                       20 = COA
+                       20.wrap = <td class="csc-uploads-fileName">|</td>
+                       20.1 = TEXT
+                       20.1 {
+                               data = register:linkedLabel
+                               wrap = <p>|</p>
+                       }
+                       20.2 = TEXT
+                       20.2 {
+                               data = register:description
+                               wrap = <p class="csc-uploads-description">|</p>
+                               required = 1
+                       }
+
+                       30 = TEXT
+                       30.if.isTrue.field = filelink_size
+                       30.data = register:fileSize
+                       30.wrap = <td class="csc-uploads-fileSize">|</td>
+                       30.bytes = 1
+                       30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+               }
+       }
+
        20.color {
                default =
                1 = #EDEBF1
index d41e5bd..2aec1df 100644 (file)
@@ -655,6 +655,40 @@ tt_content.uploads {
        20 = USER
        20.userFunc = tx_cssstyledcontent_pi1->render_uploads
        20.field = media
+       
+       20 {
+               # Rendering for each file (e.g. rows of the table) as a cObject
+               itemRendering = COA
+               itemRendering {
+                       wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*|
+
+                       10 = TEXT
+                       10.data = register:linkedIcon
+                       10.wrap = <td class="csc-uploads-icon">|</td>
+                       10.if.isPositive.field = layout
+
+                       20 = COA
+                       20.wrap = <td class="csc-uploads-fileName">|</td>
+                       20.1 = TEXT
+                       20.1 {
+                               data = register:linkedLabel
+                               wrap = <p>|</p>
+                       }
+                       20.2 = TEXT
+                       20.2 {
+                               data = register:description
+                               wrap = <p class="csc-uploads-description">|</p>
+                               required = 1
+                       }
+
+                       30 = TEXT
+                       30.if.isTrue.field = filelink_size
+                       30.data = register:fileSize
+                       30.wrap = <td class="csc-uploads-fileSize">|</td>
+                       30.bytes = 1
+                       30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+               }
+       }
 
        20.color {
                default =
index 47eb2a8..220550f 100644 (file)
@@ -672,6 +672,40 @@ tt_content.uploads {
        20.userFunc = tx_cssstyledcontent_pi1->render_uploads
        20.field = media
 
+       20 {
+               # Rendering for each file (e.g. rows of the table) as a cObject
+               itemRendering = COA
+               itemRendering {
+                       wrap = <tr class="tr-odd tr-first">|</tr> |*| <tr class="tr-even">|</tr> || <tr class="tr-odd">|</tr> |*|
+
+                       10 = TEXT
+                       10.data = register:linkedIcon
+                       10.wrap = <td class="csc-uploads-icon">|</td>
+                       10.if.isPositive.field = layout
+
+                       20 = COA
+                       20.wrap = <td class="csc-uploads-fileName">|</td>
+                       20.1 = TEXT
+                       20.1 {
+                               data = register:linkedLabel
+                               wrap = <p>|</p>
+                       }
+                       20.2 = TEXT
+                       20.2 {
+                               data = register:description
+                               wrap = <p class="csc-uploads-description">|</p>
+                               required = 1
+                       }
+
+                       30 = TEXT
+                       30.if.isTrue.field = filelink_size
+                       30.data = register:fileSize
+                       30.wrap = <td class="csc-uploads-fileSize">|</td>
+                       30.bytes = 1
+                       30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
+               }
+       }
+
        20.color {
                default =
                1 = #EDEBF1