Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OaiPmhRepositoryPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class OaiPmhRepositoryPlugin extends Omeka_Plugin_AbstractPlugin
'oaipmh_repository_expose_files' => 1,
'oaipmh_repository_expose_empty_collections' => 1,
'oaipmh_repository_expose_item_type' => 0,
'oaipmh_repository_expose_mime_type' => 0,
);

/**
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ Default: false

*Added in version 2.1*

### Expose MIME type ###
Whether the plugin should exposer the MIME type of files as Dublin Core Format.
When enabled, for items that have files, the repository will expose additional
Dublin Core Format elements (one for each different MIME type) with a value of
the MIME types found in the item's files.

Default: false

*Added in version 2.2.0*

## Advanced Configuration ##
The plugin also allows you to configure some more options about how the repository responds to harvesters. Since the default values
are recommended for most users, these values must be edited by hand, in the config.ini file in the plugin's root directory.
Expand Down
13 changes: 13 additions & 0 deletions config_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,16 @@
array('checked' => (boolean) get_option('oaipmh_repository_expose_item_type'))); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('oaipmh_repository_expose_mime_type',
__('Expose MIME type')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('Whether the plugin should expose the mime type of files as Dublin Core Format.'); ?>
</p>
<?php echo $view->formCheckbox('oaipmh_repository_expose_mime_type', true,
array('checked' => (boolean) get_option('oaipmh_repository_expose_mime_type'))); ?>
</div>
</div>
14 changes: 12 additions & 2 deletions languages/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: OaiPmhRepositoryPlugin.php:119
#: OaiPmhRepositoryPlugin.php:120
msgid "OAI-PMH Repository"
msgstr ""

#: OaiPmhRepositoryPlugin.php:120 config_form.php:16
#: OaiPmhRepositoryPlugin.php:121 config_form.php:16
msgid "Harvester can access metadata from this site"
msgstr ""

Expand Down Expand Up @@ -69,3 +69,13 @@ msgstr ""
#: config_form.php:78
msgid "Whether the plugin should expose the item type as Dublin Core Type."
msgstr ""

#: config_form.php:87
msgid "Expose MIME type"
msgstr ""

#: config_form.php:91
msgid ""
"Whether the plugin should expose the mime type of files as Dublin Core "
"Format."
msgstr ""
7 changes: 7 additions & 0 deletions libraries/OaiPmhRepository/Metadata/Mets.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public function appendMetadata($item, $metadataElement)
if ($dcType = $item->getProperty('item_type_name')) {
$dcXml->appendNewElement('dc:type', $dcType);
}
} elseif ($elementName == 'format' && get_option('oaipmh_repository_expose_mime_type')) {
$mimeTypes = array_unique(array_map(function($file) {
return $file->mime_type;
}, $item->getFiles()));
foreach ($mimeTypes as $mimeType) {
$dcXml->appendNewElement('dc:format', $mimeType);
}
}

foreach($dcElements as $elementText)
Expand Down
12 changes: 11 additions & 1 deletion libraries/OaiPmhRepository/Metadata/Mods.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,17 @@ public function appendMetadata($item, $metadataElement)
$physicalDescription = $mods->appendNewElement('physicalDescription');
$physicalDescription->appendNewElement('form', $format->text);
}


if (get_option('oaipmh_repository_expose_mime_type')) {
$mimeTypes = array_unique(array_map(function($file) {
return $file->mime_type;
}, $item->getFiles()));
foreach ($mimeTypes as $mimeType) {
$physicalDescription = $mods->appendNewElement('physicalDescription');
$physicalDescription->appendNewElement('internetMediaType', $mimeType);
}
}

$languages = $item->getElementTexts('Dublin Core','Language');
foreach($languages as $language)
{
Expand Down
7 changes: 7 additions & 0 deletions libraries/OaiPmhRepository/Metadata/OaiDc.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ public function appendMetadata($item, $metadataElement)
if ($dcType = $item->getProperty('item_type_name')) {
$oai_dc->appendNewElement('dc:type', $dcType);
}
} elseif ($elementName == 'format' && get_option('oaipmh_repository_expose_mime_type')) {
$mimeTypes = array_unique(array_map(function($file) {
return $file->mime_type;
}, $item->getFiles()));
foreach ($mimeTypes as $mimeType) {
$oai_dc->appendNewElement('dc:format', $mimeType);
}
}

foreach($dcElements as $elementText)
Expand Down
7 changes: 7 additions & 0 deletions libraries/OaiPmhRepository/Metadata/Rdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ public function appendMetadata($item, $metadataElement)
if ($dcType = $item->getProperty('item_type_name')) {
$description->appendNewElement('dc:type', $dcType);
}
} elseif ($elementName == 'Format' && get_option('oaipmh_repository_expose_mime_type')) {
$mimeTypes = array_unique(array_map(function($file) {
return $file->mime_type;
}, $item->getFiles()));
foreach ($mimeTypes as $mimeType) {
$description->appendNewElement('dc:format', $mimeType);
}
}

foreach ($texts as $text) {
Expand Down
2 changes: 1 addition & 1 deletion plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ link="https://github.com/zerocrates/OaiPmhRepository#readme"
support_link="https://github.com/zerocrates/OaiPmhRepository/issues"
omeka_minimum_version="2.0"
omeka_target_version="2.3"
version="2.1.1"
version="2.2.0"