Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2017-12-20 17:50:24 +00:00
parent 5c2c02086e
commit 7c98604877
57 changed files with 13327 additions and 13327 deletions

View File

@ -10,249 +10,249 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections',
'label' => 'label', 'label' => 'label',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'fe_cruser_id' => 'fe_cruser_id', 'fe_cruser_id' => 'fe_cruser_id',
'fe_admin_lock' => 'fe_admin_lock', 'fe_admin_lock' => 'fe_admin_lock',
'languageField' => 'sys_language_uid', 'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent', 'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource', 'transOrigDiffSourceField' => 'l18n_diffsource',
'default_sortby' => 'ORDER BY label', 'default_sortby' => 'ORDER BY label',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array ( 'enablecolumns' => array (
'disabled' => 'hidden', 'disabled' => 'hidden',
'fe_group' => 'fe_group', 'fe_group' => 'fe_group',
), ),
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfcollections.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfcollections.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'label,index_name,oai_name,fe_cruser_id', 'searchFields' => 'label,index_name,oai_name,fe_cruser_id',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => 'label,description,thumbnail,documents', 'fe_admin_fieldList' => 'label,description,thumbnail,documents',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'label,index_name,oai_name,fe_cruser_id', 'showRecordFieldList' => 'label,index_name,oai_name,fe_cruser_id',
), ),
'columns' => array ( 'columns' => array (
'sys_language_uid' => array ( 'sys_language_uid' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'sys_language', 'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title', 'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0),
), ),
'default' => 0, 'default' => 0,
), ),
), ),
'l18n_parent' => array ( 'l18n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0', 'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('', 0), array ('', 0),
), ),
'foreign_table' => 'tx_dlf_collections', 'foreign_table' => 'tx_dlf_collections',
'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0)', 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0)',
), ),
), ),
'l18n_diffsource' => array ( 'l18n_diffsource' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough' 'type' => 'passthrough'
), ),
), ),
'hidden' => array ( 'hidden' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'fe_group' => array ( 'fe_group' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectMultipleSideBySide', 'renderType' => 'selectMultipleSideBySide',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2),
array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'),
), ),
'foreign_table' => 'fe_groups', 'foreign_table' => 'fe_groups',
'size' => 5, 'size' => 5,
'autoSizeMax' => 15, 'autoSizeMax' => 15,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 20, 'maxitems' => 20,
'exclusiveKeys' => '-1,-2', 'exclusiveKeys' => '-1,-2',
), ),
), ),
'label' => array ( 'label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'index_name' => array ( 'index_name' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.index_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.index_name',
'config' => array ( 'config' => array (
'type' => 'none', 'type' => 'none',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,uniqueInPid', 'eval' => 'required,uniqueInPid',
), ),
), ),
'oai_name' => array ( 'oai_name' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.oai_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.oai_name',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace,alphanum_x,uniqueInPid', 'eval' => 'nospace,alphanum_x,uniqueInPid',
), ),
), ),
'description' => array ( 'description' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.description', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.description',
'config' => array ( 'config' => array (
'type' => 'text', 'type' => 'text',
'cols' => 30, 'cols' => 30,
'rows' => 10, 'rows' => 10,
'wrap' => 'virtual', 'wrap' => 'virtual',
), ),
'defaultExtras' => 'richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css]', 'defaultExtras' => 'richtext[undo,redo,cut,copy,paste,link,image,line,acronym,chMode,blockstylelabel,formatblock,blockstyle,textstylelabel,textstyle,bold,italic,unorderedlist,orderedlist]:rte_transform[mode=ts_css]',
), ),
'thumbnail' => array ( 'thumbnail' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.thumbnail', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.thumbnail',
'config' => array ( 'config' => array (
'type' => 'group', 'type' => 'group',
'internal_type' => 'file_reference', 'internal_type' => 'file_reference',
'allowed' => 'gif,jpg,png', 'allowed' => 'gif,jpg,png',
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'priority' => array ( 'priority' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.priority', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.priority',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('1', 1), array ('1', 1),
array ('2', 2), array ('2', 2),
array ('3', 3), array ('3', 3),
array ('4', 4), array ('4', 4),
array ('5', 5), array ('5', 5),
), ),
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
'default' => 3, 'default' => 3,
), ),
), ),
'documents' => array ( 'documents' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.documents', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.documents',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingleBox', 'renderType' => 'selectSingleBox',
'foreign_table' => 'tx_dlf_documents', 'foreign_table' => 'tx_dlf_documents',
'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting', 'foreign_table_where' => 'AND tx_dlf_documents.pid=###CURRENT_PID### ORDER BY tx_dlf_documents.title_sorting',
'size' => 5, 'size' => 5,
'autoSizeMax' => 15, 'autoSizeMax' => 15,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1048576, 'maxitems' => 1048576,
'MM' => 'tx_dlf_relations', 'MM' => 'tx_dlf_relations',
'MM_match_fields' => array ( 'MM_match_fields' => array (
'ident' => 'docs_colls', 'ident' => 'docs_colls',
), ),
'MM_opposite_field' => 'collections', 'MM_opposite_field' => 'collections',
), ),
), ),
'owner' => array ( 'owner' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner.none', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.owner.none', 0),
), ),
'foreign_table' => 'tx_dlf_libraries', 'foreign_table' => 'tx_dlf_libraries',
'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label',
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'fe_cruser_id' => array ( 'fe_cruser_id' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id.none', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_cruser_id.none', 0),
), ),
'foreign_table' => 'fe_users', 'foreign_table' => 'fe_users',
'foreign_table_where' => 'ORDER BY fe_users.username', 'foreign_table_where' => 'ORDER BY fe_users.username',
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'fe_admin_lock' => array ( 'fe_admin_lock' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_admin_lock', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.fe_admin_lock',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'status' => array ( 'status' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status.default', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_collections.status.default', 0),
), ),
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
'default' => 0, 'default' => 0,
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab1, label,--palette--;;1;;1-1-1, description,--palette--;;2;;2-2-2, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab3, hidden;;;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4, fe_cruser_id,--palette--;;3'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab1, label,--palette--;;1;;1-1-1, description,--palette--;;2;;2-2-2, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_collections.tab3, hidden;;;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4, fe_cruser_id,--palette--;;3'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1),
'2' => array ('showitem' => 'thumbnail, priority', 'canNotCollapse' => 1), '2' => array ('showitem' => 'thumbnail, priority', 'canNotCollapse' => 1),
'3' => array ('showitem' => 'fe_admin_lock', 'canNotCollapse' => 1), '3' => array ('showitem' => 'fe_admin_lock', 'canNotCollapse' => 1),
), ),
); );

View File

@ -10,328 +10,328 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents',
'label' => 'title', 'label' => 'title',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY title_sorting', 'default_sortby' => 'ORDER BY title_sorting',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array ( 'enablecolumns' => array (
'disabled' => 'hidden', 'disabled' => 'hidden',
'starttime' => 'starttime', 'starttime' => 'starttime',
'endtime' => 'endtime', 'endtime' => 'endtime',
'fe_group' => 'fe_group', 'fe_group' => 'fe_group',
), ),
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfdocuments.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfdocuments.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', 'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', 'showRecordFieldList' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn',
'maxDBListItems' => 25, 'maxDBListItems' => 25,
'maxSingleDBListItems' => 50, 'maxSingleDBListItems' => 50,
), ),
'columns' => array ( 'columns' => array (
'hidden' => array ( 'hidden' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'starttime' => array ( 'starttime' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => '13', 'size' => '13',
'max' => '20', 'max' => '20',
'eval' => 'datetime', 'eval' => 'datetime',
'default' => '0', 'default' => '0',
), ),
), ),
'endtime' => array ( 'endtime' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => '13', 'size' => '13',
'max' => '20', 'max' => '20',
'eval' => 'datetime', 'eval' => 'datetime',
'default' => '0', 'default' => '0',
), ),
), ),
'fe_group' => array ( 'fe_group' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectMultipleSideBySide', 'renderType' => 'selectMultipleSideBySide',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2),
array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'),
), ),
'foreign_table' => 'fe_groups', 'foreign_table' => 'fe_groups',
'size' => 5, 'size' => 5,
'autoSizeMax' => 15, 'autoSizeMax' => 15,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 20, 'maxitems' => 20,
'exclusiveKeys' => '-1,-2', 'exclusiveKeys' => '-1,-2',
), ),
), ),
'prod_id' => array ( 'prod_id' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.prod_id', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.prod_id',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'location' => array ( 'location' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.location', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.location',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'required,uniqueInPid', 'eval' => 'required,uniqueInPid',
), ),
), ),
'record_id' => array ( 'record_id' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.record_id', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.record_id',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace,uniqueInPid', 'eval' => 'nospace,uniqueInPid',
), ),
), ),
'opac_id' => array ( 'opac_id' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.opac_id', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.opac_id',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'union_id' => array ( 'union_id' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.union_id', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.union_id',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'urn' => array ( 'urn' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.urn', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.urn',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'purl' => array ( 'purl' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.purl', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.purl',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'title' => array ( 'title' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'title_sorting' => array ( 'title_sorting' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title_sorting', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title_sorting',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'author' => array ( 'author' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.author', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.author',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'year' => array ( 'year' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.year', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.year',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'place' => array ( 'place' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.place', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.place',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'thumbnail' => array ( 'thumbnail' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.thumbnail', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.thumbnail',
'config' => array ( 'config' => array (
'type' => 'user', 'type' => 'user',
'userFunc' => 'EXT:dlf/hooks/class.tx_dlf_tceforms.php:tx_dlf_tceforms->displayThumbnail', 'userFunc' => 'EXT:dlf/hooks/class.tx_dlf_tceforms.php:tx_dlf_tceforms->displayThumbnail',
), ),
), ),
'metadata' => array ( 'metadata' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
'metadata_sorting' => array ( 'metadata_sorting' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
'structure' => array ( 'structure' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.structure', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.structure',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'tx_dlf_structures', 'foreign_table' => 'tx_dlf_structures',
'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) AND tx_dlf_structures.toplevel=1 ORDER BY tx_dlf_structures.label', 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) AND tx_dlf_structures.toplevel=1 ORDER BY tx_dlf_structures.label',
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'partof' => array ( 'partof' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof',
'config' => array ( 'config' => array (
'type' => 'group', 'type' => 'group',
'internal_type' => 'db', 'internal_type' => 'db',
'allowed' => 'tx_dlf_documents', 'allowed' => 'tx_dlf_documents',
'prepend_tname' => 0, 'prepend_tname' => 0,
'size' => 1, 'size' => 1,
'selectedListStyle' => 'width:400px;', 'selectedListStyle' => 'width:400px;',
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
'disable_controls' => 'browser,delete', 'disable_controls' => 'browser,delete',
'default' => 0, 'default' => 0,
'readOnly' => 1, 'readOnly' => 1,
), ),
), ),
'volume' => array ( 'volume' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'volume_sorting' => array ( 'volume_sorting' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume_sorting', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume_sorting',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'collections' => array ( 'collections' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.collections', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.collections',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectMultipleSideBySide', 'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_dlf_collections', 'foreign_table' => 'tx_dlf_collections',
'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0) ORDER BY tx_dlf_collections.label', 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0) ORDER BY tx_dlf_collections.label',
'size' => 5, 'size' => 5,
'autoSizeMax' => 15, 'autoSizeMax' => 15,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1024, 'maxitems' => 1024,
'MM' => 'tx_dlf_relations', 'MM' => 'tx_dlf_relations',
'MM_match_fields' => array ( 'MM_match_fields' => array (
'ident' => 'docs_colls', 'ident' => 'docs_colls',
), ),
), ),
), ),
'owner' => array ( 'owner' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.owner', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.owner',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'tx_dlf_libraries', 'foreign_table' => 'tx_dlf_libraries',
'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label',
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'solrcore' => array ( 'solrcore' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
'status' => array ( 'status' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status.default', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status.default', 0),
), ),
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
'default' => 0, 'default' => 0,
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab1, title,--palette--;;1;;1-1-1, author, year, place, structure,--palette--;;2;;2-2-2, collections;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab2, location;;;;1-1-1, record_id, prod_id;;;;2-2-2, oai_id;;;;3-3-3, opac_id, union_id, urn, purl;;;;4-4-4, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab3, hidden,--palette--;;3;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab1, title,--palette--;;1;;1-1-1, author, year, place, structure,--palette--;;2;;2-2-2, collections;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab2, location;;;;1-1-1, record_id, prod_id;;;;2-2-2, oai_id;;;;3-3-3, opac_id, union_id, urn, purl;;;;4-4-4, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab3, hidden,--palette--;;3;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => 'title_sorting', 'canNotCollapse' => 1), '1' => array ('showitem' => 'title_sorting', 'canNotCollapse' => 1),
'2' => array ('showitem' => 'partof, thumbnail, --linebreak--, volume, volume_sorting', 'canNotCollapse' => 1), '2' => array ('showitem' => 'partof, thumbnail, --linebreak--, volume, volume_sorting', 'canNotCollapse' => 1),
'3' => array ('showitem' => 'starttime, endtime', 'canNotCollapse' => 1), '3' => array ('showitem' => 'starttime, endtime', 'canNotCollapse' => 1),
) )
); );

View File

@ -10,67 +10,67 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats',
'label' => 'type', 'label' => 'type',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY type', 'default_sortby' => 'ORDER BY type',
'delete' => 'deleted', 'delete' => 'deleted',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfformats.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfformats.png',
'rootLevel' => 1, 'rootLevel' => 1,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'type,class', 'searchFields' => 'type,class',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'type,class', 'showRecordFieldList' => 'type,class',
), ),
'columns' => array ( 'columns' => array (
'type' => array ( 'type' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.type', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.type',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,nospace,alphanum_x,unique', 'eval' => 'required,nospace,alphanum_x,unique',
), ),
), ),
'root' => array ( 'root' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.root', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.root',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,nospace,alphanum_x,unique', 'eval' => 'required,nospace,alphanum_x,unique',
), ),
), ),
'namespace' => array ( 'namespace' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.namespace', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.namespace',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'required,nospace,unique', 'eval' => 'required,nospace,unique',
), ),
), ),
'class' => array ( 'class' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.class', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.class',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'nospace,alphanum_x,unique', 'eval' => 'nospace,alphanum_x,unique',
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, root;;;;2-2-2, namespace, class;;;;3-3-3'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, root;;;;2-2-2, namespace, class;;;;3-3-3'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => ''), '1' => array ('showitem' => ''),
), ),
); );

View File

@ -10,185 +10,185 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries',
'label' => 'label', 'label' => 'label',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid', 'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent', 'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource', 'transOrigDiffSourceField' => 'l18n_diffsource',
'default_sortby' => 'ORDER BY label', 'default_sortby' => 'ORDER BY label',
'delete' => 'deleted', 'delete' => 'deleted',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlflibraries.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlflibraries.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'label,website,contact', 'searchFields' => 'label,website,contact',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'label,website,contact', 'showRecordFieldList' => 'label,website,contact',
), ),
'columns' => array ( 'columns' => array (
'sys_language_uid' => array ( 'sys_language_uid' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'sys_language', 'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title', 'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0),
), ),
'default' => 0 'default' => 0
), ),
), ),
'l18n_parent' => array ( 'l18n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0', 'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('', 0), array ('', 0),
), ),
'foreign_table' => 'tx_dlf_libraries', 'foreign_table' => 'tx_dlf_libraries',
'foreign_table_where' => 'AND tx_dlf_libraries.pid=###CURRENT_PID### AND tx_dlf_libraries.sys_language_uid IN (-1,0)', 'foreign_table_where' => 'AND tx_dlf_libraries.pid=###CURRENT_PID### AND tx_dlf_libraries.sys_language_uid IN (-1,0)',
), ),
), ),
'l18n_diffsource' => array ( 'l18n_diffsource' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough' 'type' => 'passthrough'
), ),
), ),
'label' => array ( 'label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'index_name' => array ( 'index_name' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.index_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.index_name',
'config' => array ( 'config' => array (
'type' => 'none', 'type' => 'none',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,uniqueInPid', 'eval' => 'required,uniqueInPid',
), ),
), ),
'website' => array ( 'website' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.website', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.website',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'contact' => array ( 'contact' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.contact', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.contact',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'image' => array ( 'image' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.image', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.image',
'config' => array ( 'config' => array (
'type' => 'group', 'type' => 'group',
'internal_type' => 'file', 'internal_type' => 'file',
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'max_size' => 256, 'max_size' => 256,
'uploadfolder' => 'uploads/tx_dlf', 'uploadfolder' => 'uploads/tx_dlf',
'show_thumbs' => 1, 'show_thumbs' => 1,
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'oai_label' => array ( 'oai_label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.oai_label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.oai_label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
), ),
), ),
'oai_base' => array ( 'oai_base' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.oai_base', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.oai_base',
'config' => array ( 'config' => array (
'type' => 'group', 'type' => 'group',
'internal_type' => 'db', 'internal_type' => 'db',
'allowed' => 'pages', 'allowed' => 'pages',
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'opac_label' => array ( 'opac_label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.opac_label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.opac_label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
), ),
), ),
'opac_base' => array ( 'opac_base' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.opac_base', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.opac_base',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
'union_label' => array ( 'union_label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.union_label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.union_label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
), ),
), ),
'union_base' => array ( 'union_base' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.union_base', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.union_base',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'nospace', 'eval' => 'nospace',
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab1, label,--palette--;;1;;1-1-1, website;;;;2-2-2, contact, image;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab3, oai_label,--palette--;;2;;1-1-1, opac_label,--palette--;;3;;2-2-2, union_label,--palette--;;4;;3-3-3'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab1, label,--palette--;;1;;1-1-1, website;;;;2-2-2, contact, image;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_libraries.tab3, oai_label,--palette--;;2;;1-1-1, opac_label,--palette--;;3;;2-2-2, union_label,--palette--;;4;;3-3-3'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => 'index_name', 'canNotCollapse' => 1), '1' => array ('showitem' => 'index_name', 'canNotCollapse' => 1),
'2' => array ('showitem' => 'oai_base', 'canNotCollapse' => 1), '2' => array ('showitem' => 'oai_base', 'canNotCollapse' => 1),
'3' => array ('showitem' => 'opac_base', 'canNotCollapse' => 1), '3' => array ('showitem' => 'opac_base', 'canNotCollapse' => 1),
'4' => array ('showitem' => 'union_base', 'canNotCollapse' => 1), '4' => array ('showitem' => 'union_base', 'canNotCollapse' => 1),
), ),
); );

View File

@ -13,7 +13,7 @@ return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_mail', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_mail',
'label' => 'label', 'label' => 'label',
'sortby' => 'sorting', 'sortby' => 'sorting',
'delete' => 'deleted', 'delete' => 'deleted',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfemail.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfemail.png',
'rootLevel' => 0, 'rootLevel' => 0,

View File

@ -10,239 +10,239 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata',
'label' => 'label', 'label' => 'label',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid', 'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent', 'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource', 'transOrigDiffSourceField' => 'l18n_diffsource',
'sortby' => 'sorting', 'sortby' => 'sorting',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array ( 'enablecolumns' => array (
'disabled' => 'hidden', 'disabled' => 'hidden',
), ),
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfmetadata.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfmetadata.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'label,index_name', 'searchFields' => 'label,index_name',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'label,index_name,is_sortable,is_facet,is_listed,index_autocomplete', 'showRecordFieldList' => 'label,index_name,is_sortable,is_facet,is_listed,index_autocomplete',
), ),
'columns' => array ( 'columns' => array (
'sys_language_uid' => array ( 'sys_language_uid' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'sys_language', 'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title', 'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0),
), ),
'default' => 0 'default' => 0
), ),
), ),
'l18n_parent' => array ( 'l18n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0', 'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('', 0), array ('', 0),
), ),
'foreign_table' => 'tx_dlf_metadata', 'foreign_table' => 'tx_dlf_metadata',
'foreign_table_where' => 'AND tx_dlf_metadata.pid=###CURRENT_PID### AND tx_dlf_metadata.sys_language_uid IN (-1,0) ORDER BY label ASC', 'foreign_table_where' => 'AND tx_dlf_metadata.pid=###CURRENT_PID### AND tx_dlf_metadata.sys_language_uid IN (-1,0) ORDER BY label ASC',
), ),
), ),
'l18n_diffsource' => array ( 'l18n_diffsource' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough' 'type' => 'passthrough'
), ),
), ),
'hidden' => array ( 'hidden' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'label' => array ( 'label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'index_name' => array ( 'index_name' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_name',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,nospace,alphanum_x,uniqueInPid', 'eval' => 'required,nospace,alphanum_x,uniqueInPid',
), ),
), ),
'format' => array ( 'format' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.format', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.format',
'config' => array ( 'config' => array (
'type' => 'inline', 'type' => 'inline',
'foreign_table' => 'tx_dlf_metadataformat', 'foreign_table' => 'tx_dlf_metadataformat',
'foreign_field' => 'parent_id', 'foreign_field' => 'parent_id',
'foreign_unique' => 'encoded', 'foreign_unique' => 'encoded',
'appearance' => array ( 'appearance' => array (
'expandSingle' => 1, 'expandSingle' => 1,
'levelLinksPosition' => 'bottom', 'levelLinksPosition' => 'bottom',
'enabledControls' => array ( 'enabledControls' => array (
'info' => 0, 'info' => 0,
'new' => 1, 'new' => 1,
'dragdrop' => 0, 'dragdrop' => 0,
'sort' => 0, 'sort' => 0,
'hide' => 0, 'hide' => 0,
'delete' => 1, 'delete' => 1,
'localize' => 0, 'localize' => 0,
), ),
), ),
), ),
), ),
'default_value' => array ( 'default_value' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.default_value', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.default_value',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'wrap' => array ( 'wrap' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank', 'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.wrap', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.wrap',
'config' => array ( 'config' => array (
'type' => 'text', 'type' => 'text',
'cols' => 48, 'cols' => 48,
'rows' => 20, 'rows' => 20,
'wrap' => 'off', 'wrap' => 'off',
'eval' => 'trim', 'eval' => 'trim',
'default' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>", 'default' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>",
), ),
'defaultExtras' => 'nowrap:fixed-font:enable-tab', 'defaultExtras' => 'nowrap:fixed-font:enable-tab',
), ),
'index_tokenized' => array ( 'index_tokenized' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_tokenized', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_tokenized',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'index_stored' => array ( 'index_stored' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_stored', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_stored',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'index_indexed' => array ( 'index_indexed' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_indexed', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_indexed',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 1, 'default' => 1,
), ),
), ),
'index_boost' => array ( 'index_boost' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_boost', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_boost',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 5, 'size' => 5,
'max' => 64, 'max' => 64,
'default' => '1.00', 'default' => '1.00',
'eval' => 'double2', 'eval' => 'double2',
), ),
), ),
'is_sortable' => array ( 'is_sortable' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_sortable', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_sortable',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'is_facet' => array ( 'is_facet' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_facet', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_facet',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'is_listed' => array ( 'is_listed' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_listed', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.is_listed',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'index_autocomplete' => array ( 'index_autocomplete' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_autocomplete', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.index_autocomplete',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'status' => array ( 'status' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.status', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.status',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.status.default', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.status.default', 0),
), ),
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
'default' => 0, 'default' => 0,
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab1, label,--palette--;;1;;1-1-1, format;;;;2-2-2, default_value;;;;3-3-3, wrap, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab3, hidden;;;;1-1-1, status;;;;2-2-2'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab1, label,--palette--;;1;;1-1-1, format;;;;2-2-2, default_value;;;;3-3-3, wrap, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadata.tab3, hidden;;;;1-1-1, status;;;;2-2-2'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => 'index_name, --linebreak--, index_tokenized, index_stored, index_indexed, index_boost, --linebreak--, is_sortable, is_facet, is_listed, index_autocomplete', 'canNotCollapse' => 1), '1' => array ('showitem' => 'index_name, --linebreak--, index_tokenized, index_stored, index_indexed, index_boost, --linebreak--, is_sortable, is_facet, is_listed, index_autocomplete', 'canNotCollapse' => 1),
), ),
); );

View File

@ -10,78 +10,78 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat',
'label' => 'encoded', 'label' => 'encoded',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY encoded', 'default_sortby' => 'ORDER BY encoded',
'delete' => 'deleted', 'delete' => 'deleted',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfmetadata.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfmetadata.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'encoded', 'searchFields' => 'encoded',
'hideTable' => 1, 'hideTable' => 1,
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'parent_id,encoded,xpath,xpath_sorting', 'showRecordFieldList' => 'parent_id,encoded,xpath,xpath_sorting',
), ),
'columns' => array ( 'columns' => array (
'parent_id' => array ( 'parent_id' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
'encoded' => array ( 'encoded' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.encoded', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.encoded',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'tx_dlf_formats', 'foreign_table' => 'tx_dlf_formats',
'foreign_table_where' => 'ORDER BY tx_dlf_formats.type', 'foreign_table_where' => 'ORDER BY tx_dlf_formats.type',
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
), ),
), ),
'xpath' => array ( 'xpath' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.xpath', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.xpath',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'xpath_sorting' => array ( 'xpath_sorting' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.xpath_sorting', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.xpath_sorting',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 1024, 'max' => 1024,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'mandatory' => array ( 'mandatory' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.mandatory', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.mandatory',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.tab1, encoded;;;;1-1-1, xpath;;;;2-2-2, xpath_sorting, mandatory;;;;3-3-3'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_metadataformat.tab1, encoded;;;;1-1-1, xpath;;;;2-2-2, xpath_sorting, mandatory;;;;3-3-3'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => ''), '1' => array ('showitem' => ''),
), ),
); );

View File

@ -10,49 +10,49 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores',
'label' => 'label', 'label' => 'label',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY label', 'default_sortby' => 'ORDER BY label',
'delete' => 'deleted', 'delete' => 'deleted',
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfsolrcores.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfsolrcores.png',
'rootLevel' => -1, 'rootLevel' => -1,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'label,index_name', 'searchFields' => 'label,index_name',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'label,index_name', 'showRecordFieldList' => 'label,index_name',
), ),
'columns' => array ( 'columns' => array (
'label' => array ( 'label' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'index_name' => array ( 'index_name' => array (
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.index_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.index_name',
'config' => array ( 'config' => array (
'type' => 'none', 'type' => 'none',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'alphanum,unique', 'eval' => 'alphanum,unique',
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.tab1, label;;;;1-1-1, index_name;;;;2-2-2'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_solrcores.tab1, label;;;;1-1-1, index_name;;;;2-2-2'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => ''), '1' => array ('showitem' => ''),
), ),
); );

View File

@ -10,155 +10,155 @@
*/ */
return array ( return array (
'ctrl' => array ( 'ctrl' => array (
'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures', 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures',
'label' => 'label', 'label' => 'label',
'tstamp' => 'tstamp', 'tstamp' => 'tstamp',
'crdate' => 'crdate', 'crdate' => 'crdate',
'cruser_id' => 'cruser_id', 'cruser_id' => 'cruser_id',
'languageField' => 'sys_language_uid', 'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l18n_parent', 'transOrigPointerField' => 'l18n_parent',
'transOrigDiffSourceField' => 'l18n_diffsource', 'transOrigDiffSourceField' => 'l18n_diffsource',
'default_sortby' => 'ORDER BY label', 'default_sortby' => 'ORDER BY label',
'delete' => 'deleted', 'delete' => 'deleted',
'enablecolumns' => array ( 'enablecolumns' => array (
'disabled' => 'hidden', 'disabled' => 'hidden',
), ),
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfstructures.png', 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfstructures.png',
'rootLevel' => 0, 'rootLevel' => 0,
'dividers2tabs' => 2, 'dividers2tabs' => 2,
'searchFields' => 'label,index_name,oai_name', 'searchFields' => 'label,index_name,oai_name',
'requestUpdate' => 'toplevel', 'requestUpdate' => 'toplevel',
), ),
'feInterface' => array ( 'feInterface' => array (
'fe_admin_fieldList' => '', 'fe_admin_fieldList' => '',
), ),
'interface' => array ( 'interface' => array (
'showRecordFieldList' => 'label,index_name,oai_name,toplevel', 'showRecordFieldList' => 'label,index_name,oai_name,toplevel',
), ),
'columns' => array ( 'columns' => array (
'sys_language_uid' => array ( 'sys_language_uid' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'foreign_table' => 'sys_language', 'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title', 'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array ( 'items' => array (
array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1),
array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0),
), ),
'default' => 0 'default' => 0
), ),
), ),
'l18n_parent' => array ( 'l18n_parent' => array (
'displayCond' => 'FIELD:sys_language_uid:>:0', 'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('', 0), array ('', 0),
), ),
'foreign_table' => 'tx_dlf_structures', 'foreign_table' => 'tx_dlf_structures',
'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY label ASC', 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY label ASC',
), ),
), ),
'l18n_diffsource' => array ( 'l18n_diffsource' => array (
'config' => array ( 'config' => array (
'type' => 'passthrough', 'type' => 'passthrough',
), ),
), ),
'hidden' => array ( 'hidden' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'toplevel' => array ( 'toplevel' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.toplevel', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.toplevel',
'config' => array ( 'config' => array (
'type' => 'check', 'type' => 'check',
'default' => 0, 'default' => 0,
), ),
), ),
'label' => array ( 'label' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.label', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.label',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,trim', 'eval' => 'required,trim',
), ),
), ),
'index_name' => array ( 'index_name' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.index_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.index_name',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'required,nospace,alphanum_x,uniqueInPid', 'eval' => 'required,nospace,alphanum_x,uniqueInPid',
), ),
), ),
'oai_name' => array ( 'oai_name' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.oai_name', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.oai_name',
'config' => array ( 'config' => array (
'type' => 'input', 'type' => 'input',
'size' => 30, 'size' => 30,
'max' => 255, 'max' => 255,
'eval' => 'trim', 'eval' => 'trim',
), ),
), ),
'thumbnail' => array ( 'thumbnail' => array (
'exclude' => 1, 'exclude' => 1,
'l10n_mode' => 'exclude', 'l10n_mode' => 'exclude',
'displayCond' => 'FIELD:toplevel:REQ:true', 'displayCond' => 'FIELD:toplevel:REQ:true',
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail.self', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail.self', 0),
), ),
'foreign_table' => 'tx_dlf_structures', 'foreign_table' => 'tx_dlf_structures',
'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.toplevel=0 AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY tx_dlf_structures.label', 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.toplevel=0 AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY tx_dlf_structures.label',
'size' => 1, 'size' => 1,
'minitems' => 0, 'minitems' => 0,
'maxitems' => 1, 'maxitems' => 1,
'default' => 0, 'default' => 0,
), ),
), ),
'status' => array ( 'status' => array (
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status', 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status',
'config' => array ( 'config' => array (
'type' => 'select', 'type' => 'select',
'renderType' => 'selectSingle', 'renderType' => 'selectSingle',
'items' => array ( 'items' => array (
array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status.default', 0), array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status.default', 0),
), ),
'size' => 1, 'size' => 1,
'minitems' => 1, 'minitems' => 1,
'maxitems' => 1, 'maxitems' => 1,
'default' => 0, 'default' => 0,
), ),
), ),
), ),
'types' => array ( 'types' => array (
'0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab1, toplevel;;;;1-1-1, label,--palette--;;1, thumbnail, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab3, hidden;;;;1-1-1, status;;;;2-2-2'), '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab1, toplevel;;;;1-1-1, label,--palette--;;1, thumbnail, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab3, hidden;;;;1-1-1, status;;;;2-2-2'),
), ),
'palettes' => array ( 'palettes' => array (
'1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1),
), ),
); );

View File

@ -19,265 +19,265 @@
*/ */
class ext_update { class ext_update {
/** /**
* This holds the output ready to return * This holds the output ready to return
* *
* @var string * @var string
* @access protected * @access protected
*/ */
protected $content = ''; protected $content = '';
/** /**
* Triggers the update option in the extension manager * Triggers the update option in the extension manager
* *
* @access public * @access public
* *
* @return boolean Should the update option be shown? * @return boolean Should the update option be shown?
*/ */
public function access() { public function access() {
if (count($this->getMetadataConfig())) { if (count($this->getMetadataConfig())) {
return TRUE; return TRUE;
} else if ($this->oldIndexRelatedTableNames()) { } else if ($this->oldIndexRelatedTableNames()) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
/** /**
* Get all outdated metadata configuration records * Get all outdated metadata configuration records
* *
* @access protected * @access protected
* *
* @return array Array of UIDs of outdated records * @return array Array of UIDs of outdated records
*/ */
protected function getMetadataConfig() { protected function getMetadataConfig() {
$uids = array (); $uids = array ();
// check if tx_dlf_metadata.xpath exists anyhow // check if tx_dlf_metadata.xpath exists anyhow
$fieldsInDatabase = $GLOBALS['TYPO3_DB']->admin_get_fields('tx_dlf_metadata'); $fieldsInDatabase = $GLOBALS['TYPO3_DB']->admin_get_fields('tx_dlf_metadata');
if (! in_array('xpath', array_keys($fieldsInDatabase))) { if (! in_array('xpath', array_keys($fieldsInDatabase))) {
return $uids; return $uids;
} }
// Get all records with outdated configuration. // Get all records with outdated configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.uid AS uid', 'tx_dlf_metadata.uid AS uid',
'tx_dlf_metadata', 'tx_dlf_metadata',
'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=\'\''.tx_dlf_helper::whereClause('tx_dlf_metadata'), 'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=\'\''.tx_dlf_helper::whereClause('tx_dlf_metadata'),
'', '',
'', '',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$uids[] = intval($resArray['uid']); $uids[] = intval($resArray['uid']);
} }
} }
return $uids; return $uids;
} }
/** /**
* The main method of the class * The main method of the class
* *
* @access public * @access public
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main() { public function main() {
// Load localization file. // Load localization file.
$GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml');
// Update the metadata configuration. // Update the metadata configuration.
if (count($this->getMetadataConfig())) { if (count($this->getMetadataConfig())) {
$this->updateMetadataConfig(); $this->updateMetadataConfig();
} }
if ($this->oldIndexRelatedTableNames()) { if ($this->oldIndexRelatedTableNames()) {
$this->renameIndexRelatedColumns(); $this->renameIndexRelatedColumns();
} }
return $this->content; return $this->content;
} }
/** /**
* Check for old index related colums * Check for old index related colums
* *
* @access protected * @access protected
* *
* @return boolean true if old index related columns exist * @return boolean true if old index related columns exist
*/ */
protected function oldIndexRelatedTableNames() { protected function oldIndexRelatedTableNames() {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'column_name', 'column_name',
'INFORMATION_SCHEMA.COLUMNS', 'INFORMATION_SCHEMA.COLUMNS',
'TABLE_NAME = "tx_dlf_metadata"', 'TABLE_NAME = "tx_dlf_metadata"',
'', '',
'', '',
'' ''
); );
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if($resArray['column_name'] == 'tokenized' if($resArray['column_name'] == 'tokenized'
|| $resArray['column_name'] == 'stored' || $resArray['column_name'] == 'stored'
|| $resArray['column_name'] == 'indexed' || $resArray['column_name'] == 'indexed'
|| $resArray['column_name'] == 'boost' || $resArray['column_name'] == 'boost'
|| $resArray['column_name'] == 'autocomplete') { || $resArray['column_name'] == 'autocomplete') {
return TRUE; return TRUE;
} }
} }
} }
/** /**
* Copy the data of the old index related columns to the new columns * Copy the data of the old index related columns to the new columns
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function renameIndexRelatedColumns() { protected function renameIndexRelatedColumns() {
$sqlQuery = "UPDATE tx_dlf_metadata SET `index_tokenized` = `tokenized` $sqlQuery = "UPDATE tx_dlf_metadata SET `index_tokenized` = `tokenized`
, `index_stored` = `stored` , `index_stored` = `stored`
, `index_indexed` = `indexed` , `index_indexed` = `indexed`
, `index_boost` = `boost` , `index_boost` = `boost`
, `index_autocomplete` = `autocomplete`"; , `index_autocomplete` = `autocomplete`";
// Copy the content of the old tables to the new ones // Copy the content of the old tables to the new ones
$result = $GLOBALS['TYPO3_DB']->sql_query($sqlQuery); $result = $GLOBALS['TYPO3_DB']->sql_query($sqlQuery);
if($result) { if($result) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsOkay', TRUE), $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsOkay', TRUE),
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsNotOkay', TRUE), $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsNotOkay', TRUE),
$GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
FALSE FALSE
); );
} }
$this->content .= $message->render(); $this->content .= $message->render();
} }
/** /**
* Update all outdated metadata configuration records * Update all outdated metadata configuration records
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function updateMetadataConfig() { protected function updateMetadataConfig() {
$metadataUids = $this->getMetadataConfig(); $metadataUids = $this->getMetadataConfig();
if (!empty($metadataUids)) { if (!empty($metadataUids)) {
$data = array (); $data = array ();
// Get all old metadata configuration records. // Get all old metadata configuration records.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.uid AS uid,tx_dlf_metadata.pid AS pid,tx_dlf_metadata.cruser_id AS cruser_id,tx_dlf_metadata.encoded AS encoded,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting', 'tx_dlf_metadata.uid AS uid,tx_dlf_metadata.pid AS pid,tx_dlf_metadata.cruser_id AS cruser_id,tx_dlf_metadata.encoded AS encoded,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting',
'tx_dlf_metadata', 'tx_dlf_metadata',
'tx_dlf_metadata.uid IN ('.implode(',', $metadataUids).')'.tx_dlf_helper::whereClause('tx_dlf_metadata'), 'tx_dlf_metadata.uid IN ('.implode(',', $metadataUids).')'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
'', '',
'', '',
'' ''
); );
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$newId = uniqid('NEW'); $newId = uniqid('NEW');
// Copy record to new table. // Copy record to new table.
$data['tx_dlf_metadataformat'][$newId] = array ( $data['tx_dlf_metadataformat'][$newId] = array (
'pid' => $resArray['pid'], 'pid' => $resArray['pid'],
'cruser_id' => $resArray['cruser_id'], 'cruser_id' => $resArray['cruser_id'],
'parent_id' => $resArray['uid'], 'parent_id' => $resArray['uid'],
'encoded' => $resArray['encoded'], 'encoded' => $resArray['encoded'],
'xpath' => $resArray['xpath'], 'xpath' => $resArray['xpath'],
'xpath_sorting' => $resArray['xpath_sorting'] 'xpath_sorting' => $resArray['xpath_sorting']
); );
// Add reference to old table. // Add reference to old table.
$data['tx_dlf_metadata'][$resArray['uid']]['format'] = $newId; $data['tx_dlf_metadata'][$resArray['uid']]['format'] = $newId;
} }
if (!empty($data)) { if (!empty($data)) {
// Process datamap. // Process datamap.
$substUids = tx_dlf_helper::processDBasAdmin($data); $substUids = tx_dlf_helper::processDBasAdmin($data);
unset ($data); unset ($data);
if (!empty($substUids)) { if (!empty($substUids)) {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE),
$GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
$GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE),
$GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
FALSE FALSE
); );
} }
$this->content .= $message->render(); $this->content .= $message->render();
} }
} }
} }
} }

View File

@ -11,7 +11,7 @@
if (!defined('TYPO3_cliMode')) { if (!defined('TYPO3_cliMode')) {
die('You cannot run this script directly!'); die('You cannot run this script directly!');
} }
@ -25,208 +25,208 @@ if (!defined('TYPO3_cliMode')) {
*/ */
class tx_dlf_cli extends \TYPO3\CMS\Core\Controller\CommandLineController { class tx_dlf_cli extends \TYPO3\CMS\Core\Controller\CommandLineController {
/** /**
* This is the return code. * This is the return code.
* *
* @var integer * @var integer
* @access protected * @access protected
*/ */
protected $return = 0; protected $return = 0;
/** /**
* Main function of the script. * Main function of the script.
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function main() { public function main() {
switch ((string) $this->cli_args['_DEFAULT'][1]) { switch ((string) $this->cli_args['_DEFAULT'][1]) {
// (Re-)Index a single document. // (Re-)Index a single document.
case 'index': case 'index':
// Add command line arguments. // Add command line arguments.
$this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.'); $this->cli_options[] = array ('-doc UID/URL', 'UID or (properly encoded) URL of the document.');
$this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.');
$this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.');
// Check the command line arguments. // Check the command line arguments.
$this->cli_validateArgs(); $this->cli_validateArgs();
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0]) if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-doc'][0])
&& !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) { && !\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->cli_args['-doc'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-doc'][0].'" is not a valid document UID or URL.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if ($this->return > 0) { if ($this->return > 0) {
break; break;
} }
// Get the document... // Get the document...
$doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE); $doc =& tx_dlf_document::getInstance($this->cli_args['-doc'][0], $this->cli_args['-pid'][0], TRUE);
if ($doc->ready) { if ($doc->ready) {
// ...and save it to the database... // ...and save it to the database...
if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) {
$this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE); $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" not saved and indexed.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
} else { } else {
$this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE); $this->cli_echo('ERROR: Document "'.$this->cli_args['-doc'][0].'" could not be loaded.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
break; break;
// Re-index all documents of a collection. // Re-index all documents of a collection.
case 'reindex': case 'reindex':
// Add command line arguments. // Add command line arguments.
$this->cli_options[] = array ('-coll UID', 'UID of the collection.'); $this->cli_options[] = array ('-coll UID', 'UID of the collection.');
$this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.'); $this->cli_options[] = array ('-pid UID', 'UID of the page the document should be added to.');
$this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.'); $this->cli_options[] = array ('-core UID', 'UID of the Solr core the document should be added to.');
// Check the command line arguments. // Check the command line arguments.
$this->cli_validateArgs(); $this->cli_validateArgs();
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-coll'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-coll'][0].'" is not a valid collection UID.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-pid'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-pid'][0].'" is not a valid page UID.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->cli_args['-core'][0])) {
$this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE); $this->cli_echo('ERROR: "'.$this->cli_args['-core'][0].'" is not a valid core UID.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
if ($this->return > 0) { if ($this->return > 0) {
break; break;
} }
// Get the collection. // Get the collection.
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.uid AS uid', 'tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_collections.uid='.intval($this->cli_args['-coll'][0]).' AND tx_dlf_collections.pid='.intval($this->cli_args['-pid'][0]).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'', '',
'', '',
'' ''
); );
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
// Get the document... // Get the document...
$doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE); $doc =& tx_dlf_document::getInstance($resArray['uid'], $this->cli_args['-pid'][0], TRUE);
if ($doc->ready) { if ($doc->ready) {
// ...and save it to the database... // ...and save it to the database...
if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) { if (!$doc->save(intval($this->cli_args['-pid'][0]), intval($this->cli_args['-core'][0]))) {
$this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE); $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" not saved and indexed.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
} else { } else {
$this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE); $this->cli_echo('ERROR: Document "'.$resArray['uid'].'" could not be loaded.'.LF, TRUE);
$this->return = 1; $this->return = 1;
} }
// Clear document registry to prevent memory exhaustion. // Clear document registry to prevent memory exhaustion.
tx_dlf_document::clearRegistry(); tx_dlf_document::clearRegistry();
} }
break; break;
default: default:
$this->cli_help(); $this->cli_help();
break; break;
} }
exit ($this->return); exit ($this->return);
} }
public function __construct() { public function __construct() {
// Set basic information about the script. // Set basic information about the script.
$this->cli_help = array ( $this->cli_help = array (
'name' => 'Command Line Interface for Kitodo.Presentation', 'name' => 'Command Line Interface for Kitodo.Presentation',
'synopsis' => '###OPTIONS###', 'synopsis' => '###OPTIONS###',
'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.', 'description' => 'Currently the only tasks available are "index" and "reindex".'.LF.'Try "/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK" for more options.',
'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2', 'examples' => '/PATH/TO/TYPO3/cli_dispatch.phpsh dlf TASK -ARG1=VALUE1 -ARG2=VALUE2',
'options' => '', 'options' => '',
'license' => 'GNU GPL - free software!', 'license' => 'GNU GPL - free software!',
'author' => 'Kitodo. Key to digital objects e.V. <contact@kitodo.org>', 'author' => 'Kitodo. Key to digital objects e.V. <contact@kitodo.org>',
); );
// Run parent constructor. // Run parent constructor.
parent::__construct(); parent::__construct();
} }
} }

View File

@ -19,24 +19,24 @@
*/ */
class tx_dlf_alto implements tx_dlf_fulltext { class tx_dlf_alto implements tx_dlf_fulltext {
/** /**
* This extracts the fulltext data from ALTO XML * This extracts the fulltext data from ALTO XML
* *
* @access public * @access public
* *
* @param SimpleXMLElement $xml: The XML to extract the metadata from * @param SimpleXMLElement $xml: The XML to extract the metadata from
* *
* @return string The raw unformatted fulltext * @return string The raw unformatted fulltext
*/ */
public static function getRawText(SimpleXMLElement $xml) { public static function getRawText(SimpleXMLElement $xml) {
$xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#');
// Get all (presumed) words of the text. // Get all (presumed) words of the text.
$words = $xml->xpath('./alto:Layout/alto:Page/alto:PrintSpace//alto:TextBlock/alto:TextLine/alto:String/@CONTENT'); $words = $xml->xpath('./alto:Layout/alto:Page/alto:PrintSpace//alto:TextBlock/alto:TextLine/alto:String/@CONTENT');
return implode(' ', $words); return implode(' ', $words);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,16 +20,16 @@
*/ */
interface tx_dlf_format { interface tx_dlf_format {
/** /**
* This extracts metadata from XML * This extracts metadata from XML
* *
* @access public * @access public
* *
* @param SimpleXMLElement $xml: The XML to extract the metadata from * @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill * @param array &$metadata: The metadata array to fill
* *
* @return void * @return void
*/ */
public function extractMetadata(SimpleXMLElement $xml, array &$metadata); public function extractMetadata(SimpleXMLElement $xml, array &$metadata);
} }

View File

@ -20,15 +20,15 @@
*/ */
interface tx_dlf_fulltext { interface tx_dlf_fulltext {
/** /**
* This extracts raw fulltext data from XML * This extracts raw fulltext data from XML
* *
* @access public * @access public
* *
* @param SimpleXMLElement $xml: The XML to extract the metadata from * @param SimpleXMLElement $xml: The XML to extract the metadata from
* *
* @return string The raw unformatted fulltext * @return string The raw unformatted fulltext
*/ */
public static function getRawText(SimpleXMLElement $xml); public static function getRawText(SimpleXMLElement $xml);
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,159 +19,159 @@
*/ */
class tx_dlf_mods implements tx_dlf_format { class tx_dlf_mods implements tx_dlf_format {
/** /**
* This extracts the essential MODS metadata from XML * This extracts the essential MODS metadata from XML
* *
* @access public * @access public
* *
* @param SimpleXMLElement $xml: The XML to extract the metadata from * @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill * @param array &$metadata: The metadata array to fill
* *
* @return void * @return void
*/ */
public function extractMetadata(SimpleXMLElement $xml, array &$metadata) { public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
// Get "author" and "author_sorting". // Get "author" and "author_sorting".
$authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]');
// Get "author" and "author_sorting" again if that was to sophisticated. // Get "author" and "author_sorting" again if that was to sophisticated.
if (!$authors) { if (!$authors) {
// Get all names which do not have any role term assigned and assume these are authors. // Get all names which do not have any role term assigned and assume these are authors.
$authors = $xml->xpath('./mods:name[not(./mods:role)]'); $authors = $xml->xpath('./mods:name[not(./mods:role)]');
} }
if (is_array($authors)) { if (is_array($authors)) {
for ($i = 0, $j = count($authors); $i < $j; $i++) { for ($i = 0, $j = count($authors); $i < $j; $i++) {
$authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); $authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
// Check if there is a display form. // Check if there is a display form.
if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) { if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) {
$metadata['author'][$i] = (string) $displayForm[0]; $metadata['author'][$i] = (string) $displayForm[0];
} elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) { } elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) {
$name = array (); $name = array ();
$k = 4; $k = 4;
foreach ($nameParts as $namePart) { foreach ($nameParts as $namePart) {
if (isset($namePart['type']) && (string) $namePart['type'] == 'family') { if (isset($namePart['type']) && (string) $namePart['type'] == 'family') {
$name[0] = (string) $namePart; $name[0] = (string) $namePart;
} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') { } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') {
$name[1] = (string) $namePart; $name[1] = (string) $namePart;
} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') { } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') {
$name[2] = (string) $namePart; $name[2] = (string) $namePart;
} elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') { } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') {
$name[3] = (string) $namePart; $name[3] = (string) $namePart;
} else { } else {
$name[$k] = (string) $namePart; $name[$k] = (string) $namePart;
} }
$k++; $k++;
} }
ksort($name); ksort($name);
$metadata['author'][$i] = trim(implode(', ', $name)); $metadata['author'][$i] = trim(implode(', ', $name));
} }
} }
} }
// Get "place" and "place_sorting". // Get "place" and "place_sorting".
$places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm'); $places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm');
// Get "place" and "place_sorting" again if that was to sophisticated. // Get "place" and "place_sorting" again if that was to sophisticated.
if (!$places) { if (!$places) {
// Get all places and assume these are places of publication. // Get all places and assume these are places of publication.
$places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm'); $places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm');
} }
if (is_array($places)) { if (is_array($places)) {
foreach ($places as $place) { foreach ($places as $place) {
$metadata['place'][] = (string) $place; $metadata['place'][] = (string) $place;
if (!$metadata['place_sorting'][0]) { if (!$metadata['place_sorting'][0]) {
$metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place); $metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place);
} }
} }
} }
// Get "year_sorting". // Get "year_sorting".
if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) { if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) {
foreach ($years_sorting as $year_sorting) { foreach ($years_sorting as $year_sorting) {
$metadata['year_sorting'][0] = intval($year_sorting); $metadata['year_sorting'][0] = intval($year_sorting);
} }
} }
// Get "year" and "year_sorting" if not specified separately. // Get "year" and "year_sorting" if not specified separately.
$years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]'); $years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]');
// Get "year" and "year_sorting" again if that was to sophisticated. // Get "year" and "year_sorting" again if that was to sophisticated.
if (!$years) { if (!$years) {
// Get all dates and assume these are dates of publication. // Get all dates and assume these are dates of publication.
$years = $xml->xpath('./mods:originInfo/mods:dateIssued'); $years = $xml->xpath('./mods:originInfo/mods:dateIssued');
} }
if (is_array($years)) { if (is_array($years)) {
foreach ($years as $year) { foreach ($years as $year) {
$metadata['year'][] = (string) $year; $metadata['year'][] = (string) $year;
if (!$metadata['year_sorting'][0]) { if (!$metadata['year_sorting'][0]) {
$year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year)); $year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year));
if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) { if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) {
$year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50; $year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50;
} }
$metadata['year_sorting'][0] = intval($year_sorting); $metadata['year_sorting'][0] = intval($year_sorting);
} }
} }
} }
} }
} }

View File

@ -20,115 +20,115 @@
*/ */
abstract class tx_dlf_module extends \TYPO3\CMS\Backend\Module\BaseScriptClass { abstract class tx_dlf_module extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
public $extKey = 'dlf'; public $extKey = 'dlf';
public $prefixId = 'tx_dlf'; public $prefixId = 'tx_dlf';
/** /**
* Holds the path to this module relative to 'EXT:dlf/modules/' and with trailing slash * Holds the path to this module relative to 'EXT:dlf/modules/' and with trailing slash
* *
* @var string * @var string
* @access protected * @access protected
*/ */
protected $modPath = ''; protected $modPath = '';
/** /**
* Holds the page record if access granted or FALSE if access denied * Holds the page record if access granted or FALSE if access denied
* *
* @var mixed * @var mixed
* @access protected * @access protected
*/ */
protected $pageInfo; protected $pageInfo;
/** /**
* Holds the module's button array * Holds the module's button array
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $buttonArray = array (); protected $buttonArray = array ();
/** /**
* Holds the module's marker array * Holds the module's marker array
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $markerArray = array (); protected $markerArray = array ();
/** /**
* Holds the module's subpart array * Holds the module's subpart array
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $subpartArray = array (); protected $subpartArray = array ();
/** /**
* Holds the TYPO3_CONF_VARS array of this extension * Holds the TYPO3_CONF_VARS array of this extension
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $conf = array (); protected $conf = array ();
/** /**
* Holds the submitted form's data * Holds the submitted form's data
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $data; protected $data;
/** /**
* Initializes the backend module by setting internal variables, initializing the menu. * Initializes the backend module by setting internal variables, initializing the menu.
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
$GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], 1); $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], 1);
$GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/modules/'.$this->modPath.'locallang.xml'); $GLOBALS['LANG']->includeLLFile('EXT:'.$this->extKey.'/modules/'.$this->modPath.'locallang.xml');
$this->setMOD_MENU(); $this->setMOD_MENU();
parent::init(); parent::init();
$this->conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); $this->conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
$this->pageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $this->pageInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->setModuleTemplate('EXT:'.$this->extKey.'/modules/'.$this->modPath.'template.tmpl'); $this->doc->setModuleTemplate('EXT:'.$this->extKey.'/modules/'.$this->modPath.'template.tmpl');
$this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'res/backend.css'); $this->doc->getPageRenderer()->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'res/backend.css');
$this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"'; $this->doc->bodyTagAdditions = 'class="ext-'.$this->extKey.'-modules"';
$this->doc->form = '<form action="" method="post" enctype="multipart/form-data">'; $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
$this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); $this->data = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
} }
/** /**
* Sets the module's MOD_MENU configuration. * Sets the module's MOD_MENU configuration.
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function setMOD_MENU() { protected function setMOD_MENU() {
// Set $this->MOD_MENU array here or leave empty. // Set $this->MOD_MENU array here or leave empty.
/* Example code: /* Example code:
$this->MOD_MENU = array ( $this->MOD_MENU = array (
'function' => array ( 'function' => array (
'1' => $GLOBALS['LANG']->getLL('function1'), '1' => $GLOBALS['LANG']->getLL('function1'),
@ -137,30 +137,30 @@ abstract class tx_dlf_module extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
) )
); */ ); */
} }
/** /**
* Main function of the module. * Main function of the module.
* *
* @access public * @access public
* *
* @abstract * @abstract
* *
* @return void * @return void
*/ */
abstract public function main(); abstract public function main();
/** /**
* Outputs all contents. * Outputs all contents.
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function printContent() { protected function printContent() {
// Add Javascript for function menu. // Add Javascript for function menu.
$this->doc->JScode .= ' $this->doc->JScode .= '
<script type="text/javascript"> <script type="text/javascript">
script_ended = 0; script_ended = 0;
function jumpToUrl(URL) { function jumpToUrl(URL) {
@ -168,46 +168,46 @@ abstract class tx_dlf_module extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
} }
</script>'; </script>';
// Add Javascript for convenient module switch. // Add Javascript for convenient module switch.
$this->doc->postCode .= ' $this->doc->postCode .= '
<script type="text/javascript"> <script type="text/javascript">
script_ended = 1; script_ended = 1;
</script>'; </script>';
// Render output. // Render output.
$this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
// Set defaults for buttons and menu. // Set defaults for buttons and menu.
if (empty($this->buttonArray['RELOAD'])) { if (empty($this->buttonArray['RELOAD'])) {
$this->buttonArray['RELOAD'] = '<a href="'.$GLOBALS['MCONF']['_'].'" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE).'">'.\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh').'</a>'; $this->buttonArray['RELOAD'] = '<a href="'.$GLOBALS['MCONF']['_'].'" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE).'">'.\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh').'</a>';
} }
if (empty($this->buttonArray['SHORTCUT'])) { if (empty($this->buttonArray['SHORTCUT'])) {
$this->buttonArray['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']); $this->buttonArray['SHORTCUT'] = $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
} }
if (empty($this->markerArray['CSH'])) { if (empty($this->markerArray['CSH'])) {
$this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh', $GLOBALS['BACK_PATH'], '', TRUE); $this->markerArray['CSH'] = \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem('_MOD_'.$GLOBALS['MCONF']['name'], 'csh', $GLOBALS['BACK_PATH'], '', TRUE);
} }
if (empty($this->markerArray['MOD_MENU'])) { if (empty($this->markerArray['MOD_MENU'])) {
$this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']); $this->markerArray['MOD_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
} }
$this->content .= $this->doc->moduleBody($this->pageInfo, $this->buttonArray, $this->markerArray, $this->subpartArray); $this->content .= $this->doc->moduleBody($this->pageInfo, $this->buttonArray, $this->markerArray, $this->subpartArray);
$this->content .= $this->doc->endPage(); $this->content .= $this->doc->endPage();
echo $this->content; echo $this->content;
} }
} }

View File

@ -20,320 +20,320 @@
*/ */
abstract class tx_dlf_plugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { abstract class tx_dlf_plugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
public $extKey = 'dlf'; public $extKey = 'dlf';
public $prefixId = 'tx_dlf'; public $prefixId = 'tx_dlf';
public $scriptRelPath = 'common/class.tx_dlf_plugin.php'; public $scriptRelPath = 'common/class.tx_dlf_plugin.php';
// Plugins are cached by default (@see setCache()). // Plugins are cached by default (@see setCache()).
public $pi_USER_INT_obj = FALSE; public $pi_USER_INT_obj = FALSE;
public $pi_checkCHash = TRUE; public $pi_checkCHash = TRUE;
/** /**
* This holds the current document * This holds the current document
* *
* @var tx_dlf_document * @var tx_dlf_document
* @access protected * @access protected
*/ */
protected $doc; protected $doc;
/** /**
* This holds the plugin's parsed template * This holds the plugin's parsed template
* *
* @var string * @var string
* @access protected * @access protected
*/ */
protected $template = ''; protected $template = '';
/** /**
* All the needed configuration values are stored in class variables * All the needed configuration values are stored in class variables
* Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php * Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php
* *
* @access protected * @access protected
* *
* @param array $conf: configuration array from TS-Template * @param array $conf: configuration array from TS-Template
* *
* @return void * @return void
*/ */
protected function init(array $conf) { protected function init(array $conf) {
// Read FlexForm configuration. // Read FlexForm configuration.
$flexFormConf = array (); $flexFormConf = array ();
$this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf); $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf);
if (!empty($flexFormConf)) { if (!empty($flexFormConf)) {
$conf = tx_dlf_helper::array_merge_recursive_overrule($flexFormConf, $conf); $conf = tx_dlf_helper::array_merge_recursive_overrule($flexFormConf, $conf);
} }
// Read plugin TS configuration. // Read plugin TS configuration.
$pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][get_class($this).'.']; $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][get_class($this).'.'];
if (is_array($pluginConf)) { if (is_array($pluginConf)) {
$conf = tx_dlf_helper::array_merge_recursive_overrule($pluginConf, $conf); $conf = tx_dlf_helper::array_merge_recursive_overrule($pluginConf, $conf);
} }
// Read general TS configuration. // Read general TS configuration.
$generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.']; $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
if (is_array($generalConf)) { if (is_array($generalConf)) {
$conf = tx_dlf_helper::array_merge_recursive_overrule($generalConf, $conf); $conf = tx_dlf_helper::array_merge_recursive_overrule($generalConf, $conf);
} }
// Read extension configuration. // Read extension configuration.
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]);
if (is_array($extConf)) { if (is_array($extConf)) {
$conf = tx_dlf_helper::array_merge_recursive_overrule($extConf, $conf); $conf = tx_dlf_helper::array_merge_recursive_overrule($extConf, $conf);
} }
// Read TYPO3_CONF_VARS configuration. // Read TYPO3_CONF_VARS configuration.
$varsConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]; $varsConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey];
if (is_array($varsConf)) { if (is_array($varsConf)) {
$conf = tx_dlf_helper::array_merge_recursive_overrule($varsConf, $conf); $conf = tx_dlf_helper::array_merge_recursive_overrule($varsConf, $conf);
} }
$this->conf = $conf; $this->conf = $conf;
// Set default plugin variables. // Set default plugin variables.
$this->pi_setPiVarDefaults(); $this->pi_setPiVarDefaults();
// Load translation files. // Load translation files.
$this->pi_loadLL(); $this->pi_loadLL();
} }
/** /**
* Loads the current document into $this->doc * Loads the current document into $this->doc
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function loadDocument() { protected function loadDocument() {
// Check for required variable. // Check for required variable.
if (!empty($this->piVars['id']) && !empty($this->conf['pages'])) { if (!empty($this->piVars['id']) && !empty($this->conf['pages'])) {
// Should we exclude documents from other pages than $this->conf['pages']? // Should we exclude documents from other pages than $this->conf['pages']?
$pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0); $pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0);
// Get instance of tx_dlf_document. // Get instance of tx_dlf_document.
$this->doc =& tx_dlf_document::getInstance($this->piVars['id'], $pid); $this->doc =& tx_dlf_document::getInstance($this->piVars['id'], $pid);
if (!$this->doc->ready) { if (!$this->doc->ready) {
// Destroy the incomplete object. // Destroy the incomplete object.
$this->doc = NULL; $this->doc = NULL;
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
} }
} else { } else {
// Set configuration PID. // Set configuration PID.
$this->doc->cPid = $this->conf['pages']; $this->doc->cPid = $this->conf['pages'];
} }
} elseif (!empty($this->piVars['recordId'])) { } elseif (!empty($this->piVars['recordId'])) {
// Get UID of document with given record identifier. // Get UID of document with given record identifier.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) {
list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
// Set superglobal $_GET array. // Set superglobal $_GET array.
$_GET[$this->prefixId]['id'] = $this->piVars['id']; $_GET[$this->prefixId]['id'] = $this->piVars['id'];
// Unset variable to avoid infinite looping. // Unset variable to avoid infinite looping.
unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']);
// Try to load document. // Try to load document.
$this->loadDocument(); $this->loadDocument();
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR);
} }
} }
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR);
} }
} }
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @abstract * @abstract
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
abstract public function main($content, $conf); abstract public function main($content, $conf);
/** /**
* Sets default plugin variables from Typoscript * Sets default plugin variables from Typoscript
* (stdWrap backport from TYPO3 6.2) * (stdWrap backport from TYPO3 6.2)
* @see http://forge.typo3.org/issues/22045 * @see http://forge.typo3.org/issues/22045
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function pi_setPiVarDefaults() { public function pi_setPiVarDefaults() {
if (is_array($this->conf['_DEFAULT_PI_VARS.'])) { if (is_array($this->conf['_DEFAULT_PI_VARS.'])) {
foreach ($this->conf['_DEFAULT_PI_VARS.'] as $GPkey => $GPval) { foreach ($this->conf['_DEFAULT_PI_VARS.'] as $GPkey => $GPval) {
if (strpos($GPkey,'.')) { if (strpos($GPkey,'.')) {
$GPkey = substr($GPkey, 0, -1); $GPkey = substr($GPkey, 0, -1);
} }
if (is_array($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.'])) { if (is_array($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.'])) {
$GPval = $GPval ? $GPval : ''; $GPval = $GPval ? $GPval : '';
$this->conf['_DEFAULT_PI_VARS.'][$GPkey] = $this->cObj->stdWrap($GPval, $this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); $this->conf['_DEFAULT_PI_VARS.'][$GPkey] = $this->cObj->stdWrap($GPval, $this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']);
unset ($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); unset ($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']);
} }
} }
$this->piVars = tx_dlf_helper::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array()); $this->piVars = tx_dlf_helper::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array());
} }
} }
/** /**
* Wraps the input string in a tag with the class attribute set to the class name * Wraps the input string in a tag with the class attribute set to the class name
* *
* @access public * @access public
* *
* @param string $content: HTML content to wrap in the div-tags with the "main class" of the plugin * @param string $content: HTML content to wrap in the div-tags with the "main class" of the plugin
* *
* @return string HTML content wrapped, ready to return to the parent object. * @return string HTML content wrapped, ready to return to the parent object.
*/ */
public function pi_wrapInBaseClass($content) { public function pi_wrapInBaseClass($content) {
if (!$GLOBALS['TSFE']->config['config']['disableWrapInBaseClass']) { if (!$GLOBALS['TSFE']->config['config']['disableWrapInBaseClass']) {
// Use get_class($this) instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. // Use get_class($this) instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins.
$content = '<div class="'.str_replace('_', '-', get_class($this)).'">'.$content.'</div>'; $content = '<div class="'.str_replace('_', '-', get_class($this)).'">'.$content.'</div>';
if (!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) { if (!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {
$content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n"; $content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n";
} }
} }
return $content; return $content;
} }
/** /**
* Parses a string into a Typoscript array * Parses a string into a Typoscript array
* *
* @access protected * @access protected
* *
* @param string $string: The string to parse * @param string $string: The string to parse
* *
* @return array The resulting typoscript array * @return array The resulting typoscript array
*/ */
protected function parseTS($string = '') { protected function parseTS($string = '') {
$parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser'); $parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
$parser->parse($string); $parser->parse($string);
return $parser->setup; return $parser->setup;
} }
/** /**
* Sets some configuration variables if the plugin is cached. * Sets some configuration variables if the plugin is cached.
* *
* @access protected * @access protected
* *
* @param boolean $cache: Should the plugin be cached? * @param boolean $cache: Should the plugin be cached?
* *
* @return void * @return void
*/ */
protected function setCache($cache = TRUE) { protected function setCache($cache = TRUE) {
if ($cache) { if ($cache) {
// Set cObject type to "USER" (default). // Set cObject type to "USER" (default).
$this->pi_USER_INT_obj = FALSE; $this->pi_USER_INT_obj = FALSE;
$this->pi_checkCHash = TRUE; $this->pi_checkCHash = TRUE;
if (count($this->piVars)) { if (count($this->piVars)) {
// Check cHash or disable caching. // Check cHash or disable caching.
$GLOBALS['TSFE']->reqCHash(); $GLOBALS['TSFE']->reqCHash();
} }
} else { } else {
// Set cObject type to "USER_INT". // Set cObject type to "USER_INT".
$this->pi_USER_INT_obj = TRUE; $this->pi_USER_INT_obj = TRUE;
$this->pi_checkCHash = FALSE; $this->pi_checkCHash = FALSE;
// Plugins are of type "USER" by default, so convert it to "USER_INT". // Plugins are of type "USER" by default, so convert it to "USER_INT".
$this->cObj->convertToUserIntObject(); $this->cObj->convertToUserIntObject();
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -19,20 +19,20 @@
*/ */
class tx_dlf_teihdr implements tx_dlf_format { class tx_dlf_teihdr implements tx_dlf_format {
/** /**
* This extracts the essential TEIHDR metadata from XML * This extracts the essential TEIHDR metadata from XML
* *
* @access public * @access public
* *
* @param SimpleXMLElement $xml: The XML to extract the metadata from * @param SimpleXMLElement $xml: The XML to extract the metadata from
* @param array &$metadata: The metadata array to fill * @param array &$metadata: The metadata array to fill
* *
* @return void * @return void
*/ */
public function extractMetadata(SimpleXMLElement $xml, array &$metadata) { public function extractMetadata(SimpleXMLElement $xml, array &$metadata) {
$xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0'); $xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0');
} }
} }

View File

@ -12,45 +12,45 @@
$extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('dlf'); $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('dlf');
return array ( return array (
'tx_dlf_cli' => $extensionPath.'cli/class.tx_dlf_cli.php', 'tx_dlf_cli' => $extensionPath.'cli/class.tx_dlf_cli.php',
'tx_dlf_alto' => $extensionPath.'common/class.tx_dlf_alto.php', 'tx_dlf_alto' => $extensionPath.'common/class.tx_dlf_alto.php',
'tx_dlf_document' => $extensionPath.'common/class.tx_dlf_document.php', 'tx_dlf_document' => $extensionPath.'common/class.tx_dlf_document.php',
'tx_dlf_format' => $extensionPath.'common/class.tx_dlf_format.php', 'tx_dlf_format' => $extensionPath.'common/class.tx_dlf_format.php',
'tx_dlf_fulltext' => $extensionPath.'common/class.tx_dlf_fulltext.php', 'tx_dlf_fulltext' => $extensionPath.'common/class.tx_dlf_fulltext.php',
'tx_dlf_helper' => $extensionPath.'common/class.tx_dlf_helper.php', 'tx_dlf_helper' => $extensionPath.'common/class.tx_dlf_helper.php',
'tx_dlf_indexing' => $extensionPath.'common/class.tx_dlf_indexing.php', 'tx_dlf_indexing' => $extensionPath.'common/class.tx_dlf_indexing.php',
'tx_dlf_list' => $extensionPath.'common/class.tx_dlf_list.php', 'tx_dlf_list' => $extensionPath.'common/class.tx_dlf_list.php',
'tx_dlf_mods' => $extensionPath.'common/class.tx_dlf_mods.php', 'tx_dlf_mods' => $extensionPath.'common/class.tx_dlf_mods.php',
'tx_dlf_module' => $extensionPath.'common/class.tx_dlf_module.php', 'tx_dlf_module' => $extensionPath.'common/class.tx_dlf_module.php',
'tx_dlf_plugin' => $extensionPath.'common/class.tx_dlf_plugin.php', 'tx_dlf_plugin' => $extensionPath.'common/class.tx_dlf_plugin.php',
'tx_dlf_solr' => $extensionPath.'common/class.tx_dlf_solr.php', 'tx_dlf_solr' => $extensionPath.'common/class.tx_dlf_solr.php',
'tx_dlf_teihdr' => $extensionPath.'common/class.tx_dlf_teihdr.php', 'tx_dlf_teihdr' => $extensionPath.'common/class.tx_dlf_teihdr.php',
'tx_dlf_doctype' => $extensionPath.'hooks/class.tx_dlf_doctype.php', 'tx_dlf_doctype' => $extensionPath.'hooks/class.tx_dlf_doctype.php',
'tx_dlf_em' => $extensionPath.'hooks/class.tx_dlf_em.php', 'tx_dlf_em' => $extensionPath.'hooks/class.tx_dlf_em.php',
'tx_dlf_hacks' => $extensionPath.'hooks/class.tx_dlf_hacks.php', 'tx_dlf_hacks' => $extensionPath.'hooks/class.tx_dlf_hacks.php',
'tx_dlf_tceforms' => $extensionPath.'hooks/class.tx_dlf_tceforms.php', 'tx_dlf_tceforms' => $extensionPath.'hooks/class.tx_dlf_tceforms.php',
'tx_dlf_tcemain' => $extensionPath.'hooks/class.tx_dlf_tcemain.php', 'tx_dlf_tcemain' => $extensionPath.'hooks/class.tx_dlf_tcemain.php',
'tx_dlf_modIndexing' => $extensionPath.'modules/indexing/index.php', 'tx_dlf_modIndexing' => $extensionPath.'modules/indexing/index.php',
'tx_dlf_modNewclient' => $extensionPath.'modules/newclient/index.php', 'tx_dlf_modNewclient' => $extensionPath.'modules/newclient/index.php',
'tx_dlf_audioplayer' => $extensionPath.'plugins/audioplayer/class.tx_dlf_audioplayer.php', 'tx_dlf_audioplayer' => $extensionPath.'plugins/audioplayer/class.tx_dlf_audioplayer.php',
'tx_dlf_basket' => $extensionPath.'plugins/basket/class.tx_dlf_basket.php', 'tx_dlf_basket' => $extensionPath.'plugins/basket/class.tx_dlf_basket.php',
'tx_dlf_collection' => $extensionPath.'plugins/collection/class.tx_dlf_collection.php', 'tx_dlf_collection' => $extensionPath.'plugins/collection/class.tx_dlf_collection.php',
'tx_dlf_feeds' => $extensionPath.'plugins/feeds/class.tx_dlf_feeds.php', 'tx_dlf_feeds' => $extensionPath.'plugins/feeds/class.tx_dlf_feeds.php',
'tx_dlf_listview' => $extensionPath.'plugins/listview/class.tx_dlf_listview.php', 'tx_dlf_listview' => $extensionPath.'plugins/listview/class.tx_dlf_listview.php',
'tx_dlf_metadata' => $extensionPath.'plugins/metadata/class.tx_dlf_metadata.php', 'tx_dlf_metadata' => $extensionPath.'plugins/metadata/class.tx_dlf_metadata.php',
'tx_dlf_navigation' => $extensionPath.'plugins/navigation/class.tx_dlf_navigation.php', 'tx_dlf_navigation' => $extensionPath.'plugins/navigation/class.tx_dlf_navigation.php',
'tx_dlf_newspaper' => $extensionPath.'plugins/newspaper/class.tx_dlf_newspaper.php', 'tx_dlf_newspaper' => $extensionPath.'plugins/newspaper/class.tx_dlf_newspaper.php',
'tx_dlf_oai' => $extensionPath.'plugins/oai/class.tx_dlf_oai.php', 'tx_dlf_oai' => $extensionPath.'plugins/oai/class.tx_dlf_oai.php',
'tx_dlf_pagegrid' => $extensionPath.'plugins/pagegrid/class.tx_dlf_pagegrid.php', 'tx_dlf_pagegrid' => $extensionPath.'plugins/pagegrid/class.tx_dlf_pagegrid.php',
'tx_dlf_pageview' => $extensionPath.'plugins/pageview/class.tx_dlf_pageview.php', 'tx_dlf_pageview' => $extensionPath.'plugins/pageview/class.tx_dlf_pageview.php',
'tx_dlf_search' => $extensionPath.'plugins/search/class.tx_dlf_search.php', 'tx_dlf_search' => $extensionPath.'plugins/search/class.tx_dlf_search.php',
'tx_dlf_search_suggest' => $extensionPath.'plugins/search/class.tx_dlf_search_suggest.php', 'tx_dlf_search_suggest' => $extensionPath.'plugins/search/class.tx_dlf_search_suggest.php',
'tx_dlf_statistics' => $extensionPath.'plugins/statistics/class.tx_dlf_statistics.php', 'tx_dlf_statistics' => $extensionPath.'plugins/statistics/class.tx_dlf_statistics.php',
'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php', 'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php',
'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php', 'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php',
'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php', 'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php',
'tx_dlf_toolsFulltext' => $extensionPath.'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php', 'tx_dlf_toolsFulltext' => $extensionPath.'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php',
'tx_dlf_toolsImagemanipulation' => $extensionPath.'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php', 'tx_dlf_toolsImagemanipulation' => $extensionPath.'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php',
'tx_dlf_toolsImagedownload' => $extensionPath.'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php', 'tx_dlf_toolsImagedownload' => $extensionPath.'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php',
'tx_dlf_validator' => $extensionPath.'plugins/validator/class.tx_dlf_validator.php' 'tx_dlf_validator' => $extensionPath.'plugins/validator/class.tx_dlf_validator.php'
); );

View File

@ -10,32 +10,32 @@
*/ */
$EM_CONF[$_EXTKEY] = array( $EM_CONF[$_EXTKEY] = array(
'title' => 'Kitodo.Presentation', 'title' => 'Kitodo.Presentation',
'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Kitodo Digitization Suite.', 'description' => 'Base plugins, modules, services and API of the Digital Library Framework. It is part of the community-based Kitodo Digitization Suite.',
'category' => 'fe', 'category' => 'fe',
'author' => 'Kitodo. Key to digital objects e.V.', 'author' => 'Kitodo. Key to digital objects e.V.',
'author_email' => 'contact@kitodo.org', 'author_email' => 'contact@kitodo.org',
'author_company' => '<br /><a href="http://www.kitodo.org/" target="_blank">Kitodo.org</a><br /><a href="https://github.com/kitodo" target="_blank">Kitodo on GitHub</a>', 'author_company' => '<br /><a href="http://www.kitodo.org/" target="_blank">Kitodo.org</a><br /><a href="https://github.com/kitodo" target="_blank">Kitodo on GitHub</a>',
'shy' => '', 'shy' => '',
'priority' => '', 'priority' => '',
'module' => '', 'module' => '',
'state' => 'stable', 'state' => 'stable',
'internal' => '', 'internal' => '',
'uploadfolder' => TRUE, 'uploadfolder' => TRUE,
'createDirs' => '', 'createDirs' => '',
'modify_tables' => '', 'modify_tables' => '',
'clearCacheOnLoad' => FALSE, 'clearCacheOnLoad' => FALSE,
'lockType' => '', 'lockType' => '',
'version' => '2.1.0', 'version' => '2.1.0',
'constraints' => array( 'constraints' => array(
'depends' => array( 'depends' => array(
'php' => '5.3.7-', 'php' => '5.3.7-',
'typo3' => '6.2.0-7.9.99', 'typo3' => '6.2.0-7.9.99',
), ),
'conflicts' => array( 'conflicts' => array(
), ),
'suggests' => array( 'suggests' => array(
), ),
), ),
'_md5_values_when_last_written' => '', '_md5_values_when_last_written' => '',
); );

View File

@ -74,7 +74,7 @@ $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_geturl_eid'] = 'EXT:'.$
if (TYPO3_MODE === 'FE') { if (TYPO3_MODE === 'FE') {
/* /*
* docTypeCheck user function to use in Typoscript * docTypeCheck user function to use in Typoscript
* *
* @access public * @access public
@ -88,12 +88,12 @@ if (TYPO3_MODE === 'FE') {
* *
* @return boolean TRUE if document type matches, FALSE if not * @return boolean TRUE if document type matches, FALSE if not
**/ **/
function user_dlf_docTypeCheck($type) { function user_dlf_docTypeCheck($type) {
$hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype'); $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_doctype');
return ($hook->getDocType() === $type); return ($hook->getDocType() === $type);
} }
} }

View File

@ -165,46 +165,46 @@ $TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_validator'] =
// Register modules. // Register modules.
if (TYPO3_MODE == 'BE') { if (TYPO3_MODE == 'BE') {
// Add modules after "web". // Add modules after "web".
if (!isset($TBE_MODULES['txdlfmodules'])) { if (!isset($TBE_MODULES['txdlfmodules'])) {
$modules = array(); $modules = array();
foreach($TBE_MODULES as $key => $val) { foreach($TBE_MODULES as $key => $val) {
if ($key == 'web') { if ($key == 'web') {
$modules[$key] = $val; $modules[$key] = $val;
$modules['txdlfmodules'] = ''; $modules['txdlfmodules'] = '';
} else { } else {
$modules[$key] = $val; $modules[$key] = $val;
} }
} }
$TBE_MODULES = $modules; $TBE_MODULES = $modules;
unset($modules); unset($modules);
} }
// Main "dlf" module. // Main "dlf" module.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', '', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', '', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent('txdlfmodules', 'typo3-pagetree'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent('txdlfmodules', 'typo3-pagetree');
// Module "indexing". // Module "indexing".
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfindexing', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/indexing/'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfindexing', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/indexing/');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfindexing','EXT:dlf/modules/indexing/locallang_mod.xml'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfindexing','EXT:dlf/modules/indexing/locallang_mod.xml');
// Module "newclient". // Module "newclient".
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfnewclient', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/newclient/'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('txdlfmodules', 'txdlfnewclient', '', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'modules/newclient/');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfnewclient','EXT:dlf/modules/newclient/locallang_mod.xml'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_txdlfmodules_txdlfnewclient','EXT:dlf/modules/newclient/locallang_mod.xml');
} }

View File

@ -20,61 +20,61 @@
*/ */
class tx_dlf_doctype { class tx_dlf_doctype {
/** /**
* This holds the current document * This holds the current document
* *
* @var tx_dlf_document * @var tx_dlf_document
* @access protected * @access protected
*/ */
protected $doc; protected $doc;
/** /**
* This holds the extension key * This holds the extension key
* *
* @var string * @var string
* @access protected * @access protected
*/ */
protected $extKey = 'dlf'; protected $extKey = 'dlf';
/** /**
* This holds the current DLF plugin parameters * This holds the current DLF plugin parameters
* @see __contruct() * @see __contruct()
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $piVars = array (); protected $piVars = array ();
/** /**
* This holds the DLF parameter prefix * This holds the DLF parameter prefix
* *
* @var string * @var string
* @access protected * @access protected
*/ */
protected $prefixId = 'tx_dlf'; protected $prefixId = 'tx_dlf';
/** /**
* Check the current document's type. * Check the current document's type.
* *
* @access public * @access public
* *
* @return string The type of the current document * @return string The type of the current document
*/ */
public function getDocType() { public function getDocType() {
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if document not available. // Quit without doing anything if document not available.
return ''; return '';
} }
$toc = $this->doc->tableOfContents; $toc = $this->doc->tableOfContents;
/* /*
* Get the document type * Get the document type
* *
* 1. newspaper * 1. newspaper
@ -88,145 +88,145 @@ class tx_dlf_doctype {
* - children array([0]) --> type = month * - children array([0]) --> type = month
* - children array([0], [1], [2], ...) --> type = day --> Issue * - children array([0], [1], [2], ...) --> type = day --> Issue
*/ */
switch ($toc[0]['type']) { switch ($toc[0]['type']) {
case 'newspaper': case 'newspaper':
$nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]'); $nodes_year = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]');
if (count($nodes_year) > 1) { if (count($nodes_year) > 1) {
// Multiple years means this is a newspaper's anchor file. // Multiple years means this is a newspaper's anchor file.
return 'newspaper'; return 'newspaper';
} else { } else {
$nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]'); $nodes_month = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]');
$nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]'); $nodes_day = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]/mets:div[@TYPE="month"]/mets:div[@TYPE="day"]');
$nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]'); $nodes_issue = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]');
$nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID'); $nodes_issue_current = $this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="newspaper"]/mets:div[@TYPE="year"]//mets:div[@TYPE="issue"]/@DMDID');
if (count($nodes_year) == 1 && count($nodes_issue) == 0) { if (count($nodes_year) == 1 && count($nodes_issue) == 0) {
// It's possible to have only one year in the newspaper's anchor file. // It's possible to have only one year in the newspaper's anchor file.
return 'newspaper'; return 'newspaper';
} elseif (count($nodes_year) == 1 && count($nodes_month) > 1) { } elseif (count($nodes_year) == 1 && count($nodes_month) > 1) {
// One year, multiple months means this is a year's anchor file. // One year, multiple months means this is a year's anchor file.
return 'year'; return 'year';
} elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) { } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) > 1) {
// One year, one month, one or more days means this is a year's anchor file. // One year, one month, one or more days means this is a year's anchor file.
return 'year'; return 'year';
} elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) { } elseif (count($nodes_year) == 1 && count($nodes_month) == 1 && count($nodes_day) == 1 && count($nodes_issue_current) == 0) {
// One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file. // One year, one month, a single day, one or more issues (but not the current one) means this is a year's anchor file.
return 'year'; return 'year';
} else { } else {
// In all other cases we assume it's newspaper's issue. // In all other cases we assume it's newspaper's issue.
return 'issue'; return 'issue';
} }
} }
break; break;
default: default:
return $toc[0]['type']; return $toc[0]['type'];
} }
} }
/** /**
* Loads the current document into $this->doc * Loads the current document into $this->doc
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function loadDocument() { protected function loadDocument() {
// Check for required variable. // Check for required variable.
if (!empty($this->piVars['id'])) { if (!empty($this->piVars['id'])) {
// Get instance of tx_dlf_document. // Get instance of tx_dlf_document.
$this->doc =& tx_dlf_document::getInstance($this->piVars['id']); $this->doc =& tx_dlf_document::getInstance($this->piVars['id']);
if (!$this->doc->ready) { if (!$this->doc->ready) {
// Destroy the incomplete object. // Destroy the incomplete object.
$this->doc = NULL; $this->doc = NULL;
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
} elseif (!empty($this->piVars['recordId'])) { } elseif (!empty($this->piVars['recordId'])) {
// Get UID of document with given record identifier. // Get UID of document with given record identifier.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) {
list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
// Set superglobal $_GET array. // Set superglobal $_GET array.
$_GET[$this->prefixId]['id'] = $this->piVars['id']; $_GET[$this->prefixId]['id'] = $this->piVars['id'];
// Unset variable to avoid infinite looping. // Unset variable to avoid infinite looping.
unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']);
// Try to load document. // Try to load document.
$this->loadDocument(); $this->loadDocument();
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_doctype->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
} }
} }
/** /**
* Initializes the hook by setting initial variables. * Initializes the hook by setting initial variables.
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function __construct() { public function __construct() {
// Load current plugin parameters. // Load current plugin parameters.
$this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId); $this->piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($this->prefixId);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -19,69 +19,69 @@
*/ */
class tx_dlf_hacks { class tx_dlf_hacks {
/** /**
* Hook for the __construct() method of dlf/common/class.tx_dlf_document.php * Hook for the __construct() method of dlf/common/class.tx_dlf_document.php
* When using Kitodo.Production the record identifier is saved only in MODS, but not * When using Kitodo.Production the record identifier is saved only in MODS, but not
* in METS. To get it anyway, we have to do some magic. * in METS. To get it anyway, we have to do some magic.
* *
* @access public * @access public
* *
* @param SimpleXMLElement &$xml: The XML object * @param SimpleXMLElement &$xml: The XML object
* @param mixed $record_id: The record identifier * @param mixed $record_id: The record identifier
* *
* @return void * @return void
*/ */
public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) { public function construct_postProcessRecordId(SimpleXMLElement &$xml, &$record_id) {
if (!$record_id) { if (!$record_id) {
$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
// Get all logical structure nodes with metadata, but without associated METS-Pointers. // Get all logical structure nodes with metadata, but without associated METS-Pointers.
if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) { if (($divs = $xml->xpath('//mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'))) {
$smLinks = $xml->xpath('//mets:structLink/mets:smLink'); $smLinks = $xml->xpath('//mets:structLink/mets:smLink');
if ($smLinks) { if ($smLinks) {
foreach ($smLinks as $smLink) { foreach ($smLinks as $smLink) {
$links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to; $links[(string) $smLink->attributes('http://www.w3.org/1999/xlink')->from][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->to;
} }
foreach ($divs as $div) { foreach ($divs as $div) {
if (!empty($links[(string) $div['ID']])) { if (!empty($links[(string) $div['ID']])) {
$id = (string) $div['DMDID']; $id = (string) $div['DMDID'];
break; break;
} }
} }
} }
if (empty($id)) { if (empty($id)) {
$id = (string) $divs[0]['DMDID']; $id = (string) $divs[0]['DMDID'];
} }
$recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier'); $recordIds = $xml->xpath('//mets:dmdSec[@ID="'.$id.'"]//mods:mods/mods:recordInfo/mods:recordIdentifier');
if (!empty($recordIds[0])) { if (!empty($recordIds[0])) {
$record_id = (string) $recordIds[0]; $record_id = (string) $recordIds[0];
} }
} }
} }
} }
} }

View File

@ -19,393 +19,393 @@
*/ */
class tx_dlf_tceforms { class tx_dlf_tceforms {
/** /**
* Helper to display document's thumbnail for table "tx_dlf_documents" * Helper to display document's thumbnail for table "tx_dlf_documents"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return string HTML <img> tag for thumbnail * @return string HTML <img> tag for thumbnail
*/ */
public function displayThumbnail(&$params, &$pObj) { public function displayThumbnail(&$params, &$pObj) {
$output = '<div style="padding:5px; background-color:#000000;">'; $output = '<div style="padding:5px; background-color:#000000;">';
// Simulate TCA field type "passthrough". // Simulate TCA field type "passthrough".
$output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />'; $output .= '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />';
if (!empty($params['itemFormElValue'])) { if (!empty($params['itemFormElValue'])) {
$output .= '<img alt="" src="'.$params['itemFormElValue'].'" />'; $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />';
} }
$output .= '</div>'; $output .= '</div>';
return $output; return $output;
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_collection" * Helper to get flexform's items array for plugin "tx_dlf_collection"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_collectionList(&$params, &$pObj) { public function itemsProcFunc_collectionList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6 // the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) { if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) { if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
} }
} else { } else {
$pages = $params['row']['pages']; $pages = $params['row']['pages'];
} }
if (!empty($pages)) { if (!empty($pages)) {
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title" // i.e. instead of "18" it reads "pages_18|Title"
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
$parts = explode('|', $pages); $parts = explode('|', $pages);
$pages = array_pop(explode('_', $parts[0])); $pages = array_pop(explode('_', $parts[0]));
} }
if ($pages > 0) { if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid', 'label,uid',
'tx_dlf_collections', 'tx_dlf_collections',
'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'), 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_collections'),
'', '',
'label', 'label',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray; $params['items'][] = $resArray;
} }
} }
} }
} }
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_search" * Helper to get flexform's items array for plugin "tx_dlf_search"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_extendedSearchList(&$params, &$pObj) { public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6 // the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) { if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) { if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
} }
} else { } else {
$pages = $params['row']['pages']; $pages = $params['row']['pages'];
} }
if (!empty($pages)) { if (!empty($pages)) {
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title" // i.e. instead of "18" it reads "pages_18|Title"
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
$_parts = explode('|', $pages); $_parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0])); $pages = array_pop(explode('_', $_parts[0]));
} }
if ($pages > 0) { if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,index_name', 'label,index_name',
'tx_dlf_metadata', 'tx_dlf_metadata',
'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), 'index_indexed=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
'', '',
'sorting', 'sorting',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray; $params['items'][] = $resArray;
} }
} }
} }
} }
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_search" * Helper to get flexform's items array for plugin "tx_dlf_search"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_facetsList(&$params, &$pObj) { public function itemsProcFunc_facetsList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6 // the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) { if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) { if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
} }
} else { } else {
$pages = $params['row']['pages']; $pages = $params['row']['pages'];
} }
if (!empty($pages)) { if (!empty($pages)) {
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title" // i.e. instead of "18" it reads "pages_18|Title"
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
$_parts = explode('|', $pages); $_parts = explode('|', $pages);
$pages = array_pop(explode('_', $_parts[0])); $pages = array_pop(explode('_', $_parts[0]));
} }
if ($pages > 0) { if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,index_name', 'label,index_name',
'tx_dlf_metadata', 'tx_dlf_metadata',
'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'), 'is_facet=1 AND pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_metadata'),
'', '',
'sorting', 'sorting',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray; $params['items'][] = $resArray;
} }
} }
} }
} }
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_oai" * Helper to get flexform's items array for plugin "tx_dlf_oai"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_libraryList(&$params, &$pObj) { public function itemsProcFunc_libraryList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6 // the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) { if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) { if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
} }
} else { } else {
$pages = $params['row']['pages']; $pages = $params['row']['pages'];
} }
if (!empty($pages)) { if (!empty($pages)) {
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title" // i.e. instead of "18" it reads "pages_18|Title"
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
$parts = explode('|', $pages); $parts = explode('|', $pages);
$pages = array_pop(explode('_', $parts[0])); $pages = array_pop(explode('_', $parts[0]));
} }
if ($pages > 0) { if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid', 'label,uid',
'tx_dlf_libraries', 'tx_dlf_libraries',
'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'), 'pid='.intval($pages).' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'.tx_dlf_helper::whereClause('tx_dlf_libraries'),
'', '',
'label', 'label',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray; $params['items'][] = $resArray;
} }
} }
} }
} }
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_search" * Helper to get flexform's items array for plugin "tx_dlf_search"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_solrList(&$params, &$pObj) { public function itemsProcFunc_solrList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6 // the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) { if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) { if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']); $pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF']; $pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
} }
} else { } else {
$pages = $params['row']['pages']; $pages = $params['row']['pages'];
} }
if (!empty($pages)) { if (!empty($pages)) {
// There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title. // There is a strange behavior where the uid from the flexform is prepended by the table's name and appended by its title.
// i.e. instead of "18" it reads "pages_18|Title" // i.e. instead of "18" it reads "pages_18|Title"
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) { if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($pages)) {
$parts = explode('|', $pages); $parts = explode('|', $pages);
$pages = array_pop(explode('_', $parts[0])); $pages = array_pop(explode('_', $parts[0]));
} }
if ($pages > 0) { if ($pages > 0) {
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'label,uid', 'label,uid',
'tx_dlf_solrcores', 'tx_dlf_solrcores',
'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), 'pid IN ('.intval($pages).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'', '',
'label', 'label',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
$params['items'][] = $resArray; $params['items'][] = $resArray;
} }
} }
} }
} }
} }
/** /**
* Helper to get flexform's items array for plugin "tx_dlf_toolbox" * Helper to get flexform's items array for plugin "tx_dlf_toolbox"
* *
* @access public * @access public
* *
* @param array &$params: An array with parameters * @param array &$params: An array with parameters
* @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
* *
* @return void * @return void
*/ */
public function itemsProcFunc_toolList(&$params, &$pObj) { public function itemsProcFunc_toolList(&$params, &$pObj) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/plugins/toolbox/tools'] as $class => $label) {
$params['items'][] = array ($GLOBALS['LANG']->sL($label), $class); $params['items'][] = array ($GLOBALS['LANG']->sL($label), $class);
} }
} }
} }

View File

@ -19,433 +19,433 @@
*/ */
class tx_dlf_tcemain { class tx_dlf_tcemain {
/** /**
* Field post-processing hook for the process_datamap() method. * Field post-processing hook for the process_datamap() method.
* *
* @access public * @access public
* *
* @param string $status: 'new' or 'update' * @param string $status: 'new' or 'update'
* @param string $table: The destination table * @param string $table: The destination table
* @param integer $id: The uid of the record * @param integer $id: The uid of the record
* @param array &$fieldArray: Array of field values * @param array &$fieldArray: Array of field values
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
* *
* @return void * @return void
*/ */
public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) { public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, $pObj) {
if ($status == 'new') { if ($status == 'new') {
switch ($table) { switch ($table) {
// Field post-processing for table "tx_dlf_documents". // Field post-processing for table "tx_dlf_documents".
case 'tx_dlf_documents': case 'tx_dlf_documents':
// Set sorting field if empty. // Set sorting field if empty.
if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) { if (empty($fieldArray['title_sorting']) && !empty($fieldArray['title'])) {
$fieldArray['title_sorting'] = $fieldArray['title']; $fieldArray['title_sorting'] = $fieldArray['title'];
} }
break; break;
// Field post-processing for table "tx_dlf_metadata". // Field post-processing for table "tx_dlf_metadata".
case 'tx_dlf_metadata': case 'tx_dlf_metadata':
// Store field in index if it should appear in lists. // Store field in index if it should appear in lists.
if (!empty($fieldArray['is_listed'])) { if (!empty($fieldArray['is_listed'])) {
$fieldArray['index_stored'] = 1; $fieldArray['index_stored'] = 1;
} }
// Index field in index if it should be used for auto-completion. // Index field in index if it should be used for auto-completion.
if (!empty($fieldArray['index_autocomplete'])) { if (!empty($fieldArray['index_autocomplete'])) {
$fieldArray['index_indexed'] = 1; $fieldArray['index_indexed'] = 1;
} }
// Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures". // Field post-processing for tables "tx_dlf_metadata", "tx_dlf_collections", "tx_dlf_libraries" and "tx_dlf_structures".
case 'tx_dlf_collections': case 'tx_dlf_collections':
case 'tx_dlf_libraries': case 'tx_dlf_libraries':
case 'tx_dlf_structures': case 'tx_dlf_structures':
// Set label as index name if empty. // Set label as index name if empty.
if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) { if (empty($fieldArray['index_name']) && !empty($fieldArray['label'])) {
$fieldArray['index_name'] = $fieldArray['label']; $fieldArray['index_name'] = $fieldArray['label'];
} }
// Set index name as label if empty. // Set index name as label if empty.
if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) { if (empty($fieldArray['label']) && !empty($fieldArray['index_name'])) {
$fieldArray['label'] = $fieldArray['index_name']; $fieldArray['label'] = $fieldArray['index_name'];
} }
// Ensure that index names don't get mixed up with sorting values. // Ensure that index names don't get mixed up with sorting values.
if (substr($fieldArray['index_name'], -8) == '_sorting') { if (substr($fieldArray['index_name'], -8) == '_sorting') {
$fieldArray['index_name'] .= '0'; $fieldArray['index_name'] .= '0';
} }
break; break;
// Field post-processing for table "tx_dlf_solrcores". // Field post-processing for table "tx_dlf_solrcores".
case 'tx_dlf_solrcores': case 'tx_dlf_solrcores':
// Get number of existing cores. // Get number of existing cores.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*', '*',
'tx_dlf_solrcores', 'tx_dlf_solrcores',
'', '',
'', '',
'', '',
'' ''
); );
// Get first unused core number. // Get first unused core number.
$coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result)); $coreNumber = tx_dlf_solr::solrGetCoreNumber($GLOBALS['TYPO3_DB']->sql_num_rows($result));
// Get Solr credentials. // Get Solr credentials.
$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']); $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
// Prepend username and password to hostname. // Prepend username and password to hostname.
if ($conf['solrUser'] && $conf['solrPass']) { if ($conf['solrUser'] && $conf['solrPass']) {
$host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); $host = $conf['solrUser'].':'.$conf['solrPass'].'@'.($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
} else { } else {
$host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost'); $host = ($conf['solrHost'] ? $conf['solrHost'] : 'localhost');
} }
// Set port if not set. // Set port if not set.
$port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180); $port = (intval($conf['solrPort']) > 0 ? intval($conf['solrPort']) : 8180);
// Trim path and append trailing slash. // Trim path and append trailing slash.
$path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : ''); $path = (trim($conf['solrPath'], '/') ? trim($conf['solrPath'], '/').'/' : '');
$context = stream_context_create(array ( $context = stream_context_create(array (
'http' => array ( 'http' => array (
'method' => 'GET', 'method' => 'GET',
'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent')) 'user_agent' => ($conf['useragent'] ? $conf['useragent'] : ini_get('user_agent'))
) )
)); ));
// Build request for adding new Solr core. // Build request for adding new Solr core.
// @see http://wiki.apache.org/solr/CoreAdmin // @see http://wiki.apache.org/solr/CoreAdmin
$url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber; $url = 'http://'.$host.':'.$port.'/'.$path.'admin/cores?wt=xml&action=CREATE&name=dlfCore'.$coreNumber.'&instanceDir=.&dataDir=dlfCore'.$coreNumber;
$response = @simplexml_load_string(file_get_contents($url, FALSE, $context)); $response = @simplexml_load_string(file_get_contents($url, FALSE, $context));
// Process response. // Process response.
if ($response) { if ($response) {
$status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]'); $status = $response->xpath('//lst[@name="responseHeader"]/int[@name="status"]');
if ($status && $status[0] == 0) { if ($status && $status[0] == 0) {
$fieldArray['index_name'] = 'dlfCore'.$coreNumber; $fieldArray['index_name'] = 'dlfCore'.$coreNumber;
return; return;
} }
} }
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::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); \TYPO3\CMS\Core\Utility\GeneralUtility::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);
} }
// Solr core could not be created, thus unset field array. // Solr core could not be created, thus unset field array.
$fieldArray = array (); $fieldArray = array ();
break; break;
} }
} elseif ($status == 'update') { } elseif ($status == 'update') {
switch ($table) { switch ($table) {
// Field post-processing for table "tx_dlf_metadata". // Field post-processing for table "tx_dlf_metadata".
case 'tx_dlf_metadata': case 'tx_dlf_metadata':
// Store field in index if it should appear in lists. // Store field in index if it should appear in lists.
if (!empty($fieldArray['is_listed'])) { if (!empty($fieldArray['is_listed'])) {
$fieldArray['index_stored'] = 1; $fieldArray['index_stored'] = 1;
} }
if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) { if (isset($fieldArray['index_stored']) && $fieldArray['index_stored'] == 0 && !isset($fieldArray['is_listed'])) {
// Get current configuration. // Get current configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$table.'.is_listed AS is_listed', $table.'.is_listed AS is_listed',
$table, $table,
$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Reset storing to current. // Reset storing to current.
list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($fieldArray['index_stored']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
} }
} }
// Index field in index if it should be used for auto-completion. // Index field in index if it should be used for auto-completion.
if (!empty($fieldArray['index_autocomplete'])) { if (!empty($fieldArray['index_autocomplete'])) {
$fieldArray['index_indexed'] = 1; $fieldArray['index_indexed'] = 1;
} }
if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) { if (isset($fieldArray['index_indexed']) && $fieldArray['index_indexed'] == 0 && !isset($fieldArray['index_autocomplete'])) {
// Get current configuration. // Get current configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$table.'.index_autocomplete AS index_autocomplete', $table.'.index_autocomplete AS index_autocomplete',
$table, $table,
$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Reset indexing to current. // Reset indexing to current.
list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($fieldArray['index_indexed']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
} }
} }
// Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures". // Field post-processing for tables "tx_dlf_metadata" and "tx_dlf_structures".
case 'tx_dlf_structures': case 'tx_dlf_structures':
// The index name should not be changed in production. // The index name should not be changed in production.
if (isset($fieldArray['index_name'])) { if (isset($fieldArray['index_name'])) {
if (count($fieldArray) < 2) { if (count($fieldArray) < 2) {
// Unset the whole field array. // Unset the whole field array.
$fieldArray = array (); $fieldArray = array ();
} else { } else {
// Get current index name. // Get current index name.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
$table.'.index_name AS index_name', $table.'.index_name AS index_name',
$table, $table,
$table.'.uid='.intval($id).tx_dlf_helper::whereClause($table), $table.'.uid='.intval($id).tx_dlf_helper::whereClause($table),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Reset index name to current. // Reset index name to current.
list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($fieldArray['index_name']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
} }
} }
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::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); \TYPO3\CMS\Core\Utility\GeneralUtility::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);
} }
} }
break; break;
} }
} }
} }
/** /**
* After database operations hook for the process_datamap() method. * After database operations hook for the process_datamap() method.
* *
* @access public * @access public
* *
* @param string $status: 'new' or 'update' * @param string $status: 'new' or 'update'
* @param string $table: The destination table * @param string $table: The destination table
* @param integer $id: The uid of the record * @param integer $id: The uid of the record
* @param array &$fieldArray: Array of field values * @param array &$fieldArray: Array of field values
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
* *
* @return void * @return void
*/ */
public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) { public function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, $pObj) {
if ($status == 'update') { if ($status == 'update') {
switch ($table) { switch ($table) {
// After database operations for table "tx_dlf_documents". // After database operations for table "tx_dlf_documents".
case 'tx_dlf_documents': case 'tx_dlf_documents':
// Delete/reindex document in Solr according to "hidden" status in database. // Delete/reindex document in Solr according to "hidden" status in database.
if (isset($fieldArray['hidden'])) { if (isset($fieldArray['hidden'])) {
// Get Solr core. // Get Solr core.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.uid', 'tx_dlf_solrcores.uid',
'tx_dlf_solrcores,tx_dlf_documents', 'tx_dlf_solrcores,tx_dlf_documents',
'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
if ($fieldArray['hidden']) { if ($fieldArray['hidden']) {
// Establish Solr connection. // Establish Solr connection.
if ($solr = tx_dlf_solr::getInstance($core)) { if ($solr = tx_dlf_solr::getInstance($core)) {
// Delete Solr document. // Delete Solr document.
$solr->service->deleteByQuery('uid:'.$id); $solr->service->deleteByQuery('uid:'.$id);
$solr->service->commit(); $solr->service->commit();
} }
} else { } else {
// Reindex document. // Reindex document.
$doc =& tx_dlf_document::getInstance($id); $doc =& tx_dlf_document::getInstance($id);
if ($doc->ready) { if ($doc->ready) {
$doc->save($doc->pid, $core); $doc->save($doc->pid, $core);
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::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); \TYPO3\CMS\Core\Utility\GeneralUtility::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);
} }
} }
} }
} }
} }
break; break;
} }
} }
} }
/** /**
* Post-processing hook for the process_cmdmap() method. * Post-processing hook for the process_cmdmap() method.
* *
* @access public * @access public
* *
* @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete' * @param string $command: 'move', 'copy', 'localize', 'inlineLocalizeSynchronize', 'delete' or 'undelete'
* @param string $table: The destination table * @param string $table: The destination table
* @param integer $id: The uid of the record * @param integer $id: The uid of the record
* @param mixed $value: The value for the command * @param mixed $value: The value for the command
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj: The parent object
* *
* @return void * @return void
*/ */
public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) { public function processCmdmap_postProcess($command, $table, $id, $value, $pObj) {
if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') { if (in_array($command, array ('move', 'delete', 'undelete')) && $table == 'tx_dlf_documents') {
// Get Solr core. // Get Solr core.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.uid', 'tx_dlf_solrcores.uid',
'tx_dlf_solrcores,tx_dlf_documents', 'tx_dlf_solrcores,tx_dlf_documents',
'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'), 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.intval($id).tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); list ($core) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
switch ($command) { switch ($command) {
case 'move': case 'move':
case 'delete': case 'delete':
// Establish Solr connection. // Establish Solr connection.
if ($solr = tx_dlf_solr::getInstance($core)) { if ($solr = tx_dlf_solr::getInstance($core)) {
// Delete Solr document. // Delete Solr document.
$solr->service->deleteByQuery('uid:'.$id); $solr->service->deleteByQuery('uid:'.$id);
$solr->service->commit(); $solr->service->commit();
if ($command == 'delete') { if ($command == 'delete') {
break; break;
} }
} }
case 'undelete': case 'undelete':
// Reindex document. // Reindex document.
$doc =& tx_dlf_document::getInstance($id); $doc =& tx_dlf_document::getInstance($id);
if ($doc->ready) { if ($doc->ready) {
$doc->save($doc->pid, $core); $doc->save($doc->pid, $core);
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::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); \TYPO3\CMS\Core\Utility\GeneralUtility::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);
} }
} }
break; break;
} }
} }
} }
} }
} }

View File

@ -19,363 +19,363 @@
*/ */
class tx_dlf_modIndexing extends tx_dlf_module { class tx_dlf_modIndexing extends tx_dlf_module {
protected $modPath = 'indexing/'; protected $modPath = 'indexing/';
protected $buttonArray = array ( protected $buttonArray = array (
'SHORTCUT' => '', 'SHORTCUT' => '',
); );
protected $markerArray = array ( protected $markerArray = array (
'CSH' => '', 'CSH' => '',
'MOD_MENU' => '', 'MOD_MENU' => '',
'CONTENT' => '', 'CONTENT' => '',
); );
/** /**
* This holds a list of documents to index * This holds a list of documents to index
* *
* @var tx_dlf_list * @var tx_dlf_list
* @access protected * @access protected
*/ */
protected $list; protected $list;
/** /**
* Builds HTML form for selecting a collection * Builds HTML form for selecting a collection
* *
* @access protected * @access protected
* *
* @return string The HTML output * @return string The HTML output
*/ */
protected function getCollList() { protected function getCollList() {
// Get all available Solr cores. // Get all available Solr cores.
$_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid',
'tx_dlf_solrcores', 'tx_dlf_solrcores',
'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'', '',
'', '',
'' ''
); );
// Get all available collections. // Get all available collections.
$_collections = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $_collections = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_collections.label AS label,tx_dlf_collections.uid AS uid', 'tx_dlf_collections.label AS label,tx_dlf_collections.uid AS uid',
'tx_dlf_collections', 'tx_dlf_collections',
'tx_dlf_collections.fe_cruser_id=0 AND tx_dlf_collections.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_collections.fe_cruser_id=0 AND tx_dlf_collections.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_collections'),
'', '',
'tx_dlf_collections.label ASC', 'tx_dlf_collections.label ASC',
'' ''
); );
// TODO: Ändern! // TODO: Ändern!
$form = '<label for="tx-dlf-modIndexing-id">Kollektion:</label>'; $form = '<label for="tx-dlf-modIndexing-id">Kollektion:</label>';
$form .= '<select id="tx-dlf-modIndexing-collection" name="'.$this->prefixId.'[collection]">'; $form .= '<select id="tx-dlf-modIndexing-collection" name="'.$this->prefixId.'[collection]">';
$form .= '<option value="0">Alle</option>'; $form .= '<option value="0">Alle</option>';
while ($_collection = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_collections)) { while ($_collection = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_collections)) {
$form .= '<option value="'.$_collection['uid'].'">'.htmlspecialchars($_collection['label']).'</option>'; $form .= '<option value="'.$_collection['uid'].'">'.htmlspecialchars($_collection['label']).'</option>';
} }
$form .= '</select><br />'; $form .= '</select><br />';
$form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">';
$form .= '<option value="0">---</option>'; $form .= '<option value="0">---</option>';
while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) {
$form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>';
} }
$form .= '</select><br />'; $form .= '</select><br />';
$form .= '<input type="hidden" name="CMD" value="reindexDocs" />'; $form .= '<input type="hidden" name="CMD" value="reindexDocs" />';
$form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />';
return $form; return $form;
} }
/** /**
* Builds HTML form for selecting a file * Builds HTML form for selecting a file
* *
* @access protected * @access protected
* *
* @return string The HTML output * @return string The HTML output
*/ */
protected function getFileForm() { protected function getFileForm() {
// Get all available Solr cores. // Get all available Solr cores.
$_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid',
'tx_dlf_solrcores', 'tx_dlf_solrcores',
'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'),
'', '',
'', '',
'' ''
); );
// TODO: Ändern! // TODO: Ändern!
$form = '<label for="tx-dlf-modIndexing-id">METS-Datei:</label>'; $form = '<label for="tx-dlf-modIndexing-id">METS-Datei:</label>';
$form .= '<input type="text" id="tx-dlf-modIndexing-id" name="'.$this->prefixId.'[id]" value="" /><br />'; $form .= '<input type="text" id="tx-dlf-modIndexing-id" name="'.$this->prefixId.'[id]" value="" /><br />';
$form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">';
$form .= '<option value="0">---</option>'; $form .= '<option value="0">---</option>';
while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) {
$form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>';
} }
$form .= '</select><br />'; $form .= '</select><br />';
$form .= '<input type="hidden" name="CMD" value="indexFile" />'; $form .= '<input type="hidden" name="CMD" value="indexFile" />';
$form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />';
return $form; return $form;
} }
/** /**
* Iterates through list of documents and indexes them * Iterates through list of documents and indexes them
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function indexLoop() { protected function indexLoop() {
// Get document from list. // Get document from list.
list ($uid, $title) = $this->list->remove(0); list ($uid, $title) = $this->list->remove(0);
$this->list->save(); $this->list->save();
// Save document to database and index. // Save document to database and index.
$doc =& tx_dlf_document::getInstance($uid, 0, TRUE); $doc =& tx_dlf_document::getInstance($uid, 0, TRUE);
if ($doc->ready) { if ($doc->ready) {
$doc->save($doc->pid, $this->data['core']); $doc->save($doc->pid, $this->data['core']);
} }
// Give feedback about progress. // Give feedback about progress.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentsToGo'), count($this->list))), htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentsToGo'), count($this->list))),
tx_dlf_helper::getLL('flash.running', TRUE), tx_dlf_helper::getLL('flash.running', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO, \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
TRUE TRUE
); );
$this->markerArray['CONTENT'] .= $_message->render(); $this->markerArray['CONTENT'] .= $_message->render();
// Start next loop. // Start next loop.
$this->markerArray['CONTENT'] .= '<script type="text/javascript">window.location.href=unescape("'.\TYPO3\CMS\Core\Utility\GeneralUtility::rawUrlEncodeJS(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'indexLoop', $this->prefixId => array ('core' => $this->data['core']), 'random' => uniqid())))).'");</script>'; $this->markerArray['CONTENT'] .= '<script type="text/javascript">window.location.href=unescape("'.\TYPO3\CMS\Core\Utility\GeneralUtility::rawUrlEncodeJS(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'indexLoop', $this->prefixId => array ('core' => $this->data['core']), 'random' => uniqid())))).'");</script>';
$this->printContent(); $this->printContent();
} }
/** /**
* Main function of the module * Main function of the module
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function main() { public function main() {
// Is the user allowed to access this page? // Is the user allowed to access this page?
$access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin(); $access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin();
if ($this->id && $access) { if ($this->id && $access) {
// Increase max_execution_time and max_input_time for large documents. // Increase max_execution_time and max_input_time for large documents.
if (!ini_get('safe_mode')) { if (!ini_get('safe_mode')) {
ini_set('max_execution_time', '0'); ini_set('max_execution_time', '0');
ini_set('max_input_time', '-1'); ini_set('max_input_time', '-1');
} }
switch ($this->CMD) { switch ($this->CMD) {
case 'indexFile': case 'indexFile':
if (!empty($this->data['id']) && isset($this->data['core']) if (!empty($this->data['id']) && isset($this->data['core'])
&& \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->data['id'])) { && \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($this->data['id'])) {
// Save document to database and index. // Save document to database and index.
$doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE);
if ($doc->ready) { if ($doc->ready) {
$doc->save($this->id, $this->data['core']); $doc->save($this->id, $this->data['core']);
} else { } else {
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.fileNotLoaded'), $this->data['id'])), htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.fileNotLoaded'), $this->data['id'])),
tx_dlf_helper::getLL('flash.error', TRUE), tx_dlf_helper::getLL('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE TRUE
); );
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
} }
break; break;
case 'reindexDocs': case 'reindexDocs':
if (isset($this->data['core'])) { if (isset($this->data['core'])) {
if (!empty($this->data['collection'])) { if (!empty($this->data['collection'])) {
// Get all documents in this collection. // Get all documents in this collection.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_documents.pid='.intval($this->id).' AND tx_dlf_collections.uid='.intval($this->data['collection']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_documents.pid='.intval($this->id).' AND tx_dlf_collections.uid='.intval($this->data['collection']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'', '',
'' ''
); );
} else { } else {
// Get all documents. // Get all documents.
$_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_documents.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_documents'), 'tx_dlf_documents.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'', '',
'' ''
); );
} }
// Save them as a list object in user's session. // Save them as a list object in user's session.
$elements = array (); $elements = array ();
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) {
$elements[] = array ($resArray['uid'], $resArray['title']); $elements[] = array ($resArray['uid'], $resArray['title']);
} }
$this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list', $elements); $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list', $elements);
// Start index looping. // Start index looping.
if (count($this->list) > 0) { if (count($this->list) > 0) {
$this->indexLoop(); $this->indexLoop();
} }
} }
break; break;
case 'indexLoop': case 'indexLoop':
// Refresh user's session to prevent session timeout. // Refresh user's session to prevent session timeout.
$GLOBALS['BE_USER']->fetchUserSession(); $GLOBALS['BE_USER']->fetchUserSession();
// Get document list from user's session. // Get document list from user's session.
$this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
// Continue index looping. // Continue index looping.
if (count($this->list) > 0 && isset($this->data['core'])) { if (count($this->list) > 0 && isset($this->data['core'])) {
$this->indexLoop(); $this->indexLoop();
} else { } else {
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.seeLog', TRUE), tx_dlf_helper::getLL('flash.seeLog', TRUE),
tx_dlf_helper::getLL('flash.done', TRUE), tx_dlf_helper::getLL('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
TRUE TRUE
); );
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
break; break;
} }
$this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
switch ($this->MOD_SETTINGS['function']) { switch ($this->MOD_SETTINGS['function']) {
case 'indexFile': case 'indexFile':
$this->markerArray['CONTENT'] .= $this->getFileForm(); $this->markerArray['CONTENT'] .= $this->getFileForm();
break; break;
case 'reindexDocs': case 'reindexDocs':
$this->markerArray['CONTENT'] .= $this->getCollList(); $this->markerArray['CONTENT'] .= $this->getCollList();
break; break;
} }
} else { } else {
// TODO: Ändern! // TODO: Ändern!
$this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.';
} }
$this->printContent(); $this->printContent();
} }
/** /**
* Sets the module's MOD_MENU configuration * Sets the module's MOD_MENU configuration
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function setMOD_MENU() { protected function setMOD_MENU() {
$this->MOD_MENU = array ( $this->MOD_MENU = array (
'function' => array ( 'function' => array (
'indexFile' => $GLOBALS['LANG']->getLL('function.indexFile'), 'indexFile' => $GLOBALS['LANG']->getLL('function.indexFile'),
//'reindexDoc' => $GLOBALS['LANG']->getLL('function.reindexDoc'), //'reindexDoc' => $GLOBALS['LANG']->getLL('function.reindexDoc'),
'reindexDocs' => $GLOBALS['LANG']->getLL('function.reindexDocs'), 'reindexDocs' => $GLOBALS['LANG']->getLL('function.reindexDocs'),
) )
); );
} }
} }

View File

@ -19,489 +19,489 @@
*/ */
class tx_dlf_modNewclient extends tx_dlf_module { class tx_dlf_modNewclient extends tx_dlf_module {
protected $modPath = 'newclient/'; protected $modPath = 'newclient/';
protected $buttonArray = array ( protected $buttonArray = array (
'SHORTCUT' => '', 'SHORTCUT' => '',
); );
protected $markerArray = array ( protected $markerArray = array (
'CSH' => '', 'CSH' => '',
'MOD_MENU' => '', 'MOD_MENU' => '',
'CONTENT' => '', 'CONTENT' => '',
); );
/** /**
* Add access rights * Add access rights
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function cmdAddAccessRights() { protected function cmdAddAccessRights() {
// Get command line indexer's usergroup. // Get command line indexer's usergroup.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,db_mountpoints', 'uid,db_mountpoints',
'be_groups', 'be_groups',
'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups')
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
// Add current page to mountpoints. // Add current page to mountpoints.
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) {
$data['be_groups'][$resArray['uid']]['db_mountpoints'] = $resArray['db_mountpoints'].','.$this->id; $data['be_groups'][$resArray['uid']]['db_mountpoints'] = $resArray['db_mountpoints'].','.$this->id;
tx_dlf_helper::processDBasAdmin($data); tx_dlf_helper::processDBasAdmin($data);
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.usergroupAddedMsg'), tx_dlf_helper::getLL('flash.usergroupAddedMsg'),
tx_dlf_helper::getLL('flash.usergroupAdded', TRUE), tx_dlf_helper::getLL('flash.usergroupAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
} }
} }
/** /**
* Add metadata configuration * Add metadata configuration
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function cmdAddMetadata() { protected function cmdAddMetadata() {
// Include metadata definition file. // Include metadata definition file.
include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'metadata.inc.php'); include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'metadata.inc.php');
$i = 0; $i = 0;
// Build data array. // Build data array.
foreach ($metadata as $index_name => $values) { foreach ($metadata as $index_name => $values) {
$formatIds = array (); $formatIds = array ();
foreach ($values['format'] as $format) { foreach ($values['format'] as $format) {
$formatIds[] = uniqid('NEW'); $formatIds[] = uniqid('NEW');
$data['tx_dlf_metadataformat'][end($formatIds)] = $format; $data['tx_dlf_metadataformat'][end($formatIds)] = $format;
$data['tx_dlf_metadataformat'][end($formatIds)]['pid'] = intval($this->id); $data['tx_dlf_metadataformat'][end($formatIds)]['pid'] = intval($this->id);
$i++; $i++;
} }
$data['tx_dlf_metadata'][uniqid('NEW')] = array ( $data['tx_dlf_metadata'][uniqid('NEW')] = array (
'pid' => intval($this->id), 'pid' => intval($this->id),
'label' => $GLOBALS['LANG']->getLL($index_name), 'label' => $GLOBALS['LANG']->getLL($index_name),
'index_name' => $index_name, 'index_name' => $index_name,
'format' => implode(',', $formatIds), 'format' => implode(',', $formatIds),
'default_value' => $values['default_value'], 'default_value' => $values['default_value'],
'wrap' => (!empty($values['wrap']) ? $values['wrap'] : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default']), 'wrap' => (!empty($values['wrap']) ? $values['wrap'] : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default']),
'index_tokenized' => $values['index_tokenized'], 'index_tokenized' => $values['index_tokenized'],
'index_stored' => $values['index_stored'], 'index_stored' => $values['index_stored'],
'index_indexed' => $values['index_indexed'], 'index_indexed' => $values['index_indexed'],
'index_boost' => $values['index_boost'], 'index_boost' => $values['index_boost'],
'is_sortable' => $values['is_sortable'], 'is_sortable' => $values['is_sortable'],
'is_facet' => $values['is_facet'], 'is_facet' => $values['is_facet'],
'is_listed' => $values['is_listed'], 'is_listed' => $values['is_listed'],
'index_autocomplete' => $values['index_autocomplete'], 'index_autocomplete' => $values['index_autocomplete'],
); );
$i++; $i++;
} }
$_ids = tx_dlf_helper::processDBasAdmin($data); $_ids = tx_dlf_helper::processDBasAdmin($data);
// Check for failed inserts. // Check for failed inserts.
if (count($_ids) == $i) { if (count($_ids) == $i) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.metadataAddedMsg'), tx_dlf_helper::getLL('flash.metadataAddedMsg'),
tx_dlf_helper::getLL('flash.metadataAdded', TRUE), tx_dlf_helper::getLL('flash.metadataAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Something went wrong. // Something went wrong.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.metadataNotAddedMsg'), tx_dlf_helper::getLL('flash.metadataNotAddedMsg'),
tx_dlf_helper::getLL('flash.metadataNotAdded', TRUE), tx_dlf_helper::getLL('flash.metadataNotAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
/** /**
* Add Solr core * Add Solr core
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function cmdAddSolrCore() { protected function cmdAddSolrCore() {
// Build data array. // Build data array.
$data['tx_dlf_solrcores'][uniqid('NEW')] = array ( $data['tx_dlf_solrcores'][uniqid('NEW')] = array (
'pid' => intval($this->id), 'pid' => intval($this->id),
'label' => $GLOBALS['LANG']->getLL('solrcore').' (PID '.$this->id.')', 'label' => $GLOBALS['LANG']->getLL('solrcore').' (PID '.$this->id.')',
'index_name' => '', 'index_name' => '',
); );
$_ids = tx_dlf_helper::processDBasAdmin($data); $_ids = tx_dlf_helper::processDBasAdmin($data);
// Check for failed inserts. // Check for failed inserts.
if (count($_ids) == 1) { if (count($_ids) == 1) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.solrcoreAddedMsg'), tx_dlf_helper::getLL('flash.solrcoreAddedMsg'),
tx_dlf_helper::getLL('flash.solrcoreAdded', TRUE), tx_dlf_helper::getLL('flash.solrcoreAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Something went wrong. // Something went wrong.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.solrcoreNotAddedMsg'), tx_dlf_helper::getLL('flash.solrcoreNotAddedMsg'),
tx_dlf_helper::getLL('flash.solrcoreNotAdded', TRUE), tx_dlf_helper::getLL('flash.solrcoreNotAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
/** /**
* Add structure configuration * Add structure configuration
* *
* @access protected * @access protected
* *
* @return void * @return void
*/ */
protected function cmdAddStructure() { protected function cmdAddStructure() {
// Include structure definition file. // Include structure definition file.
include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'structures.inc.php'); include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'structures.inc.php');
// Build data array. // Build data array.
foreach ($structures as $index_name => $values) { foreach ($structures as $index_name => $values) {
$data['tx_dlf_structures'][uniqid('NEW')] = array ( $data['tx_dlf_structures'][uniqid('NEW')] = array (
'pid' => intval($this->id), 'pid' => intval($this->id),
'toplevel' => $values['toplevel'], 'toplevel' => $values['toplevel'],
'label' => $GLOBALS['LANG']->getLL($index_name), 'label' => $GLOBALS['LANG']->getLL($index_name),
'index_name' => $index_name, 'index_name' => $index_name,
'oai_name' => $values['oai_name'], 'oai_name' => $values['oai_name'],
'thumbnail' => 0, 'thumbnail' => 0,
); );
} }
$_ids = tx_dlf_helper::processDBasAdmin($data); $_ids = tx_dlf_helper::processDBasAdmin($data);
// Check for failed inserts. // Check for failed inserts.
if (count($_ids) == count($structures)) { if (count($_ids) == count($structures)) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.structureAddedMsg'), tx_dlf_helper::getLL('flash.structureAddedMsg'),
tx_dlf_helper::getLL('flash.structureAdded', TRUE), tx_dlf_helper::getLL('flash.structureAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Something went wrong. // Something went wrong.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.structureNotAddedMsg'), tx_dlf_helper::getLL('flash.structureNotAddedMsg'),
tx_dlf_helper::getLL('flash.structureNotAdded', TRUE), tx_dlf_helper::getLL('flash.structureNotAdded', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
} }
/** /**
* Main function of the module * Main function of the module
* *
* @access public * @access public
* *
* @return void * @return void
*/ */
public function main() { public function main() {
// Is the user allowed to access this page? // Is the user allowed to access this page?
$access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin(); $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin();
if ($this->id && $access) { if ($this->id && $access) {
// Check if page is sysfolder. // Check if page is sysfolder.
if ($this->pageInfo['doktype'] != 254) { if ($this->pageInfo['doktype'] != 254) {
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.wrongPageTypeMsg'), tx_dlf_helper::getLL('flash.wrongPageTypeMsg'),
tx_dlf_helper::getLL('flash.wrongPageType', TRUE), tx_dlf_helper::getLL('flash.wrongPageType', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
$this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
$this->printContent(); $this->printContent();
return; return;
} }
// Should we do something? // Should we do something?
if (!empty($this->CMD)) { if (!empty($this->CMD)) {
// Sanitize input... // Sanitize input...
$_method = 'cmd'.ucfirst($this->CMD); $_method = 'cmd'.ucfirst($this->CMD);
// ...and unset to prevent infinite looping. // ...and unset to prevent infinite looping.
unset ($this->CMD); unset ($this->CMD);
if (method_exists($this, $_method)) { if (method_exists($this, $_method)) {
$this->$_method(); $this->$_method();
} }
} }
// Check for existing structure configuration. // Check for existing structure configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid', 'uid',
'tx_dlf_structures', 'tx_dlf_structures',
'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_structures') 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_structures')
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.structureOkayMsg'), tx_dlf_helper::getLL('flash.structureOkayMsg'),
tx_dlf_helper::getLL('flash.structureOkay', TRUE), tx_dlf_helper::getLL('flash.structureOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Configuration missing. // Configuration missing.
$_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addStructure'))); $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addStructure')));
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url), sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url),
tx_dlf_helper::getLL('flash.structureNotOkay', TRUE), tx_dlf_helper::getLL('flash.structureNotOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
// Check for existing metadata configuration. // Check for existing metadata configuration.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid', 'uid',
'tx_dlf_metadata', 'tx_dlf_metadata',
'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_metadata') 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_metadata')
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.metadataOkayMsg'), tx_dlf_helper::getLL('flash.metadataOkayMsg'),
tx_dlf_helper::getLL('flash.metadataOkay', TRUE), tx_dlf_helper::getLL('flash.metadataOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Configuration missing. // Configuration missing.
$_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addMetadata'))); $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addMetadata')));
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url), sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url),
tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE), tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
// Check the access conditions for the command line indexer's user. // Check the access conditions for the command line indexer's user.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,db_mountpoints', 'uid,db_mountpoints',
'be_groups', 'be_groups',
'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups')
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.usergroupOkayMsg'), tx_dlf_helper::getLL('flash.usergroupOkayMsg'),
tx_dlf_helper::getLL('flash.usergroupOkay', TRUE), tx_dlf_helper::getLL('flash.usergroupOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Configuration missing. // Configuration missing.
$_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addAccessRights'))); $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addAccessRights')));
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url), sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url),
tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE), tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
} else { } else {
// Usergoup missing. // Usergoup missing.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.usergroupMissingMsg'), tx_dlf_helper::getLL('flash.usergroupMissingMsg'),
tx_dlf_helper::getLL('flash.usergroupMissing', TRUE), tx_dlf_helper::getLL('flash.usergroupMissing', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
// Check for existing Solr core. // Check for existing Solr core.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,pid', 'uid,pid',
'tx_dlf_solrcores', 'tx_dlf_solrcores',
'pid IN ('.intval($this->id).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores') 'pid IN ('.intval($this->id).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores')
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
if ($resArray['pid']) { if ($resArray['pid']) {
// Fine. // Fine.
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
tx_dlf_helper::getLL('flash.solrcoreOkayMsg'), tx_dlf_helper::getLL('flash.solrcoreOkayMsg'),
tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE), tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK, \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
FALSE FALSE
); );
} else { } else {
// Default core available, but this is deprecated. // Default core available, but this is deprecated.
$_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore')));
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url), sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url),
tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE), tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE, \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE,
FALSE FALSE
); );
} }
} else { } else {
// Solr core missing. // Solr core missing.
$_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore')));
$_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url), sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url),
tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE), tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
FALSE FALSE
); );
} }
tx_dlf_helper::addMessage($_message); tx_dlf_helper::addMessage($_message);
$this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages();
} else { } else {
// TODO: Ändern! // TODO: Ändern!
$this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.';
} }
$this->printContent(); $this->printContent();
} }
} }

View File

@ -12,328 +12,328 @@
// Define metadata elements. // Define metadata elements.
// @see http://dfg-viewer.de/en/profile-of-the-metadata/ // @see http://dfg-viewer.de/en/profile-of-the-metadata/
$metadata = array ( $metadata = array (
'type' => array ( 'type' => array (
'format' => array (), 'format' => array (),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 0, 'index_indexed' => 0,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'title' => array ( 'title' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => 'concat(./mods:titleInfo/mods:nonSort," ",./mods:titleInfo/mods:title)', 'xpath' => 'concat(./mods:titleInfo/mods:nonSort," ",./mods:titleInfo/mods:title)',
'xpath_sorting' => './mods:titleInfo/mods:title', 'xpath_sorting' => './mods:titleInfo/mods:title',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:note[@type="caption"]', 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:note[@type="caption"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => "key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>", 'wrap' => "key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>",
'index_tokenized' => 1, 'index_tokenized' => 1,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 2.00, 'index_boost' => 2.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 1, 'index_autocomplete' => 1,
), ),
'volume' => array ( 'volume' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:part/mods:detail/mods:number', 'xpath' => './mods:part/mods:detail/mods:number',
'xpath_sorting' => './mods:part[@type="host"]/@order', 'xpath_sorting' => './mods:part[@type="host"]/@order',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 0, 'index_indexed' => 0,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'author' => array ( 'author' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:name', 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:name',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 1, 'index_tokenized' => 1,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 2.00, 'index_boost' => 2.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 1, 'index_autocomplete' => 1,
), ),
'place' => array ( 'place' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origPlace', 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origPlace',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 1, 'index_tokenized' => 1,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'year' => array ( 'year' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate', 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate',
'xpath_sorting' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate/@when', 'xpath_sorting' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:head/teihdr:origDate/@when',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 1, 'index_stored' => 1,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 1, 'is_sortable' => 1,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 1, 'is_listed' => 1,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'language' => array ( 'language' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:language/mods:languageTerm', 'xpath' => './mods:language/mods:languageTerm',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'collection' => array ( 'collection' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:classification', 'xpath' => './mods:classification',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:msIdentifier/teihdr:collection', 'xpath' => './teihdr:fileDesc/teihdr:sourceDesc/teihdr:msDesc/teihdr:msIdentifier/teihdr:collection',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 1, 'index_tokenized' => 1,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'owner' => array ( 'owner' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:name[./mods:role/mods:roleTerm="own"]/mods:displayForm', 'xpath' => './mods:name[./mods:role/mods:roleTerm="own"]/mods:displayForm',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:publisher', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:publisher',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 1, 'is_facet' => 1,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'purl' => array ( 'purl' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:identifier[@type="purl"]', 'xpath' => './mods:identifier[@type="purl"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="purl"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="purl"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>", 'wrap' => "key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.setContentToCurrent = 1\nvalue.typolink.parameter.current = 1\nvalue.wrap = <dd>|</dd>",
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 0, 'index_indexed' => 0,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'urn' => array ( 'urn' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:identifier[@type="urn"]', 'xpath' => './mods:identifier[@type="urn"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="urn"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="urn"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'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>", '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>",
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'opac_id' => array ( 'opac_id' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:identifier[@type="opac"]', 'xpath' => './mods:identifier[@type="opac"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="opac"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="opac"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'union_id' => array ( 'union_id' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:identifier[@type="ppn"]', 'xpath' => './mods:identifier[@type="ppn"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="mmid"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="mmid"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'record_id' => array ( 'record_id' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:recordInfo/mods:recordIdentifier', 'xpath' => './mods:recordInfo/mods:recordIdentifier',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="recordIdentifier"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="recordIdentifier"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 1, 'index_indexed' => 1,
'index_boost' => 1.00, 'index_boost' => 1.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
), ),
'prod_id' => array ( 'prod_id' => array (
'format' => array ( 'format' => array (
array ( array (
'encoded' => 1, 'encoded' => 1,
'xpath' => './mods:identifier[@type="goobi"]', 'xpath' => './mods:identifier[@type="goobi"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
array ( array (
'encoded' => 2, 'encoded' => 2,
'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="goobi"]', 'xpath' => './teihdr:fileDesc/teihdr:publicationStmt/teihdr:idno[@type="goobi"]',
'xpath_sorting' => '', 'xpath_sorting' => '',
), ),
), ),
'default_value' => '', 'default_value' => '',
'wrap' => '', 'wrap' => '',
'index_tokenized' => 0, 'index_tokenized' => 0,
'index_stored' => 0, 'index_stored' => 0,
'index_indexed' => 0, 'index_indexed' => 0,
'index_boost' => 0.00, 'index_boost' => 0.00,
'is_sortable' => 0, 'is_sortable' => 0,
'is_facet' => 0, 'is_facet' => 0,
'is_listed' => 0, 'is_listed' => 0,
'index_autocomplete' => 0, 'index_autocomplete' => 0,
) )
); );

View File

@ -12,352 +12,352 @@
// Define structure elements. // Define structure elements.
// @see http://dfg-viewer.de/en/structural-data-set/ // @see http://dfg-viewer.de/en/structural-data-set/
$structures = array ( $structures = array (
'act' => array ( 'act' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'additional' => array ( 'additional' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'address' => array ( 'address' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'album' => array ( 'album' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'annotation' => array ( 'annotation' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'article' => array ( 'article' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'atlas' => array ( 'atlas' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'bachelor_thesis' => array ( 'bachelor_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'binding' => array ( 'binding' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'bookplate' => array ( 'bookplate' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'cartulary' => array ( 'cartulary' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'chapter' => array ( 'chapter' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'collation' => array ( 'collation' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'colophon' => array ( 'colophon' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'contained_work' => array ( 'contained_work' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'contents' => array ( 'contents' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'corrigenda' => array ( 'corrigenda' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'cover' => array ( 'cover' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'cover_front' => array ( 'cover_front' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'cover_back' => array ( 'cover_back' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'day' => array ( 'day' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'dedication' => array ( 'dedication' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'diploma_thesis' => array ( 'diploma_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'doctoral_thesis' => array ( 'doctoral_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'document' => array ( 'document' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'dossier' => array ( 'dossier' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'edge' => array ( 'edge' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'endsheet' => array ( 'endsheet' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'engraved_titlepage' => array ( 'engraved_titlepage' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'entry' => array ( 'entry' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'fascicle' => array ( 'fascicle' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'file' => array ( 'file' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'folder' => array ( 'folder' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'fragment' => array ( 'fragment' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'ground_plan' => array ( 'ground_plan' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'habilitation_thesis' => array ( 'habilitation_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'illustration' => array ( 'illustration' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'image' => array ( 'image' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'imprint' => array ( 'imprint' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'index' => array ( 'index' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'initial_decoration' => array ( 'initial_decoration' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'issue' => array ( 'issue' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'judgement' => array ( 'judgement' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'land_register' => array ( 'land_register' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'leaflet' => array ( 'leaflet' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'lecture' => array ( 'lecture' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'letter' => array ( 'letter' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '', 'oai_name' => '',
), ),
'magister_thesis' => array ( 'magister_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'master_thesis' => array ( 'master_thesis' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'manuscript' => array ( 'manuscript' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'map' => array ( 'map' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'monograph' => array ( 'monograph' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'month' => array ( 'month' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'multivolume_work' => array ( 'multivolume_work' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'musical_notation' => array ( 'musical_notation' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'newspaper' => array ( 'newspaper' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'note' => array ( 'note' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '', 'oai_name' => '',
), ),
'official_notification' => array ( 'official_notification' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'ornament' => array ( 'ornament' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'paper' => array ( 'paper' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'paste_down' => array ( 'paste_down' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'periodical' => array ( 'periodical' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'photograph' => array ( 'photograph' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'plan' => array ( 'plan' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'poster' => array ( 'poster' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'preface' => array ( 'preface' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'preprint' => array ( 'preprint' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'printed_archives' => array ( 'printed_archives' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'printers_mark' => array ( 'printers_mark' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'privileges' => array ( 'privileges' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'proceeding' => array ( 'proceeding' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'provenance' => array ( 'provenance' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'register' => array ( 'register' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'report' => array ( 'report' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'research_paper' => array ( 'research_paper' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'scheme' => array ( 'scheme' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'seal' => array ( 'seal' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '', 'oai_name' => '',
), ),
'section' => array ( 'section' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'spine' => array ( 'spine' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'stamp' => array ( 'stamp' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'study' => array ( 'study' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '', 'oai_name' => '',
), ),
'table' => array ( 'table' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'text' => array ( 'text' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'title_page' => array ( 'title_page' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'verse' => array ( 'verse' => array (
'toplevel' => 0, 'toplevel' => 0,
'oai_name' => '' 'oai_name' => ''
), ),
'volume' => array ( 'volume' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
), ),
'year' => array ( 'year' => array (
'toplevel' => 1, 'toplevel' => 1,
'oai_name' => '' 'oai_name' => ''
) )
); );

View File

@ -19,35 +19,35 @@
*/ */
class tx_dlf_audioplayer extends tx_dlf_plugin { class tx_dlf_audioplayer extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php'; public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php';
/** /**
* Holds the current audio file's URL, MIME type and optional label * Holds the current audio file's URL, MIME type and optional label
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $audio = array (); protected $audio = array ();
/** /**
* Adds Player javascript * Adds Player javascript
* *
* @access protected * @access protected
* *
* @return string Player script tags ready for output * @return string Player script tags ready for output
*/ */
protected function addPlayerJS() { protected function addPlayerJS() {
$output = array (); $output = array ();
$output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">'; $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>';
// Add player configuration. // Add player configuration.
$output[] = ' $output[] = '
<style> <style>
#tx-dlf-audio { width: 100px; height: 100px }; #tx-dlf-audio { width: 100px; height: 100px };
</style> </style>
@ -65,87 +65,87 @@ class tx_dlf_audioplayer extends tx_dlf_plugin {
}); });
</script>'; </script>';
return implode("\n", $output); return implode("\n", $output);
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1) { if ($this->doc === NULL || $this->doc->numPages < 1) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
// Check if there are any audio files available. // Check if there are any audio files available.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) {
// Get audio data. // Get audio data.
$this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); $this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
$this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label']; $this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label'];
$this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); $this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]);
} else { } else {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###');
} }
// Fill in the template markers. // Fill in the template markers.
$markerArray = array ( $markerArray = array (
'###PLAYER_JS###' => $this->addPlayerJS() '###PLAYER_JS###' => $this->addPlayerJS()
); );
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

View File

@ -19,414 +19,414 @@
*/ */
class tx_dlf_collection extends tx_dlf_plugin { class tx_dlf_collection extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php'; public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
/** /**
* This holds the hook objects * This holds the hook objects
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $hookObjects = array (); protected $hookObjects = array ();
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Turn cache on. // Turn cache on.
$this->setCache(TRUE); $this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set. // Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) { if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
} }
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
} }
// Get hook objects. // Get hook objects.
$this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
if (!empty($this->piVars['collection'])) { if (!empty($this->piVars['collection'])) {
$this->showSingleCollection(intval($this->piVars['collection'])); $this->showSingleCollection(intval($this->piVars['collection']));
} else { } else {
$content .= $this->showCollectionList(); $content .= $this->showCollectionList();
} }
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* Builds a collection list * Builds a collection list
* *
* @access protected * @access protected
* *
* @return string The list of collections ready to output * @return string The list of collections ready to output
*/ */
protected function showCollectionList() { protected function showCollectionList() {
$additionalWhere = ''; $additionalWhere = '';
$orderBy = 'tx_dlf_collections.label'; $orderBy = 'tx_dlf_collections.label';
// Handle collections set by configuration. // Handle collections set by configuration.
if ($this->conf['collections']) { if ($this->conf['collections']) {
if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) { if (count(explode(',', $this->conf['collections'])) == 1 && empty($this->conf['dont_show_single'])) {
$this->showSingleCollection(intval(trim($this->conf['collections'], ' ,'))); $this->showSingleCollection(intval(trim($this->conf['collections'], ' ,')));
} }
$additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; $additionalWhere .= ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
$orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; $orderBy = 'FIELD(tx_dlf_collections.uid, '.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
} }
// Should user-defined collections be shown? // Should user-defined collections be shown?
if (empty($this->conf['show_userdefined'])) { if (empty($this->conf['show_userdefined'])) {
$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0'; $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id=0';
} elseif ($this->conf['show_userdefined'] > 0) { } elseif ($this->conf['show_userdefined'] > 0) {
if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) { if (!empty($GLOBALS['TSFE']->fe_user->user['uid'])) {
$additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']); $additionalWhere .= ' AND tx_dlf_collections.fe_cruser_id='.intval($GLOBALS['TSFE']->fe_user->user['uid']);
} else { } else {
$additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0'; $additionalWhere .= ' AND NOT tx_dlf_collections.fe_cruser_id=0';
} }
} }
// Get collections. // Get collections.
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles', 'tx_dlf_collections.uid AS uid,tx_dlf_collections.label AS label,tx_dlf_collections.thumbnail AS thumbnail,tx_dlf_collections.description AS description,tx_dlf_collections.priority AS priority,COUNT(tx_dlf_documents.uid) AS titles',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_collections.uid', 'tx_dlf_collections.uid',
$orderBy, $orderBy,
'' ''
); );
$count = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $count = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
$content = ''; $content = '';
if ($count == 1 && empty($this->conf['dont_show_single'])) { if ($count == 1 && empty($this->conf['dont_show_single'])) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$this->showSingleCollection(intval($resArray['uid'])); $this->showSingleCollection(intval($resArray['uid']));
} elseif ($count > 0) { } elseif ($count > 0) {
// Get number of volumes per collection. // Get number of volumes per collection.
$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes', 'tx_dlf_collections.uid AS uid,COUNT(tx_dlf_documents.uid) AS volumes',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_collections.uid', 'tx_dlf_collections.uid',
'', '',
'' ''
); );
$volumes = array (); $volumes = array ();
while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) { while ($resArrayVolumes = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultVolumes)) {
$volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes']; $volumes[$resArrayVolumes['uid']] = $resArrayVolumes['volumes'];
} }
// Process results. // Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
// Generate random but unique array key taking priority into account. // Generate random but unique array key taking priority into account.
do { do {
$_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000); $_key = ($resArray['priority'] * 1000) + mt_rand(0, 1000);
} while (!empty($markerArray[$_key])); } while (!empty($markerArray[$_key]));
// Merge plugin variables with new set of values. // Merge plugin variables with new set of values.
$additionalParams = array ('collection' => $resArray['uid']); $additionalParams = array ('collection' => $resArray['uid']);
if (is_array($this->piVars)) { if (is_array($this->piVars)) {
$piVars = $this->piVars; $piVars = $this->piVars;
unset($piVars['DATA']); unset($piVars['DATA']);
$additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams); $additionalParams = tx_dlf_helper::array_merge_recursive_overrule($piVars, $additionalParams);
} }
// Build typolink configuration array. // Build typolink configuration array.
$conf = array ( $conf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id, 'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE) 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
); );
// Link collection's title to list view. // Link collection's title to list view.
$markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf); $markerArray[$_key]['###TITLE###'] = $this->cObj->typoLink(htmlspecialchars($resArray['label']), $conf);
// Add feed link if applicable. // Add feed link if applicable.
if (!empty($this->conf['targetFeed'])) { if (!empty($this->conf['targetFeed'])) {
$img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />'; $img = '<img src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'res/icons/txdlffeeds.png" alt="'.$this->pi_getLL('feedAlt', '', TRUE).'" title="'.$this->pi_getLL('feedTitle', '', TRUE).'" />';
$markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']); $markerArray[$_key]['###FEED###'] = $this->pi_linkTP($img, array ($this->prefixId => array ('collection' => $resArray['uid'])), FALSE, $this->conf['targetFeed']);
} else { } else {
$markerArray[$_key]['###FEED###'] = ''; $markerArray[$_key]['###FEED###'] = '';
} }
// Add thumbnail. // Add thumbnail.
if (!empty($resArray['thumbnail'])) { if (!empty($resArray['thumbnail'])) {
$markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />'; $markerArray[$_key]['###THUMBNAIL###'] = '<img alt="" title="'.htmlspecialchars($resArray['label']).'" src="'.$resArray['thumbnail'].'" />';
} else { } else {
$markerArray[$_key]['###THUMBNAIL###'] = ''; $markerArray[$_key]['###THUMBNAIL###'] = '';
} }
// Add description. // Add description.
$markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']); $markerArray[$_key]['###DESCRIPTION###'] = $this->pi_RTEcssText($resArray['description']);
// Build statistic's output. // Build statistic's output.
$labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE); $labelTitles = $this->pi_getLL(($resArray['titles'] > 1 ? 'titles' : 'title'), '', FALSE);
$markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles); $markerArray[$_key]['###COUNT_TITLES###'] = htmlspecialchars($resArray['titles'].$labelTitles);
$labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE); $labelVolumes = $this->pi_getLL(($volumes[$resArray['uid']] > 1 ? 'volumes' : 'volume'), '', FALSE);
$markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes); $markerArray[$_key]['###COUNT_VOLUMES###'] = htmlspecialchars($volumes[$resArray['uid']].$labelVolumes);
} }
// Randomize sorting? // Randomize sorting?
if (!empty($this->conf['randomize'])) { if (!empty($this->conf['randomize'])) {
ksort($markerArray, SORT_NUMERIC); ksort($markerArray, SORT_NUMERIC);
// Don't cache the output. // Don't cache the output.
$this->setCache(FALSE); $this->setCache(FALSE);
} }
$entry = $this->cObj->getSubpart($this->template, '###ENTRY###'); $entry = $this->cObj->getSubpart($this->template, '###ENTRY###');
foreach ($markerArray as $marker) { foreach ($markerArray as $marker) {
$content .= $this->cObj->substituteMarkerArray($entry, $marker); $content .= $this->cObj->substituteMarkerArray($entry, $marker);
} }
// Hook for getting custom collection hierarchies/subentries (requested by SBB). // Hook for getting custom collection hierarchies/subentries (requested by SBB).
foreach ($this->hookObjects as $hookObj) { foreach ($this->hookObjects as $hookObj) {
if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) { if (method_exists($hookObj, 'showCollectionList_getCustomCollectionList')) {
$hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray); $hookObj->showCollectionList_getCustomCollectionList($this, $this->conf['templateFile'], $content, $markerArray);
} }
} }
return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE); return $this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE);
} }
return $content; return $content;
} }
/** /**
* Builds a collection's list * Builds a collection's list
* *
* @access protected * @access protected
* *
* @param integer $id: The collection's UID * @param integer $id: The collection's UID
* *
* @return void * @return void
*/ */
protected function showSingleCollection($id) { protected function showSingleCollection($id) {
// Should user-defined collections be shown? // Should user-defined collections be shown?
if (empty($this->conf['show_userdefined'])) { if (empty($this->conf['show_userdefined'])) {
$additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0'; $additionalWhere = ' AND tx_dlf_collections.fe_cruser_id=0';
} elseif ($this->conf['show_userdefined'] > 0) { } elseif ($this->conf['show_userdefined'] > 0) {
$additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0'; $additionalWhere = ' AND NOT tx_dlf_collections.fe_cruser_id=0';
} }
// Get all documents in collection. // Get all documents in collection.
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof', 'tx_dlf_collections.index_name AS index_name,tx_dlf_collections.label AS collLabel,tx_dlf_collections.description AS collDesc,tx_dlf_collections.thumbnail AS collThumb,tx_dlf_collections.fe_cruser_id AS userid,tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting,tx_dlf_documents.volume_sorting AS volume_sorting,tx_dlf_documents.partof AS partof',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_collections.uid='.intval($id).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'', '',
'tx_dlf_documents.title_sorting ASC', 'tx_dlf_documents.title_sorting ASC',
'' ''
); );
$toplevel = array (); $toplevel = array ();
$subparts = array (); $subparts = array ();
$listMetadata = array (); $listMetadata = array ();
// Process results. // Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if (empty($listMetadata)) { if (empty($listMetadata)) {
$listMetadata = array ( $listMetadata = array (
'label' => htmlspecialchars($resArray['collLabel']), 'label' => htmlspecialchars($resArray['collLabel']),
'description' => $this->pi_RTEcssText($resArray['collDesc']), 'description' => $this->pi_RTEcssText($resArray['collDesc']),
'thumbnail' => htmlspecialchars($resArray['collThumb']), 'thumbnail' => htmlspecialchars($resArray['collThumb']),
'options' => array ( 'options' => array (
'source' => 'collection', 'source' => 'collection',
'select' => $id, 'select' => $id,
'userid' => $resArray['userid'], 'userid' => $resArray['userid'],
'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')), 'params' => array ('fq' => array ('collection_faceting:("'.$resArray['index_name'].'")')),
'core' => '', 'core' => '',
'pid' => $this->conf['pages'], 'pid' => $this->conf['pages'],
'order' => 'title', 'order' => 'title',
'order.asc' => TRUE 'order.asc' => TRUE
) )
); );
} }
// Split toplevel documents from volumes. // Split toplevel documents from volumes.
if ($resArray['partof'] == 0) { if ($resArray['partof'] == 0) {
// Prepare document's metadata for sorting. // Prepare document's metadata for sorting.
$sorting = unserialize($resArray['metadata_sorting']); $sorting = unserialize($resArray['metadata_sorting']);
if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) { if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) {
$sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']); $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->conf['pages']);
} }
if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) { if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) {
$sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']); $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->conf['pages']);
} }
if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) { if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) {
$sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']); $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->conf['pages']);
} }
$toplevel[$resArray['uid']] = array ( $toplevel[$resArray['uid']] = array (
'u' => $resArray['uid'], 'u' => $resArray['uid'],
'h' => '', 'h' => '',
's' => $sorting, 's' => $sorting,
'p' => array () 'p' => array ()
); );
} else { } else {
$subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid']; $subparts[$resArray['partof']][$resArray['volume_sorting']] = $resArray['uid'];
} }
} }
// Add volumes to the corresponding toplevel documents. // Add volumes to the corresponding toplevel documents.
foreach ($subparts as $partof => $parts) { foreach ($subparts as $partof => $parts) {
if (!empty($toplevel[$partof])) { if (!empty($toplevel[$partof])) {
ksort($parts); ksort($parts);
foreach ($parts as $part) { foreach ($parts as $part) {
$toplevel[$partof]['p'][] = array ('u' => $part); $toplevel[$partof]['p'][] = array ('u' => $part);
} }
} }
} }
// Save list of documents. // Save list of documents.
$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
$list->reset(); $list->reset();
$list->add(array_values($toplevel)); $list->add(array_values($toplevel));
$list->metadata = $listMetadata; $list->metadata = $listMetadata;
$list->save(); $list->save();
// Clean output buffer. // Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
// Send headers. // Send headers.
header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid'])))); header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL(array ('parameter' => $this->conf['targetPid']))));
// Flush output buffer and end script processing. // Flush output buffer and end script processing.
ob_end_flush(); ob_end_flush();
exit; exit;
} }
} }

View File

@ -19,210 +19,210 @@
*/ */
class tx_dlf_feeds extends tx_dlf_plugin { class tx_dlf_feeds extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php'; public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return void * @return void
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Don't cache the output. // Don't cache the output.
$this->setCache(FALSE); $this->setCache(FALSE);
// Create XML document. // Create XML document.
$rss = new DOMDocument('1.0', 'utf-8'); $rss = new DOMDocument('1.0', 'utf-8');
// Add mandatory root element. // Add mandatory root element.
$root = $rss->createElement('rss'); $root = $rss->createElement('rss');
$root->setAttribute('version', '2.0'); $root->setAttribute('version', '2.0');
// Add channel element. // Add channel element.
$channel = $rss->createElement('channel'); $channel = $rss->createElement('channel');
$channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8'))); $channel->appendChild($rss->createElement('title', htmlspecialchars($this->conf['title'], ENT_NOQUOTES, 'UTF-8')));
$channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8'))); $channel->appendChild($rss->createElement('link', htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->pi_linkTP_keepPIvars_url()), ENT_NOQUOTES, 'UTF-8')));
if (!empty($this->conf['description'])) { if (!empty($this->conf['description'])) {
$channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8'))); $channel->appendChild($rss->createElement('description', htmlspecialchars($this->conf['description'], ENT_QUOTES, 'UTF-8')));
} }
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_libraries.label AS label', 'tx_dlf_libraries.label AS label',
'tx_dlf_libraries', 'tx_dlf_libraries',
'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'), 'tx_dlf_libraries.pid='.intval($this->conf['pages']).' AND tx_dlf_libraries.uid='.intval($this->conf['library']).tx_dlf_helper::whereClause('tx_dlf_libraries'),
'', '',
'', '',
'1' '1'
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
$channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8'))); $channel->appendChild($rss->createElement('copyright', htmlspecialchars($resArray['label'], ENT_NOQUOTES, 'UTF-8')));
} }
$channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME']))); $channel->appendChild($rss->createElement('pubDate', date('r', $GLOBALS['EXEC_TIME'])));
$channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8'))); $channel->appendChild($rss->createElement('generator', htmlspecialchars($this->conf['useragent'], ENT_NOQUOTES, 'UTF-8')));
// Add item elements. // Add item elements.
if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) { if (!$this->conf['excludeOther'] || empty($this->piVars['collection']) || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->conf['collections'], $this->piVars['collection'])) {
$additionalWhere = ''; $additionalWhere = '';
// Check for pre-selected collections. // Check for pre-selected collections.
if (!empty($this->piVars['collection'])) { if (!empty($this->piVars['collection'])) {
$additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']); $additionalWhere = ' AND tx_dlf_collections.uid='.intval($this->piVars['collection']);
} elseif (!empty($this->conf['collections'])) { } elseif (!empty($this->conf['collections'])) {
$additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')'; $additionalWhere = ' AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).')';
} }
$result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate', 'tx_dlf_documents.uid AS uid,tx_dlf_documents.partof AS partof,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_documents.author AS author,tx_dlf_documents.record_id AS guid,tx_dlf_documents.tstamp AS tstamp,tx_dlf_documents.crdate AS crdate',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').' AND tx_dlf_collections.pid='.intval($this->conf['pages']).$additionalWhere.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'tx_dlf_documents.tstamp DESC', 'tx_dlf_documents.tstamp DESC',
intval($this->conf['limit']) intval($this->conf['limit'])
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
// Add each record as item element. // Add each record as item element.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$item = $rss->createElement('item'); $item = $rss->createElement('item');
$title = ''; $title = '';
// Get title of superior document. // Get title of superior document.
if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) { if ((empty($resArray['title']) || !empty($this->conf['prependSuperiorTitle'])) && !empty($resArray['partof'])) {
$superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE); $superiorTitle = tx_dlf_document::getTitle($resArray['partof'], TRUE);
if (!empty($superiorTitle)) { if (!empty($superiorTitle)) {
$title .= '['.$superiorTitle.']'; $title .= '['.$superiorTitle.']';
} }
} }
// Get title of document. // Get title of document.
if (!empty($resArray['title'])) { if (!empty($resArray['title'])) {
$title .= ' '.$resArray['title']; $title .= ' '.$resArray['title'];
} }
// Set default title if empty. // Set default title if empty.
if (empty($title)) { if (empty($title)) {
$title = $this->pi_getLL('noTitle'); $title = $this->pi_getLL('noTitle');
} }
// Append volume information. // Append volume information.
if (!empty($resArray['volume'])) { if (!empty($resArray['volume'])) {
$title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume']; $title .= ', '.$this->pi_getLL('volume').' '.$resArray['volume'];
} }
// Is this document new or updated? // Is this document new or updated?
if ($resArray['crdate'] == $resArray['tstamp']) { if ($resArray['crdate'] == $resArray['tstamp']) {
$title = $this->pi_getLL('new').' '.trim($title); $title = $this->pi_getLL('new').' '.trim($title);
} else { } else {
$title = $this->pi_getLL('update').' '.trim($title); $title = $this->pi_getLL('update').' '.trim($title);
} }
$item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'))); $item->appendChild($rss->createElement('title', htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8')));
// Add link. // Add link.
$linkConf = array ( $linkConf = array (
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'forceAbsoluteUrl' => 1, 'forceAbsoluteUrl' => 1,
'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE) 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('id' => $resArray['uid']), '', TRUE, FALSE)
); );
$item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8'))); $item->appendChild($rss->createElement('link', htmlspecialchars($this->cObj->typoLink_URL($linkConf), ENT_NOQUOTES, 'UTF-8')));
// Add author if applicable. // Add author if applicable.
if (!empty($resArray['author'])) { if (!empty($resArray['author'])) {
$item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8'))); $item->appendChild($rss->createElement('author', htmlspecialchars($resArray['author'], ENT_NOQUOTES, 'UTF-8')));
} }
// Add online publication date. // Add online publication date.
$item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate']))); $item->appendChild($rss->createElement('pubDate', date('r', $resArray['crdate'])));
// Add internal record identifier. // Add internal record identifier.
$item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8'))); $item->appendChild($rss->createElement('guid', htmlspecialchars($resArray['guid'], ENT_NOQUOTES, 'UTF-8')));
$channel->appendChild($item); $channel->appendChild($item);
} }
} }
} }
$root->appendChild($channel); $root->appendChild($channel);
// Build XML output. // Build XML output.
$rss->appendChild($root); $rss->appendChild($root);
$content = $rss->saveXML(); $content = $rss->saveXML();
// Clean output buffer. // Clean output buffer.
\TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers();
// Send headers. // Send headers.
header('HTTP/1.1 200 OK'); header('HTTP/1.1 200 OK');
header('Cache-Control: no-cache'); header('Cache-Control: no-cache');
header('Content-Length: '.strlen($content)); header('Content-Length: '.strlen($content));
header('Content-Type: application/rss+xml; charset=utf-8'); header('Content-Type: application/rss+xml; charset=utf-8');
header('Date: '.date('r', $GLOBALS['EXEC_TIME'])); header('Date: '.date('r', $GLOBALS['EXEC_TIME']));
header('Expires: '.date('r', $GLOBALS['EXEC_TIME'])); header('Expires: '.date('r', $GLOBALS['EXEC_TIME']));
echo $content; echo $content;
// Flush output buffer and end script processing. // Flush output buffer and end script processing.
ob_end_flush(); ob_end_flush();
exit; exit;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,391 +20,391 @@
*/ */
class tx_dlf_metadata extends tx_dlf_plugin { class tx_dlf_metadata extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php';
/** /**
* This holds the hook objects * This holds the hook objects
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $hookObjects = array (); protected $hookObjects = array ();
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Turn cache on. // Turn cache on.
$this->setCache(TRUE); $this->setCache(TRUE);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
// Set default values if not set. // Set default values if not set.
if (!isset($this->conf['rootline'])) { if (!isset($this->conf['rootline'])) {
$this->conf['rootline'] = 0; $this->conf['rootline'] = 0;
} }
} }
$metadata = array (); $metadata = array ();
if ($this->conf['rootline'] < 2) { if ($this->conf['rootline'] < 2) {
// Get current structure's @ID. // Get current structure's @ID.
$ids = array (); $ids = array ();
if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) {
foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) {
$count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'));
$ids[$count][] = $logId; $ids[$count][] = $logId;
} }
} }
ksort($ids); ksort($ids);
reset($ids); reset($ids);
// Check if we should display all metadata up to the root. // Check if we should display all metadata up to the root.
if ($this->conf['rootline'] == 1) { if ($this->conf['rootline'] == 1) {
foreach ($ids as $id) { foreach ($ids as $id) {
foreach ($id as $sid) { foreach ($id as $sid) {
$data = $this->doc->getMetadata($sid, $this->conf['pages']); $data = $this->doc->getMetadata($sid, $this->conf['pages']);
if (!empty($data)) { if (!empty($data)) {
$data['_id'] = $sid; $data['_id'] = $sid;
$metadata[] = $data; $metadata[] = $data;
} }
} }
} }
} else { } else {
$id = array_pop($ids); $id = array_pop($ids);
if (is_array($id)) { if (is_array($id)) {
foreach ($id as $sid) { foreach ($id as $sid) {
$data = $this->doc->getMetadata($sid, $this->conf['pages']); $data = $this->doc->getMetadata($sid, $this->conf['pages']);
if (!empty($data)) { if (!empty($data)) {
$data['_id'] = $sid; $data['_id'] = $sid;
$metadata[] = $data; $metadata[] = $data;
} }
} }
} }
} }
} }
// Get titledata? // Get titledata?
if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) {
$data = $this->doc->getTitleData($this->conf['pages']); $data = $this->doc->getTitleData($this->conf['pages']);
$data['_id'] = $this->doc->toplevelId; $data['_id'] = $this->doc->toplevelId;
array_unshift($metadata, $data); array_unshift($metadata, $data);
} }
if (empty($metadata)) { if (empty($metadata)) {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
} }
return $content; return $content;
} }
ksort($metadata); ksort($metadata);
// Get hook objects. // Get hook objects.
$this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath);
// Hook for getting a customized title bar (requested by SBB). // Hook for getting a customized title bar (requested by SBB).
foreach ($this->hookObjects as $hookObj) { foreach ($this->hookObjects as $hookObj) {
if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) {
$hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata);
} }
} }
$content .= $this->printMetadata($metadata); $content .= $this->printMetadata($metadata);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* Prepares the metadata array for output * Prepares the metadata array for output
* *
* @access protected * @access protected
* *
* @param array $metadataArray: The metadata array * @param array $metadataArray: The metadata array
* *
* @return string The metadata array ready for output * @return string The metadata array ready for output
*/ */
protected function printMetadata(array $metadataArray) { protected function printMetadata(array $metadataArray) {
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###');
} }
$output = ''; $output = '';
$subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###');
// Get list of metadata to show. // Get list of metadata to show.
$metaList = array (); $metaList = array ();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap',
'tx_dlf_metadata', 'tx_dlf_metadata',
'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))', 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = ' .$GLOBALS['TSFE']->sys_language_uid. ' AND l18n_parent = 0))',
'', '',
'tx_dlf_metadata.sorting', 'tx_dlf_metadata.sorting',
'' ''
); );
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) {
$resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
} }
if ($resArray) { if ($resArray) {
// get correct language uid for translated realurl link // get correct language uid for translated realurl link
$link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid'];
// do stuff with the row entry data like built HTML or prepare further usage // do stuff with the row entry data like built HTML or prepare further usage
if ($this->conf['showFull'] || $resArray['is_listed']) { if ($this->conf['showFull'] || $resArray['is_listed']) {
$metaList[$resArray['index_name']] = array ( $metaList[$resArray['index_name']] = array (
'wrap' => $resArray['wrap'], 'wrap' => $resArray['wrap'],
'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages'])
); );
} }
} }
} }
// Get list of collections to show. // Get list of collections to show.
$collList = array (); $collList = array ();
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_collections.index_name AS index_name', 'tx_dlf_collections.index_name AS index_name',
'tx_dlf_collections', 'tx_dlf_collections',
'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'),
'', '',
'', '',
'' ''
); );
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$collList[] = $resArray['index_name']; $collList[] = $resArray['index_name'];
} }
// Save original data array. // Save original data array.
$cObjData = $this->cObj->data; $cObjData = $this->cObj->data;
// Parse the metadata arrays. // Parse the metadata arrays.
foreach ($metadataArray as $metadata) { foreach ($metadataArray as $metadata) {
$markerArray['###METADATA###'] = ''; $markerArray['###METADATA###'] = '';
// Reset content object's data array. // Reset content object's data array.
$this->cObj->data = $cObjData; $this->cObj->data = $cObjData;
// Load all the metadata values into the content object's data array. // Load all the metadata values into the content object's data array.
foreach ($metadata as $index_name => $value) { foreach ($metadata as $index_name => $value) {
if (is_array($value)) { if (is_array($value)) {
$this->cObj->data[$index_name] = implode($this->conf['separator'], $value); $this->cObj->data[$index_name] = implode($this->conf['separator'], $value);
} else { } else {
$this->cObj->data[$index_name] = $value; $this->cObj->data[$index_name] = $value;
} }
} }
// Process each metadate. // Process each metadate.
foreach ($metaList as $index_name => $metaConf) { foreach ($metaList as $index_name => $metaConf) {
$parsedValue = ''; $parsedValue = '';
$fieldwrap = $this->parseTS($metaConf['wrap']); $fieldwrap = $this->parseTS($metaConf['wrap']);
do { do {
$value = @array_shift($metadata[$index_name]); $value = @array_shift($metadata[$index_name]);
if ($index_name == 'title') { if ($index_name == 'title') {
// Get title of parent document if needed. // Get title of parent document if needed.
if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) {
$superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE);
if (!empty($superiorTitle)) { if (!empty($superiorTitle)) {
$value = '['.$superiorTitle.']'; $value = '['.$superiorTitle.']';
} }
} }
if (!empty($value)) { if (!empty($value)) {
$value = htmlspecialchars($value); $value = htmlspecialchars($value);
// Link title to pageview. // Link title to pageview.
if ($this->conf['linkTitle'] && $metadata['_id']) { if ($this->conf['linkTitle'] && $metadata['_id']) {
$details = $this->doc->getLogicalStructure($metadata['_id']); $details = $this->doc->getLogicalStructure($metadata['_id']);
$value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']);
} }
} }
} elseif ($index_name == 'owner' && !empty($value)) { } elseif ($index_name == 'owner' && !empty($value)) {
// Translate name of holding library. // Translate name of holding library.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
} elseif ($index_name == 'type' && !empty($value)) { } elseif ($index_name == 'type' && !empty($value)) {
// Translate document type. // Translate document type.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
} elseif ($index_name == 'collection' && !empty($value)) { } elseif ($index_name == 'collection' && !empty($value)) {
// Check if collections isn't hidden. // Check if collections isn't hidden.
if (in_array($value, $collList)) { if (in_array($value, $collList)) {
// Translate collection. // Translate collection.
$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages']));
} else { } else {
$value = ''; $value = '';
} }
} elseif ($index_name == 'language' && !empty($value)) { } elseif ($index_name == 'language' && !empty($value)) {
// Translate ISO 639 language code. // Translate ISO 639 language code.
$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
} elseif (!empty($value)) { } elseif (!empty($value)) {
// Sanitize value for output. // Sanitize value for output.
$value = htmlspecialchars($value); $value = htmlspecialchars($value);
} }
// Hook for getting a customized value (requested by SBB). // Hook for getting a customized value (requested by SBB).
foreach ($this->hookObjects as $hookObj) { foreach ($this->hookObjects as $hookObj) {
if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { if (method_exists($hookObj, 'printMetadata_customizeMetadata')) {
$hookObj->printMetadata_customizeMetadata($value); $hookObj->printMetadata_customizeMetadata($value);
} }
} }
$value = $this->cObj->stdWrap($value, $fieldwrap['value.']); $value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
if (!empty($value)) { if (!empty($value)) {
$parsedValue .= $value; $parsedValue .= $value;
} }
} while (count($metadata[$index_name])); } while (count($metadata[$index_name]));
if (!empty($parsedValue)) { if (!empty($parsedValue)) {
$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
$field .= $parsedValue; $field .= $parsedValue;
$markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
} }
} }
$output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray);
} }
return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE);
} }
} }

View File

@ -19,315 +19,315 @@
*/ */
class tx_dlf_navigation extends tx_dlf_plugin { class tx_dlf_navigation extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php'; public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php';
/** /**
* Display a link to the list view * Display a link to the list view
* *
* @access protected * @access protected
* *
* @return string Link to the list view ready to output * @return string Link to the list view ready to output
*/ */
protected function getLinkToListview() { protected function getLinkToListview() {
if (!empty($this->conf['targetPid'])) { if (!empty($this->conf['targetPid'])) {
// Load the list. // Load the list.
$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
if (count($list) > 0) { if (count($list) > 0) {
// Build typolink configuration array. // Build typolink configuration array.
$conf = array ( $conf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'title' => $this->pi_getLL('linkToList', '', TRUE) 'title' => $this->pi_getLL('linkToList', '', TRUE)
); );
return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf); return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf);
} }
} }
return ''; return '';
} }
/** /**
* Display the page selector for the page view * Display the page selector for the page view
* *
* @access protected * @access protected
* *
* @return string Page selector ready to output * @return string Page selector ready to output
*/ */
protected function getPageSelector() { protected function getPageSelector() {
// Configure @action URL for form. // Configure @action URL for form.
$linkConf = array ( $linkConf = array (
'parameter' => $GLOBALS['TSFE']->id, 'parameter' => $GLOBALS['TSFE']->id,
'forceAbsoluteUrl' => 1 'forceAbsoluteUrl' => 1
); );
$output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />'; $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
// Add plugin variables. // Add plugin variables.
foreach ($this->piVars as $piVar => $value) { foreach ($this->piVars as $piVar => $value) {
if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) { if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) {
$output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />'; $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />';
} }
} }
// Add page selector. // Add page selector.
$uniqId = uniqid(str_replace('_', '-', get_class($this)).'-'); $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-');
$output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>'; $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>';
for ($i = 1; $i <= $this->doc->numPages; $i++) { for ($i = 1; $i <= $this->doc->numPages; $i++) {
$output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>'; $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>';
} }
$output .= '</select></div></form>'; $output .= '</select></div></form>';
return $output; return $output;
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Turn cache on. // Turn cache on.
$this->setCache(TRUE); $this->setCache(TRUE);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
// Set default values if not set. // Set default values if not set.
if ($this->doc->numPages > 0) { if ($this->doc->numPages > 0) {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear // The logical page parameter should not appear
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} else { } else {
$this->piVars['page'] = 0; $this->piVars['page'] = 0;
$this->piVars['double'] = 0; $this->piVars['double'] = 0;
} }
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###');
} }
// Steps for X pages backward / forward. Double page view uses double steps. // Steps for X pages backward / forward. Double page view uses double steps.
$pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1); $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1);
// Link to first page. // Link to first page.
if ($this->piVars['page'] > 1) { if ($this->piVars['page'] > 1) {
$markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1)); $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1));
} else { } else {
$markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>'; $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>';
} }
// Link back X pages. // Link back X pages.
if ($this->piVars['page'] > $pageSteps) { if ($this->piVars['page'] > $pageSteps) {
$markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps)); $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps));
} else { } else {
$markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>'; $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>';
} }
// Link to previous page. // Link to previous page.
if ($this->piVars['page'] > (1 + $this->piVars['double'])) { if ($this->piVars['page'] > (1 + $this->piVars['double'])) {
$markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double']))); $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double'])));
} else { } else {
$markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>'; $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>';
} }
// Link to next page. // Link to next page.
if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) { if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) {
$markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double']))); $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double'])));
} else { } else {
$markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>'; $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>';
} }
// Link forward X pages. // Link forward X pages.
if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) { if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) {
$markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps)); $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps));
} else { } else {
$markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>'; $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>';
} }
// Link to last page. // Link to last page.
if ($this->piVars['page'] < $this->doc->numPages) { if ($this->piVars['page'] < $this->doc->numPages) {
$markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages)); $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages));
} else { } else {
$markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>'; $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>';
} }
// Add double page switcher. // Add double page switcher.
if ($this->doc->numPages > 0) { if ($this->doc->numPages > 0) {
if (!$this->piVars['double']) { if (!$this->piVars['double']) {
$markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"'); $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"');
} else { } else {
$markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"'); $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"');
} }
if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
$markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1)); $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1));
} else { } else {
$markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
} }
} else { } else {
$markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>'; $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>';
$markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>'; $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
} }
// Add page selector. // Add page selector.
$markerArray['###PAGESELECT###'] = $this->getPageSelector(); $markerArray['###PAGESELECT###'] = $this->getPageSelector();
// Add link to listview if applicable. // Add link to listview if applicable.
$markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview(); $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview();
// fill some language labels if available // fill some language labels if available
$markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE); $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE);
$markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE); $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE);
$markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE); $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE);
$markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE); $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE);
$markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE); $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE);
$markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE); $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE);
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* Generates a navigation link * Generates a navigation link
* *
* @access protected * @access protected
* *
* @param string $label: The link's text * @param string $label: The link's text
* @param array $overrulePIvars: The new set of plugin variables * @param array $overrulePIvars: The new set of plugin variables
* @param string $aTagParams: Additional HTML attributes for link tag * @param string $aTagParams: Additional HTML attributes for link tag
* *
* @return string Typolink ready to output * @return string Typolink ready to output
*/ */
protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') { protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') {
// Merge plugin variables with new set of values. // Merge plugin variables with new set of values.
if (is_array($this->piVars)) { if (is_array($this->piVars)) {
$piVars = $this->piVars; $piVars = $this->piVars;
unset($piVars['DATA']); unset($piVars['DATA']);
$overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars); $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars);
} }
// Build typolink configuration array. // Build typolink configuration array.
$conf = array ( $conf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $GLOBALS['TSFE']->id, 'parameter' => $GLOBALS['TSFE']->id,
'ATagParams' => $aTagParams, 'ATagParams' => $aTagParams,
'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE), 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE),
'title' => $label 'title' => $label
); );
return $this->cObj->typoLink($label, $conf); return $this->cObj->typoLink($label, $conf);
} }
} }

View File

@ -20,406 +20,406 @@
*/ */
class tx_dlf_newspaper extends tx_dlf_plugin { class tx_dlf_newspaper extends tx_dlf_plugin {
public $extKey = 'dlf'; public $extKey = 'dlf';
public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php'; public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
// Nothing to do here. // Nothing to do here.
return $content; return $content;
} }
/** /**
* The Calendar Method * The Calendar Method
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function calendar($content, $conf) { public function calendar($content, $conf) {
$this->init($conf); $this->init($conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###');
} }
// Get all children of year anchor. // Get all children of year anchor.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year', 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year',
'tx_dlf_documents', 'tx_dlf_documents',
'(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'title ASC', 'title ASC',
'' ''
); );
// Process results. // Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$issues[] = array ( $issues[] = array (
'uid' => $resArray['uid'], 'uid' => $resArray['uid'],
'title' => $resArray['title'], 'title' => $resArray['title'],
'year' => $resArray['year'] 'year' => $resArray['year']
); );
} }
// We need an array of issues with month number as key. // We need an array of issues with month number as key.
$calendarIssues = array (); $calendarIssues = array ();
foreach ($issues as $issue) { foreach ($issues as $issue) {
$calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue; $calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue;
} }
$allIssues = array (); $allIssues = array ();
// Get subpart templates. // Get subpart templates.
$subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###'); $subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###');
$subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###'); $subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###');
$subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###'); $subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###');
$subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###'); $subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###');
// Build calendar for given year. // Build calendar for given year.
$year = date('Y', strtotime($issues[0]['year'])); $year = date('Y', strtotime($issues[0]['year']));
for ($i = 0; $i <= 11; $i++) { for ($i = 0; $i <= 11; $i++) {
$markerArray = array ( $markerArray = array (
'###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')), '###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')),
'###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')), '###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')),
'###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')), '###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')),
'###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')), '###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')),
'###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')), '###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')),
'###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')), '###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')),
'###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')), '###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')),
'###MONTHNAME###' => strftime('%B', strtotime($year . '-' . ($i + 1) . '-1')) '###MONTHNAME###' => strftime('%B', strtotime($year . '-' . ($i + 1) . '-1'))
); );
// Reset week content of new month. // Reset week content of new month.
$subWeekPartContent = ''; $subWeekPartContent = '';
$firstOfMonth = strtotime($year . '-' . ($i + 1) . '-1'); $firstOfMonth = strtotime($year . '-' . ($i + 1) . '-1');
$lastOfMonth = strtotime('last day of', ($firstOfMonth)); $lastOfMonth = strtotime('last day of', ($firstOfMonth));
$firstOfMonthStart = strtotime('last Monday', $firstOfMonth); $firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
// There are never more than 6 weeks in a month. // There are never more than 6 weeks in a month.
for ($j = 0; $j <= 5; $j++) { for ($j = 0; $j <= 5; $j++) {
$firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart); $firstDayOfWeek = strtotime('+ ' . $j . ' Week', $firstOfMonthStart);
$weekArray = array( $weekArray = array(
'###DAYMON###' => '&nbsp;', '###DAYMON###' => '&nbsp;',
'###DAYTUE###' => '&nbsp;', '###DAYTUE###' => '&nbsp;',
'###DAYWED###' => '&nbsp;', '###DAYWED###' => '&nbsp;',
'###DAYTHU###' => '&nbsp;', '###DAYTHU###' => '&nbsp;',
'###DAYFRI###' => '&nbsp;', '###DAYFRI###' => '&nbsp;',
'###DAYSAT###' => '&nbsp;', '###DAYSAT###' => '&nbsp;',
'###DAYSUN###' => '&nbsp;', '###DAYSUN###' => '&nbsp;',
); );
// Every week has seven days. ;-) // Every week has seven days. ;-)
for ($k = 0; $k <= 6; $k++) { for ($k = 0; $k <= 6; $k++) {
$currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek); $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek);
if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) { if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) {
$dayLinks = ''; $dayLinks = '';
$dayLinksText = array (); $dayLinksText = array ();
$dayLinksList = ''; $dayLinksList = '';
$currentMonth = date('n', $currentDayTime); $currentMonth = date('n', $currentDayTime);
if (is_array($calendarIssues[$currentMonth])) { if (is_array($calendarIssues[$currentMonth])) {
foreach ($calendarIssues[$currentMonth] as $id => $day) { foreach ($calendarIssues[$currentMonth] as $id => $day) {
if ($id == date('j', $currentDayTime)) { if ($id == date('j', $currentDayTime)) {
$dayLinks = $id; $dayLinks = $id;
foreach ($day as $issue) { foreach ($day as $issue) {
$dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title']; $dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title'];
$linkConf = array ( $linkConf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($issue['uid']), 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($issue['uid']),
'ATagParams' => ' class="title"', 'ATagParams' => ' class="title"',
); );
$dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf); $dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
// Save issues for list view. // Save issues for list view.
$allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf); $allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
} }
} }
} }
if (!empty($dayLinksText)) { if (!empty($dayLinksText)) {
$dayLinksList = '<ul>'; $dayLinksList = '<ul>';
foreach ($dayLinksText as $link) { foreach ($dayLinksText as $link) {
$dayLinksList .= '<li>'.$link.'</li>'; $dayLinksList .= '<li>'.$link.'</li>';
} }
$dayLinksList .= '</ul>'; $dayLinksList .= '</ul>';
} }
$dayLinkDiv = '<div class="issues"><h4>' . strftime('%d', $currentDayTime) . '</h4><div>'.$dayLinksList.'</div></div>'; $dayLinkDiv = '<div class="issues"><h4>' . strftime('%d', $currentDayTime) . '</h4><div>'.$dayLinksList.'</div></div>';
} }
switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) { switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) {
case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime); case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
break; break;
} }
} }
} }
// Fill the weeks. // Fill the weeks.
$subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray); $subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray);
} }
// Fill the month markers. // Fill the month markers.
$subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray); $subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray);
// Fill the week markers with the week entries. // Fill the week markers with the week entries.
$subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent); $subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent);
} }
// Link to years overview // Link to years overview
$linkConf = array ( $linkConf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->parentId), 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->parentId),
); );
$allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' . $this->doc->getTitle($this->doc->parentId), $linkConf); $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' . $this->doc->getTitle($this->doc->parentId), $linkConf);
// Link to current year. // Link to current year.
$linkConf = array ( $linkConf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->uid), 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($this->doc->uid),
); );
$yearLink = $this->cObj->typoLink($year, $linkConf); $yearLink = $this->cObj->typoLink($year, $linkConf);
// Prepare list as alternative of the calendar view. // Prepare list as alternative of the calendar view.
foreach($allIssues as $dayTime => $issues) { foreach($allIssues as $dayTime => $issues) {
$markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime); $markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime);
$markerArrayDay['###ITEMS###'] = ''; $markerArrayDay['###ITEMS###'] = '';
foreach ($issues as $issue) { foreach ($issues as $issue) {
$markerArrayDay['###ITEMS###'] .= $issue; $markerArrayDay['###ITEMS###'] .= $issue;
} }
$subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay); $subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay);
} }
$this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList); $this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList);
if (count($allIssues) < 6) { if (count($allIssues) < 6) {
$listViewActive = TRUE; $listViewActive = TRUE;
} else { } else {
$listViewActive = FALSE; $listViewActive = FALSE;
} }
$markerArray = array ( $markerArray = array (
'###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active', '###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active',
'###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '', '###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '',
'###CALYEAR###' => $yearLink, '###CALYEAR###' => $yearLink,
'###CALALLYEARS###' => $allYearsLink, '###CALALLYEARS###' => $allYearsLink,
'###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'), '###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'),
'###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'), '###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'),
); );
$this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent); return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent);
} }
/** /**
* The Year Method * The Year Method
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function years($content, $conf) { public function years($content, $conf) {
$this->init($conf); $this->init($conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###');
} }
// Get subpart templates // Get subpart templates
$subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###'); $subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###');
// get the title of the anchor file // get the title of the anchor file
$titleAnchor = $this->doc->getTitle($this->doc->uid); $titleAnchor = $this->doc->getTitle($this->doc->uid);
// get all children of anchor. this should be the year anchor documents // get all children of anchor. this should be the year anchor documents
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title', 'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title',
'tx_dlf_documents', 'tx_dlf_documents',
'(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'title ASC', 'title ASC',
'' ''
); );
// Process results. // Process results.
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$years[] = array ( $years[] = array (
'title' => $resArray['title'], 'title' => $resArray['title'],
'uid' => $resArray['uid'] 'uid' => $resArray['uid']
); );
} }
$subYearPartContent = ''; $subYearPartContent = '';
if (count($years) > 0) { if (count($years) > 0) {
foreach ($years as $id => $year) { foreach ($years as $id => $year) {
$linkConf = array( $linkConf = array(
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($year['uid']), 'additionalParams' => '&' . $this->prefixId . '[id]=' . urlencode($year['uid']),
'title' => $titleAnchor . ': ' . $year['title'] 'title' => $titleAnchor . ': ' . $year['title']
); );
$yearArray = array( $yearArray = array(
'###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf), '###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf),
); );
$subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray); $subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray);
} }
} }
// link to years overview (should be itself here) // link to years overview (should be itself here)
$linkConf = array ( $linkConf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => '&' . $this->prefixId . '[id]=' . $this->doc->uid, 'additionalParams' => '&' . $this->prefixId . '[id]=' . $this->doc->uid,
); );
$allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' .$this->doc->getTitle($this->doc->uid), $linkConf); $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE) . ' ' .$this->doc->getTitle($this->doc->uid), $linkConf);
// Fill markers. // Fill markers.
$markerArray = array ( $markerArray = array (
'###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'), '###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'),
'###CALALLYEARS###' => $allYearsLink '###CALALLYEARS###' => $allYearsLink
); );
$this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray); $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
// fill the week markers // fill the week markers
return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent); return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,271 +20,271 @@
*/ */
class tx_dlf_pagegrid extends tx_dlf_plugin { class tx_dlf_pagegrid extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php'; public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php';
/** /**
* Renders entry for one page of the current document. * Renders entry for one page of the current document.
* *
* @access protected * @access protected
* *
* @param integer $number: The page to render * @param integer $number: The page to render
* @param string $template: Parsed template subpart * @param string $template: Parsed template subpart
* *
* @return string The rendered entry ready for output * @return string The rendered entry ready for output
*/ */
protected function getEntry($number, $template) { protected function getEntry($number, $template) {
// Set current page if applicable. // Set current page if applicable.
if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) { if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) {
$markerArray['###STATE###'] = 'cur'; $markerArray['###STATE###'] = 'cur';
} else { } else {
$markerArray['###STATE###'] = 'no'; $markerArray['###STATE###'] = 'no';
} }
// Set page number. // Set page number.
$markerArray['###NUMBER###'] = $number; $markerArray['###NUMBER###'] = $number;
// Set pagination. // Set pagination.
$markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel']; $markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel'];
// Get thumbnail or placeholder. // Get thumbnail or placeholder.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) {
$thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]); $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]);
} elseif (!empty($this->conf['placeholder'])) { } elseif (!empty($this->conf['placeholder'])) {
$thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']); $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']);
} else { } else {
$thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg'; $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg';
} }
$thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />'; $thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />';
// Get new plugin variables for typolink. // Get new plugin variables for typolink.
$piVars = $this->piVars; $piVars = $this->piVars;
// Unset no longer needed plugin variables. // Unset no longer needed plugin variables.
// unset($piVars['pagegrid']) is for DFG Viewer compatibility! // unset($piVars['pagegrid']) is for DFG Viewer compatibility!
unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']); unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']);
$piVars['page'] = $number; $piVars['page'] = $number;
$linkConf = array ( $linkConf = array (
'useCacheHash' => 1, 'useCacheHash' => 1,
'parameter' => $this->conf['targetPid'], 'parameter' => $this->conf['targetPid'],
'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE),
'title' => $markerArray['###PAGINATION###'] 'title' => $markerArray['###PAGINATION###']
); );
$markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf); $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf);
return $this->cObj->substituteMarkerArray($template, $markerArray); return $this->cObj->substituteMarkerArray($template, $markerArray);
} }
/** /**
* Renders the page browser * Renders the page browser
* *
* @access protected * @access protected
* *
* @return string The rendered page browser ready for output * @return string The rendered page browser ready for output
*/ */
protected function getPageBrowser() { protected function getPageBrowser() {
// Get overall number of pages. // Get overall number of pages.
$maxPages = intval(ceil($this->doc->numPages / $this->conf['limit'])); $maxPages = intval(ceil($this->doc->numPages / $this->conf['limit']));
// Return empty pagebrowser if there is just one page. // Return empty pagebrowser if there is just one page.
if ($maxPages < 2) { if ($maxPages < 2) {
return ''; return '';
} }
// Get separator. // Get separator.
$separator = $this->pi_getLL('separator', ' - ', TRUE); $separator = $this->pi_getLL('separator', ' - ', TRUE);
// Add link to previous page. // Add link to previous page.
if ($this->piVars['pointer'] > 0) { if ($this->piVars['pointer'] > 0) {
$output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator; $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator;
} else { } else {
$output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator; $output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator;
} }
$i = 0; $i = 0;
// Add links to pages. // Add links to pages.
while ($i < $maxPages) { while ($i < $maxPages) {
if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) { if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
if ($this->piVars['pointer'] != $i) { if ($this->piVars['pointer'] != $i) {
$output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator; $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator;
} else { } else {
$output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator; $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator;
} }
$skip = TRUE; $skip = TRUE;
} elseif ($skip == TRUE) { } elseif ($skip == TRUE) {
$output .= $this->pi_getLL('skip', '...', TRUE).$separator; $output .= $this->pi_getLL('skip', '...', TRUE).$separator;
$skip = FALSE; $skip = FALSE;
} }
$i++; $i++;
} }
// Add link to next page. // Add link to next page.
if ($this->piVars['pointer'] < $maxPages - 1) { if ($this->piVars['pointer'] < $maxPages - 1) {
$output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE); $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE);
} else { } else {
$output .= $this->pi_getLL('nextPage', '&gt;', TRUE); $output .= $this->pi_getLL('nextPage', '&gt;', TRUE);
} }
return $output; return $output;
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) { if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
// Set default values for page if not set. // Set default values for page if not set.
$this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0); $this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0);
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###');
} }
$entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###'); $entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###');
if (empty($entryTemplate)) { if (empty($entryTemplate)) {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
} }
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} }
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear // The logical page parameter should not appear
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set some variable defaults. // Set some variable defaults.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
if (!empty($this->piVars['page'])) { if (!empty($this->piVars['page'])) {
$this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit'])); $this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit']));
} }
if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) { if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) {
$this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0); $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
} else { } else {
$this->piVars['pointer'] = 0; $this->piVars['pointer'] = 0;
} }
// Iterate through visible page set and display thumbnails. // Iterate through visible page set and display thumbnails.
for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) { for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
// +1 because page counting starts at 1. // +1 because page counting starts at 1.
$number = $i + 1; $number = $i + 1;
if ($number > $this->doc->numPages) { if ($number > $this->doc->numPages) {
break; break;
} else { } else {
$content .= $this->getEntry($number, $entryTemplate); $content .= $this->getEntry($number, $entryTemplate);
} }
} }
// Render page browser. // Render page browser.
$markerArray['###PAGEBROWSER###'] = $this->getPageBrowser(); $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
// Merge everything with template. // Merge everything with template.
$content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray); $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

View File

@ -22,65 +22,65 @@ use \TYPO3\CMS\Core\Utility\GeneralUtility;
*/ */
class tx_dlf_geturl_eid extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { class tx_dlf_geturl_eid extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
/** /**
* *
*/ */
public $cObj; public $cObj;
/** /**
* The main method of the eID-Script * The main method of the eID-Script
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return void * @return void
*/ */
public function main($content = '', $conf = array ()) { public function main($content = '', $conf = array ()) {
$this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->extKey = 'dlf'; $this->extKey = 'dlf';
$this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php'; $this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php';
$url = GeneralUtility::_GP('url'); $url = GeneralUtility::_GP('url');
$includeHeader = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(GeneralUtility::_GP('header'), 0, 2, 0); $includeHeader = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(GeneralUtility::_GP('header'), 0, 2, 0);
// first we fetch header separately // first we fetch header separately
$fetchedHeader = GeneralUtility::getUrl($url, 2); $fetchedHeader = GeneralUtility::getUrl($url, 2);
if ($includeHeader == 0) { if ($includeHeader == 0) {
$fetchedData = GeneralUtility::getUrl($url, $includeHeader); $fetchedData = GeneralUtility::getUrl($url, $includeHeader);
} else { } else {
$fetchedData = $fetchedHeader; $fetchedData = $fetchedHeader;
} }
// add some self calculated header tags // add some self calculated header tags
header('Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . 'GMT'); header('Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . 'GMT');
header('Cache-Control: max-age=3600, must-revalidate'); header('Cache-Control: max-age=3600, must-revalidate');
header('Content-Length: '.strlen($fetchedData)); header('Content-Length: '.strlen($fetchedData));
$fi = finfo_open(FILEINFO_MIME); $fi = finfo_open(FILEINFO_MIME);
header('Content-Type: ' . finfo_buffer($fi, $fetchedData)); header('Content-Type: ' . finfo_buffer($fi, $fetchedData));
// take some tags from request header and overwrite in case already set // take some tags from request header and overwrite in case already set
$fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2)); $fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2));
foreach ($fetchedHeader as $headerline) { foreach ($fetchedHeader as $headerline) {
if (stripos($headerline, 'Last-Modified:') !== FALSE) { if (stripos($headerline, 'Last-Modified:') !== FALSE) {
header($headerline); header($headerline);
} }
} }
echo $fetchedData; echo $fetchedData;
} }
} }

View File

@ -19,69 +19,69 @@
*/ */
class tx_dlf_pageview extends tx_dlf_plugin { class tx_dlf_pageview extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php'; public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php';
/** /**
* Holds the controls to add to the map * Holds the controls to add to the map
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $controls = array (); protected $controls = array ();
/** /**
* Holds the current images' URLs and MIME types * Holds the current images' URLs and MIME types
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $images = array (); protected $images = array ();
/** /**
* Holds the current fulltexts' URLs * Holds the current fulltexts' URLs
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $fulltexts = array (); protected $fulltexts = array ();
/** /**
* Adds Viewer javascript * Adds Viewer javascript
* *
* @access protected * @access protected
* *
* @return string Viewer script tags ready for output * @return string Viewer script tags ready for output
*/ */
protected function addViewerJS() { protected function addViewerJS() {
$output = array (); $output = array ();
// Add OpenLayers library. // Add OpenLayers library.
$output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>';
// Add viewer library. // Add viewer library.
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>'; $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>';
// Add viewer configuration. // Add viewer configuration.
$output[] = ' $output[] = '
<script id="tx-dlf-pageview-initViewer" type="text/javascript"> <script id="tx-dlf-pageview-initViewer" type="text/javascript">
window.onload = function() { window.onload = function() {
if (dlfUtils.exists(dlfViewer)) { if (dlfUtils.exists(dlfViewer)) {
@ -96,11 +96,11 @@ class tx_dlf_pageview extends tx_dlf_plugin {
} }
</script>'; </script>';
return implode("\n", $output); return implode("\n", $output);
} }
/** /**
* Adds pageview interaction (crop, magnifier and rotation) * Adds pageview interaction (crop, magnifier and rotation)
* *
* @access protected * @access protected
@ -225,183 +225,183 @@ class tx_dlf_pageview extends tx_dlf_plugin {
/** /**
* Get image's URL and MIME type * Get image's URL and MIME type
* *
* @access protected * @access protected
* *
* @param integer $page: Page number * @param integer $page: Page number
* *
* @return array URL and MIME type of image file * @return array URL and MIME type of image file
*/ */
protected function getImage($page) { protected function getImage($page) {
$image = array (); $image = array ();
// Get @USE value of METS fileGrp. // Get @USE value of METS fileGrp.
$fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']);
while ($fileGrp = @array_pop($fileGrps)) { while ($fileGrp = @array_pop($fileGrps)) {
// Get image link. // Get image link.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
$image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
if ($this->conf['useInternalProxy']) { if ($this->conf['useInternalProxy']) {
// Configure @action URL for form. // Configure @action URL for form.
$linkConf = array ( $linkConf = array (
'parameter' => $GLOBALS['TSFE']->id, 'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']),
); );
$image['url'] = $this->cObj->typoLink_URL($linkConf); $image['url'] = $this->cObj->typoLink_URL($linkConf);
} }
$image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
break; break;
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
} }
return $image; return $image;
} }
/** /**
* Get fulltext URL and MIME type * Get fulltext URL and MIME type
* *
* @access protected * @access protected
* *
* @param integer $page: Page number * @param integer $page: Page number
* *
* @return array URL and MIME type of fulltext file * @return array URL and MIME type of fulltext file
*/ */
protected function getFulltext($page) { protected function getFulltext($page) {
$fulltext = array (); $fulltext = array ();
// Get fulltext link. // Get fulltext link.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) {
$fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
// Configure @action URL for form. // Configure @action URL for form.
$linkConf = array ( $linkConf = array (
'parameter' => $GLOBALS['TSFE']->id, 'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']),
); );
$fulltext['url'] = $this->cObj->typoLink_URL($linkConf); $fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
$fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]);
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
return $fulltext; return $fulltext;
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1) { if ($this->doc === NULL || $this->doc->numPages < 1) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear again // The logical page parameter should not appear again
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###');
} }
// Get image data. // Get image data.
$this->images[0] = $this->getImage($this->piVars['page']); $this->images[0] = $this->getImage($this->piVars['page']);
$this->fulltexts[0] = $this->getFulltext($this->piVars['page']); $this->fulltexts[0] = $this->getFulltext($this->piVars['page']);
if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
$this->images[1] = $this->getImage($this->piVars['page'] + 1); $this->images[1] = $this->getImage($this->piVars['page'] + 1);
$this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1); $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1);
} }
// Get the controls for the map. // Get the controls for the map.
$this->controls = explode(',', $this->conf['features']); $this->controls = explode(',', $this->conf['features']);
// Fill in the template markers. // Fill in the template markers.
$markerArray = array ( $markerArray = array (
'###VIEWER_JS###' => $this->addViewerJS() '###VIEWER_JS###' => $this->addViewerJS()
); );
$markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm()); $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm());
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -20,43 +20,43 @@
*/ */
class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php'; public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return void * @return void
*/ */
public function main($content = '', $conf = array ()) { public function main($content = '', $conf = array ()) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') {
$core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed')); $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed'));
} }
if (!empty($core)) { if (!empty($core)) {
$url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q')); $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q'));
if ($stream = fopen($url, 'r')) { if ($stream = fopen($url, 'r')) {
$content .= stream_get_contents($stream); $content .= stream_get_contents($stream);
fclose($stream); fclose($stream);
} }
} }
echo $content; echo $content;
} }
} }

View File

@ -19,111 +19,111 @@
*/ */
class tx_dlf_statistics extends tx_dlf_plugin { class tx_dlf_statistics extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php'; public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Turn cache on. // Turn cache on.
$this->setCache(TRUE); $this->setCache(TRUE);
// Quit without doing anything if required configuration variables are not set. // Quit without doing anything if required configuration variables are not set.
if (empty($this->conf['pages'])) { if (empty($this->conf['pages'])) {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
} }
return $content; return $content;
} }
// Get description. // Get description.
$content .= $this->pi_RTEcssText($this->conf['description']); $content .= $this->pi_RTEcssText($this->conf['description']);
// Check for selected collections. // Check for selected collections.
if ($this->conf['collections']) { if ($this->conf['collections']) {
// Include only selected collections. // Include only selected collections.
$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.uid AS uid', 'tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'', '',
'' ''
); );
$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
'tx_dlf_documents.uid AS uid', 'tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_relations', 'tx_dlf_relations',
'tx_dlf_collections', 'tx_dlf_collections',
'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
'tx_dlf_documents.uid', 'tx_dlf_documents.uid',
'', '',
'' ''
); );
} else { } else {
// Include all collections. // Include all collections.
$resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid AS uid', 'tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'), 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'', '',
'' ''
); );
$resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid AS uid', 'tx_dlf_documents.uid AS uid',
'tx_dlf_documents', 'tx_dlf_documents',
'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'), 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
'', '',
'', '',
'' ''
); );
} }
$countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles); $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles);
$countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes);
// Set replacements. // Set replacements.
$replace = array ( $replace = array (
'key' => array ( 'key' => array (
'###TITLES###', '###TITLES###',
'###VOLUMES###' '###VOLUMES###'
), ),
'value' => array ( 'value' => array (
$countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)),
$countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE))
) )
); );
// Apply replacements. // Apply replacements.
$content = str_replace($replace['key'], $replace['value'], $content); $content = str_replace($replace['key'], $replace['value'], $content);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

View File

@ -19,53 +19,53 @@
*/ */
class tx_dlf_toc extends tx_dlf_plugin { class tx_dlf_toc extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php'; public $scriptRelPath = 'plugins/toc/class.tx_dlf_toc.php';
/** /**
* This holds the active entries according to the currently selected page * This holds the active entries according to the currently selected page
* *
* @var array * @var array
* @access protected * @access protected
*/ */
protected $activeEntries = array (); protected $activeEntries = array ();
/** /**
* This builds an array for one menu entry * This builds an array for one menu entry
* *
* @access protected * @access protected
* *
* @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure * @param array $entry: The entry's array from tx_dlf_document->getLogicalStructure
* @param boolean $recursive: Whether to include the child entries * @param boolean $recursive: Whether to include the child entries
* *
* @return array HMENU array for menu entry * @return array HMENU array for menu entry
*/ */
protected function getMenuEntry(array $entry, $recursive = FALSE) { protected function getMenuEntry(array $entry, $recursive = FALSE) {
$entryArray = array (); $entryArray = array ();
// Set "title", "volume", "type" and "pagination" from $entry array. // Set "title", "volume", "type" and "pagination" from $entry array.
$entryArray['title'] = $entry['label']; $entryArray['title'] = $entry['label'];
$entryArray['volume'] = $entry['volume']; $entryArray['volume'] = $entry['volume'];
$entryArray['orderlabel'] = $entry['orderlabel']; $entryArray['orderlabel'] = $entry['orderlabel'];
$entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']); $entryArray['type'] = tx_dlf_helper::translate($entry['type'], 'tx_dlf_structures', $this->conf['pages']);
$entryArray['pagination'] = $entry['pagination']; $entryArray['pagination'] = $entry['pagination'];
$entryArray['_OVERRIDE_HREF'] = ''; $entryArray['_OVERRIDE_HREF'] = '';
$entryArray['doNotLinkIt'] = 1; $entryArray['doNotLinkIt'] = 1;
$entryArray['ITEM_STATE'] = 'NO'; $entryArray['ITEM_STATE'] = 'NO';
// Build menu links based on the $entry['points'] array. // Build menu links based on the $entry['points'] array.
if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) { if (!empty($entry['points']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($entry['points'])) {
$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']); $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('page' => $entry['points']), TRUE, FALSE, $this->conf['targetPid']);
$entryArray['doNotLinkIt'] = 0; $entryArray['doNotLinkIt'] = 0;
if ($this->conf['basketButton']) { if ($this->conf['basketButton']) {
@ -75,9 +75,9 @@ class tx_dlf_toc extends tx_dlf_plugin {
} elseif (!empty($entry['points']) && is_string($entry['points'])) { } elseif (!empty($entry['points']) && is_string($entry['points'])) {
$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['points'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
$entryArray['doNotLinkIt'] = 0; $entryArray['doNotLinkIt'] = 0;
if ($this->conf['basketButton']) { if ($this->conf['basketButton']) {
@ -87,9 +87,9 @@ class tx_dlf_toc extends tx_dlf_plugin {
} elseif (!empty($entry['targetUid'])) { } elseif (!empty($entry['targetUid'])) {
$entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']); $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => $entry['targetUid'], 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
$entryArray['doNotLinkIt'] = 0; $entryArray['doNotLinkIt'] = 0;
if ($this->conf['basketButton']) { if ($this->conf['basketButton']) {
@ -99,230 +99,230 @@ class tx_dlf_toc extends tx_dlf_plugin {
} }
// Set "ITEM_STATE" to "CUR" if this entry points to current page. // Set "ITEM_STATE" to "CUR" if this entry points to current page.
if (in_array($entry['id'], $this->activeEntries)) { if (in_array($entry['id'], $this->activeEntries)) {
$entryArray['ITEM_STATE'] = 'CUR'; $entryArray['ITEM_STATE'] = 'CUR';
} }
// Build sub-menu if available and called recursively. // Build sub-menu if available and called recursively.
if ($recursive == TRUE && !empty($entry['children'])) { if ($recursive == TRUE && !empty($entry['children'])) {
// Build sub-menu only if one of the following conditions apply: // Build sub-menu only if one of the following conditions apply:
// 1. "expAll" is set for menu // 1. "expAll" is set for menu
// 2. Current menu node is in rootline // 2. Current menu node is in rootline
// 3. Current menu node points to another file // 3. Current menu node points to another file
// 4. Current menu node has no corresponding images // 4. Current menu node has no corresponding images
if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) { if (!empty($this->conf['menuConf.']['expAll']) || $entryArray['ITEM_STATE'] == 'CUR' || is_string($entry['points']) || empty($this->doc->smLinks['l2p'][$entry['id']])) {
$entryArray['_SUB_MENU'] = array (); $entryArray['_SUB_MENU'] = array ();
foreach ($entry['children'] as $child) { foreach ($entry['children'] as $child) {
// Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page. // Set "ITEM_STATE" to "ACT" if this entry points to current page and has sub-entries pointing to the same page.
if (in_array($child['id'], $this->activeEntries)) { if (in_array($child['id'], $this->activeEntries)) {
$entryArray['ITEM_STATE'] = 'ACT'; $entryArray['ITEM_STATE'] = 'ACT';
} }
$entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE); $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE);
} }
} }
// Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries. // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries.
$entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB'); $entryArray['ITEM_STATE'] = ($entryArray['ITEM_STATE'] == 'NO' ? 'IFSUB' : $entryArray['ITEM_STATE'].'IFSUB');
} }
return $entryArray; return $entryArray;
} }
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Check for typoscript configuration to prevent fatal error. // Check for typoscript configuration to prevent fatal error.
if (empty($this->conf['menuConf.'])) { if (empty($this->conf['menuConf.'])) {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toc->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
} }
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toc/template.tmpl'), '###TEMPLATE###');
} }
$TSconfig = array (); $TSconfig = array ();
$TSconfig['special'] = 'userfunction'; $TSconfig['special'] = 'userfunction';
$TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray'; $TSconfig['special.']['userFunc'] = 'tx_dlf_toc->makeMenuArray';
$TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig); $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['menuConf.'], $TSconfig);
$markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig); $markerArray['###TOCMENU###'] = $this->cObj->HMENU($TSconfig);
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* This builds a menu array for HMENU * This builds a menu array for HMENU
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return array HMENU array * @return array HMENU array
*/ */
public function makeMenuArray($content, $conf) { public function makeMenuArray($content, $conf) {
$this->init($conf); $this->init($conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return array (); return array ();
} else { } else {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear again // The logical page parameter should not appear again
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values for page if not set. // Set default values for page if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
$menuArray = array (); $menuArray = array ();
// Does the document have physical elements or is it an external file? // Does the document have physical elements or is it an external file?
if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) { if ($this->doc->physicalStructure || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->doc->uid)) {
// Get all logical units the current page or track is a part of. // Get all logical units the current page or track is a part of.
if (!empty($this->piVars['page']) && $this->doc->physicalStructure) { if (!empty($this->piVars['page']) && $this->doc->physicalStructure) {
$this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]); $this->activeEntries = array_merge((array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[0]], (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]]);
if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) { if (!empty($this->piVars['double']) && $this->piVars['page'] < $this->doc->numPages) {
$this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]); $this->activeEntries = array_merge($this->activeEntries, (array) $this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page'] + 1]]);
} }
} }
// Go through table of contents and create all menu entries. // Go through table of contents and create all menu entries.
foreach ($this->doc->tableOfContents as $entry) { foreach ($this->doc->tableOfContents as $entry) {
$menuArray[] = $this->getMenuEntry($entry, TRUE); $menuArray[] = $this->getMenuEntry($entry, TRUE);
} }
} else { } else {
// Go through table of contents and create top-level menu entries. // Go through table of contents and create top-level menu entries.
foreach ($this->doc->tableOfContents as $entry) { foreach ($this->doc->tableOfContents as $entry) {
$menuArray[] = $this->getMenuEntry($entry, FALSE); $menuArray[] = $this->getMenuEntry($entry, FALSE);
} }
// Get all child documents from database. // Get all child documents from database.
$whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures'); $whereClause = 'tx_dlf_documents.partof='.intval($this->doc->uid).' AND tx_dlf_documents.structure=tx_dlf_structures.uid AND tx_dlf_structures.pid='.$this->doc->pid.tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_structures');
if ($this->conf['excludeOther']) { if ($this->conf['excludeOther']) {
$whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']); $whereClause .= ' AND tx_dlf_documents.pid='.intval($this->conf['pages']);
} }
// Build table of contents from database. // Build table of contents from database.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type', 'tx_dlf_documents.uid AS uid,tx_dlf_documents.title AS title,tx_dlf_documents.volume AS volume,tx_dlf_structures.index_name AS type',
'tx_dlf_documents,tx_dlf_structures', 'tx_dlf_documents,tx_dlf_structures',
$whereClause, $whereClause,
'', '',
'tx_dlf_documents.volume_sorting', 'tx_dlf_documents.volume_sorting',
'' ''
); );
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$menuArray[0]['ITEM_STATE'] = 'CURIFSUB'; $menuArray[0]['ITEM_STATE'] = 'CURIFSUB';
$menuArray[0]['_SUB_MENU'] = array (); $menuArray[0]['_SUB_MENU'] = array ();
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
$entry = array ( $entry = array (
'label' => $resArray['title'], 'label' => $resArray['title'],
'type' => $resArray['type'], 'type' => $resArray['type'],
'volume' => $resArray['volume'], 'volume' => $resArray['volume'],
'pagination' => '', 'pagination' => '',
'targetUid' => $resArray['uid'] 'targetUid' => $resArray['uid']
); );
$menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE); $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE);
} }
} }
} }
return $menuArray; return $menuArray;
} }
} }

View File

@ -19,66 +19,66 @@
*/ */
class tx_dlf_toolbox extends tx_dlf_plugin { class tx_dlf_toolbox extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/class.tx_dlf_toolbox.php'; public $scriptRelPath = 'plugins/toolbox/class.tx_dlf_toolbox.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Quit without doing anything if required variable is not set. // Quit without doing anything if required variable is not set.
if (empty($this->piVars['id'])) { if (empty($this->piVars['id'])) {
return $content; return $content;
} }
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/template.tmpl'), '###TEMPLATE###');
} }
// Build data array. // Build data array.
$data = array ( $data = array (
'conf' => $this->conf, 'conf' => $this->conf,
'piVars' => $this->piVars, 'piVars' => $this->piVars,
); );
// Get template subpart for tools. // Get template subpart for tools.
$subpart = $this->cObj->getSubpart($this->template, '###TOOLS###'); $subpart = $this->cObj->getSubpart($this->template, '###TOOLS###');
$tools = explode(',', $this->conf['tools']); $tools = explode(',', $this->conf['tools']);
// Add the tools to the toolbox. // Add the tools to the toolbox.
foreach ($tools as $tool) { foreach ($tools as $tool) {
$tool = trim($tool); $tool = trim($tool);
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$cObj->data = $data; $cObj->data = $data;
$content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool.'.']))); $content .= $this->cObj->substituteMarkerArray($subpart, array ('###TOOL###' => $cObj->cObjGetSingle($GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool], $GLOBALS['TSFE']->tmpl->setup['plugin.'][$tool.'.'])));
} }
return $this->pi_wrapInBaseClass($this->cObj->substituteSubpart($this->template, '###TOOLS###', $content, TRUE)); return $this->pi_wrapInBaseClass($this->cObj->substituteSubpart($this->template, '###TOOLS###', $content, TRUE));
} }
} }

View File

@ -20,85 +20,85 @@
*/ */
class tx_dlf_toolsFulltext extends tx_dlf_plugin { class tx_dlf_toolsFulltext extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php'; public $scriptRelPath = 'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Merge configuration with conf array of toolbox. // Merge configuration with conf array of toolbox.
$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpFulltext'])) { if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpFulltext'])) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear again // The logical page parameter should not appear again
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
// Load template file. // Load template file.
if (!empty($this->conf['toolTemplateFile'])) { if (!empty($this->conf['toolTemplateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/fulltext/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/fulltext/template.tmpl'), '###TEMPLATE###');
} }
$fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']]; $fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
if (!empty($fullTextFile)) { if (!empty($fullTextFile)) {
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:' $markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:'
.$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:' .$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:'
.$this->pi_getLL('fulltext-off', '', TRUE).'">&nbsp;</a>'; .$this->pi_getLL('fulltext-off', '', TRUE).'">&nbsp;</a>';
} else { } else {
$markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">' . $this->pi_getLL('fulltext-not-available', '', TRUE) . '</span>'; $markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">' . $this->pi_getLL('fulltext-not-available', '', TRUE) . '</span>';
} }
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

View File

@ -19,140 +19,140 @@
*/ */
class tx_dlf_toolsImagedownload extends tx_dlf_plugin { class tx_dlf_toolsImagedownload extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php'; public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Merge configuration with conf array of toolbox. // Merge configuration with conf array of toolbox.
$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) { if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear again // The logical page parameter should not appear again
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
// Load template file. // Load template file.
if (!empty($this->conf['toolTemplateFile'])) { if (!empty($this->conf['toolTemplateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###');
} }
// Get left or single page download. // Get left or single page download.
$markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', '')); $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', ''));
// Get right page download. // Get right page download.
$markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : ''; $markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : '';
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* Get image's URL and MIME type * Get image's URL and MIME type
* *
* @access protected * @access protected
* *
* @param integer $page: Page number * @param integer $page: Page number
* @param string $label: Link title and label * @param string $label: Link title and label
* *
* @return string linkt to image file with given label * @return string linkt to image file with given label
*/ */
protected function getImage($page, $label) { protected function getImage($page, $label) {
$image = array (); $image = array ();
// Get @USE value of METS fileGrp. // Get @USE value of METS fileGrp.
$fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']); $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']);
while ($fileGrp = @array_pop($fileGrps)) { while ($fileGrp = @array_pop($fileGrps)) {
// Get image link. // Get image link.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
$image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
$image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
switch ($image['mimetype']) { switch ($image['mimetype']) {
case 'image/jpeg': $mimetypeLabel = '(JPG)'; case 'image/jpeg': $mimetypeLabel = '(JPG)';
break; break;
case 'image/tiff': $mimetypeLabel = '(TIFF)'; case 'image/tiff': $mimetypeLabel = '(TIFF)';
break; break;
default: $mimetypeLabel = ''; default: $mimetypeLabel = '';
} }
$linkConf = array ( $linkConf = array (
'parameter' => $image['url'], 'parameter' => $image['url'],
'title' => $label . ' ' . $mimetypeLabel, 'title' => $label . ' ' . $mimetypeLabel,
'additionalParams' => '', 'additionalParams' => '',
); );
$imageLink = $this->cObj->typoLink($label . ' ' . $mimetypeLabel, $linkConf); $imageLink = $this->cObj->typoLink($label . ' ' . $mimetypeLabel, $linkConf);
break; break;
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
} }
return $imageLink; return $imageLink;
} }
} }

View File

@ -19,54 +19,54 @@
*/ */
class tx_dlf_toolsImagemanipulation extends tx_dlf_plugin { class tx_dlf_toolsImagemanipulation extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php'; public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Merge configuration with conf array of toolbox. // Merge configuration with conf array of toolbox.
$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
// Load template file. // Load template file.
if (!empty($this->conf['toolTemplateFile'])) { if (!empty($this->conf['toolTemplateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###');
} }
$markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:' $markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:'
.$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:' .$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:'
.$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:' .$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:'
.$this->pi_getLL('reset', '', TRUE).';saturation:' .$this->pi_getLL('reset', '', TRUE).';saturation:'
.$this->pi_getLL('saturation', '', TRUE).';hue:' .$this->pi_getLL('saturation', '', TRUE).';hue:'
.$this->pi_getLL('hue', '', TRUE).';contrast:' .$this->pi_getLL('hue', '', TRUE).';contrast:'
.$this->pi_getLL('contrast', '', TRUE).';brightness:' .$this->pi_getLL('contrast', '', TRUE).';brightness:'
.$this->pi_getLL('brightness', '', TRUE).';invert:' .$this->pi_getLL('brightness', '', TRUE).';invert:'
.$this->pi_getLL('invert', '', TRUE).'" title="' .$this->pi_getLL('invert', '', TRUE).'" title="'
.$this->pi_getLL('no-support', '', TRUE).'"></span>'; .$this->pi_getLL('no-support', '', TRUE).'"></span>';
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }

View File

@ -20,182 +20,182 @@
*/ */
class tx_dlf_toolsPdf extends tx_dlf_plugin { class tx_dlf_toolsPdf extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php'; public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Merge configuration with conf array of toolbox. // Merge configuration with conf array of toolbox.
$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf); $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) { if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) {
// Quit without doing anything if required variables are not set. // Quit without doing anything if required variables are not set.
return $content; return $content;
} else { } else {
if (!empty($this->piVars['logicalPage'])) { if (!empty($this->piVars['logicalPage'])) {
$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
// The logical page parameter should not appear again // The logical page parameter should not appear again
unset($this->piVars['logicalPage']); unset($this->piVars['logicalPage']);
} }
// Set default values if not set. // Set default values if not set.
// $this->piVars['page'] may be integer or string (physical structure @ID) // $this->piVars['page'] may be integer or string (physical structure @ID)
if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) { if ( (int)$this->piVars['page'] > 0 || empty($this->piVars['page'])) {
$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1); $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->piVars['page'], 1, $this->doc->numPages, 1);
} else { } else {
$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
} }
$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
} }
// Load template file. // Load template file.
if (!empty($this->conf['toolTemplateFile'])) { if (!empty($this->conf['toolTemplateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###');
} }
// Get single page downloads. // Get single page downloads.
$markerArray['###PAGE###'] = $this->getPageLink(); $markerArray['###PAGE###'] = $this->getPageLink();
// Get work download. // Get work download.
$markerArray['###WORK###'] = $this->getWorkLink(); $markerArray['###WORK###'] = $this->getWorkLink();
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
/** /**
* Get page's download link * Get page's download link
* *
* @access protected * @access protected
* *
* @return string Link to downloadable page * @return string Link to downloadable page
*/ */
protected function getPageLink() { protected function getPageLink() {
$page1Link = ''; $page1Link = '';
$page2Link = ''; $page2Link = '';
$pageNumber = $this->piVars['page']; $pageNumber = $this->piVars['page'];
// Get image link. // Get image link.
$details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]]; $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]];
$file = $details['files'][$this->conf['fileGrpDownload']]; $file = $details['files'][$this->conf['fileGrpDownload']];
if (!empty($file)) { if (!empty($file)) {
$page1Link = $this->doc->getFileLocation($file); $page1Link = $this->doc->getFileLocation($file);
} }
// Get second page, too, if double page view is activated. // Get second page, too, if double page view is activated.
if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) { if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) {
$details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]]; $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]];
$file = $details['files'][$this->conf['fileGrpDownload']]; $file = $details['files'][$this->conf['fileGrpDownload']];
if (!empty($file)) { if (!empty($file)) {
$page2Link = $this->doc->getFileLocation($file); $page2Link = $this->doc->getFileLocation($file);
} }
} }
if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) { if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' . \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] ' .
'File not found in fileGrp "' . 'File not found in fileGrp "' .
$this->conf['fileGrpDownload'] . '"', $this->conf['fileGrpDownload'] . '"',
$this->extKey, $this->extKey,
SYSLOG_SEVERITY_WARNING); SYSLOG_SEVERITY_WARNING);
} }
// Wrap URLs with HTML. // Wrap URLs with HTML.
if (!empty($page1Link)) { if (!empty($page1Link)) {
if ($this->piVars['double']) { if ($this->piVars['double']) {
$page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''), $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''),
array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', ''))); array('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', '')));
} else { } else {
$page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''), $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''),
array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', ''))); array('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', '')));
} }
} }
if (!empty($page2Link)) { if (!empty($page2Link)) {
$page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''), $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''),
array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', ''))); array('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', '')));
} }
return $page1Link . $page2Link; return $page1Link . $page2Link;
} }
/** /**
* Get work's download link * Get work's download link
* *
* @access protected * @access protected
* *
* @return string Link to downloadable work * @return string Link to downloadable work
*/ */
protected function getWorkLink() { protected function getWorkLink() {
$workLink = ''; $workLink = '';
// Get work link. // Get work link.
if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) { if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) {
$workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]); $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]);
} else { } else {
$details = $this->doc->getLogicalStructure($this->doc->toplevelId); $details = $this->doc->getLogicalStructure($this->doc->toplevelId);
if (!empty($details['files'][$this->conf['fileGrpDownload']])) { if (!empty($details['files'][$this->conf['fileGrpDownload']])) {
$workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]); $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]);
} }
} }
// Wrap URLs with HTML. // Wrap URLs with HTML.
if (!empty($workLink)) { if (!empty($workLink)) {
$workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', ''))); $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', '')));
} else { } else {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
} }
} }
return $workLink; return $workLink;
} }
} }

View File

@ -19,61 +19,61 @@
*/ */
class tx_dlf_validator extends tx_dlf_plugin { class tx_dlf_validator extends tx_dlf_plugin {
public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php';
/** /**
* The main method of the PlugIn * The main method of the PlugIn
* *
* @access public * @access public
* *
* @param string $content: The PlugIn content * @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration * @param array $conf: The PlugIn configuration
* *
* @return string The content that is displayed on the website * @return string The content that is displayed on the website
*/ */
public function main($content, $conf) { public function main($content, $conf) {
$this->init($conf); $this->init($conf);
// Disable caching for this plugin. // Disable caching for this plugin.
$this->setCache(FALSE); $this->setCache(FALSE);
// Load template file. // Load template file.
if (!empty($this->conf['templateFile'])) { if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else { } else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###');
} }
// Load current document. // Load current document.
$this->loadDocument(); $this->loadDocument();
if ($this->doc === NULL) { if ($this->doc === NULL) {
// Document could not be loaded. // Document could not be loaded.
// Check: // Check:
// - if document location is valid URL // - if document location is valid URL
// - if document location is reachable // - if document location is reachable
// - if document is well-formed XML // - if document is well-formed XML
// - if document has METS node // - if document has METS node
} else { } else {
// Document loaded. // Document loaded.
// Check: // Check:
// - if document is valid METS document // - if document is valid METS document
// - if document contains supported metadata schema // - if document contains supported metadata schema
// - if document's metadata are valid // - if document's metadata are valid
// - if document provides configured mandatory fields // - if document provides configured mandatory fields
} }
return $this->pi_wrapInBaseClass($content); return $this->pi_wrapInBaseClass($content);
} }
} }