sufia 0.1.0 → 1.0.0

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.
Files changed (129) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +5 -2
  5. data/History.md +6 -0
  6. data/README.md +40 -0
  7. data/Rakefile +4 -0
  8. data/app/assets/javascripts/sufia.js +3 -115
  9. data/app/assets/javascripts/sufia/batch_select_all.js +179 -0
  10. data/app/assets/javascripts/sufia/edit_metadata.js +86 -0
  11. data/app/assets/javascripts/sufia/multiForm.js +57 -0
  12. data/app/assets/javascripts/terms_of_service.js +7 -0
  13. data/app/assets/stylesheets/audio-js.css +3 -0
  14. data/app/assets/stylesheets/dashboard.css.scss +51 -0
  15. data/app/assets/stylesheets/generic_files.css +36 -0
  16. data/app/assets/stylesheets/sufia.css.scss +2 -0
  17. data/app/controllers/batch_controller.rb +11 -0
  18. data/app/controllers/batch_edits_controller.rb +1 -77
  19. data/app/controllers/generic_files_controller.rb +1 -0
  20. data/app/controllers/mailbox_controller.rb +1 -1
  21. data/app/controllers/single_use_link_controller.rb +11 -7
  22. data/app/helpers/generic_file_helper.rb +11 -3
  23. data/app/helpers/sufia_helper.rb +13 -10
  24. data/app/models/batch.rb +1 -1
  25. data/app/models/datastreams/fits_datastream.rb +2 -2
  26. data/app/models/datastreams/generic_file_rdf_datastream.rb +22 -18
  27. data/app/models/datastreams/properties_datastream.rb +2 -2
  28. data/app/views/_user_util_links.html.erb +2 -2
  29. data/app/views/batch/_metadata.html.erb +82 -0
  30. data/app/views/batch/_more_metadata.html.erb +6 -0
  31. data/app/views/batch/edit.html.erb +1 -8
  32. data/app/views/batch_edits/_check_all.html.erb +0 -157
  33. data/app/views/batch_edits/edit.html.erb +0 -29
  34. data/app/views/catalog/_index_partials/_list_files.html.erb +8 -10
  35. data/app/views/catalog/_recent_document.html.erb +9 -18
  36. data/app/views/catalog/_results_pagination.html.erb +1 -1
  37. data/app/views/contact_form/new.html.erb +1 -1
  38. data/app/views/dashboard/_index_partials/_default_group.html.erb +1 -1
  39. data/app/views/dashboard/_index_partials/_list_files.html.erb +12 -14
  40. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +9 -19
  41. data/app/views/dashboard/_results_pagination.html.erb +1 -1
  42. data/app/views/dashboard/index.html.erb +6 -82
  43. data/app/views/error/single_use_error.html.erb +35 -0
  44. data/app/views/generic_files/_descriptions.html.erb +2 -2
  45. data/app/views/generic_files/_extra_fields_modal.html.erb +1 -1
  46. data/app/views/generic_files/_field_form.html.erb +2 -5
  47. data/app/views/generic_files/_media_display.html.erb +8 -6
  48. data/app/views/generic_files/_permission.html.erb +2 -2
  49. data/app/views/generic_files/_rights_modal.html.erb +1 -1
  50. data/app/views/generic_files/_show_actions.html.erb +1 -1
  51. data/app/views/generic_files/_show_details.html.erb +11 -6
  52. data/app/views/generic_files/edit.html.erb +0 -8
  53. data/app/views/generic_files/edit_fields/_type.html.erb +1 -1
  54. data/app/views/generic_files/show.html.erb +5 -8
  55. data/app/views/generic_files/show_fields/_based_near.html.erb +4 -1
  56. data/app/views/generic_files/show_fields/_contributor.html.erb +4 -1
  57. data/app/views/generic_files/show_fields/_creator.html.erb +4 -1
  58. data/app/views/generic_files/show_fields/_date_created.html.erb +4 -1
  59. data/app/views/generic_files/show_fields/_description.html.erb +4 -1
  60. data/app/views/generic_files/show_fields/_language.html.erb +1 -1
  61. data/app/views/generic_files/show_fields/_publisher.html.erb +4 -1
  62. data/app/views/generic_files/show_fields/_related_url.html.erb +3 -1
  63. data/app/views/generic_files/show_fields/_resource_type.html.erb +1 -1
  64. data/app/views/generic_files/show_fields/_subject.html.erb +4 -1
  65. data/app/views/generic_files/show_fields/_tag.html.erb +1 -1
  66. data/app/views/generic_files/show_fields/_title.html.erb +4 -1
  67. data/app/views/layouts/error.html.erb +0 -4
  68. data/app/views/layouts/hydra-head.html.erb +2 -6
  69. data/app/views/single_use_link/show.html.erb +1 -1
  70. data/app/views/users/index.html.erb +1 -1
  71. data/app/views/users/show.html.erb +1 -1
  72. data/config/locales/sufia.en.yml +1 -0
  73. data/config/routes.rb +11 -4
  74. data/lib/generators/sufia/sufia_generator.rb +2 -1
  75. data/lib/generators/sufia/templates/catalog_controller.rb +143 -117
  76. data/lib/generators/sufia/templates/config/resque_admin.rb +10 -0
  77. data/lib/generators/sufia/templates/config/sufia.rb +8 -0
  78. data/lib/sufia.rb +4 -14
  79. data/lib/sufia/batch_edits_controller_behavior.rb +89 -0
  80. data/lib/sufia/controller.rb +7 -5
  81. data/lib/sufia/downloads_controller_behavior.rb +14 -19
  82. data/lib/sufia/file_content/extract_metadata.rb +11 -4
  83. data/lib/sufia/files_controller_behavior.rb +63 -44
  84. data/lib/sufia/generic_file.rb +29 -11
  85. data/lib/sufia/generic_file/audit.rb +1 -1
  86. data/lib/sufia/generic_file/thumbnail.rb +51 -26
  87. data/lib/sufia/id_service.rb +28 -11
  88. data/lib/sufia/jobs/batch_update_job.rb +2 -2
  89. data/lib/sufia/jobs/characterize_job.rb +11 -3
  90. data/lib/sufia/jobs/ffmpeg_transcode_job.rb +61 -0
  91. data/lib/sufia/jobs/resolrize_job.rb +1 -1
  92. data/lib/sufia/jobs/transcode_audio_job.rb +40 -0
  93. data/lib/sufia/jobs/transcode_video_job.rb +9 -49
  94. data/lib/sufia/queue/resque.rb +2 -2
  95. data/lib/sufia/single_use_error.rb +4 -0
  96. data/lib/sufia/solr_document_behavior.rb +108 -1
  97. data/lib/sufia/version.rb +1 -1
  98. data/solr_conf/conf/schema.xml +332 -652
  99. data/solr_conf/conf/solrconfig.xml +60 -196
  100. data/spec/controllers/batch_controller_spec.rb +4 -5
  101. data/spec/controllers/catalog_controller_spec.rb +13 -13
  102. data/spec/controllers/dashboard_controller_spec.rb +2 -2
  103. data/spec/controllers/downloads_controller_spec.rb +74 -62
  104. data/spec/controllers/generic_files_controller_spec.rb +10 -8
  105. data/spec/controllers/single_use_link_controller_spec.rb +12 -4
  106. data/spec/fixtures/Example.ogg +0 -0
  107. data/spec/fixtures/piano_note.wav +0 -0
  108. data/spec/fixtures/sufia_generic_stub.descMeta.txt +1 -1
  109. data/spec/helpers/sufia_helper_spec.rb +12 -0
  110. data/spec/models/characterize_job_spec.rb +89 -0
  111. data/spec/models/checksum_audit_log_spec.rb +1 -0
  112. data/spec/models/event_jobs_spec.rb +9 -9
  113. data/spec/models/file_content_datastream_spec.rb +16 -10
  114. data/spec/models/fits_datastream_spec.rb +2 -8
  115. data/spec/models/generic_file_spec.rb +131 -60
  116. data/spec/models/solr_document_spec.rb +21 -0
  117. data/spec/models/transcode_audio_job_spec.rb +81 -0
  118. data/spec/models/transcode_video_job_spec.rb +2 -2
  119. data/spec/models/unzip_job_spec.rb +3 -3
  120. data/spec/spec_helper.rb +21 -0
  121. data/spec/support/Gemfile +7 -3
  122. data/sufia.gemspec +8 -11
  123. data/tasks/cucumber.rake +1 -2
  124. data/tasks/sufia-dev.rake +13 -2
  125. data/tasks/sufia.rake +1 -1
  126. metadata +77 -118
  127. data/app/views/batch_edits/_metadata.html.erb +0 -180
  128. data/lib/generators/sufia/templates/config/hydra_config.rb +0 -32
  129. data/lib/kaminari/helpers/tag.rb +0 -11
@@ -0,0 +1,57 @@
1
+ (function( $ ){
2
+
3
+ $.fn.multiForm = function( options ) {
4
+
5
+ // Create some defaults, extending them with any options that were provided
6
+ var settings = $.extend( { }, options);
7
+
8
+ function addField() {
9
+ var cloneId = this.id.replace("submit", "clone");
10
+ var newId = this.id.replace("submit", "elements");
11
+ var cloneElem = $('#'+cloneId).clone();
12
+ // change the add button to a remove button
13
+ var plusbttn = cloneElem.find('#'+this.id);
14
+ plusbttn.html('-<span class="accessible-hidden">remove this '+ this.name.replace("_", " ") +'</span>');
15
+ plusbttn.on('click',removeField);
16
+
17
+ // remove the help tag on subsequent added fields
18
+ cloneElem.find('.formHelp').remove();
19
+ cloneElem.find('i').remove();
20
+ cloneElem.find('.modal-div').remove();
21
+
22
+ //clear out the value for the element being appended
23
+ //so the new element has a blank value
24
+ cloneElem.find('input[type=text]').attr("value", "");
25
+ cloneElem.find('input[type=text]').attr("required", false);
26
+
27
+ if (settings.afterAdd) {
28
+ settings.afterAdd(this, cloneElem)
29
+ }
30
+
31
+ $('#'+newId).append(cloneElem);
32
+ cloneElem.find('input[type=text]').focus();
33
+ return false;
34
+ }
35
+
36
+ function removeField () {
37
+ // get parent and remove it
38
+ $(this).parent().remove();
39
+ return false;
40
+ }
41
+
42
+ return this.each(function() {
43
+
44
+ // Tooltip plugin code here
45
+ /*
46
+ * adds additional metadata elements
47
+ */
48
+ $('.adder', this).click(addField);
49
+
50
+ $('.remover', this).click(removeField);
51
+
52
+
53
+ });
54
+
55
+ };
56
+ })( jQuery );
57
+
@@ -1,4 +1,11 @@
1
+ jQuery.fn.exists = function(){return this.length>0;}
2
+
1
3
  $(function () {
4
+ if (!$('#terms_of_service').exists()) {
5
+ // deactivate if there is no checkbox, which allows installations to skip the agreement.
6
+ return;
7
+ }
8
+
2
9
  $('#main_upload_start').attr('disabled', true);
3
10
  $("#upload_tooltip").hide();
4
11
  $("#main_upload_start_span").mousemove(function(e){
@@ -0,0 +1,3 @@
1
+ .audiojs {
2
+ width: 338px;
3
+ }
@@ -0,0 +1,51 @@
1
+ .dashboard {
2
+ .audiojs {
3
+ width: 38px;
4
+ float: left;
5
+ }
6
+
7
+ audio {
8
+ width: 38px;
9
+ float: left;
10
+ }
11
+
12
+ .batch-select-all, .button_to {
13
+
14
+ float: right;
15
+ padding-left: 6px;
16
+ padding-top: 0px;
17
+ padding-top: 0px;
18
+ }
19
+
20
+ .bedit {
21
+ width: 65%;
22
+ }
23
+
24
+ .batch-select-all .btn-primary {
25
+ background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-ms-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(top, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{background-color:#bd362f;*background-color:#a9302a;
26
+ }
27
+
28
+ .button_to .btn-primary {
29
+ background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-ms-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(top, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{background-color:#f89406;*background-color:#df8505;
30
+ }
31
+
32
+ .table th, .table td {
33
+ padding: 4px;
34
+ }
35
+ .table .sm {
36
+ padding: 2px;
37
+ }
38
+
39
+ .over {
40
+ z-index:100;
41
+ }
42
+ .under
43
+ {
44
+ position:absolute;
45
+ padding:0px 0px 0px 0px;
46
+ left:10px;
47
+ top:-8px;
48
+ color:orange;
49
+ z-index:1;
50
+ }
51
+ }
@@ -8,3 +8,39 @@
8
8
  button.close {
9
9
  display: block;
10
10
  }
11
+
12
+ .related-files {
13
+ height: 100px;
14
+ overflow-x: auto;
15
+ }
16
+
17
+ label.error { float: left; color: red; padding-left: .5em; vertical-align: top; }
18
+
19
+
20
+ /* These were from batch_edit/edit.html.erb */
21
+ #upload_tooltip { background: #ff0; padding: 5px; border: 1px solid #ddd; position: absolute; }
22
+
23
+ .fileHeight {
24
+ max-height: 50px
25
+ }
26
+
27
+ .scrollx {
28
+ overflow-x: auto;
29
+ }
30
+
31
+ .scrolly {
32
+ overflow-y: auto;
33
+ }
34
+
35
+ h2 small {
36
+ color: red;
37
+ }
38
+
39
+ .status {
40
+ color: green;
41
+ padding:5px 5px 5px;
42
+ }
43
+
44
+ .loading {
45
+ background: white url('/assets/loading.gif') center bottom no-repeat;
46
+ }
@@ -7,6 +7,8 @@
7
7
  *= require batch_edit
8
8
  *= require generic_files
9
9
  *= require video-js
10
+ *= require audio-js
11
+ *= require dashboard
10
12
  *= require jquery-ui
11
13
  */
12
14
 
@@ -25,6 +25,7 @@ class BatchController < ApplicationController
25
25
  @generic_file = GenericFile.new
26
26
  @generic_file.creator = current_user.name
27
27
  @generic_file.title = @batch.generic_files.map(&:label)
28
+ initialize_fields(@generic_file)
28
29
  end
29
30
 
30
31
  def update
@@ -36,4 +37,14 @@ class BatchController < ApplicationController
36
37
  flash[:notice] = 'Your files are being processed by ' + t('sufia.product_name') + ' in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-important" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
37
38
  redirect_to sufia.dashboard_index_path
38
39
  end
40
+
41
+ protected
42
+
43
+ # override this method if you need to initialize more complex RDF assertions (b-nodes)
44
+ def initialize_fields(file)
45
+ file.terms_for_editing.each do |key|
46
+ # if value is empty, we create an one element array to loop over for output
47
+ file[key] = [''] if file[key].empty?
48
+ end
49
+ end
39
50
  end
@@ -1,81 +1,5 @@
1
1
  class BatchEditsController < ApplicationController
2
2
  include Hydra::BatchEditBehavior
3
3
  include GenericFileHelper
4
-
5
- def edit
6
- super
7
- @generic_file = GenericFile.new
8
- @generic_file.depositor = current_user.user_key
9
- @terms = @generic_file.terms_for_editing - [:title] # +:format, :resource_type
10
-
11
- # do we want to show the original values for anything...
12
- @show_file = GenericFile.new
13
- @show_file.depositor = current_user.user_key
14
- h = {}
15
- @names = []
16
- permissions = []
17
-
18
- # For each of the files in the batch, set the attributes to be the concatination of all the attributes
19
- batch.each do |doc_id|
20
- gf = GenericFile.find(doc_id)
21
- gf.terms_for_editing.each do |key|
22
- h[key] ||= []
23
- h[key] = (h[key] + gf.send(key)).uniq
24
- end
25
- @names << display_title(gf)
26
- permissions = (permissions+gf.permissions).uniq
27
- end
28
-
29
- # why am I doing this you may ask... Well... if truth be told I have no idea, but if I use just a single item in the batch
30
- # my h arrays get converted into strings in update attributes unless I do this first....
31
- #h.keys.each {|key| h[key] = h[key].to_a} if (batch.size == 1)
32
- # end of wierd fix...
33
-
34
- @show_file.attributes = h
35
- # map the permissions to parameter like input so that the assign will work
36
- # todo sort the access level some how...
37
- perm_param ={'user'=>{},'group'=>{"public"=>"1"}}
38
- permissions.each{ |perm| perm_param[perm[:type]][perm[:name]] = perm[:access]}
39
- @show_file.permissions = HashWithIndifferentAccess.new(perm_param)
40
- end
41
-
42
- def after_update
43
- redirect_to sufia.dashboard_index_path unless request.xhr?
44
- end
45
-
46
- def update_document(obj)
47
- super
48
- obj.date_modified = Time.now.ctime
49
- obj.set_visibility(params[:visibility])
50
- end
51
-
52
- def update
53
- # keep the batch around if we are doing ajax calls
54
- batch_sav = batch.dup if request.xhr?
55
- catalog_index_path = sufia.dashboard_index_path
56
- type = params["update_type"]
57
- if (type == "update")
58
- #params["generic_file"].reject! {|k,v| (v.blank? || (v.respond_to?(:length) && v.length==1 && v.first.blank?))}
59
- super
60
- elsif (type == "delete_all")
61
- batch.each do |doc_id|
62
- gf = GenericFile.find(doc_id)
63
- gf.delete
64
- end
65
- clear_batch!
66
- after_update
67
- end
68
-
69
- # reset the batch around if we are doing ajax calls
70
- if request.xhr?
71
- self.batch = batch_sav.dup
72
- @key = params["key"]
73
- if (@key != "permissions")
74
- @vals = params["generic_file"][@key]
75
- else
76
- @vals = [""]
77
- end
78
- render :update_edit
79
- end
80
- end
4
+ include Sufia::BatchEditsControllerBehavior
81
5
  end
@@ -14,5 +14,6 @@
14
14
  # limitations under the License.
15
15
 
16
16
  class GenericFilesController < ApplicationController
17
+ include Sufia::Controller
17
18
  include Sufia::FilesControllerBehavior
18
19
  end
@@ -16,7 +16,7 @@ class MailboxController < ApplicationController
16
16
  before_filter :authenticate_user!
17
17
 
18
18
  def index
19
- if current_user
19
+ if user_signed_in?
20
20
  inbox = current_user.mailbox.inbox
21
21
  @messages = inbox.all
22
22
  current_user.mark_as_read @messages
@@ -1,7 +1,10 @@
1
+ require 'sufia/single_use_error'
2
+
1
3
  class SingleUseLinkController < DownloadsController
2
4
  before_filter :authenticate_user!, :except => [:show, :download]
3
5
  skip_filter :normalize_identifier
4
6
  prepend_before_filter :normalize_identifier, :except => [:download, :show]
7
+ rescue_from Sufia::SingleUseError, :with => :render_single_use_error
5
8
 
6
9
  def generate_download
7
10
  @generic_file = GenericFile.find(params[:id])
@@ -76,11 +79,12 @@ class SingleUseLinkController < DownloadsController
76
79
 
77
80
  return link
78
81
  end
79
-
80
- def not_found
81
- raise ActionController::RoutingError.new('Not Found')
82
- end
83
- def expired
84
- raise ActionController::RoutingError.new('expired')
85
- end
82
+
83
+ def not_found
84
+ raise Sufia::SingleUseError.new('Single Use Link Not Found')
85
+ end
86
+ def expired
87
+ raise Sufia::SingleUseError.new('Single Use Link Expired')
88
+ end
89
+
86
90
  end
@@ -50,7 +50,17 @@ module GenericFileHelper
50
50
  end
51
51
 
52
52
  def render_edit_field_partial(key, locals)
53
- ["generic_files/edit_fields/#{key}", "generic_files/edit_fields/default"].each do |str|
53
+ render_edit_field_partial_with_action('generic_files', key, locals)
54
+ end
55
+
56
+ def render_batch_edit_field_partial(key, locals)
57
+ render_edit_field_partial_with_action('batch_edit', key, locals)
58
+ end
59
+
60
+ private
61
+
62
+ def render_edit_field_partial_with_action(action, key, locals)
63
+ ["#{action}/edit_fields/#{key}", "#{action}/edit_fields/default"].each do |str|
54
64
  # XXX rather than handling this logic through exceptions, maybe there's a Rails internals method
55
65
  # for determining if a partial template exists..
56
66
  begin
@@ -61,8 +71,6 @@ module GenericFileHelper
61
71
  end
62
72
  end
63
73
 
64
- private
65
-
66
74
  def more_or_less_button(key, html_class, symbol)
67
75
  # TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
68
76
  content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do
@@ -35,12 +35,8 @@ module SufiaHelper
35
35
  end
36
36
 
37
37
  def display_user_name(recent_document)
38
- return "no display name" unless recent_document[:depositor_t]
39
- return User.find_by_user_key(recent_document[:depositor_t][0]).name rescue recent_document[:depositor_t][0]
40
- end
41
-
42
- def get_depositor_from_document(doc)
43
- doc[:depositor_t] ? doc[:depositor_t][0] : "no depositor value"
38
+ return "no display name" unless recent_document.depositor
39
+ return User.find_by_user_key(recent_document.depositor).name rescue recent_document.depositor
44
40
  end
45
41
 
46
42
  def link_to_facet(field, field_string)
@@ -48,7 +44,8 @@ module SufiaHelper
48
44
  end
49
45
 
50
46
  def link_to_facet_list(list, field_string, emptyText="No value entered", separator=", ")
51
- return list.map{ |item| link_to_facet(item, field_string) }.join(separator) unless list.blank?
47
+ facet_field = Solrizer.solr_name(field_string, :facetable)
48
+ return list.map{ |item| link_to_facet(item, facet_field) }.join(separator) unless list.blank?
52
49
  return emptyText
53
50
  end
54
51
 
@@ -70,9 +67,15 @@ module SufiaHelper
70
67
 
71
68
  def link_to_profile(login)
72
69
  user = User.find_by_user_key(login)
73
- link_to user.name, Sufia::Engine.routes.url_helpers.profile_path(login)
74
- rescue
75
- link_to login, Sufia::Engine.routes.url_helpers.profile_path(login)
70
+ return login if user.nil?
71
+
72
+ text = if user.respond_to? :name
73
+ user.name
74
+ else
75
+ login
76
+ end
77
+
78
+ link_to text, Sufia::Engine.routes.url_helpers.profile_path(user)
76
79
  end
77
80
 
78
81
  def linkify_chat_id(chat_id)
@@ -40,7 +40,7 @@ class Batch < ActiveFedora::Base
40
40
 
41
41
  def to_solr(solr_doc={}, opts={})
42
42
  super(solr_doc, opts)
43
- solr_doc["noid_s"] = noid
43
+ solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid
44
44
  return solr_doc
45
45
  end
46
46
  end
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- class FitsDatastream < ActiveFedora::NokogiriDatastream
15
+ class FitsDatastream < ActiveFedora::OmDatastream
16
16
  include OM::XML::Document
17
17
 
18
18
  set_terminology do |t|
@@ -22,7 +22,7 @@ class FitsDatastream < ActiveFedora::NokogiriDatastream
22
22
  t.identification {
23
23
  t.identity {
24
24
  t.format_label(:path=>{:attribute=>"format"})
25
- t.mime_type(:path=>{:attribute=>"mimetype"}, index_as: [:searchable])
25
+ t.mime_type(:path=>{:attribute=>"mimetype"}, index_as: [:stored_searchable])
26
26
  }
27
27
  }
28
28
  t.fileinfo {
@@ -16,56 +16,60 @@ class GenericFileRdfDatastream < ActiveFedora::NtriplesRDFDatastream
16
16
  map_predicates do |map|
17
17
  map.part_of(:to => "isPartOf", :in => RDF::DC)
18
18
  map.contributor(:in => RDF::DC) do |index|
19
- index.as :searchable, :displayable
19
+ index.as :stored_searchable, :facetable
20
20
  end
21
21
  map.creator(:in => RDF::DC) do |index|
22
- index.as :searchable, :facetable, :displayable
22
+ index.as :stored_searchable, :facetable
23
23
  end
24
24
  map.title(:in => RDF::DC) do |index|
25
- index.as :searchable, :displayable
25
+ index.as :stored_searchable
26
26
  end
27
27
  map.description(:in => RDF::DC) do |index|
28
28
  index.type :text
29
- index.as :searchable, :displayable
29
+ index.as :stored_searchable
30
30
  end
31
31
  map.publisher(:in => RDF::DC) do |index|
32
- index.as :searchable, :facetable, :displayable
32
+ index.as :stored_searchable, :facetable
33
33
  end
34
34
  map.date_created(:to => "created", :in => RDF::DC) do |index|
35
- index.as :searchable, :displayable
35
+ index.as :stored_searchable
36
36
  end
37
37
  map.date_uploaded(:to => "dateSubmitted", :in => RDF::DC) do |index|
38
38
  index.type :date
39
- index.as :searchable, :displayable, :sortable
39
+ index.as :stored_sortable
40
40
  end
41
41
  map.date_modified(:to => "modified", :in => RDF::DC) do |index|
42
42
  index.type :date
43
- index.as :searchable, :displayable, :sortable
43
+ index.as :stored_sortable
44
44
  end
45
45
  map.subject(:in => RDF::DC) do |index|
46
- index.as :searchable, :facetable, :displayable
46
+ index.as :stored_searchable, :facetable
47
47
  end
48
48
  map.language(:in => RDF::DC) do |index|
49
- index.as :searchable, :facetable, :displayable
49
+ index.as :stored_searchable, :facetable
50
50
  end
51
51
  map.rights(:in => RDF::DC) do |index|
52
- index.as :searchable, :displayable
52
+ index.as :stored_searchable
53
53
  end
54
54
  map.resource_type(:to => "type", :in => RDF::DC) do |index|
55
- index.as :searchable, :facetable, :displayable
55
+ index.as :stored_searchable, :facetable
56
56
  end
57
57
  map.identifier(:in => RDF::DC) do |index|
58
- index.as :searchable, :displayable
58
+ index.as :stored_searchable
59
59
  end
60
60
  map.based_near(:in => RDF::FOAF) do |index|
61
- index.as :searchable, :facetable, :displayable
61
+ index.as :stored_searchable, :facetable
62
62
  end
63
63
  map.tag(:to => "relation", :in => RDF::DC) do |index|
64
- index.as :searchable, :facetable, :displayable
64
+ index.as :stored_searchable, :facetable
65
65
  end
66
66
  map.related_url(:to => "seeAlso", :in => RDF::RDFS)
67
67
  end
68
- LocalAuthority.register_vocabulary(self, "subject", "lc_subjects")
69
- LocalAuthority.register_vocabulary(self, "language", "lexvo_languages")
70
- LocalAuthority.register_vocabulary(self, "tag", "lc_genres")
68
+ begin
69
+ LocalAuthority.register_vocabulary(self, "subject", "lc_subjects")
70
+ LocalAuthority.register_vocabulary(self, "language", "lexvo_languages")
71
+ LocalAuthority.register_vocabulary(self, "tag", "lc_genres")
72
+ rescue
73
+ puts "tables for vocabularies missing"
74
+ end
71
75
  end