Merge lp:~sebastian-meyer/goobi-presentation/bug909383 into lp:goobi-presentation/1.1
- bug909383
- Merge into 1.1
Proposed by
Sebastian Meyer
Status: | Merged |
---|---|
Merged at revision: | 70 |
Proposed branch: | lp:~sebastian-meyer/goobi-presentation/bug909383 |
Merge into: | lp:goobi-presentation/1.1 |
Diff against target: |
670 lines (+537/-17) 5 files modified
dlf/common/class.tx_dlf_helper.php (+2/-2) dlf/ext_conf_template.txt (+6/-0) dlf/hooks/class.tx_dlf_em.php (+464/-14) dlf/locallang.xml (+56/-0) dlf/plugins/metadata/class.tx_dlf_metadata.php (+9/-1) |
To merge this branch: | bzr merge lp:~sebastian-meyer/goobi-presentation/bug909383 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastian Meyer | Approve | ||
Review via email: mp+99893@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Sebastian Meyer (sebastian-meyer) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'dlf/common/class.tx_dlf_helper.php' |
2 | --- dlf/common/class.tx_dlf_helper.php 2012-03-23 16:19:52 +0000 |
3 | +++ dlf/common/class.tx_dlf_helper.php 2012-03-29 08:36:18 +0000 |
4 | @@ -290,11 +290,11 @@ |
5 | |
6 | if (preg_match('/^[a-z]{3}$/', $_code)) { |
7 | |
8 | - $iso639 = $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath(self::$extKey).'/lib/ISO-639/iso-639-2b.xml', FALSE, TRUE); |
9 | + $iso639 = $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml', FALSE, TRUE); |
10 | |
11 | } elseif (preg_match('/^[a-z]{2}$/', $_code)) { |
12 | |
13 | - $iso639 = $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath(self::$extKey).'/lib/ISO-639/iso-639-1.xml', FALSE, TRUE); |
14 | + $iso639 = $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml', FALSE, TRUE); |
15 | |
16 | } else { |
17 | |
18 | |
19 | === modified file 'dlf/ext_conf_template.txt' |
20 | --- dlf/ext_conf_template.txt 2011-11-11 14:48:17 +0000 |
21 | +++ dlf/ext_conf_template.txt 2012-03-29 08:36:18 +0000 |
22 | @@ -1,3 +1,9 @@ |
23 | +# cat=Basic; type=user[EXT:dlf/hooks/class.tx_dlf_em.php:tx_dlf_em->checkCliUserGroup]; label=LLL:EXT:dlf/locallang.xml:config.cliUserGroup |
24 | +cliUserGroup = 0 |
25 | + |
26 | +# cat=Basic; type=boolean; label=LLL:EXT:dlf/locallang.xml:config.makeCliUserGroup |
27 | +makeCliUserGroup = 0 |
28 | + |
29 | # cat=Basic; type=string; label=LLL:EXT:dlf/locallang.xml:config.useragent |
30 | useragent = Goobi.Presentation |
31 | |
32 | |
33 | === modified file 'dlf/hooks/class.tx_dlf_em.php' |
34 | --- dlf/hooks/class.tx_dlf_em.php 2011-11-11 14:48:17 +0000 |
35 | +++ dlf/hooks/class.tx_dlf_em.php 2012-03-29 08:36:18 +0000 |
36 | @@ -38,6 +38,14 @@ |
37 | class tx_dlf_em { |
38 | |
39 | /** |
40 | + * This holds the output ready to return |
41 | + * |
42 | + * @var string |
43 | + * @access protected |
44 | + */ |
45 | + protected $content = ''; |
46 | + |
47 | + /** |
48 | * Check if a connection to a Solr server could be established with the given credentials. |
49 | * |
50 | * @access public |
51 | @@ -53,30 +61,24 @@ |
52 | $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
53 | |
54 | // Get Solr credentials. |
55 | - $conf = t3lib_div::_POST('data'); |
56 | - |
57 | - if (empty($conf)) { |
58 | - |
59 | - $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
60 | - |
61 | - } |
62 | + $conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) t3lib_div::_POST('data')); |
63 | |
64 | // Prepend username and password to hostname. |
65 | - if ($conf['solrUser'] && $conf['solrPass']) { |
66 | + if (!empty($conf['solrUser']) && !empty($conf['solrPass'])) { |
67 | |
68 | $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
69 | |
70 | } else { |
71 | |
72 | - $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); |
73 | + $host = (!empty($conf['solrHost']) ? $conf['solrHost'] : 'localhost'); |
74 | |
75 | } |
76 | |
77 | // Set port if not set. |
78 | - $port = t3lib_div::intInRange($conf['solrPort'], 0, 65535, 8180); |
79 | + $port = (!empty($conf['solrPort']) ? t3lib_div::intInRange($conf['solrPort'], 0, 65535, 8180) : 8180); |
80 | |
81 | // Trim path and append trailing slash. |
82 | - $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); |
83 | + $path = (!empty($conf['solrPath']) ? trim($conf['solrPath'], '/').'/' : ''); |
84 | |
85 | // Build request URI. |
86 | $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores'; |
87 | @@ -84,7 +86,7 @@ |
88 | $context = stream_context_create(array ( |
89 | 'http' => array ( |
90 | 'method' => 'GET', |
91 | - 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
92 | + 'user_agent' => (!empty($conf['useragent']) ? $conf['useragent'] : ini_get('user_agent')) |
93 | ) |
94 | )); |
95 | |
96 | @@ -106,7 +108,9 @@ |
97 | FALSE |
98 | ); |
99 | |
100 | - return $message->render(); |
101 | + $this->content .= $message->render(); |
102 | + |
103 | + return $this->content; |
104 | |
105 | } |
106 | |
107 | @@ -120,7 +124,453 @@ |
108 | FALSE |
109 | ); |
110 | |
111 | - return $message->render(); |
112 | + $this->content .= $message->render(); |
113 | + |
114 | + return $this->content; |
115 | + |
116 | + } |
117 | + |
118 | + /** |
119 | + * Make sure a backend user exists and is configured properly. |
120 | + * |
121 | + * @access protected |
122 | + * |
123 | + * @param boolean $checkOnly: Just check the user or change it, too? |
124 | + * @param integer $groupUid: UID of the corresponding usergroup |
125 | + * |
126 | + * @return integer UID of user or 0 if something is wrong |
127 | + */ |
128 | + protected function checkCliUser($checkOnly, $groupUid) { |
129 | + |
130 | + // Set default return value. |
131 | + $usrUid = 0; |
132 | + |
133 | + // Check if user "_cli_dlf" exists, is no admin and is not disabled. |
134 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
135 | + 'uid,admin,usergroup', |
136 | + 'be_users', |
137 | + 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').t3lib_BEfunc::deleteClause('be_users') |
138 | + ); |
139 | + |
140 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
141 | + |
142 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
143 | + |
144 | + // Explode comma-separated list. |
145 | + $resArray['usergroup'] = explode(',', $resArray['usergroup']); |
146 | + |
147 | + // Check if user is not disabled. |
148 | + $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
149 | + '1', |
150 | + 'be_users', |
151 | + 'uid='.intval($resArray['uid']).t3lib_BEfunc::BEenableFields('be_users') |
152 | + ); |
153 | + |
154 | + // Check if user is configured properly. |
155 | + if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0 |
156 | + && !$resArray['admin'] |
157 | + && $GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) { |
158 | + |
159 | + $usrUid = $resArray['uid']; |
160 | + |
161 | + $message = t3lib_div::makeInstance( |
162 | + 't3lib_FlashMessage', |
163 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'), |
164 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'), |
165 | + t3lib_FlashMessage::OK, |
166 | + FALSE |
167 | + ); |
168 | + |
169 | + } else { |
170 | + |
171 | + if (!$checkOnly && $groupUid) { |
172 | + |
173 | + // Keep exisiting values and add the new ones. |
174 | + $_usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
175 | + |
176 | + // Try to configure user. |
177 | + $data['be_users'][$resArray['uid']] = array ( |
178 | + 'admin' => 0, |
179 | + 'usergroup' => implode(',', $_usergroup), |
180 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0, |
181 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0, |
182 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0 |
183 | + ); |
184 | + |
185 | + tx_dlf_helper::processDB($data); |
186 | + |
187 | + // Check if configuration was successful. |
188 | + if ($this->checkCliUser(TRUE, $groupUid)) { |
189 | + |
190 | + $usrUid = $resArray['uid']; |
191 | + |
192 | + $message = t3lib_div::makeInstance( |
193 | + 't3lib_FlashMessage', |
194 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'), |
195 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'), |
196 | + t3lib_FlashMessage::INFO, |
197 | + FALSE |
198 | + ); |
199 | + |
200 | + } else { |
201 | + |
202 | + $message = t3lib_div::makeInstance( |
203 | + 't3lib_FlashMessage', |
204 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
205 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
206 | + t3lib_FlashMessage::WARNING, |
207 | + FALSE |
208 | + ); |
209 | + |
210 | + } |
211 | + |
212 | + } else { |
213 | + |
214 | + $message = t3lib_div::makeInstance( |
215 | + 't3lib_FlashMessage', |
216 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
217 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
218 | + t3lib_FlashMessage::WARNING, |
219 | + FALSE |
220 | + ); |
221 | + |
222 | + } |
223 | + |
224 | + } |
225 | + |
226 | + } else { |
227 | + |
228 | + if (!$checkOnly && $groupUid) { |
229 | + |
230 | + // Try to create user. |
231 | + $_tempUid = uniqid('NEW'); |
232 | + |
233 | + $data['be_users'][$_tempUid] = array ( |
234 | + 'pid' => 0, |
235 | + 'username' => '_cli_dlf', |
236 | + 'password' => md5($_tempUid), |
237 | + 'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'), |
238 | + 'usergroup' => intval($groupUid) |
239 | + ); |
240 | + |
241 | + $_substUid = tx_dlf_helper::processDB($data); |
242 | + |
243 | + // Check if creation was successful. |
244 | + if (!empty($_substUid[$_tempUid])) { |
245 | + |
246 | + $usrUid = $_substUid[$_tempUid]; |
247 | + |
248 | + $message = t3lib_div::makeInstance( |
249 | + 't3lib_FlashMessage', |
250 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'), |
251 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'), |
252 | + t3lib_FlashMessage::INFO, |
253 | + FALSE |
254 | + ); |
255 | + |
256 | + } else { |
257 | + |
258 | + $message = t3lib_div::makeInstance( |
259 | + 't3lib_FlashMessage', |
260 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
261 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
262 | + t3lib_FlashMessage::ERROR, |
263 | + FALSE |
264 | + ); |
265 | + |
266 | + } |
267 | + |
268 | + } else { |
269 | + |
270 | + $message = t3lib_div::makeInstance( |
271 | + 't3lib_FlashMessage', |
272 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
273 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
274 | + t3lib_FlashMessage::ERROR, |
275 | + FALSE |
276 | + ); |
277 | + |
278 | + } |
279 | + |
280 | + } |
281 | + |
282 | + $this->content = $message->render(); |
283 | + |
284 | + return $usrUid; |
285 | + |
286 | + } |
287 | + |
288 | + /** |
289 | + * Make sure a backend usergroup exists and is configured properly. |
290 | + * |
291 | + * @access protected |
292 | + * |
293 | + * @param boolean $checkOnly: Just check the usergroup or change it, too? |
294 | + * @param array $settings: Array with default settings |
295 | + * |
296 | + * @return integer UID of usergroup or 0 if something is wrong |
297 | + */ |
298 | + protected function checkCliGroup($checkOnly, $settings = array ()) { |
299 | + |
300 | + // Set default return value. |
301 | + $grpUid = 0; |
302 | + |
303 | + // Set default configuration for usergroup. |
304 | + if (empty($settings)) { |
305 | + |
306 | + $settings = array ( |
307 | + 'non_exclude_fields' => array (), |
308 | + 'tables_select' => array ( |
309 | + 'tx_dlf_documents', |
310 | + 'tx_dlf_collections', |
311 | + 'tx_dlf_libraries', |
312 | + 'tx_dlf_structures', |
313 | + 'tx_dlf_metadata', |
314 | + 'tx_dlf_formats', |
315 | + 'tx_dlf_solrcores' |
316 | + ), |
317 | + 'tables_modify' => array ( |
318 | + 'tx_dlf_documents', |
319 | + 'tx_dlf_collections', |
320 | + 'tx_dlf_libraries' |
321 | + ) |
322 | + ); |
323 | + |
324 | + // Set allowed exclude fields. |
325 | + foreach ($settings['tables_modify'] as $table) { |
326 | + |
327 | + t3lib_div::loadTCA($table); |
328 | + |
329 | + foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldConf) { |
330 | + |
331 | + if (!empty($fieldConf['exclude'])) { |
332 | + |
333 | + $settings['non_exclude_fields'][] = $table.':'.$field; |
334 | + |
335 | + } |
336 | + |
337 | + } |
338 | + |
339 | + } |
340 | + |
341 | + } |
342 | + |
343 | + // Check if group "_cli_dlf" exists and is not disabled. |
344 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
345 | + 'uid,non_exclude_fields,tables_select,tables_modify,inc_access_lists,'.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
346 | + 'be_groups', |
347 | + 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').t3lib_BEfunc::deleteClause('be_groups') |
348 | + ); |
349 | + |
350 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
351 | + |
352 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
353 | + |
354 | + // Explode comma-separated lists. |
355 | + $resArray['non_exclude_fields'] = explode(',', $resArray['non_exclude_fields']); |
356 | + |
357 | + $resArray['tables_select'] = explode(',', $resArray['tables_select']); |
358 | + |
359 | + $resArray['tables_modify'] = explode(',', $resArray['tables_modify']); |
360 | + |
361 | + // Check if usergroup is configured properly. |
362 | + if (count(array_diff($settings['non_exclude_fields'], $resArray['non_exclude_fields'])) == 0 |
363 | + && count(array_diff($settings['tables_select'], $resArray['tables_select'])) == 0 |
364 | + && count(array_diff($settings['tables_modify'], $resArray['tables_modify'])) == 0 |
365 | + && $resArray['inc_access_lists'] == 1 |
366 | + && $resArray[$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled']] == 0) { |
367 | + |
368 | + $grpUid = $resArray['uid']; |
369 | + |
370 | + $message = t3lib_div::makeInstance( |
371 | + 't3lib_FlashMessage', |
372 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'), |
373 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'), |
374 | + t3lib_FlashMessage::OK, |
375 | + FALSE |
376 | + ); |
377 | + |
378 | + } else { |
379 | + |
380 | + if (!$checkOnly) { |
381 | + |
382 | + // Keep exisiting values and add the new ones. |
383 | + $_non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields'])); |
384 | + |
385 | + $_tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select'])); |
386 | + |
387 | + $_tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
388 | + |
389 | + // Try to configure usergroup. |
390 | + $data['be_groups'][$resArray['uid']] = array ( |
391 | + 'non_exclude_fields' => implode(',', $_non_exclude_fields), |
392 | + 'tables_select' => implode(',', $_tables_select), |
393 | + 'tables_modify' => implode(',', $_tables_modify), |
394 | + 'inc_access_lists' => 1, |
395 | + $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0 |
396 | + ); |
397 | + |
398 | + tx_dlf_helper::processDB($data); |
399 | + |
400 | + // Check if configuration was successful. |
401 | + if ($this->checkCliGroup(TRUE, $settings)) { |
402 | + |
403 | + $grpUid = $resArray['uid']; |
404 | + |
405 | + $message = t3lib_div::makeInstance( |
406 | + 't3lib_FlashMessage', |
407 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'), |
408 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'), |
409 | + t3lib_FlashMessage::INFO, |
410 | + FALSE |
411 | + ); |
412 | + |
413 | + } else { |
414 | + |
415 | + $message = t3lib_div::makeInstance( |
416 | + 't3lib_FlashMessage', |
417 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
418 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
419 | + t3lib_FlashMessage::WARNING, |
420 | + FALSE |
421 | + ); |
422 | + |
423 | + } |
424 | + |
425 | + } else { |
426 | + |
427 | + $message = t3lib_div::makeInstance( |
428 | + 't3lib_FlashMessage', |
429 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
430 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
431 | + t3lib_FlashMessage::WARNING, |
432 | + FALSE |
433 | + ); |
434 | + |
435 | + } |
436 | + |
437 | + } |
438 | + |
439 | + } else { |
440 | + |
441 | + if (!$checkOnly) { |
442 | + |
443 | + // Try to create usergroup. |
444 | + $_tempUid = uniqid('NEW'); |
445 | + |
446 | + $data['be_groups'][$_tempUid] = array ( |
447 | + 'pid' => 0, |
448 | + 'title' => '_cli_dlf', |
449 | + 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
450 | + 'non_exclude_fields' => implode(',', $settings['non_exclude_fields']), |
451 | + 'tables_select' => implode(',', $settings['tables_select']), |
452 | + 'tables_modify' => implode(',', $settings['tables_modify']), |
453 | + 'inc_access_lists' => 1 |
454 | + ); |
455 | + |
456 | + $_substUid = tx_dlf_helper::processDB($data); |
457 | + |
458 | + // Check if creation was successful. |
459 | + if (!empty($_substUid[$_tempUid])) { |
460 | + |
461 | + $grpUid = $_substUid[$_tempUid]; |
462 | + |
463 | + $message = t3lib_div::makeInstance( |
464 | + 't3lib_FlashMessage', |
465 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'), |
466 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'), |
467 | + t3lib_FlashMessage::INFO, |
468 | + FALSE |
469 | + ); |
470 | + |
471 | + } else { |
472 | + |
473 | + $message = t3lib_div::makeInstance( |
474 | + 't3lib_FlashMessage', |
475 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
476 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
477 | + t3lib_FlashMessage::ERROR, |
478 | + FALSE |
479 | + ); |
480 | + |
481 | + } |
482 | + |
483 | + } else { |
484 | + |
485 | + $message = t3lib_div::makeInstance( |
486 | + 't3lib_FlashMessage', |
487 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
488 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
489 | + t3lib_FlashMessage::ERROR, |
490 | + FALSE |
491 | + ); |
492 | + |
493 | + } |
494 | + |
495 | + } |
496 | + |
497 | + $this->content = $message->render(); |
498 | + |
499 | + return $grpUid; |
500 | + |
501 | + } |
502 | + |
503 | + /** |
504 | + * Make sure a CLI user and group exist. |
505 | + * |
506 | + * @access public |
507 | + * |
508 | + * @param array &$params: An array with parameters |
509 | + * @param t3lib_tsStyleConfig &$pObj: The parent object |
510 | + * |
511 | + * @return string Message informing the user of success or failure |
512 | + */ |
513 | + public function checkCliUserGroup(&$params, &$pObj) { |
514 | + |
515 | + // Load localization file. |
516 | + $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
517 | + |
518 | + // Get current configuration. |
519 | + $conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) t3lib_div::_POST('data')); |
520 | + |
521 | + // Check if usergroup "_cli_dlf" exists and is configured properly. |
522 | + $groupUid = $this->checkCliGroup(empty($conf['makeCliUserGroup'])); |
523 | + |
524 | + // Save output because it will be overwritten by the user check method. |
525 | + $content = $this->content; |
526 | + |
527 | + // Check if user "_cli_dlf" exists and is configured properly. |
528 | + $userUid = $this->checkCliUser(empty($conf['makeCliUserGroup']), $groupUid); |
529 | + |
530 | + // Merge output from usergroup and user checks. |
531 | + $this->content .= $content; |
532 | + |
533 | + // Check if CLI dispatcher is executable. |
534 | + if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) { |
535 | + |
536 | + $message = t3lib_div::makeInstance( |
537 | + 't3lib_FlashMessage', |
538 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'), |
539 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'), |
540 | + t3lib_FlashMessage::OK, |
541 | + FALSE |
542 | + ); |
543 | + |
544 | + } else { |
545 | + |
546 | + $message = t3lib_div::makeInstance( |
547 | + 't3lib_FlashMessage', |
548 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'), |
549 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'), |
550 | + t3lib_FlashMessage::ERROR, |
551 | + FALSE |
552 | + ); |
553 | + |
554 | + } |
555 | + |
556 | + $this->content .= $message->render(); |
557 | + |
558 | + return $this->content; |
559 | |
560 | } |
561 | |
562 | |
563 | === modified file 'dlf/locallang.xml' |
564 | --- dlf/locallang.xml 2012-03-24 12:06:31 +0000 |
565 | +++ dlf/locallang.xml 2012-03-29 08:36:18 +0000 |
566 | @@ -122,6 +122,8 @@ |
567 | <label index="tt_content.dlf_statistics">DLF: Statistics</label> |
568 | <label index="tt_content.dlf_toc">DLF: Table of Contents</label> |
569 | <label index="tt_content.dlf_toolbox">DLF: Toolbox</label> |
570 | + <label index="config.cliUserGroup">CLI user/group</label> |
571 | + <label index="config.makeCliUserGroup">Create and configure CLI user/group automatically?: (default is "FALSE")</label> |
572 | <label index="config.useragent">DLF User-Agent: (default is "Goobi.Presentation")</label> |
573 | <label index="config.fileGrps">Additional METS fileGrps: comma-separated list of @USE attribute values (default is "DEFAULT,MIN,MAX,THUMBS")</label> |
574 | <label index="config.caching">Cache parsed METS files: caching improves performance a little bit but can result in a very large "fe_session_data" table (default is "FALSE")</label> |
575 | @@ -135,6 +137,32 @@ |
576 | <label index="solr.status">The status code returned by Apache Solr is <strong>%s</strong>.</label> |
577 | <label index="solr.notConnected">Connection failed!</label> |
578 | <label index="solr.error">Apache Solr was not reachable under <strong>%s</strong>.</label> |
579 | + <label index="cliUserGroup.usrRealName">Goobi.Presentation command line indexer</label> |
580 | + <label index="cliUserGroup.usrOkay">User "_cli_dlf" configured and enabled!</label> |
581 | + <label index="cliUserGroup.usrOkayMsg">The backend user for the command line indexer exists and is configured properly.</label> |
582 | + <label index="cliUserGroup.usrConfigured">User "_cli_dlf" configured successfully!</label> |
583 | + <label index="cliUserGroup.usrConfiguredMsg">The backend user for the command line indexer was configured properly.</label> |
584 | + <label index="cliUserGroup.usrNotConfigured">User "_cli_dlf" not configured!</label> |
585 | + <label index="cliUserGroup.usrNotConfiguredMsg">The backend user for the command line indexer exists, but is not configured properly.</label> |
586 | + <label index="cliUserGroup.usrCreated">User "_cli_dlf" created successfully!</label> |
587 | + <label index="cliUserGroup.usrCreatedMsg">The backend user for the command line indexer was created and configured properly.</label> |
588 | + <label index="cliUserGroup.usrNotCreated">User "_cli_dlf" not created!</label> |
589 | + <label index="cliUserGroup.usrNotCreatedMsg">The backend user for the command line indexer does not exist.</label> |
590 | + <label index="cliUserGroup.grpDescription">Usergroup for the Goobi.Presentation command line indexer.</label> |
591 | + <label index="cliUserGroup.grpOkay">Usergroup "_cli_dlf" configured and enabled!</label> |
592 | + <label index="cliUserGroup.grpOkayMsg">The backend usergroup for the command line indexer exists and is configured properly.</label> |
593 | + <label index="cliUserGroup.grpConfigured">Usergroup "_cli_dlf" configured successfully!</label> |
594 | + <label index="cliUserGroup.grpConfiguredMsg">The backend usergroup for the command line indexer was configured properly.</label> |
595 | + <label index="cliUserGroup.grpNotConfigured">Usergroup "_cli_dlf" not configured!</label> |
596 | + <label index="cliUserGroup.grpNotConfiguredMsg">The backend usergroup for the command line indexer exists, but is not configured properly.</label> |
597 | + <label index="cliUserGroup.grpCreated">Usergroup "_cli_dlf" created successfully!</label> |
598 | + <label index="cliUserGroup.grpCreatedMsg">The backend usergroup for the command line indexer was created and configured properly.</label> |
599 | + <label index="cliUserGroup.grpNotCreated">Usergroup "_cli_dlf" not created!</label> |
600 | + <label index="cliUserGroup.grpNotCreatedMsg">The backend usergroup for the command line indexer does not exist.</label> |
601 | + <label index="cliUserGroup.cliOkay">Command Line Interface available!</label> |
602 | + <label index="cliUserGroup.cliOkayMsg">The TYPO3 command line interface is available for the indexer to use.</label> |
603 | + <label index="cliUserGroup.cliNotOkay">Command Line Interface not available!</label> |
604 | + <label index="cliUserGroup.cliNotOkayMsg">The TYPO3 command line interface is not available for the indexer to use.</label> |
605 | </languageKey> |
606 | <languageKey index="de" type="array"> |
607 | <label index="tx_dlf_documents">Dokumente</label> |
608 | @@ -253,6 +281,8 @@ |
609 | <label index="tt_content.dlf_statistics">DLF: Statistik</label> |
610 | <label index="tt_content.dlf_toc">DLF: Inhaltsverzeichnis</label> |
611 | <label index="tt_content.dlf_toolbox">DLF: Werkzeugkasten</label> |
612 | + <label index="config.cliUserGroup">CLI Benutzer/Gruppe</label> |
613 | + <label index="config.makeCliUserGroup">CLI Benutzer/Gruppe automatisch anlegen?: (Standard ist "FALSE")</label> |
614 | <label index="config.useragent">DLF User-Agent: (Standard ist "Goobi.Presentation")</label> |
615 | <label index="config.fileGrps">Zusätzliche METS fileGrps: Komma-getrennte Liste von @USE Attributwerten (Standard ist "DEFAULT,MIN,MAX,THUMBS")</label> |
616 | <label index="config.caching">Eingelesene METS Dateien zwischenspeichern: Dies kann die Geschwindigkeit geringfügig verbessern, führt aber zu einer sehr großen "fe_session_data" Tabelle (Standard ist "FALSE")</label> |
617 | @@ -266,6 +296,32 @@ |
618 | <label index="solr.status">Apache Solr gibt den Statuscode <strong>%s</strong> zurück.</label> |
619 | <label index="solr.notConnected">Verbindung fehlgeschlagen!</label> |
620 | <label index="solr.error">Apache Solr ist unter <strong>%s</strong> nicht erreichbar.</label> |
621 | + <label index="cliUserGroup.usrRealName">Goobi.Presentation Kommandozeilen-Indexierungsdienst</label> |
622 | + <label index="cliUserGroup.usrOkay">Nutzer "_cli_dlf" eingerichtet!</label> |
623 | + <label index="cliUserGroup.usrOkayMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst ist korrekt konfiguriert und aktiviert.</label> |
624 | + <label index="cliUserGroup.usrConfigured">Nutzer "_cli_dlf" erfolgreich konfiguriert!</label> |
625 | + <label index="cliUserGroup.usrConfiguredMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst wurde erfolgreich konfiguriert.</label> |
626 | + <label index="cliUserGroup.usrNotConfigured">Nutzer "_cli_dlf" nicht konfiguriert!</label> |
627 | + <label index="cliUserGroup.usrNotConfiguredMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst existiert, ist aber nicht korrekt konfiguriert.</label> |
628 | + <label index="cliUserGroup.usrCreated">Nutzer "_cli_dlf" erfolgreich angelegt!</label> |
629 | + <label index="cliUserGroup.usrCreatedMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst wurde erfolgreich angelegt und konfiguriert.</label> |
630 | + <label index="cliUserGroup.usrNotCreated">Nutzer "_cli_dlf" nicht angelegt!</label> |
631 | + <label index="cliUserGroup.usrNotCreatedMsg">Der Nutzer für den Kommandozeilen-Indexierungsdienst existiert nicht.</label> |
632 | + <label index="cliUserGroup.grpDescription">Nutzergruppe für den Goobi.Presentation Kommandozeilen-Indexierungsdienst.</label> |
633 | + <label index="cliUserGroup.grpOkay">Nutzergruppe "_cli_dlf" eingerichtet!</label> |
634 | + <label index="cliUserGroup.grpOkayMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst ist korrekt konfiguriert und aktiviert.</label> |
635 | + <label index="cliUserGroup.grpConfigured">Nutzergruppe "_cli_dlf" erfolgreich konfiguriert!</label> |
636 | + <label index="cliUserGroup.grpConfiguredMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst wurde erfolgreich konfiguriert.</label> |
637 | + <label index="cliUserGroup.grpNotConfigured">Nutzergruppe "_cli_dlf" nicht konfiguriert!</label> |
638 | + <label index="cliUserGroup.grpNotConfiguredMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst existiert, ist aber nicht korrekt konfiguriert.</label> |
639 | + <label index="cliUserGroup.grpCreated">Nutzergruppe "_cli_dlf" erfolgreich angelegt!</label> |
640 | + <label index="cliUserGroup.grpCreatedMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst wurde erfolgreich angelegt und konfiguriert.</label> |
641 | + <label index="cliUserGroup.grpNotCreated">Nutzergruppe "_cli_dlf" nicht angelegt!</label> |
642 | + <label index="cliUserGroup.grpNotCreatedMsg">Die Nutzergruppe für den Kommandozeilen-Indexierungsdienst existiert nicht.</label> |
643 | + <label index="cliUserGroup.cliOkay">Kommandozeilen-Schnittstelle verfügbar!</label> |
644 | + <label index="cliUserGroup.cliOkayMsg">Die TYPO3-Kommandozeilenschnittstelle steht für den Indexierungsdienst zur Verfügung.</label> |
645 | + <label index="cliUserGroup.cliNotOkay">Kommandozeilen-Schnittstelle nicht verfügbar!</label> |
646 | + <label index="cliUserGroup.cliNotOkayMsg">Die TYPO3-Kommandozeilenschnittstelle steht für den Indexierungsdienst nicht zur Verfügung.</label> |
647 | </languageKey> |
648 | </data> |
649 | </T3locallang> |
650 | \ No newline at end of file |
651 | |
652 | === modified file 'dlf/plugins/metadata/class.tx_dlf_metadata.php' |
653 | --- dlf/plugins/metadata/class.tx_dlf_metadata.php 2012-03-24 09:05:28 +0000 |
654 | +++ dlf/plugins/metadata/class.tx_dlf_metadata.php 2012-03-29 08:36:18 +0000 |
655 | @@ -210,7 +210,15 @@ |
656 | // Load all the metadata values into the content object's data array. |
657 | foreach ($_metadata as $_index_name => $_value) { |
658 | |
659 | - $this->cObj->data[$_index_name] = implode($this->conf['separator'], $_value); |
660 | + if (is_array($_value)) { |
661 | + |
662 | + $this->cObj->data[$_index_name] = implode($this->conf['separator'], $_value); |
663 | + |
664 | + } else { |
665 | + |
666 | + $this->cObj->data[$_index_name] = $_value; |
667 | + |
668 | + } |
669 | |
670 | } |
671 |