* ADD Page browser (pi_base)
[TYPO3CMS/Extensions/contagged.git] / tca.php
1 <?php
2 if (!defined ('TYPO3_MODE')) die ('Access denied.');
3
4
5 $TCA["tx_contagged_terms"] = array (
6 "ctrl" => $TCA["tx_contagged_terms"]["ctrl"],
7 "interface" => array (
8 "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, image, imagecaption, imagealt, imagetitle, related, link, exclude"
9 ),
10 "feInterface" => $TCA["tx_contagged_terms"]["feInterface"],
11 "columns" => array (
12 't3ver_label' => array (
13 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.versionLabel',
14 'config' => array (
15 'type' => 'input',
16 'size' => '30',
17 'max' => '30',
18 )
19 ),
20 'sys_language_uid' => array (
21 'exclude' => 1,
22 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
23 'config' => array (
24 'type' => 'select',
25 'foreign_table' => 'sys_language',
26 'foreign_table_where' => 'ORDER BY sys_language.title',
27 'items' => array(
28 array('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
29 array('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0)
30 )
31 )
32 ),
33 'l18n_parent' => array (
34 'displayCond' => 'FIELD:sys_language_uid:>:0',
35 'exclude' => 1,
36 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
37 'config' => array (
38 'type' => 'select',
39 'items' => array (
40 array('', 0),
41 ),
42 'foreign_table' => 'tx_contagged_terms',
43 'foreign_table_where' => 'AND tx_contagged_terms.pid=###CURRENT_PID### AND tx_contagged_terms.sys_language_uid IN (-1,0)',
44 )
45 ),
46 'l18n_diffsource' => array (
47 'config' => array (
48 'type' => 'passthrough'
49 )
50 ),
51 'hidden' => array (
52 'exclude' => 1,
53 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
54 'config' => array (
55 'type' => 'check',
56 'default' => '0'
57 )
58 ),
59 'starttime' => array (
60 'exclude' => 1,
61 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
62 'config' => array (
63 'type' => 'input',
64 'size' => '8',
65 'max' => '20',
66 'eval' => 'date',
67 'default' => '0',
68 'checkbox' => '0'
69 )
70 ),
71 'endtime' => array (
72 'exclude' => 1,
73 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
74 'config' => array (
75 'type' => 'input',
76 'size' => '8',
77 'max' => '20',
78 'eval' => 'date',
79 'checkbox' => '0',
80 'default' => '0',
81 'range' => array (
82 'upper' => mktime(0, 0, 0, 12, 31, 2020),
83 'lower' => mktime(0, 0, 0, date('m')-1, date('d'), date('Y'))
84 )
85 )
86 ),
87 'fe_group' => array (
88 'exclude' => 1,
89 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
90 'config' => array (
91 'type' => 'select',
92 'items' => array (
93 array('', 0),
94 array('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1),
95 array('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2),
96 array('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--')
97 ),
98 'foreign_table' => 'fe_groups'
99 )
100 ),
101 "term_main" => Array (
102 "exclude" => 1,
103 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_main",
104 "config" => Array (
105 "type" => "input",
106 "size" => "30",
107 "eval" => "required",
108 )
109 ),
110 "term_alt" => Array (
111 "exclude" => 1,
112 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_alt",
113 "config" => Array (
114 "type" => "text",
115 "cols" => "30",
116 "rows" => "5",
117 )
118 ),
119 "term_type" => Array (
120 "exclude" => 1,
121 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_type",
122 "config" => Array (
123 "type" => "select",
124 "itemsProcFunc" => "user_addTermTypes",
125 "size" => 1,
126 "maxitems" => 1,
127 "disableNoMatchingValueElement" => 1,
128 )
129 ),
130 "term_lang" => Array (
131 "exclude" => 1,
132 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang",
133 "config" => Array (
134 "type" => "select",
135 // TODO Make selectable languages configurable.
136 "items" => Array (
137 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.0", ""),
138 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.1", "en"),
139 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.2", "fr"),
140 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.3", "de"),
141 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.4", "it"),
142 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.5", "es"),
143 Array("LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_lang.I.6", "un"),
144 ),
145 "size" => 1,
146 "maxitems" => 1,
147 )
148 ),
149 "term_replace" => Array (
150 "exclude" => 1,
151 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.term_replace",
152 "config" => Array (
153 "type" => "input",
154 "size" => "30",
155 )
156 ),
157 "desc_short" => Array (
158 "exclude" => 1,
159 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_short",
160 "config" => Array (
161 "type" => "input",
162 "size" => "30",
163 )
164 ),
165 "desc_long" => Array (
166 "exclude" => 1,
167 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.desc_long",
168 "config" => Array (
169 "type" => "text",
170 "cols" => "30",
171 "rows" => "5",
172 "wizards" => Array(
173 "_PADDING" => 2,
174 "RTE" => array(
175 "notNewRecords" => 1,
176 "RTEonly" => 1,
177 "type" => "script",
178 "title" => "Full screen Rich Text Editing|Formatteret redigering i hele vinduet",
179 "icon" => "wizard_rte2.gif",
180 "script" => "wizard_rte.php",
181 ),
182 ),
183 )
184 ),
185 'image' => Array (
186 'exclude' => 1,
187 'l10n_mode' => $l10n_mode_image,
188 'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
189 'config' => Array (
190 'type' => 'group',
191 'internal_type' => 'file',
192 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
193 'max_size' => '10000',
194 'uploadfolder' => 'uploads/pics',
195 'show_thumbs' => '1',
196 'size' => 3,
197 'autoSizeMax' => 15,
198 'maxitems' => '99',
199 'minitems' => '0'
200 )
201 ),
202 'imagecaption' => Array (
203 'exclude' => 1,
204 'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
205 'l10n_mode' => $l10n_mode,
206 'config' => Array (
207 'type' => 'text',
208 'cols' => '30',
209 'rows' => '3'
210 )
211 ),
212 'imagealt' => Array (
213 'exclude' => 1,
214 'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
215 'l10n_mode' => $l10n_mode,
216 'config' => Array (
217 'type' => 'text',
218 'cols' => '30',
219 'rows' => '3'
220 )
221 ),
222 'imagetitle' => Array (
223 'exclude' => 1,
224 'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
225 'l10n_mode' => $l10n_mode,
226 'config' => Array (
227 'type' => 'text',
228 'cols' => '30',
229 'rows' => '3'
230 )
231 ),
232 'related' => Array (
233 'exclude' => 1,
234 'l10n_mode' => 'exclude',
235 'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.related',
236 'config' => Array (
237 'type' => 'group',
238 'internal_type' => 'db',
239 'allowed' => '*',
240 'MM' => 'tx_contagged_related_mm',
241 'show_thumbs' => 1,
242 'size' => 3,
243 'autoSizeMax' => 20,
244 'maxitems' => 9999,
245 'minitems' => 0,
246 )
247 ),
248 "link" => Array (
249 "exclude" => 1,
250 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.link",
251 "config" => Array (
252 "type" => "input",
253 "size" => "28",
254 "max" => "255",
255 "checkbox" => "",
256 "eval" => "trim",
257 "wizards" => array(
258 "_PADDING" => 2,
259 "link" => array(
260 "type" => "popup",
261 "title" => "Link",
262 "icon" => "link_popup.gif",
263 "script" => "browse_links.php?mode=wizard",
264 "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
265 )
266 )
267 )
268 ),
269 "exclude" => Array (
270 "exclude" => 1,
271 "label" => "LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.exclude",
272 "config" => Array (
273 "type" => "check",
274 )
275 ),
276 ),
277 "types" => array (
278 "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], image, imagecaption, imagealt, imagetitle, related, link, exclude")
279 ),
280 "palettes" => array (
281 "1" => array("showitem" => "starttime, endtime, fe_group")
282 )
283 );
284 require_once (PATH_t3lib.'class.t3lib_page.php');
285 require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
286 require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
287
288 function user_addTermTypes(&$params,&$pObj) {
289 global $BE_USER;
290 $BE_USER->uc['lang'] = $BE_USER->uc['lang'] ? $BE_USER->uc['lang'] : 'default';
291
292 // get extension configuration
293 $extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
294 if ( (int)$extConfArray['mainConfigStoragePid']>0 ) {
295 $mainConfigStoragePid = intval($extConfArray['mainConfigStoragePid']);
296 } else {
297 // TODO parse static setup
298 }
299
300 $rootLine = t3lib_BEfunc::BEgetRootLine($mainConfigStoragePid);
301 $TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
302 $TSObj->tt_track = 0;
303 $TSObj->init();
304 $TSObj->runThroughTemplates($rootLine);
305 $TSObj->generateConfig();
306 $conf = $TSObj->setup['plugin.']['tx_contagged.'];
307
308 // make localized labels
309 $LOCAL_LANG_ARRAY = array();
310 if (!empty($conf['types.'])) {
311 foreach ($conf['types.'] as $typeName => $typeConfigArray ) {
312 unset($LOCAL_LANG_ARRAY);
313 if ( !$typeConfigArray['hideSelection']>0 && !$typeConfigArray['dataSource'] ) {
314 foreach ($typeConfigArray['label.'] as $langKey => $labelText) {
315 $LOCAL_LANG_ARRAY[$langKey]['label'] = $labelText;
316 }
317 $LOCAL_LANG_ARRAY['default']['label'] = $typeConfigArray['label'] ? $typeConfigArray['label'] : $typeConfigArray['label.']['default'];
318 $params['items'][]= array( $GLOBALS['LANG']->getLLL('label',$LOCAL_LANG_ARRAY), substr($typeName,0,-1) );
319 }
320 }
321 }
322 }
323 ?>