curate 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. data/LICENSE +14 -0
  2. data/app/controllers/application_controller.rb +69 -0
  3. data/app/controllers/catalog_controller.rb +336 -0
  4. data/app/controllers/classify_concerns_controller.rb +29 -0
  5. data/app/controllers/common_objects_controller.rb +27 -0
  6. data/app/controllers/curation_concern/base_controller.rb +26 -0
  7. data/app/controllers/curation_concern/generic_files_controller.rb +82 -0
  8. data/app/controllers/dashboard_controller.rb +85 -0
  9. data/app/controllers/downloads_controller.rb +22 -0
  10. data/app/controllers/errors_controller.rb +19 -0
  11. data/app/controllers/help_requests_controller.rb +38 -0
  12. data/app/controllers/terms_of_service_agreements_controller.rb +44 -0
  13. data/app/controllers/welcome_controller.rb +14 -0
  14. data/app/helpers/application_helper.rb +89 -0
  15. data/app/helpers/blacklight_helper.rb +19 -0
  16. data/app/helpers/common_objects_helper.rb +5 -0
  17. data/app/inputs/multi_value_input.rb +71 -0
  18. data/app/models/access_right.rb +53 -0
  19. data/app/models/classify_concern.rb +30 -0
  20. data/app/models/contributor_agreement.rb +58 -0
  21. data/app/models/digital_object_identifier.rb +83 -0
  22. data/app/models/doi_config.rb +26 -0
  23. data/app/models/help_request.rb +34 -0
  24. data/app/models/mint_doi.rb +51 -0
  25. data/app/models/mint_purl.rb +40 -0
  26. data/app/models/object_access.rb +17 -0
  27. data/app/models/purl.rb +18 -0
  28. data/app/models/purl_config.rb +10 -0
  29. data/app/models/repo_object.rb +24 -0
  30. data/app/models/solr_document.rb +35 -0
  31. data/app/repository_datastreams/file_content_datastream.rb +36 -0
  32. data/app/repository_models/curation_concern/embargoable.rb +43 -0
  33. data/app/repository_models/curation_concern/with_access_right.rb +31 -0
  34. data/app/repository_models/generic_file.rb +36 -0
  35. data/app/services/anti_virus_scanner.rb +28 -0
  36. data/app/services/curation_concern.rb +22 -0
  37. data/app/services/curation_concern/base_actor.rb +48 -0
  38. data/app/services/curation_concern/generic_file_actor.rb +38 -0
  39. data/app/validators/future_date_validator.rb +19 -0
  40. data/app/views/_footer.html.erb +19 -0
  41. data/app/views/_ga.html.erb +6 -0
  42. data/app/views/_logo.html.erb +34 -0
  43. data/app/views/_masthead.html.erb +34 -0
  44. data/app/views/catalog/_bookmark_control.html.erb +25 -0
  45. data/app/views/catalog/_bookmark_form.html.erb +8 -0
  46. data/app/views/catalog/_citation.html.erb +11 -0
  47. data/app/views/catalog/_constraints.html.erb +6 -0
  48. data/app/views/catalog/_constraints_element.html.erb +20 -0
  49. data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
  50. data/app/views/catalog/_did_you_mean.html.erb +10 -0
  51. data/app/views/catalog/_document.html.erb +19 -0
  52. data/app/views/catalog/_document_list.html.erb +2 -0
  53. data/app/views/catalog/_edit_partials/_default.html.erb +58 -0
  54. data/app/views/catalog/_edit_partials/_default_details.html.erb +13 -0
  55. data/app/views/catalog/_email_form.html.erb +11 -0
  56. data/app/views/catalog/_facet_layout.html.erb +12 -0
  57. data/app/views/catalog/_facet_limit.html.erb +19 -0
  58. data/app/views/catalog/_facet_selected.html.erb +12 -0
  59. data/app/views/catalog/_facets.html.erb +5 -0
  60. data/app/views/catalog/_folder_control.html.erb +12 -0
  61. data/app/views/catalog/_home.html.erb +2 -0
  62. data/app/views/catalog/_home_text.html.erb +10 -0
  63. data/app/views/catalog/_index_default.html.erb +11 -0
  64. data/app/views/catalog/_index_partials/_default_group.html.erb +37 -0
  65. data/app/views/catalog/_marc_view.html.erb +33 -0
  66. data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -0
  67. data/app/views/catalog/_previous_next_doc.html.erb +6 -0
  68. data/app/views/catalog/_refworks_form.html.erb +7 -0
  69. data/app/views/catalog/_results_pagination.html.erb +6 -0
  70. data/app/views/catalog/_search_form.html.erb +20 -0
  71. data/app/views/catalog/_show_default.html.erb +9 -0
  72. data/app/views/catalog/_show_partials/_default.html.erb +22 -0
  73. data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
  74. data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
  75. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  76. data/app/views/catalog/_show_tools.html.erb +46 -0
  77. data/app/views/catalog/_sms_form.html.erb +21 -0
  78. data/app/views/catalog/_sort_and_per_page.html.erb +38 -0
  79. data/app/views/catalog/_uva_tabs.html.erb +10 -0
  80. data/app/views/catalog/about.html.erb +0 -0
  81. data/app/views/catalog/citation.html.erb +1 -0
  82. data/app/views/catalog/email.erb +1 -0
  83. data/app/views/catalog/endnote.endnote.erb +1 -0
  84. data/app/views/catalog/index.atom.builder +109 -0
  85. data/app/views/catalog/index.html.erb +55 -0
  86. data/app/views/catalog/index.rss.builder +19 -0
  87. data/app/views/catalog/librarian_view.html.erb +3 -0
  88. data/app/views/catalog/opensearch.json.erb +0 -0
  89. data/app/views/catalog/opensearch.xml.builder +10 -0
  90. data/app/views/catalog/send_email_record.erb +0 -0
  91. data/app/views/catalog/show.endnote.erb +1 -0
  92. data/app/views/catalog/show.html.erb +40 -0
  93. data/app/views/catalog/show.refworks.erb +1 -0
  94. data/app/views/catalog/sms.erb +1 -0
  95. data/app/views/classify_concerns/new.html.erb +24 -0
  96. data/app/views/common_objects/_generic_file.html.erb +0 -0
  97. data/app/views/common_objects/_senior_thesis.html.erb +2 -0
  98. data/app/views/common_objects/show.html.erb +11 -0
  99. data/app/views/common_objects/show_stub_information.html.erb +13 -0
  100. data/app/views/curation_concern/_content_license.html.erb +16 -0
  101. data/app/views/curation_concern/_contributor_agreement.html.erb +27 -0
  102. data/app/views/curation_concern/_doi.html.erb +43 -0
  103. data/app/views/curation_concern/_media_display.html.erb +1 -0
  104. data/app/views/curation_concern/_permission.html.erb +39 -0
  105. data/app/views/curation_concern/_related_files.html.erb +46 -0
  106. data/app/views/curation_concern/generic_files/_attributes.html.erb +63 -0
  107. data/app/views/curation_concern/generic_files/_form.html.erb +57 -0
  108. data/app/views/curation_concern/generic_files/edit.html.erb +5 -0
  109. data/app/views/curation_concern/generic_files/new.html.erb +5 -0
  110. data/app/views/curation_concern/generic_files/show.html.erb +12 -0
  111. data/app/views/curation_concern/senior_theses/_attributes.html.erb +13 -0
  112. data/app/views/curation_concern/senior_theses/_form.html.erb +88 -0
  113. data/app/views/curation_concern/senior_theses/edit.html.erb +15 -0
  114. data/app/views/curation_concern/senior_theses/new.html.erb +14 -0
  115. data/app/views/curation_concern/senior_theses/show.html.erb +18 -0
  116. data/app/views/dashboard/_constraints.html.erb +22 -0
  117. data/app/views/dashboard/_did_you_mean.html.erb +26 -0
  118. data/app/views/dashboard/_document_list.html.erb +20 -0
  119. data/app/views/dashboard/_facet_layout.html.erb +27 -0
  120. data/app/views/dashboard/_facet_limit.html.erb +35 -0
  121. data/app/views/dashboard/_facet_pagination.html.erb +25 -0
  122. data/app/views/dashboard/_facet_selected.html.erb +28 -0
  123. data/app/views/dashboard/_facets.html.erb +22 -0
  124. data/app/views/dashboard/_index_partials/_default_group.html.erb +37 -0
  125. data/app/views/dashboard/_index_partials/_list_files.html.erb +66 -0
  126. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +0 -0
  127. data/app/views/dashboard/_results_pagination.html.erb +22 -0
  128. data/app/views/dashboard/_search_form.html.erb +36 -0
  129. data/app/views/dashboard/_show_partials/_default.html.erb +38 -0
  130. data/app/views/dashboard/_show_partials/_default_details.html.erb +31 -0
  131. data/app/views/dashboard/_show_partials/_facets.html.erb +103 -0
  132. data/app/views/dashboard/_sort_and_per_page.html.erb +18 -0
  133. data/app/views/dashboard/facet.html.erb +38 -0
  134. data/app/views/dashboard/get_related_file.html.erb +4 -0
  135. data/app/views/dashboard/index.html.erb +60 -0
  136. data/app/views/errors/401.html.erb +5 -0
  137. data/app/views/errors/404.html.erb +16 -0
  138. data/app/views/errors/500.html.erb +10 -0
  139. data/app/views/help_requests/new.html.erb +60 -0
  140. data/app/views/layouts/application.html.erb +14 -0
  141. data/app/views/layouts/boilerplate.html.erb +28 -0
  142. data/app/views/layouts/common_objects.html.erb +45 -0
  143. data/app/views/layouts/curate_nd.html.erb +55 -0
  144. data/app/views/layouts/curate_nd/1_column.html.erb +22 -0
  145. data/app/views/layouts/curate_nd/2_column.html.erb +26 -0
  146. data/app/views/layouts/curate_nd/catalog.html.erb +22 -0
  147. data/app/views/layouts/curate_nd/dashboard.html.erb +22 -0
  148. data/app/views/layouts/hydra-head.html.erb +95 -0
  149. data/app/views/shared/_action_bar.html.erb +30 -0
  150. data/app/views/shared/_flash_message.html.erb +9 -0
  151. data/app/views/shared/_site_search.html.erb +18 -0
  152. data/app/views/terms_of_service_agreements/new.html.erb +136 -0
  153. data/app/views/welcome/index.html.erb +21 -0
  154. data/app/workers/characterize_job.rb +4 -0
  155. data/app/workers/doi_worker.rb +16 -0
  156. data/config/routes.rb +35 -0
  157. data/lib/curate.rb +6 -0
  158. data/lib/curate/engine.rb +46 -0
  159. data/lib/curate/version.rb +1 -1
  160. data/spec/abilities/generic_file_abilities_spec.rb +55 -0
  161. data/spec/controllers/application_controller_spec.rb +38 -0
  162. data/spec/controllers/classify_concerns_controller_spec.rb +36 -0
  163. data/spec/controllers/common_objects_controller_spec.rb +112 -0
  164. data/spec/controllers/curation_concern/base_controller_spec.rb +14 -0
  165. data/spec/controllers/curation_concern/generic_files_controller_spec.rb +156 -0
  166. data/spec/controllers/dashboard_controller_spec.rb +85 -0
  167. data/spec/controllers/downloads_controller_spec.rb +42 -0
  168. data/spec/controllers/help_requests_controller_spec.rb +42 -0
  169. data/spec/controllers/terms_of_service_agreements_controller_spec.rb +30 -0
  170. data/spec/controllers/welcome_controller_spec.rb +10 -0
  171. data/spec/dummy/app/models/solr_document.rb +4 -0
  172. data/spec/dummy/app/models/user.rb +13 -0
  173. data/spec/dummy/config/application.rb +8 -1
  174. data/spec/dummy/config/database.yml +21 -22
  175. data/spec/dummy/config/doi.yml +11 -0
  176. data/spec/dummy/config/fedora.yml +20 -0
  177. data/spec/dummy/config/initializers/devise.rb +232 -0
  178. data/spec/dummy/config/initializers/hydra_config.rb +41 -0
  179. data/spec/dummy/config/initializers/mailboxer.rb +17 -0
  180. data/spec/dummy/config/initializers/redis_config.rb +45 -0
  181. data/spec/dummy/config/initializers/sufia.rb +66 -0
  182. data/spec/dummy/config/purl.yml +15 -0
  183. data/spec/dummy/config/redis.yml +6 -0
  184. data/spec/dummy/config/role_map_ci.yml +15 -0
  185. data/spec/dummy/config/role_map_cucumber.yml +10 -0
  186. data/spec/dummy/config/role_map_development.yml +12 -0
  187. data/spec/dummy/config/role_map_pre_production.yml +2 -0
  188. data/spec/dummy/config/role_map_production.yml +2 -0
  189. data/spec/dummy/config/role_map_test.yml +15 -0
  190. data/spec/dummy/config/routes.rb +4 -55
  191. data/spec/dummy/config/solr.yml +17 -0
  192. data/spec/dummy/db/migrate/20130130142162_create_purl.rb +55 -0
  193. data/spec/dummy/db/migrate/20130312135359_create_help_requests.rb +22 -0
  194. data/spec/dummy/db/migrate/20130408165008_create_users.rb +11 -0
  195. data/spec/dummy/db/migrate/20130408165009_acts_as_follower_migration.rb +31 -0
  196. data/spec/dummy/db/migrate/20130408165010_add_social_to_users.rb +27 -0
  197. data/spec/dummy/db/migrate/20130408165011_create_single_use_links.rb +12 -0
  198. data/spec/dummy/db/migrate/20130408165012_add_ldap_attrs_to_user.rb +41 -0
  199. data/spec/dummy/db/migrate/20130408165013_add_avatars_to_users.rb +23 -0
  200. data/spec/dummy/db/migrate/20130408165014_create_checksum_audit_logs.rb +34 -0
  201. data/spec/dummy/db/migrate/20130408165015_create_version_committers.rb +29 -0
  202. data/spec/dummy/db/migrate/20130408165016_add_groups_to_users.rb +25 -0
  203. data/spec/dummy/db/migrate/20130408165017_create_local_authorities.rb +64 -0
  204. data/spec/dummy/db/migrate/20130408165018_create_trophies.rb +10 -0
  205. data/spec/dummy/db/migrate/20130408165022_create_mailboxer.mailboxer_engine.rb +62 -0
  206. data/spec/dummy/db/migrate/20130408165023_add_notified_object.mailboxer_engine.rb +18 -0
  207. data/spec/dummy/db/migrate/20130408165024_add_notification_code.mailboxer_engine.rb +14 -0
  208. data/spec/dummy/db/migrate/20130408165025_add_attachments.mailboxer_engine.rb +10 -0
  209. data/spec/dummy/db/migrate/20130408165026_rename_receipts_read.mailboxer_engine.rb +10 -0
  210. data/spec/dummy/db/schema.rb +197 -0
  211. data/spec/dummy/db/test.sqlite3 +0 -0
  212. data/spec/dummy/fedora_conf/conf/development/fedora.fcfg +953 -0
  213. data/spec/dummy/fedora_conf/conf/test/fedora.fcfg +953 -0
  214. data/spec/dummy/log/development.log +1791 -0
  215. data/spec/dummy/log/test.log +176333 -0
  216. data/spec/dummy/solr_conf/conf/schema.xml +692 -0
  217. data/spec/dummy/solr_conf/conf/solrconfig.xml +299 -0
  218. data/spec/dummy/solr_conf/solr.xml +35 -0
  219. data/spec/factories/create_curation_concern.rb +11 -0
  220. data/spec/factories/create_generic_file.rb +36 -0
  221. data/spec/factories/help_requests.rb +10 -0
  222. data/spec/factories/mock_curation_concerns.rb +4 -0
  223. data/spec/factories/users.rb +8 -0
  224. data/spec/helpers/application_helper_spec.rb +139 -0
  225. data/spec/helpers/common_objects_helper_spec.rb +9 -0
  226. data/spec/models/access_right_spec.rb +47 -0
  227. data/spec/models/classify_concern_spec.rb +30 -0
  228. data/spec/models/contributor_agreement_spec.rb +45 -0
  229. data/spec/models/digital_object_identifier_spec.rb +50 -0
  230. data/spec/models/help_request_spec.rb +5 -0
  231. data/spec/models/mint_doi_spec.rb +79 -0
  232. data/spec/models/mint_purl_spec.rb +38 -0
  233. data/spec/models/object_access_spec.rb +24 -0
  234. data/spec/models/purl_spec.rb +22 -0
  235. data/spec/models/repo_object_spec.rb +39 -0
  236. data/spec/repository_models/curation_concern/embargoable_spec.rb +69 -0
  237. data/spec/repository_models/generic_file_spec.rb +38 -0
  238. data/spec/services/anti_virus_scanner_spec.rb +26 -0
  239. data/spec/services/curation_concern/base_actor_spec.rb +28 -0
  240. data/spec/services/curation_concern/generic_file_actor_spec.rb +75 -0
  241. data/spec/services/curation_concern_spec.rb +34 -0
  242. data/spec/spec_helper.rb +54 -1
  243. data/spec/support/environment_override.rb +17 -0
  244. data/spec/support/matchers/raise_rescue_response_type_matcher.rb +42 -0
  245. data/spec/support/mock_curation_concern.rb +61 -0
  246. data/spec/support/shared/shared_examples_is_embargoable.rb +9 -0
  247. data/spec/support/shared/shared_examples_with_access_rights.rb +33 -0
  248. data/spec/workers/characterize_job_spec.rb +26 -0
  249. metadata +686 -10
  250. data/MIT-LICENSE +0 -20
data/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ ##########################################################################
2
+ # Copyright 2012 University of Notre Dame
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
@@ -0,0 +1,69 @@
1
+ require File.expand_path("../../helpers/application_helper", __FILE__)
2
+ class ApplicationController < ActionController::Base
3
+ # Adds a few additional behaviors into the application controller
4
+ include Blacklight::Controller
5
+ # Adds Hydra behaviors into the application controller
6
+ include Hydra::Controller::ControllerBehavior
7
+ # Adds Sufia behaviors into the application controller
8
+ include Sufia::Controller
9
+
10
+ # Please be sure to impelement current_user and user_session. Blacklight depends on
11
+ # these methods in order to perform user specific actions.
12
+
13
+ def sufia
14
+ self
15
+ end
16
+ helper_method :sufia
17
+
18
+ helper ApplicationHelper
19
+
20
+ rescue_from StandardError, with: :exception_handler
21
+ def exception_handler(exception)
22
+ raise exception if Rails.configuration.consider_all_requests_local
23
+ raise exception unless ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.name]
24
+
25
+ wrapper = ActionDispatch::ExceptionWrapper.new(env, exception)
26
+ render_response_for_error(wrapper)
27
+ end
28
+ protected :exception_handler
29
+
30
+ def set_return_location_from_status_code(status_code)
31
+ if status_code == 401
32
+ session['user_return_to'] = env['ORIGINAL_FULLPATH']
33
+ end
34
+ end
35
+ protected :set_return_location_from_status_code
36
+
37
+ def render_response_for_error(exception)
38
+ set_return_location_from_status_code(exception.status_code)
39
+ render "/errors/#{exception.status_code}", status: exception.status_code, layout: !request.xhr?
40
+ end
41
+ protected :render_response_for_error
42
+
43
+
44
+ layout 'hydra-head'
45
+
46
+ protect_from_forgery
47
+
48
+ def show_action_bar?
49
+ true
50
+ end
51
+ helper_method :show_action_bar?
52
+
53
+ def show_site_search?
54
+ true
55
+ end
56
+ helper_method :show_site_search?
57
+
58
+ protected
59
+ def agreed_to_terms_of_service!
60
+ return false unless current_user
61
+ if current_user.agreed_to_terms_of_service?
62
+ return current_user
63
+ else
64
+ redirect_to new_terms_of_service_agreement_path
65
+ return false
66
+ end
67
+ end
68
+
69
+ end
@@ -0,0 +1,336 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright © 2012 The Pennsylvania State University
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # -*- encoding : utf-8 -*-
17
+ require 'blacklight/catalog'
18
+ require 'blacklight_advanced_search'
19
+
20
+ # bl_advanced_search 1.2.4 is doing unitialized constant on these because we're calling ParseBasicQ directly
21
+ require 'parslet'
22
+ require 'parsing_nesting/tree'
23
+
24
+ class CatalogController < ApplicationController
25
+ include Blacklight::Catalog
26
+ # Extend Blacklight::Catalog with Hydra behaviors (primarily editing).
27
+ include Hydra::Controller::ControllerBehavior
28
+ include BlacklightAdvancedSearch::ParseBasicQ
29
+
30
+ layout 'curate_nd/catalog'
31
+
32
+ # These before_filters apply the hydra access controls
33
+ before_filter :enforce_show_permissions, :only=>:show
34
+ # This applies appropriate access controls to all solr queries
35
+ CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
36
+ # This filters out objects that you want to exclude from search results, like FileAssets
37
+ CatalogController.solr_search_params_logic += [:exclude_unwanted_models]
38
+
39
+ skip_before_filter :default_html_head
40
+
41
+ def index
42
+ super
43
+ recent
44
+ #also grab my recent docs too
45
+ recent_me
46
+ end
47
+
48
+ def recent
49
+ if user_signed_in?
50
+ # grab other people's documents
51
+ (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}-'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3)
52
+ else
53
+ # grab any documents we do not know who you are
54
+ (resp, doc_list) = get_search_results(:q =>'', :sort=>"system_create_dt desc", :rows=>3)
55
+ end
56
+ @recent_documents = doc_list[0..3]
57
+ end
58
+
59
+ def recent_me
60
+ if user_signed_in?
61
+ (resp, doc_list) = get_search_results(:q =>'{!lucene q.op=AND df=depositor_t}'+current_user.user_key, :sort=>"system_create_dt desc", :rows=>3)
62
+ @recent_user_documents = doc_list[0..3]
63
+ else
64
+ @recent_user_documents = nil
65
+ end
66
+ end
67
+
68
+ configure_blacklight do |config|
69
+ ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
70
+ config.default_solr_params = {
71
+ :qt => "search",
72
+ :rows => 10
73
+ }
74
+
75
+ # solr field configuration for search results/index views
76
+ config.index.show_link = "desc_metadata__title_display"
77
+ config.index.record_display_type = "id"
78
+
79
+ # solr field configuration for document/show views
80
+ config.show.html_title = "desc_metadata__title_display"
81
+ config.show.heading = "desc_metadata__title_display"
82
+ config.show.display_type = "has_model_s"
83
+
84
+ # solr fields that will be treated as facets by the blacklight application
85
+ # The ordering of the field names is the order of the display
86
+ config.add_facet_field "desc_metadata__resource_type_facet", :label => "Resource Type", :limit => 5
87
+ #config.add_facet_field "desc_metadata__contributor_facet", :label => "Contributor", :limit => 5
88
+ config.add_facet_field "desc_metadata__creator_facet", :label => "Creator", :limit => 5
89
+ config.add_facet_field "desc_metadata__tag_facet", :label => "Keyword", :limit => 5
90
+ config.add_facet_field "desc_metadata__subject_facet", :label => "Subject", :limit => 5
91
+ config.add_facet_field "desc_metadata__archived_object_type_facet", :label => "Type", :limit => 5
92
+ config.add_facet_field "desc_metadata__language_facet", :label => "Language", :limit => 5
93
+ config.add_facet_field "desc_metadata__based_near_facet", :label => "Location", :limit => 5
94
+ config.add_facet_field "desc_metadata__publisher_facet", :label => "Publisher", :limit => 5
95
+ config.add_facet_field "file_format_facet", :label => "File Format", :limit => 5
96
+
97
+ # Have BL send all facet field names to Solr, which has been the default
98
+ # previously. Simply remove these lines if you'd rather use Solr request
99
+ # handler defaults, or have no facets.
100
+ config.add_facet_fields_to_solr_request!
101
+
102
+ # solr fields to be displayed in the index (search results) view
103
+ # The ordering of the field names is the order of the display
104
+ config.add_index_field "desc_metadata__title_display", :label => "Title"
105
+ config.add_index_field "desc_metadata__description_display", :label => "Description"
106
+ config.add_index_field "desc_metadata__tag_display", :label => "Keyword"
107
+ config.add_index_field "desc_metadata__subject_display", :label => "Subject"
108
+ config.add_index_field "desc_metadata__creator_display", :label => "Creator"
109
+ config.add_index_field "desc_metadata__contributor_display", :label => "Contributor"
110
+ config.add_index_field "desc_metadata__publisher_display", :label => "Publisher"
111
+ config.add_index_field "desc_metadata__based_near_display", :label => "Location"
112
+ config.add_index_field "desc_metadata__language_display", :label => "Language"
113
+ config.add_index_field "desc_metadata__date_uploaded_display", :label => "Date Uploaded"
114
+ config.add_index_field "desc_metadata__date_modified_display", :label => "Date Modified"
115
+ config.add_index_field "desc_metadata__date_created_display", :label => "Date Created"
116
+ config.add_index_field "desc_metadata__rights_display", :label => "Rights"
117
+ config.add_index_field "desc_metadata__resource_type_display", :label => "Resource Type"
118
+ config.add_index_field "desc_metadata__format_display", :label => "File Format"
119
+ config.add_index_field "desc_metadata__identifier_display", :label => "Identifier"
120
+
121
+ # solr fields to be displayed in the show (single result) view
122
+ # The ordering of the field names is the order of the display
123
+ config.add_show_field "desc_metadata__title_display", :label => "Title"
124
+ config.add_show_field "desc_metadata__description_display", :label => "Description"
125
+ config.add_show_field "desc_metadata__tag_display", :label => "Keyword"
126
+ config.add_show_field "desc_metadata__subject_display", :label => "Subject"
127
+ config.add_show_field "desc_metadata__creator_display", :label => "Creator"
128
+ config.add_show_field "desc_metadata__contributor_display", :label => "Contributor"
129
+ config.add_show_field "desc_metadata__publisher_display", :label => "Publisher"
130
+ config.add_show_field "desc_metadata__based_near_display", :label => "Location"
131
+ config.add_show_field "desc_metadata__language_display", :label => "Language"
132
+ config.add_show_field "desc_metadata__date_uploaded_display", :label => "Date Uploaded"
133
+ config.add_show_field "desc_metadata__date_modified_display", :label => "Date Modified"
134
+ config.add_show_field "desc_metadata__date_created_display", :label => "Date Created"
135
+ config.add_show_field "desc_metadata__rights_display", :label => "Rights"
136
+ config.add_show_field "desc_metadata__resource_type_display", :label => "Resource Type"
137
+ config.add_show_field "desc_metadata__file_format_display", :label => "File Format"
138
+ config.add_show_field "desc_metadata__identifier_display", :label => "Identifier"
139
+
140
+ # "fielded" search configuration. Used by pulldown among other places.
141
+ # For supported keys in hash, see rdoc for Blacklight::SearchFields
142
+ #
143
+ # Search fields will inherit the :qt solr request handler from
144
+ # config[:default_solr_parameters], OR can specify a different one
145
+ # with a :qt key/value. Below examples inherit, except for subject
146
+ # that specifies the same :qt as default for our own internal
147
+ # testing purposes.
148
+ #
149
+ # The :key is what will be used to identify this BL search field internally,
150
+ # as well as in URLs -- so changing it after deployment may break bookmarked
151
+ # urls. A display label will be automatically calculated from the :key,
152
+ # or can be specified manually to be different.
153
+ #
154
+ # This one uses all the defaults set by the solr request handler. Which
155
+ # solr request handler? The one set in config[:default_solr_parameters][:qt],
156
+ # since we aren't specifying it otherwise.
157
+ config.add_search_field 'all_fields', :label => 'All Fields', :include_in_advanced_search => false
158
+
159
+
160
+ # Now we see how to over-ride Solr request handler defaults, in this
161
+ # case for a BL "search field", which is really a dismax aggregate
162
+ # of Solr search fields.
163
+ # creator, title, description, publisher, date_created,
164
+ # subject, language, resource_type, format, identifier, based_near,
165
+ config.add_search_field('contributor') do |field|
166
+ # solr_parameters hash are sent to Solr as ordinary url query params.
167
+ field.solr_parameters = { :"spellcheck.dictionary" => "contributor" }
168
+
169
+ # :solr_local_parameters will be sent using Solr LocalParams
170
+ # syntax, as eg {! qf=$title_qf }. This is neccesary to use
171
+ # Solr parameter de-referencing like $title_qf.
172
+ # See: http://wiki.apache.org/solr/LocalParams
173
+ field.solr_local_parameters = {
174
+ :qf => "desc_metadata__contributor_t",
175
+ :pf => "desc_metadata__contributor_t"
176
+ }
177
+ end
178
+
179
+ config.add_search_field('creator') do |field|
180
+ field.solr_parameters = { :"spellcheck.dictionary" => "creator" }
181
+ field.solr_local_parameters = {
182
+ :qf => "desc_metadata__creator_t",
183
+ :pf => "desc_metadata__creator_t"
184
+ }
185
+ end
186
+
187
+ config.add_search_field('title') do |field|
188
+ field.solr_parameters = {
189
+ :"spellcheck.dictionary" => "title"
190
+ }
191
+ field.solr_local_parameters = {
192
+ :qf => "desc_metadata__title_t",
193
+ :pf => "desc_metadata__title_t"
194
+ }
195
+ end
196
+
197
+ config.add_search_field('description') do |field|
198
+ field.label = "Abstract or Summary"
199
+ field.solr_parameters = {
200
+ :"spellcheck.dictionary" => "description"
201
+ }
202
+ field.solr_local_parameters = {
203
+ :qf => "desc_metadata__description_t",
204
+ :pf => "desc_metadata__description_t"
205
+ }
206
+ end
207
+
208
+ config.add_search_field('publisher') do |field|
209
+ field.solr_parameters = {
210
+ :"spellcheck.dictionary" => "publisher"
211
+ }
212
+ field.solr_local_parameters = {
213
+ :qf => "desc_metadata__publisher_t",
214
+ :pf => "desc_metadata__publisher_t"
215
+ }
216
+ end
217
+
218
+ config.add_search_field('date_created') do |field|
219
+ field.solr_parameters = {
220
+ :"spellcheck.dictionary" => "date_created"
221
+ }
222
+ field.solr_local_parameters = {
223
+ :qf => "desc_metadata__date_created_t",
224
+ :pf => "desc_metadata__date_created_t"
225
+ }
226
+ end
227
+
228
+ config.add_search_field('subject') do |field|
229
+ field.solr_parameters = {
230
+ :"spellcheck.dictionary" => "subject"
231
+ }
232
+ field.solr_local_parameters = {
233
+ :qf => "desc_metadata__subject_t",
234
+ :pf => "desc_metadata__subject_t"
235
+ }
236
+ end
237
+
238
+ config.add_search_field('language') do |field|
239
+ field.solr_parameters = {
240
+ :"spellcheck.dictionary" => "language"
241
+ }
242
+ field.solr_local_parameters = {
243
+ :qf => "desc_metadata__language_t",
244
+ :pf => "desc_metadata__language_t"
245
+ }
246
+ end
247
+
248
+ config.add_search_field('resource_type') do |field|
249
+ field.solr_parameters = {
250
+ :"spellcheck.dictionary" => "resource_type"
251
+ }
252
+ field.solr_local_parameters = {
253
+ :qf => "desc_metadata__resource_type_t",
254
+ :pf => "desc_metadata__resource_type_t"
255
+ }
256
+ end
257
+
258
+ config.add_search_field('format') do |field|
259
+ field.include_in_advanced_search = false
260
+ field.solr_parameters = {
261
+ :"spellcheck.dictionary" => "format"
262
+ }
263
+ field.solr_local_parameters = {
264
+ :qf => "file_format_t",
265
+ :pf => "file_format_t"
266
+ }
267
+ end
268
+
269
+ config.add_search_field('identifier') do |field|
270
+ field.include_in_advanced_search = false
271
+ field.solr_parameters = {
272
+ :"spellcheck.dictionary" => "identifier"
273
+ }
274
+ field.solr_local_parameters = {
275
+ :qf => "id_t",
276
+ :pf => "id_t"
277
+ }
278
+ end
279
+
280
+ config.add_search_field('based_near') do |field|
281
+ field.label = "Location"
282
+ field.solr_parameters = {
283
+ :"spellcheck.dictionary" => "based_near"
284
+ }
285
+ field.solr_local_parameters = {
286
+ :qf => "desc_metadata__based_near_t",
287
+ :pf => "desc_metadata__based_near_t"
288
+ }
289
+ end
290
+
291
+ config.add_search_field('tag') do |field|
292
+ field.solr_parameters = {
293
+ :"spellcheck.dictionary" => "tag"
294
+ }
295
+ field.solr_local_parameters = {
296
+ :qf => "desc_metadata__tag_t",
297
+ :pf => "desc_metadata__tag_t"
298
+ }
299
+ end
300
+
301
+ config.add_search_field('depositor') do |field|
302
+ field.solr_local_parameters = {
303
+ :qf => "depositor_t",
304
+ :pf => "depositor_t"
305
+ }
306
+ end
307
+
308
+ config.add_search_field('rights') do |field|
309
+ field.solr_local_parameters = {
310
+ :qf => "desc_metadata__rights_t",
311
+ :pf => "desc_metadata__rights_t"
312
+ }
313
+ end
314
+
315
+ # "sort results by" select (pulldown)
316
+ # label in pulldown is followed by the name of the SOLR field to sort by and
317
+ # whether the sort is ascending or descending (it must be asc or desc
318
+ # except in the relevancy case).
319
+ # label is key, solr field is value
320
+ config.add_sort_field 'score desc, desc_metadata__date_uploaded_dt desc', :label => "relevance \u25BC"
321
+ config.add_sort_field 'desc_metadata__date_uploaded_dt desc', :label => "date uploaded \u25BC"
322
+ config.add_sort_field 'desc_metadata__date_uploaded_dt asc', :label => "date uploaded \u25B2"
323
+ config.add_sort_field 'desc_metadata__date_modified_dt desc', :label => "date modified \u25BC"
324
+ config.add_sort_field 'desc_metadata__date_modified_dt asc', :label => "date modified \u25B2"
325
+
326
+ # If there are more than this many search results, no spelling ("did you
327
+ # mean") suggestion is offered.
328
+ config.spell_max = 5
329
+ end
330
+
331
+ private
332
+
333
+ def show_site_search?
334
+ false
335
+ end
336
+ end
@@ -0,0 +1,29 @@
1
+ class ClassifyConcernsController < ApplicationController
2
+ before_filter :authenticate_user!
3
+ before_filter :agreed_to_terms_of_service!
4
+ layout 'curate_nd/2_column'
5
+ respond_to :html
6
+
7
+ def classify_concern
8
+ @classify_concern ||= ClassifyConcern.new(params[:classify_concern])
9
+ end
10
+ helper_method :classify_concern
11
+
12
+ def new
13
+ respond_with(classify_concern)
14
+ end
15
+
16
+ def create
17
+ if classify_concern.valid?
18
+ respond_with(classify_concern) do |wants|
19
+ wants.html do
20
+ redirect_to new_polymorphic_path(
21
+ [:curation_concern, classify_concern.curation_concern_class]
22
+ )
23
+ end
24
+ end
25
+ else
26
+ respond_with(classify_concern)
27
+ end
28
+ end
29
+ end