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
38 changes: 37 additions & 1 deletion OaiPmhRepositoryPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
* @package OaiPmhRepository
*/

define('OAI_PMH_BASE_URL',WEB_ROOT.'/oai-pmh-repository/request');
define('OAI_PMH_BASE_URL',
WEB_ROOT . '/'
. (($baseUrl = get_option('oaipmh_repository_base_url'))
? $baseUrl
: 'oai-pmh-repository/request'));
define('OAI_PMH_REPOSITORY_PLUGIN_DIRECTORY',dirname(__FILE__));

/**
Expand All @@ -21,18 +25,21 @@ class OaiPmhRepositoryPlugin extends Omeka_Plugin_AbstractPlugin
'config',
'uninstall',
'initialize',
'define_routes',
);

protected $_filters = array(
'admin_dashboard_panels'
);

protected $_options = array(
'oaipmh_repository_base_url' => 'oai-pmh-repository/request',
'oaipmh_repository_name',
'oaipmh_repository_namespace_id',
'oaipmh_repository_expose_files' => 1,
'oaipmh_repository_expose_empty_collections' => 1,
'oaipmh_repository_expose_item_type' => 0,
'oaipmh_repository_add_human_stylesheet' => 1,
);

/**
Expand Down Expand Up @@ -112,6 +119,35 @@ public function hookInitialize()
add_translation_source(dirname(__FILE__) . '/languages');
}

/**
* Define routes.
*
* @param Zend_Controller_Router_Rewrite $router
*/
public function hookDefineRoutes($args)
{
if (is_admin_theme()) {
return;
}

// If base url is not set, use the default module/controller/action.
$route = get_option('oaipmh_repository_base_url');
if (empty($route) || $route == 'oai-pmh-repository/request') {
return;
}

$args['router']->addRoute('oai-pmh-repository', new Zend_Controller_Router_Route(
$route,
array(
'module' => 'oai-pmh-repository',
'controller' => 'request',
'action' => 'index',
)));
}

/**
* Filter to add a dashboard panel.
*/
public function filterAdminDashboardPanels($panels)
{
ob_start();
Expand Down
30 changes: 30 additions & 0 deletions config_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
<p><?php echo __('Harvester can access metadata from this site') . ' '; ?>
<a href="<?php echo OAI_PMH_BASE_URL; ?>"><?php echo OAI_PMH_BASE_URL; ?></a></p>

<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('oaipmh_repository_base_url',
__('Repository base url')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('Base URL for this OAI-PMH repository.');
echo ' ' . __('Default is "oai-pmh-repository/request" (always available), but it can be "oai/request" or simply "oai-pmh".'); ?>
</p>
<p class="explanation">
<?php echo __('Currently, harvesters can access metadata from this url: %s.', sprintf('<a href="%s">%s</a>', OAI_PMH_BASE_URL, OAI_PMH_BASE_URL)); ?></p>
</p>
<?php echo $view->formText('oaipmh_repository_base_url', get_option('oaipmh_repository_base_url')); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<label for="oaipmh_repository_name"><?php echo __('Repository name'); ?></label>
Expand Down Expand Up @@ -81,3 +97,17 @@
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_add_human_stylesheet',
__('Human display')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('If checked, a stylesheet will be added to the output, so humans will be able to browse the repository through a themable %sBootstrap%s responsive interface.',
'<a href="http://getbootstrap.com/">', '</a>'); ?>
</p>
<?php echo $view->formCheckbox('oaipmh_repository_add_human_stylesheet', true,
array('checked' => (boolean) get_option('oaipmh_repository_add_human_stylesheet'))); ?>
</div>
</div>
8 changes: 7 additions & 1 deletion libraries/OaiPmhRepository/ResponseGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ public function __construct($query)
//adds some overhead, especially on large outputs.
$this->document->formatOutput = true;
$this->document->xmlStandalone = true;


if (get_option('oaipmh_repository_add_human_stylesheet')) {
$stylesheet = src('oai-pmh-repository', 'xsl', 'xsl');
$xslt = $this->document->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . $stylesheet . '"');
$this->document->appendChild($xslt);
}

$root = $this->document->createElementNS(self::OAI_PMH_NAMESPACE_URI,
'OAI-PMH');
$this->document->appendChild($root);
Expand Down
5 changes: 5 additions & 0 deletions views/public/css/bootstrap-theme.min.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions views/public/css/bootstrap.min.css

Large diffs are not rendered by default.

106 changes: 106 additions & 0 deletions views/public/css/oai-pmh-repository.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/* Styles to adapt bootstrap. */
body {
padding-top: 70px;
}
footer a {
color: #000000;
}
footer a:hover {
color: #000000;
}
a#logo {
background: transparent none no-repeat scroll 0 0 / 100% 100%;
/* padding: 8px 51px; */
}
.vertical-space {
height: 20px;
}
.xoai-contexts div:nth-child(even) {
background-color: #eee;
}
pre {
line-height: 0.8;
}

/* Styles specific to OAI-PMH. */
.oaipmh h2 {
border-bottom-style: inset;
}
.oaipmh table small {
font-style: italic;
margin-left: 10px;
}
.oaipmh-response .panel-heading a {
color: #3c763d;
}
.oaipmh-description {
padding-top: 16px;
}
.oaipmh-formats table thead th:first-child,
.oaipmh-formats table tbody th,
.oaipmh-sets table thead th:first-child,
.oaipmh-sets table tbody th,
.oaipmh-identifiers table thead th:first-child,
.oaipmh-identifiers table tbody th,
.oaipmh-records table thead th:first-child,
.oaipmh-records table tbody th {
text-align: right;
}
.oaipmh-formats table dl {
margin-bottom: 12px;
margin-top: 12px;
}
.oaipmh-records table {
width: 100%;
}
.oaipmh-records table table {
table-layout:fixed;
}
.oaipmh-records table tr.collapse td {
word-wrap: break-word;
}
.oaipmh-record .panel-body {
word-wrap: break-word;
}

/* Stylesheet from http://www2.informatik.hu-berlin.de/~obecker/XSLT/xmlverbatim/xmlverbatim.css */
.xmlverb-default {
color: #333333;
background-color: #ffffff;
font-family: monospace;
}
.xmlverb-element-name {
color: #990000;
}
.xmlverb-element-nsprefix {
color: #666600;
}
.xmlverb-attr-name {
color: #660000;
}
.xmlverb-attr-content {
color: #000099;
font-weight: bold;
}
.xmlverb-ns-name {
color: #666600;
}
.xmlverb-ns-uri {
color: #330099;
}
.xmlverb-text {
color: #000000;
font-weight: bold;
}
.xmlverb-comment {
color: #006600;
font-style: italic;
}
.xmlverb-pi-name {
color: #006600;
font-style: italic;
}
.xmlverb-pi-content {
color: #006666;
font-style: italic;
}
Binary file not shown.
Loading