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