curation_concerns 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +15 -0
- data/README.md +46 -0
- data/RELEASING.md +2 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/application.js +18 -0
- data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
- data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
- data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
- data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
- data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
- data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
- data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
- data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
- data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
- data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
- data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
- data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
- data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
- data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
- data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
- data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
- data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
- data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
- data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
- data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
- data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +3 -0
- data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
- data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
- data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
- data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
- data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
- data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
- data/app/controllers/curation_concerns/application_controller.rb +7 -0
- data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
- data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
- data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +5 -0
- data/app/controllers/leases_controller.rb +5 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
- data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
- data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
- data/app/helpers/curation_concerns/ability_helper.rb +46 -0
- data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
- data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
- data/app/helpers/curation_concerns/collections_helper.rb +63 -0
- data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
- data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
- data/app/helpers/curation_concerns/lease_helper.rb +18 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
- data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
- data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
- data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
- data/app/helpers/curation_concerns/title_helper.rb +23 -0
- data/app/helpers/curation_concerns/url_helper.rb +29 -0
- data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
- data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
- data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
- data/app/search_builders/curation_concerns/search_builder.rb +49 -0
- data/app/services/curation_concerns/curation_concern.rb +14 -0
- data/app/services/curation_concerns/embargo_service.rb +26 -0
- data/app/services/curation_concerns/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +47 -0
- data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_additional_information.html.erb +6 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_representative_image.html.erb +13 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_form_to_add_member.html.erb +21 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +17 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
- data/app/views/curation_concerns/base/_collections.html.erb +26 -0
- data/app/views/curation_concerns/base/_form.html.erb +25 -0
- data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
- data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
- data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
- data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
- data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
- data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concerns/base/edit.html.erb +13 -0
- data/app/views/curation_concerns/base/new.html.erb +12 -0
- data/app/views/curation_concerns/base/show.html.erb +21 -0
- data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
- data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
- data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
- data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
- data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
- data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
- data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
- data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
- data/app/views/layouts/curation_concerns.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/workers/visibility_copy_worker.rb +30 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/curation_concerns.en.yml +96 -0
- data/config/routes.rb +4 -0
- data/curation_concerns-models/.gitignore +17 -0
- data/curation_concerns-models/Gemfile +4 -0
- data/curation_concerns-models/LICENSE.md +177 -0
- data/curation_concerns-models/README.md +42 -0
- data/curation_concerns-models/Rakefile +1 -0
- data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
- data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
- data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
- data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
- data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
- data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
- data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
- data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
- data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
- data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
- data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
- data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
- data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
- data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
- data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
- data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
- data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
- data/curation_concerns-models/app/models/version_committer.rb +2 -0
- data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
- data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
- data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
- data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
- data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
- data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
- data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
- data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
- data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
- data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
- data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
- data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
- data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
- data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
- data/curation_concerns-models/lib/tasks/resque.rake +13 -0
- data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
- data/curation_concerns.gemspec +46 -0
- data/lib/curation_concerns/configuration.rb +74 -0
- data/lib/curation_concerns/controller_resource.rb +10 -0
- data/lib/curation_concerns/engine.rb +20 -0
- data/lib/curation_concerns/rails/routes.rb +76 -0
- data/lib/curation_concerns/spec_support.rb +10 -0
- data/lib/curation_concerns/version.rb +3 -0
- data/lib/curation_concerns.rb +8 -0
- data/lib/generators/curation_concerns/install_generator.rb +103 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
- data/lib/generators/curation_concerns/work/USAGE +19 -0
- data/lib/generators/curation_concerns/work/templates/README +13 -0
- data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
- data/solr_conf/conf/solrconfig.xml +223 -0
- data/spec/abilities/collection_abilities_spec.rb +48 -0
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
- data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
- data/spec/controllers/catalog_controller_spec.rb +115 -0
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
- data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +51 -0
- data/spec/controllers/embargoes_controller_spec.rb +114 -0
- data/spec/controllers/leases_controller_spec.rb +94 -0
- data/spec/factories/collections.rb +15 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +31 -0
- data/spec/factories/generic_works.rb +54 -0
- data/spec/factories/users.rb +28 -0
- data/spec/features/add_file_spec.rb +30 -0
- data/spec/features/collection_spec.rb +222 -0
- data/spec/features/create_work_spec.rb +43 -0
- data/spec/features/embargo_spec.rb +51 -0
- data/spec/features/lease_spec.rb +49 -0
- data/spec/features/update_file_spec.rb +32 -0
- data/spec/features/work_generator_spec.rb +58 -0
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/charter.docx +0 -0
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/fixtures/image.jp2 +0 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sample_mpeg4.mp4 +0 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/fixtures/spoken-text.m4a +0 -0
- data/spec/fixtures/test4.pdf +0 -0
- data/spec/fixtures/test5.mp3 +0 -0
- data/spec/fixtures/world.png +0 -0
- data/spec/forms/collection_edit_form_spec.rb +20 -0
- data/spec/forms/generic_file_edit_form_spec.rb +33 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/curation_concerns/.keep +0 -0
- data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +22 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
- data/spec/jobs/audit_job_spec.rb +53 -0
- data/spec/jobs/characterize_job_spec.rb +23 -0
- data/spec/jobs/copy_permissions_job_spec.rb +49 -0
- data/spec/jobs/create_derivatives_job_spec.rb +23 -0
- data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
- data/spec/jobs/import_url_job_spec.rb +45 -0
- data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
- data/spec/lib/curation_concerns/messages_spec.rb +70 -0
- data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
- data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/matchers/response_matchers.rb +7 -0
- data/spec/matchers.rb +24 -0
- data/spec/models/checksum_audit_log_spec.rb +66 -0
- data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
- data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
- data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
- data/spec/models/fits_datastream_spec.rb +127 -0
- data/spec/models/generic_file_spec.rb +619 -0
- data/spec/models/generic_work_spec.rb +43 -0
- data/spec/models/user_spec.rb +23 -0
- data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
- data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
- data/spec/routing/curation_concerns/routes_spec.rb +36 -0
- data/spec/routing/route_spec.rb +86 -0
- data/spec/services/characterization_service_spec.rb +30 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/full_text_extraction_service_spec.rb +5 -0
- data/spec/services/generic_file_audit_service_spec.rb +71 -0
- data/spec/services/generic_file_indexing_service_spec.rb +57 -0
- data/spec/services/generic_work_indexing_service_spec.rb +18 -0
- data/spec/services/lease_service_spec.rb +53 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/services/versioning_service_spec.rb +32 -0
- data/spec/spec_helper.rb +94 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concerns/factory_helpers.rb +14 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/tasks/rake_spec.rb +24 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
- data/spec/views/catalog/index.html.erb_spec.rb +59 -0
- data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +70 -0
- data/tasks/jetty.rake +15 -0
- data/tasks/release.rake +93 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- metadata +888 -0
data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFile
|
|
3
|
+
module BelongsToWorks
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
before_destroy :remove_representative_relationship
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def generic_works
|
|
11
|
+
self.parent_objects # parent_objects is provided by Hydra::PCDM::ObjectBehavior
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def generic_work_ids
|
|
15
|
+
generic_works.map { |work| work.id }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Returns the first parent object
|
|
19
|
+
# This is a hack to handle things like GenericFiles inheriting access controls from their parent. (see CurationConcerns::ParentContainer in app/controllers/concerns/curation_concers/parent_container.rb)
|
|
20
|
+
def parent
|
|
21
|
+
self.parent_objects.first
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Returns the id of first parent object
|
|
25
|
+
# This is a hack to handle things like GenericFiles inheriting access controls from their parent. (see CurationConcerns::ParentContainer in app/controllers/concerns/curation_concers/parent_container.rb)
|
|
26
|
+
def parent_id
|
|
27
|
+
parent.id
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Files with sibling relationships
|
|
31
|
+
# Returns all GenericFiles aggregated by any of the GenericWorks that aggregate the current object
|
|
32
|
+
def related_files
|
|
33
|
+
generic_works = self.generic_works
|
|
34
|
+
return [] if generic_works.empty?
|
|
35
|
+
generic_works.flat_map {|work| work.generic_files.select {|generic_file| generic_file.id != self.id } }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# If any parent works are pointing at this object as their representative, remove that pointer.
|
|
39
|
+
def remove_representative_relationship
|
|
40
|
+
generic_works = self.generic_works
|
|
41
|
+
return if generic_works.empty?
|
|
42
|
+
generic_works.each do |work|
|
|
43
|
+
if work.representative == self.id
|
|
44
|
+
work.representative = nil
|
|
45
|
+
work.save
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFile
|
|
3
|
+
module Characterization
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
contains "characterization", class_name: 'FitsDatastream'
|
|
7
|
+
property :mime_type, delegate_to: 'characterization', multiple: false do |index|
|
|
8
|
+
index.as :stored_searchable
|
|
9
|
+
end
|
|
10
|
+
property :format_label, delegate_to: 'characterization'
|
|
11
|
+
property :file_size, delegate_to: 'characterization'
|
|
12
|
+
property :last_modified, delegate_to: 'characterization'
|
|
13
|
+
property :filename, delegate_to: 'characterization'
|
|
14
|
+
property :original_checksum, delegate_to: 'characterization'
|
|
15
|
+
property :rights_basis, delegate_to: 'characterization'
|
|
16
|
+
property :copyright_basis, delegate_to: 'characterization'
|
|
17
|
+
property :copyright_note, delegate_to: 'characterization'
|
|
18
|
+
property :well_formed, delegate_to: 'characterization'
|
|
19
|
+
property :valid, delegate_to: 'characterization'
|
|
20
|
+
property :status_message, delegate_to: 'characterization'
|
|
21
|
+
property :file_title, delegate_to: 'characterization'
|
|
22
|
+
property :file_author, delegate_to: 'characterization'
|
|
23
|
+
property :page_count, delegate_to: 'characterization'
|
|
24
|
+
property :file_language, delegate_to: 'characterization'
|
|
25
|
+
property :word_count, delegate_to: 'characterization'
|
|
26
|
+
property :character_count, delegate_to: 'characterization'
|
|
27
|
+
property :paragraph_count, delegate_to: 'characterization'
|
|
28
|
+
property :line_count, delegate_to: 'characterization'
|
|
29
|
+
property :table_count, delegate_to: 'characterization'
|
|
30
|
+
property :graphics_count, delegate_to: 'characterization'
|
|
31
|
+
property :byte_order, delegate_to: 'characterization'
|
|
32
|
+
property :compression, delegate_to: 'characterization'
|
|
33
|
+
property :color_space, delegate_to: 'characterization'
|
|
34
|
+
property :profile_name, delegate_to: 'characterization'
|
|
35
|
+
property :profile_version, delegate_to: 'characterization'
|
|
36
|
+
property :orientation, delegate_to: 'characterization'
|
|
37
|
+
property :color_map, delegate_to: 'characterization'
|
|
38
|
+
property :image_producer, delegate_to: 'characterization'
|
|
39
|
+
property :capture_device, delegate_to: 'characterization'
|
|
40
|
+
property :scanning_software, delegate_to: 'characterization'
|
|
41
|
+
property :exif_version, delegate_to: 'characterization'
|
|
42
|
+
property :gps_timestamp, delegate_to: 'characterization'
|
|
43
|
+
property :latitude, delegate_to: 'characterization'
|
|
44
|
+
property :longitude, delegate_to: 'characterization'
|
|
45
|
+
property :character_set, delegate_to: 'characterization'
|
|
46
|
+
property :markup_basis, delegate_to: 'characterization'
|
|
47
|
+
property :markup_language, delegate_to: 'characterization'
|
|
48
|
+
property :bit_depth, delegate_to: 'characterization'
|
|
49
|
+
property :channels, delegate_to: 'characterization'
|
|
50
|
+
property :data_format, delegate_to: 'characterization'
|
|
51
|
+
property :offset, delegate_to: 'characterization'
|
|
52
|
+
property :frame_rate, delegate_to: 'characterization'
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def width
|
|
57
|
+
characterization.width.blank? ? characterization.video_width : characterization.width
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def height
|
|
61
|
+
characterization.height.blank? ? characterization.video_height : characterization.height
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def duration
|
|
65
|
+
characterization.duration.blank? ? characterization.video_duration : characterization.duration
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def sample_rate
|
|
69
|
+
characterization.sample_rate.blank? ? characterization.video_sample_rate : characterization.sample_rate
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def characterization_terms
|
|
73
|
+
h = {}
|
|
74
|
+
self.characterization.class.terminology.terms.each_pair do |k, v|
|
|
75
|
+
next unless v.respond_to? :proxied_term
|
|
76
|
+
term = v.proxied_term
|
|
77
|
+
begin
|
|
78
|
+
value = self.send(term.name)
|
|
79
|
+
h[term.name] = value unless value.empty?
|
|
80
|
+
rescue NoMethodError
|
|
81
|
+
next
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
h
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFile
|
|
3
|
+
module Export
|
|
4
|
+
# MIME: 'application/x-endnote-refer'
|
|
5
|
+
def export_as_endnote
|
|
6
|
+
end_note_format = {
|
|
7
|
+
'%T' => [:title, lambda { |x| x.first }],
|
|
8
|
+
'%Q' => [:title, lambda { |x| x.drop(1) }],
|
|
9
|
+
'%A' => [:creator],
|
|
10
|
+
'%C' => [:publication_place],
|
|
11
|
+
'%D' => [:date_created],
|
|
12
|
+
'%8' => [:date_uploaded],
|
|
13
|
+
'%E' => [:contributor],
|
|
14
|
+
'%I' => [:publisher],
|
|
15
|
+
'%J' => [:series_title],
|
|
16
|
+
'%@' => [:isbn],
|
|
17
|
+
'%U' => [:related_url],
|
|
18
|
+
'%7' => [:edition_statement],
|
|
19
|
+
'%R' => [:persistent_url],
|
|
20
|
+
'%X' => [:description],
|
|
21
|
+
'%G' => [:language],
|
|
22
|
+
'%[' => [:date_modified],
|
|
23
|
+
'%9' => [:resource_type],
|
|
24
|
+
'%~' => I18n.t('curation_concerns.product_name'),
|
|
25
|
+
'%W' => I18n.t('curation_concerns.institution_name')
|
|
26
|
+
}
|
|
27
|
+
text = []
|
|
28
|
+
text << "%0 GenericFile"
|
|
29
|
+
end_note_format.each do |endnote_key, mapping|
|
|
30
|
+
if mapping.is_a? String
|
|
31
|
+
values = [mapping]
|
|
32
|
+
else
|
|
33
|
+
values = self.send(mapping[0]) if self.respond_to? mapping[0]
|
|
34
|
+
values = mapping[1].call(values) if mapping.length == 2
|
|
35
|
+
values = Array(values)
|
|
36
|
+
end
|
|
37
|
+
next if values.empty? or values.first.nil?
|
|
38
|
+
spaced_values = values.join("; ")
|
|
39
|
+
text << "#{endnote_key} #{spaced_values}"
|
|
40
|
+
end
|
|
41
|
+
return text.join("\n")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def persistent_url
|
|
45
|
+
"#{CurationConcerns.config.persistent_hostpath}#{id}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# MIME type: 'application/x-openurl-ctx-kev'
|
|
49
|
+
def export_as_openurl_ctx_kev
|
|
50
|
+
export_text = []
|
|
51
|
+
export_text << "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator"
|
|
52
|
+
field_map = {
|
|
53
|
+
title: 'title',
|
|
54
|
+
creator: 'creator',
|
|
55
|
+
subject: 'subject',
|
|
56
|
+
description: 'description',
|
|
57
|
+
publisher: 'publisher',
|
|
58
|
+
contributor: 'contributor',
|
|
59
|
+
date_created: 'date',
|
|
60
|
+
resource_type: 'format',
|
|
61
|
+
identifier: 'identifier',
|
|
62
|
+
language: 'language',
|
|
63
|
+
tag: 'relation',
|
|
64
|
+
based_near: 'coverage',
|
|
65
|
+
rights: 'rights'
|
|
66
|
+
}
|
|
67
|
+
field_map.each do |element, kev|
|
|
68
|
+
values = self.send(element)
|
|
69
|
+
next if values.empty? or values.first.nil?
|
|
70
|
+
values.each do |value|
|
|
71
|
+
export_text << "rft.#{kev}=#{CGI::escape(value.to_s)}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
export_text.join('&') unless export_text.blank?
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def export_as_apa_citation
|
|
78
|
+
text = ''
|
|
79
|
+
authors_list = []
|
|
80
|
+
authors_list_final = []
|
|
81
|
+
|
|
82
|
+
#setup formatted author list
|
|
83
|
+
authors = get_author_list
|
|
84
|
+
authors.each do |author|
|
|
85
|
+
next if author.blank?
|
|
86
|
+
authors_list.push(abbreviate_name(author))
|
|
87
|
+
end
|
|
88
|
+
authors_list.each do |author|
|
|
89
|
+
if author == authors_list.first #first
|
|
90
|
+
authors_list_final.push(author.strip)
|
|
91
|
+
elsif author == authors_list.last #last
|
|
92
|
+
authors_list_final.push(", & " + author.strip)
|
|
93
|
+
else #all others
|
|
94
|
+
authors_list_final.push(", " + author.strip)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
text << authors_list_final.join
|
|
98
|
+
unless text.blank?
|
|
99
|
+
if text[-1,1] != "."
|
|
100
|
+
text << ". "
|
|
101
|
+
else
|
|
102
|
+
text << " "
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
# Get Pub Date
|
|
106
|
+
text << "(" + setup_pub_date + "). " unless setup_pub_date.nil?
|
|
107
|
+
|
|
108
|
+
# setup title info
|
|
109
|
+
title_info = setup_title_info
|
|
110
|
+
text << "<i>" + title_info + "</i> " unless title_info.nil?
|
|
111
|
+
|
|
112
|
+
# Publisher info
|
|
113
|
+
text << setup_pub_info unless setup_pub_info.nil?
|
|
114
|
+
unless text.blank?
|
|
115
|
+
if text[-1,1] != "."
|
|
116
|
+
text += "."
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
text.html_safe
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def export_as_mla_citation
|
|
123
|
+
text = ''
|
|
124
|
+
authors_final = []
|
|
125
|
+
|
|
126
|
+
#setup formatted author list
|
|
127
|
+
authors = get_author_list
|
|
128
|
+
|
|
129
|
+
if authors.length < 4
|
|
130
|
+
authors.each do |author|
|
|
131
|
+
if author == authors.first #first
|
|
132
|
+
authors_final.push(author)
|
|
133
|
+
elsif author == authors.last #last
|
|
134
|
+
authors_final.push(", and " + name_reverse(author) + ".")
|
|
135
|
+
else #all others
|
|
136
|
+
authors_final.push(", " + name_reverse(author))
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
text << authors_final.join
|
|
140
|
+
unless text.blank?
|
|
141
|
+
if text[-1,1] != "."
|
|
142
|
+
text << ". "
|
|
143
|
+
else
|
|
144
|
+
text << " "
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
else
|
|
148
|
+
text << authors.first + ", et al. "
|
|
149
|
+
end
|
|
150
|
+
# setup title
|
|
151
|
+
title_info = setup_title_info
|
|
152
|
+
text << "<i>" + mla_citation_title(title_info) + "</i> " unless title.blank?
|
|
153
|
+
|
|
154
|
+
# Publication
|
|
155
|
+
text << setup_pub_info + ", " unless setup_pub_info.nil?
|
|
156
|
+
|
|
157
|
+
# Get Pub Date
|
|
158
|
+
text << setup_pub_date unless setup_pub_date.nil?
|
|
159
|
+
if text[-1,1] != "."
|
|
160
|
+
text << "." unless text.blank?
|
|
161
|
+
end
|
|
162
|
+
text.html_safe
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def export_as_chicago_citation
|
|
166
|
+
author_text = ""
|
|
167
|
+
authors = get_all_authors
|
|
168
|
+
unless authors.blank?
|
|
169
|
+
if authors.length > 10
|
|
170
|
+
authors.each_with_index do |author, index|
|
|
171
|
+
if index < 7
|
|
172
|
+
if index == 0
|
|
173
|
+
author_text << "#{author}"
|
|
174
|
+
if author.ends_with?(",")
|
|
175
|
+
author_text << " "
|
|
176
|
+
else
|
|
177
|
+
author_text << ", "
|
|
178
|
+
end
|
|
179
|
+
else
|
|
180
|
+
author_text << "#{name_reverse(author)}, "
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
author_text << " et al."
|
|
185
|
+
elsif authors.length > 1
|
|
186
|
+
authors.each_with_index do |author,index|
|
|
187
|
+
if index == 0
|
|
188
|
+
author_text << "#{author}"
|
|
189
|
+
if author.ends_with?(",")
|
|
190
|
+
author_text << " "
|
|
191
|
+
else
|
|
192
|
+
author_text << ", "
|
|
193
|
+
end
|
|
194
|
+
elsif index + 1 == authors.length
|
|
195
|
+
author_text << "and #{name_reverse(author)}."
|
|
196
|
+
else
|
|
197
|
+
author_text << "#{name_reverse(author)}, "
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
else
|
|
201
|
+
author_text << authors.first
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
title_info = ""
|
|
205
|
+
title_info << citation_title(clean_end_punctuation(CGI::escapeHTML(title.first)).strip) unless title.blank?
|
|
206
|
+
|
|
207
|
+
pub_info = ""
|
|
208
|
+
place = self.based_near.first
|
|
209
|
+
publisher = self.publisher.first
|
|
210
|
+
unless place.blank?
|
|
211
|
+
place = CGI::escapeHTML(place)
|
|
212
|
+
pub_info << place
|
|
213
|
+
pub_info << ": " unless publisher.blank?
|
|
214
|
+
end
|
|
215
|
+
unless publisher.blank?
|
|
216
|
+
publisher = CGI::escapeHTML(publisher)
|
|
217
|
+
pub_info << publisher
|
|
218
|
+
pub_info << ", " unless setup_pub_date.nil?
|
|
219
|
+
end
|
|
220
|
+
unless setup_pub_date.nil?
|
|
221
|
+
pub_info << setup_pub_date
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
citation = ""
|
|
225
|
+
citation << "#{author_text} " unless author_text.blank?
|
|
226
|
+
citation << "<i>#{title_info}.</i> " unless title_info.blank?
|
|
227
|
+
citation << "#{pub_info}." unless pub_info.blank?
|
|
228
|
+
citation.html_safe
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
private
|
|
232
|
+
|
|
233
|
+
def setup_pub_date
|
|
234
|
+
first_date = self.date_created.first
|
|
235
|
+
unless first_date.blank?
|
|
236
|
+
first_date = CGI::escapeHTML(first_date)
|
|
237
|
+
date_value = first_date.gsub(/[^0-9|n\.d\.]/, "")[0,4]
|
|
238
|
+
return nil if date_value.nil?
|
|
239
|
+
end
|
|
240
|
+
clean_end_punctuation(date_value) if date_value
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def setup_pub_info
|
|
244
|
+
text = ''
|
|
245
|
+
place = self.based_near.first
|
|
246
|
+
publisher = self.publisher.first
|
|
247
|
+
unless place.blank?
|
|
248
|
+
place = CGI::escapeHTML(place)
|
|
249
|
+
text << place
|
|
250
|
+
text << ": " unless publisher.blank?
|
|
251
|
+
end
|
|
252
|
+
unless publisher.blank?
|
|
253
|
+
publisher = CGI::escapeHTML(publisher)
|
|
254
|
+
text << publisher
|
|
255
|
+
end
|
|
256
|
+
return nil if text.strip.blank?
|
|
257
|
+
clean_end_punctuation(text.strip)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def mla_citation_title(text)
|
|
261
|
+
no_upcase = ["a","an","and","but","by","for","it","of","the","to","with"]
|
|
262
|
+
new_text = []
|
|
263
|
+
word_parts = text.split(" ")
|
|
264
|
+
word_parts.each do |w|
|
|
265
|
+
if !no_upcase.include? w
|
|
266
|
+
new_text.push(w.capitalize)
|
|
267
|
+
else
|
|
268
|
+
new_text.push(w)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
new_text.join(" ")
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def citation_title(title_text)
|
|
275
|
+
prepositions = ["a","about","across","an","and","before","but","by","for","it","of","the","to","with","without"]
|
|
276
|
+
new_text = []
|
|
277
|
+
title_text.split(" ").each_with_index do |word,index|
|
|
278
|
+
if (index == 0 and word != word.upcase) or (word.length > 1 and word != word.upcase and !prepositions.include?(word))
|
|
279
|
+
# the split("-") will handle the capitalization of hyphenated words
|
|
280
|
+
new_text << word.split("-").map!{|w| w.capitalize }.join("-")
|
|
281
|
+
else
|
|
282
|
+
new_text << word
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
new_text.join(" ")
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def setup_title_info
|
|
289
|
+
text = ''
|
|
290
|
+
title = self.title.first
|
|
291
|
+
unless title.blank?
|
|
292
|
+
title = CGI::escapeHTML(title)
|
|
293
|
+
title_info = clean_end_punctuation(title.strip)
|
|
294
|
+
text << title_info
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
return nil if text.strip.blank?
|
|
298
|
+
clean_end_punctuation(text.strip) + "."
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def clean_end_punctuation(text)
|
|
302
|
+
if [".",",",":",";","/"].include? text[-1,1]
|
|
303
|
+
return text[0,text.length-1]
|
|
304
|
+
end
|
|
305
|
+
text
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def get_author_list
|
|
309
|
+
self.creator.map { |author| clean_end_punctuation(CGI::escapeHTML(author)) }.uniq
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
def get_all_authors
|
|
313
|
+
authors = self.creator
|
|
314
|
+
return authors.empty? ? nil : authors.map { |author| CGI::escapeHTML(author) }
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def abbreviate_name(name)
|
|
318
|
+
abbreviated_name = ''
|
|
319
|
+
name = name.join('') if name.is_a? Array
|
|
320
|
+
# make sure we handle "Cher" correctly
|
|
321
|
+
return name if !name.include?(' ') and !name.include?(',')
|
|
322
|
+
surnames_first = name.include?(',')
|
|
323
|
+
delimiter = surnames_first ? ', ' : ' '
|
|
324
|
+
name_segments = name.split(delimiter)
|
|
325
|
+
given_names = surnames_first ? name_segments.last.split(' ') : name_segments.first.split(' ')
|
|
326
|
+
surnames = surnames_first ? name_segments.first.split(' ') : name_segments.last.split(' ')
|
|
327
|
+
abbreviated_name << surnames.join(' ')
|
|
328
|
+
abbreviated_name << ', '
|
|
329
|
+
abbreviated_name << given_names.map { |n| "#{n[0]}." }.join if given_names.is_a? Array
|
|
330
|
+
abbreviated_name << "#{given_names[0]}." if given_names.is_a? String
|
|
331
|
+
abbreviated_name
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def name_reverse(name)
|
|
335
|
+
name = clean_end_punctuation(name)
|
|
336
|
+
return name unless name =~ /,/
|
|
337
|
+
temp_name = name.split(", ")
|
|
338
|
+
return temp_name.last + " " + temp_name.first
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
end
|
|
342
|
+
end
|
|
343
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFile
|
|
3
|
+
module Indexing
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
module ClassMethods
|
|
7
|
+
# override the default indexing service
|
|
8
|
+
def indexer
|
|
9
|
+
CurationConcerns::GenericFileIndexingService
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFile
|
|
3
|
+
module Versions
|
|
4
|
+
@@count = 0
|
|
5
|
+
def record_version_committer(user)
|
|
6
|
+
version = self.latest_version
|
|
7
|
+
# content datastream not (yet?) present
|
|
8
|
+
return if version.nil?
|
|
9
|
+
@@count += 1
|
|
10
|
+
# raise "Recording #{@@count} #{version.uri} for #{user.user_key}" if @@count == 3
|
|
11
|
+
VersionCommitter.create(version_id: version.uri, committer_login: user.user_key)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFileBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
include Hydra::Works::GenericFileBehavior
|
|
5
|
+
include Hydra::Works::GenericFile::VirusCheck
|
|
6
|
+
include Hydra::WithDepositor
|
|
7
|
+
include CurationConcerns::Serializers
|
|
8
|
+
include CurationConcerns::Noid
|
|
9
|
+
include CurationConcerns::Permissions
|
|
10
|
+
include CurationConcerns::GenericFile::Export
|
|
11
|
+
include CurationConcerns::GenericFile::Characterization
|
|
12
|
+
include CurationConcerns::BasicMetadata
|
|
13
|
+
include CurationConcerns::GenericFile::Content
|
|
14
|
+
include CurationConcerns::GenericFile::FullTextIndexing
|
|
15
|
+
include CurationConcerns::GenericFile::Indexing
|
|
16
|
+
include CurationConcerns::GenericFile::BelongsToWorks
|
|
17
|
+
include Hydra::AccessControls::Embargoable
|
|
18
|
+
|
|
19
|
+
included do
|
|
20
|
+
attr_accessor :file
|
|
21
|
+
|
|
22
|
+
# make filename single-value (CurationConcerns::GenericFile::Characterization makes it multivalue)
|
|
23
|
+
def filename
|
|
24
|
+
self[:filename].first
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def human_readable_type
|
|
29
|
+
self.class.to_s.demodulize.titleize
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def representative
|
|
33
|
+
to_param
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_solr(solr_doc = {})
|
|
37
|
+
super(solr_doc).tap do |solr_doc|
|
|
38
|
+
# Enables Riiif to not have to recalculate this each time.
|
|
39
|
+
solr_doc['height_isi'] = Integer(height.first) if height.present?
|
|
40
|
+
solr_doc['width_isi'] = Integer(width.first) if width.present?
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module CurationConcerns::GenericWorkBehavior
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
include Hydra::Works::GenericWorkBehavior
|
|
5
|
+
include ::CurationConcerns::HumanReadableType
|
|
6
|
+
include CurationConcerns::Noid
|
|
7
|
+
include CurationConcerns::Permissions
|
|
8
|
+
include CurationConcerns::Serializers
|
|
9
|
+
include Hydra::WithDepositor
|
|
10
|
+
include Solrizer::Common
|
|
11
|
+
include ::CurationConcerns::HasRepresentative
|
|
12
|
+
include ::CurationConcerns::WithGenericFiles
|
|
13
|
+
include Hydra::AccessControls::Embargoable
|
|
14
|
+
|
|
15
|
+
included do
|
|
16
|
+
property :owner, predicate: RDF::URI.new('http://opaquenamespace.org/ns/hydra/owner'), multiple: false
|
|
17
|
+
class_attribute :human_readable_short_description
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module ClassMethods
|
|
21
|
+
def indexer
|
|
22
|
+
CurationConcerns::GenericWorkIndexingService
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def to_s
|
|
27
|
+
title.join(', ')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns a string identifying the path associated with the object. ActionPack uses this to find a suitable partial to represent the object.
|
|
31
|
+
def to_partial_path
|
|
32
|
+
"curation_concerns/#{super}"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def can_be_member_of_collection?(collection)
|
|
36
|
+
true
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module CurationConcerns::HasRepresentative
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
property :representative, predicate: RDF::URI.new('http://opaquenamespace.org/ns/hydra/representative'), multiple: false
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def to_solr(solr_doc={})
|
|
9
|
+
super.tap do |solr_doc|
|
|
10
|
+
solr_doc[Solrizer.solr_name('representative', :stored_searchable)] = representative
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module HumanReadableType
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
class_attribute :human_readable_short_description, :human_readable_type
|
|
7
|
+
self.human_readable_type = name.demodulize.titleize
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def human_readable_type
|
|
11
|
+
self.class.human_readable_type
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def to_solr(solr_doc={})
|
|
15
|
+
super(solr_doc).tap do |solr_doc|
|
|
16
|
+
solr_doc[Solrizer.solr_name('human_readable_type',:facetable)] = human_readable_type
|
|
17
|
+
solr_doc[Solrizer.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module Permissions
|
|
3
|
+
module Readable
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
def public?
|
|
6
|
+
read_groups.include?('public')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def registered?
|
|
10
|
+
read_groups.include?('registered')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def private?
|
|
14
|
+
!(public? || registered?)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|