hydra-head 3.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +71 -0
- data/.gitmodules +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +257 -0
- data/README.textile +150 -0
- data/README_RAILS3_CHANGES.textile +42 -0
- data/Rakefile +5 -0
- data/TESTING.textile +85 -0
- data/app/controllers/assets_controller.rb +117 -0
- data/app/controllers/contributors_controller.rb +54 -0
- data/app/controllers/file_assets_controller.rb +152 -0
- data/app/controllers/permissions_controller.rb +137 -0
- data/app/controllers/user_sessions_controller.rb +14 -0
- data/app/helpers/article_metadata_helper.rb +80 -0
- data/app/helpers/blacklight_helper.rb +192 -0
- data/app/helpers/downloads_helper.rb +19 -0
- data/app/helpers/generic_content_objects_helper.rb +16 -0
- data/app/helpers/hydra_assets_helper.rb +75 -0
- data/app/helpers/hydra_djatoka_helper.rb +23 -0
- data/app/helpers/hydra_fedora_metadata_helper.rb +365 -0
- data/app/helpers/hydra_helper.rb +155 -0
- data/app/helpers/hydra_uploader_helper.rb +18 -0
- data/app/helpers/inline_editable_metadata_helper.rb +15 -0
- data/app/helpers/javascript_includes_helper.rb +93 -0
- data/app/helpers/release_process_helper.rb +32 -0
- data/app/models/audio_asset.rb +8 -0
- data/app/models/file_asset.rb +111 -0
- data/app/models/generic_content.rb +21 -0
- data/app/models/generic_image.rb +62 -0
- data/app/models/image_asset.rb +8 -0
- data/app/models/mods_asset.rb +6 -0
- data/app/models/role_mapper.rb +22 -0
- data/app/models/superuser.rb +6 -0
- data/app/models/video_asset.rb +8 -0
- data/app/views/_add_assets_links.html.erb +13 -0
- data/app/views/_brown_sidebar.html +15 -0
- data/app/views/_user_util_links.html.erb +31 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints_element.html.erb +34 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_document_list.html.erb +11 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +64 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_email_form.html.erb +9 -0
- data/app/views/catalog/_facets.html.erb +37 -0
- data/app/views/catalog/_flash_msg.html.erb +17 -0
- data/app/views/catalog/_home.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_partials/_default.html.erb +20 -0
- data/app/views/catalog/_index_partials/_default_details.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +15 -0
- data/app/views/catalog/_search_form.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +23 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +12 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +22 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/show.html.erb +48 -0
- data/app/views/contributors/_add_contributor_split_button.html.erb +10 -0
- data/app/views/contributors/_edit_conference.html.erb +29 -0
- data/app/views/contributors/_edit_organization.html.erb +29 -0
- data/app/views/contributors/_edit_person.html.erb +42 -0
- data/app/views/contributors/_index.html.erb +12 -0
- data/app/views/contributors/_new.html.erb +10 -0
- data/app/views/contributors/_show_conference.html.erb +22 -0
- data/app/views/contributors/_show_organization.html.erb +29 -0
- data/app/views/contributors/_show_person.html.erb +17 -0
- data/app/views/contributors/new.html.erb +13 -0
- data/app/views/downloads/index.html.erb +1 -0
- data/app/views/file_assets/_deletable_result.html.erb +5 -0
- data/app/views/file_assets/_index.html.erb +15 -0
- data/app/views/file_assets/_new.html.erb +2 -0
- data/app/views/file_assets/_result.html.erb +16 -0
- data/app/views/file_assets/index.html.erb +5 -0
- data/app/views/fluid_infusion/_uploader.html.erb +81 -0
- data/app/views/fluid_infusion/_uploader_generic_content_objects.js.erb +38 -0
- data/app/views/fluid_infusion/_uploader_js.erb +45 -0
- data/app/views/generic_content_objects/_edit_description.html.erb +50 -0
- data/app/views/generic_content_objects/_new.html.erb +0 -0
- data/app/views/generic_content_objects/_show_description.html.erb +68 -0
- data/app/views/generic_content_objects/contributors/_edit_conference.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_organization.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_person.html.erb +37 -0
- data/app/views/generic_content_objects/contributors/_new.html.erb +10 -0
- data/app/views/generic_content_objects/contributors/_show_conference.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_organization.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_person.html.erb +38 -0
- data/app/views/generic_contents/_edit.html.erb +59 -0
- data/app/views/generic_contents/_index.html.erb +23 -0
- data/app/views/generic_contents/_show.html.erb +18 -0
- data/app/views/generic_contents/_show_content.html.erb +4 -0
- data/app/views/generic_images/_edit.html.erb +59 -0
- data/app/views/generic_images/_index.html.erb +24 -0
- data/app/views/generic_images/_show.html.erb +18 -0
- data/app/views/generic_images/_show_all.html.erb +14 -0
- data/app/views/generic_images/_show_content.html.erb +7 -0
- data/app/views/layouts/application.html.erb +57 -0
- data/app/views/layouts/hydra-head.html.erb +12 -0
- data/app/views/mods_assets/_edit.html.erb +49 -0
- data/app/views/mods_assets/_edit_description.html.erb +82 -0
- data/app/views/mods_assets/_edit_journal.html.erb +72 -0
- data/app/views/mods_assets/_index.html.erb +1 -0
- data/app/views/mods_assets/_index_list.html.erb +37 -0
- data/app/views/mods_assets/_index_table.html.erb +7 -0
- data/app/views/mods_assets/_progress_box.html.erb +82 -0
- data/app/views/mods_assets/_show.html.erb +44 -0
- data/app/views/mods_assets/_show_description.html.erb +44 -0
- data/app/views/mods_assets/_show_journal.html.erb +42 -0
- data/app/views/mods_assets/_show_permissions.html.erb +14 -0
- data/app/views/permissions/_edit_person_permissions.html.erb +35 -0
- data/app/views/permissions/_index.html.erb +55 -0
- data/app/views/permissions/_new.html.erb +18 -0
- data/app/views/permissions/index.html.erb +1 -0
- data/app/views/permissions/new.html.erb +1 -0
- data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
- data/app/views/user_sessions/_login_form.html.erb +10 -0
- data/app/views/user_sessions/logged_out.html.erb +1 -0
- data/config/routes.rb +12 -0
- data/fedora_conf/conf/fedora.fcfg +1021 -0
- data/hydra-head.gemspec +70 -0
- data/lib/application_controller.rb +25 -0
- data/lib/application_helper.rb +2 -0
- data/lib/engine.rb +30 -0
- data/lib/generators/hydra/head_generator.rb +152 -0
- data/lib/generators/hydra/templates/config/fedora.yml +17 -0
- data/lib/generators/hydra/templates/config/initializers/blacklight_config.rb +246 -0
- data/lib/generators/hydra/templates/config/initializers/fedora_config.rb +23 -0
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +29 -0
- data/lib/generators/hydra/templates/config/role_map_cucumber.yml +10 -0
- data/lib/generators/hydra/templates/config/role_map_development.yml +12 -0
- data/lib/generators/hydra/templates/config/role_map_production.yml +2 -0
- data/lib/generators/hydra/templates/config/role_map_test.yml +15 -0
- data/lib/generators/hydra/templates/config/solr.yml +10 -0
- data/lib/generators/hydra/templates/config/solr_mappings.yml +22 -0
- data/lib/generators/hydra/templates/fedora_conf/conf/fedora.fcfg +1021 -0
- data/lib/generators/hydra/templates/migrations/add_user_attributes_table.rb +15 -0
- data/lib/generators/hydra/templates/migrations/create_superusers.rb +12 -0
- data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +118 -0
- data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +332 -0
- data/lib/generators/hydra/templates/solr_conf/solr.xml +35 -0
- data/lib/hydra-head.rb +29 -0
- data/lib/hydra-head/engine.rb +9 -0
- data/lib/hydra-head/routes.rb +87 -0
- data/lib/hydra-head/version.rb +4 -0
- data/lib/hydra.rb +22 -0
- data/lib/hydra/access_controls_enforcement.rb +236 -0
- data/lib/hydra/access_controls_evaluation.rb +97 -0
- data/lib/hydra/assets_controller_helper.rb +144 -0
- data/lib/hydra/catalog.rb +64 -0
- data/lib/hydra/common_mods_index_methods.rb +42 -0
- data/lib/hydra/controller.rb +7 -0
- data/lib/hydra/file_assets_helper.rb +144 -0
- data/lib/hydra/fixtures.rb +43 -0
- data/lib/hydra/generic_content.rb +113 -0
- data/lib/hydra/generic_image.rb +100 -0
- data/lib/hydra/image.rb +177 -0
- data/lib/hydra/model_methods.rb +95 -0
- data/lib/hydra/model_mixins.rb +2 -0
- data/lib/hydra/model_mixins/common_metadata.rb +24 -0
- data/lib/hydra/model_mixins/mods_object.rb +16 -0
- data/lib/hydra/mods_article.rb +505 -0
- data/lib/hydra/mods_dataset.rb +165 -0
- data/lib/hydra/mods_generic_content.rb +494 -0
- data/lib/hydra/mods_image.rb +494 -0
- data/lib/hydra/repository_controller.rb +102 -0
- data/lib/hydra/rights_metadata.rb +189 -0
- data/lib/hydra/superuser_attributes.rb +12 -0
- data/lib/hydra/testing_server.rb +183 -0
- data/lib/hydra/user.rb +22 -0
- data/lib/mediashelf/active_fedora_helper.rb +72 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/hydra-fixtures.rake +184 -0
- data/lib/railties/hydra_jetty.rake +79 -0
- data/lib/railties/hyhead_cucumber.rake +127 -0
- data/lib/railties/hyhead_rspec.rake +137 -0
- data/lib/stanford/searchworks_helper.rb +1338 -0
- data/lib/stanford/solr_helper.rb +108 -0
- data/lib/uva/mods_index_methods.rb +24 -0
- data/solr_conf/conf/schema.xml +122 -0
- data/solr_conf/conf/solrconfig.xml +332 -0
- data/solr_conf/solr.xml +35 -0
- data/tasks/hydra-head-fixtures.rake +54 -0
- data/tasks/hydra-head.rake +247 -0
- data/tasks/hydra_jetty.rake +79 -0
- data/tasks/replicator.rake +27 -0
- data/tasks/solrizer-fedora.rake +53 -0
- data/tasks/solrizer.rake +13 -0
- data/test_support/etc/Gemfile +29 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/button_add_assets.feature +22 -0
- data/test_support/features/button_add_generic_content.feature +11 -0
- data/test_support/features/button_add_image.feature +11 -0
- data/test_support/features/button_add_mods_asset.feature +11 -0
- data/test_support/features/contributor_add.feature +39 -0
- data/test_support/features/file_assets_list.feature +32 -0
- data/test_support/features/file_upload.feature +40 -0
- data/test_support/features/home_page.feature +9 -0
- data/test_support/features/html_validity.feature +47 -0
- data/test_support/features/mods_asset_contributors_edit.feature +80 -0
- data/test_support/features/mods_asset_create.feature +12 -0
- data/test_support/features/mods_asset_edit.feature +33 -0
- data/test_support/features/mods_asset_edit_without_permission.feature +10 -0
- data/test_support/features/mods_asset_search_result.feature +13 -0
- data/test_support/features/mods_asset_show.feature +39 -0
- data/test_support/features/permissions_add.feature +15 -0
- data/test_support/features/permissions_edit.feature +63 -0
- data/test_support/features/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/features/step_definitions/create_asset_steps.rb +7 -0
- data/test_support/features/step_definitions/edit_metadata_steps.rb +73 -0
- data/test_support/features/step_definitions/file_list_steps.rb +28 -0
- data/test_support/features/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/features/step_definitions/hydra_steps.rb +8 -0
- data/test_support/features/step_definitions/inline_editable_edit_steps.rb +77 -0
- data/test_support/features/step_definitions/search_steps.rb +88 -0
- data/test_support/features/step_definitions/searching_steps.rb +22 -0
- data/test_support/features/step_definitions/show_document_steps.rb +85 -0
- data/test_support/features/step_definitions/user_steps.rb +36 -0
- data/test_support/features/step_definitions/web_steps.rb +219 -0
- data/test_support/features/support/env.rb +55 -0
- data/test_support/features/support/paths.rb +80 -0
- data/test_support/features/switch_users.feature +14 -0
- data/test_support/features/view_catalog_index.feature +18 -0
- data/test_support/fixtures/empty_file.txt +0 -0
- data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +1212 -0
- data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
- data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +187 -0
- data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
- data/test_support/fixtures/image.jp2 +0 -0
- data/test_support/fixtures/libra-oa_1.foxml.xml +2324 -0
- data/test_support/fixtures/libra-oa_2.foxml.xml +2422 -0
- data/test_support/spec/controllers/assets_controller_spec.rb +113 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +148 -0
- data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +62 -0
- data/test_support/spec/controllers/contributors_controller_spec.rb +47 -0
- data/test_support/spec/controllers/file_assets_controller_spec.rb +189 -0
- data/test_support/spec/controllers/hydra_controller_spec.rb +15 -0
- data/test_support/spec/controllers/permissions_controller_spec.rb +80 -0
- data/test_support/spec/controllers/user_sessions_controller_spec.rb +35 -0
- data/test_support/spec/generators/hydra-head_generator_spec.rb +14 -0
- data/test_support/spec/helpers/access_controls_enforcement_spec.rb +212 -0
- data/test_support/spec/helpers/access_controls_evaluation_spec.rb +35 -0
- data/test_support/spec/helpers/assets_controller_helper_spec.rb +71 -0
- data/test_support/spec/helpers/blacklight_helper_spec.rb +64 -0
- data/test_support/spec/helpers/file_assets_helper_spec.rb +107 -0
- data/test_support/spec/helpers/hydra-repository_controller_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_assets_helper_spec.rb +195 -0
- data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +215 -0
- data/test_support/spec/helpers/hydra_helper_spec.rb +73 -0
- data/test_support/spec/helpers/hydra_model_methods_spec.rb +95 -0
- data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +18 -0
- data/test_support/spec/helpers/javascript_includes_helper_spec.rb +43 -0
- data/test_support/spec/integration/file_asset_spec.rb +150 -0
- data/test_support/spec/lib/active_fedora_helper_spec.rb +56 -0
- data/test_support/spec/lib/catalog_spec.rb +16 -0
- data/test_support/spec/lib/common_mods_index_methods_spec.rb +28 -0
- data/test_support/spec/models/audio_asset_spec.rb +23 -0
- data/test_support/spec/models/file_asset_spec.rb +42 -0
- data/test_support/spec/models/generic_content_spec.rb +29 -0
- data/test_support/spec/models/generic_image_spec.rb +58 -0
- data/test_support/spec/models/hydra_rights_metadata_spec.rb +162 -0
- data/test_support/spec/models/image_asset_spec.rb +23 -0
- data/test_support/spec/models/mods_asset_spec.rb +29 -0
- data/test_support/spec/models/role_mapper_spec.rb +22 -0
- data/test_support/spec/models/user_spec.rb +52 -0
- data/test_support/spec/models/video_asset_spec.rb +23 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +44 -0
- data/test_support/spec/support/matchers/helper_matcher.rb +14 -0
- data/test_support/spec/support/matchers/solr_matchers.rb +60 -0
- data/test_support/spec/unit/hydra-head-engine_spec.rb +8 -0
- data/test_support/spec/unit/hydra-head_spec.rb +8 -0
- data/test_support/spec/utilities/hydra_testing_server_spec.rb +49 -0
- data/test_support/spec/views/uploader.html.erb_spec.rb +30 -0
- data/vendor/cache/RedCloth-4.2.3.gem +0 -0
- data/vendor/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/actionmailer-3.0.9.gem +0 -0
- data/vendor/cache/actionpack-3.0.9.gem +0 -0
- data/vendor/cache/active-fedora-2.3.3.gem +0 -0
- data/vendor/cache/activemodel-3.0.9.gem +0 -0
- data/vendor/cache/activerecord-3.0.9.gem +0 -0
- data/vendor/cache/activeresource-3.0.9.gem +0 -0
- data/vendor/cache/activesupport-3.0.9.gem +0 -0
- data/vendor/cache/arel-2.0.10.gem +0 -0
- data/vendor/cache/blacklight-3.0.0.gem +0 -0
- data/vendor/cache/block_helpers-0.3.3.gem +0 -0
- data/vendor/cache/builder-2.1.2.gem +0 -0
- data/vendor/cache/capybara-1.0.0.gem +0 -0
- data/vendor/cache/childprocess-0.2.0.gem +0 -0
- data/vendor/cache/columnize-0.3.4.gem +0 -0
- data/vendor/cache/crack-0.1.8.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/cucumber-rails-1.0.2.gem +0 -0
- data/vendor/cache/curb-0.7.15.gem +0 -0
- data/vendor/cache/daemons-1.1.4.gem +0 -0
- data/vendor/cache/database_cleaner-0.6.7.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/equivalent-xml-0.2.7.gem +0 -0
- data/vendor/cache/erubis-2.6.6.gem +0 -0
- data/vendor/cache/facets-2.8.4.gem +0 -0
- data/vendor/cache/factory_girl-1.3.3.gem +0 -0
- data/vendor/cache/fastercsv-1.5.4.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.5.gem +0 -0
- data/vendor/cache/haml-3.1.2.gem +0 -0
- data/vendor/cache/httparty-0.7.8.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/jettywrapper-0.0.10.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/json_pure-1.5.3.gem +0 -0
- data/vendor/cache/kaminari-0.12.4.gem +0 -0
- data/vendor/cache/launchy-2.0.3.gem +0 -0
- data/vendor/cache/linecache-0.46.gem +0 -0
- data/vendor/cache/logger-1.2.8.gem +0 -0
- data/vendor/cache/mail-2.2.19.gem +0 -0
- data/vendor/cache/marc-0.4.3.gem +0 -0
- data/vendor/cache/mediashelf-loggable-0.4.2.gem +0 -0
- data/vendor/cache/mime-types-1.16.gem +0 -0
- data/vendor/cache/mocha-0.9.12.gem +0 -0
- data/vendor/cache/multipart-post-1.1.2.gem +0 -0
- data/vendor/cache/nokogiri-1.5.0.gem +0 -0
- data/vendor/cache/om-1.2.5.gem +0 -0
- data/vendor/cache/polyglot-0.3.1.gem +0 -0
- data/vendor/cache/rack-1.2.3.gem +0 -0
- data/vendor/cache/rack-mount-0.6.14.gem +0 -0
- data/vendor/cache/rack-test-0.5.7.gem +0 -0
- data/vendor/cache/rails-3.0.9.gem +0 -0
- data/vendor/cache/railties-3.0.9.gem +0 -0
- data/vendor/cache/rake-0.9.2.gem +0 -0
- data/vendor/cache/rbx-require-relative-0.0.5.gem +0 -0
- data/vendor/cache/rcov-0.9.9.gem +0 -0
- data/vendor/cache/rdoc-3.8.gem +0 -0
- data/vendor/cache/rsolr-1.0.2.gem +0 -0
- data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
- data/vendor/cache/rspec-2.6.0.gem +0 -0
- data/vendor/cache/rspec-core-2.6.4.gem +0 -0
- data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
- data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
- data/vendor/cache/ruby-debug-0.10.4.gem +0 -0
- data/vendor/cache/ruby-debug-base-0.10.4.gem +0 -0
- data/vendor/cache/rubyzip-0.9.4.gem +0 -0
- data/vendor/cache/sanitize-2.0.3.gem +0 -0
- data/vendor/cache/selenium-webdriver-0.2.2.gem +0 -0
- data/vendor/cache/solr-ruby-0.0.8.gem +0 -0
- data/vendor/cache/solrizer-1.1.0.gem +0 -0
- data/vendor/cache/solrizer-fedora-1.1.0.gem +0 -0
- data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
- data/vendor/cache/stomp-1.1.9.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/treetop-1.4.9.gem +0 -0
- data/vendor/cache/trollop-1.16.2.gem +0 -0
- data/vendor/cache/tzinfo-0.3.29.gem +0 -0
- data/vendor/cache/unicode-0.4.0.gem +0 -0
- data/vendor/cache/will_paginate-2.3.15.gem +0 -0
- data/vendor/cache/xml-simple-1.1.0.gem +0 -0
- data/vendor/cache/xpath-0.1.4.gem +0 -0
- data/vendor/cache/yard-0.7.2.gem +0 -0
- metadata +1110 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'mediashelf/active_fedora_helper'
|
2
|
+
class PermissionsController < ApplicationController
|
3
|
+
include MediaShelf::ActiveFedoraHelper
|
4
|
+
before_filter :require_solr, :require_fedora
|
5
|
+
|
6
|
+
def index
|
7
|
+
@document_fedora=ActiveFedora::Base.load_instance(params[:asset_id])
|
8
|
+
pid = params[:asset_id]
|
9
|
+
dsid = "rightsMetadata"
|
10
|
+
xml_content = @document_fedora.datastreams_in_memory[dsid].content
|
11
|
+
ds = Hydra::RightsMetadata.from_xml(xml_content)
|
12
|
+
ds.pid = pid
|
13
|
+
ds.dsid = dsid
|
14
|
+
@document_fedora.datastreams_in_memory[dsid] = ds
|
15
|
+
|
16
|
+
respond_to do |format|
|
17
|
+
format.html
|
18
|
+
format.inline { render :partial=>"permissions/index.html", :format=>"html" }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def new
|
23
|
+
=begin
|
24
|
+
HYDRA-150
|
25
|
+
Removed from permissions/_new.html.erb
|
26
|
+
<% javascript_includes << ["jquery.form.js", {:plugin=>"hydra-head"}] %>
|
27
|
+
=end
|
28
|
+
respond_to do |format|
|
29
|
+
format.html
|
30
|
+
format.inline { render :partial=>"permissions/new.html" }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def edit
|
35
|
+
@document_fedora=ActiveFedora::Base.load_instance(params[:asset_id])
|
36
|
+
pid = params[:asset_id]
|
37
|
+
dsid = "rightsMetadata"
|
38
|
+
xml_content = @document_fedora.datastreams_in_memory[dsid].content
|
39
|
+
ds = Hydra::RightsMetadata.from_xml(xml_content)
|
40
|
+
ds.pid = pid
|
41
|
+
ds.dsid = dsid
|
42
|
+
@document_fedora.datastreams_in_memory[dsid] = ds
|
43
|
+
|
44
|
+
respond_to do |format|
|
45
|
+
format.html
|
46
|
+
format.inline {render :action=>"edit", :layout=>false}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Create a new permissions entry
|
51
|
+
# expects permission["actor_id"], permission["actor_type"] and permission["access_level"] as params. ie. :permission=>{"actor_id"=>"_person_id_","actor_type"=>"person","access_level"=>"read"}
|
52
|
+
def create
|
53
|
+
pid = params[:asset_id]
|
54
|
+
dsid = "rightsMetadata"
|
55
|
+
# xml_content = Fedora::Repository.instance.fetch_custom(pid, "datastreams/#{dsid}/content")
|
56
|
+
@document_fedora=ActiveFedora::Base.load_instance(params[:asset_id])
|
57
|
+
xml_content = @document_fedora.datastreams_in_memory[dsid].content
|
58
|
+
ds = Hydra::RightsMetadata.from_xml(xml_content)
|
59
|
+
ds.pid = pid
|
60
|
+
ds.dsid = dsid
|
61
|
+
@document_fedora.datastreams_in_memory[dsid] = ds
|
62
|
+
|
63
|
+
access_actor_type = params["permission"]["actor_type"]
|
64
|
+
actor_id = params["permission"]["actor_id"]
|
65
|
+
access_level = params["permission"]["access_level"]
|
66
|
+
|
67
|
+
# update the datastream's values
|
68
|
+
result = ds.permissions({access_actor_type => actor_id}, access_level)
|
69
|
+
|
70
|
+
# Replace the object's datastream with the new updated ds
|
71
|
+
# !! Careful when re-working this. If you init the object, replace the datastream, and call object.save, the datastream might get indexed twice!
|
72
|
+
# FUTURE: ActiveFedora::Base will support this soon:
|
73
|
+
# ActiveFedora::Base.replace_datastream("changeme:25","rightsMetadata", ds).
|
74
|
+
# base_object.replace_datastream("rightsMetadata", ds)
|
75
|
+
ds.pid = pid
|
76
|
+
ds.dsid = dsid
|
77
|
+
ds.save
|
78
|
+
|
79
|
+
# Re-index the object
|
80
|
+
Solrizer::Fedora::Solrizer.new.solrize(pid)
|
81
|
+
|
82
|
+
flash[:notice] = "#{actor_id} has been granted #{access_level} permissions for #{params[:asset_id]}"
|
83
|
+
|
84
|
+
respond_to do |format|
|
85
|
+
format.html { redirect_to :controller=>"permissions", :action=>"index" }
|
86
|
+
format.inline { render :partial=>"permissions/edit_person_permissions", :locals=>{:person_id=>actor_id}}
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# Updates the permissions for all actors in a hash. Can specify as many groups and persons as you want
|
92
|
+
# ie. :permission => {"group"=>{"group1"=>"discover","group2"=>"edit"}, {"person"=>{"person1"=>"read"}}}
|
93
|
+
def update
|
94
|
+
pid = params[:asset_id]
|
95
|
+
dsid = "rightsMetadata"
|
96
|
+
# xml_content = Fedora::Repository.instance.fetch_custom(pid, "datastreams/#{dsid}/content")
|
97
|
+
@document_fedora=ActiveFedora::Base.load_instance(params[:asset_id])
|
98
|
+
xml_content = @document_fedora.datastreams_in_memory[dsid].content
|
99
|
+
ds = Hydra::RightsMetadata.from_xml(xml_content)
|
100
|
+
ds.pid = pid
|
101
|
+
ds.dsid = dsid
|
102
|
+
@document_fedora.datastreams_in_memory[dsid] = ds
|
103
|
+
|
104
|
+
# update the datastream's values
|
105
|
+
result = ds.update_permissions(params[:permission])
|
106
|
+
|
107
|
+
# Replace the object's datastream with the new updated ds
|
108
|
+
# !! Careful when re-working this. If you init the object, replace the datastream, and call object.save, the datastream might get indexed twice!
|
109
|
+
# FUTURE: ActiveFedora::Base will support this soon:
|
110
|
+
# ActiveFedora::Base.replace_datastream("changeme:25","rightsMetadata", ds).
|
111
|
+
# base_object.replace_datastream("rightsMetadata", ds)
|
112
|
+
ds.pid = pid
|
113
|
+
ds.dsid = dsid
|
114
|
+
ds.save
|
115
|
+
|
116
|
+
# Re-index the object
|
117
|
+
Solrizer::Fedora::Solrizer.new.solrize(pid)
|
118
|
+
|
119
|
+
flash[:notice] = "The permissions have been updated."
|
120
|
+
|
121
|
+
respond_to do |format|
|
122
|
+
format.html { redirect_to :controller=>"catalog", :action=>"edit", :id=>params[:asset_id] }
|
123
|
+
format.inline do
|
124
|
+
# This should be replaced ...
|
125
|
+
if params[:permission].has_key?(:group)
|
126
|
+
access_actor_type = "group"
|
127
|
+
else
|
128
|
+
access_actor_type = "person"
|
129
|
+
end
|
130
|
+
actor_id = params["permission"][access_actor_type].first[0]
|
131
|
+
render :partial=>"permissions/edit_person_permissions", :locals=>{:person_id=>actor_id}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class UserSessionsController < ApplicationController
|
2
|
+
# toggle to set superuser_mode in session
|
3
|
+
# Only allows user who can be superusers to set this value in session
|
4
|
+
def superuser
|
5
|
+
if session[:superuser_mode]
|
6
|
+
session[:superuser_mode] = nil
|
7
|
+
elsif current_user.can_be_superuser?
|
8
|
+
session[:superuser_mode] = true
|
9
|
+
end
|
10
|
+
redirect_to :back
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# This was CatalogHelper in the rails2 version of hydra-head
|
2
|
+
module ArticleMetadataHelper
|
3
|
+
|
4
|
+
def format_date date
|
5
|
+
date.strftime("%b. %e, %Y")
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def depositor_string depositor=nil
|
10
|
+
"#{depositor}" unless depositor.nil?
|
11
|
+
end
|
12
|
+
def get_children pid
|
13
|
+
par = solr_facet_params(:is_part_of_s)
|
14
|
+
query="_query_:\"{!dismax qf=$qf_dismax pf=$pf_dismax}is_part_of_s:info\\:fedora/#{pid.gsub(":",'\:')}\""
|
15
|
+
# start query of with user supplied query term
|
16
|
+
#q << "_query_:\"{!dismax qf=$qf_dismax pf=$pf_dismax}#{user_query}\""
|
17
|
+
(response, document_list) = get_search_results( :q=>query )
|
18
|
+
par.inspect
|
19
|
+
end
|
20
|
+
|
21
|
+
def author_list(doc)
|
22
|
+
get_persons_from_roles(doc,['author','collaborator','creator','contributor']).map {|person| format_person_string(person[:first],person[:last],person[:institution])}
|
23
|
+
end
|
24
|
+
|
25
|
+
def researcher_list(doc)
|
26
|
+
get_persons_from_roles(doc,['research team head']).map {|person| format_person_string(person[:first],person[:last],person[:institution])}
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_persons_from_roles(doc,roles,opts={})
|
30
|
+
i = 0
|
31
|
+
persons =[]
|
32
|
+
while i < 10
|
33
|
+
persons_roles = [] # reset the array
|
34
|
+
persons_roles = doc["person_#{i}_role_t"].map{|w|w.strip.downcase} unless doc["person_#{i}_role_t"].nil?
|
35
|
+
if persons_roles and (persons_roles & roles).length > 0
|
36
|
+
persons << {:first => doc["person_#{i}_first_name_t"], :last=> doc["person_#{i}_last_name_t"], :institution => doc["person_#{i}_institution_t"]}
|
37
|
+
end
|
38
|
+
i += 1
|
39
|
+
end
|
40
|
+
return persons
|
41
|
+
end
|
42
|
+
|
43
|
+
def format_person_string first_name, last_name, affiliation, opt={}
|
44
|
+
full_name = [first_name, last_name].join(" ").strip
|
45
|
+
affiliation = affiliation.nil? ? "" : "(#{affiliation})"
|
46
|
+
[full_name, affiliation].join(" ").concat(";")
|
47
|
+
end
|
48
|
+
|
49
|
+
def journal_info(doc)
|
50
|
+
title = doc.get(:journal_title_info_main_title_t)
|
51
|
+
pub_date = doc.get(:journal_issue_publication_date_t)
|
52
|
+
volume = doc.get(:journal_issue_volume_t)
|
53
|
+
issue = doc.get(:journal_issue_volume_t)
|
54
|
+
start_page = doc.get(:journal_issue_pages_start_t)
|
55
|
+
end_page = doc.get(:journal_issue_end_page_t)
|
56
|
+
journal_info = "#{title}. #{pub_date}; #{volume} ( #{issue} ): #{start_page} - #{end_page}"
|
57
|
+
journal_info = "" if journal_info.match(/^\.\s+;\s+\(\s+\)\:\s+-\s*$/)
|
58
|
+
journal_info
|
59
|
+
end
|
60
|
+
|
61
|
+
def short_abstract(doc,max=250)
|
62
|
+
abstract = doc.get(:abstract_t)
|
63
|
+
if abstract.blank?
|
64
|
+
return ""
|
65
|
+
elsif abstract.length < max
|
66
|
+
return abstract
|
67
|
+
else
|
68
|
+
return abstract[0..max].strip.concat("...")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def admin_info(doc)
|
73
|
+
info =<<-EOS
|
74
|
+
Deposited: #{format_date(DateTime.parse(doc.get(:system_create_dt)).to_time)}
|
75
|
+
| By: #{depositor_string(doc.get(:depositor_t))}
|
76
|
+
| Status: Created
|
77
|
+
EOS
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require "hydra_helper"
|
2
|
+
|
3
|
+
module BlacklightHelper
|
4
|
+
require "#{Blacklight.root}/app/helpers/blacklight_helper"
|
5
|
+
#include Stanford::SearchworksHelper
|
6
|
+
#include Stanford::SolrHelper # this is already included by the SearchworksHelper
|
7
|
+
include HydraHelper
|
8
|
+
|
9
|
+
def application_name
|
10
|
+
'A Hydra Head'
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_data_with_linked_label(doc, label, field_string, opts={})
|
14
|
+
|
15
|
+
(opts[:default] and !doc[field_string]) ? field = opts[:default] : field = doc[field_string]
|
16
|
+
delim = opts[:delimiter] ? opts[:delimiter] : "<br/>"
|
17
|
+
if doc[field_string]
|
18
|
+
text = "<dt>#{label}</dt><dd>"
|
19
|
+
if field.respond_to?(:each)
|
20
|
+
text += field.map do |l|
|
21
|
+
linked_label(l, field_string)
|
22
|
+
end.join(delim)
|
23
|
+
else
|
24
|
+
text += linked_label(field, field_string)
|
25
|
+
end
|
26
|
+
text += "</dd>"
|
27
|
+
text
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def linked_label(field, field_string)
|
32
|
+
link_to(field, add_facet_params(field_string, field).merge!({"controller" => "catalog", :action=> "index"}))
|
33
|
+
end
|
34
|
+
def link_to_document(doc, opts={:label=>Blacklight.config[:index][:show_link].to_sym, :counter => nil,:title => nil})
|
35
|
+
label = case opts[:label]
|
36
|
+
when Symbol
|
37
|
+
doc.fetch(opts[:label], "foo")
|
38
|
+
when String
|
39
|
+
opts[:label]
|
40
|
+
else
|
41
|
+
raise 'Invalid label argument'
|
42
|
+
end
|
43
|
+
|
44
|
+
if label.blank?
|
45
|
+
label = doc[:id]
|
46
|
+
end
|
47
|
+
|
48
|
+
link_to_with_data(label, catalog_path(doc[:id]), {:method => :put, :data => {:counter => opts[:counter]},:title=>opts[:title]})
|
49
|
+
end
|
50
|
+
|
51
|
+
# currently only used by the render_document_partial helper method (below)
|
52
|
+
def document_partial_name(document)
|
53
|
+
if !document[Blacklight.config[:show][:display_type]].nil?
|
54
|
+
return document[Blacklight.config[:show][:display_type]].first.gsub("info:fedora/afmodel:","").underscore.pluralize
|
55
|
+
else
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Overriding Blacklight's render_document_partial
|
61
|
+
# given a doc and action_name, this method attempts to render a partial template
|
62
|
+
# based on the value of doc[:format]
|
63
|
+
# if this value is blank (nil/empty) the "default" is used
|
64
|
+
# if the partial is not found, the "default" partial is rendered instead
|
65
|
+
def render_document_partial(doc, action_name, locals={})
|
66
|
+
format = document_partial_name(doc)
|
67
|
+
begin
|
68
|
+
Rails.logger.debug("attempting to render #{format}/_#{action_name}")
|
69
|
+
render :partial=>"#{format}/#{action_name}", :locals=>{:document=>doc}.merge(locals)
|
70
|
+
rescue ActionView::MissingTemplate
|
71
|
+
Rails.logger.debug("rendering default partial catalog/_#{action_name}_partials/default")
|
72
|
+
render :partial=>"catalog/_#{action_name}_partials/default", :locals=>{:document=>doc}.merge(locals)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
###
|
77
|
+
### Overrides pulled in from Libra
|
78
|
+
###
|
79
|
+
|
80
|
+
def render_facet_value(facet_solr_field, item, options ={})
|
81
|
+
if item.is_a? Array
|
82
|
+
link_to_unless(options[:suppress_link], item[0], add_facet_params_and_redirect(facet_solr_field, item[0]), :class=>"facet_select") + " (" + format_num(item[1]) + ")"
|
83
|
+
else
|
84
|
+
link_to_unless(options[:suppress_link], item.value, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " (" + format_num(item.hits) + ")"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# Removing the [remove] link from the default selected facet display
|
89
|
+
def render_selected_facet_value(facet_solr_field, item)
|
90
|
+
'<span class="selected">' +
|
91
|
+
render_facet_value(facet_solr_field, item, :suppress_link => true) +
|
92
|
+
'</span>'
|
93
|
+
end
|
94
|
+
|
95
|
+
def render_complex_facet_value(facet_solr_field, item, options ={})
|
96
|
+
link_to_unless(options[:suppress_link], format_item_value(item.value), add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " (" + format_num(item.hits) + ")"
|
97
|
+
end
|
98
|
+
|
99
|
+
def render_journal_facet_value(facet_solr_field, item, options ={})
|
100
|
+
|
101
|
+
val = item.value.strip.length > 12 ? item.value.strip[0..12].concat("...") : item.value.strip
|
102
|
+
link_to_unless(options[:suppress_link], val, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " (" + format_num(item.hits) + ")"
|
103
|
+
end
|
104
|
+
|
105
|
+
def render_complex_facet_image(facet_solr_field, item, options = {})
|
106
|
+
computing_id = extract_computing_id(item.value)
|
107
|
+
if File.exists?("#{Rails.root}/public/images/faculty_images/#{computing_id}.jpg")
|
108
|
+
img = image_tag "/images/faculty_images/#{computing_id}.jpg", :width=> "100", :alt=>"#{item.value}"
|
109
|
+
else
|
110
|
+
img = image_tag "/plugin_assets/hydra-head/images/default_thumbnail.gif", :width=>"100", :alt=>"#{item.value}"
|
111
|
+
end
|
112
|
+
link_to_unless(options[:suppress_link], img, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select facet_image")
|
113
|
+
end
|
114
|
+
|
115
|
+
def render_journal_image(facet_solr_field, item, options = {})
|
116
|
+
if File.exists?("#{Rails.root}/public/images/journal_images/#{item.value.strip.downcase.gsub(/\s+/,'_')}.jpg")
|
117
|
+
img = image_tag "/images/journal_images/#{item.value.strip.downcase.gsub(/\s+/,'_')}.jpg", :width => "100"
|
118
|
+
else
|
119
|
+
img = image_tag "/plugin_assets/hydra-head/images/default_thumbnail.gif", :width=>"100", :alt=>"#{item.value}"
|
120
|
+
end
|
121
|
+
|
122
|
+
link_to_unless(options[:suppress_link], img, add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select")
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_randomized_display_items items
|
126
|
+
clean_items = items.each.inject([]) do |array, item|
|
127
|
+
array << item unless item.value.strip.blank?
|
128
|
+
array
|
129
|
+
end
|
130
|
+
|
131
|
+
if clean_items.length < 6
|
132
|
+
clean_items.sort_by {|item| item.value }
|
133
|
+
else
|
134
|
+
rdi = clean_items.sort_by {rand}.slice(0..5)
|
135
|
+
return rdi.sort_by {|item| item.value.downcase}
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
def extract_computing_id val
|
141
|
+
cid = val.split(" ")[-1]
|
142
|
+
cid[1..cid.length-2]
|
143
|
+
end
|
144
|
+
|
145
|
+
def format_item_value val
|
146
|
+
begin
|
147
|
+
last, f_c = val.split(", ")
|
148
|
+
first = f_c.split(" (")[0]
|
149
|
+
rescue
|
150
|
+
return val.nil? ? "" : val
|
151
|
+
end
|
152
|
+
[last, "#{first[0..0]}."].join(", ")
|
153
|
+
end
|
154
|
+
|
155
|
+
def render_head_content
|
156
|
+
render_stylesheet_includes +
|
157
|
+
render_js_includes +
|
158
|
+
render_extra_head_content +
|
159
|
+
content_for(:head)
|
160
|
+
end
|
161
|
+
|
162
|
+
# COPIED from vendor/plugins/blacklight/app/helpers/application_helper.rb
|
163
|
+
# Used in catalog/facet action, facets.rb view, for a click
|
164
|
+
# on a facet value. Add on the facet params to existing
|
165
|
+
# search constraints. Remove any paginator-specific request
|
166
|
+
# params, or other request params that should be removed
|
167
|
+
# for a 'fresh' display.
|
168
|
+
# Change the action to 'index' to send them back to
|
169
|
+
# catalog/index with their new facet choice.
|
170
|
+
def add_facet_params_and_redirect(field, value)
|
171
|
+
new_params = add_facet_params(field, value)
|
172
|
+
|
173
|
+
# Delete page, if needed.
|
174
|
+
new_params.delete(:page)
|
175
|
+
|
176
|
+
# Delete :qt, if needed - added to resolve NPE errors
|
177
|
+
new_params.delete(:qt)
|
178
|
+
|
179
|
+
# Delete any request params from facet-specific action, needed
|
180
|
+
# to redir to index action properly.
|
181
|
+
Blacklight::Solr::FacetPaginator.request_keys.values.each do |paginator_key|
|
182
|
+
new_params.delete(paginator_key)
|
183
|
+
end
|
184
|
+
new_params.delete(:id)
|
185
|
+
|
186
|
+
# Force action to be index.
|
187
|
+
new_params[:action] = "index"
|
188
|
+
|
189
|
+
new_params
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module DownloadsHelper
|
2
|
+
|
3
|
+
def list_downloadables( datastreams, mime_types=["application/pdf"])
|
4
|
+
result = "<ul>"
|
5
|
+
|
6
|
+
datastreams.each_value do |ds|
|
7
|
+
result << "<li>"
|
8
|
+
result << link_to(ds.label, asset_downloads_path(ds.pid, :download_id=>ds.dsid))
|
9
|
+
# if editor?
|
10
|
+
# result << " <span>#{ds.attributes["mimeType"]}</span>"
|
11
|
+
# end
|
12
|
+
result << "</li>"
|
13
|
+
end
|
14
|
+
|
15
|
+
result << "</ul>"
|
16
|
+
return result
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module GenericContentObjectsHelper
|
2
|
+
|
3
|
+
def datastream_disseminator_url pid, datastream_name
|
4
|
+
begin
|
5
|
+
base_url = Fedora::Repository.instance.send(:connection).site.to_s
|
6
|
+
rescue
|
7
|
+
base_url = "http://localhost:8983/fedora"
|
8
|
+
end
|
9
|
+
"#{base_url}/get/#{pid}/#{datastream_name}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def disseminator_link pid, datastream_name
|
13
|
+
"<a class=\"fbImage\" href=\"#{ datastream_disseminator_url(pid, datastream_name) }\">view</a>"
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|