Browse Source

Coder

pull/725/head
Jared Whiklo 5 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.
* 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).

11
includes/dublin_core.inc

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

37
includes/imageserver.inc

@ -1,9 +1,23 @@
<?php
/**
* @file
* 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) {
form_load_include($form_state, 'inc', 'islandora', 'includes/utilities');
$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() {
variable_del('islandora_imageserver_settings');
drupal_set_message('Settings reset.', 'status');
drupal_set_message(t('Settings reset.'), 'status');
}
/**
* 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);
}
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.
*
* @param array $settings
* The image server settings.
* @param array $form_state
* The current form state.
*
* @see islandora_imageserver_get_settings().
* @see islandora_imageserver_get_settings()
*
* @return string
* 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') {
$url = url(rtrim($url, '/')
, array(
$url = url(rtrim($url, '/'),
array(
'absolute' => TRUE,
)
);
@ -178,14 +191,14 @@ function islandora_imageserver_admin_form_access_message(array &$form_state) {
if ($result->code == 200) {
$confirmation_message = theme_image(array(
'path' => 'misc/watchdog-ok.png',
'attributes' => array()
'attributes' => array(),
));
$confirmation_message .= t('Successfully connected to image server.');
}
else {
$confirmation_message = theme_image(array(
'path' => 'misc/watchdog-error.png',
'attributes' => array()
'attributes' => array(),
));
$confirmation_message .= t('Unable to connect to image server at !path', array(
'!path' => $url,
@ -219,8 +232,9 @@ function islandora_imageserver_get_settings() {
*
* @param array $form_state
* Drupal form state.
* @param $name
* @param string $name
* Name of the form element/settings key.
*
* @return mixed
* 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.
* @param string $authtoken
* The authentication token.
*
* @return mixed
* The token replaced string.
*/

12
includes/mime_detect.inc

@ -59,7 +59,19 @@ class MimeDetect {
* $this->get_extension('image/jpeg') will always return 'jpg'.
*/
protected $protectedMimeTypes = array();
/**
* Protected file extensions.
*
* @var array
*/
protected $protectedFileExtensions;
/**
* Extension exceptions.
*
* @deprecated
*
* @var array
*/
protected $extensionExceptions = array(
// XXX: Deprecated... Only here due to old 'tif' => 'image/tif' mapping...
// 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.
*/
class IslandoraFedoraRepository extends FedoraRepository {
/**
* Class name.
* @var string
*/
protected $queryClass = 'IslandoraRepositoryQuery';
/**
* Class name.
* @var string
*/
protected $newObjectClass = 'IslandoraNewFedoraObject';
/**
* Class name.
* @var string
*/
protected $objectClass = 'IslandoraFedoraObject';
/**
@ -179,8 +191,20 @@ class IslandoraRepositoryQuery extends RepositoryQuery {}
* Implementation of NewFedoraObject class.
*/
class IslandoraNewFedoraObject extends NewFedoraObject {
/**
* Class name.
* @var string
*/
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
}
@ -188,8 +212,20 @@ class IslandoraNewFedoraObject extends NewFedoraObject {
* Implementation, magic functions for a FedoraObject class.
*/
class IslandoraFedoraObject extends FedoraObject {
/**
* Class name.
* @var string
*/
protected $newFedoraDatastreamClass = 'IslandoraNewFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamClass = 'IslandoraFedoraDatastream';
/**
* Class name.
* @var string
*/
protected $fedoraRelsExtClass = 'IslandoraFedoraRelsExt';
/**
@ -568,7 +604,15 @@ class IslandoraSimpleCache extends SimpleCache {}
* Implementation of NewFedoraDatastream class.
*/
class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
}
@ -576,7 +620,15 @@ class IslandoraNewFedoraDatastream extends NewFedoraDatastream {
* Implementation and magic functions for FedoraDatastream class.
*/
class IslandoraFedoraDatastream extends FedoraDatastream {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
/**
@ -650,7 +702,15 @@ class IslandoraFedoraDatastream extends FedoraDatastream {
* Implementation of FedoraDatastreamVersion class.
*/
class IslandoraFedoraDatastreamVersion extends FedoraDatastreamVersion {
/**
* Class name.
* @var string
*/
protected $fedoraRelsIntClass = 'IslandoraFedoraRelsInt';
/**
* Class name.
* @var string
*/
protected $fedoraDatastreamVersionClass = 'IslandoraFedoraDatastreamVersion';
}

12
includes/utilities.inc

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

8
islandora.install

@ -189,8 +189,8 @@ function islandora_update_7003() {
$new_settings = $openseadragon_settings;
}
else {
// We could not migrate your settings to the new place. This stops the other
// two modules from deleting your settings.
// We could not migrate your settings to the new place. This stops the
// 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.');
}
}
@ -202,8 +202,8 @@ function islandora_update_7003() {
}
if (isset($new_settings)) {
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.
$new_settings['iiif_identifer'] = "[islandora:" + $new_settings['iiif_identifer'];
// This will only have the back half of the token, prepend islandora.
$new_settings['iiif_identifer'] = "[islandora:" . $new_settings['iiif_identifer'];
}
if ($new_settings['type'] == 'djatoka' && !preg_match('~resolver$~', $new_settings['url'])) {
// IABV javascript added resolver to URL, Openseadragon did not.

20
tests/includes/utilities.inc

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

Loading…
Cancel
Save