blacklight 3.0pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/.gitignore +17 -0
  2. data/.gitmodules +6 -0
  3. data/.yardopts +4 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +14 -0
  6. data/README.rdoc +168 -0
  7. data/Rakefile +9 -0
  8. data/app/controllers/bookmarks_controller.rb +98 -0
  9. data/app/controllers/feedback_controller.rb +37 -0
  10. data/app/controllers/folder_controller.rb +49 -0
  11. data/app/controllers/saved_searches_controller.rb +45 -0
  12. data/app/controllers/search_history_controller.rb +25 -0
  13. data/app/helpers/blacklight_helper.rb +606 -0
  14. data/app/helpers/bookmarks_helper.rb +3 -0
  15. data/app/helpers/catalog_helper.rb +65 -0
  16. data/app/helpers/feedback_helper.rb +2 -0
  17. data/app/helpers/hash_as_hidden_fields.rb +57 -0
  18. data/app/helpers/render_constraints_helper.rb +120 -0
  19. data/app/helpers/saved_searches_helper.rb +2 -0
  20. data/app/helpers/search_history_helper.rb +2 -0
  21. data/app/models/bookmark.rb +6 -0
  22. data/app/models/record_mailer.rb +43 -0
  23. data/app/models/search.rb +19 -0
  24. data/app/views/_flash_msg.html.erb +6 -0
  25. data/app/views/_user_util_links.html.erb +13 -0
  26. data/app/views/bookmarks/index.html.erb +33 -0
  27. data/app/views/catalog/_bookmark_control.html.erb +25 -0
  28. data/app/views/catalog/_bookmark_form.html.erb +8 -0
  29. data/app/views/catalog/_citation.html.erb +15 -0
  30. data/app/views/catalog/_constraints.html.erb +7 -0
  31. data/app/views/catalog/_constraints_element.html.erb +33 -0
  32. data/app/views/catalog/_did_you_mean.html.erb +10 -0
  33. data/app/views/catalog/_document_list.html.erb +30 -0
  34. data/app/views/catalog/_email_form.html.erb +11 -0
  35. data/app/views/catalog/_facet_limit.html.erb +33 -0
  36. data/app/views/catalog/_facet_pagination.html.erb +28 -0
  37. data/app/views/catalog/_facets.html.erb +9 -0
  38. data/app/views/catalog/_folder_control.html.erb +12 -0
  39. data/app/views/catalog/_home.html.erb +6 -0
  40. data/app/views/catalog/_home_text.html.erb +6 -0
  41. data/app/views/catalog/_index_partials/_default.erb +11 -0
  42. data/app/views/catalog/_marc_view.html.erb +33 -0
  43. data/app/views/catalog/_opensearch_response_metadata.html.erb +3 -0
  44. data/app/views/catalog/_previous_next_doc.html.erb +6 -0
  45. data/app/views/catalog/_refworks_form.html.erb +7 -0
  46. data/app/views/catalog/_results_pagination.html.erb +11 -0
  47. data/app/views/catalog/_search_form.html.erb +14 -0
  48. data/app/views/catalog/_show_partials/_default.html.erb +9 -0
  49. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  50. data/app/views/catalog/_show_tools.html.erb +46 -0
  51. data/app/views/catalog/_sms_form.html.erb +23 -0
  52. data/app/views/catalog/_solr_request.html.erb +5 -0
  53. data/app/views/catalog/_sort_and_per_page.html.erb +20 -0
  54. data/app/views/catalog/_unapi_microformat.html.erb +1 -0
  55. data/app/views/catalog/citation.html.erb +1 -0
  56. data/app/views/catalog/email.erb +1 -0
  57. data/app/views/catalog/endnote.endnote.erb +1 -0
  58. data/app/views/catalog/facet.html.erb +28 -0
  59. data/app/views/catalog/index.atom.builder +108 -0
  60. data/app/views/catalog/index.html.erb +37 -0
  61. data/app/views/catalog/index.rss.builder +19 -0
  62. data/app/views/catalog/librarian_view.html.erb +3 -0
  63. data/app/views/catalog/opensearch.json.erb +0 -0
  64. data/app/views/catalog/opensearch.xml.erb +11 -0
  65. data/app/views/catalog/send_email_record.erb +0 -0
  66. data/app/views/catalog/show.endnote.erb +1 -0
  67. data/app/views/catalog/show.html.erb +42 -0
  68. data/app/views/catalog/show.refworks.erb +1 -0
  69. data/app/views/catalog/sms.erb +1 -0
  70. data/app/views/catalog/unapi.xml.builder +6 -0
  71. data/app/views/feedback/complete.html.erb +3 -0
  72. data/app/views/feedback/show.html.erb +20 -0
  73. data/app/views/folder/_tools.html.erb +23 -0
  74. data/app/views/folder/index.html.erb +44 -0
  75. data/app/views/layouts/blacklight.html.erb +49 -0
  76. data/app/views/record_mailer/email_record.erb +6 -0
  77. data/app/views/record_mailer/sms_record.erb +4 -0
  78. data/app/views/saved_searches/index.html.erb +27 -0
  79. data/app/views/search_history/index.html.erb +23 -0
  80. data/blacklight.gemspec +50 -0
  81. data/config.ru +4 -0
  82. data/config/routes.rb +54 -0
  83. data/db/seeds.rb +7 -0
  84. data/features/generators.feature +77 -0
  85. data/features/support/aruba.rb +9 -0
  86. data/install.rb +0 -0
  87. data/install/solr.yml +8 -0
  88. data/lib/blacklight.rb +121 -0
  89. data/lib/blacklight/catalog.rb +311 -0
  90. data/lib/blacklight/comma_link_renderer.rb +27 -0
  91. data/lib/blacklight/configurable.rb +46 -0
  92. data/lib/blacklight/controller.rb +121 -0
  93. data/lib/blacklight/engine.rb +32 -0
  94. data/lib/blacklight/exceptions.rb +13 -0
  95. data/lib/blacklight/marc.rb +46 -0
  96. data/lib/blacklight/marc/citation.rb +251 -0
  97. data/lib/blacklight/search_fields.rb +107 -0
  98. data/lib/blacklight/solr.rb +7 -0
  99. data/lib/blacklight/solr/document.rb +239 -0
  100. data/lib/blacklight/solr/document/dublin_core.rb +40 -0
  101. data/lib/blacklight/solr/document/email.rb +15 -0
  102. data/lib/blacklight/solr/document/marc.rb +84 -0
  103. data/lib/blacklight/solr/document/marc_export.rb +430 -0
  104. data/lib/blacklight/solr/document/sms.rb +13 -0
  105. data/lib/blacklight/solr/facet_paginator.rb +93 -0
  106. data/lib/blacklight/solr_helper.rb +413 -0
  107. data/lib/blacklight/user.rb +55 -0
  108. data/lib/blacklight/version.rb +3 -0
  109. data/lib/colorize.rb +196 -0
  110. data/lib/generators/blacklight/blacklight_generator.rb +134 -0
  111. data/lib/generators/blacklight/templates/SolrMarc.jar +0 -0
  112. data/lib/generators/blacklight/templates/catalog_controller.rb +8 -0
  113. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +37 -0
  114. data/lib/generators/blacklight/templates/config/SolrMarc/config.properties +37 -0
  115. data/lib/generators/blacklight/templates/config/SolrMarc/index.properties +97 -0
  116. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh +47 -0
  117. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/format.bsh +126 -0
  118. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/README_MAPS +1 -0
  119. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/callnumber_map.properties +407 -0
  120. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/composition_era_map.properties +56 -0
  121. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/country_map.properties +379 -0
  122. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/format_map.properties +50 -0
  123. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/instrument_map.properties +101 -0
  124. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/language_map.properties +490 -0
  125. data/lib/generators/blacklight/templates/config/blacklight_config.rb +245 -0
  126. data/lib/generators/blacklight/templates/config/solr.yml +6 -0
  127. data/lib/generators/blacklight/templates/migrations/add_user_types_to_bookmarks_searches.rb +11 -0
  128. data/lib/generators/blacklight/templates/migrations/create_bookmarks.rb +17 -0
  129. data/lib/generators/blacklight/templates/migrations/create_searches.rb +15 -0
  130. data/lib/generators/blacklight/templates/migrations/remove_editable_fields_from_bookmarks.rb +11 -0
  131. data/lib/generators/blacklight/templates/public/images/blacklight/bg.png +0 -0
  132. data/lib/generators/blacklight/templates/public/images/blacklight/border.png +0 -0
  133. data/lib/generators/blacklight/templates/public/images/blacklight/bul_sq_gry.gif +0 -0
  134. data/lib/generators/blacklight/templates/public/images/blacklight/checkmark.gif +0 -0
  135. data/lib/generators/blacklight/templates/public/images/blacklight/logo.png +0 -0
  136. data/lib/generators/blacklight/templates/public/images/blacklight/magnifying_glass.gif +0 -0
  137. data/lib/generators/blacklight/templates/public/images/blacklight/remove.gif +0 -0
  138. data/lib/generators/blacklight/templates/public/images/blacklight/separator.gif +0 -0
  139. data/lib/generators/blacklight/templates/public/images/blacklight/start_over.gif +0 -0
  140. data/lib/generators/blacklight/templates/public/javascripts/blacklight.js +485 -0
  141. data/lib/generators/blacklight/templates/public/javascripts/jquery-1.4.2.min.js +154 -0
  142. data/lib/generators/blacklight/templates/public/javascripts/jquery-ui-1.8.1.custom.min.js +756 -0
  143. data/lib/generators/blacklight/templates/public/stylesheets/blacklight.css +487 -0
  144. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  145. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  146. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  147. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  148. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  149. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  150. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
  151. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  152. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  153. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  154. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  155. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
  156. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  157. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  158. data/lib/generators/blacklight/templates/public/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +486 -0
  159. data/lib/generators/blacklight/templates/public/stylesheets/yui.css +31 -0
  160. data/lib/generators/blacklight/templates/solr_document.rb +30 -0
  161. data/lib/railties/blacklight.rake +66 -0
  162. data/lib/railties/cucumber.rake +53 -0
  163. data/lib/railties/rspec.rake +188 -0
  164. data/lib/railties/solr_marc.rake +148 -0
  165. data/lib/railties/test_solr_server.rb +130 -0
  166. data/spec/helpers/catalog_helper_spec.rb +111 -0
  167. data/spec/views/catalog/_sms_form.html.erb_spec.rb +19 -0
  168. data/tasks/blacklight_tasks.rake +4 -0
  169. data/uninstall.rb +1 -0
  170. metadata +431 -0
@@ -0,0 +1,3 @@
1
+ module Blacklight
2
+ VERSION = "3.0pre1"
3
+ end
@@ -0,0 +1,196 @@
1
+ # == colorize
2
+ # http://colorize.rubyforge.org
3
+ # http://fazibear.prv.pl
4
+ #
5
+
6
+ #
7
+ # Colorize String class extension.
8
+ #
9
+ class String
10
+
11
+ #
12
+ # Colors Hash
13
+ #
14
+ COLORS = {
15
+ :black => 0,
16
+ :red => 1,
17
+ :green => 2,
18
+ :yellow => 3,
19
+ :blue => 4,
20
+ :magenta => 5,
21
+ :cyan => 6,
22
+ :white => 7,
23
+ :default => 9,
24
+
25
+ :light_black => 10,
26
+ :light_red => 11,
27
+ :light_green => 12,
28
+ :light_yellow => 13,
29
+ :light_blue => 14,
30
+ :light_magenta => 15,
31
+ :light_cyan => 16,
32
+ :light_white => 17
33
+ }
34
+
35
+ #
36
+ # Modes Hash
37
+ #
38
+ MODES = {
39
+ :default => 0, # Turn off all attributes
40
+ #:bright => 1, # Set bright mode
41
+ :underline => 4, # Set underline mode
42
+ :blink => 5, # Set blink mode
43
+ :swap => 7, # Exchange foreground and background colors
44
+ :hide => 8 # Hide text (foreground color would be the same as background)
45
+ }
46
+
47
+ protected
48
+
49
+ #
50
+ # Set color values in new string intance
51
+ #
52
+ def set_color_parameters( params )
53
+ if (params.instance_of?(Hash))
54
+ @color = params[:color]
55
+ @background = params[:background]
56
+ @mode = params[:mode]
57
+ @uncolorized = params[:uncolorized]
58
+ self
59
+ else
60
+ nil
61
+ end
62
+ end
63
+
64
+ public
65
+
66
+ #
67
+ # Change color of string
68
+ #
69
+ # Examples:
70
+ #
71
+ # puts "This is blue".colorize( :blue )
72
+ # puts "This is light blue".colorize( :light_blue )
73
+ # puts "This is also blue".colorize( :color => :blue )
74
+ # puts "This is light blue with red background".colorize( :color => :light_blue, :background => :red )
75
+ # puts "This is light blue with red background".colorize( :light_blue ).colorize( :background => :red )
76
+ # puts "This is blue text on red".blue.on_red
77
+ # puts "This is red on blue".colorize( :red ).on_blue
78
+ # puts "This is red on blue and underline".colorize( :red ).on_blue.underline
79
+ # puts "This is blue text on red".blue.on_red.blink
80
+ # puts "This is uncolorized".blue.on_red.uncolorize
81
+ #
82
+ def colorize( params )
83
+ return self unless STDOUT.isatty
84
+
85
+ begin
86
+ require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/
87
+ rescue LoadError
88
+ raise 'You must gem install win32console to use colorize on Windows'
89
+ end
90
+
91
+ color_parameters = {}
92
+
93
+ if (params.instance_of?(Hash))
94
+ color_parameters[:color] = COLORS[params[:color]]
95
+ color_parameters[:background] = COLORS[params[:background]]
96
+ color_parameters[:mode] = MODES[params[:mode]]
97
+ elsif (params.instance_of?(Symbol))
98
+ color_parameters[:color] = COLORS[params]
99
+ end
100
+
101
+ color_parameters[:color] ||= @color ||= COLORS[:default]
102
+ color_parameters[:background] ||= @background ||= COLORS[:default]
103
+ color_parameters[:mode] ||= @mode ||= MODES[:default]
104
+
105
+ color_parameters[:uncolorized] ||= @uncolorized ||= self.dup
106
+
107
+ # calculate bright mode
108
+ color_parameters[:color] += 50 if color_parameters[:color] > 10
109
+
110
+ color_parameters[:background] += 50 if color_parameters[:background] > 10
111
+
112
+ "\033[#{color_parameters[:mode]};#{color_parameters[:color]+30};#{color_parameters[:background]+40}m#{color_parameters[:uncolorized]}\033[0m".set_color_parameters( color_parameters )
113
+ end
114
+
115
+ #
116
+ # Return uncolorized string
117
+ #
118
+ def uncolorize
119
+ @uncolorized || self
120
+ end
121
+
122
+ #
123
+ # Return true if sting is colorized
124
+ #
125
+ def colorized?
126
+ !defined?(@uncolorized).nil?
127
+ end
128
+
129
+ #
130
+ # Make some color and on_color methods
131
+ #
132
+ COLORS.each_key do | key |
133
+ next if key == :default
134
+
135
+ define_method key do
136
+ self.colorize( :color => key )
137
+ end
138
+
139
+ define_method "on_#{key}" do
140
+ self.colorize( :background => key )
141
+ end
142
+ end
143
+
144
+ #
145
+ # Methods for modes
146
+ #
147
+ MODES.each_key do | key |
148
+ next if key == :default
149
+
150
+ define_method key do
151
+ self.colorize( :mode => key )
152
+ end
153
+ end
154
+
155
+ class << self
156
+
157
+ #
158
+ # Return array of available modes used by colorize method
159
+ #
160
+ def modes
161
+ keys = []
162
+ MODES.each_key do | key |
163
+ keys << key
164
+ end
165
+ keys
166
+ end
167
+
168
+ #
169
+ # Return array of available colors used by colorize method
170
+ #
171
+ def colors
172
+ keys = []
173
+ COLORS.each_key do | key |
174
+ keys << key
175
+ end
176
+ keys
177
+ end
178
+
179
+ #
180
+ # Display color matrix with color names.
181
+ #
182
+ def color_matrix( txt = "[X]" )
183
+ size = String.colors.length
184
+ String.colors.each do | color |
185
+ String.colors.each do | back |
186
+ print txt.colorize( :color => color, :background => back )
187
+ end
188
+ puts " < #{color}"
189
+ end
190
+ String.colors.reverse.each_with_index do | back, index |
191
+ puts "#{"|".rjust(txt.length)*(size-index)} < #{back}"
192
+ end
193
+ ""
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,134 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ class BlacklightGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ argument :model_name, :type => :string , :default => "user"
10
+ class_option :devise , :type => :boolean, :default => false, :aliases => "-d", :desc => "Use Devise as authentication logic (this is default)."
11
+
12
+ desc """
13
+ This generator makes the following changes to your application:
14
+ 1. Creates several database migrations if they do not exist in /db/migrate
15
+ 2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
16
+ 3. Creates config/initializers/blacklight_config.rb which you should then modify for your instance
17
+ 4. Creates config/solr.yml with a default solr configuration that should work with standard marc records
18
+ 5. Creates congig/SolrMarc/... with settings for SolrMarc
19
+ 6. Creates a number of public assets, including images, stylesheets, and javascript
20
+ 7. Adds a solr_marc.jar file to your lib/ directory
21
+ 9. Injects behavior into your user application_controller.rb
22
+ 9. Injects behavior into your user model
23
+ 10. Creates a blacklight catalog controller in your /app/controllers directory
24
+ 11. Creates a blacklight document in your /app/models directory
25
+ Thank you for Installing Blacklight.
26
+ """
27
+ # Implement the required interface for Rails::Generators::Migration.
28
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
29
+ def self.next_migration_number(path)
30
+ unless @prev_migration_nr
31
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
32
+ else
33
+ @prev_migration_nr += 1
34
+ end
35
+ @prev_migration_nr.to_s
36
+ end
37
+
38
+ # Content types used by Marc Document extension, possibly among others.
39
+ # Registering a unique content type with 'register' (rather than
40
+ # register_alias) will allow content-negotiation for the format.
41
+ def add_mime_types
42
+ puts "Updating Mime Types"
43
+ insert_into_file "config/initializers/mime_types.rb", :after => "# Be sure to restart your server when you modify this file." do <<EOF
44
+ Mime::Type.register_alias "text/plain", :refworks_marc_txt
45
+ Mime::Type.register_alias "text/plain", :openurl_kev
46
+ Mime::Type.register "application/x-endnote-refer", :endnote
47
+ Mime::Type.register "application/marc", :marc
48
+ Mime::Type.register "application/marcxml+xml", :marcxml,
49
+ ["application/x-marc+xml", "application/x-marcxml+xml",
50
+ "application/marc+xml"]
51
+ EOF
52
+ end
53
+ end
54
+
55
+ # Install Devise?
56
+ def generate_devise_assets
57
+ if options[:devise]
58
+ gem "devise"
59
+ run "bundle install"
60
+ generate "devise:install"
61
+ generate "devise", model_name.classify
62
+ generate "devise:views"
63
+ end
64
+ end
65
+
66
+ # Copy all files in templates/config directory to host config
67
+ def create_configuration_files
68
+ copy_file "config/blacklight_config.rb", "config/initializers/blacklight_config.rb"
69
+ copy_file "config/solr.yml", "config/solr.yml"
70
+ directory("config/SolrMarc")
71
+ end
72
+
73
+ # Copy all files in templates/public/ directory to public/
74
+ def copy_public_assets
75
+ directory("public")
76
+ end
77
+
78
+ # Setup the database migrations
79
+ def copy_migrations
80
+ # Can't get this any more DRY, because we need this order.
81
+ better_migration_template "create_searches.rb"
82
+ better_migration_template "create_bookmarks.rb"
83
+ better_migration_template "remove_editable_fields_from_bookmarks.rb"
84
+ better_migration_template "add_user_types_to_bookmarks_searches.rb"
85
+ end
86
+
87
+ # Copy ocver the solr_marc.jar file
88
+ def copy_solr_marc
89
+ copy_file "SolrMarc.jar", "lib/SolrMarc.jar"
90
+ end
91
+
92
+ # Add Blacklight to the user model
93
+ def inject_blacklight_user_behavior
94
+ file_path = "app/models/#{model_name.underscore}.rb"
95
+ if File.exists?(file_path)
96
+ inject_into_class file_path, model_name.classify do
97
+ "# Connects this user object to Blacklights Bookmarks and Folders. " +
98
+ "\n include Blacklight::User\n"
99
+ end
100
+ else
101
+ puts " \e[31mFailure\e[0m Blacklight requires a user object in order to presist bookmarks and saved searches. This generators assumes that the model is defined in the file /app/models/user.rb, which does not exist. If you used a different name, please re-run the migration and provide that name as an argument. Such as \b rails -g blacklight client"
102
+ end
103
+ end
104
+
105
+ # Add Blacklight to the application controller
106
+ def inject_blacklight_controller_behavior
107
+ # prepend_file("app/controllers/application_controller.rb", "require 'blacklight/controller'\n\n")
108
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
109
+ " # Adds a few additional behaviors into the application controller \n " +
110
+ " include Blacklight::Controller\n" +
111
+ " # Please be sure to impelement current_user and user_session. Blacklight depends on \n" +
112
+ " # these methods in order to perform user specific actions. \n\n"
113
+ end
114
+ end
115
+
116
+ # Generate blacklight document and the catalog controller
117
+ def create_blacklight_catalog_and_document
118
+ copy_file "solr_document.rb", "app/models/solr_document.rb"
119
+ copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
120
+ end
121
+
122
+ private
123
+
124
+ def better_migration_template (file)
125
+ begin
126
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
127
+ sleep 1 # ensure scripts have different time stamps
128
+ rescue
129
+ puts " \e[1m\e[34mMigrations\e[0m " + $!.message
130
+ end
131
+ end
132
+
133
+ end
134
+
@@ -0,0 +1,8 @@
1
+ require 'blacklight/catalog'
2
+
3
+ class CatalogController < ApplicationController
4
+
5
+ include Blacklight::SolrHelper
6
+ include Blacklight::Catalog
7
+
8
+ end
@@ -0,0 +1,37 @@
1
+ # If using the solr:marc:index task, you can define environment-specific
2
+ # config files that will be used instead of 'config.properties' for
3
+ # a specific environment. config-development.properties,
4
+ # config-production.properties, etc.
5
+
6
+ # Relative paths for solrmarc.solr.war.path and solr.path are relative
7
+ # to the location of SolrMarc.jar, which for blacklight is by default
8
+ # in blacklight/config/solr_marc.
9
+
10
+ # solrmarc.solr.war.path - must point to either a war file for the version of
11
+ # Solr that you want to use, or to a directory of jar files extracted from a
12
+ # Solr war files. If this is not provided, SolrMarc can only work by
13
+ # communicating with a running Solr server.
14
+ solrmarc.solr.war.path=../jetty/webapps/solr.war
15
+ # Path to your solr instance
16
+ solr.path = ../jetty/solr
17
+
18
+ # Relative paths for solr.indexer can be relative to the location of
19
+ # this config.properties file.
20
+ solr.indexer = org.solrmarc.index.SolrIndexer
21
+ solr.indexer.properties = index.properties
22
+
23
+ # URL of running solr search engine to cause updates to be recognized.
24
+ # * When solr.path and solrmarc.solr.war.path are defined, this is optional,
25
+ # but if defined SolrMarc will issue a 'commit' after it's done indexing.
26
+ # * Alternately, do not define solr.path or solrmarc.solr.war.path to have
27
+ # SolrMarc use HTTP Post to add documents.
28
+ # NOTE:
29
+ # When using the solr:marc:index rake task, this value will be automatically
30
+ # looked up from your solr.yml, and the value here will NOT be used.
31
+ solr.hosturl = http://localhost:8888/solr/update
32
+
33
+ # MARC handling parameters
34
+ marc.to_utf_8 = true
35
+ marc.permissive = true
36
+ marc.default_encoding = MARC8
37
+ marc.include_errors = false
@@ -0,0 +1,37 @@
1
+ # If using the solr:marc:index task, you can define environment-specific
2
+ # config files that will be used instead of 'config.properties' for
3
+ # a specific environment. config-development.properties,
4
+ # config-production.properties, etc.
5
+
6
+ # Relative paths for solrmarc.solr.war.path and solr.path are relative
7
+ # to the location of SolrMarc.jar, which for blacklight is by default
8
+ # in blacklight/config/solr_marc.
9
+
10
+ # solrmarc.solr.war.path - must point to either a war file for the version of
11
+ # Solr that you want to use, or to a directory of jar files extracted from a
12
+ # Solr war files. If this is not provided, SolrMarc can only work by
13
+ # communicating with a running Solr server.
14
+ # solrmarc.solr.war.path= ../../../../jetty/webapps/solr.war
15
+ # Path to your solr instance
16
+ # solr.path = ../../../../jetty/solr
17
+
18
+ # Relative paths for solr.indexer can be relative to the location of
19
+ # this config.properties file.
20
+ solr.indexer = org.solrmarc.index.SolrIndexer
21
+ solr.indexer.properties = index.properties
22
+
23
+ # URL of running solr search engine to cause updates to be recognized.
24
+ # * When solr.path and solrmarc.solr.war.path are defined, this is optional,
25
+ # but if defined SolrMarc will issue a 'commit' after it's done indexing.
26
+ # * Alternately, do not define solr.path or solrmarc.solr.war.path to have
27
+ # SolrMarc use HTTP Post to add documents.
28
+ # NOTE:
29
+ # When using the solr:marc:index rake task, this value will be automatically
30
+ # looked up from your solr.yml, and the value here will NOT be used.
31
+ solr.hosturl = http://localhost:8983/solr/update
32
+
33
+ # MARC handling parameters
34
+ marc.to_utf_8 = true
35
+ marc.permissive = true
36
+ marc.default_encoding = MARC8
37
+ marc.include_errors = false
@@ -0,0 +1,97 @@
1
+ # for more information on solrmarc mappings,
2
+ # see http://code.google.com/p/solrmarc/w/list
3
+ #
4
+ # GenericBlacklight uses these conventions, mostly.
5
+ # _t for indexed fields (for searching)
6
+ # _display for stored fields (for display in UI)
7
+ # _facet for facet fields
8
+ # _sort for sorting fields (fields used to sort results)
9
+ #
10
+ # see jetty/solr/conf/schema.xml in Blacklight demo project
11
+ # see http://blacklight.rubyforge.org/ DEMO_README file
12
+
13
+ id = 001, first
14
+ marc_display = FullRecordAsXML
15
+ text = custom, getAllSearchableFields(100, 900)
16
+
17
+ language_facet = 008[35-37]:041a:041d, language_map.properties
18
+ # format is for facet, display, and selecting partial for display in show view
19
+ format = 007[0-1]:000[6-7]:000[6], (map.format), first
20
+ isbn_t = 020a, (pattern_map.isbn_clean)
21
+ material_type_display = custom, removeTrailingPunct(300aa)
22
+
23
+ # Title fields
24
+ # primary title
25
+ title_t = custom, getLinkedFieldCombined(245a)
26
+ title_display = custom, removeTrailingPunct(245a)
27
+ title_vern_display = custom, getLinkedField(245a)
28
+ # subtitle
29
+ subtitle_t = custom, getLinkedFieldCombined(245b)
30
+ subtitle_display = custom, removeTrailingPunct(245b)
31
+ subtitle_vern_display = custom, getLinkedField(245b)
32
+ # additional title fields
33
+ title_addl_t = custom, getLinkedFieldCombined(245abnps:130[a-z]:240[a-gk-s]:210ab:222ab:242abnp:243[a-gk-s]:246[a-gnp]:247[a-gnp])
34
+ title_added_entry_t = custom, getLinkedFieldCombined(700[gk-pr-t]:710[fgk-t]:711fgklnpst:730[a-gk-t]:740anp)
35
+ title_series_t = custom, getLinkedFieldCombined(440anpv:490av)
36
+ title_sort = custom, getSortableTitle
37
+
38
+ # Author fields
39
+ author_t = custom, getLinkedFieldCombined(100abcegqu:110abcdegnu:111acdegjnqu)
40
+ author_addl_t = custom, getLinkedFieldCombined(700abcegqu:710abcdegnu:711acdegjnqu)
41
+ author_display = custom, removeTrailingPunct(100abcdq:110[a-z]:111[a-z])
42
+ author_vern_display = custom, getLinkedField(100abcdq:110[a-z]:111[a-z])
43
+ author_sort = custom, getSortableAuthor
44
+
45
+ # Subject fields
46
+ subject_t = custom, getLinkedFieldCombined(600[a-u]:610[a-u]:611[a-u]:630[a-t]:650[a-e]:651ae:653aa:654[a-e]:655[a-c])
47
+ subject_addl_t = custom, getLinkedFieldCombined(600[v-z]:610[v-z]:611[v-z]:630[v-z]:650[v-z]:651[v-z]:654[v-z]:655[v-z])
48
+ subject_topic_facet = custom, removeTrailingPunct(600abcdq:610ab:611ab:630aa:650aa:653aa:654ab:655ab)
49
+ subject_era_facet = custom, removeTrailingPunct(650y:651y:654y:655y)
50
+ subject_geo_facet = custom, removeTrailingPunct(651a:650z)
51
+
52
+ # Publication fields
53
+ published_display = custom, removeTrailingPunct(260a)
54
+ published_vern_display = custom, getLinkedField(260a)
55
+ # used for facet and display, and copied for sort
56
+ pub_date = custom, getDate
57
+
58
+ # Call Number fields
59
+ lc_callnum_display = 050ab, first
60
+ lc_1letter_facet = 050a[0], callnumber_map.properties, first
61
+ lc_alpha_facet = 050a, (pattern_map.lc_alpha), first
62
+ lc_b4cutter_facet = 050a, first
63
+
64
+ # URL Fields
65
+ url_fulltext_display = custom, getFullTextUrls
66
+ url_suppl_display = custom, getSupplUrls
67
+
68
+
69
+ # MAPPINGS
70
+
71
+ # format mapping
72
+ # leader 06-07
73
+ map.format.aa = Book
74
+ map.format.ab = Serial
75
+ map.format.am = Book
76
+ map.format.as = Serial
77
+ map.format.ta = Book
78
+ map.format.tm = Book
79
+ # leader 06
80
+ map.format.c = Musical Score
81
+ map.format.d = Musical Score
82
+ map.format.e = Map or Globe
83
+ map.format.f = Map or Globe
84
+ map.format.i = Non-musical Recording
85
+ map.format.j = Musical Recording
86
+ map.format.k = Image
87
+ map.format.m = Computer File
88
+ # 007[0] when it doesn't clash with above
89
+ map.format.h = Microform
90
+ map.format.q = Musical Score
91
+ map.format.v = Video
92
+ # none of the above
93
+ map.format = Unknown
94
+
95
+ pattern_map.lc_alpha.pattern_0 = ^([A-Z]{1,3})\\d+.*=>$1
96
+
97
+ pattern_map.isbn_clean.pattern_0 = ([- 0-9]*[0-9]).*=>$1