Compare commits

..

No commits in common. '2.x' and '7.x-2.x' have entirely different histories.
2.x ... 7.x-2.x

  1. 43
      .github/PULL_REQUEST_TEMPLATE.md
  2. 125
      .github/workflows/build-2.x.yml
  3. 26
      .github/workflows/gitlab-mirror.yml
  4. 3
      .gitignore
  5. 30
      .travis.yml
  6. 42
      CONTRIBUTING.md
  7. 15
      COPYRIGHT
  8. 118
      README.md
  9. 57
      composer.json
  10. 4
      config/install/islandora.settings.yml
  11. 13
      config/install/system.action.delete_media_and_file.yml
  12. 244
      config/schema/islandora.schema.yml
  13. 3
      css/islandora.css
  14. 6
      drush.services.yml
  15. 33
      islandora.info.yml
  16. 228
      islandora.install
  17. 5
      islandora.libraries.yml
  18. 29
      islandora.links.action.yml
  19. 20
      islandora.links.menu.yml
  20. 762
      islandora.module
  21. 12
      islandora.permissions.yml
  22. 16
      islandora.post_update.php
  23. 111
      islandora.routing.yml
  24. 80
      islandora.services.yml
  25. 192
      islandora.tokens.inc
  26. 54
      islandora.views.inc
  27. 674
      islandora/LICENSE.txt
  28. 20
      islandora/README.md
  29. 105
      islandora/build.xml
  30. 1627
      islandora/build/Doxyfile
  31. 61
      islandora/include/admin.form.inc
  32. 95
      islandora/include/fields.inc
  33. 21
      islandora/include/rdf.inc
  34. 50
      islandora/include/rdf_mapping.inc
  35. 70
      islandora/include/triplestore.inc
  36. 24
      islandora/include/utils.inc
  37. 23
      islandora/islandora.api.php
  38. 16
      islandora/islandora.info
  39. 39
      islandora/islandora.install
  40. 263
      islandora/islandora.module
  41. 14
      islandora/tests/scripts/line_endings.sh
  42. 58
      islandora/tests/scripts/travis_setup.sh
  43. 6
      islandora_apachesolr/islandora_apachesolr.info
  44. 14
      islandora_apachesolr/islandora_apachesolr.module
  45. 6
      islandora_basic_image/islandora_basic_image.info
  46. 27
      islandora_basic_image/islandora_basic_image.install
  47. 215
      islandora_basic_image/islandora_basic_image.module
  48. 78
      islandora_collection/include/islandora_collection.views_default.inc
  49. 35
      islandora_collection/include/relations.inc
  50. 8
      islandora_collection/islandora_collection.info
  51. 20
      islandora_collection/islandora_collection.install
  52. 200
      islandora_collection/islandora_collection.module
  53. 88
      islandora_dc/include/fields.inc
  54. 5
      islandora_dc/islandora_dc.info
  55. 42
      islandora_dc/islandora_dc.install
  56. 33
      islandora_dc/islandora_dc.module
  57. 42
      islandora_delete_by_fedora_uri_service/include/islandora_delete_by_fedora_uri_service.inc
  58. 6
      islandora_delete_by_fedora_uri_service/islandora_delete_by_fedora_uri_service.info
  59. 48
      islandora_delete_by_fedora_uri_service/islandora_delete_by_fedora_uri_service.module
  60. 50
      islandora_medium_size_service/include/islandora_medium_size_service.inc
  61. 6
      islandora_medium_size_service/islandora_medium_size_service.info
  62. 48
      islandora_medium_size_service/islandora_medium_size_service.module
  63. 17
      islandora_mods/include/fields.inc
  64. 5
      islandora_mods/islandora_mods.info
  65. 20
      islandora_mods/islandora_mods.install
  66. 34
      islandora_mods/islandora_mods.module
  67. 25
      islandora_rdf_mapping_service/include/islandora_rdf_mapping_service.inc
  68. 6
      islandora_rdf_mapping_service/islandora_rdf_mapping_service.info
  69. 59
      islandora_rdf_mapping_service/islandora_rdf_mapping_service.module
  70. 45
      islandora_tn_service/include/islandora_tn_service.inc
  71. 6
      islandora_tn_service/islandora_tn_service.info
  72. 48
      islandora_tn_service/islandora_tn_service.module
  73. 19
      migrate/tags.csv
  74. 73
      modules/islandora_advanced_search/CONTRIBUTING.md
  75. 339
      modules/islandora_advanced_search/LICENSE
  76. 261
      modules/islandora_advanced_search/README.md
  77. 37
      modules/islandora_advanced_search/css/islandora_advanced_search.form.css
  78. 111
      modules/islandora_advanced_search/css/islandora_advanced_search.pager.css
  79. BIN
      modules/islandora_advanced_search/docs/advanced_search_block_settings.png
  80. BIN
      modules/islandora_advanced_search/docs/basic-input.png
  81. BIN
      modules/islandora_advanced_search/docs/contextual_filter_settings.png
  82. BIN
      modules/islandora_advanced_search/docs/demo.gif
  83. BIN
      modules/islandora_advanced_search/docs/enable_index_hierarchy.png
  84. BIN
      modules/islandora_advanced_search/docs/enable_index_hierarchy_processor.png
  85. BIN
      modules/islandora_advanced_search/docs/exclude_facet_settings_exclude.png
  86. BIN
      modules/islandora_advanced_search/docs/exclude_facet_settings_url_alias.png
  87. BIN
      modules/islandora_advanced_search/docs/facet_block_settings.png
  88. BIN
      modules/islandora_advanced_search/docs/field_decedent_of.png
  89. BIN
      modules/islandora_advanced_search/docs/include_exclude_facets.png
  90. BIN
      modules/islandora_advanced_search/docs/include_exclude_facets_settings.png
  91. BIN
      modules/islandora_advanced_search/docs/islandora_advanced_search_settings.png
  92. BIN
      modules/islandora_advanced_search/docs/pager.png
  93. BIN
      modules/islandora_advanced_search/docs/pager_settings.png
  94. BIN
      modules/islandora_advanced_search/docs/sort_criteria.png
  95. BIN
      modules/islandora_advanced_search/docs/view_advanced_setting.png
  96. 13
      modules/islandora_advanced_search/islandora_advanced_search.info.yml
  97. 17
      modules/islandora_advanced_search/islandora_advanced_search.libraries.yml
  98. 6
      modules/islandora_advanced_search/islandora_advanced_search.links.menu.yml
  99. 89
      modules/islandora_advanced_search/islandora_advanced_search.module
  100. 17
      modules/islandora_advanced_search/islandora_advanced_search.routing.yml
  101. Some files were not shown because too many files have changed in this diff Show More

43
.github/PULL_REQUEST_TEMPLATE.md

@ -1,43 +0,0 @@
**GitHub Issue**: (link)
* Other Relevant Links (Google Groups discussion, related pull requests,
Release pull requests, etc.)
# What does this Pull Request do?
A brief description of what the intended result of the PR will be and/or what
problem it solves.
# What's new?
A in-depth description of the changes made by this PR. Technical details and
possible side effects.
* Changes x feature to such that y
* Added x
* Removed y
* Does this change add any new dependencies?
* Does this change require any other modifications to be made to the repository
(i.e. Regeneration activity, etc.)?
* Could this change impact execution of existing code?
# How should this be tested?
A description of what steps someone could take to:
* Reproduce the problem you are fixing (if applicable)
* Test that the Pull Request does what is intended.
* Please be as detailed as possible.
* Good testing instructions help get your PR completed faster.
# Documentation Status
* Does this change existing behaviour that's currently documented?
* Does this change require new pages or sections of documentation?
* Who does this need to be documented for?
* Associated documentation pull request(s): ___ or documentation issue ___
# Additional Notes:
Any additional information that you think would be helpful when reviewing this
PR.
# Interested parties
Tag (@ mention) interested parties or, if unsure, @Islandora/committers

125
.github/workflows/build-2.x.yml

@ -1,125 +0,0 @@
name: CI
on:
push:
branches: [ 2.x ]
pull_request:
branches: [ 2.x ]
workflow_dispatch:
jobs:
build:
env:
DRUPAL_VERSION: ${{ matrix.drupal-version }}
SCRIPT_DIR: ${{ github.workspace }}/islandora_ci
DRUPAL_DIR: /opt/drupal
PHPUNIT_FILE: ${{ github.workspace }}/build_dir/phpunit.xml
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allowed_failure }}
strategy:
fail-fast: false
matrix:
php-versions: ["8.1", "8.2", "8.3"]
test-suite: ["kernel", "functional", "functional-javascript"]
drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"]
mysql: ["8.0"]
allowed_failure: [false]
exclude:
- php-versions: "8.3"
drupal-version: "10.1.x"
name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }} | test-suite ${{ matrix.test-suite }}
services:
mysql:
image: mysql:${{ matrix.mysql }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: drupal
ports:
- 3306:3306
activemq:
image: webcenter/activemq:5.14.3
ports:
- 8161:8161
- 61616:61616
- 61613:61613
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: build_dir
- name: Checkout islandora_ci
uses: actions/checkout@v4
with:
repository: islandora/islandora_ci
ref: github-actions
path: islandora_ci
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
- name: Setup Mysql client
run: |
sudo apt-get update
sudo apt-get remove -y mysql-client mysql-common
sudo apt-get install -y mysql-client
- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup Drupal
run: |
mkdir $DRUPAL_DIR
$SCRIPT_DIR/travis_setup_drupal.sh
cd $DRUPAL_DIR
chmod -R u+w web/sites/default
mkdir -p web/sites/simpletest/browser_output
- name: Setup composer paths
run: |
git -C "$GITHUB_WORKSPACE/build_dir" checkout -b github-testing
cd $DRUPAL_DIR
composer config repositories.local path "$GITHUB_WORKSPACE/build_dir"
composer config minimum-stability dev
composer require "islandora/islandora:dev-github-testing as dev-2.x"
- name: Install modules
run: |
cd $DRUPAL_DIR/web
drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults
- name: Copy PHPunit file
run: cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml
- name: Test scripts
run: $SCRIPT_DIR/travis_scripts.sh
- name: Start chromedriver
if: matrix.test-suite == 'functional-javascript'
run: |-
/usr/local/share/chromedriver-linux64/chromedriver \
--log-path=/tmp/chromedriver.log \
--verbose \
--allowed-ips= \
--allowed-origins=* &
- name: PHPUNIT tests
run: |
cd $DRUPAL_DIR/web/core
$DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"
- name: Print chromedriver logs
if: matrix.test-suite == 'functional-javascript'
run: cat /tmp/chromedriver.log

26
.github/workflows/gitlab-mirror.yml

@ -1,26 +0,0 @@
name: Mirror and run GitLab CI
on:
push:
branches: [2.x]
tags: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://git.drupalcode.org/project/islandora"
env:
FOLLOW_TAGS: "true"
FORCE_PUSH: "false"
GITLAB_HOSTNAME: "git.drupal.org"
GITLAB_USERNAME: "project_34868_bot"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "34868"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored

@ -1,3 +0,0 @@
vendor
/.idea/
/.vscode

30
.travis.yml

@ -0,0 +1,30 @@
sudo: true
language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
allow_failures:
- php: hhvm
branches:
only:
- 7.x-2.x
before_install:
- export ISLANDORA_DIR=$TRAVIS_BUILD_DIR
- $TRAVIS_BUILD_DIR/islandora/tests/scripts/travis_setup.sh
- cd $HOME/drupal-*
script:
- ant -buildfile sites/all/modules/islandora/islandora/build.xml lint
- $ISLANDORA_DIR/islandora/tests/scripts/line_endings.sh sites/all/modules/islandora/islandora sites/all/modules/islandora/islandora_apachesolr sites/all/modules/islandora/islandora_basic_image sites/all/modules/islandora/islandora_collection sites/all/modules/islandora/islandora_dc sites/all/modules/islandora/islandora_mods sites/all/modules/islandora/islandora_rdf_mapping_service
- drush coder-review --reviews=production,security,style,i18n,potx,sniffer islandora islandora_apachesolr islandora_basic_image islandora_collection islandora_dc islandora_mods islandora_rdf_mapping_service
- phpcpd --names *.module,*.inc,*.test sites/all/modules/islandora/islandora sites/all/modules/islandora/islandora_apachesolr sites/all/modules/islandora/islandora_basic_image sites/all/modules/islandora/islandora_collection sites/all/modules/islandora/islandora_dc sites/all/modules/islandora/islandora_mods sites/all/modules/islandora/islandora_rdf_mapping_service
- drush test-run --uri=http://localhost:8081 Islandora
notifications:
irc: "irc.freenode.org#islandora"

42
CONTRIBUTING.md

@ -1,34 +1,31 @@
# Welcome! # Welcome!
If you are reading this document then you are interested in contributing to Islandora 8. All contributions are welcome: use-cases, documentation, code, patches, bug reports, feature requests, etc. You do not need to be a programmer to speak up! If you are reading this document then you are interested in contributing to the Islandora CLAW, and Islandora. All contributions are welcome: use-cases, documentation, code, patches, bug reports, feature requests, etc. You do not need to be a programmer to speak up!
We also have an IRC channel -- #islandora -- on freenode.net. Feel free to hang out there, ask questions, and help others out if you can.
Please note that this project operates under the [Islandora Community Code of Conduct](http://islandora.ca/codeofconduct). By participating in this project you agree to abide by its terms.
## Workflows ## Workflows
The Islandora 8 Tech Call meets each Wednesday at 1:00 PM Eastern, and the Islandora 8 User Call meets every second Thursday at 1:00 PM Eastern. Meeting notes and announcements are posted to the [Islandora community list](https://groups.google.com/forum/#!forum/islandora) and the [Islandora developers list](https://groups.google.com/forum/#!forum/islandora-dev). You can view meeting agendas, notes, and call-in information [here](https://github.com/Islandora/documentation/wiki#islandora-8-tech-calls). Anybody is welcome to join the calls, and add items to the agenda. The group meets each Wednesday at 1PM Eastern. Meeting notes and announcements are posted to the [Islandora community list](https://groups.google.com/forum/#!forum/islandora) and the [Islandora developers list](https://groups.google.com/forum/#!forum/islandora-dev). You can view meeting agendas, notes, and call-in information [here](https://github.com/Islandora-CLAW/CLAW/wiki#islandora-7x-2x-tech-calls). Anybody is welcome to join the calls, and add items to the agenda.
### Use cases ### Use cases
If you would like to submit a use case to the Islandora 8 project, please submit an issue [here](https://github.com/Islandora/documentation/issues/new) using the [Use Case template](https://github.com/Islandora/documentation/wiki/Use-Case-template), prepending "Use Case:" to the title of the issue. If you would like to submit a use case for the Islandora and Fedora integration project, please submit and issue [here](https://github.com/Islandora-CLAW/CLAW/issues/new) using the [Use Case template](https://github.com/Islandora/Islandora-Fedora4-Interest-Group/wiki/Use-Case-template), assign the "use case" label to the issue.
### Documentation ### Documentation
You can contribute documentation in two different ways. One way is to create an issue [here](https://github.com/Islandora/documentation/issues/new), prepending "Documentation:" to the title of the issue. Another way is by pull request, which is the same process as [Contribute Code](https://github.com/Islandora/documentation/blob/master/CONTRIBUTING.md#contribute-code). All documentation resides in [`docs`](https://github.com/Islandora/documentation/tree/master/docs). You can contribute documentation in two different ways. One way is to create an issue [here](https://github.com/Islandora-CLAW/CLAW/issues/new) assign the "documentation" label to the issue. Another way is to by pull request, same process as [Contribute Code](https://github.com/Islandora-CLAW/CLAW/blob/7.x-2.x/contributing.md#contribute-code). All documentation resides in [`docs`](https://github.com/Islandora-CLAW/CLAW/tree/7.x-2.x/docs).
### Request a new feature ### Request a new feature
To request a new feature you should [open an issue in the Islandora 8 repository](https://github.com/Islandora/documentation/issues/new) or create a use case (see the _Use cases_ section above), and summarize the desired functionality. Prepend "Enhancement:" if creating an issue on the project repo, and "Use Case:" if creating a use case. To request a new feature you should [open an issue](https://github.com/Islandora-CLAW/CLAW/issues/new) or create a [use case](https://github.com/Islandora-CLAW/CLAW/blob/7.x-2.x/CONTRIBUTING.md#use-cases) (see _use case_ section above), and summarize the desired functionality. Select the label "enhancement" if creating an issue on the project repo, and "use case" if creating a use case in the interest group repo.
### Report a bug ### Report a bug
To report a bug you should [open an issue in the Islandora 8 repository](https://github.com/Islandora/documentation/issues/new) that summarizes the bug. Prepend the label "Bug:" to the title of the issue. To report a bug you should [open an issue](https://github.com/Islandora-CLAW/CLAW/issues/new) that summarizes the bug. Set the label to "bug".
In order to help us understand and fix the bug it would be great if you could provide us with: In order to help us understand and fix the bug it would be great if you could provide us with:
1. The steps to reproduce the bug. This includes information about e.g. the Islandora version you were using along with the versions of stack components. 1. The steps to reproduce the bug. This includes information about e.g. the Islandora version you were using along with version of stack components.
2. The expected behavior. 2. The expected behavior.
3. The actual, incorrect behavior. 3. The actual, incorrect behavior.
@ -36,15 +33,15 @@ Feel free to search the issue queue for existing issues (aka tickets) that alrea
**If you want to provide a pull along with your bug report:** **If you want to provide a pull along with your bug report:**
That is great! In this case please send us a pull request as described in the section _Create a pull request_ below. That is great! In this case please send us a pull request as described in section _[Create a pull request](https://github.com/Islandora-CLAW/CLAW/blob/7.x-2.x/CONTRIBUTING.md#create-a-pull-request)_ below.
### Contribute code ### Contribute code
Before you set out to contribute code you will need to have completed a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <mailto:community@islandora.ca> Before you set out to contribute code you will need to have completed a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor Licencse Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <mailto:community@islandora.ca>
_If you are interested in contributing code to Islandora but do not know where to begin:_ _If you are interested in contributing code to Islandora but do not know where to begin:_
In this case you should [browse open issues](https://github.com/Islandora/documentation/issues) and check out [use cases](https://github.com/Islandora/documentation/labels/use%20case). In this case you should [browse open issues](https://github.com/Islandora-CLAW/CLAW/issues), and or [use cases](https://github.com/Islandora/Islandora-Fedora4-Interest-Group/labels/use%20case).
If you are contributing Drupal code, it must adhere to [Drupal Coding Standards](https://www.drupal.org/coding-standards); Travis CI will check for this on pull requests. If you are contributing Drupal code, it must adhere to [Drupal Coding Standards](https://www.drupal.org/coding-standards); Travis CI will check for this on pull requests.
@ -53,7 +50,7 @@ Contributions to the Islandora codebase should be sent as GitHub pull requests.
* For _small patches_, feel free to submit pull requests directly for those patches. * For _small patches_, feel free to submit pull requests directly for those patches.
* For _larger code contributions_, please use the following process. The idea behind this process is to prevent any wasted work and catch design issues early on. * For _larger code contributions_, please use the following process. The idea behind this process is to prevent any wasted work and catch design issues early on.
1. [Open an issue](https://github.com/Islandora/documentation/issues), prepending "Enhancement:" in the title if a similar issue does not exist already. If a similar issue does exist, then you may consider participating in the work on the existing issue. 1. [Open an issue](https://github.com/Islandora-CLAW/CLAW/issues) and assign it the label of "enhancement", if a similar issue does not exist already. If a similar issue does exist, then you may consider participating in the work on the existing issue.
2. Comment on the issue with your plan for implementing the issue. Explain what pieces of the codebase you are going to touch and how everything is going to fit together. 2. Comment on the issue with your plan for implementing the issue. Explain what pieces of the codebase you are going to touch and how everything is going to fit together.
3. Islandora committers will work with you on the design to make sure you are on the right track. 3. Islandora committers will work with you on the design to make sure you are on the right track.
4. Implement your issue, create a pull request (see below), and iterate from there. 4. Implement your issue, create a pull request (see below), and iterate from there.
@ -62,12 +59,19 @@ Contributions to the Islandora codebase should be sent as GitHub pull requests.
Take a look at [Creating a pull request](https://help.github.com/articles/creating-a-pull-request). In a nutshell you need to: Take a look at [Creating a pull request](https://help.github.com/articles/creating-a-pull-request). In a nutshell you need to:
1. [Fork](https://help.github.com/articles/fork-a-repo) this repository to your personal or institutional GitHub account (depending on the CLA you are working under). Be cautious of which branches you work from though (you'll want to base your work off the default branch). See [Fork a repo](https://help.github.com/articles/fork-a-repo) for detailed instructions. 1. [Fork](https://help.github.com/articles/fork-a-repo) the Islandora GitHub repository at [https://github.com/Islandora-CLAW/CLAW](https://github.com/Islandora-CLAW/CLAW) to your personal GitHub account. If you already have a fork of [https://github.com/Islandora/islandora](https://github.com/Islandora/islandora) Github will prevent you from creating a new fork; in such a case you can continue to use [https://github.com/Islandora/islandora](https://github.com/Islandora/islandora) to issue pull request, be cautious of which branches you work from though (you'll want to base your work off of 7.x-2.x). Also be cautious of which repository your issuing your Pull Request to (you'll want to issue your pull request to [https://github.com/Islandora-CLAW/CLAW](https://github.com/Islandora-CLAW/CLAW)). See [Fork a repo](https://help.github.com/articles/fork-a-repo) for detailed instructions.
2. Commit any changes to your fork. 2. Commit any changes to your fork.
3. Send a [pull request](https://help.github.com/articles/creating-a-pull-request) using the [pull request template](https://github.com/Islandora/documentation/blob/master/.github/PULL_REQUEST_TEMPLATE.md) to the Islandora GitHub repository that you forked in step 1. If your pull request is related to an existing issue -- for instance, because you reported a [bug/issue](https://github.com/Islandora/documentation/issues) earlier -- prefix the title of your pull request with the corresponding issue number (e.g. `issue-123: ...`). Please also include a reference to the issue in the description of the pull. This can be done by using '#' plus the issue number like so '#123', also try to pick an appropriate name for the branch in which you're issuing the pull request from. 3. Send a [pull request](https://help.github.com/articles/creating-a-pull-request) to the Islandora GitHub repository that you forked in step 1. If your pull request is related to an existing issue -- for instance, because you reported a [bug/issue](https://github.com/Islandora-CLAW/CLAW/issues) earlier -- prefix the title of your pull request with the corresponding issue number (e.g. `issue-123: ...`). Please also include a reference to the issue in the description of the pull. This can be done by using '#' plus the issue number like so '#123', also try to pick an appropriate name for the branch in which you're issuing the pull request from.
You may want to read [Syncing a fork](https://help.github.com/articles/syncing-a-fork) for instructions on how to keep your fork up to date with the latest changes of the upstream (official) `islandora` repository.
You may want to read [Syncing a fork](https://help.github.com/articles/syncing-a-fork) for instructions on how to keep your fork up to date with the latest changes of the upstream (official) repository. Please note that TravisCI will test for [PSR-2](http://www.php-fig.org/psr/psr-2/) compliance. You can verify coding standard compliance with [PHP Codesniffer](https://github.com/squizlabs/PHP_CodeSniffer).
**Note**: Due to differing interpretations of the PSR-2 coding standards do **not** use PHP [Coding Standards Fixer](http://cs.sensiolabs.org/). Coding Standards Fixer may make changes to your code that can cause it to fail our TravisCI tests.
In addition, Islandora 7.x-2.x Committers will review contributions for [PSR-4 ](http://www.php-fig.org/psr/psr-4/) compliance.
## License Agreements ## License Agreements
The Islandora Foundation requires that contributors complete a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <a href="mailto:community@islandora.ca?Subject=Contributor%20License%20Agreement" target="_top">community@islandora.ca</a>. This license is for your protection as a contributor as well as the protection of the Foundation and its users; it does not change your rights to use your own contributions for any other purpose. A list of current CLAs is kept [here](https://github.com/Islandora/islandora/wiki/Contributor-License-Agreements). The Islandora Foundation requires that contributors complete a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor Licencse Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <a href="mailto:community@islandora.ca?Subject=Contributor%20License%20Agreement" target="_top">community@islandora.ca</a>. This license is for your protection as a contributor as well as the protection of the Foundation and its users; it does not change your rights to use your own contributions for any other purpose.

15
COPYRIGHT

@ -1,15 +0,0 @@
Copyright (C) 2015 The Islandora Foundation and contributors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program as the file LICENSE.txt; if not, please see
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

118
README.md

@ -1,121 +1,39 @@
# Islandora # Islandora
[![Build Status](https://travis-ci.org/Islandora-CLAW/islandora.png?branch=7.x-2.x)](https://travis-ci.org/Islandora-CLAW/islandora)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg?style=flat-square)](https://php.net/)
[![Build Status](https://github.com/islandora/islandora/actions/workflows/build-2.x.yml/badge.svg)](https://github.com/Islandora/islandora/actions)
[![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md) [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
[![LICENSE](https://img.shields.io/badge/license-GPLv2-blue.svg?style=flat-square)](./LICENSE) [![LICENSE](https://img.shields.io/badge/license-GPLv2-blue.svg?style=flat-square)](./LICENSE)
[![codecov](https://codecov.io/gh/Islandora/islandora/branch/2.x/graph/badge.svg)](https://codecov.io/gh/Islandora/islandora)
## Introduction ## Introduction
This is the core module of Islandora's digital repository ecosystem. The `islandora` module provides: Islandora Fedora 4 Repository Module
- Fedora 5 integration via the [flysystem](https://drupal.org/project/flysystem) module
- Integration with the [context](https://drupal.org/project/context) module to control your digital repository's behaviour
- Publishing messages to a queue so they can be processed in the background
`islandora` contains several submodules and features:
- `islandora_core_feature` (**required**)
- Configuration required by the `islandora` module
- `islandora_image`
- Integrates with a [Houdini](https://github.com/Islandora/Crayfish/tree/dev/Houdini) (Imagemagick) server for image processing
- `islandora_audio` and `islandora_video`
- Integrate with a [Homarus](https://github.com/Islandora/Crayfish/tree/dev/Homarus) (`ffmpeg`) server for audio/video processing
- `islandora_text_extraction` and `islandora_text_extraction_defaults`
- Integrate with a [Hypercube](https://github.com/Islandora/Crayfish/tree/dev/Hypercube) (`tessseract` and `pdftotext`) server for text extraction
- `islandora_breadcrumbs`
- Provides breadcrumbs following collection structure
- `islandora_iiif`
- Provides IIIF manifests for repository content
## Requirements
Installing via composer will download all required libraries and modules. However, for reference, `islandora` requires the following drupal modules:
- [context](http://drupal.org/project/context)
- [search_api](http://drupal.org/project/search_api)
- [jsonld](http://drupal.org/project/jsonld)
- [jwt](http://drupal.org/project/jwt)
- [filehash](http://drupal.org/project/filehash)
- [prepopulate](http://drupal.org/project/prepopulate)
- [eva](http://drupal.org/project/eva)
- [features](http://drupal.org/project/features)
- [migrate_plus](http://drupal.org/project/migrate_plus)
- [migrate_source_csv](http://drupal.org/project/migrate_source_csv)
- [flysystem](http://drupal.org/project/flysystem)
It also requires the following PHP libraries:
- [Crayfish Commons](https://packagist.org/packages/islandora/crayfish-commons)
- [Stomp PHP](http://drupal.org/project/)
If you are using a Drush version less than 10.4 you will also need to install and enable [migrate_tools](http://drupal.org/project/migrate_tools) separately.
## Installation
For a full digital repository solution, see our [installation documentation](https://islandora.github.io/documentation/installation/component_overview/).
To download/enable just this module, use the following from the command line:
```bash ## Maintainers/Sponsors
$ composer require islandora/islandora
$ drush en islandora_core_feature
$ drush mim islandora_tags
```
## Configuration * UPEI
* discoverygarden inc.
![image](https://user-images.githubusercontent.com/20773151/67234502-ac171900-f41b-11e9-964e-c7d4cfadbd67.png) * LYRASIS
* McMaster University
You can set the following configuration at `admin/config/islandora/core`: * University of Limerick
- Broker URL * York University
- The URL to your message broker (i.e. Activemq) * University of Manitoba
- JWT Expiry * Simon Fraser University
- Set to increase the amount of time that authorization tokens remain valid. If you have a long running derivative processes or a migration, you may need to set this to be a very long time, e.g. `500d`. Otherwise, it's best to leave it alone. * PALS
- Gemini URL * American Philosophical Society
- The URL to your Gemini server, which keeps track of where Islandora content is in Fedora. * common media inc.
- Fedora URL Display
- Selected bundles can display the Fedora URL for repository content.
## Documentation
Further documentation for this module is available on the [Islandora 8 documentation site](https://islandora.github.io/documentation/).
## Troubleshooting/Issues
Having problems or solved a problem? Check out the Islandora google groups for a solution.
* [Islandora Group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/islandora)
* [Islandora Dev Group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/islandora-dev)
## Maintainers ## Maintainers
Current maintainers: Current maintainers:
* [Islandora Technical Advisory Group](https://github.com/Islandora/islandora-community/wiki/Technical-Advisory-Group-%28TAG%29) * [Nick Ruest](https://github.com/ruebot)
* [Daniel Lamb](https://github.com/dannylamb/)
## Sponsors
* [American Philosophical Society](https://www.amphilsoc.org/)
* [Born-Digital, Inc.](https://www.born-digital.com/)
* [discoverygarden inc.](https://www.discoverygarden.ca/)
* [LYRASIS](https://www.lyrasis.org/)
* [McMaster University](https://www.mcmaster.ca/)
* [PALS](https://www.mnpals.org/)
* [University of Limerick](https://www.ul.ie/)
* [University of Manitoba](https://umanitoba.ca/)
* [UPEI](https://www.upei.ca/)
* [Simon Fraser University](https://www.sfu.ca/)
* [York University](https://www.yorku.ca/)
## Development ## Development
If you would like to contribute, please get involved by attending our weekly [Tech Call](https://github.com/Islandora/islandora-community/wiki/Weekly-Open-Tech-Call). We love to hear from you! If you would like to contribute, please get involved by attending our weekly [Tech Call](https://github.com/Islandora-CLAW/CLAW/wiki). We love to hear from you!
If you would like to contribute code to the project, you need to be covered by an Islandora Foundation [Contributor License Agreement](https://github.com/Islandora/islandora-community/wiki/Onboarding-Checklist#contributor-license-agreements) or [Corporate Contributor License Agreement](https://github.com/Islandora/islandora-community/wiki/Onboarding-Checklist#contributor-license-agreements). Please see the [Contributor License Agreements](https://github.com/Islandora/islandora-community/wiki/Contributor-License-Agreements) page on the islandora-community wiki for more information. If you would like to contribute code to the project, you need to be covered by an Islandora Foundation [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or [Corporate Contributor Licencse Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). Please see the [Contributors](http://islandora.ca/resources/contributors) pages on Islandora.ca for more information.
We recommend using the [islandora-playbook](https://github.com/Islandora-Devops/islandora-playbook) to get started.
## License ## License
[GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt) [GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt)

57
composer.json

@ -1,57 +0,0 @@
{
"name": "islandora/islandora",
"description": "Core Islandora module",
"type": "drupal-module",
"keywords": ["Drupal", "Islandora"],
"homepage": "https://github.com/Islandora/islandora",
"support": {
"issues": "https://github.com/Islandora/documentation/issues"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"drupal/context": "^4 || ^5@RC",
"drupal/ctools": "^3.8 || ^4",
"drupal/eva" : "^3.0",
"drupal/file_replace": "^1.1",
"drupal/filehash": "^2 || ^3",
"drupal/flysystem" : "^2.0@alpha",
"drupal/jwt": "^1.1 || ^2",
"drupal/migrate_plus" : "^5.1 || ^6",
"drupal/migrate_source_csv" : "^3.4",
"drupal/prepopulate" : "^2.2",
"drupal/search_api": "^1.8",
"drupal/token" : "^1.3",
"islandora/chullo": "^2.0",
"islandora/fedora-entity-mapper": "^1.0",
"islandora/jsonld": "^2 || ^3",
"stomp-php/stomp-php": "4.* || ^5"
},
"require-dev": {
"phpunit/phpunit": "^6",
"squizlabs/php_codesniffer": "^2.7.1",
"drupal/coder": "*",
"sebastian/phpcpd": "*"
},
"suggest": {
"drupal/transliterate_filenames": "Sanitizes filenames when they are uploaded so they don't break your repository.",
"drupal/coi": "Some configuration fields work with Config Override Inspector."
},
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Islandora Foundation",
"email": "community@islandora.ca",
"role": "Owner"
},
{
"name": "Daniel Lamb",
"email": "dlamb@islandora.ca",
"role": "Maintainer"
}
]
}

4
config/install/islandora.settings.yml

@ -1,4 +0,0 @@
broker_url: 'tcp://localhost:61613'
jwt_expiry: '+2 hour'
delete_media_and_files: TRUE
gemini_pseudo_bundles: []

13
config/install/system.action.delete_media_and_file.yml

@ -1,13 +0,0 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora
module:
- islandora
id: delete_media_and_file
label: 'Delete media and file(s)'
type: media
plugin: delete_media_and_file
configuration: { }

244
config/schema/islandora.schema.yml

@ -1,244 +0,0 @@
islandora.settings:
type: config_object
label: 'Islandora Core Settings'
mapping:
broker_url:
type: string
label: 'Url to connect to message broker'
fedora_rest_endpoint:
type: string
label: 'Url to Fedora instance'
broadcast_queue:
type: string
label: 'Queue that handles distributing messages amongst multiple recipients'
jwt_expiry:
type: string
label: 'How long JWTs should last before expiring.'
delete_media_and_files:
type: boolean
label: 'Node Delete with Media and Files'
redirect_after_media_save:
type: boolean
label: 'Redirect to node after media save.'
upload_form_location:
type: string
label: 'Upload Form Location'
upload_form_allowed_mimetypes:
type: string
label: 'Upload Form Allowed Extensions'
gemini_pseudo_bundles:
type: sequence
label: 'List of node, media and taxonomy terms that should include the linked Fedora URI'
sequence:
type: string
action.configuration.emit_node_event:
type: mapping
label: 'Emit a Node event to a queue/topic'
mapping:
queue:
type: text
label: 'Queue'
event:
type: text
label: 'Event Type'
action.configuration.emit_media_event:
type: mapping
label: 'Emit a Media event to a queue/topic'
mapping:
queue:
type: text
label: 'Queue'
event:
type: text
label: 'Event Type'
action.configuration.emit_file_event:
type: mapping
label: 'Emit a File event to a queue/topic'
mapping:
queue:
type: text
label: 'Queue'
event:
type: text
label: 'Event Type'
action.configuration.emit_term_event:
type: mapping
label: 'Emit a Taxonomy Term event to a queue/topic'
mapping:
queue:
type: text
label: 'Queue'
event:
type: text
label: 'Event Type'
action.configuration.delete_media_and_file:
type: action_configuration_default
label: 'Delete media and file'
condition.plugin.node_has_term:
type: condition.plugin
mapping:
uri:
type: text
label: 'Taxonomy Term URI'
logic:
type: string
label: 'Logic (AND or OR)'
tids:
type: sequence
sequence:
type: mapping
mapping:
target_id:
type: integer
label: The target taxonomy term IDs
condition.plugin.node_has_parent:
type: condition.plugin
mapping:
parent_nid:
type: integer
label: 'Parent node'
parent_reference_field:
type: string
label: 'Parent reference field'
condition.plugin.media_has_term:
type: condition.plugin
mapping:
uri:
type: text
label: 'Taxonomy Term URI'
logic:
type: string
label: 'Logic (AND or OR)'
condition.plugin.parent_node_has_term:
type: condition.plugin
mapping:
uri:
type: text
label: 'Taxonomy Term URI'
logic:
type: string
label: 'Logic (AND or OR)'
condition.plugin.file_uses_filesystem:
type: condition.plugin
mapping:
filesystems:
type: sequence
sequence:
type: string
condition.plugin.media_uses_filesystem:
type: condition.plugin
mapping:
filesystems:
type: sequence
sequence:
type: string
condition.plugin.media_has_mimetype:
type: condition.plugin
mapping:
mimetypes:
type: text
label: 'Mime types'
condition.plugin.content_entity_type:
type: condition.plugin
mapping:
types:
type: sequence
sequence:
type: string
condition.plugin.node_had_namespace:
type: condition.plugin
mapping:
namespace:
type: text
label: 'Namespace'
pid_field:
type: ignore
label: 'PID field'
field.formatter.settings.islandora_image:
type: field.formatter.settings.image
label: 'Islandora image field display format settings'
condition.plugin.islandora_entity_bundle:
type: condition.plugin
mapping:
bundles:
type: sequence
sequence:
type: string
condition.plugin.media_source_mimetype:
type: condition.plugin
mapping:
mimetype:
type: string
reaction.plugin.alter_jsonld_type:
type: islandora.reaction_plugin_with_saved
mapping:
source_field:
type: string
islandora.reaction_plugin_with_saved:
type: reaction.plugin
mapping:
saved:
type: boolean
label: Default config upstream; however, left undefined in the schema.
reaction.plugin.islandora_map_uri_predicate:
type: islandora.reaction_plugin_with_saved
mapping:
drupal_uri_predicate:
type: string
reaction.plugin.view_mode_alter:
type: islandora.reaction_plugin_with_saved
mapping:
mode:
type: string
label: The view mode to which to switch
islandora.reaction.actions:
type: islandora.reaction_plugin_with_saved
mapping:
actions:
type: sequence
sequence:
type: string
reaction.plugin.index:
type: islandora.reaction.actions
reaction.plugin.delete:
type: islandora.reaction.actions
reaction.plugin.derivative:
type: islandora.reaction.actions
field.widget.settings.media_track:
type: field.widget.settings.file_generic
field.field_settings.media_track:
type: field.field_settings.file
mapping:
languages:
type: string
field.storage_settings.media_track:
type: field.storage_settings.file

3
css/islandora.css

@ -1,3 +0,0 @@
.container .islandora-media-items {
margin: 0;
}

6
drush.services.yml

@ -1,6 +0,0 @@
services:
islandora.commands:
class: \Drupal\islandora\Commands\IslandoraCommands
arguments: ['@entity_type.manager', '@current_user', '@account_switcher']
tags:
- { name: drush.command }

33
islandora.info.yml

@ -1,33 +0,0 @@
# This .info.yml files provides the basic information about our module to Drupal
# More: https://www.drupal.org/node/2000204
name: 'islandora'
description: "Islandora Core"
type: module
package: Islandora
core_version_requirement: ^9 || ^10
dependencies:
- context:context_ui
- ctools:ctools
- drupal:action
- drupal:basic_auth
- drupal:block
- drupal:content_translation
- drupal:link
- drupal:media
- drupal:node
- drupal:options
- drupal:path
- drupal:rest
- drupal:taxonomy
- drupal:text
- drupal:views_ui
- eva:eva
- file_replace:file_replace
- filehash:filehash
- flysystem:flysystem
- jsonld:jsonld
- jwt:jwt
- migrate_source_csv:migrate_source_csv
- prepopulate:prepopulate
- search_api:search_api
- token:token

228
islandora.install

@ -1,228 +0,0 @@
<?php
/**
* @file
* Install/update hook implementations.
*/
use Drupal\Core\Extension\ExtensionNameLengthException;
use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\Utility\UpdateException;
/**
* Adds common namespaces to jsonld.settings.
*/
function islandora_install() {
update_jsonld_included_namespaces();
}
/**
* Delete the 'delete_media' action we used to provide, if it exists.
*
* Use the core 'media_delete_action' instead.
*/
function islandora_update_8001(&$sandbox) {
$action = \Drupal::service('entity_type.manager')->getStorage('action')->load('delete_media');
if ($action) {
$action->delete();
}
}
/**
* Replaces 'entity_bundle' conditions with 'islandora_entity_bundle'.
*
* This prevents plugin naming collisions between islandora and ctools.
*/
function islandora_update_8002(&$sandbox) {
// Find contexts that have the old 'entity_bundle' condition.
$results = \Drupal::entityQuery('context')->condition('conditions.entity_bundle.id', 'entity_bundle')->execute();
if (empty($results)) {
return;
}
// Set each context config to use 'islandora_entity_bundle' instead.
foreach ($results as $result) {
$config = \Drupal::configFactory()->getEditable("context.context.$result");
$condition = $config->get('conditions.entity_bundle');
$condition['id'] = 'islandora_entity_bundle';
$config->set('conditions.islandora_entity_bundle', $condition);
$config->clear('conditions.entity_bundle');
$config->save();
}
// Force drupal to reload the config.
\Drupal::service('plugin.manager.condition')->clearCachedDefinitions();
}
/**
* Deletes the islandora_version_count table.
*
* We never implemented the functionality.
*/
function islandora_update_8003(&$sandbox) {
\Drupal::service('database')
->schema()
->dropTable('islandora_version_count');
}
/**
* Renames migration source keys -> ids.
*/
function islandora_update_8004() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('migrate_plus.migration.islandora__tags');
if ($config) {
if (!$config->get('source.ids')) {
$config->set('source.ids', $config->get('source.keys'));
$config->clear('source.keys');
$config->save(TRUE);
}
}
}
/**
* Makes migrate_tags an array.
*/
function islandora_update_8005() {
$config_factory = \Drupal::configFactory();
$config_factory->getEditable('migrate_plus.migration.islandora__tags')->delete();
$config = $config_factory->getEditable('migrate_plus.migration.islandora_tags');
if ($config) {
if (!is_array($config->get('migration_tags'))) {
$config->set('migration_tags', [$config->get('migration_tags')]);
$config->save(TRUE);
}
if (!$config->get('source.ids')) {
$config->set('source.ids', $config->get('source.keys'));
$config->clear('source.keys');
$config->save(TRUE);
}
}
}
/**
* Adds adds previously hardcoded namespaces to configuration.
*/
function islandora_update_8006() {
update_jsonld_included_namespaces();
}
/**
* Used by install and update_8006 to add namespaces to jsonld.settings.yml.
*/
function update_jsonld_included_namespaces() {
$namespaces = [
[
'prefix' => 'ldp',
'namespace' => 'http://www.w3.org/ns/ldp#',
], [
'prefix' => 'dc11',
'namespace' => 'http://purl.org/dc/elements/1.1/',
], [
'prefix' => 'dcterms',
'namespace' => 'http://purl.org/dc/terms/',
], [
'prefix' => 'nfo',
'namespace' => 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/v1.1/',
], [
'prefix' => 'ebucore',
'namespace' => 'http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#',
], [
'prefix' => 'fedora',
'namespace' => 'http://fedora.info/definitions/v4/repository#',
], [
'prefix' => 'owl',
'namespace' => 'http://www.w3.org/2002/07/owl#',
], [
'prefix' => 'ore',
'namespace' => 'http://www.openarchives.org/ore/terms/',
], [
'prefix' => 'rdf',
'namespace' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
], [
'prefix' => 'rdau',
'namespace' => 'http://rdaregistry.info/Elements/u/',
], [
'prefix' => 'islandora',
'namespace' => 'http://islandora.ca/',
], [
'prefix' => 'pcdm',
'namespace' => 'http://pcdm.org/models#',
], [
'prefix' => 'use',
'namespace' => 'http://pcdm.org/use#',
], [
'prefix' => 'iana',
'namespace' => 'http://www.iana.org/assignments/relation/',
], [
'prefix' => 'premis',
'namespace' => 'http://www.loc.gov/premis/rdf/v1#',
], [
'prefix' => 'premis3',
'namespace' => 'http://www.loc.gov/premis/rdf/v3/',
], [
'prefix' => 'co',
'namespace' => 'http://purl.org/co/',
],
];
$config = \Drupal::configFactory()->getEditable('jsonld.settings');
if ($config && !is_array($config->get('rdf_namespaces'))) {
$config->set('rdf_namespaces', $namespaces);
$config->save(TRUE);
}
else {
\Drupal::logger('islandora')
->warning("Could not find required jsonld.settings to add default RDF namespaces.");
}
}
/**
* Ensure that ctools is enabled.
*/
function islandora_update_8007() {
$module_handler = \Drupal::moduleHandler();
if ($module_handler->moduleExists('ctools')) {
return t('The "@module_name" module is already enabled, no action necessary.', [
'@module_name' => 'ctools',
]);
}
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */
$installer = \Drupal::service('module_installer');
try {
if ($installer->install(['ctools'], TRUE)) {
return t('The "@module_name" module was enabled successfully.', [
'@module_name' => 'ctools',
]);
}
}
catch (ExtensionNameLengthException | MissingDependencyException $e) {
throw new UpdateException('Failed; ensure that the ctools module is available in the Drupal installation.', 0, $e);
}
catch (\Exception $e) {
throw new UpdateException('Failed; encountered an exception while trying to enable ctools.', 0, $e);
}
// Theoretically impossible to hit, as ModuleInstaller::install() only returns
// TRUE (or throws/propagates an exception), but... probably a good idea to
// have the here, just in case?
throw new UpdateException('Failed; hit the end of the update hook implementation, which is not expected.');
}
/**
* Set config to no redirect after media save.
*/
function islandora_update_8008() {
$config = \Drupal::configFactory()->getEditable('islandora.settings');
if ($config) {
$config->set('redirect_after_media_save', FALSE);
$config->save(TRUE);
return t('A new configuration option, "Redirect after media save" is now available.
It has been turned off to preserve existing behaviour. To enable this setting visit
Configuration > Islandora > Core Settings.');
}
}

5
islandora.libraries.yml

@ -1,5 +0,0 @@
islandora:
version: VERSION
css:
theme:
css/islandora.css: {}

29
islandora.links.action.yml

@ -1,29 +0,0 @@
islandora.upload_media:
route_name: islandora.upload_media
title: Batch Upload Media
appears_on:
- view.media_of.page_1
islandora.add_media_to_node:
route_name: islandora.add_media_to_node_page
title: Add Media
appears_on:
- view.media_of.page_1
islandora.upload_children:
route_name: islandora.upload_children
title: Batch Upload Children
appears_on:
- view.manage_members.page_1
islandora.add_member_to_node:
route_name: islandora.add_member_to_node_page
title: Add Child
appears_on:
- view.manage_members.page_1
islandora.reorder_children:
route_name: view.reorder_children.page_1
title: Reorder Children
appears_on:
- view.manage_members.page_1

20
islandora.links.menu.yml

@ -1,20 +0,0 @@
# Menu list of Islandora configuration forms
system.admin_config_islandora:
title: Islandora
parent: system.admin_config
route_name: system.admin_config_islandora
weight: 100
# Core Islandora configuration form
system.islandora_settings:
title: 'Core Settings'
parent: system.admin_config_islandora
route_name: system.islandora_settings
description: 'Confgure core Islandora settings'
# RDF property mappings
system.islandora_rdf_mappings:
title: 'Field and term RDF mappings'
parent: system.admin_reports
description: 'List of configured Drupal field to RDF property mappings and taxonomy term linked data URIs.'
route_name: system.islandora_rdf_mappings

762
islandora.module

@ -1,762 +0,0 @@
<?php
/**
* @file
* Contains islandora.module.
*
* This file is part of the Islandora Project.
*
* (c) Islandora Foundation
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Diego Pino Navarro <dpino@metro.org> https://github.com/diegopino
*/
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\Url;
use Drupal\islandora\Form\IslandoraSettingsForm;
use Drupal\node\NodeInterface;
use Drupal\media\MediaInterface;
use Drupal\file\FileInterface;
use Drupal\taxonomy\TermInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\serialization\Normalizer\CacheableNormalizerInterface;
use Drupal\Core\Entity\EntityForm;
use Drupal\file\Entity\File;
/**
* Implements hook_help().
*/
function islandora_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the islandora module.
case 'help.page.islandora':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Islandora integrates Drupal with a Fedora repository.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_node_insert().
*/
function islandora_node_insert(NodeInterface $node) {
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeNodeReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $node);
}
/**
* Implements hook_node_update().
*/
function islandora_node_update(NodeInterface $node) {
$utils = \Drupal::service('islandora.utils');
if (!$utils->haveFieldsChanged($node, $node->original)) {
return;
};
// Execute index reactions.
$utils->executeNodeReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $node);
}
/**
* Implements hook_node_delete().
*/
function islandora_node_delete(NodeInterface $node) {
$utils = \Drupal::service('islandora.utils');
// Execute delete reactions.
$utils->executeNodeReactions('\Drupal\islandora\Plugin\ContextReaction\DeleteReaction', $node);
}
/**
* Implements hook_media_insert().
*/
function islandora_media_insert(MediaInterface $media) {
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeMediaReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $media);
// If it has a parent node...
$node = $utils->getParentNode($media);
if ($node) {
// Fire off derivative reactions for the Media.
$utils->executeDerivativeReactions(
'\Drupal\islandora\Plugin\ContextReaction\DerivativeReaction',
$node,
$media
);
}
// Wait until the media insert is complete, then fire file derivatives.
drupal_register_shutdown_function('_islandora_fire_media_file_derivative_reaction', $media);
}
/**
* Implements hook_media_update().
*/
function islandora_media_update(MediaInterface $media) {
$media_source_service = \Drupal::service('islandora.media_source_service');
// Exit early if nothing's changed.
$utils = \Drupal::service('islandora.utils');
if (!$utils->haveFieldsChanged($media, $media->original)) {
return;
};
// Execute index reactions.
$utils->executeMediaReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $media);
// Does it have a source field?
$source_field = $media_source_service->getSourceFieldName($media->bundle());
if (empty($source_field)) {
return;
}
// Exit early if the source file did not change.
if ($media->get($source_field)->equals($media->original->get($source_field))) {
return;
}
// If it has a parent node...
$node = $utils->getParentNode($media);
if ($node) {
// Fire off derivative reactions for the Media.
$utils->executeDerivativeReactions(
'\Drupal\islandora\Plugin\ContextReaction\DerivativeReaction',
$node,
$media
);
$utils->executeMediaReactions('\Drupal\islandora\Plugin\ContextReaction\DerivativeFileReaction', $media);
}
}
/**
* Implements hook_media_delete().
*/
function islandora_media_delete(MediaInterface $media) {
$utils = \Drupal::service('islandora.utils');
// Execute delete reactions.
$utils->executeMediaReactions('\Drupal\islandora\Plugin\ContextReaction\DeleteReaction', $media);
}
/**
* Helper to fire media derivative file reactions after a media 'insert'.
*
* This function should not be called on its own; it exists as a workaround to
* being unable to fire media events after a media insert operation. This
* behaviour will eventually be replaced by event listeners once these are
* implemented in Drupal 9.
*
* @param \Drupal\Core\Media\MediaInterface $media
* The media that was just inserted.
*
* @see https://www.drupal.org/project/drupal/issues/2551893
*/
function _islandora_fire_media_file_derivative_reaction(MediaInterface $media) {
$utils = \Drupal::service('islandora.utils');
// Execute derivative file reactions.
$utils->executeMediaReactions('\Drupal\islandora\Plugin\ContextReaction\DerivativeFileReaction', $media);
}
/**
* Implements hook_file_insert().
*/
function islandora_file_insert(FileInterface $file) {
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeFileReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $file);
}
/**
* Implements hook_file_update().
*/
function islandora_file_update(FileInterface $file) {
// Exit early if unchanged.
if ($file->hasField('sha1') && $file->original->hasField('sha1')
&& $file->sha1->getString() == $file->original->sha1->getString()) {
return;
}
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeFileReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $file);
// Execute derivative reactions.
foreach ($utils->getReferencingMedia($file->id()) as $media) {
$node = $utils->getParentNode($media);
if ($node) {
$utils->executeDerivativeReactions(
'\Drupal\islandora\Plugin\ContextReaction\DerivativeReaction',
$node,
$media
);
}
}
}
/**
* Implements hook_file_delete().
*/
function islandora_file_delete(FileInterface $file) {
$utils = \Drupal::service('islandora.utils');
// Execute delete reactions.
$utils->executeFileReactions('\Drupal\islandora\Plugin\ContextReaction\DeleteReaction', $file);
}
/**
* Implements hook_taxonomy_term_insert().
*/
function islandora_taxonomy_term_insert(TermInterface $term) {
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeTermReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $term);
}
/**
* Implements hook_taxonomy_term_update().
*/
function islandora_taxonomy_term_update(TermInterface $term) {
$utils = \Drupal::service('islandora.utils');
// Execute index reactions.
$utils->executeTermReactions('\Drupal\islandora\Plugin\ContextReaction\IndexReaction', $term);
}
/**
* Implements hook_taxonomy_term_delete().
*/
function islandora_taxonomy_term_delete(TermInterface $term) {
$utils = \Drupal::service('islandora.utils');
// Execute delete reactions.
$utils->executeTermReactions('\Drupal\islandora\Plugin\ContextReaction\DeleteReaction', $term);
}
/**
* Implements hook_jsonld_alter_normalized_array().
*/
function islandora_jsonld_alter_normalized_array(EntityInterface $entity, array &$normalized, array $context) {
$context_manager = \Drupal::service('context.manager');
foreach ($context_manager->getActiveReactions('\Drupal\islandora\ContextReaction\NormalizerAlterReaction') as $reaction) {
$reaction->execute($entity, $normalized, $context);
foreach ($context_manager->getActiveContexts() as $context_config) {
try {
if ($context_config->getReaction($reaction->getPluginId()) && isset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) {
$context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($context_config);
};
}
catch (PluginNotFoundException $e) {
// Squash :(.
}
}
}
}
/**
* Implements hook_entity_view_mode_alter().
*/
function islandora_entity_view_mode_alter(&$view_mode, EntityInterface $entity) {
// Change the view mode based on user input from a 'view_mode_alter'
// ContextReaction.
$entity_type = $entity->getEntityType()->id();
$storage = \Drupal::service('entity_type.manager')->getStorage('entity_view_mode');
$context_manager = \Drupal::service('context.manager');
$current_entity = \Drupal::routeMatch()->getParameter($entity_type);
$current_id = ($current_entity instanceof NodeInterface || $current_entity instanceof MediaInterface) ? $current_entity->id() : NULL;
if (isset($current_id) && $current_id == $entity->id()) {
foreach ($context_manager->getActiveReactions('\Drupal\islandora\Plugin\ContextReaction\ViewModeAlterReaction') as $reaction) {
// Construct the new view mode's machine name.
$entity_type = $entity->getEntityTypeId();
$mode = $reaction->execute();
$machine_name = "$entity_type.$mode";
// Try to load it.
$new_mode = $storage->load($machine_name);
// If successful, alter the view mode.
if ($new_mode) {
$view_mode = $mode;
}
else {
// Otherwise, leave it be, but log a message.
\Drupal::logger('islandora')
->info("EntityViewMode $machine_name does not exist. View mode cannot be altered.");
}
}
}
}
/**
* Implements hook_preprocess_node().
*/
function islandora_preprocess_node(&$variables) {
// Using alternate view modes causes on a node's canoncial page
// causes the title to get printed out twice. Once from the
// fields themselves and again as a block above the main content.
// Setting 'page' to TRUE gets rid of the title in the fields and
// leaves the block. This makes it look uniform with the 'default'
// view mode.
if (node_is_page($variables['elements']['#node'])) {
$variables['page'] = TRUE;
}
}
/**
* Implements hook_form_alter().
*/
function islandora_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$media_add_forms = ['media_audio_add_form', 'media_document_add_form',
'media_extracted_text_add_form', 'media_file_add_form', 'media_image_add_form',
'media_fits_technical_metadata_add_form', 'media_video_add_form',
];
if (in_array($form['#form_id'], $media_add_forms)) {
$params = \Drupal::request()->query->all();
if (isset($params['edit'])) {
$media_of_nid = $params['edit']['field_media_of']['widget'][0]['target_id'];
$node = \Drupal::entityTypeManager()->getStorage('node')->load($media_of_nid);
if ($node) {
$form['name']['widget'][0]['value']['#default_value'] = $node->getTitle();
}
$form['actions']['submit']['#submit'][] = 'islandora_media_custom_form_submit';
}
}
$form_object = $form_state->getFormObject();
$utils = \Drupal::service('islandora.utils');
$config = \Drupal::config('islandora.settings')->get('delete_media_and_files');
if ($config == 1 && $form_object instanceof EntityForm) {
$entity = $form_object->getEntity();
if ($entity->getEntityTypeId() == "node" && $utils->isIslandoraType($entity->getEntityTypeId(), $entity->bundle()) && strpos($form['#form_id'], 'delete_form') !== FALSE) {
$medias = $utils->getMedia($form_state->getFormObject()->getEntity());
if (count($medias) != 0) {
$form['delete_associated_content'] = [
'#type' => 'checkbox',
'#title' => t('Delete all associated medias and nodes'),
];
$media_list = [];
foreach ($medias as $media) {
$media_list[] = $media->getName();
}
$form['container'] = [
'#type' => 'container',
'#states' => [
'visible' => [
':input[name="delete_associated_content"]' => ['checked' => TRUE],
],
],
];
$form['container']['media_items'] = [
'#theme' => 'item_list',
'#type' => 'ul',
'#items' => $media_list,
'#attributes' => ['class' => ['islandora-media-items']],
'#wrapper_attributes' => ['class' => ['container']],
'#attached' => [
'library' => [
'islandora/islandora',
],
],
];
$form['actions']['submit']['#submit'][] = 'islandora_object_delete_form_submit';
return $form;
}
}
}
return $form;
}
/**
* Redirect submit handler for media save.
*/
function islandora_media_custom_form_submit(&$form, FormStateInterface $form_state) {
// Check configuration to see whether a redirect is desired.
$redirect = \Drupal::config('islandora.settings')->get('redirect_after_media_save');
if ($redirect) {
$params = \Drupal::request()->query->all();
if (!empty($params)) {
$target_id = $params['edit']['field_media_of']['widget'][0]['target_id'];
$url = Url::fromRoute('view.media_of.page_1', ['node' => $target_id]);
$form_state->setRedirectUrl($url);
}
}
}
/**
* Implements a submit handler for the delete form.
*/
function islandora_object_delete_form_submit($form, FormStateInterface $form_state) {
$result = $form_state->getValues('delete_associated_content');
$utils = \Drupal::service('islandora.utils');
if ($result['delete_associated_content'] == 1) {
$node = $form_state->getFormObject()->getEntity();
$medias = $utils->getMedia($node);
$media_list = [];
$entity_field_manager = \Drupal::service('entity_field.manager');
$current_user = \Drupal::currentUser();
$logger = \Drupal::logger('logger.channel.islandora');
$messenger = \Drupal::messenger();
$delete_media = [];
$media_translations = [];
$media_files = [];
$entity_protected_medias = [];
$inaccessible_entities = [];
foreach ($medias as $id => $media) {
$lang = $media->language()->getId();
$selected_langcodes[$lang] = $lang;
if (!$media->access('delete', $current_user)) {
$inaccessible_entities[] = $media;
continue;
}
// Check for files.
$fields = $entity_field_manager->getFieldDefinitions('media', $media->bundle());
foreach ($fields as $field) {
$type = $field->getType();
if ($type == 'file' || $type == 'image') {
$target_id = $media->get($field->getName())->target_id;
$file = File::load($target_id);
if ($file) {
if (!$file->access('delete', $current_user)) {
$inaccessible_entities[] = $file;
continue;
}
$media_files[$id][$file->id()] = $file;
}
}
}
foreach ($selected_langcodes as $langcode) {
// We're only working with media, which are translatable.
$entity = $media->getTranslation($langcode);
if ($entity->isDefaultTranslation()) {
$delete_media[$id] = $entity;
unset($media_translations[$id]);
}
elseif (!isset($delete_media[$id])) {
$media_translations[$id][] = $entity;
}
}
}
if ($delete_media) {
foreach ($delete_media as $id => $media) {
try {
$media->delete();
$media_list[] = $id;
$logger->notice('The media %label has been deleted.', [
'%label' => $media->label(),
]);
}
catch (Exception $e) {
$entity_protected_medias[] = $id;
}
}
}
$delete_files = array_filter($media_files, function ($media) use ($entity_protected_medias) {
return !in_array($media, $entity_protected_medias);
}, ARRAY_FILTER_USE_KEY);
if ($delete_files) {
foreach ($delete_files as $files_array) {
foreach ($files_array as $file) {
$file->delete();
$logger->notice('The file %label has been deleted.', [
'%label' => $file->label(),
]);
}
}
}
$delete_media_translations = array_filter($media_translations, function ($media) use ($entity_protected_medias) {
return !in_array($media, $entity_protected_medias);
}, ARRAY_FILTER_USE_KEY);
if ($delete_media_translations) {
foreach ($delete_media_translations as $id => $translations) {
$media = $medias[$id];
foreach ($translations as $translation) {
$media->removeTranslation($translation->language()->getId());
}
$media->save();
foreach ($translations as $translation) {
$logger->notice('The media %label @language translation has been deleted', [
'%label' => $media->label(),
'@language' => $translation->language()->getName(),
]);
}
}
}
if ($inaccessible_entities) {
$messenger->addWarning("@count items have not been deleted because you do not have the necessary permissions.", [
'@count' => count($inaccessible_entities),
]);
}
$build = [
'heading' => [
'#type' => 'html_tag',
'#tag' => 'div',
'#value' => t("The repository item @node and @media", [
'@node' => $node->getTitle(),
'@media' => \Drupal::translation()->formatPlural(
count($media_list), 'the media with the id @media has been deleted.',
'the medias with the ids @media have been deleted.',
['@media' => implode(", ", $media_list)],
),
]),
],
];
$message = \Drupal::service('renderer')->renderPlain($build);
$messenger->deleteByType('status');
$messenger->addStatus($message);
}
}
/**
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter().
*/
function islandora_field_widget_single_element_image_image_form_alter(&$element, $form_state, $context) {
$element['#process'][] = 'islandora_add_default_image_alt_text';
}
/**
* Callback for hook_field_widget_single_element_WIDGET_TYPE_form_alter().
*/
function islandora_add_default_image_alt_text($element, $form_state, $form) {
if ($element['alt']['#access']) {
$params = \Drupal::request()->query->all();
if (isset($params['edit'])) {
$media_of_nid = $params['edit']['field_media_of']['widget'][0]['target_id'];
$node = \Drupal::entityTypeManager()->getStorage('node')->load($media_of_nid);
if ($node) {
$element['alt']['#default_value'] = $node->getTitle();
}
}
}
return $element;
}
/**
* Implements hook_entity_form_display_alter().
*/
function islandora_entity_form_display_alter(&$form_display, $context) {
// Change the form display based on user input from a 'form_display_alter'
// ContextReaction.
$storage = \Drupal::service('entity_type.manager')->getStorage('entity_form_display');
$context_manager = \Drupal::service('context.manager');
// Alter form display based on context.
foreach ($context_manager->getActiveReactions('\Drupal\islandora\Plugin\ContextReaction\FormDisplayAlterReaction') as $reaction) {
// Construct the new form display's machine name.
$entity_type = $context['entity_type'];
$bundle = $context['bundle'];
$mode = $reaction->execute();
$machine_name = "$entity_type.$bundle.$mode";
// Try to load it.
$new_display = $storage->load($machine_name);
// If successful, alter the form display.
if ($new_display) {
$form_display = $new_display;
}
else {
// Otherwise, leave it be, but log a message.
\Drupal::logger('islandora')->info("EntityFormDisplay $machine_name does not exist. Form display cannot be altered.");
}
}
}
/**
* Implements hook_form_form_id_alter().
*/
function islandora_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// Unset our custom conditions. There's too many to use well within
// the core block placement UI, and no other reasonable way to filter
// them out. See https://www.drupal.org/node/2284687. Use
// /admin/structure/context instead if you want to use these conditions
// to alter block layout.
unset($form['visibility']['content_entity_type']);
unset($form['visibility']['file_uses_filesystem']);
unset($form['visibility']['media_has_mimetype']);
unset($form['visibility']['media_has_term']);
unset($form['visibility']['media_is_islandora_media']);
unset($form['visibility']['media_uses_filesystem']);
unset($form['visibility']['node_had_namespace']);
unset($form['visibility']['node_has_ancestor']);
unset($form['visibility']['node_has_parent']);
unset($form['visibility']['node_has_term']);
unset($form['visibility']['node_is_islandora_object']);
unset($form['visibility']['node_referenced_by_node']);
unset($form['visibility']['parent_node_has_term']);
}
/**
* Implements hook_entity_extra_field_info().
*/
function islandora_entity_extra_field_info() {
$config_factory = \Drupal::service('config.factory')->get(IslandoraSettingsForm::CONFIG_NAME);
$extra_field = [];
$pseudo_bundles = $config_factory->get(IslandoraSettingsForm::GEMINI_PSEUDO);
if (!empty($pseudo_bundles)) {
foreach ($pseudo_bundles as $key) {
[$bundle, $content_entity] = explode(":", $key);
$extra_field[$content_entity][$bundle]['display'][IslandoraSettingsForm::GEMINI_PSEUDO_FIELD] = [
'label' => t('Fedora URI'),
'description' => t('The URI to the persistent'),
'weight' => 100,
'visible' => TRUE,
];
}
}
return $extra_field;
}
/**
* Implements hook_entity_view().
*/
function islandora_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
$route_match_item = \Drupal::routeMatch()->getParameters()->get($entity->getEntityTypeId());
// Ensure the entity matches the route.
if ($entity === $route_match_item) {
if ($display->getComponent('field_gemini_uri')) {
$mapper = \Drupal::service('islandora.entity_mapper');
$flysystem_config = Settings::get('flysystem');
$fedora_root = $flysystem_config['fedora']['config']['root'];
$fedora_root = rtrim($fedora_root, '/');
if ($entity->getEntityTypeId() == 'media') {
// Check if the source file is in Fedora or not.
$media_source_service = \Drupal::service('islandora.media_source_service');
$source_file = $media_source_service->getSourceFile($entity);
if (!$source_file) {
\Drupal::logger('islandora')->error(
\Drupal::service('string_translation')->translate(
"Can't get source file for @label (@id)", [
'@label' => $entity->label(),
"@id" => $entity->id(),
]
)
);
return;
}
$uri = $source_file->getFileUri();
$scheme = \Drupal::service('stream_wrapper_manager')->getScheme($uri);
$flysystem_config = Settings::get('flysystem');
// Use the file's path if it's in fedora.
// Otherwise do the UUID -> pair tree thang.
if (isset($flysystem_config[$scheme]) && $flysystem_config[$scheme]['driver'] == 'fedora') {
$parts = parse_url($uri);
$path = $parts['host'] . $parts['path'];
}
else {
$path = $mapper->getFedoraPath($source_file->uuid());
}
$path = trim($path, '/');
$fedora_uri = "$fedora_root/$path/fcr:metadata";
}
else {
// All non-media entities do the UUID -> pair tree thang.
$path = $mapper->getFedoraPath($entity->uuid());
$path = trim($path, '/');
$fedora_uri = "$fedora_root/$path";
}
// Stuff the fedora url into the pseudo field.
$build['field_gemini_uri'] = [
'#type' => 'container',
'#attributes' => [
'id' => 'field-gemini-uri',
],
'internal_label' => [
'#type' => 'item',
'#title' => t('Fedora URI'),
'internal_uri' => [
'#type' => 'link',
'#title' => t("@url", ['@url' => $fedora_uri]),
'#url' => Url::fromUri($fedora_uri),
],
],
];
}
}
}
/**
* Implements hook_preprocess_views_view_table().
*
* Used for the integer-weight drag-n-drop. Taken almost
* verbatim from the weight module.
*/
function islandora_preprocess_views_view_table(&$variables) {
// Check for a weight selector field.
foreach ($variables['view']->field as $field_key => $field) {
if ($field->getPluginId() == 'integer_weight_selector') {
// Check if the weight selector is on the first column.
$is_first_column = array_search($field_key, array_keys($variables['view']->field)) > 0 ? FALSE : TRUE;
// Add the tabledrag attributes.
foreach ($variables['rows'] as $key => $row) {
if ($is_first_column) {
// If the weight selector is the first column move it to the last
// column, in order to make the draggable widget appear.
$weight_selector = $variables['rows'][$key]['columns'][$field->field];
unset($variables['rows'][$key]['columns'][$field->field]);
$variables['rows'][$key]['columns'][$field->field] = $weight_selector;
}
// Add draggable attribute.
$variables['rows'][$key]['attributes']->addClass('draggable');
}
// The row key identify in an unique way a view grouped by a field.
// Without row number, all the groups will share the same table_id
// and just the first table can be draggable.
$table_id = 'weight-table-' . $variables['view']->dom_id . '-row-' . $key;
$variables['attributes']['id'] = $table_id;
$options = [
'table_id' => $table_id,
'action' => 'order',
'relationship' => 'sibling',
'group' => 'weight-selector',
];
drupal_attach_tabledrag($variables, $options);
}
}
}

12
islandora.permissions.yml

@ -1,12 +0,0 @@
view checksums:
title: 'View Checksums'
description: 'Allows access to viewing file checksums'
manage members:
title: 'Manage Members'
description: 'Allows access to managing members for content'
manage media:
title: 'Manage Media'
description: 'Allows access to managing media for content'

16
islandora.post_update.php

@ -1,16 +0,0 @@
<?php
/**
* @file
* Post updates.
*/
/**
* Set default value for delete_media_and_files field in settings.
*/
function islandora_post_update_delete_media_and_files() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('islandora.settings');
$config->set('delete_media_and_files', TRUE);
$config->save(TRUE);
}

111
islandora.routing.yml

@ -1,111 +0,0 @@
# Menu list of Islandora configuration forms
system.admin_config_islandora:
path: '/admin/config/islandora'
defaults:
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
_title: 'Islandora'
requirements:
_permission: 'access administration pages'
# Core Islandora configuration form
system.islandora_settings:
path: '/admin/config/islandora/core'
defaults:
_form: '\Drupal\islandora\Form\IslandoraSettingsForm'
_title: 'Islandora Settings'
requirements:
_permission: 'administer site configuration'
# RDF properties report
system.islandora_rdf_mappings:
path: '/admin/reports/islandora/rdf_mappings'
defaults:
_controller: '\Drupal\islandora\Controller\RdfMappingsReportController::main'
_title: 'Field and term RDF mappings'
requirements:
_permission: 'administer site configuration'
islandora.add_member_to_node_page:
path: '/node/{node}/members/add'
defaults:
_controller: '\Drupal\islandora\Controller\ManageMembersController::addToNodePage'
_title_callback: '\Drupal\islandora\Controller\ManageMembersController::addTitle'
entity_type_id: node
options:
_admin_route: 'true'
requirements:
_entity_create_any_access: 'node'
islandora.upload_children:
path: '/node/{node}/members/upload/{step}'
defaults:
_wizard: '\Drupal\islandora\Form\AddChildrenWizard\ChildForm'
_title: 'Upload Children'
step: 'type_selection'
options:
_admin_route: 'TRUE'
requirements:
_custom_access: '\Drupal\islandora\Form\AddChildrenWizard\Access::childAccess'
islandora.add_media_to_node_page:
path: '/node/{node}/media/add'
defaults:
_controller: '\Drupal\islandora\Controller\ManageMediaController::addToNodePage'
_title_callback: '\Drupal\islandora\Controller\ManageMediaController::addTitle'
entity_type_id: media
options:
_admin_route: 'true'
requirements:
_entity_create_any_access: 'media'
islandora.upload_media:
path: '/node/{node}/media/upload/{step}'
defaults:
_wizard: '\Drupal\islandora\Form\AddChildrenWizard\MediaForm'
_title: 'Add media'
step: 'type_selection'
options:
_admin_route: 'TRUE'
requirements:
_custom_access: '\Drupal\islandora\Form\AddChildrenWizard\Access::mediaAccess'
islandora.media_source_update:
path: '/media/{media}/source'
defaults:
_controller: '\Drupal\islandora\Controller\MediaSourceController::put'
methods: [PUT]
requirements:
_permission: 'update media'
options:
_auth: ['basic_auth', 'cookie', 'jwt_auth']
islandora.media_source_put_to_node:
path: '/node/{node}/media/{media_type}/{taxonomy_term}'
defaults:
_controller: '\Drupal\islandora\Controller\MediaSourceController::putToNode'
methods: [PUT]
requirements:
_custom_access: '\Drupal\islandora\Controller\MediaSourceController::putToNodeAccess'
options:
_auth: ['basic_auth', 'cookie', 'jwt_auth']
islandora.attach_file_to_media:
path: '/media/add_derivative/{media}/{destination_field}'
defaults:
_controller: '\Drupal\islandora\Controller\MediaSourceController::attachToMedia'
methods: [GET, PUT]
requirements:
_custom_access: '\Drupal\islandora\Controller\MediaSourceController::attachToMediaAccess'
options:
_auth: ['basic_auth', 'cookie', 'jwt_auth']
no_cache: 'TRUE'
parameters:
media:
type: entity:media
islandora.confirm_delete_media_and_file:
path: '/media/delete_with_files'
defaults:
_form: 'Drupal\islandora\Form\ConfirmDeleteMediaAndFile'
requirements:
_permission: 'administer media+delete any media'

80
islandora.services.yml

@ -1,80 +0,0 @@
# Islandora Services
# islandora.services.yml:
services:
islandora.eventgenerator:
class: Drupal\islandora\EventGenerator\EventGenerator
arguments: ['@islandora.utils', '@islandora.media_source_service']
islandora.stomp:
class: Stomp\StatefulStomp
factory: ['Drupal\islandora\StompFactory', create]
arguments: ['@config.factory']
islandora.jwt-subscriber:
class: Drupal\islandora\EventSubscriber\JwtEventSubscriber
factory: ['Drupal\islandora\EventSubscriber\JwtEventSubscriber', create]
arguments: ['@entity_type.manager', '@current_user']
tags:
- { name: event_subscriber }
islandora.media_link_header_subscriber:
class: Drupal\islandora\EventSubscriber\MediaLinkHeaderSubscriber
arguments: ['@entity_type.manager', '@entity_field.manager', '@access_manager', '@current_user', '@current_route_match', '@request_stack', '@islandora.utils']
tags:
- { name: event_subscriber }
islandora.node_link_header_subscriber:
class: Drupal\islandora\EventSubscriber\NodeLinkHeaderSubscriber
arguments: ['@entity_type.manager', '@entity_field.manager', '@access_manager', '@current_user', '@current_route_match', '@request_stack', '@islandora.utils']
tags:
- { name: event_subscriber }
islandora.admin_view_route_subscriber:
class: Drupal\islandora\EventSubscriber\AdminViewsRouteSubscriber
tags:
- { name: event_subscriber }
logger.channel.islandora:
parent: logger.channel_base
arguments: ['islandora']
logger.channel.fedora_flysystem:
parent: logger.channel_base
arguments: ['fedora_flysystem']
islandora.media_route_context_provider:
class: Drupal\islandora\ContextProvider\MediaRouteContextProvider
arguments: ['@current_route_match']
tags:
- { name: 'context_provider' }
islandora.file_route_context_provider:
class: Drupal\islandora\ContextProvider\FileRouteContextProvider
arguments: ['@current_route_match']
tags:
- { name: 'context_provider' }
islandora.taxonomy_term_route_context_provider:
class: Drupal\islandora\ContextProvider\TermRouteContextProvider
arguments: ['@current_route_match']
tags:
- { name: 'context_provider' }
islandora.media_source_service:
class: Drupal\islandora\MediaSource\MediaSourceService
arguments: ['@entity_type.manager', '@current_user', '@language_manager', '@file_system', '@islandora.utils']
islandora.utils:
class: Drupal\islandora\IslandoraUtils
arguments: ['@entity_type.manager', '@entity_field.manager', '@context.manager', '@flysystem_factory', '@language_manager']
islandora.entity_mapper:
class: Islandora\EntityMapper\EntityMapper
islandora.stomp.auth_header_listener:
class: Drupal\islandora\EventSubscriber\StompHeaderEventSubscriber
arguments: ['@jwt.authentication.jwt']
tags:
- { name: event_subscriber }
islandora.upload_children.batch_processor:
class: Drupal\islandora\Form\AddChildrenWizard\ChildBatchProcessor
arguments:
- '@entity_type.manager'
- '@database'
- '@current_user'
- '@messenger'
- '@date.formatter'
islandora.upload_media.batch_processor:
class: Drupal\islandora\Form\AddChildrenWizard\MediaBatchProcessor
arguments:
- '@entity_type.manager'
- '@database'
- '@current_user'
- '@messenger'
- '@date.formatter'

192
islandora.tokens.inc

@ -1,192 +0,0 @@
<?php
/**
* @file
* Contains islandora.tokens.inc.
*
* This file provides islandora tokens.
*/
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\media\Entity\Media;
use Drupal\file\Entity\File;
/**
* Implements hook_token_info().
*/
function islandora_token_info() {
$type = [
'name' => t('Islandora Tokens'),
'description' => t('Tokens for Islandora objects.'),
];
$node['media-original-file:filename'] = [
'name' => t('Media: Original File filename without extension.'),
'description' => t('File name without extension of original uploaded file associated with Islandora Object via Media.'),
];
$node['media-original-file:basename'] = [
'name' => t('Media: Original File filename with extension.'),
'description' => t('File name with extension of original uploaded file associated with Islandora Object via Media.'),
];
$node['media-original-file:extension'] = [
'name' => t('Media: Original File extension.'),
'description' => t('File extension of original uploaded file associated with Islandora Object via Media.'),
];
$node['media-thumbnail-image:url'] = [
'name' => t('Media: Thumbnail Image URL.'),
'description' => t('URL of Thumbnail Image associated with Islandora Object via Media.'),
];
$node['media-thumbnail-image:alt'] = [
'name' => t('Alternative text for Media: Thumbnail Image.'),
'description' => t('Alternative text for Thumbnail Image associated with Islandora Object via Media.'),
];
// Deprecated in favour if hyphenated version.
$node['media_thumbnail_image:url'] = [
'name' => t('Media: Thumbnail Image URL.'),
'description' => t('Deprecated: URL of Thumbnail Image associated with Islandora Object via Media.'),
];
// Deprecated in favour if hyphenated version.
$node['media_thumbnail_image:alt'] = [
'name' => t('Alternative text for Media: Thumbnail Image.'),
'description' => t('Deprecated: Alternative text for Thumbnail Image associated with Islandora Object via Media.'),
];
$node['pdf_url'] = [
'name' => t("PDF Url"),
'description' => t('URL to related media file if "Original file" is a PDF file'),
];
return [
'types' => ['islandoratokens' => $type],
'tokens' => ['islandoratokens' => $node],
];
}
/**
* Implements hook_tokens().
*/
function islandora_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$replacements = [];
if ($type == 'islandoratokens' && !empty($data['node'])) {
if (!is_array($tokens) || empty($tokens)) {
\Drupal::logger('islandora')
->alert(
'Tokens not correct format: @tokens', [
'@tokens' => print_r($tokens, 1),
]
);
return;
}
$islandoraUtils = \Drupal::service('islandora.utils');
foreach ($tokens as $name => $original) {
switch ($name) {
case 'media-original-file:basename':
case 'media-original-file:filename':
case 'media-original-file:extension':
$term = $islandoraUtils->getTermForUri('http://pcdm.org/use#OriginalFile');
$media = $islandoraUtils->getMediaWithTerm($data['node'], $term);
// Is there media?
if ($media) {
$file = \Drupal::service('islandora.media_source_service')->getSourceFile($media);
if (!empty($file)) {
$path_info = pathinfo($file->createFileUrl());
$key = explode(':', $name)[1];
if (array_key_exists($key, $path_info)) {
$replacements[$original] = $path_info[$key];
}
}
}
break;
case 'media-thumbnail-image:url':
case 'media_thumbnail_image:url':
$term = $islandoraUtils->getTermForUri('http://pcdm.org/use#ThumbnailImage');
$media = $islandoraUtils->getMediaWithTerm($data['node'], $term);
// Is there media?
// @todo is this single or multiple?
if ($media) {
$file = \Drupal::service('islandora.media_source_service')->getSourceFile($media);
if (!empty($file)) {
$url = $file->createFileUrl();
$replacements[$original] = $url;
}
}
break;
case 'media-thumbnail-image:alt':
case 'media_thumbnail_image:alt':
$alt = '';
$term = $islandoraUtils->getTermForUri('http://pcdm.org/use#ThumbnailImage');
$media = $islandoraUtils->getMediaWithTerm($data['node'], $term);
// Is there media?
// @todo is this single or multiple?
if ($media) {
// Is the media an image?
if (isset($media->field_media_image)) {
$alt = $media->field_media_image[0]->alt;
}
}
// @todo get alt from original or service file, if thumbnail
// alt is empty.
$replacements[$original] = $alt;
break;
case 'pdf_url':
$replacements[$original] = islandora_url_to_service_file_media_by_mimetype($data['node'], 'application/pdf');
break;
}
}
}
return $replacements;
}
/**
* Gets Original File PDF file URL.
*
* @param object $node
* A core drupal node object.
* @param string $mime_type
* The name of the node's field to check for the specific relationship.
*
* @return string
* The tokenized value for the given data.
*/
function islandora_url_to_service_file_media_by_mimetype($node, $mime_type) {
$islandora_utils = \Drupal::service('islandora.utils');
$origfile_term = $islandora_utils->getTermForUri('http://pcdm.org/use#OriginalFile');
$origfile_media = $islandora_utils->getMediaWithTerm($node, $origfile_term);
// Get the media file's mime_type value.
if (is_object($origfile_media)) {
$origfile_mime_type = ($origfile_media->hasField('field_mime_type')) ?
$origfile_media->get('field_mime_type')->getValue() : NULL;
$origfile_mime_type = (is_array($origfile_mime_type) &&
array_key_exists(0, $origfile_mime_type) &&
is_array($origfile_mime_type[0]) &&
array_key_exists('value', $origfile_mime_type[0])) ?
$origfile_mime_type[0]['value'] : '';
// Compare the media file's mime_type to the given value.
if ($origfile_mime_type == $mime_type) {
$vid = $origfile_media->id();
if (!is_null($vid)) {
$media = Media::load($vid);
$bundle = $media->bundle();
// Since this is Islandora and we assume the Original File is a
// Document type... but doing it dynamically.
$fid = $media->get('field_media_' . $bundle)->getValue();
$fid_value = (is_array($fid) && array_key_exists(0, $fid) &&
array_key_exists('target_id', $fid[0])) ?
$fid[0]['target_id'] : NULL;
if (!is_null($fid_value)) {
$file = File::load($fid_value);
if ($file) {
$url = $islandora_utils->getDownloadUrl($file);
return $url;
}
}
}
}
}
return '';
}

54
islandora.views.inc

@ -1,54 +0,0 @@
<?php
/**
* @file
* Provide Views data for integer-weight fields.
*/
/**
* Implements hook_views_data_alter().
*/
function islandora_views_data_alter(&$data) {
// For now only support Nodes and Media.
foreach (['node', 'media'] as $entity_type) {
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions($entity_type);
foreach ($fields as $field => $field_storage_definition) {
if ($field_storage_definition->getType() == 'integer' && strpos($field, "field_") === 0) {
$prefixed_field = $entity_type . '__' . $field;
if (isset($data[$prefixed_field])) {
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field'];
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [
'@field' => $field,
]);
$data[$prefixed_field][$field]['help'] = t('Provides a drag-n-drop reordering of integer-based weight fields.');
$data[$prefixed_field][$field]['title short'] = t('Integer weight selector');
$data[$prefixed_field][$field]['field']['id'] = 'integer_weight_selector';
}
}
}
}
// Add Has Media filter.
$data['node_field_data']['islandora_has_media'] = [
'title' => t('Node has Media Use'),
'group' => t('Content'),
'filter' => [
'title' => t('Node has media use filter'),
'help' => t('Provides a custom filter for nodes that do or do not have media with a given use.'),
'field' => 'nid',
'id' => 'islandora_node_has_media_use',
],
];
// Add Is Islandora filter.
$data['node_field_data']['islandora_node_is_islandora'] = [
'title' => t('Node is Islandora'),
'group' => t('Content'),
'filter' => [
'title' => t('Node is Islandora'),
'help' => t('Node has a content type that possesses the mandatory Islandora fields.'),
'field' => 'nid',
'id' => 'islandora_node_is_islandora',
],
];
}

674
islandora/LICENSE.txt

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

20
islandora/README.md

@ -0,0 +1,20 @@
# Islandora [![Build Status](https://travis-ci.org/Islandora-Labs/islandora.png?branch=7.x-2.x)](https://travis-ci.org/Islandora-Labs/islandora)
## Introduction
Islandora Fedora 4 Repository Module
## Maintainers/Sponsors
Current maintainers:
* [Nick Ruest](https://github.com/ruebot)
* [Daniel Lamb](https://github.com/dannylamb/)
## Development
If you would like to contribute to this module, please check out our helpful [Documentation for Developers](https://github.com/Islandora/islandora/wiki#wiki-documentation-for-developers) info, as well as our [Developers](http://islandora.ca/developers) section on the Islandora.ca site.
## License
[GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt)

105
islandora/build.xml

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="islandora" default="build">
<target name="build" depends="clean,prepare,php-eval,lint,phploc,code_sniff,phpcpd,pdepend,doxygen,phpcb,test,cc-process,cc-export" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/test" />
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/api" />
<delete dir="${basedir}/build/code-browser" />
<delete dir="${basedir}/build/code_coverage" />
</target>
<target name="prepare" description="Prepares workspace for artifacts" >
<mkdir dir="${basedir}/build/test" />
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/pdepend" />
<mkdir dir="${basedir}/build/api" />
<mkdir dir="${basedir}/build/code-browser" />
<mkdir dir="${basedir}/build/code_coverage" />
</target>
<target name="php-eval" description="Use php-eval to set the code_coverage_filter_files variable">
<exec executable="drush">
<arg line="php-eval &quot;variable_set('code_coverage_files', array('sites/all/modules/islandora/islandora.module')&quot;"/>
</exec>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}">
<include name="**/*.php" />
<include name="**/*.inc" />
<include name="**/*.module" />
<include name="**/*.install" />
<include name="**/*.test" />
<modified />
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg line="--log-csv ${basedir}/build/logs/phploc.csv --exclude build --exclude css --exclude images --exclude xml --names *.php,*.module,*.inc,*.test,*.install ${basedir}" />
</exec>
</target>
<target name="code_sniff" description="Checks the code for Drupal coding standard violations" >
<exec executable="phpcs">
<arg line="--standard=Drupal --report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --extensions=php,inc,test,module,install --ignore=build/,xml/,images/,css/ ${basedir}" />
</exec>
</target>
<target name="phpcpd" description="Copy/Paste code detection">
<exec executable="phpcpd">
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml --exclude build --exclude css --exclude images --exclude xml --names *.php,*.module,*.inc,*.test,*.install ${basedir}" />
</exec>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml --jdepend-chart=${basedir}/build/pdepend/dependencies.svg --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg ${basedir}"/>
</exec>
</target>
<target name="doxygen" description="Generate API documentation with doxygen" depends="prepare">
<exec executable="bash">
<arg line='-c "sed -i s/PROJECT_NUMBER\ \ \ \ \ \ \ \ \ =/PROJECT_NUMBER\ \ \ \ \ \ \ \ \ =\ `git log -1 --pretty=format:%h`/ build/Doxyfile"'/>
</exec>
<exec executable="doxygen">
<arg line="${basedir}/build/Doxyfile" />
</exec>
<exec executable="git">
<arg line="checkout ${basedir}/build/Doxyfile"/>
</exec>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg line="--log ${basedir}/build/logs --source ${basedir} --output ${basedir}/build/code-browser"/>
</exec>
</target>
<target name="test">
<exec executable="bash">
<arg line='-c "php ../../../../scripts/run-tests.sh --xml ${basedir}/build/test Islandora"' />
</exec>
</target>
<target name="cc-process" description="Processes the code coverage output so it can be exported">
<exec executable="drush">
<arg line="cc-process all"/>
</exec>
</target>
<target name="cc-export" description="Generate a code coverage report for the simpletest run">
<exec executable="drush">
<arg line="cc-export latest --html --csv --tag-html --generate-index --path=${basedir}/build/code_coverage"/>
</exec>
</target>
</project>

1627
islandora/build/Doxyfile

File diff suppressed because it is too large Load Diff

61
islandora/include/admin.form.inc

@ -0,0 +1,61 @@
<?php
/**
* @file
* Admin form.
*/
/**
* Form function for module config.
*
* @param array $form
* Drupal renderable array.
* @param array $form_state
* Drupal form state.
*
* @return array
* Final form to render.
*/
function islandora_config_form(array $form, array &$form_state) {
$form = array(
'islandora_stomp_url' => array(
'#type' => 'textfield',
'#title' => t('Stomp URL'),
'#default_value' => variable_get('islandora_stomp_url', 'tcp://localhost:61613'),
'#description' => t('URL to the Stomp broker for async messaging'),
'#element_validate' => array('islandora_config_form_validate_stomp_url'),
'#required' => TRUE,
),
'islandora_triplestore_index_queue' => array(
'#type' => 'textfield',
'#title' => t('Triplestore Index Queue'),
'#default_value' => variable_get('islandora_triplestore_index_queue', 'islandora/triplestore/index'),
'#description' => t('Queue to send triplestore indexing messages'),
'#required' => TRUE,
),
);
return system_settings_form($form);
}
/**
* Stomp broker url validator.
*
* @param array $element
* Form element for stomp broker url.
* @param array $form_state
* Drupal form state.
* @param array $form
* Drupal renderable array.
*/
function islandora_config_form_validate_stomp_url(array $element, array &$form_state, array $form) {
// Try to connect to the server.
try {
$url = $element['#value'];
$stomp = new Stomp($url);
unset($stomp);
}
catch (StompException $e) {
form_error($element, t('Connection failed for @url: @message', array('@url' => $url, '@message' => $e->getMessage())));
}
}

95
islandora/include/fields.inc

@ -0,0 +1,95 @@
<?php
/**
* @file
* Utility functions for working Islandora core fields.
*/
/**
* Adds all the core Islandora fields to a bundle.
*
* @param string $bundle_name
* The name of the bundle to give the fields.
*/
function islandora_add_fields_to_bundle($bundle_name) {
// Big list of field names/labels/descriptions.
$field_data = array(
ISLANDORA_TN_FIELD => array(
'label' => 'Thumbnail',
'description' => 'Thumbnail image',
),
ISLANDORA_FEDORA_PATH_FIELD => array(
'label' => 'Fedora Path',
'description' => 'Path to resource in Fedora 4',
),
ISLANDORA_FEDORA_HAS_PARENT_FIELD => array(
'label' => 'fedora:hasParent',
'description' => 'Parent resource in Fedora 4',
),
ISLANDORA_PCDM_HAS_MEMBER_FIELD => array(
'label' => 'pcdm:hasMember',
'description' => 'Child resources in Fedora 4',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
),
);
// Iterate over fields and add each to the specified bundle.
foreach ($field_data as $field_name => $data) {
$field_label = $data['label'];
$field_description = $data['description'];
islandora_add_field_to_bundle($bundle_name, $field_name, $field_label, $field_description);
}
}
/**
* Adds a field to a bundle.
*
* @param string $bundle_name
* The machine name of the bundle.
* @param string $field_name
* The machine name of the field.
* @param string $field_label
* The human-readable label for the field.
* @param string $field_description
* The human-readable description for the field.
*/
function islandora_add_field_to_bundle($bundle_name, $field_name, $field_label, $field_description) {
// If this gets called from an install hook, we can't guarantee the t's
// existance.
$t = get_t();
if (field_info_field($field_name)) {
$field_instance = array(
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => $bundle_name,
'label' => $t("@label", array("@label" => $field_label)),
'description' => $t("@description", array("@description" => $field_description)),
'required' => FALSE,
);
field_create_instance($field_instance);
$message = $t('Field @name was added to @bundle successfully',
array(
'@name' => $field_name,
'@bundle' => $bundle_name,
));
drupal_set_message($message);
}
}
/**
* Creates a field from a field definition.
*
* @param array $field_definition
* Field definition for the desired field.
*/
function islandora_create_field(array $field_definition) {
// If this gets called from an install hook, we can't guarantee the t's
// existance.
$t = get_t();
field_create_field($field_definition);
drupal_set_message($t("Created field @field",
array("@field" => $field_definition['field_name'])));
}

21
islandora/include/rdf.inc

@ -0,0 +1,21 @@
<?php
/**
* @file
* Utility functions for working with RDF.
*/
/**
* Serializes a Drupal node to N-Triples.
*
* @param object $node
* Node to serialize.
*
* @return string
* RDF serialized as N-Triples.
*/
function islandora_serialize_node_to_triples($node) {
$rdf_model = rdfx_get_rdf_model('node', $node);
$serializer = ARC2::getSer('NTriples', array('ns' => $rdf_model->ns));
return $serializer->getSerializedIndex($rdf_model->index);
}

50
islandora/include/rdf_mapping.inc

@ -0,0 +1,50 @@
<?php
/**
* @file
* RDF mapping utility functions.
*/
/**
* Returns the default mapping for Islandora content types.
*
* @param string $bundle
* The bundle to associate with the RDF mapping.
* @param array $rdf_types
* RDF types to apply on top of the Fedora defaults.
*
* @return array
* The default RDF mapping for Islandora content types.
*/
function islandora_get_default_rdf_mapping($bundle, array $rdf_types) {
$default_rdf_types = array(
'ldp:RDFSource',
'ldp:Container',
'fedora:Resource',
'fedora:Container',
);
$rdf_types = array_merge($default_rdf_types, $rdf_types);
return array(
array(
'type' => 'node',
'bundle' => $bundle,
'mapping' => array(
'rdftype' => $rdf_types,
'uuid' => array(
'predicates' => array('nfo:uuid'),
'datatype' => 'xsd:string',
),
ISLANDORA_FEDORA_HAS_PARENT_FIELD => array(
'predicates' => array('fedora:hasParent'),
'type' => 'rel',
),
ISLANDORA_PCDM_HAS_MEMBER_FIELD => array(
'predicates' => array('pcdm:hasMember'),
'type' => 'rel',
),
),
),
);
}

70
islandora/include/triplestore.inc

@ -0,0 +1,70 @@
<?php
/**
* @file
* Triplestore indexing functionality.
*/
/**
* Enqueues a triplestore upsert action.
*
* @param object $node
* Node to upsert in index.
*
* @return bool
* True if publishing the message was successful.
*/
function islandora_triplestore_upsert($node) {
return islandora_triplestore_enqueue_action($node, 'upsert');
}
/**
* Enqueues a triplestore delete action.
*
* @param object $node
* Node to delete from index.
*
* @return bool
* True if publishing the message was successful.
*/
function islandora_triplestore_delete($node) {
return islandora_triplestore_enqueue_action($node, 'delete');
}
/**
* Enqueues a triplestore index action.
*
* @param object $node
* Node to index.
* @param string $action
* Action to take. Either 'upsert' or 'delete' at the moment.
*
* @return bool
* True if publishing the message was successful.
*/
function islandora_triplestore_enqueue_action($node, $action) {
module_load_include('inc', 'islandora', 'include/rdf');
$broker_url = variable_get("islandora_stomp_url", "tcp://localhost:61613");
$queue = variable_get("islandora_triplestore_index_queue", "islandora/triplestore/index");
$msg = islandora_serialize_node_to_triples($node);
// Add enough headers to fool the FcrepoCamel code we're re-using to do this.
global $base_url;
$headers = array(
'action' => $action,
'Content-Type' => 'application/n-triples',
'CamelFcrepoBaseUrl' => $base_url,
'CamelFcrepoIdentifier' => "/node/{$node->nid}",
);
try {
$stomp = new Stomp($broker_url);
$stomp->send($queue, $msg, $headers);
unset($stomp);
return TRUE;
}
catch (StompException $e) {
watchdog('islandora', 'Error publishing triplestore index action to Stomp broker: @err', array('@err' => $e->getMessage()), WATCHDOG_ERROR);
return FALSE;
}
}

24
islandora/include/utils.inc

@ -0,0 +1,24 @@
<?php
/**
* @file
* Miscellaneous utility functions for the islandora module.
*/
/**
* Predicate to determine if we should ignore hooks that talk to Fedora.
*
* @return bool
* True if we shouldn't talk to Fedora (breaks the cycle).
*/
function islandora_ignore_hooks() {
$header_is_set = isset($_SERVER['HTTP_IGNORE_HOOKS']);
if (!$header_is_set) {
return FALSE;
}
$header_is_true = strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0;
return $header_is_true;
}

23
islandora/islandora.api.php

@ -0,0 +1,23 @@
<?php
/**
* @file
* Hooks provided by Islandora.
*/
/**
* Hook to collect pcdm:File to field mappings.
*
* @return array
* An associative array, where keys are the name of the field and the values
* are dc:identifier of the associated pcdm:File (e.g. DSID for those using
* the old vocabulary).
*/
function hook_pcdm_file_mapping() {
return array(
'field_mods' => array(
'id' => 'MODS',
'mimetype' => 'application/xml',
),
);
}

16
islandora/islandora.info

@ -0,0 +1,16 @@
name = Islandora
description = "View and manage Fedora 4 objects"
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = rest_server
dependencies[] = field_permissions
dependencies[] = field_readonly
dependencies[] = uuid_services
dependencies[] = views_ui
dependencies[] = rdfui
dependencies[] = xml_field
dependencies[] = xpath_field
dependencies[] = islandora_dc
dependencies[] = islandora_mods
dependencies[] = islandora_rdf_mapping_service

39
islandora/islandora.install

@ -0,0 +1,39 @@
<?php
/**
* @file
* This file contains all install related hooks.
*/
/**
* Implements hook_install().
*
* Defines common fields for various bundles.
*/
function islandora_install() {
module_load_include('inc', 'islandora', 'include/fields');
$fields = array(
array(
'field_name' => ISLANDORA_TN_FIELD,
'type' => 'image',
),
array(
'field_name' => ISLANDORA_FEDORA_PATH_FIELD,
'type' => 'text',
),
array(
'field_name' => ISLANDORA_FEDORA_HAS_PARENT_FIELD,
'type' => 'text',
),
array(
'field_name' => ISLANDORA_PCDM_HAS_MEMBER_FIELD,
'type' => 'text',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
),
);
foreach ($fields as $field) {
islandora_create_field($field);
}
}

263
islandora/islandora.module

@ -0,0 +1,263 @@
<?php
/**
* @file
* This is the new Islandora module. We need a better doc comment here.
*/
define('ISLANDORA_NAMESPACE', 'http://islandora.ca/ontology/v2/');
define('ISLANDORA_NAMESPACE_PREFIX', 'islandora');
define('ISLANDORA_RDF_NAMESPACE', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
define('ISLANDORA_RDF_NAMESPACE_PREFIX', 'rdf');
define('ISLANDORA_FEDORA_NAMESPACE', 'http://fedora.info/definitions/v4/repository#');
define('ISLANDORA_FEDORA_NAMESPACE_PREFIX', 'fedora');
define('ISLANDORA_PCDM_NAMESPACE', 'http://pcdm.org/models#');
define('ISLANDORA_PCDM_NAMESPACE_PREFIX', 'pcdm');
define('ISLANDORA_NFO_NAMESPACE', 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/v1.2/');
define('ISLANDORA_NFO_NAMESPACE_PREFIX', 'nfo');
define('ISLANDORA_LDP_NAMESPACE', 'http://www.w3.org/ns/ldp#');
define('ISLANDORA_LDP_NAMESPACE_PREFIX', 'ldp');
define('ISLANDORA_MIX_NAMESPACE', 'http://www.jcp.org/jcr/mix/1.0');
define('ISLANDORA_MIX_NAMESPACE_PREFIX', 'mix');
define('ISLANDORA_NT_NAMESPACE', 'http://www.jcp.org/jcr/nt/1.0');
define('ISLANDORA_NT_NAMESPACE_PREFIX', 'nt');
define('ISLANDORA_PCDM_COLLECTION_RDF_TYPE', 'pcdm:Collection');
define('ISLANDORA_PCDM_OBJECT_RDF_TYPE', 'pcdm:Object');
define('ISLANDORA_TN_FIELD', 'field_tn');
define('ISLANDORA_FEDORA_PATH_FIELD', 'field_fedora_path');
define('ISLANDORA_FEDORA_HAS_PARENT_FIELD', 'field_fedora_has_parent');
define('ISLANDORA_PCDM_HAS_MEMBER_FIELD', 'field_pcdm_has_member');
/**
* Implements hook_menu().
*/
function islandora_menu() {
$items = array(
'admin/islandora/config' => array(
'title' => 'Islandora',
'description' => 'Configure settings for Islandora',
'page callback' => 'drupal_get_form',
'page arguments' => array('islandora_config_form'),
'file' => '/include/admin.form.inc',
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
),
);
return $items;
}
/**
* Implements hook_ctools_plugin_api().
*/
function islandora_ctools_plugin_api($owner, $api) {
if ($owner == 'services' && $api == 'services') {
return array(
'version' => 3,
);
}
}
/**
* Implements hook_rdf_namespaces().
*/
function islandora_rdf_namespaces() {
return array(
ISLANDORA_NAMESPACE_PREFIX => ISLANDORA_NAMESPACE,
ISLANDORA_RDF_NAMESPACE_PREFIX => ISLANDORA_RDF_NAMESPACE,
ISLANDORA_FEDORA_NAMESPACE_PREFIX => ISLANDORA_FEDORA_NAMESPACE,
ISLANDORA_PCDM_NAMESPACE_PREFIX => ISLANDORA_PCDM_NAMESPACE,
ISLANDORA_NFO_NAMESPACE_PREFIX => ISLANDORA_NFO_NAMESPACE,
ISLANDORA_NT_NAMESPACE_PREFIX => ISLANDORA_NT_NAMESPACE,
ISLANDORA_MIX_NAMESPACE_PREFIX => ISLANDORA_MIX_NAMESPACE,
ISLANDORA_LDP_NAMESPACE_PREFIX => ISLANDORA_LDP_NAMESPACE,
);
}
/**
* Implements hook_entity_load().
*/
function islandora_entity_load($entities, $type) {
foreach ($entities as $entity) {
if (strcmp($type, "node") == 0) {
$entity->rdf_namespaces = rdf_get_namespaces();
$entity->pcdm_file_mapping = module_invoke_all("pcdm_file_mapping");
}
}
}
/**
* Implements hook_node_postinsert().
*/
function islandora_node_postinsert($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if the node never was successfully inserted in the database.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
module_load_include('inc', 'islandora', 'include/triplestore');
islandora_triplestore_upsert($node);
}
/**
* Implements hook_node_postupdate().
*/
function islandora_node_postupdate($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Unfortunately, there's no way to tell if the db transaction got rolled
// back in this hook, so we'll default to doing it anyway so as not to miss
// any updates. Open to suggestions on this one. But we gotta do post_action
// hooks otherwise things can get crazy if the db transaction hasn't closed.
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if something has gone wrong and there's no node info.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
module_load_include('inc', 'islandora', 'include/triplestore');
islandora_triplestore_upsert($node);
}
/**
* Implements hook_node_postdelete().
*/
function islandora_node_postdelete($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
module_load_include('inc', 'islandora', 'include/triplestore');
islandora_triplestore_delete($node);
}
/**
* Implements hook_default_services_endpoint().
*/
function islandora_default_services_endpoint() {
$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'islandora';
$endpoint->server = 'rest_server';
$endpoint->path = 'islandora';
$endpoint->authentication = array(
'services' => 'services',
);
$endpoint->server_settings = array(
'formatters' => array(
'json' => TRUE,
'bencode' => FALSE,
'jsonp' => FALSE,
'php' => FALSE,
'xml' => FALSE,
),
'parsers' => array(
'application/json' => TRUE,
'application/vnd.php.serialized' => FALSE,
'application/x-www-form-urlencoded' => FALSE,
'application/xml' => FALSE,
'multipart/form-data' => FALSE,
'text/xml' => FALSE,
),
);
$endpoint->resources = array(
'medium_size' => array(
'operations' => array(
'create' => array(
'enabled' => '1',
),
),
),
'node' => array(
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
'update' => array(
'enabled' => '1',
),
'delete' => array(
'enabled' => '1',
),
'index' => array(
'enabled' => '1',
),
),
'relationships' => array(
'files' => array(
'enabled' => '1',
),
'comments' => array(
'enabled' => '1',
),
),
'targeted_actions' => array(
'attach_file' => array(
'enabled' => '1',
),
),
),
'rdf_mapping' => array(
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
),
),
'system' => array(
'actions' => array(
'connect' => array(
'enabled' => '1',
),
),
),
'tn' => array(
'operations' => array(
'create' => array(
'enabled' => '1',
),
),
),
'user' => array(
'actions' => array(
'login' => array(
'enabled' => '1',
'settings' => array(
'services' => array(
'resource_api_version' => '1.0',
),
),
),
'logout' => array(
'enabled' => '1',
'settings' => array(
'services' => array(
'resource_api_version' => '1.0',
),
),
),
'token' => array(
'enabled' => '1',
),
),
),
);
$endpoint->debug = 0;
return array($endpoint);
}

14
islandora/tests/scripts/line_endings.sh

@ -0,0 +1,14 @@
#!/bin/bash
RETURN=0
FILES=`find -L $1 -name "*.info" -o -name "*.txt" -o -name "*.md"`
echo "Testing for files with DOS line endings..."
for FILE in $FILES
do
file $FILE | grep CRLF
if [ $? == 0 ]
then
RETURN=1
fi
done
exit $RETURN

58
islandora/tests/scripts/travis_setup.sh

@ -0,0 +1,58 @@
#!/bin/bash
mysql -u root -e 'create database drupal;'
mysql -u root -e "GRANT ALL PRIVILEGES ON drupal.* To 'drupal'@'localhost' IDENTIFIED BY 'drupal';"
# Java (Oracle)
sudo apt-get install -y software-properties-common
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get install -y oracle-java8-installer
sudo update-java-alternatives -s java-8-oracle
sudo apt-get install -y oracle-java8-set-default
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
cd $HOME
pear channel-discover pear.drush.org
pear upgrade --force Console_Getopt
pear upgrade --force pear
pear channel-discover pear.drush.org
wget http://alpha.library.yorku.ca/drush-6.3.tar.gz
tar xf drush-6.3.tar.gz
sudo mv drush-6.3 /opt/
sudo ln -s /opt/drush-6.3/drush /usr/bin/drush
wget http://alpha.library.yorku.ca/PHP_CodeSniffer-1.5.6.tgz
pear install PHP_CodeSniffer-1.5.6.tgz
wget http://alpha.library.yorku.ca/phpcpd.phar
sudo mv phpcpd.phar /usr/local/bin/phpcpd
sudo chmod +x /usr/local/bin/phpcpd
phpenv rehash
drush dl --yes drupal
cd drupal-*
drush si minimal --db-url=mysql://drupal:drupal@localhost/drupal --yes
drush runserver --php-cgi=$HOME/.phpenv/shims/php-cgi localhost:8081 &>/tmp/drush_webserver.log &
ln -s $ISLANDORA_DIR sites/all/modules/islandora
drush dl --yes coder-7.x-2.4
drush dl --yes potx-7.x-1.0
drush en --yes coder_review
drush en --yes simpletest
drush en --yes potx
drush dl --user=1 services
drush en --user=1 --yes rest_server
drush en --user=1 --yes islandora
drush en --user=1 --yes islandora_apachesolr
drush en --user=1 --yes islandora_basic_image
drush en --user=1 --yes islandora_collection
drush en --user=1 --yes islandora_dc
drush en --user=1 --yes islandora_mods
drush en --user=1 --yes islandora_rdf_mapping_service
drush cc all
# The shebang in this file is a bogeyman that is haunting the web test cases.
rm /home/travis/.phpenv/rbenv.d/exec/hhvm-switcher.bash
sleep 20

6
islandora_apachesolr/islandora_apachesolr.info

@ -0,0 +1,6 @@
name = Islandora Apache Solr Integration
description = A module which allows the Solr indexing and searching of Islandora resources.
core = 7.x
package = Islandora
dependencies[] = apachesolr
dependencies[] = uuid

14
islandora_apachesolr/islandora_apachesolr.module

@ -0,0 +1,14 @@
<?php
/**
* @file
* Islandora Apache Solr integration.
*/
/**
* Implements hook_apachesolr_index_documents_alter().
*/
function islandora_apachesolr_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
if ($entity_type == 'node' && count($documents) > 0 && isset($entity->uuid)) {
$documents[0]->ss_uuid = $entity->uuid;
}
}

6
islandora_basic_image/islandora_basic_image.info

@ -0,0 +1,6 @@
name = Islandora Basic Image
description = "Content type, viewer, and hooks for Basic Image objects"
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = islandora

27
islandora_basic_image/islandora_basic_image.install

@ -0,0 +1,27 @@
<?php
/**
* @file
* This file contains all install related hooks.
*/
/**
* Implements hook_install().
*/
function islandora_basic_image_install() {
module_load_include('inc', 'islandora', 'include/fields');
// Ensure the basic image node type is available.
node_types_rebuild();
// Add default islandora fields.
islandora_add_fields_to_bundle(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE);
// Create medium size field and add to bundle.
islandora_create_field(array(
'field_name' => ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD,
'type' => 'image',
));
islandora_add_field_to_bundle(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD, "Medium Size", "A display copy of the image");
}

215
islandora_basic_image/islandora_basic_image.module

@ -0,0 +1,215 @@
<?php
/**
* @file
* This is the new Islandora Basic Image module.
*/
define('ISLANDORA_BASIC_IMAGE_CONTENT_TYPE', 'islandora_basic_image');
define('ISLANDORA_BASIC_IMAGE_RDF_TYPE', 'islandora:basic_image');
define('ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD', 'field_medium_size');
/**
* Implements hook_node_info().
*/
function islandora_basic_image_node_info() {
return array(
ISLANDORA_BASIC_IMAGE_CONTENT_TYPE => array(
'name' => t("Basic Image"),
'base' => ISLANDORA_BASIC_IMAGE_CONTENT_TYPE,
'description' => t("A Drupal node modeling a basic image pcdm:Object"),
),
);
}
/**
* Implements hook_form().
*/
function islandora_basic_image_form($node, array &$form_state) {
return node_content_form($node, $form_state);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function islandora_basic_image_form_islandora_basic_image_node_form_alter(&$form, array &$form_state, $form_id) {
$form['title']['#weight'] = -6;
$form['obj'] = array(
'#type' => 'file',
'#title' => t('Basic Image'),
'#description' => t('Upload your archival object to put in Fedora. This will generate new derivatives'),
'#weight' => -5,
);
// Add a collection picker if node is new (e.g. this is an insert form).
$node = $form_state['node'];
if (!isset($node->nid) || isset($node->is_new)) {
// Construct list of options from db and a default.
$from_db = db_select('node', 'n')
->fields('n', array('uuid', 'title'))
->condition('n.type', ISLANDORA_COLLECTION_CONTENT_TYPE)
->execute()
->fetchAllKeyed();
// Add the select to the form.
$form['parent_collection'] = array(
'#type' => 'select',
'#title' => t('Parent Collection'),
'#description' => t('Select the parent collection to add this to.'),
'#options' => $from_db,
'#weight' => -4,
'#required' => TRUE,
);
// Keep title on top.
$form['title']['#weight'] = -7;
// Tack on a custom submit handler to attach data on the entity for use
// later on in the post action hooks.
array_unshift($form['#submit'], 'islandora_basic_image_add_parent_uuid');
}
}
/**
* Custom submit handler to pass along parent uuid.
*
* @param array $form
* Drupal form.
* @param array $form_state
* Drupal form state.
*/
function islandora_basic_image_add_parent_uuid(array $form, array &$form_state) {
$node = $form_state['node'];
$node->parent_collection = "";
if (isset($form_state['values']['parent_collection'])) {
$form_state['values']['field_fedora_has_parent']['und'][0]['value'] = $form_state['values']['parent_collection'];
}
}
/**
* Implements hook_rdf_mapping().
*/
function islandora_basic_image_rdf_mapping() {
module_load_include('inc', 'islandora', 'include/rdf_mapping');
$rdf_types = array(
ISLANDORA_PCDM_OBJECT_RDF_TYPE,
ISLANDORA_BASIC_IMAGE_RDF_TYPE,
);
return islandora_get_default_rdf_mapping(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, $rdf_types);
}
/**
* Implements hook_node_postinsert().
*/
function islandora_basic_image_node_postinsert($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a basic_image.
if (strcmp($node->type, ISLANDORA_BASIC_IMAGE_CONTENT_TYPE) != 0) {
return;
}
$parent_collection = $node->parent_collection;
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if the node never was successfully inserted in the database.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
// Set the options for httprl.
$options = array(
'method' => 'POST',
'data' => array(
'mimetype' => $_FILES['files']['type']['obj'],
'node' => json_encode($node),
),
);
// Add the obj file to the options if it exists.
$has_obj = isset($_FILES['files']['tmp_name']['obj']);
if ($has_obj) {
$options['data']['files'] = array(
'obj' => array(
$_FILES['files']['tmp_name']['obj'],
),
);
}
$url = "http://127.0.0.1:8181/cxf/islandora/image/$parent_collection";
httprl_request($url,
$options);
$response = httprl_send_request();
}
/**
* Implements hook_node_postupdate().
*/
function islandora_basic_image_node_postupdate($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a basic image.
if (strcmp($node->type, ISLANDORA_BASIC_IMAGE_CONTENT_TYPE) != 0) {
return;
}
$nodes = entity_uuid_load('node', array($node->uuid));
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
// Set the options for httprl.
$options = array(
'method' => 'PUT',
'data' => array(
'mimetype' => $_FILES['files']['type']['obj'],
'node' => json_encode($node),
),
);
// Add the obj file to the options if it exists.
$has_obj = isset($_FILES['files']['tmp_name']['obj']);
if ($has_obj) {
$options['data']['files'] = array(
'obj' => array(
$_FILES['files']['tmp_name']['obj'],
),
);
}
httprl_request("http://127.0.0.1:8181/cxf/islandora/image/{$node->uuid}",
$options);
$response = httprl_send_request();
}
/**
* Implements hook_node_postdelete().
*/
function islandora_basic_image_node_postdelete($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_BASIC_IMAGE_CONTENT_TYPE) != 0) {
return;
}
$uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/cxf/islandora/image/$uuid",
array(
'method' => 'DELETE',
));
$response = httprl_send_request();
}

78
islandora_collection/include/islandora_collection.views_default.inc

@ -0,0 +1,78 @@
<?php
/**
* @file
* Exported views code for this module.
*/
/**
* Implements hook_views_default_views().
*/
function islandora_collection_views_default_views() {
$view = new view();
$view->name = 'collection_view';
$view->description = 'Shows all members of a collection';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Collection View';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Members';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Relationship: Content: Relation: pcdm:hasMember (node → node) */
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['id'] = 'relation_pcdm_hasmember_node';
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['table'] = 'node';
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['field'] = 'relation_pcdm_hasmember_node';
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['required'] = TRUE;
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['r_index'] = '1';
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['entity_deduplication_left'] = 0;
$handler->display->display_options['relationships']['relation_pcdm_hasmember_node']['entity_deduplication_right'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Content: Node UUID */
$handler->display->display_options['arguments']['uuid']['id'] = 'uuid';
$handler->display->display_options['arguments']['uuid']['table'] = 'node';
$handler->display->display_options['arguments']['uuid']['field'] = 'uuid';
$handler->display->display_options['arguments']['uuid']['relationship'] = 'relation_pcdm_hasmember_node';
$handler->display->display_options['arguments']['uuid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['uuid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uuid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uuid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['uuid']['limit'] = '0';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'collection-view/%';
$views[$view->name] = $view;
return $views;
}

35
islandora_collection/include/relations.inc

@ -0,0 +1,35 @@
<?php
/**
* @file
* Utility functions for defining collection relationships.
*/
/**
* Utility function to define relation types using CTools export code.
*/
function islandora_collection_define_relations() {
$relation_type = new stdClass();
$relation_type->disabled = FALSE; /* Edit this to true to make a default relation_type disabled initially */
$relation_type->api_version = 1;
$relation_type->relation_type = 'pcdm_hasmember';
$relation_type->label = 'pcdm:hasMember';
$relation_type->reverse_label = 'fedora:hasParent';
$relation_type->directional = 1;
$relation_type->transitive = 0;
$relation_type->r_unique = 0;
$relation_type->min_arity = 2;
$relation_type->max_arity = 2;
$relation_type->source_bundles = array(
0 => 'node:basic_image',
1 => 'node:collection',
);
$relation_type->target_bundles = array(
0 => 'node:basic_image',
1 => 'node:collection',
);
// Relation type create adds default keys. It also handles casting to array.
$relation_type = relation_type_create($relation_type);
// Yes, in relation.module 'save' is a distinct step from 'create'.
relation_type_save($relation_type);
}

8
islandora_collection/islandora_collection.info

@ -0,0 +1,8 @@
name = Islandora Collection
description = "Content type, view, and hooks for Collections"
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = islandora
dependencies[] = hook_post_action
dependencies[] = httprl

20
islandora_collection/islandora_collection.install

@ -0,0 +1,20 @@
<?php
/**
* @file
* This file contains all install related hooks.
*/
/**
* Implements hook_install().
*/
function islandora_collection_install() {
module_load_include('inc', 'islandora', 'include/fields');
module_load_include('inc', 'islandora_collection', 'include/relations');
// Ensure the collection node type is available.
node_types_rebuild();
// Add default Islandora fields.
islandora_add_fields_to_bundle(ISLANDORA_COLLECTION_CONTENT_TYPE);
}

200
islandora_collection/islandora_collection.module

@ -0,0 +1,200 @@
<?php
/**
* @file
* This is the new Islandora Collection module.
*/
define('ISLANDORA_COLLECTION_CONTENT_TYPE', 'islandora_collection');
define('ISLANDORA_COLLECTION_RDF_TYPE', 'islandora:collection');
/**
* Implements hook_views_api().
*/
function islandora_collection_views_api() {
return array(
'api' => 3.0,
'path' => drupal_get_path('module', 'islandora_collection') . '/include',
);
}
/**
* Implements hook_node_info().
*/
function islandora_collection_node_info() {
return array(
ISLANDORA_COLLECTION_CONTENT_TYPE => array(
'name' => t("Collection"),
'base' => ISLANDORA_COLLECTION_CONTENT_TYPE,
'description' => t("A Drupal node modeling a pcdm:Collection."),
),
);
}
/**
* Implements hook_form().
*/
function islandora_collection_form($node, array &$form_state) {
return node_content_form($node, $form_state);
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function islandora_collection_form_islandora_collection_node_form_alter(&$form, array &$form_state, $form_id) {
$node = $form_state['node'];
// Add a collection picker if node is new (e.g. this is an insert form).
if (!isset($node->nid) || isset($node->is_new)) {
// Construct list of options from db and a default.
$default = array('' => t('Fedora Root'));
$from_db = db_select('node', 'n')
->fields('n', array('uuid', 'title'))
->condition('n.type', ISLANDORA_COLLECTION_CONTENT_TYPE)
->execute()
->fetchAllKeyed();
$options = $default + $from_db;
// Add the select to the form.
$form['parent_collection'] = array(
'#type' => 'select',
'#title' => t('Parent Collection'),
'#description' => t('Select the parent collection to add this to. Select "Fedora Root" if you want it to be a top-level collection'),
'#options' => $options,
'#default_value' => '',
'#weight' => -4,
);
// Keep title on top.
$form['title']['#weight'] = -5;
// Tack on a custom submit handler to attach data on the entity for use
// later on in the post action hooks.
array_unshift($form['#submit'], 'islandora_collection_add_parent_uuid');
}
}
/**
* Custom submit handler to pass along parent uuid.
*
* @param array $form
* Drupal form.
* @param array $form_state
* Drupal form state.
*/
function islandora_collection_add_parent_uuid(array $form, array &$form_state) {
$node = $form_state['node'];
$node->parent_collection = "";
if (isset($form_state['parent_collection']['#value'])) {
$node->parent_collection = $form_state['parent_collection']['#value'];
}
}
/**
* Implements hook_rdf_mapping().
*/
function islandora_collection_rdf_mapping() {
module_load_include('inc', 'islandora', 'include/rdf_mapping');
$rdf_types = array(
ISLANDORA_PCDM_COLLECTION_RDF_TYPE,
ISLANDORA_COLLECTION_RDF_TYPE,
);
return islandora_get_default_rdf_mapping(ISLANDORA_COLLECTION_CONTENT_TYPE, $rdf_types);
}
/**
* Implements hook_node_postinsert().
*/
function islandora_collection_node_postinsert($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_COLLECTION_CONTENT_TYPE) != 0) {
return;
}
$parent_collection = $node->parent_collection;
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if the node never was successfully inserted in the database.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
$url = "http://127.0.0.1:8181/cxf/islandora/collection/$parent_collection";
// Don't forget the trailing slash.
httprl_request($url,
array(
'method' => 'POST',
'headers' => array(
'Content-Type' => 'application/json',
),
'data' => json_encode($node),
));
$response = httprl_send_request();
}
/**
* Implements hook_node_postupdate().
*/
function islandora_collection_node_postupdate($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_COLLECTION_CONTENT_TYPE) != 0) {
return;
}
// Unfortunately, there's no way to tell if the db transaction got rolled
// back in this hook, so we'll default to doing it anyway so as not to miss
// any updates. Open to suggestions on this one. But we gotta do post_action
// hooks otherwise things can get crazy if the db transaction hasn't closed.
$nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if something has gone wrong and there's no node info.
if (empty($nodes)) {
return;
}
$node = array_pop($nodes);
$uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid",
array(
'method' => 'PUT',
'headers' => array(
'Content-Type' => 'application/json',
),
'data' => json_encode($node),
));
$response = httprl_send_request();
}
/**
* Implements hook_node_postdelete().
*/
function islandora_collection_node_postdelete($node) {
module_load_include('inc', 'islandora', 'include/utils');
if (islandora_ignore_hooks()) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_COLLECTION_CONTENT_TYPE) != 0) {
return;
}
$uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid",
array(
'method' => 'DELETE',
));
$response = httprl_send_request();
}

88
islandora_dc/include/fields.inc

@ -0,0 +1,88 @@
<?php
/**
* @file
* Utility functions for working with DC fields.
*/
/**
* Adds all the DC fields to a bundle.
*
* @param string $bundle_name
* The name of the bundle to give the fields.
*/
function islandora_dc_add_fields_to_bundle($bundle_name) {
module_load_include('inc', 'islandora', 'include/fields');
// Big list of field names/labels/descriptions.
$field_data = array(
ISLANDORA_DC_CONTRIBUTOR_FIELD => array(
'label' => 'DC Contributor',
'description' => 'Dublin Core 1.1 Contributor Metadata',
),
ISLANDORA_DC_COVERAGE_FIELD => array(
'label' => 'DC Coverage',
'description' => 'Dublin Core 1.1 Coverage Metadata',
),
ISLANDORA_DC_CREATOR_FIELD => array(
'label' => 'DC Creator',
'description' => 'Dublin Core 1.1 Creator Metadata',
),
ISLANDORA_DC_DATE_FIELD => array(
'label' => 'DC Date',
'description' => 'Dublin Core 1.1 Date Metadata',
),
ISLANDORA_DC_DESCRIPTION_FIELD => array(
'label' => 'DC Description',
'description' => 'Dublin Core 1.1 Description Metadata',
),
ISLANDORA_DC_FORMAT_FIELD => array(
'label' => 'DC Format',
'description' => 'Dublin Core 1.1 Format Metadata',
),
ISLANDORA_DC_IDENTIFIER_FIELD => array(
'label' => 'DC Identifier',
'description' => 'Dublin Core 1.1 Identifier Metadata',
),
ISLANDORA_DC_LANGUAGE_FIELD => array(
'label' => 'DC Language',
'description' => 'Dublin Core 1.1 Language Metadata',
),
ISLANDORA_DC_PUBLISHER_FIELD => array(
'label' => 'DC Publisher',
'description' => 'Dublin Core 1.1 Publisher Metadata',
),
ISLANDORA_DC_RELATION_FIELD => array(
'label' => 'DC Relation',
'description' => 'Dublin Core 1.1 Relation Metadata',
),
ISLANDORA_DC_RIGHTS_FIELD => array(
'label' => 'DC Rights',
'description' => 'Dublin Core 1.1 Rights Metadata',
),
ISLANDORA_DC_SOURCE_FIELD => array(
'label' => 'DC Source',
'description' => 'Dublin Core 1.1 Source Metadata',
),
ISLANDORA_DC_SUBJECT_FIELD => array(
'label' => 'DC Subject',
'description' => 'Dublin Core 1.1 Subject Metadata',
),
ISLANDORA_DC_TITLE_FIELD => array(
'label' => 'DC Title',
'description' => 'Dublin Core 1.1 Title Metadata',
),
ISLANDORA_DC_TYPE_FIELD => array(
'label' => 'DC Type',
'description' => 'Dublin Core 1.1 Type Metadata',
),
);
// Iterate over fields and add each to the specified bundle.
foreach ($field_data as $field_name => $data) {
$field_label = $data['label'];
$field_description = $data['description'];
islandora_add_field_to_bundle($bundle_name, $field_name, $field_label, $field_description);
}
}

5
islandora_dc/islandora_dc.info

@ -0,0 +1,5 @@
name = Islandora DC
description = "Fields and utilities for managing DC 1.1 metadata in Islandora"
package = Islandora
version = 7.x-dev
core = 7.x

42
islandora_dc/islandora_dc.install

@ -0,0 +1,42 @@
<?php
/**
* @file
* Install hooks for this module.
*/
/**
* Implements hook_install().
*
* Creates shared fields for content types using DC metadata.
*/
function islandora_dc_install() {
module_load_include('inc', 'islandora', 'include/fields');
$field_names = array(
ISLANDORA_DC_CONTRIBUTOR_FIELD,
ISLANDORA_DC_COVERAGE_FIELD,
ISLANDORA_DC_CREATOR_FIELD,
ISLANDORA_DC_DATE_FIELD,
ISLANDORA_DC_DESCRIPTION_FIELD,
ISLANDORA_DC_FORMAT_FIELD,
ISLANDORA_DC_IDENTIFIER_FIELD,
ISLANDORA_DC_LANGUAGE_FIELD,
ISLANDORA_DC_PUBLISHER_FIELD,
ISLANDORA_DC_RELATION_FIELD,
ISLANDORA_DC_RIGHTS_FIELD,
ISLANDORA_DC_SOURCE_FIELD,
ISLANDORA_DC_SUBJECT_FIELD,
ISLANDORA_DC_TITLE_FIELD,
ISLANDORA_DC_TYPE_FIELD,
);
foreach ($field_names as $field_name) {
islandora_create_field(array(
'field_name' => $field_name,
'type' => 'text_long',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
));
}
}

33
islandora_dc/islandora_dc.module

@ -0,0 +1,33 @@
<?php
/**
* @file
* Islandora module for working with DC Metadata.
*/
define('ISLANDORA_DC_NAMESPACE', 'http://purl.org/dc/elements/1.1/');
define('ISLANDORA_DC_NAMESPACE_PREFIX', 'dc11');
define('ISLANDORA_DC_CONTRIBUTOR_FIELD', 'field_dc_contributor');
define('ISLANDORA_DC_COVERAGE_FIELD', 'field_dc_coverage');
define('ISLANDORA_DC_CREATOR_FIELD', 'field_dc_creator');
define('ISLANDORA_DC_DATE_FIELD', 'field_dc_date');
define('ISLANDORA_DC_DESCRIPTION_FIELD', 'field_dc_description');
define('ISLANDORA_DC_FORMAT_FIELD', 'field_dc_format');
define('ISLANDORA_DC_IDENTIFIER_FIELD', 'field_dc_identifier');
define('ISLANDORA_DC_LANGUAGE_FIELD', 'field_dc_language');
define('ISLANDORA_DC_PUBLISHER_FIELD', 'field_dc_publisher');
define('ISLANDORA_DC_RELATION_FIELD', 'field_dc_relation');
define('ISLANDORA_DC_RIGHTS_FIELD', 'field_dc_rights');
define('ISLANDORA_DC_SOURCE_FIELD', 'field_dc_source');
define('ISLANDORA_DC_SUBJECT_FIELD', 'field_dc_subject');
define('ISLANDORA_DC_TITLE_FIELD', 'field_dc_title');
define('ISLANDORA_DC_TYPE_FIELD', 'field_dc_type');
/**
* Implements hook_rdf_namespaces().
*/
function islandora_dc_rdf_namespaces() {
return array(
ISLANDORA_DC_NAMESPACE_PREFIX => ISLANDORA_DC_NAMESPACE,
);
}

42
islandora_delete_by_fedora_uri_service/include/islandora_delete_by_fedora_uri_service.inc

@ -0,0 +1,42 @@
<?php
/**
* @file
* Provides the callback implementations for the service.
*/
/**
* The POST callback for the deletion by Fedora URI service.
*
* @param array $args
* JSON encoded arguments to delete function.
*
* @return array
* JSON encoded response message.
*/
function islandora_delete_by_fedora_uri_service_delete(array $args) {
// Hack the Fedora path out of the POST data.
$fedora_uri = $args['fedoraUri'];
// Get entities identified by Fedora path.
$query = new EntityFieldQuery();
$results = $query->fieldCondition('field_fedora_path', 'value', $fedora_uri)
->execute();
// Delete 'em all.
foreach ($results as $entity_type => $entities) {
$ids = array_keys($entities);
if (entity_delete_multiple($entity_type, $ids) === FALSE) {
$response[] = "Could not delete any $entity_type identified by $fedora_uri.";
}
else {
$response[] = "Deleted entities of type $entity_type with ids " . implode(', ', $ids) . ".";
}
}
if (!isset($response)) {
$response[] = "Could not find any entities identified by $fedora_uri.";
}
return $response;
}

6
islandora_delete_by_fedora_uri_service/islandora_delete_by_fedora_uri_service.info

@ -0,0 +1,6 @@
name = Islandora Delete By Fedora URI Service
description = "Deletes Drupal nodes by Fedora URI. Needed for Sync to handle delete events that don't originate from Drupal."
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = rest_server

48
islandora_delete_by_fedora_uri_service/islandora_delete_by_fedora_uri_service.module

@ -0,0 +1,48 @@
<?php
/**
* @file
* Provides a service for deleting Drupal nodes by Fedora path.
*/
/**
* Implements hook_permission().
*/
function islandora_delete_by_fedora_uri_service_permission() {
return array(
'islandora delete by fedora uri' => array(
'title' => t('Delete by Fedora URI.'),
'description' => t('Allows external sources to delete Drupal nodes by Fedora URI.'),
),
);
}
/**
* Implements hook_services_resources().
*/
function islandora_delete_by_fedora_uri_service_services_resources() {
return array(
'delete_by_fedora_uri' => array(
'create' => array(
'help' => t('Deletes a Drupal node by the Fedora URI supplied in the POST data.'),
'file' => array(
'type' => 'inc',
'module' => 'islandora_delete_by_fedora_uri_service',
'name' => 'include/islandora_delete_by_fedora_uri_service',
),
'callback' => 'islandora_delete_by_fedora_uri_service_delete',
'access callback' => 'user_access',
'access arguments' => array('islandora delete by fedora uri'),
'args' => array(
array(
'name' => 'args',
'type' => 'array',
'description' => t("JSON data containing arguments to the delete function (e.g. the Fedora URI)"),
'source' => 'data',
'optional' => FALSE,
),
),
),
),
);
}

50
islandora_medium_size_service/include/islandora_medium_size_service.inc

@ -0,0 +1,50 @@
<?php
/**
* @file
* Provides the callback implementations for the service.
*/
/**
* The POST callback for the MEDIUM_SIZE service.
*
* @param array $args
* JSON encoded arguments.
*
* @return string
* Response message.
*/
function islandora_medium_size_service_create(array $args) {
$uuid = $args['uuid'];
$tn_b64 = $args['file'];
$mimetype = $args['mimetype'];
$exploded = explode("/", $mimetype);
$extension = $exploded[1];
$entities = entity_uuid_load('node', array($uuid));
if (empty($entities)) {
return "Could not add medium sized image because there is no entity identified by $uuid";
}
$node = array_pop($entities);
$file = file_save_data(base64_decode($tn_b64), "public://" . $uuid . "_MEDIUM_SIZE." . $extension, FILE_EXISTS_REPLACE);
$node->field_medium_size[LANGUAGE_NONE][] = array(
'fid' => $file->fid,
'alt' => "Medium sized image for node $uuid",
'title' => "Medium sized image for node $uuid",
);
$node->field_tn[LANGUAGE_NONE][] = array(
'fid' => $file->fid,
'width' => 100,
'height' => 100,
'alt' => "Thumbnail for node $uuid",
'title' => "Thumbnail for node $uuid",
);
node_save($node);
return "Successfully added medium sized image to node $uuid";
}

6
islandora_medium_size_service/islandora_medium_size_service.info

@ -0,0 +1,6 @@
name = Islandora Medium Size Service
description = "Adds medium size images to nodes"
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = rest_server

48
islandora_medium_size_service/islandora_medium_size_service.module

@ -0,0 +1,48 @@
<?php
/**
* @file
* Provides a service for adding medium size images to nodes.
*/
/**
* Implements hook_permission().
*/
function islandora_medium_size_service_permission() {
return array(
'islandora medium size service create' => array(
'title' => t('Add Medium Size'),
'description' => t('Allows external sources to add medium size images to nodes.'),
),
);
}
/**
* Implements hook_services_resources().
*/
function islandora_medium_size_service_services_resources() {
return array(
'medium_size' => array(
'create' => array(
'help' => t('Adds a medium sized image to the node identified by UUID.'),
'file' => array(
'type' => 'inc',
'module' => 'islandora_medium_size_service',
'name' => 'include/islandora_medium_size_service',
),
'callback' => 'islandora_medium_size_service_create',
'access callback' => 'user_access',
'access arguments' => array('islandora medium size service create'),
'args' => array(
array(
'name' => 'args',
'type' => 'array',
'description' => t("JSON data containing arguments to add the medium sized image."),
'source' => 'data',
'optional' => FALSE,
),
),
),
),
);
}

17
islandora_mods/include/fields.inc

@ -0,0 +1,17 @@
<?php
/**
* @file
* Utility functions for working with MODS fields.
*/
/**
* Adds all the MODS fields to a bundle.
*
* @param string $bundle_name
* The name of the bundle to give the fields.
*/
function islandora_mods_add_fields_to_bundle($bundle_name) {
module_load_include('inc', 'islandora', 'include/fields');
islandora_add_field_to_bundle($bundle_name, ISLANDORA_MODS_FIELD, "MODS XML", "A MODS record for the Fedora resource");
}

5
islandora_mods/islandora_mods.info

@ -0,0 +1,5 @@
name = Islandora MODS
description = "Fields and utilities for managing MODS metadata in Islandora"
package = Islandora
version = 7.x-dev
core = 7.x

20
islandora_mods/islandora_mods.install

@ -0,0 +1,20 @@
<?php
/**
* @file
* Install hooks for this module.
*/
/**
* Implements hook_install().
*
* Creates shared fields for content types using MODS metadata.
*/
function islandora_mods_install() {
module_load_include('inc', 'islandora', 'include/fields');
islandora_create_field(array(
'field_name' => ISLANDORA_MODS_FIELD,
'type' => 'xml_field_xml',
));
}

34
islandora_mods/islandora_mods.module

@ -0,0 +1,34 @@
<?php
/**
* @file
* Islandora module for working with MODS Metadata.
*/
define('ISLANDORA_MODS_NAMESPACE', 'http://www.loc.gov/mods/v3/');
define('ISLANDORA_MODS_NAMESPACE_PREFIX', 'mods');
define('ISLANDORA_MODS_RDF_NAMESPACE', 'http://www.loc.gov/mods/modsrdf/v1#');
define('ISLANDORA_MODS_RDF_NAMESPACE_PREFIX', 'modsrdf');
define('ISLANDORA_MODS_FIELD', 'field_mods');
define('ISLANDORA_MODS_FILE_ID', 'MODS');
/**
* Implements hook_rdf_namespaces().
*/
function islandora_mods_rdf_namespaces() {
return array(
ISLANDORA_MODS_RDF_NAMESPACE_PREFIX => ISLANDORA_MODS_RDF_NAMESPACE,
);
}
/**
* Implements hook_pcdm_file_mapping().
*/
function islandora_mods_pcdm_file_mapping() {
return array(
ISLANDORA_MODS_FIELD => array(
'id' => ISLANDORA_MODS_FILE_ID,
'mimetype' => 'application/xml',
),
);
}

25
islandora_rdf_mapping_service/include/islandora_rdf_mapping_service.inc

@ -0,0 +1,25 @@
<?php
/**
* @file
* Provides the callback implementations for the service.
*/
/**
* The GET callback for the RDF mapping service.
*
* @param string $type
* Entity type to which the RDF mapping belongs.
* @param string $bundle
* Bundle to which the RDF mapping belongs.
*
* @return array
* The RDF mapping.
*/
function islandora_rdf_mapping_service_retrieve($type, $bundle) {
return array(
'rdf_mapping' => rdf_mapping_load($type, $bundle),
'rdf_namespaces' => rdf_get_namespaces(),
'pcdm_file_mapping' => module_invoke_all('pcdm_file_mapping'),
);
}

6
islandora_rdf_mapping_service/islandora_rdf_mapping_service.info

@ -0,0 +1,6 @@
name = Islandora RDF Mapping Service
description = "Exposes RDF -> Field mapping for the middleware layer to use."
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = rest_server

59
islandora_rdf_mapping_service/islandora_rdf_mapping_service.module

@ -0,0 +1,59 @@
<?php
/**
* @file
* Provides a service for retrieving RDF mappings from Drupal.
*/
/**
* Implements hook_permission().
*/
function islandora_rdf_mapping_service_permission() {
return array(
'islandora rdf mapping service retrieve' => array(
'title' => t('Retrieve RDF Mappings'),
'description' => t('Allows external sources to request RDF mappings.'),
),
);
}
/**
* Implements hook_services_resources().
*/
function islandora_rdf_mapping_service_services_resources() {
return array(
'rdf_mapping' => array(
'retrieve' => array(
'help' => t('Retrieves an RDF mapping using the supplied entity type and bundle.'),
'file' => array(
'type' => 'inc',
'module' => 'islandora_rdf_mapping_service',
'name' => 'include/islandora_rdf_mapping_service',
),
'callback' => 'islandora_rdf_mapping_service_retrieve',
'access callback' => 'user_access',
'access arguments' => array('islandora rdf mapping service retrieve'),
'args' => array(
array(
'name' => 'type',
'type' => 'string',
'description' => t("Entity type to which the RDF mapping belongs."),
'source' => array(
'path' => 0,
),
'optional' => FALSE,
),
array(
'name' => 'bundle',
'type' => 'string',
'description' => t("Bundle to which the RDF mapping belongs."),
'source' => array(
'path' => 1,
),
'optional' => FALSE,
),
),
),
),
);
}

45
islandora_tn_service/include/islandora_tn_service.inc

@ -0,0 +1,45 @@
<?php
/**
* @file
* Provides the callback implementations for the service.
*/
/**
* The POST callback for the TN service.
*
* @param array $args
* JSON decoded function arguments.
*
* @return string
* Message.
*/
function islandora_tn_service_create(array $args) {
$uuid = $args['uuid'];
$tn_b64 = $args['file'];
$mimetype = $args['mimetype'];
$exploded = explode("/", $mimetype);
$extension = $exploded[1];
$entities = entity_uuid_load('node', array($uuid));
if (empty($entities)) {
return "Could not add thumbnail because there is no entity identified by $uuid";
}
$node = array_pop($entities);
$file = file_save_data(base64_decode($tn_b64), "public://" . $uuid . "_TN." . $extension, FILE_EXISTS_REPLACE);
$node->field_tn[LANGUAGE_NONE][] = array(
'fid' => $file->fid,
'width' => 100,
'height' => 100,
'alt' => "Thumbnail for node $uuid",
'title' => "Thumbnail for node $uuid",
);
node_save($node);
return "Successfully added thumbnail to node $uuid";
}

6
islandora_tn_service/islandora_tn_service.info

@ -0,0 +1,6 @@
name = Islandora TN Service
description = "Adds thumbnail images to nodes"
package = Islandora
version = 7.x-dev
core = 7.x
dependencies[] = rest_server

48
islandora_tn_service/islandora_tn_service.module

@ -0,0 +1,48 @@
<?php
/**
* @file
* Provides a service for adding thumbnails to Drupal.
*/
/**
* Implements hook_permission().
*/
function islandora_tn_service_permission() {
return array(
'islandora tn service create' => array(
'title' => t('Add Thumbnails'),
'description' => t('Allows external sources to add thumbnails to nodes.'),
),
);
}
/**
* Implements hook_services_resources().
*/
function islandora_tn_service_services_resources() {
return array(
'tn' => array(
'create' => array(
'help' => t('Adds a thumbnail to the node identified by UUID.'),
'file' => array(
'type' => 'inc',
'module' => 'islandora_tn_service',
'name' => 'include/islandora_tn_service',
),
'callback' => 'islandora_tn_service_create',
'access callback' => 'user_access',
'access arguments' => array('islandora tn service create'),
'args' => array(
array(
'name' => 'args',
'type' => 'array',
'description' => t("JSON data containing arguments to add the thumbnail."),
'source' => 'data',
'optional' => FALSE,
),
),
),
),
);
}

19
migrate/tags.csv

@ -1,19 +0,0 @@
vid,name,description,external_uri
islandora_media_use,"Extracted Text","A textual representation of the Object appropriate for fulltext indexing, such as a plaintext version of a document, or OCR text",http://pcdm.org/use#ExtractedText
islandora_media_use,"Intermediate File","High quality representation of the Object, appropriate for generating derivatives or other additional processing",http://pcdm.org/use#IntermediateFile
islandora_media_use,"Original File","The original creation format of a file",http://pcdm.org/use#OriginalFile
islandora_media_use,"Preservation Master File","Best quality representation of the Object appropriate for long-term preservation",http://pcdm.org/use#PreservationMasterFile
islandora_media_use,"Service File","A medium quality representation of the Object appropriate for serving to users",http://pcdm.org/use#ServiceFile
islandora_media_use,"Thumbnail Image","A low resolution image representation of the Object appropriate for using as an icon",http://pcdm.org/use#ThumbnailImage
islandora_media_use,"Transcript","A textual representation of the Object appropriate for presenting to users, such as subtitles or transcript of a video. Can be used as a substitute or complement to other files for accessibility purposes",http://pcdm.org/use#Transcript
islandora_models,"Audio","A resource primarily intended to be heard. Examples include a music playback file format, an audio compact disc, and recorded speech or sounds",http://purl.org/coar/resource_type/c_18cc
islandora_models,"Binary","A generic binary file for repository items that don't fall into any other category or cannot be shown in a browser",http://purl.org/coar/resource_type/c_1843
islandora_models,"Collection","A collection is an aggregation of items",http://purl.org/dc/dcmitype/Collection
islandora_models,"Image","A visual representation other than text, including all types of moving image and still image",http://purl.org/coar/resource_type/c_c513
islandora_models,"Video","A recording of visual images, usually in motion and with sound accompaniment",http://purl.org/coar/resource_type/c_12ce
islandora_models,"Digital Document","An electronic file or document.",https://schema.org/DigitalDocument
islandora_models,"Paged Content","An Electronic Book, object with pages",https://schema.org/Book
islandora_models,"Page","A page in an Electronic Paged Content Object",http://id.loc.gov/ontologies/bibframe/part
islandora_models,"Publication Issue","A part of a successively published publication such as a periodical or publication volume, often numbered, usually containing a grouping of works such as articles.",https://schema.org/PublicationIssue
islandora_models,"Compound Object","A special type of collection where the parent item may also have complex metadata",http://vocab.getty.edu/aat/300242735
islandora_models,"Newspaper","A special type of collection which only has Newspaper Issues for children.",https://schema.org/Newspaper
1 vid name description external_uri
2 islandora_media_use Extracted Text A textual representation of the Object appropriate for fulltext indexing, such as a plaintext version of a document, or OCR text http://pcdm.org/use#ExtractedText
3 islandora_media_use Intermediate File High quality representation of the Object, appropriate for generating derivatives or other additional processing http://pcdm.org/use#IntermediateFile
4 islandora_media_use Original File The original creation format of a file http://pcdm.org/use#OriginalFile
5 islandora_media_use Preservation Master File Best quality representation of the Object appropriate for long-term preservation http://pcdm.org/use#PreservationMasterFile
6 islandora_media_use Service File A medium quality representation of the Object appropriate for serving to users http://pcdm.org/use#ServiceFile
7 islandora_media_use Thumbnail Image A low resolution image representation of the Object appropriate for using as an icon http://pcdm.org/use#ThumbnailImage
8 islandora_media_use Transcript A textual representation of the Object appropriate for presenting to users, such as subtitles or transcript of a video. Can be used as a substitute or complement to other files for accessibility purposes http://pcdm.org/use#Transcript
9 islandora_models Audio A resource primarily intended to be heard. Examples include a music playback file format, an audio compact disc, and recorded speech or sounds http://purl.org/coar/resource_type/c_18cc
10 islandora_models Binary A generic binary file for repository items that don't fall into any other category or cannot be shown in a browser http://purl.org/coar/resource_type/c_1843
11 islandora_models Collection A collection is an aggregation of items http://purl.org/dc/dcmitype/Collection
12 islandora_models Image A visual representation other than text, including all types of moving image and still image http://purl.org/coar/resource_type/c_c513
13 islandora_models Video A recording of visual images, usually in motion and with sound accompaniment http://purl.org/coar/resource_type/c_12ce
14 islandora_models Digital Document An electronic file or document. https://schema.org/DigitalDocument
15 islandora_models Paged Content An Electronic Book, object with pages https://schema.org/Book
16 islandora_models Page A page in an Electronic Paged Content Object http://id.loc.gov/ontologies/bibframe/part
17 islandora_models Publication Issue A part of a successively published publication such as a periodical or publication volume, often numbered, usually containing a grouping of works such as articles. https://schema.org/PublicationIssue
18 islandora_models Compound Object A special type of collection where the parent item may also have complex metadata http://vocab.getty.edu/aat/300242735
19 islandora_models Newspaper A special type of collection which only has Newspaper Issues for children. https://schema.org/Newspaper

73
modules/islandora_advanced_search/CONTRIBUTING.md

@ -1,73 +0,0 @@
# Welcome!
If you are reading this document then you are interested in contributing to Islandora 8. All contributions are welcome: use-cases, documentation, code, patches, bug reports, feature requests, etc. You do not need to be a programmer to speak up!
We also have an IRC channel -- #islandora -- on freenode.net. Feel free to hang out there, ask questions, and help others out if you can.
Please note that this project operates under the [Islandora Community Code of Conduct](http://islandora.ca/codeofconduct). By participating in this project you agree to abide by its terms.
## Workflows
The group meets each Wednesday at 1:00 PM Eastern. Meeting notes and announcements are posted to the [Islandora community list](https://groups.google.com/forum/#!forum/islandora) and the [Islandora developers list](https://groups.google.com/forum/#!forum/islandora-dev). You can view meeting agendas, notes, and call-in information [here](https://github.com/Islandora/documentation/wiki#islandora-8-tech-calls). Anybody is welcome to join the calls, and add items to the agenda.
### Use cases
If you would like to submit a use case to the Islandora 8 project, please submit an issue [here](https://github.com/Islandora/documentation/issues/new) using the [Use Case template](https://github.com/Islandora/documentation/wiki/Use-Case-template), prepending "Use Case:" to the title of the issue.
### Documentation
You can contribute documentation in two different ways. One way is to create an issue [here](https://github.com/Islandora/documentation/issues/new), prepending "Documentation:" to the title of the issue. Another way is by pull request, which is the same process as [Contribute Code](https://github.com/Islandora/documentation/blob/main/CONTRIBUTING.md#contribute-code). All documentation resides in [`docs`](https://github.com/Islandora/documentation/tree/main/docs).
### Request a new feature
To request a new feature you should [open an issue in the Islandora 8 repository](https://github.com/Islandora/documentation/issues/new) or create a use case (see the _Use cases_ section above), and summarize the desired functionality. Prepend "Enhancement:" if creating an issue on the project repo, and "Use Case:" if creating a use case.
### Report a bug
To report a bug you should [open an issue in the Islandora 8 repository](https://github.com/Islandora/documentation/issues/new) that summarizes the bug. Prepend the label "Bug:" to the title of the issue.
In order to help us understand and fix the bug it would be great if you could provide us with:
1. The steps to reproduce the bug. This includes information about e.g. the Islandora version you were using along with the versions of stack components.
2. The expected behavior.
3. The actual, incorrect behavior.
Feel free to search the issue queue for existing issues (aka tickets) that already describe the problem; if there is such a ticket please add your information as a comment.
**If you want to provide a pull along with your bug report:**
That is great! In this case please send us a pull request as described in the section _Create a pull request_ below.
### Contribute code
Before you set out to contribute code you will need to have completed a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <mailto:community@islandora.ca>
_If you are interested in contributing code to Islandora but do not know where to begin:_
In this case you should [browse open issues](https://github.com/Islandora/documentation/issues) and check out [use cases](https://github.com/Islandora/documentation/labels/use%20case).
If you are contributing Drupal code, it must adhere to [Drupal Coding Standards](https://www.drupal.org/coding-standards); Travis CI will check for this on pull requests.
Contributions to the Islandora codebase should be sent as GitHub pull requests. See section _Create a pull request_ below for details. If there is any problem with the pull request we can work through it using the commenting features of GitHub.
* For _small patches_, feel free to submit pull requests directly for those patches.
* For _larger code contributions_, please use the following process. The idea behind this process is to prevent any wasted work and catch design issues early on.
1. [Open an issue](https://github.com/Islandora/documentation/issues), prepending "Enhancement:" in the title if a similar issue does not exist already. If a similar issue does exist, then you may consider participating in the work on the existing issue.
2. Comment on the issue with your plan for implementing the issue. Explain what pieces of the codebase you are going to touch and how everything is going to fit together.
3. Islandora committers will work with you on the design to make sure you are on the right track.
4. Implement your issue, create a pull request (see below), and iterate from there.
### Create a pull request
Take a look at [Creating a pull request](https://help.github.com/articles/creating-a-pull-request). In a nutshell you need to:
1. [Fork](https://help.github.com/articles/fork-a-repo) this repository to your personal or institutional GitHub account (depending on the CLA you are working under). Be cautious of which branches you work from though (you'll want to base your work off the default branch). See [Fork a repo](https://help.github.com/articles/fork-a-repo) for detailed instructions.
2. Commit any changes to your fork.
3. Send a [pull request](https://help.github.com/articles/creating-a-pull-request) using the [pull request template](https://github.com/Islandora/documentation/blob/main/.github/PULL_REQUEST_TEMPLATE.md) to the Islandora GitHub repository that you forked in step 1. If your pull request is related to an existing issue -- for instance, because you reported a [bug/issue](https://github.com/Islandora/documentation/issues) earlier -- prefix the title of your pull request with the corresponding issue number (e.g. `issue-123: ...`). Please also include a reference to the issue in the description of the pull. This can be done by using '#' plus the issue number like so '#123', also try to pick an appropriate name for the branch in which you're issuing the pull request from.
You may want to read [Syncing a fork](https://help.github.com/articles/syncing-a-fork) for instructions on how to keep your fork up to date with the latest changes of the upstream (official) repository.
## License Agreements
The Islandora Foundation requires that contributors complete a [Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf) or be covered by a [Corporate Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf). The signed copy of the license agreement should be sent to <a href="mailto:community@islandora.ca?Subject=Contributor%20License%20Agreement" target="_top">community@islandora.ca</a>. This license is for your protection as a contributor as well as the protection of the Foundation and its users; it does not change your rights to use your own contributions for any other purpose. A list of current CLAs is kept [here](https://github.com/Islandora/islandora/wiki/Contributor-License-Agreements).

339
modules/islandora_advanced_search/LICENSE

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

261
modules/islandora_advanced_search/README.md

@ -1,261 +0,0 @@
# Islandora Advanced Search <!-- omit in toc -->
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Configuring Solr](#configuring-solr)
- [Configure Collection Search](#configure-collection-search)
- [Configure Views](#configure-views)
- [Exposed Form](#exposed-form)
- [Collection Search](#collection-search)
- [Paging](#paging)
- [Sorting](#sorting)
- [Configure Facets](#configure-facets)
- [Include / Exclude Facets](#include--exclude-facets)
- [Configure Blocks](#configure-blocks)
- [Advanced Search Block](#advanced-search-block)
- [Documentation](#documentation)
- [Troubleshooting/Issues](#troubleshootingissues)
- [Maintainers](#maintainers)
- [Sponsors](#sponsors)
- [Development](#development)
- [License](#license)
## Introduction
This module creates several blocks to support searching. It also enables the use
of Ajax with search blocks, facets, and search results.
![image](./docs/demo.gif)
## Requirements
Use composer to download the required libraries and modules.
```bash
composer require drupal/facets "^1.3"
composer require drupal/search_api_solr "^4.1"
composer require drupal/search_api "^1.5"
```
However, for reference, `islandora_advanced_search` requires the following
drupal modules:
- [facets](https://www.drupal.org/project/facets)
- [search_api_solr](https://www.drupal.org/project/search_api_solr)
## Installation
To download/enable just this module, use the following from the command line:
```bash
composer require islandora/islandora
drush en islandora_advanced_search
```
## Configuration
You can set the following configuration at
`admin/config/islandora/advanced_search`:
![image](./docs/islandora_advanced_search_settings.png)
## Configuring Solr
Please review
[Islandora Documentation](https://islandora.github.io/documentation/user-documentation/searching/)
before continuing. The following assumes you already have a working Solr and the
Drupal Search API setup.
## Configure Collection Search
To support collection based searches you need to index the `field_member_of` for
every repository item as well define a new field that captures the full
hierarchy of `field_member_of` for each repository item.
Add a new `Content` solr field `field_decedent_of` to the solr index at
`admin/config/search/search-api/index/default_solr_index/fields`.
![image](./docs/field_decedent_of.png)
Then under `admin/config/search/search-api/index/default_solr_index/processors`
enable `Index hierarchy` and setup the new field to index the hierarchy.
![image](./docs/enable_index_hierarchy.png)
![image](./docs/enable_index_hierarchy_processor.png)
The field can now be used limit a search to all the decedents of a given object.
> N.B. You may have to re-index to make sure the field is populated.
## Configure Views
The configuration of views is outside of the scope of this document, please read
the [Drupal Documentation](https://www.drupal.org/docs/8/core/modules/views), as
well as the
[Search API Documentation](https://www.drupal.org/docs/contributed-modules/search-api).
### Exposed Form
Solr views allow the user to configure an exposed form (_optionally as a
block_). This form / block is **different** from the
[Advanced Search Block](#advanced-search-block). This module does not make any
changes to the form, but this form can cause the Advanced Search Block to not
function if configured incorrectly.
The Advanced Search Block requires that if present the Exposed forms
`Exposed form style` is set to `Basic` rather than `Input Required`. As
`Input Required` will prevent any search from occurring unless the user puts an
additional query in the Exposed form as well.
![Form Style](./docs/basic-input.png)
### Collection Search
That being said it will be typical that you require the following
`Relationships` and `Contextual Filters` when setting up a search view to enable
`Collection Search` searches.
![image](./docs/view_advanced_setting.png)
Here a relationship is setup with `Member Of` field and we have **two**
contextual filters:
1. `field_member_of` (Direct decedents of the Entity)
2. `field_decedent_of` (All decedents of the Entity)
Both of these filters are configured the exact same way.
![image](./docs/contextual_filter_settings.png)
These filters are toggled by the Advanced Search block to allow the search to
include all decedents or just direct decedents (*documented below*).
### Paging
The paging options specified here can have an affect on the pager block
(*documented below*).
![image](./docs/pager_settings.png)
### Sorting
Additional the fields listed as `Sort Criteria` as `Exposed` will be made
available in the pager block (*documented below*).
![image](./docs/sort_criteria.png)
## Configure Facets
The facets can be configured at `admin/config/search/facets`. Facets are linked
to a **Source** which is a **Search API View Display** so it will be typically
to have to duplicate your configuration for a given facet across each of the
displays where you want it to show up.
### Include / Exclude Facets
To be able to display exclude facet links as well as include links in the facets
block we have to duplicate the configuration for the facet like so.
![image](./docs/include_exclude_facets.png)
Both the include / exclude facets must use the widget
`List of links that allow the user to include / exclude facets`
![image](./docs/include_exclude_facets_settings.png)
The excluded facet also needs the following settings to appear and function
correctly.
The `URL alias` must match the same value as the include facet except it must be
prefixed with `~` character that is what links to the two facets to each other.
![image](./docs/exclude_facet_settings_url_alias.png)
And it must also explicitly be set to exclude:
![image](./docs/exclude_facet_settings_exclude.png)
You may also want to enable `Hide active items` and `Hide non-narrowing results`
for a cleaner presentation of facets.
## Configure Blocks
For each block type:
- Facet
- Pager
- Advanced Search
There will be **one block** per `View Display`. The block should be limited to
only appear when the view it was derived from is also being displayed on the
same page.
This requires configuring the `visibility` of the block as appropriate. For
collection based searches be sure to limit the display of the Facets block to
the models you want to display the search on, e.g:
![image](./docs/facet_block_settings.png)
### Advanced Search Block
For any valid search field, you can drag / drop and reorder the fields to
display in the advanced search form on. The configuration resides on the block
so this can differ across views / displays if need be. Additionally if the View
the block was derived from has multiple contextual filters you can choose which
one corresponds to direct children, this will enable the recursive search
checkbox.
![image](./docs/advanced_search_block_settings.png)
> N.B. Be aware that the Search views [Exposed Form](#exposed-form) can have an
> affect on the function of the
> [Advanced Search Block](#advanced-search-block). Please refer to that section
> to learn more.
## Documentation
Further documentation for this module is available on the
[Islandora 8 documentation site](https://islandora.github.io/documentation/).
## Troubleshooting/Issues
Having problems or solved a problem? Check out the Islandora google groups for
a solution.
- [Islandora Group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/islandora)
- [Islandora Dev Group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/islandora-dev)
## Maintainers
Current maintainers:
- [Nigel Banks](https://github.com/nigelgbanks)
## Sponsors
- LYRASIS
## Development
If you would like to contribute, please get involved by attending our weekly
[Tech Call](https://github.com/Islandora/documentation/wiki). We love to hear
from you!
If you would like to contribute code to the project, you need to be covered by
an Islandora Foundation
[Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_cla.pdf)
or
[Corporate Contributor License Agreement](http://islandora.ca/sites/default/files/islandora_ccla.pdf).
Please see the [Contributors](http://islandora.ca/resources/contributors) pages
on Islandora.ca for more information.
We recommend using the
[islandora-playbook](https://github.com/Islandora-Devops/islandora-playbook) to
get started.
## License
[GPLv2](http://www.gnu.org/licenses/gpl-2.0.txt)

37
modules/islandora_advanced_search/css/islandora_advanced_search.form.css

@ -1,37 +0,0 @@
.islandora-advanced-search-form .form-type-select {
display: inline-block;
}
.islandora-advanced-search-form .form-type-select__select-wrapper {
width: auto;
}
.islandora-advanced-search-form .form-select {
margin-right: 0.25em;
}
input.islandora-advanced-search-form__add,
input.islandora-advanced-search-form__remove {
display: inline-block;
background: none !important;
border: none;
box-shadow: none;
color: #0c6170;
padding: 0 !important;
text-decoration: none;
margin: 0 0 1rem;
}
input.islandora-advanced-search-form__add:hover,
input.islandora-advanced-search-form__add:focus,
input.islandora-advanced-search-form__remove:hover,
input.islandora-advanced-search-form__remove:focus {
text-decoration: underline;
color: #0c6170;
outline: none;
}
input.islandora-advanced-search-form__reset,
input.islandora-advanced-search-form__search {
display: inline-block;
}

111
modules/islandora_advanced_search/css/islandora_advanced_search.pager.css

@ -1,111 +0,0 @@
.islandora_advanced_search_result_pager .pager__summary {
font-weight: 700;
}
.islandora_advanced_search_result_pager .pager__group {
margin: 1.25rem 0;
padding: 1rem 0;
border-top: 1px solid;
border-bottom: 1px solid;
border-color: #e5e5e5;
display: flex;
justify-content: flex-start;
align-items: center;
flex-flow: row wrap;
}
@media all and (min-width: 45.063em) {
.islandora_advanced_search_result_pager .pager__group {
justify-content: flex-end;
}
.islandora_advanced_search_result_pager .pager__group > * {
margin: 0.47214rem 0 0.47214rem 2.61803rem;
}
.islandora_advanced_search_result_pager .pager__group > *:first-child {
margin-left: 0;
}
}
.islandora_advanced_search_result_pager .pager__group > * {
margin: 0.47214rem 2rem 0.47214rem 0;
}
.islandora_advanced_search_result_pager .pager__group > *:last-child {
margin-right: 0;
}
.islandora_advanced_search_result_pager .pager__group .item-list__list,
.islandora_advanced_search_result_pager .pager__group .item-list__title,
.islandora_advanced_search_result_pager .pager__group .item-list__item {
display: inline;
}
.islandora_advanced_search_result_pager .pager__group .item-list__title {
font-size: initial;
margin: 0.25rem;
}
.pager {
margin: initial;
}
.pager__item {
margin: 0.125rem;
text-align: center;
}
.pager__items {
text-align: right;
}
@media all and (max-width: 45em) {
.pager__items {
text-align: center;
}
}
.pager__items__first-previous,
.pager__items__num-pages,
.pager__items__next-last {
display: inline;
}
.pager__items__first-previous,
.pager__items__next-last {
float: none;
}
.pager__items__first-previous .pager__item,
.pager__items__next-last .pager__item {
display: inline;
}
.pager .pager__link,
.pager__results .pager__link {
display: inline-block;
border-radius: 0.125em;
border: 1px solid;
transition: all, 0.2s, ease-in-out;
min-width: 1.75em;
padding: 0.125rem 0.4375rem 0;
}
.pager .pager__link:focus,
.pager .pager__link:hover,
.pager__results .pager__link:focus,
.pager__results .pager__link:hover {
text-decoration: underline;
}
.pager__display .pager__link {
background-color: #ffffff;
}
.pager__display .pager__link:hover,
.pager__display .pager__link:focus {
background-color: #ffffff;
}
.pager__link--is-active {
text-decoration: underline;
}

BIN
modules/islandora_advanced_search/docs/advanced_search_block_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

BIN
modules/islandora_advanced_search/docs/basic-input.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

BIN
modules/islandora_advanced_search/docs/contextual_filter_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

BIN
modules/islandora_advanced_search/docs/demo.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 KiB

BIN
modules/islandora_advanced_search/docs/enable_index_hierarchy.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

BIN
modules/islandora_advanced_search/docs/enable_index_hierarchy_processor.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
modules/islandora_advanced_search/docs/exclude_facet_settings_exclude.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

BIN
modules/islandora_advanced_search/docs/exclude_facet_settings_url_alias.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

BIN
modules/islandora_advanced_search/docs/facet_block_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

BIN
modules/islandora_advanced_search/docs/field_decedent_of.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

BIN
modules/islandora_advanced_search/docs/include_exclude_facets.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
modules/islandora_advanced_search/docs/include_exclude_facets_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
modules/islandora_advanced_search/docs/islandora_advanced_search_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

BIN
modules/islandora_advanced_search/docs/pager.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

BIN
modules/islandora_advanced_search/docs/pager_settings.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

BIN
modules/islandora_advanced_search/docs/sort_criteria.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

BIN
modules/islandora_advanced_search/docs/view_advanced_setting.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

13
modules/islandora_advanced_search/islandora_advanced_search.info.yml

@ -1,13 +0,0 @@
# This .info.yml files provides the basic information about our module to Drupal
# More: https://www.drupal.org/node/2000204
name: 'Islandora Advanced Search'
description: "Creates an Advanced Search block and other enhancements to search."
type: module
package: Islandora
core_version_requirement: ^9 || ^10
dependencies:
- drupal:facets
- drupal:facets_summary
- drupal:search_api_solr
lifecycle: deprecated
lifecycle_link: https://groups.google.com/g/islandora/c/SEOAWJrfE_M

17
modules/islandora_advanced_search/islandora_advanced_search.libraries.yml

@ -1,17 +0,0 @@
advanced.search.admin:
js:
js/islandora_advanced_search.admin.js: {}
dependencies:
- core/drupal.tabledrag
advanced.search.form:
js:
js/islandora_advanced_search.form.js: {}
css:
component:
css/islandora_advanced_search.form.css: {}
advanced.search.pager:
css:
component:
css/islandora_advanced_search.pager.css: {}

6
modules/islandora_advanced_search/islandora_advanced_search.links.menu.yml

@ -1,6 +0,0 @@
islandora_advanced_search.settings:
title: 'Advanced Search Settings'
route_name: islandora_advanced_search.settings
description: 'Configure Islandora Advanced Search settings'
parent: system.admin_config_islandora
weight: 99

89
modules/islandora_advanced_search/islandora_advanced_search.module

@ -1,89 +0,0 @@
<?php
/**
* @file
* Contains islandora_advanced_search.module.
*
* This file is part of the Islandora Project.
*
* (c) Islandora Foundation
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Drupal\block\Entity\Block;
use Drupal\Core\Form\FormStateInterface;
use Drupal\islandora_advanced_search\AdvancedSearchQuery;
use Drupal\islandora_advanced_search\Utilities;
use Drupal\search_api\Query\QueryInterface as DrupalQueryInterface;
use Drupal\views\ViewExecutable;
use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
/**
* Implements hook_search_api_solr_converted_query_alter().
*/
function islandora_advanced_search_search_api_solr_converted_query_alter(SolariumQueryInterface $solarium_query, DrupalQueryInterface $search_api_query) {
// We must modify the query itself rather than the representation the
// search_api presents as it is not possible to use the 'OR' operator
// with it as it converts conditions into separate filter queries.
// Additionally filter queries do not affect the score so are not
// suitable for use in the advanced search queries.
$advanced_search_query = new AdvancedSearchQuery();
$advanced_search_query->alterQuery(\Drupal::request(), $solarium_query, $search_api_query);
}
/**
* Implements hook_form_form_id_alter().
*/
function islandora_advanced_search_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// Islandora removes this condition from the form, but we require it.
// So we can show blocks for nodes which belong to specific models.
// Allowing us to add a block for collections only.
$visibility = [];
$entity_id = $form['id']['#default_value'];
$block = Block::load($entity_id);
if ($block) {
$visibility = $block->getVisibility();
}
$manager = \Drupal::getContainer()->get('plugin.manager.condition');
$condition_id = 'node_has_term';
/** @var \Drupal\Core\Condition\ConditionInterface $condition */
$condition = $manager->createInstance($condition_id, isset($visibility[$condition_id]) ? $visibility[$condition_id] : []);
$form_state->set(['conditions', $condition_id], $condition);
$condition_form = $condition->buildConfigurationForm([], $form_state);
$condition_form['#type'] = 'details';
$condition_form['#title'] = $condition->getPluginDefinition()['label'];
$condition_form['#group'] = 'visibility_tabs';
// Not all blocks are required to give this field.
$condition_form['term']['#required'] = FALSE;
$form['visibility'][$condition_id] = $condition_form;
}
/**
* Implements hook_preprocess_preprocess_views_view().
*/
function islandora_advanced_search_preprocess_views_view(&$variables) {
/** @var \Drupal\views\ViewExecutable $view */
$view = &$variables['view'];
$views = Utilities::getPagerViewDisplays();
// Only add the toggle class for view display on displays in which the pager
// has been created for.
if (in_array([$view->id(), $view->current_display], $views)) {
// Toggle between 'list' and 'grid' display depending on url parameter.
$format = \Drupal::request()->query->get('display') ?? 'list';
$variables['attributes']['class'][] = "view-{$format}";
$view->element['#attached']['library'][] = 'islandora_advanced_search/advanced.search.pager';
}
$view = &$variables['view'];
}
/**
* Implements hook_views_pre_view().
*/
function islandora_advanced_search_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// Allow for recursive searches by disabling contextual filter.
$advanced_search_query = new AdvancedSearchQuery();
$advanced_search_query->alterView(\Drupal::request(), $view, $display_id);
}

17
modules/islandora_advanced_search/islandora_advanced_search.routing.yml

@ -1,17 +0,0 @@
islandora_advanced_search.ajax.blocks:
path: '/islandora-advanced-search-ajax-blocks'
defaults:
_controller: '\Drupal\islandora_advanced_search\Controller\AjaxBlocksController::respond'
requirements:
# Allow public access to search blocks.
_access: 'TRUE'
islandora_advanced_search.settings:
path: '/admin/config/search/advanced'
defaults:
_form: '\Drupal\islandora_advanced_search\Form\SettingsForm'
_title: 'Islandora Advanced Search Settings'
requirements:
_permission: 'administer site configuration'
options:
_admin_route: TRUE

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save