Merge lp:goobi-presentation/1.1 into lp:~slub.team/goobi-presentation/old-bzr-trunk
- 1.1
- Merge into old-bzr-trunk
Proposed by
Sebastian Meyer
Status: | Merged |
---|---|
Merged at revision: | 86 |
Proposed branch: | lp:goobi-presentation/1.1 |
Merge into: | lp:~slub.team/goobi-presentation/old-bzr-trunk |
Diff against target: |
6190 lines (+1826/-1558) (has conflicts) 35 files modified
dlf/common/class.tx_dlf_document.php (+427/-367) dlf/common/class.tx_dlf_helper.php (+189/-137) dlf/common/class.tx_dlf_indexing.php (+138/-157) dlf/common/class.tx_dlf_list.php (+51/-15) dlf/common/class.tx_dlf_mods.php (+0/-12) dlf/common/class.tx_dlf_module.php (+12/-14) dlf/common/class.tx_dlf_plugin.php (+22/-10) dlf/common/class.tx_dlf_solr.php (+14/-3) dlf/ext_autoload.php (+30/-30) dlf/ext_emconf.php (+33/-0) dlf/ext_tables.php (+146/-145) dlf/ext_tables.sql (+2/-1) dlf/ext_tables_static+adt.sql (+1/-2) dlf/hooks/class.tx_dlf_em.php (+166/-166) dlf/hooks/class.tx_dlf_hacks.php (+21/-21) dlf/hooks/class.tx_dlf_tceforms.php (+24/-24) dlf/hooks/class.tx_dlf_tcemain.php (+50/-58) dlf/locallang.xml (+0/-2) dlf/modules/indexing/index.php (+2/-2) dlf/modules/newclient/index.php (+1/-0) dlf/modules/newclient/metadata.inc.php (+18/-3) dlf/plugins/collection/class.tx_dlf_collection.php (+19/-15) dlf/plugins/feeds/class.tx_dlf_feeds.php (+6/-6) dlf/plugins/listview/class.tx_dlf_listview.php (+100/-93) dlf/plugins/listview/locallang.xml (+2/-0) dlf/plugins/metadata/class.tx_dlf_metadata.php (+91/-87) dlf/plugins/navigation/class.tx_dlf_navigation.php (+2/-2) dlf/plugins/oai/class.tx_dlf_oai.php (+124/-91) dlf/plugins/pageview/class.tx_dlf_pageview.php (+33/-26) dlf/plugins/search/class.tx_dlf_search.php (+39/-30) dlf/plugins/search/locallang.xml (+2/-2) dlf/plugins/statistics/class.tx_dlf_statistics.php (+5/-1) dlf/plugins/toc/class.tx_dlf_toc.php (+23/-19) dlf/plugins/toolbox/class.tx_dlf_toolbox.php (+8/-8) dlf/tca.php (+25/-9) Text conflict in dlf/ext_emconf.php |
To merge this branch: | bzr merge lp:goobi-presentation/1.1 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastian Meyer | Approve | ||
Review via email: mp+120060@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_document.php' |
2 | --- dlf/common/class.tx_dlf_document.php 2012-08-09 10:31:57 +0000 |
3 | +++ dlf/common/class.tx_dlf_document.php 2012-08-17 07:00:27 +0000 |
4 | @@ -35,7 +35,7 @@ |
5 | * @subpackage tx_dlf |
6 | * @access public |
7 | */ |
8 | -class tx_dlf_document { |
9 | +final class tx_dlf_document { |
10 | |
11 | /** |
12 | * This holds the whole XML file as string for serialization purposes |
13 | @@ -87,15 +87,23 @@ |
14 | * @access protected |
15 | */ |
16 | protected $formats = array ( |
17 | - 'OTHER' => array ( |
18 | - 'DVRIGHTS' => array ( |
19 | - 'rootElement' => 'rights', |
20 | - 'namespaceURI' => 'http://dfg-viewer.de/', |
21 | - ), |
22 | - 'DVLINKS' => array ( |
23 | - 'rootElement' => 'links', |
24 | - 'namespaceURI' => 'http://dfg-viewer.de/', |
25 | - ) |
26 | + 'METS' => array ( |
27 | + 'rootElement' => 'mets', |
28 | + 'namespaceURI' => 'http://www.loc.gov/METS/', |
29 | + ), |
30 | + // This one can become a problem, because MODS uses its own custom XLINK schema. |
31 | + // @see http://comments.gmane.org/gmane.comp.text.mods/1126 |
32 | + 'XLINK' => array ( |
33 | + 'rootElement' => 'xlink', |
34 | + 'namespaceURI' => 'http://www.w3.org/1999/xlink', |
35 | + ), |
36 | + 'DVRIGHTS' => array ( |
37 | + 'rootElement' => 'rights', |
38 | + 'namespaceURI' => 'http://dfg-viewer.de/', |
39 | + ), |
40 | + 'DVLINKS' => array ( |
41 | + 'rootElement' => 'links', |
42 | + 'namespaceURI' => 'http://dfg-viewer.de/', |
43 | ) |
44 | ); |
45 | |
46 | @@ -300,13 +308,17 @@ |
47 | */ |
48 | public function getFileLocation($id) { |
49 | |
50 | - if (($_location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) { |
51 | + if (($location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'))) { |
52 | |
53 | - return (string) $_location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
54 | + return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
55 | |
56 | } else { |
57 | |
58 | - trigger_error('There is no file node with @ID '.$id, E_USER_WARNING); |
59 | + if (TYPO3_DLOG) { |
60 | + |
61 | + t3lib_div::devLog('[tx_dlf_document->getFileLocation('.$id.')] There is no file node with @ID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
62 | + |
63 | + } |
64 | |
65 | return ''; |
66 | |
67 | @@ -325,9 +337,9 @@ |
68 | |
69 | if (!$this->hookObjectsLoaded && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/common/class.tx_dlf_document.php']['hookClass'])) { |
70 | |
71 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/common/class.tx_dlf_document.php']['hookClass'] as $_classRef) { |
72 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/common/class.tx_dlf_document.php']['hookClass'] as $classRef) { |
73 | |
74 | - $this->hookObjects[] = t3lib_div::getUserObj($_classRef); |
75 | + $this->hookObjects[] = t3lib_div::getUserObj($classRef); |
76 | |
77 | } |
78 | |
79 | @@ -393,10 +405,10 @@ |
80 | self::$registry[$instance->uid] = $instance; |
81 | |
82 | // Load extension configuration |
83 | - $_extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
84 | + $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
85 | |
86 | // Save document to session if caching is enabled. |
87 | - if (!empty($_extConf['caching'])) { |
88 | + if (!empty($extConf['caching'])) { |
89 | |
90 | tx_dlf_helper::saveToSession(self::$registry, get_class($instance)); |
91 | |
92 | @@ -412,6 +424,62 @@ |
93 | /** |
94 | * This gets details about a logical structure element |
95 | * |
96 | + * @access public |
97 | + * |
98 | + * @param string $id: The @ID attribute of the logical structure node |
99 | + * @param boolean $recursive: Whether to include the child elements |
100 | + * |
101 | + * @return array Array of the element's id, label, type and physical page indexes/mptr link |
102 | + */ |
103 | + public function getLogicalStructure($id, $recursive = FALSE) { |
104 | + |
105 | + $details = array (); |
106 | + |
107 | + // Is the requested logical unit already loaded? |
108 | + if (!$recursive && !empty($this->logicalUnits[$id])) { |
109 | + |
110 | + // Yes. Return it. |
111 | + return $this->logicalUnits[$id]; |
112 | + |
113 | + } elseif (!empty($id)) { |
114 | + |
115 | + // Get specified logical unit. |
116 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
117 | + |
118 | + } else { |
119 | + |
120 | + // Get all logical units at top level. |
121 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
122 | + |
123 | + } |
124 | + |
125 | + if (!empty($divs)) { |
126 | + |
127 | + if (!$recursive) { |
128 | + |
129 | + // Get the details for the first xpath hit. |
130 | + $details = $this->getLogicalStructureInfo($divs[0]); |
131 | + |
132 | + } else { |
133 | + |
134 | + // Walk the logical structure recursively and fill the whole table of contents. |
135 | + foreach ($divs as $div) { |
136 | + |
137 | + $this->tableOfContents[] = $this->getLogicalStructureInfo($div, TRUE); |
138 | + |
139 | + } |
140 | + |
141 | + } |
142 | + |
143 | + } |
144 | + |
145 | + return $details; |
146 | + |
147 | + } |
148 | + |
149 | + /** |
150 | + * This gets details about a logical structure element |
151 | + * |
152 | * @access protected |
153 | * |
154 | * @param SimpleXMLElement $structure: The logical structure node |
155 | @@ -439,6 +507,7 @@ |
156 | |
157 | $details['volume'] = ''; |
158 | |
159 | + // Set volume information only if no label is set and this is the toplevel structure element. |
160 | if (empty($details['label']) && $details['id'] == $this->_getToplevelId()) { |
161 | |
162 | $metadata = $this->getMetadata($details['id']); |
163 | @@ -455,11 +524,14 @@ |
164 | |
165 | $details['type'] = $attributes['TYPE']; |
166 | |
167 | + // Load smLinks. |
168 | + $this->_getSmLinks(); |
169 | + |
170 | // Get the physical page or external file this structure element is pointing at. |
171 | $details['points'] = ''; |
172 | |
173 | // Is there a mptr node? |
174 | - if (!empty($structure->children('http://www.loc.gov/METS/')->mptr)) { |
175 | + if (count($structure->children('http://www.loc.gov/METS/')->mptr)) { |
176 | |
177 | // Yes. Get the file reference. |
178 | $details['points'] = (string) $structure->children('http://www.loc.gov/METS/')->mptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
179 | @@ -472,7 +544,7 @@ |
180 | // Get page number of the first page related to this structure element. |
181 | $details['pagination'] = $this->physicalPagesInfo[$id]['label']; |
182 | |
183 | - // Is this the toplevel structure? |
184 | + // Is this the toplevel structure element? |
185 | } elseif ($details['id'] == $this->_getToplevelId()) { |
186 | |
187 | // Yes. Point to itself. |
188 | @@ -484,14 +556,14 @@ |
189 | $this->logicalUnits[$details['id']] = $details; |
190 | |
191 | // Walk the structure recursively? And are there any children of the current element? |
192 | - if ($recursive && !empty($structure->children('http://www.loc.gov/METS/')->div)) { |
193 | + if ($recursive && count($structure->children('http://www.loc.gov/METS/')->div)) { |
194 | |
195 | $details['children'] = array (); |
196 | |
197 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
198 | |
199 | // Repeat for all children. |
200 | - $details['children'][] = $this->getLogicalStructureInfo($child, $recursive); |
201 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
202 | |
203 | } |
204 | |
205 | @@ -502,64 +574,6 @@ |
206 | } |
207 | |
208 | /** |
209 | - * This gets details about a logical structure element |
210 | - * |
211 | - * @access public |
212 | - * |
213 | - * @param string $id: The @ID attribute of the logical structure node |
214 | - * @param boolean $recursive: Whether to include the child elements |
215 | - * |
216 | - * @return array Array of the element's id, label, type and physical page indexes/mptr link |
217 | - */ |
218 | - public function getLogicalStructure($id = '', $recursive = FALSE) { |
219 | - |
220 | - // Is the requested logical unit already loaded? |
221 | - if (!$recursive && !empty($id) && !empty($this->logicalUnits[$id])) { |
222 | - |
223 | - // Yes. Return it. |
224 | - return $this->logicalUnits[$id]; |
225 | - |
226 | - } elseif (!empty($id)) { |
227 | - |
228 | - // Get specified logical unit. |
229 | - $div = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
230 | - |
231 | - } elseif ($recursive) { |
232 | - |
233 | - // Get all logical units at top level. |
234 | - $div = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
235 | - |
236 | - } |
237 | - |
238 | - if (!empty($div)) { |
239 | - |
240 | - // Load smLinks. |
241 | - $this->_getSmLinks(); |
242 | - |
243 | - foreach ($div as $structure) { |
244 | - |
245 | - // Get logical unit's details. |
246 | - $this->tableOfContents[] = $this->getLogicalStructureInfo($structure, $recursive); |
247 | - |
248 | - } |
249 | - |
250 | - } |
251 | - |
252 | - if (!empty($this->logicalUnits[$id])) { |
253 | - |
254 | - return $this->logicalUnits[$id]; |
255 | - |
256 | - } else { |
257 | - |
258 | -// trigger_error('There is no logical structure node with @ID '.$id, E_USER_WARNING); |
259 | - |
260 | - return array (); |
261 | - |
262 | - } |
263 | - |
264 | - } |
265 | - |
266 | - /** |
267 | * This extracts all the metadata for a logical structure node |
268 | * |
269 | * @access public |
270 | @@ -572,6 +586,9 @@ |
271 | */ |
272 | public function getMetadata($id, $cPid = 0) { |
273 | |
274 | + // Save parameter for logging purposes. |
275 | + $_cPid = $cPid; |
276 | + |
277 | // Make sure $cPid is a non-negative integer. |
278 | $cPid = max(intval($cPid), 0); |
279 | |
280 | @@ -583,7 +600,11 @@ |
281 | |
282 | } elseif (!$cPid) { |
283 | |
284 | - trigger_error('Invalid PID ('.$cPid.') for metadata definitions', E_USER_WARNING); |
285 | + if (TYPO3_DLOG) { |
286 | + |
287 | + t3lib_div::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid PID "'.$cPid.'" for metadata definitions', $this->extKey, SYSLOG_SEVERITY_ERROR); |
288 | + |
289 | + } |
290 | |
291 | return array (); |
292 | |
293 | @@ -597,7 +618,7 @@ |
294 | } |
295 | |
296 | // Initialize metadata array with empty values. |
297 | - $_metadata = array ( |
298 | + $metadata = array ( |
299 | 'title' => array (), |
300 | 'title_sorting' => array (), |
301 | 'author' => array (), |
302 | @@ -619,17 +640,17 @@ |
303 | // Get the logical structure node's DMDID. |
304 | if (!empty($this->logicalUnits[$id])) { |
305 | |
306 | - $_dmdId = $this->logicalUnits[$id]['dmdId']; |
307 | + $dmdId = $this->logicalUnits[$id]['dmdId']; |
308 | |
309 | } else { |
310 | |
311 | - $_dmdId = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
312 | + $dmdId = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@DMDID'); |
313 | |
314 | - $_dmdId = (string) $_dmdId[0]; |
315 | + $dmdId = (string) $dmdId[0]; |
316 | |
317 | } |
318 | |
319 | - if (!empty($_dmdId)) { |
320 | + if (!empty($dmdId)) { |
321 | |
322 | // Load available metadata formats and dmdSecs. |
323 | $this->loadFormats(); |
324 | @@ -637,30 +658,34 @@ |
325 | $this->_getDmdSec(); |
326 | |
327 | // Is this metadata format supported? |
328 | - if (!empty($this->formats[$this->dmdSec[$_dmdId]['type']]['class'])) { |
329 | - |
330 | - $_class = $this->formats[$this->dmdSec[$_dmdId]['type']]['class']; |
331 | - |
332 | - } elseif (!empty($this->formats['OTHER'][$this->dmdSec[$_dmdId]['type']]['class'])) { |
333 | - |
334 | - $_class = $this->formats['OTHER'][$this->dmdSec[$_dmdId]['type']]['class']; |
335 | + if (!empty($this->formats[$this->dmdSec[$dmdId]['type']]['class'])) { |
336 | + |
337 | + $class = $this->formats[$this->dmdSec[$dmdId]['type']]['class']; |
338 | |
339 | } else { |
340 | |
341 | - trigger_error('Unsupported metadata format or dmdSec with @ID '.$_dmdId.' not found', E_USER_WARNING); |
342 | + if (TYPO3_DLOG) { |
343 | + |
344 | + t3lib_div::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Unsupported metadata format "'.$this->dmdSec[$dmdId]['type'].'" in dmdSec with @ID "'.$dmdId.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
345 | + |
346 | + } |
347 | |
348 | return array (); |
349 | |
350 | } |
351 | |
352 | // Get the metadata from class. |
353 | - if (class_exists($_class) && ($obj = t3lib_div::makeInstance($_class)) instanceof tx_dlf_format) { |
354 | + if (class_exists($class) && ($obj = t3lib_div::makeInstance($class)) instanceof tx_dlf_format) { |
355 | |
356 | - $obj->extractMetadata($this->dmdSec[$_dmdId]['xml'], $_metadata); |
357 | + $obj->extractMetadata($this->dmdSec[$dmdId]['xml'], $metadata); |
358 | |
359 | } else { |
360 | |
361 | - trigger_error('Invalid class/method '.$_class.'->extractMetadata()', E_USER_ERROR); |
362 | + if (TYPO3_DLOG) { |
363 | + |
364 | + t3lib_div::devLog('[tx_dlf_document->getMetadata('.$id.', '.$_cPid.')] Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->dmdSec[$dmdId]['type'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
365 | + |
366 | + } |
367 | |
368 | return array (); |
369 | |
370 | @@ -669,84 +694,84 @@ |
371 | // Get the structure's type. |
372 | if (!empty($this->logicalUnits[$id])) { |
373 | |
374 | - $_metadata['type'] = array ($this->logicalUnits[$id]['type']); |
375 | + $metadata['type'] = array ($this->logicalUnits[$id]['type']); |
376 | |
377 | } else { |
378 | |
379 | - $_struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
380 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
381 | |
382 | - $_metadata['type'] = array ((string) $_struct[0]); |
383 | + $metadata['type'] = array ((string) $struct[0]); |
384 | |
385 | } |
386 | |
387 | // Get the additional metadata from database. |
388 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
389 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
390 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.default_value AS default_value', |
391 | 'tx_dlf_metadata,tx_dlf_formats', |
392 | - 'tx_dlf_metadata.pid='.$cPid.' AND ((tx_dlf_metadata.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$_dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.encoded=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata', TRUE).tx_dlf_helper::whereClause('tx_dlf_formats'), |
393 | + 'tx_dlf_metadata.pid='.$cPid.' AND ((tx_dlf_metadata.encoded=tx_dlf_formats.uid AND tx_dlf_formats.type='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->dmdSec[$dmdId]['type'], 'tx_dlf_formats').') OR tx_dlf_metadata.encoded=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata', TRUE).tx_dlf_helper::whereClause('tx_dlf_formats'), |
394 | '', |
395 | '', |
396 | '' |
397 | ); |
398 | |
399 | // We need a DOMDocument here, because SimpleXML doesn't support XPath functions properly. |
400 | - $_domNode = dom_import_simplexml($this->dmdSec[$_dmdId]['xml']); |
401 | - |
402 | - $_domXPath = new DOMXPath($_domNode->ownerDocument); |
403 | - |
404 | - $this->registerNamespaces($_domXPath); |
405 | + $domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']); |
406 | + |
407 | + $domXPath = new DOMXPath($domNode->ownerDocument); |
408 | + |
409 | + $this->registerNamespaces($domXPath); |
410 | |
411 | // OK, now make the XPath queries. |
412 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
413 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
414 | |
415 | // Set metadata field's value(s). |
416 | - if ($resArray['xpath'] && ($_values = $_domXPath->evaluate($resArray['xpath'], $_domNode))) { |
417 | - |
418 | - if ($_values instanceof DOMNodeList && $_values->length > 0) { |
419 | - |
420 | - $_metadata[$resArray['index_name']] = array (); |
421 | - |
422 | - foreach ($_values as $_value) { |
423 | - |
424 | - $_metadata[$resArray['index_name']][] = trim((string) $_value->nodeValue); |
425 | + if ($resArray['xpath'] && ($values = $domXPath->evaluate($resArray['xpath'], $domNode))) { |
426 | + |
427 | + if ($values instanceof DOMNodeList && $values->length > 0) { |
428 | + |
429 | + $metadata[$resArray['index_name']] = array (); |
430 | + |
431 | + foreach ($values as $value) { |
432 | + |
433 | + $metadata[$resArray['index_name']][] = trim((string) $value->nodeValue); |
434 | |
435 | } |
436 | |
437 | - } elseif (!($_values instanceof DOMNodeList)) { |
438 | + } elseif (!($values instanceof DOMNodeList)) { |
439 | |
440 | - $_metadata[$resArray['index_name']] = array (trim((string) $_values)); |
441 | + $metadata[$resArray['index_name']] = array (trim((string) $values)); |
442 | |
443 | } |
444 | |
445 | } |
446 | |
447 | // Set default value if applicable. |
448 | - if (empty($_metadata[$resArray['index_name']][0]) && $resArray['default_value']) { |
449 | + if (empty($metadata[$resArray['index_name']][0]) && $resArray['default_value']) { |
450 | |
451 | - $_metadata[$resArray['index_name']] = array ($resArray['default_value']); |
452 | + $metadata[$resArray['index_name']] = array ($resArray['default_value']); |
453 | |
454 | } |
455 | |
456 | // Set sorting value if applicable. |
457 | - if (!empty($_metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
458 | - |
459 | - if ($resArray['xpath_sorting'] && ($_values = $_domXPath->evaluate($resArray['xpath_sorting'], $_domNode))) { |
460 | - |
461 | - if ($_values instanceof DOMNodeList && $_values->length > 0) { |
462 | - |
463 | - $_metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $_values->item(0)->nodeValue); |
464 | - |
465 | - } elseif (!($_values instanceof DOMNodeList)) { |
466 | - |
467 | - $_metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $_values); |
468 | + if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
469 | + |
470 | + if ($resArray['xpath_sorting'] && ($values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode))) { |
471 | + |
472 | + if ($values instanceof DOMNodeList && $values->length > 0) { |
473 | + |
474 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
475 | + |
476 | + } elseif (!($values instanceof DOMNodeList)) { |
477 | + |
478 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
479 | |
480 | } |
481 | |
482 | } |
483 | |
484 | - if (empty($_metadata[$resArray['index_name'].'_sorting'][0])) { |
485 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
486 | |
487 | - $_metadata[$resArray['index_name'].'_sorting'][0] = $_metadata[$resArray['index_name']][0]; |
488 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
489 | |
490 | } |
491 | |
492 | @@ -755,11 +780,11 @@ |
493 | } |
494 | |
495 | // Set title to empty string if not present. |
496 | - if (empty($_metadata['title'][0])) { |
497 | - |
498 | - $_metadata['title'][0] = ''; |
499 | - |
500 | - $_metadata['title_sorting'][0] = ''; |
501 | + if (empty($metadata['title'][0])) { |
502 | + |
503 | + $metadata['title'][0] = ''; |
504 | + |
505 | + $metadata['title_sorting'][0] = ''; |
506 | |
507 | } |
508 | |
509 | @@ -770,7 +795,7 @@ |
510 | |
511 | } |
512 | |
513 | - return $_metadata; |
514 | + return $metadata; |
515 | |
516 | } |
517 | |
518 | @@ -786,6 +811,9 @@ |
519 | */ |
520 | public static function getTitle($uid, $recursive = FALSE) { |
521 | |
522 | + // Save parameter for logging purposes. |
523 | + $_uid = $uid; |
524 | + |
525 | $title = ''; |
526 | |
527 | // Sanitize input. |
528 | @@ -816,13 +844,21 @@ |
529 | |
530 | } else { |
531 | |
532 | - trigger_error('No document with UID '.$uid.' found', E_USER_WARNING); |
533 | + if (TYPO3_DLOG) { |
534 | + |
535 | + t3lib_div::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] No document with UID "'.$uid.'" found or document not accessible', $this->extKey, SYSLOG_SEVERITY_WARNING); |
536 | + |
537 | + } |
538 | |
539 | } |
540 | |
541 | } else { |
542 | |
543 | - trigger_error('No UID given for document', E_USER_ERROR); |
544 | + if (TYPO3_DLOG) { |
545 | + |
546 | + t3lib_div::devLog('[tx_dlf_document->getTitle('.$_uid.', ['.($recursive ? 'TRUE' : 'FALSE').'])] Invalid UID "'.$uid.'" for document', $this->extKey, SYSLOG_SEVERITY_ERROR); |
547 | + |
548 | + } |
549 | |
550 | } |
551 | |
552 | @@ -865,11 +901,11 @@ |
553 | // Get METS node from XML file. |
554 | $this->registerNamespaces($this->xml); |
555 | |
556 | - $_mets = $this->xml->xpath('//mets:mets'); |
557 | - |
558 | - if ($_mets) { |
559 | - |
560 | - $this->mets = $_mets[0]; |
561 | + $mets = $this->xml->xpath('//mets:mets'); |
562 | + |
563 | + if ($mets) { |
564 | + |
565 | + $this->mets = $mets[0]; |
566 | |
567 | // Register namespaces. |
568 | $this->registerNamespaces($this->mets); |
569 | @@ -879,7 +915,11 @@ |
570 | |
571 | } else { |
572 | |
573 | - trigger_error('No valid METS part found in document with UID '.$this->uid, E_USER_ERROR); |
574 | + if (TYPO3_DLOG) { |
575 | + |
576 | + t3lib_div::devLog('[tx_dlf_document->init()] No METS part found in document with UID "'.$this->uid.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
577 | + |
578 | + } |
579 | |
580 | } |
581 | |
582 | @@ -904,39 +944,48 @@ |
583 | || version_compare(phpversion(), '5.3.3', '<')) { |
584 | |
585 | // Load extension configuration |
586 | - $_extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
587 | + $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); |
588 | |
589 | // Set user-agent to identify self when fetching XML data. |
590 | - if (!empty($_extConf['useragent'])) { |
591 | + if (!empty($extConf['useragent'])) { |
592 | |
593 | - @ini_set('user_agent', $_extConf['useragent']); |
594 | + @ini_set('user_agent', $extConf['useragent']); |
595 | |
596 | } |
597 | |
598 | - // Load XML from file... |
599 | - $_libxmlErrors = libxml_use_internal_errors(TRUE); |
600 | - |
601 | - $_xml = @simplexml_load_file($location); |
602 | - |
603 | - libxml_use_internal_errors($_libxmlErrors); |
604 | - |
605 | - // ...and set some basic properties. |
606 | - if ($_xml !== FALSE) { |
607 | - |
608 | - $this->xml = $_xml; |
609 | + // Turn off libxml's error logging. |
610 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
611 | + |
612 | + // Load XML from file. |
613 | + $xml = @simplexml_load_file($location); |
614 | + |
615 | + // Reset libxml's error logging. |
616 | + libxml_use_internal_errors($libxmlErrors); |
617 | + |
618 | + // Set some basic properties. |
619 | + if ($xml !== FALSE) { |
620 | + |
621 | + $this->xml = $xml; |
622 | |
623 | return TRUE; |
624 | |
625 | } else { |
626 | |
627 | - trigger_error('Could not load XML file from '.$location, E_USER_ERROR); |
628 | - // TODO: libxml_get_errors() || libxml_get_last_error() || libxml_clear_errors() |
629 | + if (TYPO3_DLOG) { |
630 | + |
631 | + t3lib_div::devLog('[tx_dlf_document->load('.$location.')] Could not load XML file from "'.$location.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
632 | + |
633 | + } |
634 | |
635 | } |
636 | |
637 | } else { |
638 | |
639 | - trigger_error('File location "'.$location.'" is not a valid URL', E_USER_ERROR); |
640 | + if (TYPO3_DLOG) { |
641 | + |
642 | + t3lib_div::devLog('[tx_dlf_document->load('.$location.')] Invalid file location "'.$location.'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR); |
643 | + |
644 | + } |
645 | |
646 | } |
647 | |
648 | @@ -956,8 +1005,8 @@ |
649 | if (!$this->formatsLoaded) { |
650 | |
651 | // Get available data formats from database. |
652 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
653 | - 'tx_dlf_formats.type AS type,tx_dlf_formats.other_type AS other_type,tx_dlf_formats.root AS root,tx_dlf_formats.namespace AS namespace,tx_dlf_formats.class AS class', |
654 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
655 | + 'tx_dlf_formats.type AS type,tx_dlf_formats.root AS root,tx_dlf_formats.namespace AS namespace,tx_dlf_formats.class AS class', |
656 | 'tx_dlf_formats', |
657 | 'tx_dlf_formats.pid=0'.tx_dlf_helper::whereClause('tx_dlf_formats'), |
658 | '', |
659 | @@ -965,27 +1014,14 @@ |
660 | '' |
661 | ); |
662 | |
663 | - while ($_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
664 | - |
665 | - if (!$_resArray['other_type']) { |
666 | - |
667 | - // Update format registry. |
668 | - $this->formats[$_resArray['type']] = array ( |
669 | - 'rootElement' => $_resArray['root'], |
670 | - 'namespaceURI' => $_resArray['namespace'], |
671 | - 'class' => $_resArray['class'] |
672 | - ); |
673 | - |
674 | - } else { |
675 | - |
676 | - // Update format registry. |
677 | - $this->formats['OTHER'][$_resArray['type']] = array ( |
678 | - 'rootElement' => $_resArray['root'], |
679 | - 'namespaceURI' => $_resArray['namespace'], |
680 | - 'class' => $_resArray['class'] |
681 | - ); |
682 | - |
683 | - } |
684 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
685 | + |
686 | + // Update format registry. |
687 | + $this->formats[$resArray['type']] = array ( |
688 | + 'rootElement' => $resArray['root'], |
689 | + 'namespaceURI' => $resArray['namespace'], |
690 | + 'class' => $resArray['class'] |
691 | + ); |
692 | |
693 | } |
694 | |
695 | @@ -1011,43 +1047,28 @@ |
696 | // Do we have a SimpleXMLElement or DOMXPath object? |
697 | if ($obj instanceof SimpleXMLElement) { |
698 | |
699 | - $_method = 'registerXPathNamespace'; |
700 | + $method = 'registerXPathNamespace'; |
701 | |
702 | } elseif ($obj instanceof DOMXPath) { |
703 | |
704 | - $_method = 'registerNamespace'; |
705 | + $method = 'registerNamespace'; |
706 | |
707 | } else { |
708 | |
709 | - trigger_error('No SimpleXMLElement or DOMXPath object given', E_USER_WARNING); |
710 | + if (TYPO3_DLOG) { |
711 | + |
712 | + t3lib_div::devLog('[tx_dlf_document->registerNamespaces(['.get_class($obj).'])] Given object is neither a SimpleXMLElement nor a DOMXPath instance', $this->extKey, SYSLOG_SEVERITY_ERROR); |
713 | + |
714 | + } |
715 | |
716 | return; |
717 | |
718 | } |
719 | |
720 | - // Register mandatory METS' and XLINK's namespaces. |
721 | - $obj->$_method('mets', 'http://www.loc.gov/METS/'); |
722 | - |
723 | - // This one can become a problem, because MODS uses its own custom XLINK schema. |
724 | - // @see http://comments.gmane.org/gmane.comp.text.mods/1126 |
725 | - $obj->$_method('xlink', 'http://www.w3.org/1999/xlink'); |
726 | - |
727 | // Register metadata format's namespaces. |
728 | foreach ($this->formats as $enc => $conf) { |
729 | |
730 | - if ($enc != 'OTHER') { |
731 | - |
732 | - $obj->$_method(strtolower($enc), $conf['namespaceURI']); |
733 | - |
734 | - } else { |
735 | - |
736 | - foreach ($conf as $otherEnc => $otherConf) { |
737 | - |
738 | - $obj->$_method(strtolower($otherEnc), $otherConf['namespaceURI']); |
739 | - |
740 | - } |
741 | - |
742 | - } |
743 | + $obj->$method(strtolower($enc), $conf['namespaceURI']); |
744 | |
745 | } |
746 | |
747 | @@ -1065,9 +1086,18 @@ |
748 | */ |
749 | public function save($pid = 0, $core = 0) { |
750 | |
751 | + // Save parameters for logging purposes. |
752 | + $_pid = $pid; |
753 | + |
754 | + $_core = $core; |
755 | + |
756 | if (TYPO3_MODE !== 'BE') { |
757 | |
758 | - trigger_error('Saving documents is only allowed in the backend!', E_USER_ERROR); |
759 | + if (TYPO3_DLOG) { |
760 | + |
761 | + t3lib_div::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Saving a document is only allowed in the backend', $this->extKey, SYSLOG_SEVERITY_ERROR); |
762 | + |
763 | + } |
764 | |
765 | return FALSE; |
766 | |
767 | @@ -1087,7 +1117,11 @@ |
768 | |
769 | } elseif (!$pid) { |
770 | |
771 | - trigger_error('Invalid PID ('.$pid.') given to save document', E_USER_WARNING); |
772 | + if (TYPO3_DLOG) { |
773 | + |
774 | + t3lib_div::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid PID "'.$pid.'" for document saving', $this->extKey, SYSLOG_SEVERITY_ERROR); |
775 | + |
776 | + } |
777 | |
778 | return FALSE; |
779 | |
780 | @@ -1118,7 +1152,11 @@ |
781 | // Check for record identifier. |
782 | if (empty($metadata['record_id'][0])) { |
783 | |
784 | - trigger_error('No record identifier found to avoid duplication', E_USER_WARNING); |
785 | + if (TYPO3_DLOG) { |
786 | + |
787 | + t3lib_div::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] No record identifier found to avoid duplication', $this->extKey, SYSLOG_SEVERITY_ERROR); |
788 | + |
789 | + } |
790 | |
791 | return FALSE; |
792 | |
793 | @@ -1142,7 +1180,11 @@ |
794 | |
795 | } else { |
796 | |
797 | - trigger_error('Could not identify structure type', E_USER_ERROR); |
798 | + if (TYPO3_DLOG) { |
799 | + |
800 | + t3lib_div::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Could not identify document/structure type', $this->extKey, SYSLOG_SEVERITY_ERROR); |
801 | + |
802 | + } |
803 | |
804 | return FALSE; |
805 | |
806 | @@ -1166,23 +1208,23 @@ |
807 | |
808 | $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
809 | |
810 | - $_collUid[$resArray['index_name']] = $resArray['uid']; |
811 | + $collUid[$resArray['index_name']] = $resArray['uid']; |
812 | |
813 | } |
814 | |
815 | foreach ($metadata['collection'] as $collection) { |
816 | |
817 | - if (!empty($_collUid[$collection])) { |
818 | + if (!empty($collUid[$collection])) { |
819 | |
820 | // Add existing collection's UID. |
821 | - $collections[] = $_collUid[$collection]; |
822 | + $collections[] = $collUid[$collection]; |
823 | |
824 | } else { |
825 | |
826 | // Insert new collection. |
827 | - $_collNewUid = uniqid('NEW'); |
828 | + $collNewUid = uniqid('NEW'); |
829 | |
830 | - $_collData['tx_dlf_collections'][$_collNewUid] = array ( |
831 | + $collData['tx_dlf_collections'][$collNewUid] = array ( |
832 | 'pid' => $pid, |
833 | 'label' => $collection, |
834 | 'index_name' => $collection, |
835 | @@ -1193,23 +1235,23 @@ |
836 | 'status' => 0, |
837 | ); |
838 | |
839 | - $_substUid = tx_dlf_helper::processDB($_collData); |
840 | + $substUid = tx_dlf_helper::processDB($collData); |
841 | |
842 | // Prevent double insertion. |
843 | - unset ($_collData); |
844 | + unset ($collData); |
845 | |
846 | // Add new collection's UID. |
847 | - $collections[] = $_substUid[$_collNewUid]; |
848 | + $collections[] = $substUid[$collNewUid]; |
849 | |
850 | - $_message = t3lib_div::makeInstance( |
851 | + $message = t3lib_div::makeInstance( |
852 | 't3lib_FlashMessage', |
853 | - htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.newCollection'), $collection, $_substUid[$_collNewUid])), |
854 | + htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.newCollection'), $collection, $substUid[$collNewUid])), |
855 | $GLOBALS['LANG']->getLL('flash.attention', TRUE), |
856 | t3lib_FlashMessage::INFO, |
857 | TRUE |
858 | ); |
859 | |
860 | - t3lib_FlashMessageQueue::addMessage($_message); |
861 | + t3lib_FlashMessageQueue::addMessage($message); |
862 | |
863 | } |
864 | |
865 | @@ -1254,9 +1296,9 @@ |
866 | } else { |
867 | |
868 | // Insert new library. |
869 | - $_libNewUid = uniqid('NEW'); |
870 | + $libNewUid = uniqid('NEW'); |
871 | |
872 | - $_libData['tx_dlf_libraries'][$_libNewUid] = array ( |
873 | + $libData['tx_dlf_libraries'][$libNewUid] = array ( |
874 | 'pid' => $pid, |
875 | 'label' => $metadata['owner'][0], |
876 | 'index_name' => $metadata['owner'][0], |
877 | @@ -1271,20 +1313,20 @@ |
878 | 'union_base' => '', |
879 | ); |
880 | |
881 | - $_substUid = tx_dlf_helper::processDB($_libData); |
882 | + $substUid = tx_dlf_helper::processDB($libData); |
883 | |
884 | // Add new library's UID. |
885 | - $owner = $_substUid[$_libNewUid]; |
886 | + $owner = $substUid[$libNewUid]; |
887 | |
888 | - $_message = t3lib_div::makeInstance( |
889 | + $message = t3lib_div::makeInstance( |
890 | 't3lib_FlashMessage', |
891 | - htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.newLibrary'), $metadata['owner'][0], $_substUid[$_libNewUid])), |
892 | + htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.newLibrary'), $metadata['owner'][0], $substUid[$libNewUid])), |
893 | $GLOBALS['LANG']->getLL('flash.attention', TRUE), |
894 | t3lib_FlashMessage::INFO, |
895 | TRUE |
896 | ); |
897 | |
898 | - t3lib_FlashMessageQueue::addMessage($_message); |
899 | + t3lib_FlashMessageQueue::addMessage($message); |
900 | |
901 | } |
902 | |
903 | @@ -1401,7 +1443,11 @@ |
904 | |
905 | } else { |
906 | |
907 | - trigger_error('Invalid UID for Solr core ('.$core.') given to index document', E_USER_NOTICE); |
908 | + if (TYPO3_DLOG) { |
909 | + |
910 | + t3lib_div::devLog('[tx_dlf_document->save('.$_pid.', '.$_core.')] Invalid UID "'.$core.'" for Solr core', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
911 | + |
912 | + } |
913 | |
914 | } |
915 | |
916 | @@ -1437,49 +1483,39 @@ |
917 | $this->loadFormats(); |
918 | |
919 | // Get dmdSec nodes from METS. |
920 | - $_dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
921 | - |
922 | - foreach ($_dmdIds as $_dmdId) { |
923 | - |
924 | - $_type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $_dmdId.'"]/mets:mdWrap/@MDTYPE'); |
925 | - |
926 | - if ($_type && !empty($this->formats[(string) $_type[0]]) && $_type[0] != 'OTHER') { |
927 | - |
928 | - $_type = (string) $_type[0]; |
929 | - |
930 | - $_xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $_dmdId.'"]/mets:mdWrap[@MDTYPE="'.$_type.'"]/mets:xmlData/'.strtolower($_type).':'.$this->formats[$_type]['rootElement']); |
931 | - |
932 | - if ($_xml) { |
933 | - |
934 | - $this->dmdSec[(string) $_dmdId]['type'] = $_type; |
935 | - |
936 | - $this->dmdSec[(string) $_dmdId]['xml'] = $_xml[0]; |
937 | - |
938 | - $this->registerNamespaces($this->dmdSec[(string) $_dmdId]['xml']); |
939 | - |
940 | - } |
941 | - |
942 | - } elseif ($_type && $_type[0] == 'OTHER') { |
943 | - |
944 | - $_otherType = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $_dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE'); |
945 | - |
946 | - if ($_otherType && !empty($this->formats['OTHER'][(string) $_otherType[0]])) { |
947 | - |
948 | - $_otherType = (string) $_otherType[0]; |
949 | - |
950 | - $_xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $_dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$_otherType.'"]/mets:xmlData/'.strtolower($_otherType).':'.$this->formats['OTHER'][$_otherType]['rootElement']); |
951 | - |
952 | - if ($_xml) { |
953 | - |
954 | - $this->dmdSec[(string) $_dmdId]['type'] = $_otherType; |
955 | - |
956 | - $this->dmdSec[(string) $_dmdId]['xml'] = $_xml[0]; |
957 | - |
958 | - $this->registerNamespaces($this->dmdSec[(string) $_dmdId]['xml']); |
959 | - |
960 | - } |
961 | - |
962 | - } |
963 | + $dmdIds = $this->mets->xpath('./mets:dmdSec/@ID'); |
964 | + |
965 | + foreach ($dmdIds as $dmdId) { |
966 | + |
967 | + if ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
968 | + |
969 | + if (!empty($this->formats[(string) $type[0]])) { |
970 | + |
971 | + $type = (string) $type[0]; |
972 | + |
973 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
974 | + |
975 | + } |
976 | + |
977 | + } elseif ($type = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
978 | + |
979 | + if (!empty($this->formats[(string) $type[0]])) { |
980 | + |
981 | + $type = (string) $type[0]; |
982 | + |
983 | + $xml = $this->mets->xpath('./mets:dmdSec[@ID="'.(string) $dmdId.'"]/mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
984 | + |
985 | + } |
986 | + |
987 | + } |
988 | + |
989 | + if ($xml) { |
990 | + |
991 | + $this->dmdSec[(string) $dmdId]['type'] = $type; |
992 | + |
993 | + $this->dmdSec[(string) $dmdId]['xml'] = $xml[0]; |
994 | + |
995 | + $this->registerNamespaces($this->dmdSec[(string) $dmdId]['xml']); |
996 | |
997 | } |
998 | |
999 | @@ -1507,7 +1543,11 @@ |
1000 | |
1001 | if (!$cPid) { |
1002 | |
1003 | - trigger_error('No PID for metadata definitions found', E_USER_ERROR); |
1004 | + if (TYPO3_DLOG) { |
1005 | + |
1006 | + t3lib_div::devLog('[tx_dlf_document->getMetadataArray()] Invalid PID "'.$cPid.'" for metadata definitions', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1007 | + |
1008 | + } |
1009 | |
1010 | return array (); |
1011 | |
1012 | @@ -1516,11 +1556,11 @@ |
1013 | if (!$this->metadataArrayLoaded || $this->metadataArray[0] != $cPid) { |
1014 | |
1015 | // Get all logical structure nodes with metadata |
1016 | - if (($_ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'))) { |
1017 | - |
1018 | - foreach ($_ids as $_id) { |
1019 | - |
1020 | - $this->metadataArray[(string) $_id] = $this->getMetadata((string) $_id, $cPid); |
1021 | + if (($ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'))) { |
1022 | + |
1023 | + foreach ($ids as $id) { |
1024 | + |
1025 | + $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
1026 | |
1027 | } |
1028 | |
1029 | @@ -1591,26 +1631,26 @@ |
1030 | if (!$this->physicalPagesLoaded) { |
1031 | |
1032 | // Does the document have a structMap node of type "PHYSICAL"? |
1033 | - $_pageNodes = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]'); |
1034 | + $pageNodes = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]/mets:div[@TYPE="page"]'); |
1035 | |
1036 | - if ($_pageNodes) { |
1037 | + if ($pageNodes) { |
1038 | |
1039 | $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); |
1040 | |
1041 | - $_useGrps = t3lib_div::trimExplode(',', $extConf['fileGrps']); |
1042 | + $useGrps = t3lib_div::trimExplode(',', $extConf['fileGrps']); |
1043 | |
1044 | // Yes. Get concordance of @FILEID and @USE attributes. |
1045 | - $_fileUse = array (); |
1046 | - |
1047 | - $_fileGrps = $this->mets->xpath('./mets:fileSec/mets:fileGrp'); |
1048 | - |
1049 | - foreach ($_fileGrps as $_fileGrp) { |
1050 | - |
1051 | - if (in_array((string) $_fileGrp['USE'], $_useGrps)) { |
1052 | - |
1053 | - foreach ($_fileGrp->children('http://www.loc.gov/METS/')->file as $_file) { |
1054 | - |
1055 | - $_fileUse[(string) $_file->attributes()->ID] = (string) $_fileGrp['USE']; |
1056 | + $fileUse = array (); |
1057 | + |
1058 | + $fileGrps = $this->mets->xpath('./mets:fileSec/mets:fileGrp'); |
1059 | + |
1060 | + foreach ($fileGrps as $fileGrp) { |
1061 | + |
1062 | + if (in_array((string) $fileGrp['USE'], $useGrps)) { |
1063 | + |
1064 | + foreach ($fileGrp->children('http://www.loc.gov/METS/')->file as $file) { |
1065 | + |
1066 | + $fileUse[(string) $file->attributes()->ID] = (string) $fileGrp['USE']; |
1067 | |
1068 | } |
1069 | |
1070 | @@ -1619,46 +1659,46 @@ |
1071 | } |
1072 | |
1073 | // Get the physical sequence's metadata. |
1074 | - $_physNode = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]'); |
1075 | - |
1076 | - $_physSeq[0] = (string) $_physNode[0]['ID']; |
1077 | - |
1078 | - $this->physicalPagesInfo[$_physSeq[0]]['dmdId'] = (isset($_physNode[0]['DMDID']) ? (string) $_physNode[0]['DMDID'] : ''); |
1079 | - |
1080 | - $this->physicalPagesInfo[$_physSeq[0]]['label'] = (isset($_physNode[0]['ORDERLABEL']) ? (string) $_physNode[0]['ORDERLABEL'] : ''); |
1081 | - |
1082 | - $this->physicalPagesInfo[$_physSeq[0]]['type'] = (string) $_physNode[0]['TYPE']; |
1083 | + $physNode = $this->mets->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]'); |
1084 | + |
1085 | + $physSeq[0] = (string) $physNode[0]['ID']; |
1086 | + |
1087 | + $this->physicalPagesInfo[$physSeq[0]]['dmdId'] = (isset($physNode[0]['DMDID']) ? (string) $physNode[0]['DMDID'] : ''); |
1088 | + |
1089 | + $this->physicalPagesInfo[$physSeq[0]]['label'] = (isset($physNode[0]['ORDERLABEL']) ? (string) $physNode[0]['ORDERLABEL'] : ''); |
1090 | + |
1091 | + $this->physicalPagesInfo[$physSeq[0]]['type'] = (string) $physNode[0]['TYPE']; |
1092 | |
1093 | // Get the file representations from fileSec node. |
1094 | - foreach ($_physNode[0]->children('http://www.loc.gov/METS/')->fptr as $_fptr) { |
1095 | + foreach ($physNode[0]->children('http://www.loc.gov/METS/')->fptr as $fptr) { |
1096 | |
1097 | // Check if file has valid @USE attribute. |
1098 | - if (!empty($_fileUse[(string) $_fptr->attributes()->FILEID])) { |
1099 | + if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) { |
1100 | |
1101 | - $this->physicalPagesInfo[$_physSeq[0]]['files'][strtolower($_fileUse[(string) $_fptr->attributes()->FILEID])] = (string) $_fptr->attributes()->FILEID; |
1102 | + $this->physicalPagesInfo[$physSeq[0]]['files'][strtolower($fileUse[(string) $fptr->attributes()->FILEID])] = (string) $fptr->attributes()->FILEID; |
1103 | |
1104 | } |
1105 | |
1106 | } |
1107 | |
1108 | // Build the physical pages' array from the physical structMap node. |
1109 | - foreach ($_pageNodes as $_pageNode) { |
1110 | - |
1111 | - $_pages[(int) $_pageNode['ORDER']] = (string) $_pageNode['ID']; |
1112 | - |
1113 | - $this->physicalPagesInfo[$_pages[(int) $_pageNode['ORDER']]]['dmdId'] = (isset($_pageNode['DMDID']) ? (string) $_pageNode['DMDID'] : ''); |
1114 | - |
1115 | - $this->physicalPagesInfo[$_pages[(int) $_pageNode['ORDER']]]['label'] = (isset($_pageNode['ORDERLABEL']) ? (string) $_pageNode['ORDERLABEL'] : ''); |
1116 | - |
1117 | - $this->physicalPagesInfo[$_pages[(int) $_pageNode['ORDER']]]['type'] = (string) $_pageNode['TYPE']; |
1118 | + foreach ($pageNodes as $pageNode) { |
1119 | + |
1120 | + $pages[(int) $pageNode['ORDER']] = (string) $pageNode['ID']; |
1121 | + |
1122 | + $this->physicalPagesInfo[$pages[(int) $pageNode['ORDER']]]['dmdId'] = (isset($pageNode['DMDID']) ? (string) $pageNode['DMDID'] : ''); |
1123 | + |
1124 | + $this->physicalPagesInfo[$pages[(int) $pageNode['ORDER']]]['label'] = (isset($pageNode['ORDERLABEL']) ? (string) $pageNode['ORDERLABEL'] : ''); |
1125 | + |
1126 | + $this->physicalPagesInfo[$pages[(int) $pageNode['ORDER']]]['type'] = (string) $pageNode['TYPE']; |
1127 | |
1128 | // Get the file representations from fileSec node. |
1129 | - foreach ($_pageNode->children('http://www.loc.gov/METS/')->fptr as $_fptr) { |
1130 | + foreach ($pageNode->children('http://www.loc.gov/METS/')->fptr as $fptr) { |
1131 | |
1132 | // Check if file has valid @USE attribute. |
1133 | - if (!empty($_fileUse[(string) $_fptr->attributes()->FILEID])) { |
1134 | + if (!empty($fileUse[(string) $fptr->attributes()->FILEID])) { |
1135 | |
1136 | - $this->physicalPagesInfo[$_pages[(int) $_pageNode['ORDER']]]['files'][strtolower($_fileUse[(string) $_fptr->attributes()->FILEID])] = (string) $_fptr->attributes()->FILEID; |
1137 | + $this->physicalPagesInfo[$pages[(int) $pageNode['ORDER']]]['files'][strtolower($fileUse[(string) $fptr->attributes()->FILEID])] = (string) $fptr->attributes()->FILEID; |
1138 | |
1139 | } |
1140 | |
1141 | @@ -1667,13 +1707,13 @@ |
1142 | } |
1143 | |
1144 | // Sort array by keys (= @ORDER). |
1145 | - if (ksort($_pages)) { |
1146 | + if (ksort($pages)) { |
1147 | |
1148 | // Set total number of pages. |
1149 | - $this->numPages = count($_pages); |
1150 | + $this->numPages = count($pages); |
1151 | |
1152 | // Merge and re-index the array to get nice numeric indexes. |
1153 | - $this->physicalPages = array_merge($_physSeq, $_pages); |
1154 | + $this->physicalPages = array_merge($physSeq, $pages); |
1155 | |
1156 | } |
1157 | |
1158 | @@ -1905,22 +1945,25 @@ |
1159 | // Cast to string for safety reasons. |
1160 | $location = (string) $uid; |
1161 | |
1162 | - // Get record identifier to check with database. |
1163 | - $_libxmlErrors = libxml_use_internal_errors(TRUE); |
1164 | + // Turn off libxml's error logging. |
1165 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
1166 | |
1167 | + // Load XML file. |
1168 | $xml = @simplexml_load_file($location); |
1169 | |
1170 | - libxml_use_internal_errors($_libxmlErrors); |
1171 | + // Reset libxml's error logging. |
1172 | + libxml_use_internal_errors($libxmlErrors); |
1173 | |
1174 | if ($xml !== FALSE) { |
1175 | |
1176 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
1177 | |
1178 | - $_objId = $xml->xpath('//mets:mets'); |
1179 | - |
1180 | - if (!empty($_objId[0]['OBJID'])) { |
1181 | - |
1182 | - $this->recordid = (string) $_objId[0]['OBJID']; |
1183 | + // Check for @OBJID in order to use it as record identifier. |
1184 | + $objId = $xml->xpath('//mets:mets'); |
1185 | + |
1186 | + if (!empty($objId[0]['OBJID'])) { |
1187 | + |
1188 | + $this->recordid = (string) $objId[0]['OBJID']; |
1189 | |
1190 | } |
1191 | |
1192 | @@ -1955,12 +1998,12 @@ |
1193 | // Check for PID if needed. |
1194 | if ($pid) { |
1195 | |
1196 | - $whereClause .= ' AND tx_dlf_documents.pid='.$pid; |
1197 | + $whereClause .= ' AND tx_dlf_documents.pid='.intval($pid); |
1198 | |
1199 | } |
1200 | |
1201 | // Get document PID and location from database. |
1202 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1203 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1204 | 'tx_dlf_documents.uid AS uid,tx_dlf_documents.pid AS pid,tx_dlf_documents.record_id AS record_id,tx_dlf_documents.partof AS partof,tx_dlf_documents.location AS location', |
1205 | 'tx_dlf_documents', |
1206 | $whereClause, |
1207 | @@ -1969,9 +2012,9 @@ |
1208 | '1' |
1209 | ); |
1210 | |
1211 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) { |
1212 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
1213 | |
1214 | - list ($this->uid, $this->pid, $this->recordid, $this->parentid, $location) = $GLOBALS['TYPO3_DB']->sql_fetch_row($_result); |
1215 | + list ($this->uid, $this->pid, $this->recordid, $this->parentid, $location) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
1216 | |
1217 | // Load XML file... |
1218 | if ($this->load($location)) { |
1219 | @@ -1995,7 +2038,11 @@ |
1220 | |
1221 | } else { |
1222 | |
1223 | - trigger_error('There is no record with UID '.$uid.' or you are not allowed to access it', E_USER_ERROR); |
1224 | + if (TYPO3_DLOG) { |
1225 | + |
1226 | + t3lib_div::devLog('[tx_dlf_document->__construct('.$uid.', '.$pid.')] No document with UID "'.$uid.'" found or document not accessible', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1227 | + |
1228 | + } |
1229 | |
1230 | } |
1231 | |
1232 | @@ -2012,17 +2059,21 @@ |
1233 | */ |
1234 | public function __get($var) { |
1235 | |
1236 | - $_method = '_get'.ucfirst($var); |
1237 | - |
1238 | - if (!property_exists($this, $var) || !method_exists($this, $_method)) { |
1239 | - |
1240 | - trigger_error('There is no get function for property '.$var, E_USER_ERROR); |
1241 | + $method = '_get'.ucfirst($var); |
1242 | + |
1243 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
1244 | + |
1245 | + if (TYPO3_DLOG) { |
1246 | + |
1247 | + t3lib_div::devLog('[tx_dlf_document->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1248 | + |
1249 | + } |
1250 | |
1251 | return; |
1252 | |
1253 | } else { |
1254 | |
1255 | - return $this->$_method(); |
1256 | + return $this->$method(); |
1257 | |
1258 | } |
1259 | |
1260 | @@ -2040,15 +2091,19 @@ |
1261 | */ |
1262 | public function __set($var, $value) { |
1263 | |
1264 | - $_method = '_set'.ucfirst($var); |
1265 | - |
1266 | - if (!property_exists($this, $var) || !method_exists($this, $_method)) { |
1267 | - |
1268 | - trigger_error('There is no set function for property '.$var, E_USER_ERROR); |
1269 | + $method = '_set'.ucfirst($var); |
1270 | + |
1271 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
1272 | + |
1273 | + if (TYPO3_DLOG) { |
1274 | + |
1275 | + t3lib_div::devLog('[tx_dlf_document->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1276 | + |
1277 | + } |
1278 | |
1279 | } else { |
1280 | |
1281 | - $this->$_method($value); |
1282 | + $this->$method($value); |
1283 | |
1284 | } |
1285 | |
1286 | @@ -2080,13 +2135,13 @@ |
1287 | */ |
1288 | public function __toString() { |
1289 | |
1290 | - $_xml = new DOMDocument('1.0', 'utf-8'); |
1291 | - |
1292 | - $_xml->appendChild($_xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
1293 | - |
1294 | - $_xml->formatOutput = TRUE; |
1295 | - |
1296 | - return $_xml->saveXML(); |
1297 | + $xml = new DOMDocument('1.0', 'utf-8'); |
1298 | + |
1299 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
1300 | + |
1301 | + $xml->formatOutput = TRUE; |
1302 | + |
1303 | + return $xml->saveXML(); |
1304 | |
1305 | } |
1306 | |
1307 | @@ -2100,26 +2155,31 @@ |
1308 | */ |
1309 | public function __wakeup() { |
1310 | |
1311 | - $_libxmlErrors = libxml_use_internal_errors(TRUE); |
1312 | - |
1313 | - // Reload XML from string... |
1314 | - $_xml = @simplexml_load_string($this->asXML); |
1315 | - |
1316 | - libxml_use_internal_errors($_libxmlErrors); |
1317 | - |
1318 | - if ($_xml !== FALSE) { |
1319 | + // Turn off libxml's error logging. |
1320 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
1321 | + |
1322 | + // Reload XML from string. |
1323 | + $xml = @simplexml_load_string($this->asXML); |
1324 | + |
1325 | + // Reset libxml's error logging. |
1326 | + libxml_use_internal_errors($libxmlErrors); |
1327 | + |
1328 | + if ($xml !== FALSE) { |
1329 | |
1330 | $this->asXML = ''; |
1331 | |
1332 | - $this->xml = $_xml; |
1333 | + $this->xml = $xml; |
1334 | |
1335 | - // ...and rebuild the unserializable properties. |
1336 | + // Rebuild the unserializable properties. |
1337 | $this->init(); |
1338 | |
1339 | } else { |
1340 | |
1341 | - trigger_error('Could not reload XML from session', E_USER_ERROR); |
1342 | - // TODO: libxml_get_errors() || libxml_get_last_error() || libxml_clear_errors() |
1343 | + if (TYPO3_DLOG) { |
1344 | + |
1345 | + t3lib_div::devLog('[tx_dlf_document->__wakeup()] Could not load XML after deserialization', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1346 | + |
1347 | + } |
1348 | |
1349 | } |
1350 | |
1351 | |
1352 | === modified file 'dlf/common/class.tx_dlf_helper.php' |
1353 | --- dlf/common/class.tx_dlf_helper.php 2012-08-06 15:18:18 +0000 |
1354 | +++ dlf/common/class.tx_dlf_helper.php 2012-08-17 07:00:27 +0000 |
1355 | @@ -231,15 +231,25 @@ |
1356 | // Check for PHP extension "mcrypt". |
1357 | if (!extension_loaded('mcrypt')) { |
1358 | |
1359 | - trigger_error('PHP extension "mcrypt" not available', E_USER_WARNING); |
1360 | - |
1361 | - return NULL; |
1362 | + if (TYPO3_DLOG) { |
1363 | + |
1364 | + t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] PHP extension "mcrypt" not available', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1365 | + |
1366 | + } |
1367 | + |
1368 | + return; |
1369 | |
1370 | } |
1371 | |
1372 | if (empty($encrypted) || empty($hash)) { |
1373 | |
1374 | - return NULL; |
1375 | + if (TYPO3_DLOG) { |
1376 | + |
1377 | + t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid parameters given for decryption', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1378 | + |
1379 | + } |
1380 | + |
1381 | + return; |
1382 | |
1383 | } |
1384 | |
1385 | @@ -253,7 +263,13 @@ |
1386 | |
1387 | if ($hashed !== $hash) { |
1388 | |
1389 | - return NULL; |
1390 | + if (TYPO3_DLOG) { |
1391 | + |
1392 | + t3lib_div::devLog('[tx_dlf_helper->decrypt('.$encrypted.', '.$hash.')] Invalid hash "'.$hash.'" given for decryption', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1393 | + |
1394 | + } |
1395 | + |
1396 | + return; |
1397 | |
1398 | } |
1399 | |
1400 | @@ -276,9 +292,13 @@ |
1401 | // Check for PHP extension "mcrypt". |
1402 | if (!extension_loaded('mcrypt')) { |
1403 | |
1404 | - trigger_error('PHP extension "mcrypt" not available', E_USER_WARNING); |
1405 | - |
1406 | - return NULL; |
1407 | + if (TYPO3_DLOG) { |
1408 | + |
1409 | + t3lib_div::devLog('[tx_dlf_helper->encrypt('.$string.')] PHP extension "mcrypt" not available', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1410 | + |
1411 | + } |
1412 | + |
1413 | + return; |
1414 | |
1415 | } |
1416 | |
1417 | @@ -305,22 +325,50 @@ |
1418 | |
1419 | if (TYPO3_MODE === 'FE') { |
1420 | |
1421 | - // TODO: Anpassen! (aus typo3/init.php übernommen) |
1422 | - $userObj = t3lib_div::makeInstance('t3lib_beUserAuth'); |
1423 | - |
1424 | - $userObj->start(); |
1425 | - |
1426 | - $userObj->backendCheckLogin(); |
1427 | - |
1428 | - return $userObj; |
1429 | + // Check for existing backend login. |
1430 | + if ($GLOBALS['TSFE']->beUserLogin > 0 && isset($GLOBALS['BE_USER'])) { |
1431 | + |
1432 | + return $GLOBALS['BE_USER']; |
1433 | + |
1434 | + } elseif (!isset($_COOKIE['be_typo_user'])) { |
1435 | + |
1436 | + // Initialize backend session with CLI user's rights. |
1437 | + $userObj = t3lib_div::makeInstance('t3lib_beUserAuth'); |
1438 | + |
1439 | + $userObj->dontSetCookie = TRUE; |
1440 | + |
1441 | + $userObj->start(); |
1442 | + |
1443 | + $userObj->setBeUserByName('_cli_dlf'); |
1444 | + |
1445 | + $userObj->backendCheckLogin(); |
1446 | + |
1447 | + return $userObj; |
1448 | + |
1449 | + } else { |
1450 | + |
1451 | + if (TYPO3_DLOG) { |
1452 | + |
1453 | + t3lib_div::devLog('[tx_dlf_helper->getBeUser()] Could not determine current user\'s login status', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1454 | + |
1455 | + } |
1456 | + |
1457 | + return; |
1458 | + |
1459 | + } |
1460 | |
1461 | } elseif (TYPO3_MODE === 'BE') { |
1462 | |
1463 | + // Return current backend user. |
1464 | return $GLOBALS['BE_USER']; |
1465 | |
1466 | } else { |
1467 | |
1468 | - trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING); |
1469 | + if (TYPO3_DLOG) { |
1470 | + |
1471 | + t3lib_div::devLog('[tx_dlf_helper->getBeUser()] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1472 | + |
1473 | + } |
1474 | |
1475 | return; |
1476 | |
1477 | @@ -341,11 +389,21 @@ |
1478 | */ |
1479 | public static function getIndexName($uid, $table, $pid = -1) { |
1480 | |
1481 | + // Save parameters for logging purposes. |
1482 | + $_uid = $uid; |
1483 | + |
1484 | + $_pid = $pid; |
1485 | + |
1486 | + // Sanitize input. |
1487 | $uid = max(intval($uid), 0); |
1488 | |
1489 | if (!$uid || !in_array($table, array ('tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'))) { |
1490 | |
1491 | - trigger_error('At least one argument is not valid: UID='.$uid.' or TABLE='.$table, E_USER_WARNING); |
1492 | + if (TYPO3_DLOG) { |
1493 | + |
1494 | + t3lib_div::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] Invalid UID "'.$uid.'" or table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1495 | + |
1496 | + } |
1497 | |
1498 | return ''; |
1499 | |
1500 | @@ -353,6 +411,7 @@ |
1501 | |
1502 | $where = ''; |
1503 | |
1504 | + // Should we check for a specific PID, too? |
1505 | if ($pid !== -1) { |
1506 | |
1507 | $pid = max(intval($pid), 0); |
1508 | @@ -361,7 +420,8 @@ |
1509 | |
1510 | } |
1511 | |
1512 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1513 | + // Get index_name from database. |
1514 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1515 | $table.'.index_name AS index_name', |
1516 | $table, |
1517 | $table.'.uid='.$uid.$where.self::whereClause($table), |
1518 | @@ -370,18 +430,24 @@ |
1519 | '1' |
1520 | ); |
1521 | |
1522 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) { |
1523 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
1524 | |
1525 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result); |
1526 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
1527 | |
1528 | return $resArray['index_name']; |
1529 | |
1530 | + } else { |
1531 | + |
1532 | + if (TYPO3_DLOG) { |
1533 | + |
1534 | + t3lib_div::devLog('[tx_dlf_helper->getIndexName('.$_uid.', '.$table.', '.$_pid.')] No "index_name" with UID "'.$uid.'" and PID "'.$pid.'" found in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1535 | + |
1536 | + } |
1537 | + |
1538 | + return ''; |
1539 | + |
1540 | } |
1541 | |
1542 | - trigger_error('No "index_name" with UID '.$uid.' found for PID '.$pid.' in TABLE '.$table, E_USER_WARNING); |
1543 | - |
1544 | - return ''; |
1545 | - |
1546 | } |
1547 | |
1548 | /** |
1549 | @@ -395,45 +461,52 @@ |
1550 | */ |
1551 | public static function getLanguageName($code) { |
1552 | |
1553 | - $_code = strtolower(trim($code)); |
1554 | - |
1555 | - if (preg_match('/^[a-z]{3}$/', $_code)) { |
1556 | - |
1557 | - $_file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml'; |
1558 | - |
1559 | - } elseif (preg_match('/^[a-z]{2}$/', $_code)) { |
1560 | - |
1561 | - $_file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml'; |
1562 | + // Analyze code and set appropriate ISO table. |
1563 | + $isoCode = strtolower(trim($code)); |
1564 | + |
1565 | + if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
1566 | + |
1567 | + $file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-2b.xml'; |
1568 | + |
1569 | + } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) { |
1570 | + |
1571 | + $file = t3lib_extMgm::extPath(self::$extKey).'lib/ISO-639/iso-639-1.xml'; |
1572 | |
1573 | } else { |
1574 | |
1575 | + // No ISO code, return unchanged. |
1576 | return $code; |
1577 | |
1578 | } |
1579 | |
1580 | + // Load ISO table and get localized full name of language. |
1581 | if (TYPO3_MODE === 'FE') { |
1582 | |
1583 | - $iso639 = $GLOBALS['TSFE']->readLLfile($_file); |
1584 | - |
1585 | - if (!empty($iso639['default'][$_code])) { |
1586 | - |
1587 | - $lang = $GLOBALS['TSFE']->getLLL($_code, $iso639); |
1588 | + $iso639 = $GLOBALS['TSFE']->readLLfile($file); |
1589 | + |
1590 | + if (!empty($iso639['default'][$isoCode])) { |
1591 | + |
1592 | + $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639); |
1593 | |
1594 | } |
1595 | |
1596 | } elseif (TYPO3_MODE === 'BE') { |
1597 | |
1598 | - $iso639 = $GLOBALS['LANG']->includeLLFile($_file, FALSE, TRUE); |
1599 | - |
1600 | - if (!empty($iso639['default'][$_code])) { |
1601 | - |
1602 | - $lang = $GLOBALS['LANG']->getLLL($_code, $iso639, FALSE); |
1603 | + $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE); |
1604 | + |
1605 | + if (!empty($iso639['default'][$isoCode])) { |
1606 | + |
1607 | + $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639, FALSE); |
1608 | |
1609 | } |
1610 | |
1611 | } else { |
1612 | |
1613 | - trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING); |
1614 | + if (TYPO3_DLOG) { |
1615 | + |
1616 | + t3lib_div::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1617 | + |
1618 | + } |
1619 | |
1620 | return $code; |
1621 | |
1622 | @@ -445,7 +518,11 @@ |
1623 | |
1624 | } else { |
1625 | |
1626 | - trigger_error('Language code "'.$code.'" not found', E_USER_WARNING); |
1627 | + if (TYPO3_DLOG) { |
1628 | + |
1629 | + t3lib_div::devLog('[tx_dlf_helper->getLanguageName('.$code.')] Language code "'.$code.'" not found in ISO-639 table', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
1630 | + |
1631 | + } |
1632 | |
1633 | return $code; |
1634 | |
1635 | @@ -466,7 +543,7 @@ |
1636 | */ |
1637 | public static function getURN($base, $id) { |
1638 | |
1639 | - $concordance = array( |
1640 | + $concordance = array ( |
1641 | '0' => 1, |
1642 | '1' => 2, |
1643 | '2' => 3, |
1644 | @@ -511,7 +588,11 @@ |
1645 | |
1646 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
1647 | |
1648 | - trigger_error('Invalid chars in URN', E_USER_WARNING); |
1649 | + if (TYPO3_DLOG) { |
1650 | + |
1651 | + t3lib_div::devLog('[tx_dlf_helper->getURN('.$base.', '.$id.')] Invalid chars in given parameters', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1652 | + |
1653 | + } |
1654 | |
1655 | return ''; |
1656 | |
1657 | @@ -559,23 +640,31 @@ |
1658 | * |
1659 | * @access public |
1660 | * |
1661 | - * @param string $key: Session key for retrieval |
1662 | + * @param string $key: Session data key for retrieval |
1663 | * |
1664 | * @return mixed Session value for given key or NULL on failure |
1665 | */ |
1666 | public static function loadFromSession($key) { |
1667 | |
1668 | + // Save parameter for logging purposes. |
1669 | + $_key = $key; |
1670 | + |
1671 | // Cast to string for security reasons. |
1672 | $key = (string) $key; |
1673 | |
1674 | if (!$key) { |
1675 | |
1676 | - trigger_error('No session key given', E_USER_WARNING); |
1677 | + if (TYPO3_DLOG) { |
1678 | + |
1679 | + t3lib_div::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Invalid key "'.$key.'" for session data retrieval', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1680 | + |
1681 | + } |
1682 | |
1683 | return; |
1684 | |
1685 | } |
1686 | |
1687 | + // Get the session data. |
1688 | if (TYPO3_MODE === 'FE') { |
1689 | |
1690 | return $GLOBALS['TSFE']->fe_user->getKey('ses', $key); |
1691 | @@ -586,7 +675,11 @@ |
1692 | |
1693 | } else { |
1694 | |
1695 | - trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING); |
1696 | + if (TYPO3_DLOG) { |
1697 | + |
1698 | + t3lib_div::devLog('[tx_dlf_helper->loadFromSession('.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1699 | + |
1700 | + } |
1701 | |
1702 | return; |
1703 | |
1704 | @@ -647,23 +740,31 @@ |
1705 | * @access public |
1706 | * |
1707 | * @param string $value: Value to save |
1708 | - * @param string $key: Session key for retrieval |
1709 | + * @param string $key: Session data key for saving |
1710 | * |
1711 | * @return boolean TRUE on success, FALSE on failure |
1712 | */ |
1713 | public static function saveToSession($value, $key) { |
1714 | |
1715 | + // Save parameter for logging purposes. |
1716 | + $_key = $key; |
1717 | + |
1718 | // Cast to string for security reasons. |
1719 | $key = (string) $key; |
1720 | |
1721 | if (!$key) { |
1722 | |
1723 | - trigger_error('No session key given', E_USER_WARNING); |
1724 | + if (TYPO3_DLOG) { |
1725 | + |
1726 | + t3lib_div::devLog('[tx_dlf_helper->saveToSession('.$value.', '.$_key.')] Invalid key "'.$key.'" for session data saving', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1727 | + |
1728 | + } |
1729 | |
1730 | return FALSE; |
1731 | |
1732 | } |
1733 | |
1734 | + // Save value in session data. |
1735 | if (TYPO3_MODE === 'FE') { |
1736 | |
1737 | $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value); |
1738 | @@ -680,7 +781,11 @@ |
1739 | |
1740 | } else { |
1741 | |
1742 | - trigger_error('Unexpected TYPO3_MODE', E_USER_WARNING); |
1743 | + if (TYPO3_DLOG) { |
1744 | + |
1745 | + t3lib_div::devLog('[tx_dlf_helper->saveToSession('.$value.', '.$_key.')] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1746 | + |
1747 | + } |
1748 | |
1749 | return FALSE; |
1750 | |
1751 | @@ -689,82 +794,6 @@ |
1752 | } |
1753 | |
1754 | /** |
1755 | - * This validates a METS file against its schemas |
1756 | - * TODO: nicht funktionstüchtig! |
1757 | - * |
1758 | - * @access public |
1759 | - * |
1760 | - * @param SimpleXMLElement $xml: |
1761 | - * |
1762 | - * @return void |
1763 | - */ |
1764 | - public static function schemaValidate(SimpleXMLElement $xml) { |
1765 | - |
1766 | - $_libxmlErrors = libxml_use_internal_errors(TRUE); |
1767 | - |
1768 | - // Get schema locations. |
1769 | - $xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
1770 | - |
1771 | - $_schemaLocations = $xml->xpath('//*[@xsi:schemaLocation]'); |
1772 | - |
1773 | - foreach ($_schemaLocations as $_schemaLocation) { |
1774 | - |
1775 | - $_schemas = explode(' ', (string) $_schemaLocation->attributes('http://www.w3.org/2001/XMLSchema-instance')->schemaLocation); |
1776 | - |
1777 | - for ($i = 1, $j = count($_schemas); $i <= $j; $i++) { |
1778 | - |
1779 | - if ($_schemas[$i] == 'http://www.loc.gov/METS/') { |
1780 | - |
1781 | - $schema['mets'] = $_schemas[$i + 1]; |
1782 | - |
1783 | - } elseif ($_schemas[$i] == 'http://www.loc.gov/mods/v3') { |
1784 | - |
1785 | - $schema['mods'] = $_schemas[$i + 1]; |
1786 | - |
1787 | - } |
1788 | - |
1789 | - } |
1790 | - |
1791 | - } |
1792 | - // TODO: Error-Handling (keine Schemas gefunden) |
1793 | - |
1794 | - // Validate METS part against schema. |
1795 | - $dom = new DOMDocument('1.0', 'UTF-8'); |
1796 | - |
1797 | - $dom->appendChild($dom->importNode(dom_import_simplexml($this->mets), TRUE)); |
1798 | - |
1799 | - $dom->schemaValidate($schema['mets']); |
1800 | - |
1801 | - // TODO: Error-Handling (invalider METS-Part) |
1802 | - // libxml_get_last_error() || libxml_get_errors() || libxml_clear_errors() |
1803 | - |
1804 | - // Validate dmdSec parts against schema. |
1805 | - foreach ($this->dmdSec as $dmdSec) { |
1806 | - |
1807 | - switch ($dmdSec['type']) { |
1808 | - |
1809 | - case 'MODS': |
1810 | - |
1811 | - $dom = new DOMDocument('1.0', 'UTF-8'); |
1812 | - |
1813 | - $dom->appendChild($dom->importNode(dom_import_simplexml($dmdSec['xml']), TRUE)); |
1814 | - |
1815 | - $dom->schemaValidate($schema['mods']); |
1816 | - |
1817 | - // TODO: Error-Handling (invalider MODS-Part) |
1818 | - // libxml_get_last_error() || libxml_get_errors() || libxml_clear_errors() |
1819 | - |
1820 | - break; |
1821 | - |
1822 | - } |
1823 | - |
1824 | - } |
1825 | - |
1826 | - libxml_use_internal_errors($_libxmlErrors); |
1827 | - |
1828 | - } |
1829 | - |
1830 | - /** |
1831 | * This translates an internal "index_name" |
1832 | * |
1833 | * @access public |
1834 | @@ -777,13 +806,24 @@ |
1835 | */ |
1836 | public static function translate($index_name, $table, $pid) { |
1837 | |
1838 | + // Save parameters for logging purposes. |
1839 | + $_index_name = $index_name; |
1840 | + |
1841 | + $_pid = $pid; |
1842 | + |
1843 | + // Load labels into static variable for future use. |
1844 | static $labels = array (); |
1845 | |
1846 | + // Sanitize input. |
1847 | $pid = max(intval($pid), 0); |
1848 | |
1849 | if (!$pid) { |
1850 | |
1851 | - trigger_error('No PID given for translations', E_USER_WARNING); |
1852 | + if (TYPO3_DLOG) { |
1853 | + |
1854 | + t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] Invalid PID "'.$pid.'" for translation', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1855 | + |
1856 | + } |
1857 | |
1858 | return $index_name; |
1859 | |
1860 | @@ -811,7 +851,7 @@ |
1861 | } |
1862 | |
1863 | // Get labels from database. |
1864 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1865 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
1866 | '*', |
1867 | $table, |
1868 | 'pid='.$pid.$additionalWhere.self::whereClause($table), |
1869 | @@ -820,9 +860,9 @@ |
1870 | '' |
1871 | ); |
1872 | |
1873 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) { |
1874 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
1875 | |
1876 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
1877 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
1878 | |
1879 | // Overlay localized labels if available. |
1880 | if ($GLOBALS['TSFE']->sys_language_content > 0) { |
1881 | @@ -841,13 +881,21 @@ |
1882 | |
1883 | } else { |
1884 | |
1885 | - trigger_error('There are no entries with PID '.$pid.' in table '.$table.' or you are not allowed to access them', E_USER_ERROR); |
1886 | + if (TYPO3_DLOG) { |
1887 | + |
1888 | + t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translation with PID "'.$pid.'" available in table "'.$table.'" or translation not accessible', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
1889 | + |
1890 | + } |
1891 | |
1892 | } |
1893 | |
1894 | } else { |
1895 | |
1896 | - trigger_error('The table '.$table.' is not allowed for translation', E_USER_ERROR); |
1897 | + if (TYPO3_DLOG) { |
1898 | + |
1899 | + t3lib_div::devLog('[tx_dlf_helper->translate('.$_index_name.', '.$table.', '.$_pid.')] No translations available for table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
1900 | + |
1901 | + } |
1902 | |
1903 | } |
1904 | |
1905 | @@ -916,7 +964,11 @@ |
1906 | |
1907 | } else { |
1908 | |
1909 | - trigger_error('Unexpected TYPO3_MODE', E_USER_ERROR); |
1910 | + if (TYPO3_DLOG) { |
1911 | + |
1912 | + t3lib_div::devLog('[tx_dlf_helper->whereClause('.$table.', ['.($showHidden ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
1913 | + |
1914 | + } |
1915 | |
1916 | return ' AND 1=-1'; |
1917 | |
1918 | |
1919 | === modified file 'dlf/common/class.tx_dlf_indexing.php' |
1920 | --- dlf/common/class.tx_dlf_indexing.php 2012-08-09 10:31:57 +0000 |
1921 | +++ dlf/common/class.tx_dlf_indexing.php 2012-08-17 07:00:27 +0000 |
1922 | @@ -38,15 +38,6 @@ |
1923 | class tx_dlf_indexing { |
1924 | |
1925 | /** |
1926 | - * Array of autocompletable metadata |
1927 | - * @see loadIndexConf() |
1928 | - * |
1929 | - * @var array |
1930 | - * @access protected |
1931 | - */ |
1932 | - protected static $autocompleted = array (); |
1933 | - |
1934 | - /** |
1935 | * The extension key |
1936 | * |
1937 | * @var string |
1938 | @@ -55,31 +46,21 @@ |
1939 | public static $extKey = 'dlf'; |
1940 | |
1941 | /** |
1942 | - * Array of facets |
1943 | - * @see loadIndexConf() |
1944 | - * |
1945 | - * @var array |
1946 | - * @access protected |
1947 | - */ |
1948 | - protected static $facets = array (); |
1949 | - |
1950 | - /** |
1951 | - * Array of fields' boost values |
1952 | - * @see loadIndexConf() |
1953 | - * |
1954 | - * @var array |
1955 | - * @access protected |
1956 | - */ |
1957 | - protected static $fieldboost = array (); |
1958 | - |
1959 | - /** |
1960 | - * Array of indexed metadata |
1961 | - * @see loadIndexConf() |
1962 | - * |
1963 | - * @var array |
1964 | - * @access protected |
1965 | - */ |
1966 | - protected static $indexed = array (); |
1967 | + * Array of metadata fields' configuration |
1968 | + * @see loadIndexConf() |
1969 | + * |
1970 | + * @var array |
1971 | + * @access protected |
1972 | + */ |
1973 | + protected static $fields = array ( |
1974 | + 'autocompleted' => array (), |
1975 | + 'facets' => array (), |
1976 | + 'sortables' => array (), |
1977 | + 'indexed' => array (), |
1978 | + 'stored' => array (), |
1979 | + 'tokenized' => array (), |
1980 | + 'fieldboost' => array () |
1981 | + ); |
1982 | |
1983 | /** |
1984 | * List of already processed documents |
1985 | @@ -98,33 +79,6 @@ |
1986 | protected static $solr; |
1987 | |
1988 | /** |
1989 | - * Array of sortable metadata |
1990 | - * @see loadIndexConf() |
1991 | - * |
1992 | - * @var array |
1993 | - * @access protected |
1994 | - */ |
1995 | - protected static $sortables = array (); |
1996 | - |
1997 | - /** |
1998 | - * Array of stored metadata |
1999 | - * @see loadIndexConf() |
2000 | - * |
2001 | - * @var array |
2002 | - * @access protected |
2003 | - */ |
2004 | - protected static $stored = array (); |
2005 | - |
2006 | - /** |
2007 | - * Array of tokenized metadata |
2008 | - * @see loadIndexConf() |
2009 | - * |
2010 | - * @var array |
2011 | - * @access protected |
2012 | - */ |
2013 | - protected static $tokenized = array (); |
2014 | - |
2015 | - /** |
2016 | * Array of toplevel structure elements |
2017 | * @see loadIndexConf() |
2018 | * |
2019 | @@ -164,7 +118,11 @@ |
2020 | |
2021 | } else { |
2022 | |
2023 | - trigger_error('Could not load multi-volume work with UID '.$doc->parentid, E_USER_ERROR); |
2024 | + if (TYPO3_DLOG) { |
2025 | + |
2026 | + t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentid.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2027 | + |
2028 | + } |
2029 | |
2030 | return 1; |
2031 | |
2032 | @@ -195,7 +153,7 @@ |
2033 | self::$solr->commit(); |
2034 | |
2035 | // Get document title from database. |
2036 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2037 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2038 | 'tx_dlf_documents.title AS title', |
2039 | 'tx_dlf_documents', |
2040 | 'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'), |
2041 | @@ -204,11 +162,11 @@ |
2042 | '1' |
2043 | ); |
2044 | |
2045 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result); |
2046 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
2047 | |
2048 | if (!defined('TYPO3_cliMode')) { |
2049 | |
2050 | - $_message = t3lib_div::makeInstance( |
2051 | + $message = t3lib_div::makeInstance( |
2052 | 't3lib_FlashMessage', |
2053 | htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)), |
2054 | $GLOBALS['LANG']->getLL('flash.done', TRUE), |
2055 | @@ -216,7 +174,7 @@ |
2056 | TRUE |
2057 | ); |
2058 | |
2059 | - t3lib_FlashMessageQueue::addMessage($_message); |
2060 | + t3lib_FlashMessageQueue::addMessage($message); |
2061 | |
2062 | } |
2063 | |
2064 | @@ -226,7 +184,7 @@ |
2065 | |
2066 | if (!defined('TYPO3_cliMode')) { |
2067 | |
2068 | - $_message = t3lib_div::makeInstance( |
2069 | + $message = t3lib_div::makeInstance( |
2070 | 't3lib_FlashMessage', |
2071 | $GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
2072 | $GLOBALS['LANG']->getLL('flash.error', TRUE), |
2073 | @@ -234,11 +192,15 @@ |
2074 | TRUE |
2075 | ); |
2076 | |
2077 | - t3lib_FlashMessageQueue::addMessage($_message); |
2078 | - |
2079 | - } |
2080 | - |
2081 | - trigger_error('Apache Solr exception thrown: '.$e->getMessage(), E_USER_ERROR); |
2082 | + t3lib_FlashMessageQueue::addMessage($message); |
2083 | + |
2084 | + } |
2085 | + |
2086 | + if (TYPO3_DLOG) { |
2087 | + |
2088 | + t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2089 | + |
2090 | + } |
2091 | |
2092 | return 1; |
2093 | |
2094 | @@ -248,7 +210,7 @@ |
2095 | |
2096 | if (!defined('TYPO3_cliMode')) { |
2097 | |
2098 | - $_message = t3lib_div::makeInstance( |
2099 | + $message = t3lib_div::makeInstance( |
2100 | 't3lib_FlashMessage', |
2101 | $GLOBALS['LANG']->getLL('flash.solrNoConnection', TRUE), |
2102 | $GLOBALS['LANG']->getLL('flash.warning', TRUE), |
2103 | @@ -256,11 +218,15 @@ |
2104 | TRUE |
2105 | ); |
2106 | |
2107 | - t3lib_FlashMessageQueue::addMessage($_message); |
2108 | - |
2109 | - } |
2110 | - |
2111 | - trigger_error('Could not connect to Apache Solr server', E_USER_WARNING); |
2112 | + t3lib_FlashMessageQueue::addMessage($message); |
2113 | + |
2114 | + } |
2115 | + |
2116 | + if (TYPO3_DLOG) { |
2117 | + |
2118 | + t3lib_div::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2119 | + |
2120 | + } |
2121 | |
2122 | return 1; |
2123 | |
2124 | @@ -279,6 +245,9 @@ |
2125 | */ |
2126 | public static function delete($uid) { |
2127 | |
2128 | + // Save parameter for logging purposes. |
2129 | + $_uid = $uid; |
2130 | + |
2131 | // Sanitize input. |
2132 | $uid = max(intval($uid), 0); |
2133 | |
2134 | @@ -310,7 +279,7 @@ |
2135 | |
2136 | if (!defined('TYPO3_cliMode')) { |
2137 | |
2138 | - $_message = t3lib_div::makeInstance( |
2139 | + $message = t3lib_div::makeInstance( |
2140 | 't3lib_FlashMessage', |
2141 | $GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
2142 | $GLOBALS['LANG']->getLL('flash.error', TRUE), |
2143 | @@ -318,11 +287,15 @@ |
2144 | TRUE |
2145 | ); |
2146 | |
2147 | - t3lib_FlashMessageQueue::addMessage($_message); |
2148 | - |
2149 | - } |
2150 | - |
2151 | - trigger_error('Apache Solr exception thrown: '.$e->getMessage(), E_USER_ERROR); |
2152 | + t3lib_FlashMessageQueue::addMessage($message); |
2153 | + |
2154 | + } |
2155 | + |
2156 | + if (TYPO3_DLOG) { |
2157 | + |
2158 | + t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2159 | + |
2160 | + } |
2161 | |
2162 | return 1; |
2163 | |
2164 | @@ -332,7 +305,7 @@ |
2165 | |
2166 | if (!defined('TYPO3_cliMode')) { |
2167 | |
2168 | - $_message = t3lib_div::makeInstance( |
2169 | + $message = t3lib_div::makeInstance( |
2170 | 't3lib_FlashMessage', |
2171 | $GLOBALS['LANG']->getLL('flash.solrNoConnection', TRUE), |
2172 | $GLOBALS['LANG']->getLL('flash.error', TRUE), |
2173 | @@ -340,11 +313,15 @@ |
2174 | TRUE |
2175 | ); |
2176 | |
2177 | - t3lib_FlashMessageQueue::addMessage($_message); |
2178 | - |
2179 | - } |
2180 | - |
2181 | - trigger_error('Could not connect to Apache Solr server', E_USER_ERROR); |
2182 | + t3lib_FlashMessageQueue::addMessage($message); |
2183 | + |
2184 | + } |
2185 | + |
2186 | + if (TYPO3_DLOG) { |
2187 | + |
2188 | + t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2189 | + |
2190 | + } |
2191 | |
2192 | return 1; |
2193 | |
2194 | @@ -352,7 +329,7 @@ |
2195 | |
2196 | if (!defined('TYPO3_cliMode')) { |
2197 | |
2198 | - $_message = t3lib_div::makeInstance( |
2199 | + $message = t3lib_div::makeInstance( |
2200 | 't3lib_FlashMessage', |
2201 | htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('flash.documentDeleted'), $title, $uid)), |
2202 | $GLOBALS['LANG']->getLL('flash.done', TRUE), |
2203 | @@ -360,7 +337,7 @@ |
2204 | TRUE |
2205 | ); |
2206 | |
2207 | - t3lib_FlashMessageQueue::addMessage($_message); |
2208 | + t3lib_FlashMessageQueue::addMessage($message); |
2209 | |
2210 | } |
2211 | |
2212 | @@ -368,7 +345,11 @@ |
2213 | |
2214 | } else { |
2215 | |
2216 | - trigger_error('Could not find document with UID '.$uid, E_USER_ERROR); |
2217 | + if (TYPO3_DLOG) { |
2218 | + |
2219 | + t3lib_div::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2220 | + |
2221 | + } |
2222 | |
2223 | return 1; |
2224 | |
2225 | @@ -388,7 +369,7 @@ |
2226 | protected static function loadIndexConf($pid) { |
2227 | |
2228 | // Get the list of toplevel structures. |
2229 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2230 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2231 | 'tx_dlf_structures.index_name AS index_name', |
2232 | 'tx_dlf_structures', |
2233 | 'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'), |
2234 | @@ -397,14 +378,14 @@ |
2235 | '' |
2236 | ); |
2237 | |
2238 | - while ($_toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
2239 | + while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
2240 | |
2241 | - self::$toplevel[] = $_toplevel['index_name']; |
2242 | + self::$toplevel[] = $toplevel['index_name']; |
2243 | |
2244 | } |
2245 | |
2246 | // Get the metadata indexing options. |
2247 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2248 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2249 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.tokenized AS tokenized,tx_dlf_metadata.stored AS stored,tx_dlf_metadata.indexed AS indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.autocomplete AS autocomplete,tx_dlf_metadata.boost AS boost', |
2250 | 'tx_dlf_metadata', |
2251 | 'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
2252 | @@ -413,51 +394,51 @@ |
2253 | '' |
2254 | ); |
2255 | |
2256 | - while ($_indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
2257 | - |
2258 | - if ($_indexing['tokenized']) { |
2259 | - |
2260 | - self::$tokenized[] = $_indexing['index_name']; |
2261 | - |
2262 | - } |
2263 | - |
2264 | - if ($_indexing['stored'] || $_indexing['is_listed']) { |
2265 | - |
2266 | - self::$stored[] = $_indexing['index_name']; |
2267 | - |
2268 | - } |
2269 | - |
2270 | - if ($_indexing['indexed']) { |
2271 | - |
2272 | - self::$indexed[] = $_indexing['index_name']; |
2273 | - |
2274 | - } |
2275 | - |
2276 | - if ($_indexing['is_sortable']) { |
2277 | - |
2278 | - self::$sortables[] = $_indexing['index_name']; |
2279 | - |
2280 | - } |
2281 | - |
2282 | - if ($_indexing['is_facet']) { |
2283 | - |
2284 | - self::$facets[] = $_indexing['index_name']; |
2285 | - |
2286 | - } |
2287 | - |
2288 | - if ($_indexing['autocomplete']) { |
2289 | - |
2290 | - self::$autocompleted[] = $_indexing['index_name']; |
2291 | - |
2292 | - } |
2293 | - |
2294 | - if ($_indexing['boost'] > 0.0) { |
2295 | - |
2296 | - self::$fieldboost[$_indexing['index_name']] = floatval($_indexing['boost']); |
2297 | + while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
2298 | + |
2299 | + if ($indexing['tokenized']) { |
2300 | + |
2301 | + self::$fields['tokenized'][] = $indexing['index_name']; |
2302 | + |
2303 | + } |
2304 | + |
2305 | + if ($indexing['stored'] || $indexing['is_listed']) { |
2306 | + |
2307 | + self::$fields['stored'][] = $indexing['index_name']; |
2308 | + |
2309 | + } |
2310 | + |
2311 | + if ($indexing['indexed']) { |
2312 | + |
2313 | + self::$fields['indexed'][] = $indexing['index_name']; |
2314 | + |
2315 | + } |
2316 | + |
2317 | + if ($indexing['is_sortable']) { |
2318 | + |
2319 | + self::$fields['sortables'][] = $indexing['index_name']; |
2320 | + |
2321 | + } |
2322 | + |
2323 | + if ($indexing['is_facet']) { |
2324 | + |
2325 | + self::$fields['facets'][] = $indexing['index_name']; |
2326 | + |
2327 | + } |
2328 | + |
2329 | + if ($indexing['autocomplete']) { |
2330 | + |
2331 | + self::$fields['autocompleted'][] = $indexing['index_name']; |
2332 | + |
2333 | + } |
2334 | + |
2335 | + if ($indexing['boost'] > 0.0) { |
2336 | + |
2337 | + self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['boost']); |
2338 | |
2339 | } else { |
2340 | |
2341 | - self::$fieldboost[$_indexing['index_name']] = FALSE; |
2342 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
2343 | |
2344 | } |
2345 | |
2346 | @@ -513,39 +494,39 @@ |
2347 | |
2348 | $solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel)); |
2349 | |
2350 | - $solrDoc->setField('type', $logicalUnit['type'], self::$fieldboost['type']); |
2351 | - |
2352 | - $solrDoc->setField('title', $metadata['title'][0], self::$fieldboost['title']); |
2353 | - |
2354 | - $solrDoc->setField('volume', $metadata['volume'][0], self::$fieldboost['volume']); |
2355 | + $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']); |
2356 | + |
2357 | + $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
2358 | + |
2359 | + $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
2360 | |
2361 | foreach ($metadata as $index_name => $data) { |
2362 | |
2363 | if (!empty($data) && substr($index_name, -8) !== '_sorting') { |
2364 | |
2365 | - $suffix = (in_array($index_name, self::$tokenized) ? 't' : 'u'); |
2366 | - |
2367 | - $suffix .= (in_array($index_name, self::$stored) ? 's' : 'u'); |
2368 | - |
2369 | - $suffix .= (in_array($index_name, self::$indexed) ? 'i' : 'u'); |
2370 | - |
2371 | - $solrDoc->setField($index_name.'_'.$suffix, $data, self::$fieldboost[$index_name]); |
2372 | - |
2373 | - if (in_array($index_name, self::$sortables)) { |
2374 | + $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
2375 | + |
2376 | + $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
2377 | + |
2378 | + $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
2379 | + |
2380 | + $solrDoc->setField($index_name.'_'.$suffix, $data, self::$fields['fieldboost'][$index_name]); |
2381 | + |
2382 | + if (in_array($index_name, self::$fields['sortables'])) { |
2383 | |
2384 | // Add sortable fields to index. |
2385 | $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
2386 | |
2387 | } |
2388 | |
2389 | - if (in_array($index_name, self::$facets)) { |
2390 | + if (in_array($index_name, self::$fields['facets'])) { |
2391 | |
2392 | // Add facets to index. |
2393 | $solrDoc->setField($index_name.'_faceting', $data); |
2394 | |
2395 | } |
2396 | |
2397 | - if (in_array($index_name, self::$autocompleted)) { |
2398 | + if (in_array($index_name, self::$fields['autocompleted'])) { |
2399 | |
2400 | // Add autocomplete values to index. |
2401 | $solrDoc->setField($index_name.'_suggest', $data); |
2402 | @@ -564,7 +545,7 @@ |
2403 | |
2404 | if (!defined('TYPO3_cliMode')) { |
2405 | |
2406 | - $_message = t3lib_div::makeInstance( |
2407 | + $message = t3lib_div::makeInstance( |
2408 | 't3lib_FlashMessage', |
2409 | $GLOBALS['LANG']->getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
2410 | $GLOBALS['LANG']->getLL('flash.error', TRUE), |
2411 | @@ -572,7 +553,7 @@ |
2412 | TRUE |
2413 | ); |
2414 | |
2415 | - t3lib_FlashMessageQueue::addMessage($_message); |
2416 | + t3lib_FlashMessageQueue::addMessage($message); |
2417 | |
2418 | } |
2419 | |
2420 | |
2421 | === modified file 'dlf/common/class.tx_dlf_list.php' |
2422 | --- dlf/common/class.tx_dlf_list.php 2012-08-06 15:19:06 +0000 |
2423 | +++ dlf/common/class.tx_dlf_list.php 2012-08-17 07:00:27 +0000 |
2424 | @@ -92,11 +92,18 @@ |
2425 | */ |
2426 | public function remove($position) { |
2427 | |
2428 | + // Save parameter for logging purposes. |
2429 | + $_position = $position; |
2430 | + |
2431 | $position = intval($position); |
2432 | |
2433 | if ($position < 0 || $position >= $this->count) { |
2434 | |
2435 | - trigger_error('No valid list position for removal', E_USER_WARNING); |
2436 | + if (TYPO3_DLOG) { |
2437 | + |
2438 | + t3lib_div::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING); |
2439 | + |
2440 | + } |
2441 | |
2442 | return; |
2443 | |
2444 | @@ -122,12 +129,21 @@ |
2445 | */ |
2446 | public function move($position, $steps) { |
2447 | |
2448 | + // Save parameters for logging purposes. |
2449 | + $_position = $position; |
2450 | + |
2451 | + $_steps = $steps; |
2452 | + |
2453 | $position = intval($position); |
2454 | |
2455 | // Check if list position is valid. |
2456 | if ($position < 0 || $position >= $this->count) { |
2457 | |
2458 | - trigger_error('Invalid list position '.$position, E_USER_WARNING); |
2459 | + if (TYPO3_DLOG) { |
2460 | + |
2461 | + t3lib_div::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING); |
2462 | + |
2463 | + } |
2464 | |
2465 | return; |
2466 | |
2467 | @@ -138,7 +154,11 @@ |
2468 | // Check if moving given amount of steps is possible. |
2469 | if (($position + $steps) < 0 || ($position + $steps) >= $this->count) { |
2470 | |
2471 | - trigger_error('Element at position '.$position.' can not be moved '.$steps.' steps', E_USER_WARNING); |
2472 | + if (TYPO3_DLOG) { |
2473 | + |
2474 | + t3lib_div::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
2475 | + |
2476 | + } |
2477 | |
2478 | return; |
2479 | |
2480 | @@ -273,6 +293,14 @@ |
2481 | |
2482 | $this->elements = $newOrder; |
2483 | |
2484 | + } else { |
2485 | + |
2486 | + if (TYPO3_DLOG) { |
2487 | + |
2488 | + t3lib_div::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2489 | + |
2490 | + } |
2491 | + |
2492 | } |
2493 | |
2494 | } |
2495 | @@ -400,17 +428,21 @@ |
2496 | */ |
2497 | public function __get($var) { |
2498 | |
2499 | - $_method = '_get'.ucfirst($var); |
2500 | - |
2501 | - if (!property_exists($this, $var) || !method_exists($this, $_method)) { |
2502 | - |
2503 | - trigger_error('There is no get function for property '.$var, E_USER_ERROR); |
2504 | + $method = '_get'.ucfirst($var); |
2505 | + |
2506 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
2507 | + |
2508 | + if (TYPO3_DLOG) { |
2509 | + |
2510 | + t3lib_div::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
2511 | + |
2512 | + } |
2513 | |
2514 | return; |
2515 | |
2516 | } else { |
2517 | |
2518 | - return $this->$_method(); |
2519 | + return $this->$method(); |
2520 | |
2521 | } |
2522 | |
2523 | @@ -428,15 +460,19 @@ |
2524 | */ |
2525 | public function __set($var, $value) { |
2526 | |
2527 | - $_method = '_set'.ucfirst($var); |
2528 | - |
2529 | - if (!property_exists($this, $var) || !method_exists($this, $_method)) { |
2530 | - |
2531 | - trigger_error('There is no set function for property '.$var, E_USER_ERROR); |
2532 | + $method = '_set'.ucfirst($var); |
2533 | + |
2534 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
2535 | + |
2536 | + if (TYPO3_DLOG) { |
2537 | + |
2538 | + t3lib_div::devLog('[tx_dlf_list->__set('.$var.', '.$value.')] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
2539 | + |
2540 | + } |
2541 | |
2542 | } else { |
2543 | |
2544 | - $this->$_method($value); |
2545 | + $this->$method($value); |
2546 | |
2547 | } |
2548 | |
2549 | |
2550 | === modified file 'dlf/common/class.tx_dlf_mods.php' |
2551 | --- dlf/common/class.tx_dlf_mods.php 2012-08-07 14:39:23 +0000 |
2552 | +++ dlf/common/class.tx_dlf_mods.php 2012-08-17 07:00:27 +0000 |
2553 | @@ -107,12 +107,6 @@ |
2554 | |
2555 | $metadata['author'][$i] = trim(implode(', ', $name)); |
2556 | |
2557 | - if (!$metadata['author_sorting'][0]) { |
2558 | - |
2559 | - $metadata['author_sorting'][0] = trim(implode(', ', $name)); |
2560 | - |
2561 | - } |
2562 | - |
2563 | } |
2564 | |
2565 | // Check if there is a display form. |
2566 | @@ -120,12 +114,6 @@ |
2567 | |
2568 | $metadata['author'][$i] = (string) $displayForm[0]; |
2569 | |
2570 | - if (!$metadata['author_sorting'][0]) { |
2571 | - |
2572 | - $metadata['author_sorting'][0] = (string) $displayForm[0]; |
2573 | - |
2574 | - } |
2575 | - |
2576 | } |
2577 | |
2578 | } |
2579 | |
2580 | === modified file 'dlf/common/class.tx_dlf_module.php' |
2581 | --- dlf/common/class.tx_dlf_module.php 2012-08-07 14:39:23 +0000 |
2582 | +++ dlf/common/class.tx_dlf_module.php 2012-08-17 07:00:27 +0000 |
2583 | @@ -147,13 +147,13 @@ |
2584 | // Set $this->MOD_MENU array here or leave empty. |
2585 | |
2586 | /* Example code: |
2587 | - $this->MOD_MENU = array ( |
2588 | - 'function' => array ( |
2589 | - '1' => $GLOBALS['LANG']->getLL('function1'), |
2590 | - '2' => $GLOBALS['LANG']->getLL('function2'), |
2591 | - '3' => $GLOBALS['LANG']->getLL('function3'), |
2592 | - ) |
2593 | - ); */ |
2594 | + $this->MOD_MENU = array ( |
2595 | + 'function' => array ( |
2596 | + '1' => $GLOBALS['LANG']->getLL('function1'), |
2597 | + '2' => $GLOBALS['LANG']->getLL('function2'), |
2598 | + '3' => $GLOBALS['LANG']->getLL('function3'), |
2599 | + ) |
2600 | + ); */ |
2601 | |
2602 | } |
2603 | |
2604 | @@ -182,17 +182,15 @@ |
2605 | <script type="text/javascript"> |
2606 | script_ended = 0; |
2607 | function jumpToUrl(URL) { |
2608 | - document.location = URL; |
2609 | - } |
2610 | - </script> |
2611 | - '; |
2612 | + document.location = URL; |
2613 | + } |
2614 | + </script>'; |
2615 | |
2616 | // Add Javascript for convenient module switch. |
2617 | $this->doc->postCode .= ' |
2618 | <script type="text/javascript"> |
2619 | script_ended = 1; |
2620 | - </script> |
2621 | - '; |
2622 | + </script>'; |
2623 | |
2624 | // Render output. |
2625 | $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); |
2626 | @@ -233,7 +231,7 @@ |
2627 | } |
2628 | |
2629 | /* No xclasses for abstract classes! |
2630 | - if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_module.php']) { |
2631 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_module.php']) { |
2632 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_module.php']); |
2633 | } |
2634 | */ |
2635 | |
2636 | === modified file 'dlf/common/class.tx_dlf_plugin.php' |
2637 | --- dlf/common/class.tx_dlf_plugin.php 2012-08-07 14:39:23 +0000 |
2638 | +++ dlf/common/class.tx_dlf_plugin.php 2012-08-17 07:00:27 +0000 |
2639 | @@ -155,7 +155,11 @@ |
2640 | if (!$this->doc->ready) { |
2641 | |
2642 | // Destroy the incomplete object. |
2643 | - trigger_error('Failed to load document with UID '.$this->piVars['id'], E_USER_ERROR); |
2644 | + if (TYPO3_DLOG) { |
2645 | + |
2646 | + t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2647 | + |
2648 | + } |
2649 | |
2650 | $this->doc = NULL; |
2651 | |
2652 | @@ -170,12 +174,12 @@ |
2653 | |
2654 | // Get UID of document with given record identifier. |
2655 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
2656 | - 'tx_dlf_documents.uid', |
2657 | - 'tx_dlf_documents', |
2658 | - 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
2659 | - '', |
2660 | - '', |
2661 | - '1' |
2662 | + 'tx_dlf_documents.uid', |
2663 | + 'tx_dlf_documents', |
2664 | + 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
2665 | + '', |
2666 | + '', |
2667 | + '1' |
2668 | ); |
2669 | |
2670 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
2671 | @@ -193,13 +197,21 @@ |
2672 | |
2673 | } else { |
2674 | |
2675 | - trigger_error('Failed to load document with record ID '.$this->piVars['recordId'], E_USER_ERROR); |
2676 | + if (TYPO3_DLOG) { |
2677 | + |
2678 | + t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2679 | + |
2680 | + } |
2681 | |
2682 | } |
2683 | |
2684 | } else { |
2685 | |
2686 | - trigger_error('No UID or PID given for document', E_USER_ERROR); |
2687 | + if (TYPO3_DLOG) { |
2688 | + |
2689 | + t3lib_div::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2690 | + |
2691 | + } |
2692 | |
2693 | } |
2694 | |
2695 | @@ -304,7 +316,7 @@ |
2696 | } |
2697 | |
2698 | /* No xclasses for abstract classes! |
2699 | - if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_plugin.php']) { |
2700 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_plugin.php']) { |
2701 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_plugin.php']); |
2702 | } |
2703 | */ |
2704 | |
2705 | === modified file 'dlf/common/class.tx_dlf_solr.php' |
2706 | --- dlf/common/class.tx_dlf_solr.php 2012-08-07 14:39:23 +0000 |
2707 | +++ dlf/common/class.tx_dlf_solr.php 2012-08-17 07:00:27 +0000 |
2708 | @@ -93,6 +93,9 @@ |
2709 | */ |
2710 | public static function solrConnect($core = 0) { |
2711 | |
2712 | + // Save parameter for logging purposes. |
2713 | + $_core = $core; |
2714 | + |
2715 | // Load class. |
2716 | if (!class_exists('Apache_Solr_Service')) { |
2717 | |
2718 | @@ -122,7 +125,11 @@ |
2719 | |
2720 | if (empty($core)) { |
2721 | |
2722 | - trigger_error('Could not find Solr core with UID '.$core, E_USER_NOTICE); |
2723 | + if (TYPO3_DLOG) { |
2724 | + |
2725 | + t3lib_div::devLog('[tx_dlf_solr->solrConnect('.$_core.')] Invalid UID "'.$_core.'" for Apache Solr core', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2726 | + |
2727 | + } |
2728 | |
2729 | return; |
2730 | |
2731 | @@ -146,7 +153,11 @@ |
2732 | |
2733 | } else { |
2734 | |
2735 | - trigger_error('Could not connect to Solr server with core "'.$core.'"', E_USER_ERROR); |
2736 | + if (TYPO3_DLOG) { |
2737 | + |
2738 | + t3lib_div::devLog('[tx_dlf_solr->solrConnect('.$_core.')] Could not connect to Apache Solr server with core "'.$core.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
2739 | + |
2740 | + } |
2741 | |
2742 | return; |
2743 | |
2744 | @@ -191,7 +202,7 @@ |
2745 | } |
2746 | |
2747 | /* No xclasses for static classes! |
2748 | - if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_solr.php']) { |
2749 | +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_solr.php']) { |
2750 | include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/common/class.tx_dlf_solr.php']); |
2751 | } |
2752 | */ |
2753 | |
2754 | === modified file 'dlf/ext_autoload.php' |
2755 | --- dlf/ext_autoload.php 2012-08-07 14:39:23 +0000 |
2756 | +++ dlf/ext_autoload.php 2012-08-17 07:00:27 +0000 |
2757 | @@ -25,36 +25,36 @@ |
2758 | $extensionPath = t3lib_extMgm::extPath('dlf'); |
2759 | |
2760 | return array ( |
2761 | - 'tx_dlf_cli' => $extensionPath.'cli/class.tx_dlf_cli.php', |
2762 | - 'tx_dlf_document' => $extensionPath.'common/class.tx_dlf_document.php', |
2763 | - 'tx_dlf_format' => $extensionPath.'common/class.tx_dlf_format.php', |
2764 | - 'tx_dlf_helper' => $extensionPath.'common/class.tx_dlf_helper.php', |
2765 | - 'tx_dlf_indexing' => $extensionPath.'common/class.tx_dlf_indexing.php', |
2766 | - 'tx_dlf_list' => $extensionPath.'common/class.tx_dlf_list.php', |
2767 | - 'tx_dlf_mods' => $extensionPath.'common/class.tx_dlf_mods.php', |
2768 | - 'tx_dlf_module' => $extensionPath.'common/class.tx_dlf_module.php', |
2769 | - 'tx_dlf_plugin' => $extensionPath.'common/class.tx_dlf_plugin.php', |
2770 | - 'tx_dlf_solr' => $extensionPath.'common/class.tx_dlf_solr.php', |
2771 | - 'tx_dlf_em' => $extensionPath.'hooks/class.tx_dlf_em.php', |
2772 | - 'tx_dlf_hacks' => $extensionPath.'hooks/class.tx_dlf_hacks.php', |
2773 | - 'tx_dlf_tceforms' => $extensionPath.'hooks/class.tx_dlf_tceforms.php', |
2774 | - 'tx_dlf_tcemain' => $extensionPath.'hooks/class.tx_dlf_tcemain.php', |
2775 | - 'tx_dlf_modIndexing' => $extensionPath.'modules/indexing/index.php', |
2776 | - 'tx_dlf_modNewclient' => $extensionPath.'modules/newclient/index.php', |
2777 | - 'tx_dlf_collection' => $extensionPath.'plugins/collection/class.tx_dlf_collection.php', |
2778 | - 'tx_dlf_feeds' => $extensionPath.'plugins/feeds/class.tx_dlf_feeds.php', |
2779 | - 'tx_dlf_listview' => $extensionPath.'plugins/listview/class.tx_dlf_listview.php', |
2780 | - 'tx_dlf_metadata' => $extensionPath.'plugins/metadata/class.tx_dlf_metadata.php', |
2781 | - 'tx_dlf_navigation' => $extensionPath.'plugins/navigation/class.tx_dlf_navigation.php', |
2782 | - 'tx_dlf_oai' => $extensionPath.'plugins/oai/class.tx_dlf_oai.php', |
2783 | - 'tx_dlf_pageview' => $extensionPath.'plugins/pageview/class.tx_dlf_pageview.php', |
2784 | - 'tx_dlf_search' => $extensionPath.'plugins/search/class.tx_dlf_search.php', |
2785 | - 'tx_dlf_search_suggest' => $extensionPath.'plugins/search/class.tx_dlf_search_suggest.php', |
2786 | - 'tx_dlf_statistics' => $extensionPath.'plugins/statistics/class.tx_dlf_statistics.php', |
2787 | - 'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php', |
2788 | - 'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php', |
2789 | - 'tx_dlf_toolsDfgviewer' => $extensionPath.'plugins/toolbox/tools/dfgviewer/class.tx_dlf_toolsDfgviewer.php', |
2790 | - 'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php' |
2791 | + 'tx_dlf_cli' => $extensionPath.'cli/class.tx_dlf_cli.php', |
2792 | + 'tx_dlf_document' => $extensionPath.'common/class.tx_dlf_document.php', |
2793 | + 'tx_dlf_format' => $extensionPath.'common/class.tx_dlf_format.php', |
2794 | + 'tx_dlf_helper' => $extensionPath.'common/class.tx_dlf_helper.php', |
2795 | + 'tx_dlf_indexing' => $extensionPath.'common/class.tx_dlf_indexing.php', |
2796 | + 'tx_dlf_list' => $extensionPath.'common/class.tx_dlf_list.php', |
2797 | + 'tx_dlf_mods' => $extensionPath.'common/class.tx_dlf_mods.php', |
2798 | + 'tx_dlf_module' => $extensionPath.'common/class.tx_dlf_module.php', |
2799 | + 'tx_dlf_plugin' => $extensionPath.'common/class.tx_dlf_plugin.php', |
2800 | + 'tx_dlf_solr' => $extensionPath.'common/class.tx_dlf_solr.php', |
2801 | + 'tx_dlf_em' => $extensionPath.'hooks/class.tx_dlf_em.php', |
2802 | + 'tx_dlf_hacks' => $extensionPath.'hooks/class.tx_dlf_hacks.php', |
2803 | + 'tx_dlf_tceforms' => $extensionPath.'hooks/class.tx_dlf_tceforms.php', |
2804 | + 'tx_dlf_tcemain' => $extensionPath.'hooks/class.tx_dlf_tcemain.php', |
2805 | + 'tx_dlf_modIndexing' => $extensionPath.'modules/indexing/index.php', |
2806 | + 'tx_dlf_modNewclient' => $extensionPath.'modules/newclient/index.php', |
2807 | + 'tx_dlf_collection' => $extensionPath.'plugins/collection/class.tx_dlf_collection.php', |
2808 | + 'tx_dlf_feeds' => $extensionPath.'plugins/feeds/class.tx_dlf_feeds.php', |
2809 | + 'tx_dlf_listview' => $extensionPath.'plugins/listview/class.tx_dlf_listview.php', |
2810 | + 'tx_dlf_metadata' => $extensionPath.'plugins/metadata/class.tx_dlf_metadata.php', |
2811 | + 'tx_dlf_navigation' => $extensionPath.'plugins/navigation/class.tx_dlf_navigation.php', |
2812 | + 'tx_dlf_oai' => $extensionPath.'plugins/oai/class.tx_dlf_oai.php', |
2813 | + 'tx_dlf_pageview' => $extensionPath.'plugins/pageview/class.tx_dlf_pageview.php', |
2814 | + 'tx_dlf_search' => $extensionPath.'plugins/search/class.tx_dlf_search.php', |
2815 | + 'tx_dlf_search_suggest' => $extensionPath.'plugins/search/class.tx_dlf_search_suggest.php', |
2816 | + 'tx_dlf_statistics' => $extensionPath.'plugins/statistics/class.tx_dlf_statistics.php', |
2817 | + 'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php', |
2818 | + 'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php', |
2819 | + 'tx_dlf_toolsDfgviewer' => $extensionPath.'plugins/toolbox/tools/dfgviewer/class.tx_dlf_toolsDfgviewer.php', |
2820 | + 'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php' |
2821 | ); |
2822 | |
2823 | ?> |
2824 | \ No newline at end of file |
2825 | |
2826 | === modified file 'dlf/ext_emconf.php' |
2827 | --- dlf/ext_emconf.php 2012-08-09 12:13:34 +0000 |
2828 | +++ dlf/ext_emconf.php 2012-08-17 07:00:27 +0000 |
2829 | @@ -23,6 +23,7 @@ |
2830 | ***************************************************************/ |
2831 | |
2832 | $EM_CONF[$_EXTKEY] = array( |
2833 | +<<<<<<< TREE |
2834 | 'title' => 'Goobi.Presentation', |
2835 | 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Goobi Digitization Suite.', |
2836 | 'category' => 'fe', |
2837 | @@ -53,6 +54,38 @@ |
2838 | ), |
2839 | ), |
2840 | '_md5_values_when_last_written' => '', |
2841 | +======= |
2842 | + 'title' => 'Goobi.Presentation', |
2843 | + 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Goobi Digitization Suite.', |
2844 | + 'category' => 'fe', |
2845 | + 'author' => 'Sebastian Meyer', |
2846 | + 'author_email' => 'sebastian.meyer@slub-dresden.de', |
2847 | + 'author_company' => '<br /><a href="http://www.slub-dresden.de/en/" target="_blank">Saxon State and University Library Dresden</a><br /><a href="https://launchpad.net/goobi" target="_blank">The Goobi Community</a>', |
2848 | + 'shy' => '', |
2849 | + 'priority' => '', |
2850 | + 'module' => '', |
2851 | + 'state' => 'stable', |
2852 | + 'internal' => '', |
2853 | + 'uploadfolder' => TRUE, |
2854 | + 'createDirs' => '', |
2855 | + 'modify_tables' => '', |
2856 | + 'clearCacheOnLoad' => FALSE, |
2857 | + 'lockType' => '', |
2858 | + 'version' => '1.1.3', |
2859 | + 'constraints' => array( |
2860 | + 'depends' => array( |
2861 | + 'php' => '5.3.0-', |
2862 | + 'typo3' => '4.5.0-', |
2863 | + ), |
2864 | + 'conflicts' => array( |
2865 | + ), |
2866 | + 'suggests' => array( |
2867 | + 'realurl' => '', |
2868 | + 't3jquery' => '', |
2869 | + ), |
2870 | + ), |
2871 | + '_md5_values_when_last_written' => '', |
2872 | +>>>>>>> MERGE-SOURCE |
2873 | ); |
2874 | |
2875 | ?> |
2876 | \ No newline at end of file |
2877 | |
2878 | === modified file 'dlf/ext_tables.php' |
2879 | --- dlf/ext_tables.php 2012-08-07 14:39:23 +0000 |
2880 | +++ dlf/ext_tables.php 2012-08-17 07:00:27 +0000 |
2881 | @@ -26,173 +26,174 @@ |
2882 | |
2883 | // Register database tables. |
2884 | $TCA['tx_dlf_documents'] = array ( |
2885 | - 'ctrl' => array ( |
2886 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents', |
2887 | - 'label' => 'title', |
2888 | - 'tstamp' => 'tstamp', |
2889 | - 'crdate' => 'crdate', |
2890 | - 'cruser_id' => 'cruser_id', |
2891 | - 'default_sortby' => 'ORDER BY title_sorting', |
2892 | - 'delete' => 'deleted', |
2893 | - 'enablecolumns' => array ( |
2894 | - 'disabled' => 'hidden', |
2895 | - 'fe_group' => 'fe_group', |
2896 | - ), |
2897 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
2898 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfdocuments.png', |
2899 | - 'rootLevel' => 0, |
2900 | - 'dividers2tabs' => 2, |
2901 | - 'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
2902 | + 'ctrl' => array ( |
2903 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents', |
2904 | + 'label' => 'title', |
2905 | + 'tstamp' => 'tstamp', |
2906 | + 'crdate' => 'crdate', |
2907 | + 'cruser_id' => 'cruser_id', |
2908 | + 'default_sortby' => 'ORDER BY title_sorting', |
2909 | + 'delete' => 'deleted', |
2910 | + 'enablecolumns' => array ( |
2911 | + 'disabled' => 'hidden', |
2912 | + 'starttime' => 'starttime', |
2913 | + 'endtime' => 'endtime', |
2914 | + 'fe_group' => 'fe_group', |
2915 | ), |
2916 | - 'feInterface' => array ( |
2917 | - 'fe_admin_fieldList' => '', |
2918 | - ) |
2919 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
2920 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfdocuments.png', |
2921 | + 'rootLevel' => 0, |
2922 | + 'dividers2tabs' => 2, |
2923 | + 'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
2924 | + ), |
2925 | + 'feInterface' => array ( |
2926 | + 'fe_admin_fieldList' => '', |
2927 | + ) |
2928 | ); |
2929 | |
2930 | $TCA['tx_dlf_structures'] = array ( |
2931 | - 'ctrl' => array ( |
2932 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures', |
2933 | - 'label' => 'label', |
2934 | - 'tstamp' => 'tstamp', |
2935 | - 'crdate' => 'crdate', |
2936 | - 'cruser_id' => 'cruser_id', |
2937 | - 'languageField' => 'sys_language_uid', |
2938 | - 'transOrigPointerField' => 'l18n_parent', |
2939 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
2940 | - 'default_sortby' => 'ORDER BY label', |
2941 | - 'delete' => 'deleted', |
2942 | - 'enablecolumns' => array ( |
2943 | - 'disabled' => 'hidden', |
2944 | - ), |
2945 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
2946 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfstructures.png', |
2947 | - 'rootLevel' => 0, |
2948 | - 'dividers2tabs' => 2, |
2949 | - 'searchFields' => 'label,index_name,oai_name', |
2950 | + 'ctrl' => array ( |
2951 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures', |
2952 | + 'label' => 'label', |
2953 | + 'tstamp' => 'tstamp', |
2954 | + 'crdate' => 'crdate', |
2955 | + 'cruser_id' => 'cruser_id', |
2956 | + 'languageField' => 'sys_language_uid', |
2957 | + 'transOrigPointerField' => 'l18n_parent', |
2958 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
2959 | + 'default_sortby' => 'ORDER BY label', |
2960 | + 'delete' => 'deleted', |
2961 | + 'enablecolumns' => array ( |
2962 | + 'disabled' => 'hidden', |
2963 | ), |
2964 | - 'feInterface' => array ( |
2965 | - 'fe_admin_fieldList' => '', |
2966 | - ) |
2967 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
2968 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfstructures.png', |
2969 | + 'rootLevel' => 0, |
2970 | + 'dividers2tabs' => 2, |
2971 | + 'searchFields' => 'label,index_name,oai_name', |
2972 | + ), |
2973 | + 'feInterface' => array ( |
2974 | + 'fe_admin_fieldList' => '', |
2975 | + ) |
2976 | ); |
2977 | |
2978 | $TCA['tx_dlf_metadata'] = array ( |
2979 | - 'ctrl' => array ( |
2980 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata', |
2981 | - 'label' => 'label', |
2982 | - 'tstamp' => 'tstamp', |
2983 | - 'crdate' => 'crdate', |
2984 | - 'cruser_id' => 'cruser_id', |
2985 | - 'languageField' => 'sys_language_uid', |
2986 | - 'transOrigPointerField' => 'l18n_parent', |
2987 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
2988 | - 'sortby' => 'sorting', |
2989 | - 'delete' => 'deleted', |
2990 | - 'enablecolumns' => array ( |
2991 | - 'disabled' => 'hidden', |
2992 | - ), |
2993 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
2994 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfmetadata.png', |
2995 | - 'rootLevel' => 0, |
2996 | - 'dividers2tabs' => 2, |
2997 | - 'searchFields' => 'label,index_name,encoding,xpath,xpath_sorting,default', |
2998 | - 'requestUpdate' => 'is_sortable', |
2999 | + 'ctrl' => array ( |
3000 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata', |
3001 | + 'label' => 'label', |
3002 | + 'tstamp' => 'tstamp', |
3003 | + 'crdate' => 'crdate', |
3004 | + 'cruser_id' => 'cruser_id', |
3005 | + 'languageField' => 'sys_language_uid', |
3006 | + 'transOrigPointerField' => 'l18n_parent', |
3007 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
3008 | + 'sortby' => 'sorting', |
3009 | + 'delete' => 'deleted', |
3010 | + 'enablecolumns' => array ( |
3011 | + 'disabled' => 'hidden', |
3012 | ), |
3013 | - 'feInterface' => array ( |
3014 | - 'fe_admin_fieldList' => '', |
3015 | - ) |
3016 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3017 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfmetadata.png', |
3018 | + 'rootLevel' => 0, |
3019 | + 'dividers2tabs' => 2, |
3020 | + 'searchFields' => 'label,index_name,encoding,xpath,xpath_sorting,default', |
3021 | + 'requestUpdate' => 'is_sortable', |
3022 | + ), |
3023 | + 'feInterface' => array ( |
3024 | + 'fe_admin_fieldList' => '', |
3025 | + ) |
3026 | ); |
3027 | |
3028 | $TCA['tx_dlf_formats'] = array ( |
3029 | - 'ctrl' => array ( |
3030 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats', |
3031 | - 'label' => 'type', |
3032 | - 'tstamp' => 'tstamp', |
3033 | - 'crdate' => 'crdate', |
3034 | - 'cruser_id' => 'cruser_id', |
3035 | - 'default_sortby' => 'ORDER BY type', |
3036 | - 'delete' => 'deleted', |
3037 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3038 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfformats.png', |
3039 | - 'rootLevel' => 1, |
3040 | - 'dividers2tabs' => 2, |
3041 | - 'searchFields' => 'type,class', |
3042 | - ), |
3043 | - 'feInterface' => array ( |
3044 | - 'fe_admin_fieldList' => '', |
3045 | - ) |
3046 | + 'ctrl' => array ( |
3047 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats', |
3048 | + 'label' => 'type', |
3049 | + 'tstamp' => 'tstamp', |
3050 | + 'crdate' => 'crdate', |
3051 | + 'cruser_id' => 'cruser_id', |
3052 | + 'default_sortby' => 'ORDER BY type', |
3053 | + 'delete' => 'deleted', |
3054 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3055 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfformats.png', |
3056 | + 'rootLevel' => 1, |
3057 | + 'dividers2tabs' => 2, |
3058 | + 'searchFields' => 'type,class', |
3059 | + ), |
3060 | + 'feInterface' => array ( |
3061 | + 'fe_admin_fieldList' => '', |
3062 | + ) |
3063 | ); |
3064 | |
3065 | $TCA['tx_dlf_solrcores'] = array ( |
3066 | - 'ctrl' => array ( |
3067 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores', |
3068 | - 'label' => 'label', |
3069 | - 'tstamp' => 'tstamp', |
3070 | - 'crdate' => 'crdate', |
3071 | - 'cruser_id' => 'cruser_id', |
3072 | - 'default_sortby' => 'ORDER BY label', |
3073 | - 'delete' => 'deleted', |
3074 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3075 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfsolrcores.png', |
3076 | - 'rootLevel' => -1, |
3077 | - 'adminOnly' => 1, |
3078 | - 'dividers2tabs' => 2, |
3079 | - 'searchFields' => 'label,index_name', |
3080 | - ), |
3081 | - 'feInterface' => array ( |
3082 | - 'fe_admin_fieldList' => '', |
3083 | - ) |
3084 | + 'ctrl' => array ( |
3085 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores', |
3086 | + 'label' => 'label', |
3087 | + 'tstamp' => 'tstamp', |
3088 | + 'crdate' => 'crdate', |
3089 | + 'cruser_id' => 'cruser_id', |
3090 | + 'default_sortby' => 'ORDER BY label', |
3091 | + 'delete' => 'deleted', |
3092 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3093 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfsolrcores.png', |
3094 | + 'rootLevel' => -1, |
3095 | + 'dividers2tabs' => 2, |
3096 | + 'searchFields' => 'label,index_name', |
3097 | + ), |
3098 | + 'feInterface' => array ( |
3099 | + 'fe_admin_fieldList' => '', |
3100 | + ) |
3101 | ); |
3102 | |
3103 | $TCA['tx_dlf_collections'] = array ( |
3104 | - 'ctrl' => array ( |
3105 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections', |
3106 | - 'label' => 'label', |
3107 | - 'tstamp' => 'tstamp', |
3108 | - 'crdate' => 'crdate', |
3109 | - 'cruser_id' => 'cruser_id', |
3110 | - 'fe_cruser_id' => 'fe_cruser_id', |
3111 | - 'fe_admin_lock' => 'fe_admin_lock', |
3112 | - 'languageField' => 'sys_language_uid', |
3113 | - 'transOrigPointerField' => 'l18n_parent', |
3114 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
3115 | - 'default_sortby' => 'ORDER BY label', |
3116 | - 'delete' => 'deleted', |
3117 | - 'enablecolumns' => array ( |
3118 | - 'disabled' => 'hidden', |
3119 | - 'fe_group' => 'fe_group', |
3120 | - ), |
3121 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3122 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfcollections.png', |
3123 | - 'rootLevel' => 0, |
3124 | - 'dividers2tabs' => 2, |
3125 | - 'searchFields' => 'label,index_name,oai_name,fe_cruser_id', |
3126 | + 'ctrl' => array ( |
3127 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections', |
3128 | + 'label' => 'label', |
3129 | + 'tstamp' => 'tstamp', |
3130 | + 'crdate' => 'crdate', |
3131 | + 'cruser_id' => 'cruser_id', |
3132 | + 'fe_cruser_id' => 'fe_cruser_id', |
3133 | + 'fe_admin_lock' => 'fe_admin_lock', |
3134 | + 'languageField' => 'sys_language_uid', |
3135 | + 'transOrigPointerField' => 'l18n_parent', |
3136 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
3137 | + 'default_sortby' => 'ORDER BY label', |
3138 | + 'delete' => 'deleted', |
3139 | + 'enablecolumns' => array ( |
3140 | + 'disabled' => 'hidden', |
3141 | + 'fe_group' => 'fe_group', |
3142 | ), |
3143 | - 'feInterface' => array ( |
3144 | - 'fe_admin_fieldList' => 'label,description,documents', |
3145 | - ) |
3146 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3147 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlfcollections.png', |
3148 | + 'rootLevel' => 0, |
3149 | + 'dividers2tabs' => 2, |
3150 | + 'searchFields' => 'label,index_name,oai_name,fe_cruser_id', |
3151 | + ), |
3152 | + 'feInterface' => array ( |
3153 | + 'fe_admin_fieldList' => 'label,description,documents', |
3154 | + ) |
3155 | ); |
3156 | |
3157 | $TCA['tx_dlf_libraries'] = array ( |
3158 | - 'ctrl' => array ( |
3159 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries', |
3160 | - 'label' => 'label', |
3161 | - 'tstamp' => 'tstamp', |
3162 | - 'crdate' => 'crdate', |
3163 | - 'cruser_id' => 'cruser_id', |
3164 | - 'languageField' => 'sys_language_uid', |
3165 | - 'transOrigPointerField' => 'l18n_parent', |
3166 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
3167 | - 'default_sortby' => 'ORDER BY label', |
3168 | - 'delete' => 'deleted', |
3169 | - 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3170 | - 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlflibraries.png', |
3171 | - 'rootLevel' => 0, |
3172 | - 'dividers2tabs' => 2, |
3173 | - 'searchFields' => 'label,website,contact', |
3174 | - ), |
3175 | - 'feInterface' => array ( |
3176 | - 'fe_admin_fieldList' => '', |
3177 | - ) |
3178 | + 'ctrl' => array ( |
3179 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries', |
3180 | + 'label' => 'label', |
3181 | + 'tstamp' => 'tstamp', |
3182 | + 'crdate' => 'crdate', |
3183 | + 'cruser_id' => 'cruser_id', |
3184 | + 'languageField' => 'sys_language_uid', |
3185 | + 'transOrigPointerField' => 'l18n_parent', |
3186 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
3187 | + 'default_sortby' => 'ORDER BY label', |
3188 | + 'delete' => 'deleted', |
3189 | + 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php', |
3190 | + 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'res/icons/txdlflibraries.png', |
3191 | + 'rootLevel' => 0, |
3192 | + 'dividers2tabs' => 2, |
3193 | + 'searchFields' => 'label,website,contact', |
3194 | + ), |
3195 | + 'feInterface' => array ( |
3196 | + 'fe_admin_fieldList' => '', |
3197 | + ) |
3198 | ); |
3199 | |
3200 | // Register static typoscript. |
3201 | |
3202 | === modified file 'dlf/ext_tables.sql' |
3203 | --- dlf/ext_tables.sql 2012-08-09 10:31:57 +0000 |
3204 | +++ dlf/ext_tables.sql 2012-08-17 07:00:27 +0000 |
3205 | @@ -9,6 +9,8 @@ |
3206 | cruser_id int(11) DEFAULT '0' NOT NULL, |
3207 | deleted tinyint(4) DEFAULT '0' NOT NULL, |
3208 | hidden tinyint(4) DEFAULT '0' NOT NULL, |
3209 | + starttime int(11) DEFAULT '0' NOT NULL, |
3210 | + endtime int(11) DEFAULT '0' NOT NULL, |
3211 | fe_group varchar(100) DEFAULT '' NOT NULL, |
3212 | prod_id tinytext NOT NULL, |
3213 | location text NOT NULL, |
3214 | @@ -109,7 +111,6 @@ |
3215 | cruser_id int(11) DEFAULT '0' NOT NULL, |
3216 | deleted tinyint(4) DEFAULT '0' NOT NULL, |
3217 | type tinytext NOT NULL, |
3218 | - other_type tinyint(4) DEFAULT '0' NOT NULL, |
3219 | root tinytext NOT NULL, |
3220 | namespace text NOT NULL, |
3221 | class text NOT NULL, |
3222 | |
3223 | === modified file 'dlf/ext_tables_static+adt.sql' |
3224 | --- dlf/ext_tables_static+adt.sql 2012-04-30 16:05:21 +0000 |
3225 | +++ dlf/ext_tables_static+adt.sql 2012-08-17 07:00:27 +0000 |
3226 | @@ -9,7 +9,6 @@ |
3227 | cruser_id int(11) DEFAULT '0' NOT NULL, |
3228 | deleted tinyint(4) DEFAULT '0' NOT NULL, |
3229 | type tinytext NOT NULL, |
3230 | - other_type tinyint(4) DEFAULT '0' NOT NULL, |
3231 | root tinytext NOT NULL, |
3232 | namespace text NOT NULL, |
3233 | class text NOT NULL, |
3234 | @@ -18,4 +17,4 @@ |
3235 | KEY parent (pid) |
3236 | ); |
3237 | |
3238 | -INSERT INTO tx_dlf_formats VALUES ('1', '0', '0', '0', '0', '0', 'MODS', '0', 'mods', 'http://www.loc.gov/mods/v3', 'tx_dlf_mods'); |
3239 | +INSERT INTO tx_dlf_formats VALUES ('1', '0', '0', '0', '0', '0', 'MODS', 'mods', 'http://www.loc.gov/mods/v3', 'tx_dlf_mods'); |
3240 | |
3241 | === modified file 'dlf/hooks/class.tx_dlf_em.php' |
3242 | --- dlf/hooks/class.tx_dlf_em.php 2012-08-07 14:39:23 +0000 |
3243 | +++ dlf/hooks/class.tx_dlf_em.php 2012-08-17 07:00:27 +0000 |
3244 | @@ -84,10 +84,10 @@ |
3245 | $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores'; |
3246 | |
3247 | $context = stream_context_create(array ( |
3248 | - 'http' => array ( |
3249 | - 'method' => 'GET', |
3250 | - 'user_agent' => (!empty($conf['useragent']) ? $conf['useragent'] : ini_get('user_agent')) |
3251 | - ) |
3252 | + 'http' => array ( |
3253 | + 'method' => 'GET', |
3254 | + 'user_agent' => (!empty($conf['useragent']) ? $conf['useragent'] : ini_get('user_agent')) |
3255 | + ) |
3256 | )); |
3257 | |
3258 | // Try to connect to Solr server. |
3259 | @@ -101,11 +101,11 @@ |
3260 | if (is_array($status)) { |
3261 | |
3262 | $message = t3lib_div::makeInstance( |
3263 | - 't3lib_FlashMessage', |
3264 | - sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]), |
3265 | - $GLOBALS['LANG']->getLL('solr.connected'), |
3266 | - ($status[0] == 0 ? t3lib_FlashMessage::OK : t3lib_FlashMessage::WARNING), |
3267 | - FALSE |
3268 | + 't3lib_FlashMessage', |
3269 | + sprintf($GLOBALS['LANG']->getLL('solr.status'), (string) $status[0]), |
3270 | + $GLOBALS['LANG']->getLL('solr.connected'), |
3271 | + ($status[0] == 0 ? t3lib_FlashMessage::OK : t3lib_FlashMessage::WARNING), |
3272 | + FALSE |
3273 | ); |
3274 | |
3275 | $this->content .= $message->render(); |
3276 | @@ -117,11 +117,11 @@ |
3277 | } |
3278 | |
3279 | $message = t3lib_div::makeInstance( |
3280 | - 't3lib_FlashMessage', |
3281 | - sprintf($GLOBALS['LANG']->getLL('solr.error'), $url), |
3282 | - $GLOBALS['LANG']->getLL('solr.notConnected'), |
3283 | - t3lib_FlashMessage::WARNING, |
3284 | - FALSE |
3285 | + 't3lib_FlashMessage', |
3286 | + sprintf($GLOBALS['LANG']->getLL('solr.error'), $url), |
3287 | + $GLOBALS['LANG']->getLL('solr.notConnected'), |
3288 | + t3lib_FlashMessage::WARNING, |
3289 | + FALSE |
3290 | ); |
3291 | |
3292 | $this->content .= $message->render(); |
3293 | @@ -147,9 +147,9 @@ |
3294 | |
3295 | // Check if user "_cli_dlf" exists, is no admin and is not disabled. |
3296 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3297 | - 'uid,admin,usergroup', |
3298 | - 'be_users', |
3299 | - 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').t3lib_BEfunc::deleteClause('be_users') |
3300 | + 'uid,admin,usergroup', |
3301 | + 'be_users', |
3302 | + 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users').t3lib_BEfunc::deleteClause('be_users') |
3303 | ); |
3304 | |
3305 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
3306 | @@ -160,25 +160,25 @@ |
3307 | $resArray['usergroup'] = explode(',', $resArray['usergroup']); |
3308 | |
3309 | // Check if user is not disabled. |
3310 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3311 | - '1', |
3312 | - 'be_users', |
3313 | - 'uid='.intval($resArray['uid']).t3lib_BEfunc::BEenableFields('be_users') |
3314 | + $result2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3315 | + '1', |
3316 | + 'be_users', |
3317 | + 'uid='.intval($resArray['uid']).t3lib_BEfunc::BEenableFields('be_users') |
3318 | ); |
3319 | |
3320 | // Check if user is configured properly. |
3321 | if (count(array_diff(array ($groupUid), $resArray['usergroup'])) == 0 |
3322 | && !$resArray['admin'] |
3323 | - && $GLOBALS['TYPO3_DB']->sql_num_rows($_result) > 0) { |
3324 | + && $GLOBALS['TYPO3_DB']->sql_num_rows($result2) > 0) { |
3325 | |
3326 | $usrUid = $resArray['uid']; |
3327 | |
3328 | $message = t3lib_div::makeInstance( |
3329 | - 't3lib_FlashMessage', |
3330 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'), |
3331 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'), |
3332 | - t3lib_FlashMessage::OK, |
3333 | - FALSE |
3334 | + 't3lib_FlashMessage', |
3335 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkayMsg'), |
3336 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrOkay'), |
3337 | + t3lib_FlashMessage::OK, |
3338 | + FALSE |
3339 | ); |
3340 | |
3341 | } else { |
3342 | @@ -186,15 +186,15 @@ |
3343 | if (!$checkOnly && $groupUid) { |
3344 | |
3345 | // Keep exisiting values and add the new ones. |
3346 | - $_usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
3347 | + $usergroup = array_unique(array_merge(array ($groupUid), $resArray['usergroup'])); |
3348 | |
3349 | // Try to configure user. |
3350 | $data['be_users'][$resArray['uid']] = array ( |
3351 | - 'admin' => 0, |
3352 | - 'usergroup' => implode(',', $_usergroup), |
3353 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0, |
3354 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0, |
3355 | - $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0 |
3356 | + 'admin' => 0, |
3357 | + 'usergroup' => implode(',', $usergroup), |
3358 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['disabled'] => 0, |
3359 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['starttime'] => 0, |
3360 | + $GLOBALS['TCA']['be_users']['ctrl']['enablecolumns']['endtime'] => 0 |
3361 | ); |
3362 | |
3363 | tx_dlf_helper::processDB($data); |
3364 | @@ -205,33 +205,33 @@ |
3365 | $usrUid = $resArray['uid']; |
3366 | |
3367 | $message = t3lib_div::makeInstance( |
3368 | - 't3lib_FlashMessage', |
3369 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'), |
3370 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'), |
3371 | - t3lib_FlashMessage::INFO, |
3372 | - FALSE |
3373 | + 't3lib_FlashMessage', |
3374 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfiguredMsg'), |
3375 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrConfigured'), |
3376 | + t3lib_FlashMessage::INFO, |
3377 | + FALSE |
3378 | ); |
3379 | |
3380 | } else { |
3381 | |
3382 | $message = t3lib_div::makeInstance( |
3383 | - 't3lib_FlashMessage', |
3384 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
3385 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
3386 | - t3lib_FlashMessage::ERROR, |
3387 | - FALSE |
3388 | - ); |
3389 | - |
3390 | - } |
3391 | - |
3392 | - } else { |
3393 | - |
3394 | - $message = t3lib_div::makeInstance( |
3395 | 't3lib_FlashMessage', |
3396 | $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
3397 | $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
3398 | t3lib_FlashMessage::ERROR, |
3399 | FALSE |
3400 | + ); |
3401 | + |
3402 | + } |
3403 | + |
3404 | + } else { |
3405 | + |
3406 | + $message = t3lib_div::makeInstance( |
3407 | + 't3lib_FlashMessage', |
3408 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfiguredMsg'), |
3409 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotConfigured'), |
3410 | + t3lib_FlashMessage::ERROR, |
3411 | + FALSE |
3412 | ); |
3413 | |
3414 | } |
3415 | @@ -243,51 +243,51 @@ |
3416 | if (!$checkOnly && $groupUid) { |
3417 | |
3418 | // Try to create user. |
3419 | - $_tempUid = uniqid('NEW'); |
3420 | + $tempUid = uniqid('NEW'); |
3421 | |
3422 | - $data['be_users'][$_tempUid] = array ( |
3423 | - 'pid' => 0, |
3424 | - 'username' => '_cli_dlf', |
3425 | - 'password' => md5($_tempUid), |
3426 | - 'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'), |
3427 | - 'usergroup' => intval($groupUid) |
3428 | + $data['be_users'][$tempUid] = array ( |
3429 | + 'pid' => 0, |
3430 | + 'username' => '_cli_dlf', |
3431 | + 'password' => md5($tempUid), |
3432 | + 'realName' => $GLOBALS['LANG']->getLL('cliUserGroup.usrRealName'), |
3433 | + 'usergroup' => intval($groupUid) |
3434 | ); |
3435 | |
3436 | - $_substUid = tx_dlf_helper::processDB($data); |
3437 | + $substUid = tx_dlf_helper::processDB($data); |
3438 | |
3439 | // Check if creation was successful. |
3440 | - if (!empty($_substUid[$_tempUid])) { |
3441 | + if (!empty($substUid[$tempUid])) { |
3442 | |
3443 | - $usrUid = $_substUid[$_tempUid]; |
3444 | + $usrUid = $substUid[$tempUid]; |
3445 | |
3446 | $message = t3lib_div::makeInstance( |
3447 | - 't3lib_FlashMessage', |
3448 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'), |
3449 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'), |
3450 | - t3lib_FlashMessage::INFO, |
3451 | - FALSE |
3452 | + 't3lib_FlashMessage', |
3453 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreatedMsg'), |
3454 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrCreated'), |
3455 | + t3lib_FlashMessage::INFO, |
3456 | + FALSE |
3457 | ); |
3458 | |
3459 | } else { |
3460 | |
3461 | $message = t3lib_div::makeInstance( |
3462 | - 't3lib_FlashMessage', |
3463 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
3464 | - $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
3465 | - t3lib_FlashMessage::ERROR, |
3466 | - FALSE |
3467 | - ); |
3468 | - |
3469 | - } |
3470 | - |
3471 | - } else { |
3472 | - |
3473 | - $message = t3lib_div::makeInstance( |
3474 | 't3lib_FlashMessage', |
3475 | $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
3476 | $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
3477 | t3lib_FlashMessage::ERROR, |
3478 | FALSE |
3479 | + ); |
3480 | + |
3481 | + } |
3482 | + |
3483 | + } else { |
3484 | + |
3485 | + $message = t3lib_div::makeInstance( |
3486 | + 't3lib_FlashMessage', |
3487 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreatedMsg'), |
3488 | + $GLOBALS['LANG']->getLL('cliUserGroup.usrNotCreated'), |
3489 | + t3lib_FlashMessage::ERROR, |
3490 | + FALSE |
3491 | ); |
3492 | |
3493 | } |
3494 | @@ -319,21 +319,21 @@ |
3495 | if (empty($settings)) { |
3496 | |
3497 | $settings = array ( |
3498 | - 'non_exclude_fields' => array (), |
3499 | - 'tables_select' => array ( |
3500 | - 'tx_dlf_documents', |
3501 | - 'tx_dlf_collections', |
3502 | - 'tx_dlf_libraries', |
3503 | - 'tx_dlf_structures', |
3504 | - 'tx_dlf_metadata', |
3505 | - 'tx_dlf_formats', |
3506 | - 'tx_dlf_solrcores' |
3507 | - ), |
3508 | - 'tables_modify' => array ( |
3509 | - 'tx_dlf_documents', |
3510 | - 'tx_dlf_collections', |
3511 | - 'tx_dlf_libraries' |
3512 | - ) |
3513 | + 'non_exclude_fields' => array (), |
3514 | + 'tables_select' => array ( |
3515 | + 'tx_dlf_documents', |
3516 | + 'tx_dlf_collections', |
3517 | + 'tx_dlf_libraries', |
3518 | + 'tx_dlf_structures', |
3519 | + 'tx_dlf_metadata', |
3520 | + 'tx_dlf_formats', |
3521 | + 'tx_dlf_solrcores' |
3522 | + ), |
3523 | + 'tables_modify' => array ( |
3524 | + 'tx_dlf_documents', |
3525 | + 'tx_dlf_collections', |
3526 | + 'tx_dlf_libraries' |
3527 | + ) |
3528 | ); |
3529 | |
3530 | // Set allowed exclude fields. |
3531 | @@ -357,9 +357,9 @@ |
3532 | |
3533 | // Check if group "_cli_dlf" exists and is not disabled. |
3534 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3535 | - 'uid,non_exclude_fields,tables_select,tables_modify,inc_access_lists,'.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
3536 | - 'be_groups', |
3537 | - 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').t3lib_BEfunc::deleteClause('be_groups') |
3538 | + 'uid,non_exclude_fields,tables_select,tables_modify,inc_access_lists,'.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'], |
3539 | + 'be_groups', |
3540 | + 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').t3lib_BEfunc::deleteClause('be_groups') |
3541 | ); |
3542 | |
3543 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
3544 | @@ -383,11 +383,11 @@ |
3545 | $grpUid = $resArray['uid']; |
3546 | |
3547 | $message = t3lib_div::makeInstance( |
3548 | - 't3lib_FlashMessage', |
3549 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'), |
3550 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'), |
3551 | - t3lib_FlashMessage::OK, |
3552 | - FALSE |
3553 | + 't3lib_FlashMessage', |
3554 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkayMsg'), |
3555 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpOkay'), |
3556 | + t3lib_FlashMessage::OK, |
3557 | + FALSE |
3558 | ); |
3559 | |
3560 | } else { |
3561 | @@ -395,19 +395,19 @@ |
3562 | if (!$checkOnly) { |
3563 | |
3564 | // Keep exisiting values and add the new ones. |
3565 | - $_non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields'])); |
3566 | - |
3567 | - $_tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select'])); |
3568 | - |
3569 | - $_tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
3570 | + $non_exclude_fields = array_unique(array_merge($settings['non_exclude_fields'], $resArray['non_exclude_fields'])); |
3571 | + |
3572 | + $tables_select = array_unique(array_merge($settings['tables_select'], $resArray['tables_select'])); |
3573 | + |
3574 | + $tables_modify = array_unique(array_merge($settings['tables_modify'], $resArray['tables_modify'])); |
3575 | |
3576 | // Try to configure usergroup. |
3577 | $data['be_groups'][$resArray['uid']] = array ( |
3578 | - 'non_exclude_fields' => implode(',', $_non_exclude_fields), |
3579 | - 'tables_select' => implode(',', $_tables_select), |
3580 | - 'tables_modify' => implode(',', $_tables_modify), |
3581 | - 'inc_access_lists' => 1, |
3582 | - $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0 |
3583 | + 'non_exclude_fields' => implode(',', $non_exclude_fields), |
3584 | + 'tables_select' => implode(',', $tables_select), |
3585 | + 'tables_modify' => implode(',', $tables_modify), |
3586 | + 'inc_access_lists' => 1, |
3587 | + $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] => 0 |
3588 | ); |
3589 | |
3590 | tx_dlf_helper::processDB($data); |
3591 | @@ -418,33 +418,33 @@ |
3592 | $grpUid = $resArray['uid']; |
3593 | |
3594 | $message = t3lib_div::makeInstance( |
3595 | - 't3lib_FlashMessage', |
3596 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'), |
3597 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'), |
3598 | - t3lib_FlashMessage::INFO, |
3599 | - FALSE |
3600 | + 't3lib_FlashMessage', |
3601 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfiguredMsg'), |
3602 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpConfigured'), |
3603 | + t3lib_FlashMessage::INFO, |
3604 | + FALSE |
3605 | ); |
3606 | |
3607 | } else { |
3608 | |
3609 | $message = t3lib_div::makeInstance( |
3610 | - 't3lib_FlashMessage', |
3611 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
3612 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
3613 | - t3lib_FlashMessage::ERROR, |
3614 | - FALSE |
3615 | - ); |
3616 | - |
3617 | - } |
3618 | - |
3619 | - } else { |
3620 | - |
3621 | - $message = t3lib_div::makeInstance( |
3622 | 't3lib_FlashMessage', |
3623 | $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
3624 | $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
3625 | t3lib_FlashMessage::ERROR, |
3626 | FALSE |
3627 | + ); |
3628 | + |
3629 | + } |
3630 | + |
3631 | + } else { |
3632 | + |
3633 | + $message = t3lib_div::makeInstance( |
3634 | + 't3lib_FlashMessage', |
3635 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfiguredMsg'), |
3636 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotConfigured'), |
3637 | + t3lib_FlashMessage::ERROR, |
3638 | + FALSE |
3639 | ); |
3640 | |
3641 | } |
3642 | @@ -456,53 +456,53 @@ |
3643 | if (!$checkOnly) { |
3644 | |
3645 | // Try to create usergroup. |
3646 | - $_tempUid = uniqid('NEW'); |
3647 | + $tempUid = uniqid('NEW'); |
3648 | |
3649 | - $data['be_groups'][$_tempUid] = array ( |
3650 | - 'pid' => 0, |
3651 | - 'title' => '_cli_dlf', |
3652 | - 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
3653 | - 'non_exclude_fields' => implode(',', $settings['non_exclude_fields']), |
3654 | - 'tables_select' => implode(',', $settings['tables_select']), |
3655 | - 'tables_modify' => implode(',', $settings['tables_modify']), |
3656 | - 'inc_access_lists' => 1 |
3657 | + $data['be_groups'][$tempUid] = array ( |
3658 | + 'pid' => 0, |
3659 | + 'title' => '_cli_dlf', |
3660 | + 'description' => $GLOBALS['LANG']->getLL('cliUserGroup.grpDescription'), |
3661 | + 'non_exclude_fields' => implode(',', $settings['non_exclude_fields']), |
3662 | + 'tables_select' => implode(',', $settings['tables_select']), |
3663 | + 'tables_modify' => implode(',', $settings['tables_modify']), |
3664 | + 'inc_access_lists' => 1 |
3665 | ); |
3666 | |
3667 | - $_substUid = tx_dlf_helper::processDB($data); |
3668 | + $substUid = tx_dlf_helper::processDB($data); |
3669 | |
3670 | // Check if creation was successful. |
3671 | - if (!empty($_substUid[$_tempUid])) { |
3672 | + if (!empty($substUid[$tempUid])) { |
3673 | |
3674 | - $grpUid = $_substUid[$_tempUid]; |
3675 | + $grpUid = $substUid[$tempUid]; |
3676 | |
3677 | $message = t3lib_div::makeInstance( |
3678 | - 't3lib_FlashMessage', |
3679 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'), |
3680 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'), |
3681 | - t3lib_FlashMessage::INFO, |
3682 | - FALSE |
3683 | + 't3lib_FlashMessage', |
3684 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreatedMsg'), |
3685 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpCreated'), |
3686 | + t3lib_FlashMessage::INFO, |
3687 | + FALSE |
3688 | ); |
3689 | |
3690 | } else { |
3691 | |
3692 | $message = t3lib_div::makeInstance( |
3693 | - 't3lib_FlashMessage', |
3694 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
3695 | - $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
3696 | - t3lib_FlashMessage::ERROR, |
3697 | - FALSE |
3698 | - ); |
3699 | - |
3700 | - } |
3701 | - |
3702 | - } else { |
3703 | - |
3704 | - $message = t3lib_div::makeInstance( |
3705 | 't3lib_FlashMessage', |
3706 | $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
3707 | $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
3708 | t3lib_FlashMessage::ERROR, |
3709 | FALSE |
3710 | + ); |
3711 | + |
3712 | + } |
3713 | + |
3714 | + } else { |
3715 | + |
3716 | + $message = t3lib_div::makeInstance( |
3717 | + 't3lib_FlashMessage', |
3718 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreatedMsg'), |
3719 | + $GLOBALS['LANG']->getLL('cliUserGroup.grpNotCreated'), |
3720 | + t3lib_FlashMessage::ERROR, |
3721 | + FALSE |
3722 | ); |
3723 | |
3724 | } |
3725 | @@ -549,21 +549,21 @@ |
3726 | if (is_executable(PATH_typo3.'cli_dispatch.phpsh')) { |
3727 | |
3728 | $message = t3lib_div::makeInstance( |
3729 | - 't3lib_FlashMessage', |
3730 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'), |
3731 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'), |
3732 | - t3lib_FlashMessage::OK, |
3733 | - FALSE |
3734 | + 't3lib_FlashMessage', |
3735 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkayMsg'), |
3736 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliOkay'), |
3737 | + t3lib_FlashMessage::OK, |
3738 | + FALSE |
3739 | ); |
3740 | |
3741 | } else { |
3742 | |
3743 | $message = t3lib_div::makeInstance( |
3744 | - 't3lib_FlashMessage', |
3745 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'), |
3746 | - $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'), |
3747 | - t3lib_FlashMessage::ERROR, |
3748 | - FALSE |
3749 | + 't3lib_FlashMessage', |
3750 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkayMsg'), |
3751 | + $GLOBALS['LANG']->getLL('cliUserGroup.cliNotOkay'), |
3752 | + t3lib_FlashMessage::ERROR, |
3753 | + FALSE |
3754 | ); |
3755 | |
3756 | } |
3757 | |
3758 | === modified file 'dlf/hooks/class.tx_dlf_hacks.php' |
3759 | --- dlf/hooks/class.tx_dlf_hacks.php 2012-08-07 14:39:23 +0000 |
3760 | +++ dlf/hooks/class.tx_dlf_hacks.php 2012-08-17 07:00:27 +0000 |
3761 | @@ -55,23 +55,23 @@ |
3762 | |
3763 | $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
3764 | |
3765 | - if (($_divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]'))) { |
3766 | - |
3767 | - $_smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
3768 | - |
3769 | - if ($_smLinks) { |
3770 | - |
3771 | - foreach ($_smLinks as $_smLink) { |
3772 | - |
3773 | - $_links[(string) $_smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $_smLink->attributes('http://www.w3.org/1999/xlink')->to; |
3774 | + if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]'))) { |
3775 | + |
3776 | + $smLinks = $xml->xpath('//mets:structLink/mets:smLink'); |
3777 | + |
3778 | + if ($smLinks) { |
3779 | + |
3780 | + foreach ($smLinks as $smLink) { |
3781 | + |
3782 | + $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; |
3783 | |
3784 | } |
3785 | |
3786 | - foreach ($_divs as $_div) { |
3787 | - |
3788 | - if (!empty($_links[(string) $_div['ID']])) { |
3789 | - |
3790 | - $_id = (string) $_div['DMDID']; |
3791 | + foreach ($divs as $div) { |
3792 | + |
3793 | + if (!empty($links[(string) $div['ID']])) { |
3794 | + |
3795 | + $id = (string) $div['DMDID']; |
3796 | |
3797 | break; |
3798 | |
3799 | @@ -81,17 +81,17 @@ |
3800 | |
3801 | } |
3802 | |
3803 | - if (empty($_id)) { |
3804 | + if (empty($id)) { |
3805 | |
3806 | - $_id = (string) $_divs[0]['DMDID']; |
3807 | + $id = (string) $divs[0]['DMDID']; |
3808 | |
3809 | } |
3810 | |
3811 | - $_recordId = $xml->xpath('//mets:dmdSec[@ID="'.$_id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
3812 | - |
3813 | - if (!empty($_recordId[0])) { |
3814 | - |
3815 | - return (string) $_recordId[0]; |
3816 | + $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); |
3817 | + |
3818 | + if (!empty($recordIds[0])) { |
3819 | + |
3820 | + return (string) $recordIds[0]; |
3821 | |
3822 | } |
3823 | |
3824 | |
3825 | === modified file 'dlf/hooks/class.tx_dlf_tceforms.php' |
3826 | --- dlf/hooks/class.tx_dlf_tceforms.php 2012-08-07 14:39:23 +0000 |
3827 | +++ dlf/hooks/class.tx_dlf_tceforms.php 2012-08-17 07:00:27 +0000 |
3828 | @@ -59,21 +59,21 @@ |
3829 | // i.e. instead of "18" it reads "pages_18|Title" |
3830 | if (!t3lib_div::testInt($pages)) { |
3831 | |
3832 | - $_parts = explode('|', $pages); |
3833 | + $parts = explode('|', $pages); |
3834 | |
3835 | - $pages = array_pop(explode('_', $_parts[0])); |
3836 | + $pages = array_pop(explode('_', $parts[0])); |
3837 | |
3838 | } |
3839 | |
3840 | if ($pages > 0) { |
3841 | |
3842 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3843 | - 'label,uid', |
3844 | - 'tx_dlf_collections', |
3845 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
3846 | - '', |
3847 | - 'label', |
3848 | - '' |
3849 | + 'label,uid', |
3850 | + 'tx_dlf_collections', |
3851 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), |
3852 | + '', |
3853 | + 'label', |
3854 | + '' |
3855 | ); |
3856 | |
3857 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
3858 | @@ -114,21 +114,21 @@ |
3859 | // i.e. instead of "18" it reads "pages_18|Title" |
3860 | if (!t3lib_div::testInt($pages)) { |
3861 | |
3862 | - $_parts = explode('|', $pages); |
3863 | + $parts = explode('|', $pages); |
3864 | |
3865 | - $pages = array_pop(explode('_', $_parts[0])); |
3866 | + $pages = array_pop(explode('_', $parts[0])); |
3867 | |
3868 | } |
3869 | |
3870 | if ($pages > 0) { |
3871 | |
3872 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3873 | - 'label,uid', |
3874 | - 'tx_dlf_libraries', |
3875 | - 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
3876 | - '', |
3877 | - 'label', |
3878 | - '' |
3879 | + 'label,uid', |
3880 | + 'tx_dlf_libraries', |
3881 | + 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), |
3882 | + '', |
3883 | + 'label', |
3884 | + '' |
3885 | ); |
3886 | |
3887 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
3888 | @@ -169,21 +169,21 @@ |
3889 | // i.e. instead of "18" it reads "pages_18|Title" |
3890 | if (!t3lib_div::testInt($pages)) { |
3891 | |
3892 | - $_parts = explode('|', $pages); |
3893 | + $parts = explode('|', $pages); |
3894 | |
3895 | - $pages = array_pop(explode('_', $_parts[0])); |
3896 | + $pages = array_pop(explode('_', $parts[0])); |
3897 | |
3898 | } |
3899 | |
3900 | if ($pages > 0) { |
3901 | |
3902 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3903 | - 'label,uid', |
3904 | - 'tx_dlf_solrcores', |
3905 | - 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
3906 | - '', |
3907 | - 'label', |
3908 | - '' |
3909 | + 'label,uid', |
3910 | + 'tx_dlf_solrcores', |
3911 | + 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
3912 | + '', |
3913 | + 'label', |
3914 | + '' |
3915 | ); |
3916 | |
3917 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
3918 | |
3919 | === modified file 'dlf/hooks/class.tx_dlf_tcemain.php' |
3920 | --- dlf/hooks/class.tx_dlf_tcemain.php 2012-08-07 14:39:23 +0000 |
3921 | +++ dlf/hooks/class.tx_dlf_tcemain.php 2012-08-17 07:00:27 +0000 |
3922 | @@ -59,37 +59,13 @@ |
3923 | // Field post-processing for table "tx_dlf_documents". |
3924 | case 'tx_dlf_documents': |
3925 | |
3926 | - // Set sorting fields if empty. |
3927 | + // Set sorting field if empty. |
3928 | if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { |
3929 | |
3930 | $fieldArray['title_sorting'] = $fieldArray['title']; |
3931 | |
3932 | } |
3933 | |
3934 | - if (empty($fieldArray['author_sorting']) && !empty($fieldArray['author'])) { |
3935 | - |
3936 | - $fieldArray['author_sorting'] = $fieldArray['author']; |
3937 | - |
3938 | - } |
3939 | - |
3940 | - if (empty($fieldArray['year_sorting']) && !empty($fieldArray['year'])) { |
3941 | - |
3942 | - $fieldArray['year_sorting'] = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $fieldArray['year'])); |
3943 | - |
3944 | - if (strpos($fieldArray['year_sorting'], '.') || strlen($fieldArray['year_sorting']) < 3) { |
3945 | - |
3946 | - $fieldArray['year_sorting'] = ((intval(trim($fieldArray['year_sorting'], '.')) - 1) * 100) + 50; |
3947 | - |
3948 | - } |
3949 | - |
3950 | - } |
3951 | - |
3952 | - if (empty($fieldArray['place_sorting']) && !empty($fieldArray['place'])) { |
3953 | - |
3954 | - $fieldArray['place_sorting'] = preg_replace('/[[:punct:]]/', '', (string) $fieldArray['place']); |
3955 | - |
3956 | - } |
3957 | - |
3958 | break; |
3959 | |
3960 | // Field post-processing for tables "tx_dlf_collections", "tx_dlf_libraries", "tx_dlf_metadata" and "tx_dlf_structures". |
3961 | @@ -119,12 +95,12 @@ |
3962 | |
3963 | // Get number of existing cores. |
3964 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
3965 | - '*', |
3966 | - 'tx_dlf_solrcores', |
3967 | - '', |
3968 | - '', |
3969 | - '', |
3970 | - '' |
3971 | + '*', |
3972 | + 'tx_dlf_solrcores', |
3973 | + '', |
3974 | + '', |
3975 | + '', |
3976 | + '' |
3977 | ); |
3978 | |
3979 | // Get first unused core number. |
3980 | @@ -155,10 +131,10 @@ |
3981 | $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; |
3982 | |
3983 | $context = stream_context_create(array ( |
3984 | - 'http' => array ( |
3985 | - 'method' => 'GET', |
3986 | - 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
3987 | - ) |
3988 | + 'http' => array ( |
3989 | + 'method' => 'GET', |
3990 | + 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) |
3991 | + ) |
3992 | )); |
3993 | |
3994 | $response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); |
3995 | @@ -178,7 +154,11 @@ |
3996 | |
3997 | } |
3998 | |
3999 | - trigger_error('Could not create new Solr core "dlfCore'.$coreNumber.'"', E_USER_WARNING); |
4000 | + if (TYPO3_DLOG) { |
4001 | + |
4002 | + t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Could not create new Apache Solr core "dlfCore'.$coreNumber.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
4003 | + |
4004 | + } |
4005 | |
4006 | $fieldArray = NULL; |
4007 | |
4008 | @@ -206,12 +186,12 @@ |
4009 | |
4010 | // Get current index name. |
4011 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4012 | - $table.'.index_name AS index_name', |
4013 | - $table, |
4014 | - $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
4015 | - '', |
4016 | - '', |
4017 | - '1' |
4018 | + $table.'.index_name AS index_name', |
4019 | + $table, |
4020 | + $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), |
4021 | + '', |
4022 | + '', |
4023 | + '1' |
4024 | ); |
4025 | |
4026 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
4027 | @@ -225,7 +205,11 @@ |
4028 | |
4029 | } |
4030 | |
4031 | - trigger_error('Prevented change of "index_name" for UID '.intval($id).' in table "'.htmlspecialchars($table).'"', E_USER_NOTICE); |
4032 | + if (TYPO3_DLOG) { |
4033 | + |
4034 | + t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_postProcessFieldArray('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Prevented change of "index_name" for UID "'.$id.'" in table "'.$table.'"', $this->extKey, SYSLOG_SEVERITY_NOTICE, $fieldArray); |
4035 | + |
4036 | + } |
4037 | |
4038 | } |
4039 | |
4040 | @@ -252,7 +236,7 @@ |
4041 | */ |
4042 | public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { |
4043 | |
4044 | - if ($status == "update") { |
4045 | + if ($status == 'update') { |
4046 | |
4047 | switch ($table) { |
4048 | |
4049 | @@ -264,12 +248,12 @@ |
4050 | |
4051 | // Get Solr core. |
4052 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4053 | - 'tx_dlf_solrcores.uid', |
4054 | - 'tx_dlf_solrcores,tx_dlf_documents', |
4055 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4056 | - '', |
4057 | - '', |
4058 | - '1' |
4059 | + 'tx_dlf_solrcores.uid', |
4060 | + 'tx_dlf_solrcores,tx_dlf_documents', |
4061 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4062 | + '', |
4063 | + '', |
4064 | + '1' |
4065 | ); |
4066 | |
4067 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
4068 | @@ -299,7 +283,11 @@ |
4069 | |
4070 | } else { |
4071 | |
4072 | - trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING); |
4073 | + if (TYPO3_DLOG) { |
4074 | + |
4075 | + t3lib_div::devLog('[tx_dlf_tcemain->processDatamap_afterDatabaseOperations('.$status.', '.$table.', '.$id.', [data], ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR, $fieldArray); |
4076 | + |
4077 | + } |
4078 | |
4079 | } |
4080 | |
4081 | @@ -336,12 +324,12 @@ |
4082 | |
4083 | // Get Solr core. |
4084 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4085 | - 'tx_dlf_solrcores.uid', |
4086 | - 'tx_dlf_solrcores,tx_dlf_documents', |
4087 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4088 | - '', |
4089 | - '', |
4090 | - '1' |
4091 | + 'tx_dlf_solrcores.uid', |
4092 | + 'tx_dlf_solrcores,tx_dlf_documents', |
4093 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4094 | + '', |
4095 | + '', |
4096 | + '1' |
4097 | ); |
4098 | |
4099 | if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
4100 | @@ -380,7 +368,11 @@ |
4101 | |
4102 | } else { |
4103 | |
4104 | - trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING); |
4105 | + if (TYPO3_DLOG) { |
4106 | + |
4107 | + t3lib_div::devLog('[tx_dlf_tcemain->processCmdmap_postProcess('.$command.', '.$table.', '.$id.', '.$value.', ['.get_class($pObj).'])] Failed to re-index document with UID "'.$id.'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
4108 | + |
4109 | + } |
4110 | |
4111 | } |
4112 | |
4113 | |
4114 | === modified file 'dlf/locallang.xml' |
4115 | --- dlf/locallang.xml 2012-08-09 10:31:57 +0000 |
4116 | +++ dlf/locallang.xml 2012-08-17 07:00:27 +0000 |
4117 | @@ -64,7 +64,6 @@ |
4118 | <label index="tx_dlf_metadata.tab3">Access</label> |
4119 | <label index="tx_dlf_formats">Data Formats</label> |
4120 | <label index="tx_dlf_formats.type">METS Name</label> |
4121 | - <label index="tx_dlf_formats.other_type">Is it @MDTYPE="OTHER" in METS?</label> |
4122 | <label index="tx_dlf_formats.root">Root Element</label> |
4123 | <label index="tx_dlf_formats.namespace">Namespace URI</label> |
4124 | <label index="tx_dlf_formats.class">Class Name</label> |
4125 | @@ -219,7 +218,6 @@ |
4126 | <label index="tx_dlf_metadata.tab3">Zugriff</label> |
4127 | <label index="tx_dlf_formats">Datenformate</label> |
4128 | <label index="tx_dlf_formats.type">Bezeichnung in METS</label> |
4129 | - <label index="tx_dlf_formats.other_type">@MDTYPE="OTHER" in METS?</label> |
4130 | <label index="tx_dlf_formats.root">Root-Element</label> |
4131 | <label index="tx_dlf_formats.namespace">Namensraum URI</label> |
4132 | <label index="tx_dlf_formats.class">Klassenname</label> |
4133 | |
4134 | === modified file 'dlf/modules/indexing/index.php' |
4135 | --- dlf/modules/indexing/index.php 2012-07-13 07:54:25 +0000 |
4136 | +++ dlf/modules/indexing/index.php 2012-08-17 07:00:27 +0000 |
4137 | @@ -70,7 +70,7 @@ |
4138 | $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4139 | 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
4140 | 'tx_dlf_solrcores', |
4141 | - '1=1'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4142 | + 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4143 | '', |
4144 | '', |
4145 | '' |
4146 | @@ -134,7 +134,7 @@ |
4147 | $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4148 | 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
4149 | 'tx_dlf_solrcores', |
4150 | - '1=1'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4151 | + 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
4152 | '', |
4153 | '', |
4154 | '' |
4155 | |
4156 | === modified file 'dlf/modules/newclient/index.php' |
4157 | --- dlf/modules/newclient/index.php 2012-08-07 14:39:23 +0000 |
4158 | +++ dlf/modules/newclient/index.php 2012-08-17 07:00:27 +0000 |
4159 | @@ -127,6 +127,7 @@ |
4160 | 'is_sortable' => $values['is_sortable'], |
4161 | 'is_facet' => $values['is_facet'], |
4162 | 'is_listed' => $values['is_listed'], |
4163 | + 'autocomplete' => $value['autocomplete'], |
4164 | ); |
4165 | |
4166 | } |
4167 | |
4168 | === modified file 'dlf/modules/newclient/metadata.inc.php' |
4169 | --- dlf/modules/newclient/metadata.inc.php 2012-08-07 14:39:23 +0000 |
4170 | +++ dlf/modules/newclient/metadata.inc.php 2012-08-17 07:00:27 +0000 |
4171 | @@ -39,6 +39,7 @@ |
4172 | 'is_sortable' => 0, |
4173 | 'is_facet' => 0, |
4174 | 'is_listed' => 0, |
4175 | + 'autocomplete' => 0, |
4176 | ), |
4177 | 'record_id' => array ( |
4178 | 'encoded' => 1, |
4179 | @@ -53,6 +54,7 @@ |
4180 | 'is_sortable' => 0, |
4181 | 'is_facet' => 0, |
4182 | 'is_listed' => 0, |
4183 | + 'autocomplete' => 0, |
4184 | ), |
4185 | 'union_id' => array ( |
4186 | 'encoded' => 1, |
4187 | @@ -67,6 +69,7 @@ |
4188 | 'is_sortable' => 0, |
4189 | 'is_facet' => 0, |
4190 | 'is_listed' => 0, |
4191 | + 'autocomplete' => 0, |
4192 | ), |
4193 | 'opac_id' => array ( |
4194 | 'encoded' => 1, |
4195 | @@ -81,13 +84,14 @@ |
4196 | 'is_sortable' => 0, |
4197 | 'is_facet' => 0, |
4198 | 'is_listed' => 0, |
4199 | + 'autocomplete' => 0, |
4200 | ), |
4201 | 'urn' => array ( |
4202 | 'encoded' => 1, |
4203 | 'xpath' => './mods:identifier[@type="urn"]', |
4204 | 'xpath_sorting' => '', |
4205 | 'default_value' => '', |
4206 | - 'wrap' => "key.wrap = <dt>|</dt>\nvalue.setContentToCurrent = 1\nvalue.required = 1\nvalue.typolink.parameter.current = 1\nvalue.typolink.parameter.prepend = TEXT\nvalue.typolink.parameter.prepend.value = http://nbn-resolving.de/\nvalue.wrap = <dd>|</dd>", |
4207 | + 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.typolink.parameter.prepend = TEXT\nvalue.typolink.parameter.prepend.value = http://nbn-resolving.de/\nvalue.wrap = <dd>|</dd>", |
4208 | 'tokenized' => 0, |
4209 | 'stored' => 0, |
4210 | 'indexed' => 1, |
4211 | @@ -95,13 +99,14 @@ |
4212 | 'is_sortable' => 0, |
4213 | 'is_facet' => 0, |
4214 | 'is_listed' => 0, |
4215 | + 'autocomplete' => 0, |
4216 | ), |
4217 | 'purl' => array ( |
4218 | 'encoded' => 1, |
4219 | 'xpath' => './mods:identifier[@type="purl"]', |
4220 | 'xpath_sorting' => '', |
4221 | 'default_value' => '', |
4222 | - 'wrap' => "key.wrap = <dt>|</dt>\nvalue.setContentToCurrent = 1\nvalue.required = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>", |
4223 | + 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>", |
4224 | 'tokenized' => 0, |
4225 | 'stored' => 0, |
4226 | 'indexed' => 0, |
4227 | @@ -109,6 +114,7 @@ |
4228 | 'is_sortable' => 0, |
4229 | 'is_facet' => 0, |
4230 | 'is_listed' => 0, |
4231 | + 'autocomplete' => 0, |
4232 | ), |
4233 | 'owner' => array ( |
4234 | 'encoded' => 1, |
4235 | @@ -123,6 +129,7 @@ |
4236 | 'is_sortable' => 0, |
4237 | 'is_facet' => 1, |
4238 | 'is_listed' => 0, |
4239 | + 'autocomplete' => 0, |
4240 | ), |
4241 | 'collection' => array ( |
4242 | 'encoded' => 1, |
4243 | @@ -137,6 +144,7 @@ |
4244 | 'is_sortable' => 0, |
4245 | 'is_facet' => 1, |
4246 | 'is_listed' => 0, |
4247 | + 'autocomplete' => 0, |
4248 | ), |
4249 | 'language' => array ( |
4250 | 'encoded' => 1, |
4251 | @@ -151,6 +159,7 @@ |
4252 | 'is_sortable' => 0, |
4253 | 'is_facet' => 1, |
4254 | 'is_listed' => 0, |
4255 | + 'autocomplete' => 0, |
4256 | ), |
4257 | 'year' => array ( |
4258 | 'encoded' => 1, |
4259 | @@ -165,6 +174,7 @@ |
4260 | 'is_sortable' => 1, |
4261 | 'is_facet' => 1, |
4262 | 'is_listed' => 1, |
4263 | + 'autocomplete' => 0, |
4264 | ), |
4265 | 'place' => array ( |
4266 | 'encoded' => 1, |
4267 | @@ -179,6 +189,7 @@ |
4268 | 'is_sortable' => 1, |
4269 | 'is_facet' => 1, |
4270 | 'is_listed' => 1, |
4271 | + 'autocomplete' => 0, |
4272 | ), |
4273 | 'author' => array ( |
4274 | 'encoded' => 1, |
4275 | @@ -193,6 +204,7 @@ |
4276 | 'is_sortable' => 1, |
4277 | 'is_facet' => 1, |
4278 | 'is_listed' => 1, |
4279 | + 'autocomplete' => 1, |
4280 | ), |
4281 | 'volume' => array ( |
4282 | 'encoded' => 1, |
4283 | @@ -207,6 +219,7 @@ |
4284 | 'is_sortable' => 1, |
4285 | 'is_facet' => 0, |
4286 | 'is_listed' => 1, |
4287 | + 'autocomplete' => 0, |
4288 | ), |
4289 | 'title' => array ( |
4290 | 'encoded' => 1, |
4291 | @@ -221,13 +234,14 @@ |
4292 | 'is_sortable' => 1, |
4293 | 'is_facet' => 0, |
4294 | 'is_listed' => 1, |
4295 | + 'autocomplete' => 1, |
4296 | ), |
4297 | 'type' => array ( |
4298 | 'encoded' => 0, |
4299 | 'xpath' => '', |
4300 | 'xpath_sorting' => '', |
4301 | 'default_value' => '', |
4302 | - 'wrap' => "key.wrap = <dt class=\"tx-dlf-metadata-type\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-type\">|</dd>", |
4303 | + 'wrap' => '', |
4304 | 'tokenized' => 0, |
4305 | 'stored' => 1, |
4306 | 'indexed' => 0, |
4307 | @@ -235,6 +249,7 @@ |
4308 | 'is_sortable' => 1, |
4309 | 'is_facet' => 1, |
4310 | 'is_listed' => 1, |
4311 | + 'autocomplete' => 0, |
4312 | ) |
4313 | ); |
4314 | |
4315 | |
4316 | === modified file 'dlf/plugins/collection/class.tx_dlf_collection.php' |
4317 | --- dlf/plugins/collection/class.tx_dlf_collection.php 2012-08-07 14:42:49 +0000 |
4318 | +++ dlf/plugins/collection/class.tx_dlf_collection.php 2012-08-17 07:00:27 +0000 |
4319 | @@ -56,7 +56,11 @@ |
4320 | // Quit without doing anything if required configuration variables are not set. |
4321 | if (empty($this->conf['pages'])) { |
4322 | |
4323 | - trigger_error('Incomplete configuration for plugin '.get_class($this), E_USER_NOTICE); |
4324 | + if (TYPO3_DLOG) { |
4325 | + |
4326 | + t3lib_div::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
4327 | + |
4328 | + } |
4329 | |
4330 | return $content; |
4331 | |
4332 | @@ -201,9 +205,9 @@ |
4333 | // Add feed link if applicable. |
4334 | if (!empty($this->conf['targetFeed'])) { |
4335 | |
4336 | - $_img = '<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />'; |
4337 | + $img = '<img src="'.t3lib_extMgm::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />'; |
4338 | |
4339 | - $markerArray[$resArray['uid']]['###FEED###'] = $this->pi_linkTP($_img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']); |
4340 | + $markerArray[$resArray['uid']]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']); |
4341 | |
4342 | } else { |
4343 | |
4344 | @@ -215,21 +219,21 @@ |
4345 | $markerArray[$resArray['uid']]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']); |
4346 | |
4347 | // Build statistic's output. |
4348 | - $_labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE); |
4349 | - |
4350 | - $markerArray[$resArray['uid']]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$_labelTitles); |
4351 | - |
4352 | - $_labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE); |
4353 | - |
4354 | - $markerArray[$resArray['uid']]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$_labelVolumes); |
4355 | + $labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE); |
4356 | + |
4357 | + $markerArray[$resArray['uid']]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles); |
4358 | + |
4359 | + $labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE); |
4360 | + |
4361 | + $markerArray[$resArray['uid']]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes); |
4362 | |
4363 | } |
4364 | |
4365 | $entry = $this->cObj->getSubpart($this->template, '###ENTRY###'); |
4366 | |
4367 | - foreach ($markerArray as $_markerArray) { |
4368 | + foreach ($markerArray as $marker) { |
4369 | |
4370 | - $content .= $this->cObj->substituteMarkerArray($entry, $_markerArray); |
4371 | + $content .= $this->cObj->substituteMarkerArray($entry, $marker); |
4372 | |
4373 | } |
4374 | |
4375 | @@ -271,9 +275,9 @@ |
4376 | // Process results. |
4377 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
4378 | |
4379 | - if (empty($_metadata)) { |
4380 | + if (empty($listMetadata)) { |
4381 | |
4382 | - $_metadata = array ( |
4383 | + $listMetadata = array ( |
4384 | 'label' => htmlspecialchars($resArray['collLabel']), |
4385 | 'description' => $this->pi_RTEcssText($resArray['collDesc']), |
4386 | 'options' => array ( |
4387 | @@ -379,7 +383,7 @@ |
4388 | |
4389 | $list->add(array_values($toplevel)); |
4390 | |
4391 | - $list->metadata = $_metadata; |
4392 | + $list->metadata = $listMetadata; |
4393 | |
4394 | $list->save(); |
4395 | |
4396 | |
4397 | === modified file 'dlf/plugins/feeds/class.tx_dlf_feeds.php' |
4398 | --- dlf/plugins/feeds/class.tx_dlf_feeds.php 2012-03-24 09:05:28 +0000 |
4399 | +++ dlf/plugins/feeds/class.tx_dlf_feeds.php 2012-08-17 07:00:27 +0000 |
4400 | @@ -77,7 +77,7 @@ |
4401 | |
4402 | } |
4403 | |
4404 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4405 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4406 | 'tx_dlf_libraries.label AS label', |
4407 | 'tx_dlf_libraries', |
4408 | 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), |
4409 | @@ -86,11 +86,11 @@ |
4410 | '1' |
4411 | ); |
4412 | |
4413 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($_result)) { |
4414 | - |
4415 | - $_resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result); |
4416 | - |
4417 | - $channel->appendChild($rss->createElement('copyright', htmlspecialchars($_resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
4418 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
4419 | + |
4420 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
4421 | + |
4422 | + $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); |
4423 | |
4424 | } |
4425 | |
4426 | |
4427 | === modified file 'dlf/plugins/listview/class.tx_dlf_listview.php' |
4428 | --- dlf/plugins/listview/class.tx_dlf_listview.php 2012-08-07 15:30:34 +0000 |
4429 | +++ dlf/plugins/listview/class.tx_dlf_listview.php 2012-08-17 07:00:27 +0000 |
4430 | @@ -162,71 +162,71 @@ |
4431 | |
4432 | $element = $this->list->elements[$number]; |
4433 | |
4434 | - foreach ($this->metadata as $_index_name => $_metaConf) { |
4435 | - |
4436 | - $value = ''; |
4437 | - |
4438 | - $fieldwrap = $this->parseTS($_metaConf['wrap']); |
4439 | + foreach ($this->metadata as $index_name => $metaConf) { |
4440 | + |
4441 | + $parsedValue = ''; |
4442 | + |
4443 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
4444 | |
4445 | do { |
4446 | |
4447 | - $_value = @array_shift($element['metadata'][$_index_name]); |
4448 | + $value = @array_shift($element['metadata'][$index_name]); |
4449 | |
4450 | // Link title to pageview. |
4451 | - if ($_index_name == 'title') { |
4452 | + if ($index_name == 'title') { |
4453 | |
4454 | // Get title of parent document if needed. |
4455 | - if (empty($_value) && $this->conf['getTitle']) { |
4456 | + if (empty($value) && $this->conf['getTitle']) { |
4457 | |
4458 | - $_value = '['.tx_dlf_document::getTitle($element['uid'], TRUE).']'; |
4459 | + $value = '['.tx_dlf_document::getTitle($element['uid'], TRUE).']'; |
4460 | |
4461 | } |
4462 | |
4463 | // Set fake title if still not present. |
4464 | - if (empty($_value)) { |
4465 | + if (empty($value)) { |
4466 | |
4467 | - $_value = $this->pi_getLL('noTitle'); |
4468 | + $value = $this->pi_getLL('noTitle'); |
4469 | |
4470 | } |
4471 | |
4472 | - $_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $element['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']); |
4473 | + $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $element['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']); |
4474 | |
4475 | // Translate name of holding library. |
4476 | - } elseif ($_index_name == 'owner' && !empty($_value)) { |
4477 | + } elseif ($index_name == 'owner' && !empty($value)) { |
4478 | |
4479 | - $_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages'])); |
4480 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
4481 | |
4482 | // Translate document type. |
4483 | - } elseif ($_index_name == 'type' && !empty($_value)) { |
4484 | + } elseif ($index_name == 'type' && !empty($value)) { |
4485 | |
4486 | - $_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages'])); |
4487 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
4488 | |
4489 | // Translate ISO 639 language code. |
4490 | - } elseif ($_index_name == 'language' && !empty($_value)) { |
4491 | - |
4492 | - $_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value)); |
4493 | - |
4494 | - } elseif (!empty($_value)) { |
4495 | - |
4496 | - $_value = htmlspecialchars($_value); |
4497 | - |
4498 | - } |
4499 | - |
4500 | - $_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']); |
4501 | - |
4502 | - if (!empty($_value)) { |
4503 | - |
4504 | - $value .= $_value; |
4505 | - |
4506 | - } |
4507 | - |
4508 | - } while (count($element['metadata'][$_index_name])); |
4509 | - |
4510 | - if (!empty($value)) { |
4511 | - |
4512 | - $field = $this->cObj->stdWrap(htmlspecialchars($_metaConf['label']), $fieldwrap['key.']); |
4513 | - |
4514 | - $field .= $value; |
4515 | + } elseif ($index_name == 'language' && !empty($value)) { |
4516 | + |
4517 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
4518 | + |
4519 | + } elseif (!empty($value)) { |
4520 | + |
4521 | + $value = htmlspecialchars($value); |
4522 | + |
4523 | + } |
4524 | + |
4525 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
4526 | + |
4527 | + if (!empty($value)) { |
4528 | + |
4529 | + $parsedValue .= $value; |
4530 | + |
4531 | + } |
4532 | + |
4533 | + } while (count($element['metadata'][$index_name])); |
4534 | + |
4535 | + if (!empty($parsedValue)) { |
4536 | + |
4537 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
4538 | + |
4539 | + $field .= $parsedValue; |
4540 | |
4541 | $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
4542 | |
4543 | @@ -276,13 +276,20 @@ |
4544 | |
4545 | } |
4546 | |
4547 | - $_uniqId = uniqid($prefix.'-'); |
4548 | - |
4549 | - $sorting .= '<label for="'.$_uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$_uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();"><option value=""></option>'; |
4550 | + $uniqId = uniqid($prefix.'-'); |
4551 | + |
4552 | + $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">'; |
4553 | + |
4554 | + // Add relevance sorting if this is a search result list. |
4555 | + if ($this->list->metadata['options']['source'] == 'search') { |
4556 | + |
4557 | + $sorting .= '<option value="relevance"'.(($this->list->metadata['options']['order'] == 'relevance') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>'; |
4558 | + |
4559 | + } |
4560 | |
4561 | foreach ($this->sortables as $index_name => $label) { |
4562 | |
4563 | - $sorting .= '<option value="'.$index_name.'"'.(($this->piVars['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>'; |
4564 | + $sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>'; |
4565 | |
4566 | } |
4567 | |
4568 | @@ -310,71 +317,71 @@ |
4569 | |
4570 | $markerArray['###SUBMETADATA###'] = ''; |
4571 | |
4572 | - foreach ($this->metadata as $_index_name => $_metaConf) { |
4573 | - |
4574 | - $value = ''; |
4575 | - |
4576 | - $fieldwrap = $this->parseTS($_metaConf['wrap']); |
4577 | + foreach ($this->metadata as $index_name => $metaConf) { |
4578 | + |
4579 | + $parsedValue = ''; |
4580 | + |
4581 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
4582 | |
4583 | do { |
4584 | |
4585 | - $_value = @array_shift($subpart['metadata'][$_index_name]); |
4586 | + $value = @array_shift($subpart['metadata'][$index_name]); |
4587 | |
4588 | // Link title to pageview. |
4589 | - if ($_index_name == 'title') { |
4590 | + if ($index_name == 'title') { |
4591 | |
4592 | // Get title of parent document if needed. |
4593 | - if (empty($_value) && $this->conf['getTitle']) { |
4594 | + if (empty($value) && $this->conf['getTitle']) { |
4595 | |
4596 | - $_value = '['.tx_dlf_document::getTitle($subpart['uid'], TRUE).']'; |
4597 | + $value = '['.tx_dlf_document::getTitle($subpart['uid'], TRUE).']'; |
4598 | |
4599 | } |
4600 | |
4601 | // Set fake title if still not present. |
4602 | - if (empty($_value)) { |
4603 | + if (empty($value)) { |
4604 | |
4605 | - $_value = $this->pi_getLL('noTitle'); |
4606 | + $value = $this->pi_getLL('noTitle'); |
4607 | |
4608 | } |
4609 | |
4610 | - $_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $subpart['uid'], 'page' => $subpart['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']); |
4611 | + $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $subpart['uid'], 'page' => $subpart['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']); |
4612 | |
4613 | // Translate name of holding library. |
4614 | - } elseif ($_index_name == 'owner' && !empty($_value)) { |
4615 | + } elseif ($index_name == 'owner' && !empty($value)) { |
4616 | |
4617 | - $_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages'])); |
4618 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
4619 | |
4620 | // Translate document type. |
4621 | - } elseif ($_index_name == 'type' && !empty($_value)) { |
4622 | + } elseif ($index_name == 'type' && !empty($value)) { |
4623 | |
4624 | - $_value = $this->pi_getLL($_value, tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages']), FALSE); |
4625 | + $value = $this->pi_getLL($value, tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']), FALSE); |
4626 | |
4627 | // Translate ISO 639 language code. |
4628 | - } elseif ($_index_name == 'language' && !empty($_value)) { |
4629 | - |
4630 | - $_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value)); |
4631 | - |
4632 | - } elseif (!empty($_value)) { |
4633 | - |
4634 | - $_value = htmlspecialchars($_value); |
4635 | - |
4636 | - } |
4637 | - |
4638 | - $_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']); |
4639 | - |
4640 | - if (!empty($_value)) { |
4641 | - |
4642 | - $value .= $_value; |
4643 | - |
4644 | - } |
4645 | - |
4646 | - } while (count($subpart['metadata'][$_index_name])); |
4647 | - |
4648 | - if (!empty($value)) { |
4649 | - |
4650 | - $field = $this->cObj->stdWrap(htmlspecialchars($_metaConf['label']), $fieldwrap['key.']); |
4651 | - |
4652 | - $field .= $value; |
4653 | + } elseif ($index_name == 'language' && !empty($value)) { |
4654 | + |
4655 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
4656 | + |
4657 | + } elseif (!empty($value)) { |
4658 | + |
4659 | + $value = htmlspecialchars($value); |
4660 | + |
4661 | + } |
4662 | + |
4663 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
4664 | + |
4665 | + if (!empty($value)) { |
4666 | + |
4667 | + $parsedValue .= $value; |
4668 | + |
4669 | + } |
4670 | + |
4671 | + } while (count($subpart['metadata'][$index_name])); |
4672 | + |
4673 | + if (!empty($parsedValue)) { |
4674 | + |
4675 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
4676 | + |
4677 | + $field .= $parsedValue; |
4678 | |
4679 | $markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
4680 | |
4681 | @@ -399,7 +406,7 @@ |
4682 | */ |
4683 | protected function loadConfig() { |
4684 | |
4685 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4686 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4687 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.wrap AS wrap,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable', |
4688 | 'tx_dlf_metadata', |
4689 | '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
4690 | @@ -408,7 +415,7 @@ |
4691 | '' |
4692 | ); |
4693 | |
4694 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
4695 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
4696 | |
4697 | if ($resArray['is_listed']) { |
4698 | |
4699 | @@ -456,11 +463,11 @@ |
4700 | $this->list->sort($this->piVars['order'], TRUE); |
4701 | |
4702 | // Update list's metadata. |
4703 | - $_metadata = $this->list->metadata; |
4704 | - |
4705 | - $_metadata['options']['order'] = $this->piVars['order']; |
4706 | - |
4707 | - $this->list->metadata = $_metadata; |
4708 | + $listMetadata = $this->list->metadata; |
4709 | + |
4710 | + $listMetadata['options']['order'] = $this->piVars['order']; |
4711 | + |
4712 | + $this->list->metadata = $listMetadata; |
4713 | |
4714 | // Save updated list. |
4715 | $this->list->save(); |
4716 | |
4717 | === modified file 'dlf/plugins/listview/locallang.xml' |
4718 | --- dlf/plugins/listview/locallang.xml 2011-11-10 16:20:57 +0000 |
4719 | +++ dlf/plugins/listview/locallang.xml 2012-08-17 07:00:27 +0000 |
4720 | @@ -19,6 +19,7 @@ |
4721 | <label index="separator"> - </label> |
4722 | <label index="skip">...</label> |
4723 | <label index="orderBy">Order by: </label> |
4724 | + <label index="relevance">relevance</label> |
4725 | <label index="noTitle">[no title]</label> |
4726 | </languageKey> |
4727 | <languageKey index="de" type="array"> |
4728 | @@ -35,6 +36,7 @@ |
4729 | <label index="separator"> - </label> |
4730 | <label index="skip">...</label> |
4731 | <label index="orderBy">Sortieren nach: </label> |
4732 | + <label index="relevance">Relevanz</label> |
4733 | <label index="noTitle">[kein Titel]</label> |
4734 | </languageKey> |
4735 | </data> |
4736 | |
4737 | === modified file 'dlf/plugins/metadata/class.tx_dlf_metadata.php' |
4738 | --- dlf/plugins/metadata/class.tx_dlf_metadata.php 2012-08-07 15:15:45 +0000 |
4739 | +++ dlf/plugins/metadata/class.tx_dlf_metadata.php 2012-08-17 07:00:27 +0000 |
4740 | @@ -68,36 +68,36 @@ |
4741 | if ($this->conf['rootline'] < 2) { |
4742 | |
4743 | // Get current structure's @ID. |
4744 | - $_ids = array (); |
4745 | + $ids = array (); |
4746 | |
4747 | if (!empty($this->doc->physicalPages[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]])) { |
4748 | |
4749 | - foreach ($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]] as $_logId) { |
4750 | - |
4751 | - $_count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$_logId.'"]/ancestor::*')); |
4752 | - |
4753 | - $_ids[$_count][] = $_logId; |
4754 | + foreach ($this->doc->smLinks['p2l'][$this->doc->physicalPages[$this->piVars['page']]] as $logId) { |
4755 | + |
4756 | + $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
4757 | + |
4758 | + $ids[$count][] = $logId; |
4759 | |
4760 | } |
4761 | |
4762 | } |
4763 | |
4764 | - ksort($_ids); |
4765 | + ksort($ids); |
4766 | |
4767 | - reset($_ids); |
4768 | + reset($ids); |
4769 | |
4770 | // Check if we should display all metadata up to the root. |
4771 | if ($this->conf['rootline'] == 1) { |
4772 | |
4773 | - foreach ($_ids as $_id) { |
4774 | - |
4775 | - foreach ($_id as $id) { |
4776 | - |
4777 | - $_data = $this->doc->getMetadata($id, $this->conf['pages']); |
4778 | - |
4779 | - $_data['_id'] = $id; |
4780 | - |
4781 | - $metadata[] = $_data; |
4782 | + foreach ($ids as $id) { |
4783 | + |
4784 | + foreach ($id as $sid) { |
4785 | + |
4786 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
4787 | + |
4788 | + $data['_id'] = $sid; |
4789 | + |
4790 | + $metadata[] = $data; |
4791 | |
4792 | } |
4793 | |
4794 | @@ -105,17 +105,17 @@ |
4795 | |
4796 | } else { |
4797 | |
4798 | - $_id = array_pop($_ids); |
4799 | - |
4800 | - if (is_array($_id)) { |
4801 | - |
4802 | - foreach ($_id as $id) { |
4803 | - |
4804 | - $_data = $this->doc->getMetadata($id, $this->conf['pages']); |
4805 | - |
4806 | - $_data['_id'] = $id; |
4807 | - |
4808 | - $metadata[] = $_data; |
4809 | + $id = array_pop($ids); |
4810 | + |
4811 | + if (is_array($id)) { |
4812 | + |
4813 | + foreach ($id as $sid) { |
4814 | + |
4815 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
4816 | + |
4817 | + $data['_id'] = $sid; |
4818 | + |
4819 | + $metadata[] = $data; |
4820 | |
4821 | } |
4822 | |
4823 | @@ -128,17 +128,21 @@ |
4824 | // Get titledata? |
4825 | if (empty($metadata)) { |
4826 | |
4827 | - $_data = $this->doc->getTitleData($this->conf['pages']); |
4828 | - |
4829 | - $_data['_id'] = ''; |
4830 | - |
4831 | - $metadata[] = $_data; |
4832 | + $data = $this->doc->getTitleData($this->conf['pages']); |
4833 | + |
4834 | + $data['_id'] = $this->doc->toplevelId; |
4835 | + |
4836 | + $metadata[] = $data; |
4837 | |
4838 | } |
4839 | |
4840 | if (empty($metadata)) { |
4841 | |
4842 | - trigger_error('No metadata found', E_USER_WARNING); |
4843 | + if (TYPO3_DLOG) { |
4844 | + |
4845 | + t3lib_div::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
4846 | + |
4847 | + } |
4848 | |
4849 | return $content; |
4850 | |
4851 | @@ -157,11 +161,11 @@ |
4852 | * |
4853 | * @access protected |
4854 | * |
4855 | - * @param array $metadata: The metadata array |
4856 | + * @param array $metadataArray: The metadata array |
4857 | * |
4858 | * @return string The metadata array ready for output |
4859 | */ |
4860 | - protected function printMetadata(array $metadata) { |
4861 | + protected function printMetadata(array $metadataArray) { |
4862 | |
4863 | // Load template file. |
4864 | if (!empty($this->conf['templateFile'])) { |
4865 | @@ -181,7 +185,7 @@ |
4866 | // Get list of metadata to show. |
4867 | $metaList = array (); |
4868 | |
4869 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4870 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
4871 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
4872 | 'tx_dlf_metadata', |
4873 | 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
4874 | @@ -190,7 +194,7 @@ |
4875 | '' |
4876 | ); |
4877 | |
4878 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
4879 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
4880 | |
4881 | if ($this->conf['showFull'] || $resArray['is_listed']) { |
4882 | |
4883 | @@ -207,7 +211,7 @@ |
4884 | $cObjData = $this->cObj->data; |
4885 | |
4886 | // Parse the metadata arrays. |
4887 | - foreach ($metadata as $_metadata) { |
4888 | + foreach ($metadataArray as $metadata) { |
4889 | |
4890 | $markerArray['###METADATA###'] = ''; |
4891 | |
4892 | @@ -215,92 +219,92 @@ |
4893 | $this->cObj->data = $cObjData; |
4894 | |
4895 | // Load all the metadata values into the content object's data array. |
4896 | - foreach ($_metadata as $_index_name => $_value) { |
4897 | - |
4898 | - if (is_array($_value)) { |
4899 | - |
4900 | - $this->cObj->data[$_index_name] = implode($this->conf['separator'], $_value); |
4901 | + foreach ($metadata as $index_name => $value) { |
4902 | + |
4903 | + if (is_array($value)) { |
4904 | + |
4905 | + $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
4906 | |
4907 | } else { |
4908 | |
4909 | - $this->cObj->data[$_index_name] = $_value; |
4910 | + $this->cObj->data[$index_name] = $value; |
4911 | |
4912 | } |
4913 | |
4914 | } |
4915 | |
4916 | // Process each metadate. |
4917 | - foreach ($metaList as $_index_name => $_metaConf) { |
4918 | - |
4919 | - $value = ''; |
4920 | - |
4921 | - $fieldwrap = $this->parseTS($_metaConf['wrap']); |
4922 | + foreach ($metaList as $index_name => $metaConf) { |
4923 | + |
4924 | + $parsedValue = ''; |
4925 | + |
4926 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
4927 | |
4928 | do { |
4929 | |
4930 | - $_value = @array_shift($_metadata[$_index_name]); |
4931 | + $value = @array_shift($metadata[$index_name]); |
4932 | |
4933 | - if ($_index_name == 'title') { |
4934 | + if ($index_name == 'title') { |
4935 | |
4936 | // Get title of parent document if needed. |
4937 | - if (empty($_value) && $this->conf['getTitle'] && $this->doc->parentid) { |
4938 | + if (empty($value) && $this->conf['getTitle'] && $this->doc->parentid) { |
4939 | |
4940 | - $_value = '['.tx_dlf_document::getTitle($this->doc->parentid, TRUE).']'; |
4941 | + $value = '['.tx_dlf_document::getTitle($this->doc->parentid, TRUE).']'; |
4942 | |
4943 | } |
4944 | |
4945 | - if (!empty($_value)) { |
4946 | + if (!empty($value)) { |
4947 | |
4948 | - $_value = htmlspecialchars($_value); |
4949 | + $value = htmlspecialchars($value); |
4950 | |
4951 | // Link title to pageview. |
4952 | - if ($this->conf['linkTitle'] && $_metadata['_id']) { |
4953 | - |
4954 | - $details = $this->doc->getLogicalStructure($_metadata['_id']); |
4955 | - |
4956 | - $_value = $this->pi_linkTP(htmlspecialchars($_value), array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
4957 | + if ($this->conf['linkTitle'] && $metadata['_id']) { |
4958 | + |
4959 | + $details = $this->doc->getLogicalStructure($metadata['_id']); |
4960 | + |
4961 | + $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
4962 | |
4963 | } |
4964 | |
4965 | } |
4966 | |
4967 | - } elseif ($_index_name == 'owner' && !empty($_value)) { |
4968 | + } elseif ($index_name == 'owner' && !empty($value)) { |
4969 | |
4970 | // Translate name of holding library. |
4971 | - $_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_libraries', $this->conf['pages'])); |
4972 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
4973 | |
4974 | - } elseif ($_index_name == 'type' && !empty($_value)) { |
4975 | + } elseif ($index_name == 'type' && !empty($value)) { |
4976 | |
4977 | // Translate document type. |
4978 | - $_value = htmlspecialchars(tx_dlf_helper::translate($_value, 'tx_dlf_structures', $this->conf['pages'])); |
4979 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
4980 | |
4981 | - } elseif ($_index_name == 'language' && !empty($_value)) { |
4982 | + } elseif ($index_name == 'language' && !empty($value)) { |
4983 | |
4984 | // Translate ISO 639 language code. |
4985 | - $_value = htmlspecialchars(tx_dlf_helper::getLanguageName($_value)); |
4986 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
4987 | |
4988 | - } elseif (!empty($_value)) { |
4989 | + } elseif (!empty($value)) { |
4990 | |
4991 | // Sanitize value for output. |
4992 | - $_value = htmlspecialchars($_value); |
4993 | - |
4994 | - } |
4995 | - |
4996 | - $_value = $this->cObj->stdWrap($_value, $fieldwrap['value.']); |
4997 | - |
4998 | - if (!empty($_value)) { |
4999 | - |
5000 | - $value .= $_value; |
The diff has been truncated for viewing.