curate 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +14 -0
- data/app/controllers/application_controller.rb +69 -0
- data/app/controllers/catalog_controller.rb +336 -0
- data/app/controllers/classify_concerns_controller.rb +29 -0
- data/app/controllers/common_objects_controller.rb +27 -0
- data/app/controllers/curation_concern/base_controller.rb +26 -0
- data/app/controllers/curation_concern/generic_files_controller.rb +82 -0
- data/app/controllers/dashboard_controller.rb +85 -0
- data/app/controllers/downloads_controller.rb +22 -0
- data/app/controllers/errors_controller.rb +19 -0
- data/app/controllers/help_requests_controller.rb +38 -0
- data/app/controllers/terms_of_service_agreements_controller.rb +44 -0
- data/app/controllers/welcome_controller.rb +14 -0
- data/app/helpers/application_helper.rb +89 -0
- data/app/helpers/blacklight_helper.rb +19 -0
- data/app/helpers/common_objects_helper.rb +5 -0
- data/app/inputs/multi_value_input.rb +71 -0
- data/app/models/access_right.rb +53 -0
- data/app/models/classify_concern.rb +30 -0
- data/app/models/contributor_agreement.rb +58 -0
- data/app/models/digital_object_identifier.rb +83 -0
- data/app/models/doi_config.rb +26 -0
- data/app/models/help_request.rb +34 -0
- data/app/models/mint_doi.rb +51 -0
- data/app/models/mint_purl.rb +40 -0
- data/app/models/object_access.rb +17 -0
- data/app/models/purl.rb +18 -0
- data/app/models/purl_config.rb +10 -0
- data/app/models/repo_object.rb +24 -0
- data/app/models/solr_document.rb +35 -0
- data/app/repository_datastreams/file_content_datastream.rb +36 -0
- data/app/repository_models/curation_concern/embargoable.rb +43 -0
- data/app/repository_models/curation_concern/with_access_right.rb +31 -0
- data/app/repository_models/generic_file.rb +36 -0
- data/app/services/anti_virus_scanner.rb +28 -0
- data/app/services/curation_concern.rb +22 -0
- data/app/services/curation_concern/base_actor.rb +48 -0
- data/app/services/curation_concern/generic_file_actor.rb +38 -0
- data/app/validators/future_date_validator.rb +19 -0
- data/app/views/_footer.html.erb +19 -0
- data/app/views/_ga.html.erb +6 -0
- data/app/views/_logo.html.erb +34 -0
- data/app/views/_masthead.html.erb +34 -0
- data/app/views/catalog/_bookmark_control.html.erb +25 -0
- data/app/views/catalog/_bookmark_form.html.erb +8 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints.html.erb +6 -0
- data/app/views/catalog/_constraints_element.html.erb +20 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_did_you_mean.html.erb +10 -0
- data/app/views/catalog/_document.html.erb +19 -0
- data/app/views/catalog/_document_list.html.erb +2 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +58 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +13 -0
- data/app/views/catalog/_email_form.html.erb +11 -0
- data/app/views/catalog/_facet_layout.html.erb +12 -0
- data/app/views/catalog/_facet_limit.html.erb +19 -0
- data/app/views/catalog/_facet_selected.html.erb +12 -0
- data/app/views/catalog/_facets.html.erb +5 -0
- data/app/views/catalog/_folder_control.html.erb +12 -0
- data/app/views/catalog/_home.html.erb +2 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_default.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +37 -0
- data/app/views/catalog/_marc_view.html.erb +33 -0
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -0
- data/app/views/catalog/_previous_next_doc.html.erb +6 -0
- data/app/views/catalog/_refworks_form.html.erb +7 -0
- data/app/views/catalog/_results_pagination.html.erb +6 -0
- data/app/views/catalog/_search_form.html.erb +20 -0
- data/app/views/catalog/_show_default.html.erb +9 -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/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_tools.html.erb +46 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +38 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/citation.html.erb +1 -0
- data/app/views/catalog/email.erb +1 -0
- data/app/views/catalog/endnote.endnote.erb +1 -0
- data/app/views/catalog/index.atom.builder +109 -0
- data/app/views/catalog/index.html.erb +55 -0
- data/app/views/catalog/index.rss.builder +19 -0
- data/app/views/catalog/librarian_view.html.erb +3 -0
- data/app/views/catalog/opensearch.json.erb +0 -0
- data/app/views/catalog/opensearch.xml.builder +10 -0
- data/app/views/catalog/send_email_record.erb +0 -0
- data/app/views/catalog/show.endnote.erb +1 -0
- data/app/views/catalog/show.html.erb +40 -0
- data/app/views/catalog/show.refworks.erb +1 -0
- data/app/views/catalog/sms.erb +1 -0
- data/app/views/classify_concerns/new.html.erb +24 -0
- data/app/views/common_objects/_generic_file.html.erb +0 -0
- data/app/views/common_objects/_senior_thesis.html.erb +2 -0
- data/app/views/common_objects/show.html.erb +11 -0
- data/app/views/common_objects/show_stub_information.html.erb +13 -0
- data/app/views/curation_concern/_content_license.html.erb +16 -0
- data/app/views/curation_concern/_contributor_agreement.html.erb +27 -0
- data/app/views/curation_concern/_doi.html.erb +43 -0
- data/app/views/curation_concern/_media_display.html.erb +1 -0
- data/app/views/curation_concern/_permission.html.erb +39 -0
- data/app/views/curation_concern/_related_files.html.erb +46 -0
- data/app/views/curation_concern/generic_files/_attributes.html.erb +63 -0
- data/app/views/curation_concern/generic_files/_form.html.erb +57 -0
- data/app/views/curation_concern/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concern/generic_files/new.html.erb +5 -0
- data/app/views/curation_concern/generic_files/show.html.erb +12 -0
- data/app/views/curation_concern/senior_theses/_attributes.html.erb +13 -0
- data/app/views/curation_concern/senior_theses/_form.html.erb +88 -0
- data/app/views/curation_concern/senior_theses/edit.html.erb +15 -0
- data/app/views/curation_concern/senior_theses/new.html.erb +14 -0
- data/app/views/curation_concern/senior_theses/show.html.erb +18 -0
- data/app/views/dashboard/_constraints.html.erb +22 -0
- data/app/views/dashboard/_did_you_mean.html.erb +26 -0
- data/app/views/dashboard/_document_list.html.erb +20 -0
- data/app/views/dashboard/_facet_layout.html.erb +27 -0
- data/app/views/dashboard/_facet_limit.html.erb +35 -0
- data/app/views/dashboard/_facet_pagination.html.erb +25 -0
- data/app/views/dashboard/_facet_selected.html.erb +28 -0
- data/app/views/dashboard/_facets.html.erb +22 -0
- data/app/views/dashboard/_index_partials/_default_group.html.erb +37 -0
- data/app/views/dashboard/_index_partials/_list_files.html.erb +66 -0
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +0 -0
- data/app/views/dashboard/_results_pagination.html.erb +22 -0
- data/app/views/dashboard/_search_form.html.erb +36 -0
- data/app/views/dashboard/_show_partials/_default.html.erb +38 -0
- data/app/views/dashboard/_show_partials/_default_details.html.erb +31 -0
- data/app/views/dashboard/_show_partials/_facets.html.erb +103 -0
- data/app/views/dashboard/_sort_and_per_page.html.erb +18 -0
- data/app/views/dashboard/facet.html.erb +38 -0
- data/app/views/dashboard/get_related_file.html.erb +4 -0
- data/app/views/dashboard/index.html.erb +60 -0
- data/app/views/errors/401.html.erb +5 -0
- data/app/views/errors/404.html.erb +16 -0
- data/app/views/errors/500.html.erb +10 -0
- data/app/views/help_requests/new.html.erb +60 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/layouts/boilerplate.html.erb +28 -0
- data/app/views/layouts/common_objects.html.erb +45 -0
- data/app/views/layouts/curate_nd.html.erb +55 -0
- data/app/views/layouts/curate_nd/1_column.html.erb +22 -0
- data/app/views/layouts/curate_nd/2_column.html.erb +26 -0
- data/app/views/layouts/curate_nd/catalog.html.erb +22 -0
- data/app/views/layouts/curate_nd/dashboard.html.erb +22 -0
- data/app/views/layouts/hydra-head.html.erb +95 -0
- data/app/views/shared/_action_bar.html.erb +30 -0
- data/app/views/shared/_flash_message.html.erb +9 -0
- data/app/views/shared/_site_search.html.erb +18 -0
- data/app/views/terms_of_service_agreements/new.html.erb +136 -0
- data/app/views/welcome/index.html.erb +21 -0
- data/app/workers/characterize_job.rb +4 -0
- data/app/workers/doi_worker.rb +16 -0
- data/config/routes.rb +35 -0
- data/lib/curate.rb +6 -0
- data/lib/curate/engine.rb +46 -0
- data/lib/curate/version.rb +1 -1
- data/spec/abilities/generic_file_abilities_spec.rb +55 -0
- data/spec/controllers/application_controller_spec.rb +38 -0
- data/spec/controllers/classify_concerns_controller_spec.rb +36 -0
- data/spec/controllers/common_objects_controller_spec.rb +112 -0
- data/spec/controllers/curation_concern/base_controller_spec.rb +14 -0
- data/spec/controllers/curation_concern/generic_files_controller_spec.rb +156 -0
- data/spec/controllers/dashboard_controller_spec.rb +85 -0
- data/spec/controllers/downloads_controller_spec.rb +42 -0
- data/spec/controllers/help_requests_controller_spec.rb +42 -0
- data/spec/controllers/terms_of_service_agreements_controller_spec.rb +30 -0
- data/spec/controllers/welcome_controller_spec.rb +10 -0
- data/spec/dummy/app/models/solr_document.rb +4 -0
- data/spec/dummy/app/models/user.rb +13 -0
- data/spec/dummy/config/application.rb +8 -1
- data/spec/dummy/config/database.yml +21 -22
- data/spec/dummy/config/doi.yml +11 -0
- data/spec/dummy/config/fedora.yml +20 -0
- data/spec/dummy/config/initializers/devise.rb +232 -0
- data/spec/dummy/config/initializers/hydra_config.rb +41 -0
- data/spec/dummy/config/initializers/mailboxer.rb +17 -0
- data/spec/dummy/config/initializers/redis_config.rb +45 -0
- data/spec/dummy/config/initializers/sufia.rb +66 -0
- data/spec/dummy/config/purl.yml +15 -0
- data/spec/dummy/config/redis.yml +6 -0
- data/spec/dummy/config/role_map_ci.yml +15 -0
- data/spec/dummy/config/role_map_cucumber.yml +10 -0
- data/spec/dummy/config/role_map_development.yml +12 -0
- data/spec/dummy/config/role_map_pre_production.yml +2 -0
- data/spec/dummy/config/role_map_production.yml +2 -0
- data/spec/dummy/config/role_map_test.yml +15 -0
- data/spec/dummy/config/routes.rb +4 -55
- data/spec/dummy/config/solr.yml +17 -0
- data/spec/dummy/db/migrate/20130130142162_create_purl.rb +55 -0
- data/spec/dummy/db/migrate/20130312135359_create_help_requests.rb +22 -0
- data/spec/dummy/db/migrate/20130408165008_create_users.rb +11 -0
- data/spec/dummy/db/migrate/20130408165009_acts_as_follower_migration.rb +31 -0
- data/spec/dummy/db/migrate/20130408165010_add_social_to_users.rb +27 -0
- data/spec/dummy/db/migrate/20130408165011_create_single_use_links.rb +12 -0
- data/spec/dummy/db/migrate/20130408165012_add_ldap_attrs_to_user.rb +41 -0
- data/spec/dummy/db/migrate/20130408165013_add_avatars_to_users.rb +23 -0
- data/spec/dummy/db/migrate/20130408165014_create_checksum_audit_logs.rb +34 -0
- data/spec/dummy/db/migrate/20130408165015_create_version_committers.rb +29 -0
- data/spec/dummy/db/migrate/20130408165016_add_groups_to_users.rb +25 -0
- data/spec/dummy/db/migrate/20130408165017_create_local_authorities.rb +64 -0
- data/spec/dummy/db/migrate/20130408165018_create_trophies.rb +10 -0
- data/spec/dummy/db/migrate/20130408165022_create_mailboxer.mailboxer_engine.rb +62 -0
- data/spec/dummy/db/migrate/20130408165023_add_notified_object.mailboxer_engine.rb +18 -0
- data/spec/dummy/db/migrate/20130408165024_add_notification_code.mailboxer_engine.rb +14 -0
- data/spec/dummy/db/migrate/20130408165025_add_attachments.mailboxer_engine.rb +10 -0
- data/spec/dummy/db/migrate/20130408165026_rename_receipts_read.mailboxer_engine.rb +10 -0
- data/spec/dummy/db/schema.rb +197 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/fedora_conf/conf/development/fedora.fcfg +953 -0
- data/spec/dummy/fedora_conf/conf/test/fedora.fcfg +953 -0
- data/spec/dummy/log/development.log +1791 -0
- data/spec/dummy/log/test.log +176333 -0
- data/spec/dummy/solr_conf/conf/schema.xml +692 -0
- data/spec/dummy/solr_conf/conf/solrconfig.xml +299 -0
- data/spec/dummy/solr_conf/solr.xml +35 -0
- data/spec/factories/create_curation_concern.rb +11 -0
- data/spec/factories/create_generic_file.rb +36 -0
- data/spec/factories/help_requests.rb +10 -0
- data/spec/factories/mock_curation_concerns.rb +4 -0
- data/spec/factories/users.rb +8 -0
- data/spec/helpers/application_helper_spec.rb +139 -0
- data/spec/helpers/common_objects_helper_spec.rb +9 -0
- data/spec/models/access_right_spec.rb +47 -0
- data/spec/models/classify_concern_spec.rb +30 -0
- data/spec/models/contributor_agreement_spec.rb +45 -0
- data/spec/models/digital_object_identifier_spec.rb +50 -0
- data/spec/models/help_request_spec.rb +5 -0
- data/spec/models/mint_doi_spec.rb +79 -0
- data/spec/models/mint_purl_spec.rb +38 -0
- data/spec/models/object_access_spec.rb +24 -0
- data/spec/models/purl_spec.rb +22 -0
- data/spec/models/repo_object_spec.rb +39 -0
- data/spec/repository_models/curation_concern/embargoable_spec.rb +69 -0
- data/spec/repository_models/generic_file_spec.rb +38 -0
- data/spec/services/anti_virus_scanner_spec.rb +26 -0
- data/spec/services/curation_concern/base_actor_spec.rb +28 -0
- data/spec/services/curation_concern/generic_file_actor_spec.rb +75 -0
- data/spec/services/curation_concern_spec.rb +34 -0
- data/spec/spec_helper.rb +54 -1
- data/spec/support/environment_override.rb +17 -0
- data/spec/support/matchers/raise_rescue_response_type_matcher.rb +42 -0
- data/spec/support/mock_curation_concern.rb +61 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +9 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +33 -0
- data/spec/workers/characterize_job_spec.rb +26 -0
- metadata +686 -10
- data/MIT-LICENSE +0 -20
@@ -0,0 +1,19 @@
|
|
1
|
+
require Blacklight::Engine.root.join('app/helpers/blacklight/hash_as_hidden_fields_helper_behavior')
|
2
|
+
require Blacklight::Engine.root.join('app/helpers/blacklight/render_constraints_helper_behavior')
|
3
|
+
require Blacklight::Engine.root.join('app/helpers/blacklight/html_head_helper_behavior')
|
4
|
+
require Blacklight::Engine.root.join('app/helpers/blacklight/facets_helper_behavior')
|
5
|
+
|
6
|
+
require Blacklight::Engine.root.join('app/helpers/hash_as_hidden_fields_helper')
|
7
|
+
require Blacklight::Engine.root.join('app/helpers/render_constraints_helper')
|
8
|
+
require Blacklight::Engine.root.join('app/helpers/html_head_helper')
|
9
|
+
require Blacklight::Engine.root.join('app/helpers/facets_helper')
|
10
|
+
|
11
|
+
require Blacklight::Engine.root.join('app/helpers/blacklight/blacklight_helper_behavior')
|
12
|
+
|
13
|
+
module BlacklightHelper
|
14
|
+
include Blacklight::BlacklightHelperBehavior
|
15
|
+
|
16
|
+
def application_name
|
17
|
+
"CurateND"
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
class MultiValueInput < SimpleForm::Inputs::CollectionInput
|
3
|
+
def input
|
4
|
+
input_html_classes.unshift("string")
|
5
|
+
input_html_options[:type] ||= 'text'
|
6
|
+
input_html_options[:name] ||= "#{object_name}[#{attribute_name}][]"
|
7
|
+
markup = <<-HTML
|
8
|
+
|
9
|
+
|
10
|
+
<ul class="listing">
|
11
|
+
HTML
|
12
|
+
|
13
|
+
collection.each do |value|
|
14
|
+
unless value.to_s.strip.blank?
|
15
|
+
markup << <<-HTML
|
16
|
+
<li class="field-wrapper">
|
17
|
+
#{build_text_field(value)}
|
18
|
+
</li>
|
19
|
+
HTML
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
markup << <<-HTML
|
24
|
+
<li class="field-wrapper">
|
25
|
+
#{build_text_field('')}
|
26
|
+
</li>
|
27
|
+
</ul>
|
28
|
+
|
29
|
+
HTML
|
30
|
+
end
|
31
|
+
|
32
|
+
# NOTE: There is a one to many relationship between the label and the input
|
33
|
+
# elements. Because of this we can't use the "for" attribute on the label
|
34
|
+
# point to the "id" of the input. Instead we use the "aria-labelledby"
|
35
|
+
# attribute on the input to point to the "id" on the label.
|
36
|
+
#
|
37
|
+
# It would be _better_ to use @builder construct the element but the proper
|
38
|
+
# syntax escapes me.
|
39
|
+
def label
|
40
|
+
<<-HTML
|
41
|
+
|
42
|
+
<label id="#{label_id}" class="string #{label_classes}">#{attribute_name.to_s.titleize}</label>
|
43
|
+
HTML
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def label_id
|
49
|
+
"#{object_name}_#{attribute_name}_label"
|
50
|
+
end
|
51
|
+
|
52
|
+
def label_classes
|
53
|
+
label_html_options[:class].map{|c| c.to_s}.join(' ')
|
54
|
+
end
|
55
|
+
|
56
|
+
def build_text_field(value)
|
57
|
+
input_html_options[:value] = value
|
58
|
+
input_html_options[:id] = nil
|
59
|
+
input_html_options[:class] = "#{object_name}_#{attribute_name}"
|
60
|
+
input_html_options[:'aria-labelledby'] = label_id
|
61
|
+
@builder.text_field(attribute_name, input_html_options)
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
def collection
|
66
|
+
@collection ||= begin
|
67
|
+
object.send(attribute_name)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
def multiple?; true; end
|
71
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'method_decorators/precondition'
|
2
|
+
|
3
|
+
class AccessRight
|
4
|
+
PERMISSION_TEXT_VALUE_PUBLIC = 'public'.freeze
|
5
|
+
PERMISSION_TEXT_VALUE_AUTHENTICATED = 'registered'.freeze
|
6
|
+
VISIBILITY_TEXT_VALUE_PUBLIC = 'open'.freeze
|
7
|
+
VISIBILITY_TEXT_VALUE_AUTHENTICATED = 'psu'.freeze
|
8
|
+
VISIBILITY_TEXT_VALUE_PRIVATE = 'restricted'.freeze
|
9
|
+
|
10
|
+
extend MethodDecorators
|
11
|
+
+MethodDecorators::Precondition.new { |permissionable|
|
12
|
+
permissionable.respond_to?(:visibility) &&
|
13
|
+
permissionable.respond_to?(:persisted?) &&
|
14
|
+
permissionable.respond_to?(:permissions) &&
|
15
|
+
permissionable.permissions.respond_to?(:map)
|
16
|
+
}
|
17
|
+
def initialize(permissionable)
|
18
|
+
@permissionable = permissionable
|
19
|
+
end
|
20
|
+
|
21
|
+
extend Forwardable
|
22
|
+
def_delegators :permissionable, :persisted?, :permissions, :visibility
|
23
|
+
protected :persisted?, :permissions, :visibility
|
24
|
+
|
25
|
+
attr_reader :permissionable
|
26
|
+
|
27
|
+
def open_access?
|
28
|
+
return true if has_visibility_text_for?(VISIBILITY_TEXT_VALUE_PUBLIC)
|
29
|
+
if persisted?
|
30
|
+
has_permission_text_for?(PERMISSION_TEXT_VALUE_PUBLIC)
|
31
|
+
else
|
32
|
+
visibility.to_s == ''
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def authenticated_only?
|
37
|
+
return false if open_access?
|
38
|
+
has_permission_text_for?(PERMISSION_TEXT_VALUE_AUTHENTICATED) ||
|
39
|
+
has_visibility_text_for?(VISIBILITY_TEXT_VALUE_AUTHENTICATED)
|
40
|
+
end
|
41
|
+
|
42
|
+
def private?
|
43
|
+
!open_access? && !authenticated_only?
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def has_visibility_text_for?(text)
|
48
|
+
visibility == text
|
49
|
+
end
|
50
|
+
def has_permission_text_for?(text)
|
51
|
+
!!permissions.detect { |perm| perm[:name] == text }
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'active_attr'
|
2
|
+
class ClassifyConcern
|
3
|
+
# @TODO - This should be part of the application configuration
|
4
|
+
# or detected on load
|
5
|
+
VALID_CURATION_CONCERNS = {
|
6
|
+
'Mock Curation Concern' => 'MockCurationConcern'
|
7
|
+
}
|
8
|
+
include ActiveAttr::Model
|
9
|
+
attribute :curation_concern_type
|
10
|
+
|
11
|
+
validates(
|
12
|
+
:curation_concern_type,
|
13
|
+
presence: true,
|
14
|
+
inclusion: { in: lambda { |record| VALID_CURATION_CONCERNS.values } }
|
15
|
+
)
|
16
|
+
|
17
|
+
def possible_curation_concern_types
|
18
|
+
VALID_CURATION_CONCERNS
|
19
|
+
end
|
20
|
+
|
21
|
+
def curation_concern_class
|
22
|
+
if possible_curation_concern_types.detect{|name, class_name|
|
23
|
+
class_name == curation_concern_type
|
24
|
+
}
|
25
|
+
curation_concern_type.constantize
|
26
|
+
else
|
27
|
+
raise RuntimeError, "Invalid :curation_concern_type"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class ContributorAgreement
|
2
|
+
attr_reader :curation_concern, :user
|
3
|
+
def initialize(curation_concern, user, params)
|
4
|
+
@curation_concern = curation_concern
|
5
|
+
@user = user
|
6
|
+
@param_value = params[param_key.to_sym] || params[param_key.to_s]
|
7
|
+
end
|
8
|
+
|
9
|
+
def legally_binding_text
|
10
|
+
<<-HTML
|
11
|
+
<p>
|
12
|
+
I am submitting my work for inclusion in the CurateND repository maintained by the University Libraries of the University of Notre Dame.
|
13
|
+
I acknowledge that publication of the work may implicate my legal rights with respect to the work and its contents, including my ability to publish the work in other venues.
|
14
|
+
I UNDERSTAND AND AGREE THAT BY SUBMITTING MY CONTENT FOR INCLUSION IN THE CURATEND REPOSITORY, I AGREE TO THE FOLLOWING TERMS:
|
15
|
+
</p>
|
16
|
+
|
17
|
+
<p>
|
18
|
+
I hereby grant the University of Notre Dame permission to reproduce, edit, publish, disseminate, publicly display, or publicly perform, in whole or in part, the work in any medium at the University’s discretion (including but not limited to public websites).
|
19
|
+
I agree that the University can keep more than one copy of the submission for the purpose of preservation and security.
|
20
|
+
I agree that the University can preserve the submission by migrating or translating it to a new format or medium as needed in the future.
|
21
|
+
I also agree that the metadata attached to the item can be reviewed and altered by the University to aid in preservation and discovery.
|
22
|
+
I understand that I may be allowed the opportunity to select the intended audience for the materials that I submit, and I agree that I am fully responsible for any claims and all responsibility for materials submitted.
|
23
|
+
The CurateND service is offered as-is with no warranties, express or implied.
|
24
|
+
The University may suspend or terminate CurateND, or remove any content within the system, at any time for any reason in the University’s sole discretion.
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
I warrant that the submitted material is original to me and that I have power to make this agreement.
|
29
|
+
I also warrant that the submission does not, to the best of my knowledge, infringe upon anyone’s copyright.
|
30
|
+
I also warrant that if the work has been previously published elsewhere in whole or in part, that I have obtained the permission of the copyright owner to grant CurateND the rights required by this license.
|
31
|
+
I also guarantee that I do not have any other publication agreements that involve this material or substantial parts of it that conflict with my submission of materials for dissemination in CurateND.
|
32
|
+
</p>
|
33
|
+
|
34
|
+
<p>
|
35
|
+
I represent that any materials that are used in this submission that I do not hold copyright for, I have obtained permission to use and display the materials according to the rights required by this license, and that third-party owned materials are clearly identified and credited within the content of the submission.
|
36
|
+
If it is determined that permissions of use have not properly been obtained, I acknowledge that the University may remove or restrict access to items as necessary.
|
37
|
+
</p>
|
38
|
+
|
39
|
+
<p>
|
40
|
+
I understand that I may request the University to remove my submitted materials from the CurateND repository; however, I acknowledge that the University cannot control or retract works that may have been accessed by third parties prior to my request for removal.
|
41
|
+
If the submission is removed I agree that the item can be replaced by a page with a statement declaring that the item was removed by my request.
|
42
|
+
</p>
|
43
|
+
HTML
|
44
|
+
end
|
45
|
+
|
46
|
+
def acceptance_value
|
47
|
+
'accept'
|
48
|
+
end
|
49
|
+
|
50
|
+
def param_key
|
51
|
+
:accept_contributor_agreement
|
52
|
+
end
|
53
|
+
attr_reader :param_value
|
54
|
+
|
55
|
+
def is_being_accepted?
|
56
|
+
param_value == acceptance_value
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class DigitalObjectIdentifier
|
2
|
+
|
3
|
+
attr_accessor :target, :creator, :title, :publisher, :publicationyear
|
4
|
+
attr_accessor :description, :rights, :version, :format, :data_size, :contributor, :subject, :name_id, :subtitle, :created_date, :accepted_date, :resource_type, :lang
|
5
|
+
|
6
|
+
# Mandatory fields for creating DOI.
|
7
|
+
def data
|
8
|
+
"_target: #{target}\ndatacite.creator: #{creator}\ndatacite.title: #{title}\ndatacite.publisher: #{publisher}\ndatacite.publicationyear: #{publicationyear}\n"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Step - 1: Create DOI by passing 5 metadata - target, creator, title, publisher, publicationyear
|
12
|
+
def create_doi
|
13
|
+
response = RestClient.post DoiConfig.url_for_creating_doi, data, :content_type => 'text/plain'
|
14
|
+
return response
|
15
|
+
end
|
16
|
+
|
17
|
+
# Create DOI or return if already created.
|
18
|
+
def doi
|
19
|
+
@doi ||= create_doi
|
20
|
+
if @doi.include?("success")
|
21
|
+
@doi = @doi.split("|")[0].sub("success:", "").strip
|
22
|
+
end
|
23
|
+
@doi
|
24
|
+
end
|
25
|
+
|
26
|
+
# Step - 2: Update the DOI metadata with more attributes. The extra metadata will need to be in the xml format.
|
27
|
+
def update_doi
|
28
|
+
response = RestClient.post "#{DoiConfig.url_for_updating_doi}#{doi}", sanitize_data, :content_type => 'text/plain; charset=UTF-8', :content_length => sanitize_data.size, :accept => 'text/plain'
|
29
|
+
return response
|
30
|
+
end
|
31
|
+
|
32
|
+
# This method replaces special characters like %, :, \n and \r in the XML data and appends to the basic metadata which was used while creating DOI in Step - 1.
|
33
|
+
def sanitize_data
|
34
|
+
data + "datacite: #{create_xml.to_xml.gsub("%", "%25").gsub(":", "%3A").gsub("\n", "%0D%0A").gsub("\r", "")}\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
# This method creates XML data which is used for extra metadata other than the 5 metadata which was used in Step - 1.
|
38
|
+
def create_xml
|
39
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
40
|
+
xml.resource("xmlns" => "http://datacite.org/schema/kernel-2.2", "xmlns:xsi" =>"http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation" => "http://datacite.org/schema/kernel-2.2 http://schema.datacite.org/meta/kernel-2.2/metadata.xsd") {
|
41
|
+
xml.identifier(:identifierType => "DOI"){ xml.text doi.sub("doi:", "") }
|
42
|
+
xml.creators{
|
43
|
+
xml.creator{
|
44
|
+
xml.creatorName creator
|
45
|
+
xml.nameIdentifier(:nameIdentifierScheme => "ISNI") { xml.text name_id }
|
46
|
+
}
|
47
|
+
}
|
48
|
+
xml.titles{
|
49
|
+
xml.title title
|
50
|
+
xml.title(:titleType => "Subtitle") { xml.text subtitle}
|
51
|
+
}
|
52
|
+
xml.publisher publisher
|
53
|
+
xml.publicationYear publicationyear
|
54
|
+
xml.subjects{
|
55
|
+
xml.subject subject
|
56
|
+
}
|
57
|
+
xml.contributors{
|
58
|
+
xml.contributor(:contributorType => "DataManager"){
|
59
|
+
xml.contributorName contributor
|
60
|
+
}
|
61
|
+
}
|
62
|
+
xml.dates{
|
63
|
+
xml.date(:dateType => "Valid"){ xml.text created_date }
|
64
|
+
xml.date(:dateType => "Accepted"){ xml.text accepted_date }
|
65
|
+
}
|
66
|
+
xml.language lang
|
67
|
+
xml.resourceType(:resourceTypeGeneral => "Image"){ xml.text resource_type }
|
68
|
+
xml.sizes{
|
69
|
+
xml.size data_size
|
70
|
+
}
|
71
|
+
xml.formats{
|
72
|
+
xml.format format
|
73
|
+
}
|
74
|
+
xml.version version
|
75
|
+
xml.rights rights
|
76
|
+
xml.descriptions{
|
77
|
+
xml.description(:descriptionType => "Other") { xml.text description }
|
78
|
+
}
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class DoiConfig
|
2
|
+
@@config_info, @@url = nil
|
3
|
+
def self.configure
|
4
|
+
@@config_info ||= YAML.load(File.open(File.join(Rails.root, "config/doi.yml")))
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.username
|
8
|
+
configure[Rails.env]['username']
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.password
|
12
|
+
configure[Rails.env]['password']
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.shoulder
|
16
|
+
configure[Rails.env]['shoulder']
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.url_for_creating_doi
|
20
|
+
@@url_for_creating_doi ||= "#{configure[Rails.env]['url'].sub("://", "://#{username}:#{password}@")}shoulder/#{shoulder}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.url_for_updating_doi
|
24
|
+
@@url_for_updating_doi ||= "#{configure[Rails.env]['url'].sub("://", "://#{username}:#{password}@")}id/"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'browser'
|
2
|
+
class HelpRequest < ActiveRecord::Base
|
3
|
+
|
4
|
+
attr_accessible(
|
5
|
+
:current_url,
|
6
|
+
:flash_version,
|
7
|
+
:how_can_we_help_you,
|
8
|
+
:javascript_enabled,
|
9
|
+
:resolution,
|
10
|
+
:user_agent,
|
11
|
+
:view_port
|
12
|
+
)
|
13
|
+
|
14
|
+
belongs_to :user
|
15
|
+
validates_presence_of :how_can_we_help_you,
|
16
|
+
:message => "Please tell us about the problem or issue you are having with CurateND."
|
17
|
+
|
18
|
+
|
19
|
+
def browser_name
|
20
|
+
parse_user_agent
|
21
|
+
@browser.name
|
22
|
+
end
|
23
|
+
|
24
|
+
def platform
|
25
|
+
parse_user_agent
|
26
|
+
@browser.platform
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def parse_user_agent
|
32
|
+
@browser ||= Browser.new(:ua => user_agent)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class MintDoi
|
2
|
+
|
3
|
+
attr_reader :fedora_object
|
4
|
+
|
5
|
+
class MissingDataError < RuntimeError
|
6
|
+
def initialize(error_message)
|
7
|
+
super(error_message)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(obj_id)
|
12
|
+
@fedora_object = retreive_fedora_object(obj_id)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Return DOI if already stored in fedora object. If not create a new DOI and store it in the fedora object.
|
16
|
+
def create_or_retrieve_doi
|
17
|
+
if (doi = fedora_object.identifier).present?
|
18
|
+
return doi
|
19
|
+
end
|
20
|
+
|
21
|
+
fedora_object.identifier = digital_object_identifier.doi
|
22
|
+
fedora_object.save!
|
23
|
+
return fedora_object.identifier
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def digital_object_identifier
|
29
|
+
@digital_object_identifier ||= DigitalObjectIdentifier.new
|
30
|
+
|
31
|
+
@digital_object_identifier.target = create_or_retreive_purl
|
32
|
+
@digital_object_identifier.title = fedora_object.title
|
33
|
+
@digital_object_identifier.creator = fedora_object.creator
|
34
|
+
@digital_object_identifier.publisher = "Hesburgh Library - University of Notre Dame"
|
35
|
+
@digital_object_identifier.publicationyear = Time.now.year.to_s
|
36
|
+
|
37
|
+
@digital_object_identifier
|
38
|
+
end
|
39
|
+
|
40
|
+
# Obtain the actual content-model type and load the object.
|
41
|
+
def retreive_fedora_object(obj_id)
|
42
|
+
ActiveFedora::Base.find(obj_id, cast: true)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create or retrieve purl link for the given fedora ID.
|
46
|
+
def create_or_retreive_purl
|
47
|
+
raise MissingDataError.new("Title and Creator fields cannot be empty.") if fedora_object.title.blank? || fedora_object.creator.blank?
|
48
|
+
mint_purl = MintPurl.new(fedora_object)
|
49
|
+
mint_purl.create_or_retreive_purl
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'method_decorators/precondition'
|
2
|
+
class MintPurl
|
3
|
+
extend MethodDecorators
|
4
|
+
|
5
|
+
class PurlError < RuntimeError
|
6
|
+
def initialize(error_message)
|
7
|
+
super(error_message)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :fedora_object
|
12
|
+
|
13
|
+
+MethodDecorators::Precondition.new {|fedora_object| fedora_object.present? }
|
14
|
+
def initialize(fedora_object)
|
15
|
+
@fedora_object = fedora_object
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_or_retreive_purl
|
19
|
+
repo_object = RepoObject.where(:filename => fedora_object.to_param).first
|
20
|
+
if repo_object
|
21
|
+
purl = Purl.where(:repo_object_id => repo_object.repo_object_id).first
|
22
|
+
return purl_url(purl.purl_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
Purl.transaction do
|
26
|
+
@repo_object = RepoObject.create_from_fedora_object(fedora_object)
|
27
|
+
@purl = Purl.create_from_repo_object(@repo_object)
|
28
|
+
end
|
29
|
+
return purl_url(@purl.purl_id) if @purl
|
30
|
+
rescue => e
|
31
|
+
raise PurlError.new("Could not create Purl for the following reasons: #{e.backtrace.inspect}")
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def purl_url(purl_id)
|
37
|
+
File.join(PurlConfig.url, purl_id.to_s, fedora_object.to_param)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|