cul_hydra 1.9.5 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cbe0237339bc24069451b8fae3742430d8ba2b9e2d102ee7d2cebcf0d6905d3
4
- data.tar.gz: 9ee494352f8aeb9be9f597a6ec2b24e358a89193e5a4e69e0bfd89113ede246a
3
+ metadata.gz: 819e0f48c1fa5131507b07dc2a9a85ff860f8c5db1da630340fac4304182b2d4
4
+ data.tar.gz: 344dd588d2abd59cc6c6e79a0b33722e93cd6da565bdb4e7bcc9533ce1dfabae
5
5
  SHA512:
6
- metadata.gz: d94d52aa21a5739cce5277e60f72980d7d542ae28bf6e19491ec9baa6cef141147e10cceae46ae94192952b748dc46ea357de4133d12f2e0677f69eb3873af6c
7
- data.tar.gz: c95522636da024ea1eb7f34fe11fbfed9f2de266c5f0eba22bbfa06ea4084e1ddaaab9b8f466812b2f3ad9de6d5410935be3d4b451568558a5baaf96d38850a9
6
+ metadata.gz: 4128ef0a29f9491e0668d7c3f4c3691c46eeab5a5157b3016ff06bdd60ef72f3dcc00a83261069cc16a154cd59de1f854f4dc570943dfeaf43b11c9273cc01ff
7
+ data.tar.gz: d566fbc71e0206609f726ed6565985fa28125cf28758c31a7f67b7488ce6d02fda5511efc9603147a0f3c9258a03240fb503d94ca66f715e78a10c1bc2d59aa6
@@ -3,7 +3,7 @@ module Cul::Hydra::ApplicationIdBehavior
3
3
 
4
4
  def find_for_params(path,solr_params)
5
5
  res = blacklight_config.repository.send_and_receive(path, {key=>solr_params.to_hash, method:blacklight_config.http_method})
6
- Blacklight::SolrResponse.new(res, solr_params, solr_document_model: blacklight_config.solr_document_model)
6
+ Blacklight::SolrResponse.new(res, solr_params, blacklight_config: blacklight_config)
7
7
  end
8
8
 
9
9
  def get_solr_response_for_app_id(id=nil, extra_controller_params={})
@@ -18,7 +18,7 @@ module Cul::Hydra::ApplicationIdBehavior
18
18
  #p[:qt] ||= blacklight_config.document_solr_request_handler
19
19
  repository = blacklight_config.repository_class.new(blacklight_config)
20
20
  solr_response = repository.search(p)
21
- raise Blacklight::Exceptions::InvalidSolrID.new(id) if solr_response.docs.empty?
21
+ raise Blacklight::Exceptions::RecordNotFound.new(id) if solr_response.docs.empty?
22
22
  document = SolrDocument.new(solr_response.docs.first, solr_response)
23
23
  @response, @document = [solr_response, document]
24
24
  end
@@ -35,7 +35,7 @@ module Cul::Hydra::ApplicationIdBehavior
35
35
  #p[:qt] ||= blacklight_config.document_solr_request_handler
36
36
  repository = blacklight_config.repository_class.new(blacklight_config)
37
37
  solr_response = repository.search(p)
38
- raise Blacklight::Exceptions::InvalidSolrID.new(id) if solr_response.docs.empty?
38
+ raise Blacklight::Exceptions::RecordNotFound.new(id) if solr_response.docs.empty?
39
39
  document = SolrDocument.new(solr_response.docs.first, solr_response)
40
40
  @response, @document = [solr_response, document]
41
41
  end
@@ -1,22 +1,10 @@
1
1
  module Cul::Hydra::Controller
2
2
 
3
- def asset_path_from_config(asset)
4
- Rails.configuration.assets.paths.each do |dir|
5
- result = "#{dir}/#{asset}"
6
- return result if File.exists?(result)
7
- end
8
- return nil
9
- end
10
-
11
3
  def asset_url(source)
12
4
  URI.join(root_url, ActionController::Base.helpers.asset_path(source))
13
5
  end
14
6
 
15
7
  def http_client
16
- unless @http_client
17
- @http_client ||= HTTPClient.new
18
- end
19
- @http_client
8
+ @http_client ||= HTTPClient.new
20
9
  end
21
-
22
- end
10
+ end
@@ -4,10 +4,10 @@ module Cul::Hydra::Resolver
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- # Whenever an action raises SolrHelper::InvalidSolrID, this block gets executed.
7
+ # Whenever an action raises SolrHelper::RecordNotFound, this block gets executed.
8
8
  # Hint: the SolrHelper #get_solr_response_for_doc_id method raises this error,
9
9
  # which is used in the #show action here.
10
- self.rescue_from Blacklight::Exceptions::InvalidSolrID, :with => :invalid_solr_id_error
10
+ self.rescue_from Blacklight::Exceptions::RecordNotFound, :with => :invalid_solr_id_error
11
11
  # When RSolr::RequestError is raised, the rsolr_request_error method is executed.
12
12
  # The index action will more than likely throw this one.
13
13
  # Example, when the standard query parser is used, and a user submits a "bad" query.
@@ -19,7 +19,7 @@ module Cul::Hydra::Resolver
19
19
  solr_params = blacklight_config.default_document_solr_params.merge!(extra_controller_params)
20
20
  solr_params[:fq] = "identifier_ssim:#{(id)}"
21
21
  solr_response = find((blacklight_config.document_solr_request_handler || blacklight_config.qt), solr_params)
22
- raise Blacklight::Exceptions::InvalidSolrID.new if solr_response.docs.empty?
22
+ raise Blacklight::Exceptions::RecordNotFound.new if solr_response.docs.empty?
23
23
  document = SolrDocument.new(solr_response.docs.first, solr_response)
24
24
  @response, @document = [solr_response, document]
25
25
  end
@@ -51,7 +51,7 @@ module Cul::Hydra::Resolver
51
51
  end
52
52
  end
53
53
  end
54
-
54
+
55
55
  # when a request for /resolve/:action/BAD_SOLR_ID is made, this method is executed...
56
56
  def invalid_solr_id_error
57
57
  id = params.delete(:id)
@@ -60,10 +60,6 @@ module Cul::Hydra::Resolver
60
60
  end
61
61
 
62
62
  def blacklight_solr
63
- @solr ||= RSolr.connect(blacklight_solr_config)
64
- end
65
-
66
- def blacklight_solr_config
67
- Blacklight.solr_config
63
+ @solr ||= Blacklight.default_index
68
64
  end
69
65
  end
@@ -30,42 +30,4 @@ class AdministrativeSet < ::ActiveFedora::Base
30
30
  r.collect {|hit| members << SolrDocument.new(hit) } unless r.blank?
31
31
  members
32
32
  end
33
-
34
- def thumbnail_info
35
- members = solr_members
36
- if members.length == 0
37
- thumb = {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
38
- else
39
- thumb = thumb_from_members(members)
40
- end
41
- return thumb || {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
42
- end
43
-
44
- private
45
- def thumb_from_members(members)
46
- sorted = members.sort do |a,b|
47
- c = a['title_si'] <=> b['title_si']
48
- if c == 0 && a['identifier_ssim']
49
- if b['identifier_ssim']
50
- a['identifier_ssim'].delete(a.id) unless a['identifier_ssim'].length == 1
51
- b['identifier_ssim'].delete(a.id) unless b['identifier_ssim'].length == 1
52
- a['identifier_ssim'][0] <=> b['identifier_ssim'][0]
53
- else
54
- -1
55
- end
56
- else
57
- c
58
- end
59
- end
60
- thumb_from_solr_doc(sorted[0])
61
- end
62
-
63
- def thumb_from_solr_doc(solr_doc)
64
- if solr_doc and (member = ActiveFedora::Base.find(solr_doc.id, :cast=>true)).respond_to? :thumbnail_info
65
- member.thumbnail_info
66
- else
67
- return nil
68
- end
69
- end
70
-
71
33
  end
@@ -41,21 +41,6 @@ module Cul::Hydra::Models::Aggregator
41
41
  solr_members(opts).collect {|hit| hit.id}
42
42
  end
43
43
 
44
- def thumbnail_info
45
- members = solr_members
46
- if members.length == 0
47
- thumb = {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
48
- else
49
- thumb = nil
50
- unless datastreams['structMetadata'].new?
51
- thumb = thumb_from_struct(members)
52
- else
53
- thumb = thumb_from_members(members)
54
- end
55
- end
56
- return thumb || {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
57
- end
58
-
59
44
  # a representative image URI for this object
60
45
  # defined by the predicate https://schema.org/image
61
46
  # @return [String, URI]
@@ -68,48 +53,6 @@ module Cul::Hydra::Models::Aggregator
68
53
  end
69
54
 
70
55
  private
71
- def thumb_from_struct(members)
72
- puts "thumb thumb_from_struct"
73
- sm = datastreams['structMetadata']
74
- first = sm.divs_with_attribute(false,'ORDER','1').first
75
- if first
76
- members.each do |member|
77
- puts "looking for #{first["CONTENTIDS"]} in #{member["identifier_ssim"].inspect}"
78
- if member["identifier_ssim"].include? first["CONTENTIDS"]
79
- return thumb_from_solr_doc(member)
80
- end
81
- end
82
- return thumb_from_solr_doc(members.first) if members.first
83
- else
84
- return nil
85
- end
86
- end
87
-
88
- def thumb_from_members(members)
89
- sorted = members.sort do |a,b|
90
- c = a['title_si'] <=> b['title_si']
91
- if c == 0 && a['identifier_ssim']
92
- if b['identifier_ssim']
93
- a['identifier_ssim'].delete(a.id) unless a['identifier_ssim'].length == 1
94
- b['identifier_ssim'].delete(a.id) unless b['identifier_ssim'].length == 1
95
- a['identifier_ssim'][0] <=> b['identifier_ssim'][0]
96
- else
97
- -1
98
- end
99
- else
100
- c
101
- end
102
- end
103
- thumb_from_solr_doc(sorted[0])
104
- end
105
-
106
- def thumb_from_solr_doc(solr_doc)
107
- if solr_doc and (member = ActiveFedora::Base.find(solr_doc.id, :cast=>true)).respond_to? :thumbnail_info
108
- member.thumbnail_info
109
- else
110
- return nil
111
- end
112
- end
113
56
 
114
57
  def to_uri(obj)
115
58
  if obj.respond_to? :internal_uri
@@ -284,10 +284,6 @@ module Cul::Hydra::Models::Common
284
284
  return result
285
285
  end
286
286
 
287
- def thumbnail_info
288
- {:asset=>("cul_hydra/crystal/kmultiple.png"),:mime_type=>"image/png"}
289
- end
290
-
291
287
  def get_singular_rel(predicate)
292
288
  property = relationships(predicate).first
293
289
  return nil unless property
@@ -8,19 +8,6 @@ module Cul::Hydra::Models::ImageResource
8
8
  FORMAT_OF_PREDICATE = ActiveFedora::Predicates.short_predicate("http://purl.org/dc/terms/isFormatOf").to_s
9
9
  FORMAT_URI = RDF::URI("http://purl.org/dc/terms/format")
10
10
 
11
- DJATOKA_THUMBNAIL_PARMS = {
12
- "url_ver" => "Z39.88-2004",
13
- "svc_id" => "info:lanl-repo/svc/getRegion",
14
- "svc_val_fmt" => "info:ofi/fmt:kev:mtx:jpeg2000",
15
- "svc.format" => "image/jpeg",
16
- "svc.level" => "",
17
- "svc.rotate" => "0",
18
- "svc.scale" => "200",
19
- "svc.clayers" => ""
20
- }
21
-
22
- DJATOKA_BASE_URL = "http://iris.cul.columbia.edu:8888/resolve"
23
-
24
11
  EXIF_ORIENTATION_TO_DEGREES = {
25
12
  'top-left' => 0,
26
13
  'left-bottom' => 90,
@@ -57,33 +44,6 @@ module Cul::Hydra::Models::ImageResource
57
44
  end
58
45
  end
59
46
 
60
- def zooming?
61
- zoom = rels_int.relationships(datastreams['content'],:foaf_zooming).first
62
- return zoom.object.to_s if zoom
63
- datastreams.each do |k,v|
64
- if v.mimeType =~ /image\/jp2$/i
65
- zoom = "info:fedora/#{k.dsid}"
66
- end
67
- end
68
- return zoom
69
- end
70
-
71
- def thumbnail_info
72
- thumb = rels_int.relationships(datastreams['content'],:foaf_thumbnail).first
73
- if thumb
74
- t_dsid = thumb.object.to_s.split('/')[-1]
75
- t_url = "#{ActiveFedora.fedora_config.credentials[:url]}/objects/#{pid}/datastreams/#{t_dsid}/content"
76
- return {:url=>t_url,:mime=>datastreams[t_dsid].mimeType}
77
- elsif (zoom = self.zooming?)
78
- t_dsid = zoom.split('/')[-1]
79
- t_parms = DJATOKA_THUMBNAIL_PARMS.merge({"rft_id" => datastreams[t_dsid].dsLocation})
80
- url = "#{DJATOKA_BASE_URL}?#{options.map { |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}"}.join("&") }"
81
- {:url => url, :mime => t_parms["svc.format"]}
82
- else
83
- return {:asset=>"cul_hydra/crystal/file.png",:mime=>'image/png'}
84
- end
85
- end
86
-
87
47
  # The number of rotational degrees required to display this image as upright
88
48
  def required_rotation_for_upright_display
89
49
  required_rotation_orientation_in_degrees = (360 - self.orientation) % 360
@@ -102,5 +62,4 @@ module Cul::Hydra::Models::ImageResource
102
62
  def orientation
103
63
  self.relationships(:orientation).present? ? EXIF_ORIENTATION_TO_DEGREES[self.relationships(:orientation).first.to_s] : 0
104
64
  end
105
-
106
65
  end
@@ -28,9 +28,6 @@ module Cul::Hydra::Models::Resource
28
28
 
29
29
  after_create :resource!
30
30
  end
31
- if self.respond_to? :has_datastream
32
- has_datastream :name => "CONTENT", :type=>::ActiveFedora::Datastream, :versionable => true
33
- end
34
31
  end
35
32
 
36
33
  def resource!
@@ -39,50 +36,4 @@ module Cul::Hydra::Models::Resource
39
36
  @metadata_is_dirty = true
40
37
  update
41
38
  end
42
-
43
- def add_content_blob(blob, opts)
44
- file_name = opts[:file_name]
45
- mime = opts[:mime_type].nil? ? mime_type(file_name) : opts[:mime_type]
46
- add_file_datastream(blob, :label=>file_name, :mimeType=>mime, :dsid => 'CONTENT')
47
- set_title_and_label( file_name, :only_if_blank=>true )
48
- if IMAGE_MIME_TYPES.include? mime
49
- blob.rewind
50
- # retrieve Nokogiri of image property RDF
51
- image_properties = Cul::Image::Properties.identify(blob)
52
- if image_properties
53
- image_prop_nodes = image_properties.nodeset
54
- relsext = datastreams['RELS-EXT']
55
- image_prop_nodes.each { |node|
56
- if node["resource"]
57
- is_literal = false
58
- object = RDF::URI.new(node["resource"])
59
- else
60
- is_literal = true
61
- object = RDF::Literal(node.text)
62
- end
63
- subject = RDF::URI(internal_uri)
64
- predicate = RDF::URI("#{node.namespace.href}#{node.name}")
65
- query = RDF::Query.new({ :subject => {predicate => :object}})
66
- relationships(predicate).dup.each { |stmt|
67
- relationships.delete(stmt)
68
- }
69
- add_relationship(predicate,object, is_literal)
70
- relationships_are_dirty=true
71
- }
72
- # add mimetype to DC:format values
73
- self.datastreams['DC'].update_values({[:format] => mime})
74
- end
75
- end
76
- blob.rewind
77
- end
78
-
79
- private
80
-
81
- # Return the mimeType for a given file name
82
- # @param [String] file_name The filename to use to get the mimeType
83
- # @return [String] mimeType for filename passed in. Default: application/octet-stream if mimeType cannot be determined
84
- def mime_type file_name
85
- mime_types = MIME::Types.of(file_name)
86
- mime_type = mime_types.empty? ? "application/octet-stream" : mime_types.first.content_type
87
- end
88
39
  end
@@ -17,7 +17,6 @@ module Hydra
17
17
  autoload :Aggregator, 'cul/hydra/models/aggregator'
18
18
  autoload :Common, 'cul/hydra/models/common'
19
19
  autoload :ImageResource, 'cul/hydra/models/image_resource'
20
- autoload :LinkableResources, 'cul/hydra/models/linkable_resources'
21
20
  autoload :RelsInt, 'cul/hydra/models/rels_int'
22
21
  autoload :Resource, 'cul/hydra/models/resource'
23
22
  end
@@ -13,11 +13,11 @@ module Hydra
13
13
 
14
14
  def serialize!
15
15
  self.content = to_rels_int() if changed_attributes.include? 'relationships'
16
- clear_attribute_changes 'relationships'
16
+ clear_attribute_changes ['relationships']
17
17
  end
18
18
 
19
19
  def relationships_will_change!
20
- changed_attributes['relationships'] = nil
20
+ attribute_will_change!('relationships')
21
21
  end
22
22
 
23
23
  def content
@@ -114,7 +114,7 @@ module Hydra
114
114
  g << stmt
115
115
  end
116
116
  self.relationships_loaded = true
117
- clear_attribute_changes 'relationships'
117
+ clear_attribute_changes ['relationships']
118
118
  @graph = g
119
119
  end
120
120
 
@@ -1,4 +1,3 @@
1
- require "cul_image_props"
2
1
  require "mime/types"
3
2
  require "uri"
4
3
  require "open-uri"
@@ -53,15 +52,6 @@ class GenericResource < ::ActiveFedora::Base
53
52
  end
54
53
  end
55
54
 
56
- if self.zooming?
57
- fz = rels_int.relationships(datastreams['content'], :foaf_zooming).first.object.to_s.split('/')[-1]
58
- ds = datastreams[fz]
59
- unless ds.nil?
60
- rft_id = ds.controlGroup == 'E' ? datastreams[fz].dsLocation : legacy_content_path(ds,'info:fedora/datastreams/')
61
- solr_doc['rft_id_ss'] = rft_id
62
- end
63
- end
64
-
65
55
  if (service_ds = self.service_datastream)
66
56
  solr_doc['service_dslocation_ss'] = service_ds.dsLocation
67
57
  end
@@ -82,22 +72,6 @@ class GenericResource < ::ActiveFedora::Base
82
72
  solr_doc
83
73
  end
84
74
 
85
- def thumbnail_info
86
- thumb = rels_int.relationships(datastreams['content'],:foaf_thumbnail).first
87
- if thumb
88
- t_dsid = thumb.object.to_s.split('/')[-1]
89
- t_url = "#{ActiveFedora.fedora_config.credentials[:url]}/objects/#{pid}/datastreams/#{t_dsid}/content"
90
- return {:url=>t_url,:mime=>datastreams[t_dsid].mimeType}
91
- elsif self.zooming?
92
- t_dsid = rels_int.relationships(dsuri, :foaf_zooming).first.object.to_s.split('/')[-1]
93
- t_parms = DJATOKA_THUMBNAIL_PARMS.merge({"rft_id" => datastreams[t_dsid].dsLocation})
94
- url = "#{DJATOKA_BASE_URL}?#{options.map { |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}"}.join("&") }"
95
- {:url => url, :mime => t_parms["svc.format"]}
96
- else
97
- return {:asset => "cul_hydra/crystal/file.png",:mime=>'image/png'}
98
- end
99
- end
100
-
101
75
  def linkable_resources
102
76
  # let's start with the known DSIDs from lindquist, then work our way back to parsing the solrized relsint
103
77
  results = []
@@ -135,17 +109,6 @@ class GenericResource < ::ActiveFedora::Base
135
109
  results
136
110
  end
137
111
 
138
- def zooming?
139
- content = datastreams['content']
140
- return false unless content
141
- zr = rels_int.relationships(content, :foaf_zooming)
142
- if (zr && zr.first)
143
- return !zr.first.blank?
144
- else
145
- false
146
- end
147
- end
148
-
149
112
  def closed?
150
113
  return access_levels.map(&:downcase).include?('closed')
151
114
  end
@@ -13,8 +13,7 @@ module ClassMethods
13
13
  recursive_member_query += ' and $cmodel <mulgara:is> <info:fedora/ldpd:' + cmodel_type + '>'
14
14
  end
15
15
 
16
- puts 'Performing query:' if verbose_output
17
- puts recursive_member_query if verbose_output
16
+ log_risearch_query(recursive_member_query, verbose_output)
18
17
 
19
18
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(recursive_member_query, {
20
19
  :type => 'tuples',
@@ -35,8 +34,7 @@ module ClassMethods
35
34
  'select $pid from <#ri>
36
35
  where $pid <http://purl.oclc.org/NET/CUL/memberOf> <fedora:' + pid + '>'
37
36
 
38
- puts 'Performing query:' if verbose_output
39
- puts direct_member_query if verbose_output
37
+ log_risearch_query(direct_member_query, verbose_output)
40
38
 
41
39
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(direct_member_query, {
42
40
  :type => 'tuples',
@@ -72,8 +70,7 @@ module ClassMethods
72
70
  where $pid <http://purl.oclc.org/NET/CUL/memberOf> <info:fedora/#{pid}>
73
71
  having $k0 <http://mulgara.org/mulgara#occursMoreThan> '0.0'^^<http://www.w3.org/2001/XMLSchema#double>;"
74
72
 
75
- puts 'Performing query:' if verbose_output
76
- puts direct_members_with_ds_query if verbose_output
73
+ log_risearch_query(direct_members_with_ds_query, verbose_output)
77
74
 
78
75
  search_response = JSON.parse(Cul::Hydra::Fedora.repository.find_by_itql(direct_members_with_ds_query, {
79
76
  :type => 'tuples',
@@ -99,8 +96,7 @@ module ClassMethods
99
96
  'select $pid from <#ri>
100
97
  where $pid <info:fedora/fedora-system:def/relations-external#isConstituentOf> <fedora:' + pid + '>'
101
98
 
102
- puts 'Performing query:' if verbose_output
103
- puts project_constituent_query if verbose_output
99
+ log_risearch_query(project_constituent_query, verbose_output)
104
100
 
105
101
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(project_constituent_query, {
106
102
  :type => 'tuples',
@@ -130,8 +126,7 @@ module ClassMethods
130
126
  'select $pid from <#ri>
131
127
  where $pid <http://purl.org/dc/terms/publisher> <fedora:' + pid + '>'
132
128
 
133
- puts 'Performing query:' if verbose_output
134
- puts project_constituent_query if verbose_output
129
+ log_risearch_query(project_constituent_query, verbose_output)
135
130
 
136
131
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(project_constituent_query, {
137
132
  :type => 'tuples',
@@ -199,6 +194,9 @@ module ClassMethods
199
194
  return pids_to_return
200
195
  end
201
196
 
197
+ def log_risearch_query(query, verbose_output = false)
198
+ puts "Performing query:\n#{query}" if verbose_output
199
+ end
202
200
  end
203
201
  extend ClassMethods
204
202
  end
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.9.5'
3
+ VERSION = '1.11.1'
4
4
  def self.version
5
5
  VERSION
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
@@ -9,50 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-14 00:00:00.000000000 Z
12
+ date: 2021-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.2.10
20
+ version: '5.2'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '6.0'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '5.2'
31
+ - - "<"
26
32
  - !ruby/object:Gem::Version
27
- version: 4.2.10
33
+ version: '6.0'
28
34
  - !ruby/object:Gem::Dependency
29
- name: bootstrap-sass
35
+ name: bootstrap
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - "~>"
33
39
  - !ruby/object:Gem::Version
34
- version: 3.3.7
40
+ version: '4.6'
35
41
  type: :runtime
36
42
  prerelease: false
37
43
  version_requirements: !ruby/object:Gem::Requirement
38
44
  requirements:
39
45
  - - "~>"
40
46
  - !ruby/object:Gem::Version
41
- version: 3.3.7
47
+ version: '4.6'
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: blacklight
44
50
  requirement: !ruby/object:Gem::Requirement
45
51
  requirements:
46
52
  - - "~>"
47
53
  - !ruby/object:Gem::Version
48
- version: '6.0'
54
+ version: '7.0'
49
55
  type: :runtime
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
52
58
  requirements:
53
59
  - - "~>"
54
60
  - !ruby/object:Gem::Version
55
- version: '6.0'
61
+ version: '7.0'
56
62
  - !ruby/object:Gem::Dependency
57
63
  name: httpclient
58
64
  requirement: !ruby/object:Gem::Requirement
@@ -115,20 +121,6 @@ dependencies:
115
121
  - - ">="
116
122
  - !ruby/object:Gem::Version
117
123
  version: 0.5.0
118
- - !ruby/object:Gem::Dependency
119
- name: cul_image_props
120
- requirement: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- type: :runtime
126
- prerelease: false
127
- version_requirements: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
124
  - !ruby/object:Gem::Dependency
133
125
  name: mods
134
126
  requirement: !ruby/object:Gem::Requirement
@@ -219,28 +211,14 @@ dependencies:
219
211
  requirements:
220
212
  - - "~>"
221
213
  - !ruby/object:Gem::Version
222
- version: 2.0.0
223
- type: :runtime
224
- prerelease: false
225
- version_requirements: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: 2.0.0
230
- - !ruby/object:Gem::Dependency
231
- name: sprockets
232
- requirement: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: '3.0'
214
+ version: 2.1.0
237
215
  type: :runtime
238
216
  prerelease: false
239
217
  version_requirements: !ruby/object:Gem::Requirement
240
218
  requirements:
241
219
  - - "~>"
242
220
  - !ruby/object:Gem::Version
243
- version: '3.0'
221
+ version: 2.1.0
244
222
  - !ruby/object:Gem::Dependency
245
223
  name: sqlite3
246
224
  requirement: !ruby/object:Gem::Requirement
@@ -359,7 +337,6 @@ files:
359
337
  - app/controllers/concerns/cul/hydra/application_id_behavior.rb
360
338
  - app/controllers/concerns/cul/hydra/controller.rb
361
339
  - app/controllers/concerns/cul/hydra/resolver.rb
362
- - app/controllers/concerns/cul/hydra/thumbnails.rb
363
340
  - app/helpers/cul/hydra/ore_proxies_helper_behavior.rb
364
341
  - app/helpers/cul/hydra/struct_metadata_helper_behavior.rb
365
342
  - app/models/administrative_set.rb
@@ -370,7 +347,6 @@ files:
370
347
  - app/models/concerns/cul/hydra/models/aggregator.rb
371
348
  - app/models/concerns/cul/hydra/models/common.rb
372
349
  - app/models/concerns/cul/hydra/models/image_resource.rb
373
- - app/models/concerns/cul/hydra/models/linkable_resources.rb
374
350
  - app/models/concerns/cul/hydra/models/rels_int.rb
375
351
  - app/models/concerns/cul/hydra/models/resource.rb
376
352
  - app/models/concerns/nfo/common.rb
@@ -566,7 +542,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
566
542
  - !ruby/object:Gem::Version
567
543
  version: '0'
568
544
  requirements: []
569
- rubygems_version: 3.0.8
545
+ rubygems_version: 3.0.9
570
546
  signing_key:
571
547
  specification_version: 4
572
548
  summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps
@@ -1,62 +0,0 @@
1
- require 'httpclient'
2
- module Cul::Hydra::Thumbnails
3
- # some thumbnail urls
4
- NO_THUMB = "cul_hydra/crystal/file.png"
5
- BROKEN_THUMB = "cul_hydra/crystal/file_broken.png"
6
- COLLECTION_THUMB = "cul_hydra/crystal/kmultiple.png"
7
- AUDIO_THUMB = "cul_hydra/crystal/sound.png"
8
- # some rel predicates
9
- FORMAT = "http://purl.org/dc/elements/1.1/format"
10
- MEMBER_OF = "http://purl.oclc.org/NET/CUL/memberOf"
11
- HAS_MODEL = "info:fedora/fedora-system:def/model#hasModel"
12
- IMAGE_WIDTH = "http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageWidth"
13
- IMAGE_LENGTH = "http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageLength"
14
-
15
- def show
16
- pid = params[:id].split(/@/)[0]
17
- get_by_pid(pid)
18
- end
19
-
20
- def get_by_pid(pid)
21
- r_obj = ActiveFedora::Base.find(pid, :cast=>true)
22
-
23
- if r_obj.respond_to? :thumbnail_info
24
- url = r_obj.thumbnail_info
25
- else
26
- url = {:asset=>(COLLECTION_THUMB),:mime=>'image/png'}
27
- end
28
- if url[:asset]
29
- #url = {:url=>asset_url(COLLECTION_THUMB),:mime=>'image/png'}
30
- #redirect_to asset_url(url[:asset]).to_s, status: 302
31
- #return
32
- end
33
- Rails.logger.debug "thumbnail #{url[:url] || url[:asset]} #{url[:mime]}"
34
- filename = pid + '.' + url[:mime].split('/')[1].downcase
35
- h_cd = "filename=""#{CGI.escapeHTML(filename)}"""
36
- headers.delete "Cache-Control"
37
- headers["Content-Disposition"] = h_cd
38
- headers["Content-Type"] = url[:mime]
39
-
40
- if url[:asset]
41
- full_path = Rails.application.assets.resolve(url[:asset]).to_path
42
- render :status => 200, :text => File.read(full_path)
43
- return
44
- elsif url[:url].to_s =~ /^https?:/
45
- cl = http_client
46
- render :status => 200, :text => cl.get_content(url[:url])
47
- return
48
- else
49
- render :status => 200, :text => File.read(url[:url])
50
- return
51
- end
52
- end
53
-
54
- def jp2_thumbnail(pid)
55
- {:url => ActiveFedora.fedora_config.credentials[:url] + '/objects/' + pid + '/methods/ldpd:sdef.Image/getView?max=250', :mime => 'image/jpeg'}
56
- end
57
-
58
- def pid_from_uri(uri)
59
- return uri.sub(/info:fedora\//,'')
60
- end
61
-
62
- end
@@ -1,108 +0,0 @@
1
- module Cul::Hydra::Models::LinkableResources
2
- include Cul::Hydra::Fedora::UrlHelperBehavior
3
- # so as to avoid including all the url hepers via:
4
- ## include Rails.application.routes.url_helpers
5
- # we are just going to delegate
6
- delegate :fedora_content_path, :to => 'Rails.application.routes.url_helpers'
7
- delegate :cache_path, :to => 'Rails.application.routes.url_helpers'
8
-
9
- def http_client
10
- unless @http_client
11
- @http_client ||= HTTPClient.new
12
- @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
- uname = Cul::Hydra::Fedora.repository.config[:user]
14
- pwd = Cul::Hydra::Fedora.repository.config[:password]
15
- @http_client.set_auth(nil, uname, pwd)
16
- end
17
- @http_client
18
- end
19
-
20
- def linkable_resources
21
- r = self.parts(:response_format => :solr)
22
- return [] if r.blank?
23
- members = r.collect {|hit|
24
- SolrDocument.new(hit)
25
- }
26
- members.delete_if { |sd| (sd[:has_model_ssim] & ["info:fedora/ldpd:Resource"]).blank? }
27
- case self.route_as
28
- when "zoomingimage"
29
- results = members.collect {|doc| image_resource(doc)}
30
- base_id = self.pid
31
- url = fedora_ds_url(base_id, 'SOURCE') + '/content'
32
- head_req = http_client().head(url)
33
- file_size = head_req.header["Content-Length"].first.to_i
34
- results << {
35
- :dimensions => "Original",
36
- :mime_type => "image/jp2",
37
- :uri=>base_id, :block=>"SOURCE", :filename=>base_id + "_source.jp2",
38
- :content_models=>[]}
39
- when "audio"
40
- results = members.collect {|doc| audio_resource(doc)}
41
- when "image"
42
- results = members.collect {|doc| image_resource(doc)}
43
- else
44
- raise "Unknown format #{self.route_as}"
45
- end
46
- return results
47
- end
48
-
49
- def basic_resource(document)
50
- res = {}
51
- res[:pid] = document["id"]
52
- res[:dsid] = "CONTENT"
53
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
54
- res[:content_models] = document["has_model_ssim"]
55
- res[:file_size] = document["extent_ssim"].first.to_i
56
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
57
- res
58
- end
59
-
60
- def image_resource(document)
61
- res = basic_resource(document)
62
- if document["image_width_ssim"]
63
- res[:dimensions] = document["image_width_ssim"].first + " x " + document["image_length_ssim"].first
64
- res[:width] = document["image_width_ssim"].first
65
- res[:height] = document["image_length_ssim"].first
66
- else
67
- res[:dimensions] = "? x ?"
68
- res[:width] = "0"
69
- res[:height] = "0"
70
- end
71
- base_id = document["id"]
72
- base_filename = base_id.gsub(/\:/,"")
73
- img_filename = base_filename + "." + document["dc_format_ssm"].first.gsub(/^[^\/]+\//,"")
74
- res[:filename] = img_filename
75
- res[:block] = "CONTENT"
76
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
77
- res[:content_models] = document["has_model_ssim"]
78
- res[:file_size] = document["extent_ssim"].first.to_i
79
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
80
- res[:uri] = base_id
81
- res
82
- end
83
-
84
- def audio_resource(document)
85
- res = basic_resource(document)
86
- base_id = document["id"]
87
- base_filename = base_id.gsub(/\:/,"")
88
- if res[:mime_type] =~ /wav/
89
- ext = 'wav'
90
- elsif res[:mime_type] =~ /mpeg/
91
- ext = 'mp3'
92
- else
93
- ext = 'bin'
94
- end
95
- filename = base_filename + "." + ext
96
- dc_filename = base_filename + "_dc.xml"
97
- res[:uri] = base_id
98
- res[:block] = "CONTENT"
99
- res[:filename] = filename
100
- res[:dc_path] = fedora_content_path(:download_method=>"show_pretty", :uri=>base_id, :block=>"DC", :filename=>dc_filename)
101
- res[:mime_type] = document["dc_format_ssm"] ? document["dc_format_ssm"].first : "application/octect-stream"
102
- res[:content_models] = document["has_model_ssim"]
103
- res[:file_size] = document["extent_ssim"].first.to_i
104
- res[:size] = (document["extent_ssim"].first.to_i / 1024).to_s + " Kb"
105
- res
106
- end
107
-
108
- end