Browse Source

Coder

pull/725/head
Jared Whiklo 6 years ago
parent
commit
df8edb465e
  1. 42
      README.md
  2. 11
      includes/dublin_core.inc
  3. 37
      includes/imageserver.inc
  4. 12
      includes/mime_detect.inc
  5. 60
      includes/tuque_wrapper.inc
  6. 12
      includes/utilities.inc
  7. 8
      islandora.install
  8. 20
      tests/includes/utilities.inc

42
README.md

@ -63,7 +63,47 @@ By default, objects with the [Fedora state](https://wiki.duraspace.org/display/F
* A [detailed tutorial](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) on extending the multi-page ingest forms is available on the Github (developers') Wiki. * A [detailed tutorial](https://github.com/Islandora/islandora/wiki/Multi-paged-Ingest-Forms) on extending the multi-page ingest forms is available on the Github (developers') Wiki.
* Additional modules developed by members of the Islandora community to extend Islandora can be found on the curated [Islandora Awesome](https://github.com/Islandora-Labs/islandora_awesome) list. * Additional modules developed by members of the Islandora community to extend Islandora can be found on the curated [Islandora Awesome](https://github.com/Islandora-Labs/islandora_awesome) list.
## Documentation ### Image Server configuration
#### Drupal
In Administration » Islandora » Image Server configuration
Choose the type of image server (Djatoka or IIIF).
Set the URL.
#### Djatoka
![Configuration](https://user-images.githubusercontent.com/2857697/63660444-1a24c400-c77c-11e9-831d-5f3fc71b085e.png)
#### IIIF
![Configuration](https://user-images.githubusercontent.com/2857697/63660476-43455480-c77c-11e9-8460-c3d2639e7575.png)
If using IIIF choose to send token as a header and choose the token to use.
Any [IIIF](http://iiif.io) image server can be used the the IIIF tile source. The IIIF tile source provides a full URL to the datastream to be displayed as the IIIF `identifier`. The IIIF server needs to be configured to resolve this full URL to retrieve the image.
The [Cantaloupe 🍈](https://medusa-project.github.io/cantaloupe/) IIIF image server can be configured to resolve these identifiers using the [`HttpResolver`](https://medusa-project.github.io/cantaloupe/manual/3.3/resolvers.html#HttpResolver) with no prefix specified.
#### Apache Reverse Proxy
Reverse proxy config: We make the assumption that we (reverse) proxy Djatoka, to fix the same-origin issue.
For Apache, with Drupal running on the same box as Apache, a couple lines like:
```
ProxyPass /adore-djatoka http://localhost:8080/adore-djatoka
ProxyPassReverse /adore-djatoka http://localhost:8080/adore-djatoka
```
in the Apache config somewhere (either the main apache.conf, httpd.conf, or in and arbitrarily named `*.conf` in your Apache's conf.d directory should suffice to establish the reverse proxy.
In Debian derived systems one will need to create location entries for each proxy or remove the Deny from All in mod_proxy's conf file.
# Documentation
Further documentation for this module is available at [our documentation wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora+Core+Module). Further documentation for this module is available at [our documentation wiki](https://wiki.duraspace.org/display/ISLANDORA/Islandora+Core+Module).

11
includes/dublin_core.inc

@ -13,6 +13,11 @@
*/ */
class DublinCore { class DublinCore {
/**
* Dublin Core fields.
*
* @var array|\DublinCore
*/
public $dc = array( public $dc = array(
'dc:title' => array(), 'dc:title' => array(),
'dc:creator' => array(), 'dc:creator' => array(),
@ -30,6 +35,12 @@ class DublinCore {
'dc:coverage' => array(), 'dc:coverage' => array(),
'dc:rights' => array(), 'dc:rights' => array(),
); );
/**
* Owner name.
*
* @var string
*/
public $owner; public $owner;
/** /**

37
includes/imageserver.inc

@ -1,9 +1,23 @@
<?php <?php
/** /**
* @file * @file
* Image server central configuration. * Image server central configuration.
*/ */
/**
* Image server configuration form.
*
* @param array $form
* Drupal form.
* @param array $form_state
* Drupal form state.
*
* @return array
* Drupal form.
* @throws \Exception
* Thrown by theme() function.
*/
function islandora_imageserver_admin_form(array $form, array &$form_state) { function islandora_imageserver_admin_form(array $form, array &$form_state) {
form_load_include($form_state, 'inc', 'islandora', 'includes/utilities'); form_load_include($form_state, 'inc', 'islandora', 'includes/utilities');
$settings = islandora_imageserver_get_settings(); $settings = islandora_imageserver_get_settings();
@ -91,10 +105,9 @@ function islandora_imageserver_admin_form(array $form, array &$form_state) {
*/ */
function islandora_imageserver_admin_submit_reset() { function islandora_imageserver_admin_submit_reset() {
variable_del('islandora_imageserver_settings'); variable_del('islandora_imageserver_settings');
drupal_set_message('Settings reset.', 'status'); drupal_set_message(t('Settings reset.'), 'status');
} }
/** /**
* Implements hook_form_submit(). * Implements hook_form_submit().
*/ */
@ -117,7 +130,7 @@ function islandora_imageserver_admin_form_submit(array $form, array &$form_state
} }
variable_set('islandora_imageserver_settings', $settings); variable_set('islandora_imageserver_settings', $settings);
} }
drupal_set_message("Settings saved successfully.", 'status'); drupal_set_message(t("Settings saved successfully."), 'status');
} }
/** /**
@ -138,10 +151,10 @@ function islandora_imageserver_admin_ajax_url(array $form, array $form_state) {
/** /**
* Gets a message which describes if Adore-Djatoka is accessible. * Gets a message which describes if Adore-Djatoka is accessible.
* *
* @param array $settings * @param array $form_state
* The image server settings. * The current form state.
* *
* @see islandora_imageserver_get_settings(). * @see islandora_imageserver_get_settings()
* *
* @return string * @return string
* A message describing the accessibility of the Adore-Djatoka image resolver. * A message describing the accessibility of the Adore-Djatoka image resolver.
@ -166,8 +179,8 @@ function islandora_imageserver_admin_form_access_message(array &$form_state) {
)); ));
} }
elseif ($type == 'iiif') { elseif ($type == 'iiif') {
$url = url(rtrim($url, '/') $url = url(rtrim($url, '/'),
, array( array(
'absolute' => TRUE, 'absolute' => TRUE,
) )
); );
@ -178,14 +191,14 @@ function islandora_imageserver_admin_form_access_message(array &$form_state) {
if ($result->code == 200) { if ($result->code == 200) {
$confirmation_message = theme_image(array( $confirmation_message = theme_image(array(
'path' => 'misc/watchdog-ok.png', 'path' => 'misc/watchdog-ok.png',
'attributes' => array() 'attributes' => array(),
)); ));
$confirmation_message .= t('Successfully connected to image server.'); $confirmation_message .= t('Successfully connected to image server.');
} }
else { else {
$confirmation_message = theme_image(array( $confirmation_message = theme_image(array(
'path' => 'misc/watchdog-error.png', 'path' => 'misc/watchdog-error.png',
'attributes' => array() 'attributes' => array(),
)); ));
$confirmation_message .= t('Unable to connect to image server at !path', array( $confirmation_message .= t('Unable to connect to image server at !path', array(
'!path' => $url, '!path' => $url,
@ -219,8 +232,9 @@ function islandora_imageserver_get_settings() {
* *
* @param array $form_state * @param array $form_state
* Drupal form state. * Drupal form state.
* @param $name * @param string $name
* Name of the form element/settings key. * Name of the form element/settings key.
*
* @return mixed * @return mixed
* The Form value or currently saved value. * The Form value or currently saved value.
*/ */
@ -240,6 +254,7 @@ function islandora_imageserver_get_default_value(array &$form_state, $name) {
* The dsid to return. * The dsid to return.
* @param string $authtoken * @param string $authtoken
* The authentication token. * The authentication token.
*
* @return mixed * @return mixed
* The token replaced string. * The token replaced string.
*/ */

12
includes/mime_detect.inc

@ -59,7 +59,19 @@ class MimeDetect {
* $this->get_extension('image/jpeg') will always return 'jpg'. * $this->get_extension('image/jpeg') will always return 'jpg'.
*/ */
protected $protectedMimeTypes = array(); protected $protectedMimeTypes = array();
/**
* Protected file extensions.
*
* @var array
*/
protected $protectedFileExtensions; protected $protectedFileExtensions;
/**
* Extension exceptions.
*
* @deprecated
*
* @var array
*/
protected $extensionExceptions = array( protected $extensionExceptions = array(
// XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping... // XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping...
// The correct MIMEtype is 'image/tiff'. // The correct MIMEtype is 'image/tiff'.

60
includes/tuque_wrapper.inc

@ -80,8 +80,20 @@ function islandora_invoke_datastream_hooks($hook, array $models, $dsid) {
* Implementation of the FedoraRepository class. * Implementation of the FedoraRepository class.
*/ */
class IslandoraFedoraRepository extends FedoraRepository { class IslandoraFedoraRepository extends FedoraRepository {
/**
* Class name.
* @var string
*/
protected $queryClass = 'IslandoraRepositoryQuery'; protected $queryClass = 'IslandoraRepositoryQuery';
/**
* Class name.
* @var string
*/
protected $newObjectClass = 'IslandoraNewFedoraObject'; protected $newObjectClass = 'IslandoraNewFedoraObject';
/**
* Class name.
* @var string
*/
protected $objectClass = 'IslandoraFedoraObject'; protected $objectClass = 'IslandoraFedoraObject';
/** /**
@ -179,8 +191,20 @@ class IslandoraRepositoryQuery extends RepositoryQuery {}
* Implementation of NewFedoraObject class. * Implementation of NewFedoraObject class.
*/ */
class IslandoraNewFedoraObject extends NewFedoraObject { class IslandoraNewFedoraObject extends NewFedoraObject {
/**
* Class name.
* @var string
*/
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream'; protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream'; protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt'; protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
} }
@ -188,8 +212,20 @@ class IslandoraNewFedoraObject extends NewFedoraObject {
* Implementation, magic functions for a FedoraObject class. * Implementation, magic functions for a FedoraObject class.
*/ */
class IslandoraFedoraObject extends FedoraObject { class IslandoraFedoraObject extends FedoraObject {
/**
* Class name.
* @var string
*/
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream'; protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream'; protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt'; protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
/** /**
@ -568,7 +604,15 @@ class IslandoraSimpleCache extends SimpleCache {}
* Implementation of NewFedoraDatastream class. * Implementation of NewFedoraDatastream class.
*/ */
class IslandoraNewFedoraDatastream extends NewFedoraDatastream { class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
} }
@ -576,7 +620,15 @@ class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
* Implementation and magic functions for FedoraDatastream class. * Implementation and magic functions for FedoraDatastream class.
*/ */
class IslandoraFedoraDatastream extends FedoraDatastream { class IslandoraFedoraDatastream extends FedoraDatastream {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
/** /**
@ -650,7 +702,15 @@ class IslandoraFedoraDatastream extends FedoraDatastream {
* Implementation of FedoraDatastreamVersion class. * Implementation of FedoraDatastreamVersion class.
*/ */
class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion { class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt'; protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion'; protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
} }

12
includes/utilities.inc

@ -267,9 +267,9 @@ function islandora_escape_pid_for_function($pid) {
* below are fine. * below are fine.
* *
* @code * @code
* 'islandora', * 'islandora',
* 'islandora:', * 'islandora:',
* 'islandora:1234', * 'islandora:1234',
* @endcode * @endcode
* *
* @return string * @return string
@ -291,9 +291,9 @@ function islandora_get_namespace($id) {
* below are fine. * below are fine.
* *
* @code * @code
* 'islandora', * 'islandora',
* 'islandora:', * 'islandora:',
* 'islandora:1234', * 'islandora:1234',
* @endcode * @endcode
* *
* @return bool * @return bool

8
islandora.install

@ -189,8 +189,8 @@ function islandora_update_7003() {
$new_settings = $openseadragon_settings; $new_settings = $openseadragon_settings;
} }
else { else {
// We could not migrate your settings to the new place. This stops the other // We could not migrate your settings to the new place. This stops the
// two modules from deleting your settings. // other two modules from deleting your settings.
throw new DrupalUpdateException('Islandora image server settings could NOT be configured automatically, please set them manually at Admin -> Islandora -> Image Server configuration and then run updates again.'); throw new DrupalUpdateException('Islandora image server settings could NOT be configured automatically, please set them manually at Admin -> Islandora -> Image Server configuration and then run updates again.');
} }
} }
@ -202,8 +202,8 @@ function islandora_update_7003() {
} }
if (isset($new_settings)) { if (isset($new_settings)) {
if (isset($new_settings['iiif_identifer']) && !empty($new_settings['iiif_identifer'])) { if (isset($new_settings['iiif_identifer']) && !empty($new_settings['iiif_identifer'])) {
// This will only have the back half of the token, prepend islandora to it. // This will only have the back half of the token, prepend islandora.
$new_settings['iiif_identifer'] = "[islandora:" + $new_settings['iiif_identifer']; $new_settings['iiif_identifer'] = "[islandora:" . $new_settings['iiif_identifer'];
} }
if ($new_settings['type'] == 'djatoka' && !preg_match('~resolver$~', $new_settings['url'])) { if ($new_settings['type'] == 'djatoka' && !preg_match('~resolver$~', $new_settings['url'])) {
// IABV javascript added resolver to URL, Openseadragon did not. // IABV javascript added resolver to URL, Openseadragon did not.

20
tests/includes/utilities.inc

@ -19,12 +19,32 @@
*/ */
class IslandoraTestUtilities extends IslandoraTestUtilityClass { class IslandoraTestUtilities extends IslandoraTestUtilityClass {
/**
* The test configuration.
*
* @var array
*/
protected $configuration; protected $configuration;
/**
* The parameters.
*
* @var array
*/
protected $params; protected $params;
/**
* Test results.
*
* @var array
*/
public $results = array(); public $results = array();
/**
* A repository object.
*
* @var \FedoraRepository
*/
protected $repository; protected $repository;
/** /**

Loading…
Cancel
Save