1e38ddc7ecebb4758a81ccb4a9d2e6bb3d792a68
[TYPO3CMS/Extensions/dam_ttcontent.git] / class.ux_tx_cms_layout.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Include file extending db_list.inc for use with the web_layout module
29 *
30 * $Id: class.tx_cms_layout.php 1868 2006-12-12 11:24:10Z ingmars $
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 * (This index is automatically created/updated by the extension "extdeveval")
41 *
42 */
43
44
45
46
47 /**
48 * Child class for the Web > Page module
49 *
50 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
51 * @package TYPO3
52 * @subpackage core
53 */
54 class ux_tx_cms_layout extends tx_cms_layout {
55
56
57 /**
58 * Draws the preview content for a content element
59 *
60 * @param string Content element
61 * @param boolean Set if the RTE link can be created.
62 * @return string HTML
63 */
64 function tt_content_drawItem($row, $isRTE=FALSE) {
65 global $TCA;
66
67 $out='';
68 $outHeader='';
69
70 // Make header:
71 if ($row['header'] && $row['header_layout']!=100) {
72 $infoArr = Array();
73 $this->getProcessedValue('tt_content','header_position,header_layout,header_link',$row,$infoArr);
74
75 $outHeader= ($row['date'] ? htmlspecialchars($this->itemLabels['date'].' '.t3lib_BEfunc::date($row['date'])).'<br />':'').
76 $this->infoGif($infoArr).
77 '<b>'.$this->linkEditContent($this->renderText($row['header']),$row).'</b><br />';
78 }
79
80 // Make content:
81 $infoArr=Array();
82 switch($row['CType']) {
83 case 'header':
84 if ($row['subheader']) {
85 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
86 $out.= $this->infoGif($infoArr).
87 $this->linkEditContent($this->renderText($row['subheader']),$row).'<br />';
88 }
89 break;
90 case 'text':
91 case 'textpic':
92 case 'image':
93 if ($row['CType']=='text' || $row['CType']=='textpic') {
94 if ($row['bodytext']) {
95 $this->getProcessedValue('tt_content','text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
96 $out.= $this->infoGif($infoArr).
97 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
98 }
99 }
100 if ($row['CType']=='textpic' || $row['CType']=='image') {
101 if ($row['image']) {
102 $infoArr=Array();
103 $this->getProcessedValue('tt_content','imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames',$row,$infoArr);
104 $out.= $this->infoGif($infoArr).
105 $this->thumbCode($row,'tt_content','image').'<br />';
106
107 if ($row['imagecaption']) {
108 $infoArr=Array();
109 $this->getProcessedValue('tt_content','imagecaption_position',$row,$infoArr);
110 $out.= $this->infoGif($infoArr).
111 $this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
112 }
113 }
114 ###########
115 if ($row['tx_damttcontent_files']) {
116 require_once(PATH_txdam.'lib/class.tx_dam_image.php');
117 require_once(PATH_txdam.'lib/class.tx_dam_tcefunc.php');
118 require_once(PATH_txdam.'lib/class.tx_dam_guifunc.php');
119 $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
120 $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
121 foreach($filesArray['rows'] as $rowDAM) {
122 $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
123
124 #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
125 #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
126 $thumb = tx_dam_guiFunc::thumbnail($rowDAM);
127 $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">'.$thumb.'</div>';
128 $thumb = '<div>'.$thumb.$caption.'</div><div style="clear:both"></div>';
129
130
131
132 $out.= $thumb;
133 }
134 }
135 #############
136 }
137 break;
138 case 'bullets':
139 if ($row['bodytext']) {
140 $this->getProcessedValue('tt_content','layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
141 $out.= $this->infoGif($infoArr).
142 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
143 }
144 break;
145 case 'table':
146 if ($row['bodytext']) {
147 $this->getProcessedValue('tt_content','table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
148 $out.= $this->infoGif($infoArr).
149 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
150 }
151 break;
152 case 'uploads':
153 if ($row['media']) {
154 $this->getProcessedValue('tt_content','media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing',$row,$infoArr);
155 $out.= $this->infoGif($infoArr).
156 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
157 }
158 break;
159 case 'multimedia':
160 if ($row['multimedia']) {
161 $out.= $this->renderText($row['multimedia']).'<br />';
162 $out.= $this->renderText($row['parameters']).'<br />';
163 }
164 break;
165 case 'mailform':
166 if ($row['bodytext']) {
167 $this->getProcessedValue('tt_content','pages,subheader',$row,$infoArr);
168 $out.= $this->infoGif($infoArr).
169 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
170 }
171 break;
172 case 'splash':
173 if ($row['bodytext']) {
174 $out.= $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
175 }
176 if ($row['image']) {
177 $infoArr=Array();
178 $this->getProcessedValue('tt_content','imagewidth',$row,$infoArr);
179 $out.= $this->infoGif($infoArr).
180 $this->thumbCode($row,'tt_content','image').'<br />';
181 }
182 break;
183 case 'menu':
184 if ($row['pages']) {
185 $this->getProcessedValue('tt_content','menu_type',$row,$infoArr);
186 $out.= $this->infoGif($infoArr).
187 $this->linkEditContent($row['pages'],$row).'<br />';
188 }
189 break;
190 case 'shortcut':
191 if ($row['records']) {
192 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
193 $out.= $this->infoGif($infoArr).
194 $this->linkEditContent($row['shortcut'],$row).'<br />';
195 }
196 break;
197 case 'list':
198 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
199 $out.= $this->infoGif($infoArr).
200 $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','list_type'),1).' '.
201 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','list_type',$row['list_type']),1).'<br />';
202
203 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
204
205 $infoArr=Array();
206 $this->getProcessedValue('tt_content','recursive',$row,$infoArr);
207 $out.= $this->infoGif($infoArr).
208 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','pages',$row['pages']),1).'<br />';
209 break;
210 case 'script':
211 $out.= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
212 $out.= '<br />'.$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
213 $out.= '<br />'.$this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
214 break;
215 default:
216 if ($row['bodytext']) {
217 $out.=$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
218 }
219 break;
220 }
221
222 // Wrap span-tags:
223 $out = '
224 <span class="exampleContent">'.$out.'</span>';
225 // Add header:
226 $out = $outHeader.$out;
227 // Add RTE button:
228 if ($isRTE) {
229 $out.= $this->linkRTEbutton($row);
230 }
231
232 // Return values:
233 if ($this->isDisabled('tt_content',$row)) {
234 return $GLOBALS['TBE_TEMPLATE']->dfw($out);
235 } else {
236 return $out;
237 }
238 }
239
240 }
241
242
243
244
245 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dam_ttcontent/class.ux_tx_cms_layout.php']) {
246 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dam_ttcontent/class.ux_tx_cms_layout.php']);
247 }
248 ?>