sufia 6.0.0 → 6.1.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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -5
- data/CONTRIBUTING.md +4 -4
- data/Gemfile +2 -1
- data/History.md +69 -0
- data/README.md +84 -4
- data/SUFIA_VERSION +1 -1
- data/app/assets/images/zotero.png +0 -0
- data/app/assets/javascripts/sufia/featured_works.js +20 -3
- data/app/assets/stylesheets/generic_files.css.erb +2 -2
- data/app/assets/stylesheets/sufia.css.scss +2 -2
- data/app/assets/stylesheets/sufia/_buttons.scss +2 -2
- data/app/assets/stylesheets/sufia/_collections.scss +4 -4
- data/app/assets/stylesheets/sufia/_dashboard.scss +1 -1
- data/app/assets/stylesheets/sufia/_file-listing.scss +3 -0
- data/app/assets/stylesheets/sufia/_modal.scss +4 -0
- data/app/assets/stylesheets/sufia/_settings.scss +4 -3
- data/app/assets/stylesheets/sufia/_styles.scss +4 -0
- data/app/controllers/admin/stats_controller.rb +68 -0
- data/app/controllers/api/items_controller.rb +78 -0
- data/app/controllers/api/zotero_controller.rb +70 -0
- data/app/controllers/authorities_controller.rb +6 -5
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +2 -1
- data/app/controllers/concerns/sufia/breadcrumbs.rb +1 -1
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +11 -0
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +23 -11
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +1 -7
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +1 -2
- data/app/controllers/my/collections_controller.rb +1 -0
- data/app/controllers/my/files_controller.rb +1 -1
- data/app/helpers/sufia/sufia_helper_behavior.rb +28 -16
- data/app/models/my_search_builder.rb +4 -0
- data/app/search_builders/sufia/my_search_builder_behavior.rb +20 -0
- data/app/search_builders/sufia/search_builder.rb +1 -1
- data/app/views/admin/stats/index.html.erb +68 -0
- data/app/views/collections/_action_menu.html.erb +22 -20
- data/app/views/collections/_collection.html.erb +1 -1
- data/app/views/collections/_form_for_select_collection.html.erb +5 -3
- data/app/views/generic_files/_show_actions.html.erb +4 -2
- data/app/views/generic_files/show.html.erb +1 -1
- data/app/views/layouts/sufia-dashboard.html.erb +5 -4
- data/app/views/layouts/sufia-one-column.html.erb +2 -0
- data/app/views/layouts/sufia-two-column.html.erb +6 -4
- data/app/views/my/_facet_layout.html.erb +2 -2
- data/app/views/my/_facets.html.erb +4 -6
- data/app/views/my/index.html.erb +4 -3
- data/app/views/users/_edit_primary.html.erb +18 -17
- data/app/views/users/_follower_modal.html.erb +5 -1
- data/app/views/users/_following_modal.html.erb +5 -1
- data/app/views/users/_user_info.html.erb +6 -1
- data/app/views/users/_zotero.html.erb +12 -0
- data/config/locales/sufia.en.yml +10 -1
- data/config/routes.rb +23 -1
- data/lib/generators/sufia/admin_stat_generator.rb +17 -0
- data/lib/generators/sufia/install_generator.rb +8 -3
- data/{sufia-models/lib/generators/sufia/models/templates/config/resque_admin.rb → lib/generators/sufia/templates/sufia/stats_admin.rb} +3 -3
- data/lib/generators/sufia/upgrade400_generator.rb +2 -2
- data/lib/sufia.rb +3 -0
- data/lib/sufia/arkivo.rb +11 -0
- data/lib/sufia/arkivo/actor.rb +95 -0
- data/lib/sufia/arkivo/config.rb +11 -0
- data/lib/sufia/arkivo/create_subscription_job.rb +67 -0
- data/lib/sufia/arkivo/metadata_munger.rb +51 -0
- data/lib/sufia/arkivo/schema_validator.rb +55 -0
- data/lib/sufia/form_builder.rb +1 -1
- data/lib/sufia/inflections.rb +3 -0
- data/lib/sufia/version.rb +1 -1
- data/lib/sufia/zotero.rb +6 -0
- data/lib/sufia/zotero/config.rb +15 -0
- data/solr_conf/conf/solrconfig.xml +11 -0
- data/spec/controllers/admin_stats_controller_spec.rb +73 -0
- data/spec/controllers/api/items_controller_spec.rb +476 -0
- data/spec/controllers/api/zotero_controller_spec.rb +178 -0
- data/spec/controllers/batch_edits_controller_spec.rb +7 -0
- data/spec/controllers/collections_controller_spec.rb +1 -1
- data/spec/controllers/dashboard_controller_spec.rb +1 -1
- data/spec/controllers/depositors_controller_spec.rb +9 -5
- data/spec/controllers/generic_files_controller_spec.rb +5 -4
- data/spec/controllers/mailbox_controller_spec.rb +2 -2
- data/spec/controllers/my/collections_controller_spec.rb +1 -2
- data/spec/controllers/my/files_controller_spec.rb +5 -5
- data/spec/controllers/my/shares_controller_spec.rb +15 -3
- data/spec/controllers/pages_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +10 -9
- data/spec/factories/api_items.rb +91 -0
- data/spec/factories/generic_files.rb +4 -0
- data/spec/factories/users.rb +4 -4
- data/spec/features/featured_item_spec.rb +26 -0
- data/spec/features/ingest_upload_files_spec.rb +2 -3
- data/spec/features/proxy_spec.rb +0 -1
- data/spec/helpers/permissions_helper_spec.rb +2 -2
- data/spec/helpers/sufia_helper_spec.rb +11 -5
- data/spec/inputs/select_with_help_input_spec.rb +2 -2
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +832 -0
- data/spec/javascripts/jasmine_spec.rb +31 -0
- data/spec/javascripts/notify_update_link_spec.js +8 -0
- data/spec/javascripts/single_use_link_spec.js.coffee +23 -0
- data/spec/javascripts/support/jasmine.yml +124 -0
- data/spec/javascripts/support/jasmine_helper.rb +15 -0
- data/spec/javascripts/terms_of_service_spec.js.coffee +32 -0
- data/spec/javascripts/toggle_icon_spec.js +11 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +3 -3
- data/spec/jobs/import_url_job_spec.rb +0 -2
- data/spec/lib/sufia/arkivo/actor_spec.rb +139 -0
- data/spec/lib/sufia/arkivo/create_subscription_job_spec.rb +54 -0
- data/spec/lib/sufia/arkivo/metadata_munger_spec.rb +48 -0
- data/spec/lib/sufia/arkivo/schema_validator_spec.rb +65 -0
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +1 -1
- data/spec/lib/sufia/user_stat_importer_spec.rb +60 -0
- data/spec/lib/sufia/zotero/config_spec.rb +30 -0
- data/spec/models/collection_spec.rb +36 -7
- data/spec/models/file_download_stat_spec.rb +5 -5
- data/spec/models/file_usage_spec.rb +23 -0
- data/spec/models/file_view_stat_spec.rb +6 -6
- data/spec/models/fits_datastream_spec.rb +0 -5
- data/spec/models/generic_file_spec.rb +49 -14
- data/spec/models/local_authority_spec.rb +1 -1
- data/spec/models/proxy_deposit_request_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +8 -8
- data/spec/models/user_spec.rb +33 -0
- data/spec/presenters/sufia/collection_presenter_spec.rb +1 -1
- data/spec/routing/api_route_spec.rb +91 -0
- data/spec/routing/route_spec.rb +1 -1
- data/spec/services/generic_file_audit_service_spec.rb +44 -8
- data/spec/spec_helper.rb +18 -3
- data/spec/support/features.rb +0 -2
- data/spec/support/locations.rb +0 -21
- data/spec/support/rake.rb +41 -0
- data/spec/support/selectors.rb +0 -50
- data/spec/tasks/rake_spec.rb +33 -12
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -0
- data/spec/views/admin/stats/index.html.erb_spec.rb +45 -0
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +0 -1
- data/spec/views/dashboard/index_spec.rb +1 -1
- data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/show.html.erb_spec.rb +1 -3
- data/spec/views/users/_follower_modal.html.erb_spec.rb +44 -7
- data/spec/views/users/_following_modal.html.erb_spec.rb +49 -7
- data/spec/views/users/edit.html.erb_spec.rb +72 -0
- data/spec/views/users/show.html.erb_spec.rb +1 -1
- data/sufia.gemspec +6 -2
- data/tasks/sufia-user.rake +14 -0
- metadata +130 -156
- data/spec/lib/sufia/id_service_spec.rb +0 -32
- data/spec/services/noid_spec.rb +0 -9
- data/spec/support/poltergeist.rb +0 -11
- data/spec/support/rake_output.rb +0 -20
- data/sufia-models/.gitignore +0 -17
- data/sufia-models/Gemfile +0 -4
- data/sufia-models/LICENSE.md +0 -177
- data/sufia-models/README.md +0 -39
- data/sufia-models/Rakefile +0 -1
- data/sufia-models/app/actors/sufia/generic_file/actor.rb +0 -137
- data/sufia-models/app/jobs/active_fedora_id_based_job.rb +0 -22
- data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +0 -7
- data/sufia-models/app/jobs/audit_job.rb +0 -62
- data/sufia-models/app/jobs/batch_update_job.rb +0 -72
- data/sufia-models/app/jobs/characterize_job.rb +0 -10
- data/sufia-models/app/jobs/create_derivatives_job.rb +0 -14
- data/sufia-models/app/jobs/import_url_job.rb +0 -52
- data/sufia-models/app/jobs/ingest_local_file_job.rb +0 -46
- data/sufia-models/app/jobs/resolrize_job.rb +0 -9
- data/sufia-models/app/models/batch.rb +0 -36
- data/sufia-models/app/models/checksum_audit_log.rb +0 -21
- data/sufia-models/app/models/concerns/sufia/ability.rb +0 -61
- data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +0 -24
- data/sufia-models/app/models/concerns/sufia/file_stat_utils.rb +0 -35
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +0 -25
- data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +0 -28
- data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +0 -89
- data/sufia-models/app/models/concerns/sufia/generic_file/content.rb +0 -13
- data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +0 -26
- data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +0 -343
- data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +0 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +0 -43
- data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +0 -14
- data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +0 -98
- data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +0 -69
- data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +0 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +0 -31
- data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +0 -14
- data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +0 -16
- data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +0 -37
- data/sufia-models/app/models/concerns/sufia/model_methods.rb +0 -20
- data/sufia-models/app/models/concerns/sufia/user.rb +0 -137
- data/sufia-models/app/models/concerns/sufia/user_usage_stats.rb +0 -15
- data/sufia-models/app/models/datastreams/file_content_datastream.rb +0 -4
- data/sufia-models/app/models/datastreams/fits_datastream.rb +0 -152
- data/sufia-models/app/models/domain_term.rb +0 -5
- data/sufia-models/app/models/featured_work.rb +0 -22
- data/sufia-models/app/models/file_download_stat.rb +0 -18
- data/sufia-models/app/models/file_usage.rb +0 -34
- data/sufia-models/app/models/file_view_stat.rb +0 -18
- data/sufia-models/app/models/follow.rb +0 -12
- data/sufia-models/app/models/generic_file.rb +0 -3
- data/sufia-models/app/models/geo_names_resource.rb +0 -18
- data/sufia-models/app/models/group.rb +0 -8
- data/sufia-models/app/models/local_authority.rb +0 -86
- data/sufia-models/app/models/local_authority_entry.rb +0 -3
- data/sufia-models/app/models/proxy_deposit_request.rb +0 -85
- data/sufia-models/app/models/proxy_deposit_rights.rb +0 -4
- data/sufia-models/app/models/single_use_link.rb +0 -42
- data/sufia-models/app/models/subject_local_authority_entry.rb +0 -2
- data/sufia-models/app/models/sufia/avatar_uploader.rb +0 -20
- data/sufia-models/app/models/sufia/avatar_validator.rb +0 -8
- data/sufia-models/app/models/sufia/collection.rb +0 -5
- data/sufia-models/app/models/sufia/download.rb +0 -9
- data/sufia-models/app/models/sufia/orcid_validator.rb +0 -12
- data/sufia-models/app/models/sufia/pageview.rb +0 -9
- data/sufia-models/app/models/trophy.rb +0 -10
- data/sufia-models/app/models/user_stat.rb +0 -2
- data/sufia-models/app/models/version_committer.rb +0 -2
- data/sufia-models/app/services/sufia/analytics.rb +0 -50
- data/sufia-models/app/services/sufia/generic_file_audit_service.rb +0 -83
- data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -12
- data/sufia-models/app/services/sufia/id_service.rb +0 -45
- data/sufia-models/app/services/sufia/noid.rb +0 -22
- data/sufia-models/app/services/sufia/repository_audit_service.rb +0 -9
- data/sufia-models/config/locales/sufia.en.yml +0 -6
- data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +0 -30
- data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +0 -24
- data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +0 -27
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +0 -106
- data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +0 -24
- data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +0 -2
- data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +0 -9
- data/sufia-models/lib/generators/sufia/models/templates/config/clamav.rb +0 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/mailboxer.rb +0 -17
- data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +0 -6
- data/sufia-models/lib/generators/sufia/models/templates/config/redis.yml +0 -9
- data/sufia-models/lib/generators/sufia/models/templates/config/redis_config.rb +0 -32
- data/sufia-models/lib/generators/sufia/models/templates/config/resque-pool.yml +0 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +0 -3
- data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +0 -223
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +0 -144
- data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +0 -17
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +0 -15
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +0 -6
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_groups_to_users.rb +0 -11
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_ldap_attrs_to_user.rb +0 -27
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_linkedin_to_users.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_social_to_users.rb +0 -13
- data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +0 -10
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_download_stats.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_view_stats.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +0 -50
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +0 -16
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +0 -11
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_single_use_links.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +0 -8
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_trophies.rb +0 -10
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_user_stats.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb +0 -15
- data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +0 -18
- data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +0 -54
- data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +0 -21
- data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +0 -31
- data/sufia-models/lib/sufia/messages.rb +0 -66
- data/sufia-models/lib/sufia/models.rb +0 -34
- data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -43
- data/sufia-models/lib/sufia/models/active_record/redis.rb +0 -56
- data/sufia-models/lib/sufia/models/engine.rb +0 -79
- data/sufia-models/lib/sufia/models/file_content.rb +0 -6
- data/sufia-models/lib/sufia/models/file_content/versions.rb +0 -21
- data/sufia-models/lib/sufia/models/resque.rb +0 -36
- data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +0 -108
- data/sufia-models/lib/sufia/models/user_local_directory_behavior.rb +0 -29
- data/sufia-models/lib/sufia/models/utils.rb +0 -22
- data/sufia-models/lib/sufia/models/version.rb +0 -5
- data/sufia-models/lib/sufia/models/virus_found_error.rb +0 -4
- data/sufia-models/lib/sufia/permissions.rb +0 -9
- data/sufia-models/lib/sufia/permissions/readable.rb +0 -20
- data/sufia-models/lib/sufia/permissions/writable.rb +0 -74
- data/sufia-models/lib/tasks/batch_cleanup.rake +0 -19
- data/sufia-models/lib/tasks/migrate.rake +0 -21
- data/sufia-models/lib/tasks/resque.rake +0 -13
- data/sufia-models/lib/tasks/stats_tasks.rake +0 -12
- data/sufia-models/lib/tasks/sufia-models_tasks.rake +0 -80
- data/sufia-models/sufia-models.gemspec +0 -52
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module FileStatUtils
|
|
3
|
-
|
|
4
|
-
def to_flots stats
|
|
5
|
-
stats.map {|stat| stat.to_flot}
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def convert_date date_time
|
|
9
|
-
date_time.to_datetime.to_i * 1000
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
def cached_stats(file_id, start_date, method)
|
|
15
|
-
stats = self.where(file_id:file_id).order(date: :asc)
|
|
16
|
-
ga_start_date = stats.size > 0 ? stats[stats.size-1].date + 1.day : start_date.to_date
|
|
17
|
-
{ga_start_date: ga_start_date, cached_stats: stats.to_a }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def combined_stats file_id, start_date, object_method, ga_key, user_id=nil
|
|
21
|
-
stat_cache_info = cached_stats( file_id, start_date, object_method)
|
|
22
|
-
stats = stat_cache_info[:cached_stats]
|
|
23
|
-
if stat_cache_info[:ga_start_date] < Date.today
|
|
24
|
-
ga_stats = ga_statistics(stat_cache_info[:ga_start_date], file_id)
|
|
25
|
-
ga_stats.each do |stat|
|
|
26
|
-
lstat = self.new file_id: file_id, date: stat[:date], object_method => stat[ga_key], user_id: user_id
|
|
27
|
-
lstat.save unless Date.parse(stat[:date]) == Date.today
|
|
28
|
-
stats << lstat
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
stats
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
autoload :VirusFoundError, 'sufia/models/virus_found_error'
|
|
3
|
-
|
|
4
|
-
module GenericFile
|
|
5
|
-
extend ActiveSupport::Concern
|
|
6
|
-
include Sufia::ModelMethods
|
|
7
|
-
include Sufia::Noid
|
|
8
|
-
include Sufia::GenericFile::MimeTypes
|
|
9
|
-
include Sufia::GenericFile::Export
|
|
10
|
-
include Sufia::GenericFile::Characterization
|
|
11
|
-
include Sufia::GenericFile::Permissions
|
|
12
|
-
include Sufia::GenericFile::Derivatives
|
|
13
|
-
include Sufia::GenericFile::Trophies
|
|
14
|
-
include Sufia::GenericFile::Featured
|
|
15
|
-
include Sufia::GenericFile::Metadata
|
|
16
|
-
include Sufia::GenericFile::Content
|
|
17
|
-
include Sufia::GenericFile::Versions
|
|
18
|
-
include Sufia::GenericFile::VirusCheck
|
|
19
|
-
include Sufia::GenericFile::FullTextIndexing
|
|
20
|
-
include Sufia::GenericFile::ProxyDeposit
|
|
21
|
-
include Hydra::Collections::Collectible
|
|
22
|
-
include Sufia::GenericFile::Batches
|
|
23
|
-
include Sufia::GenericFile::Indexing
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module GenericFile
|
|
3
|
-
module Batches
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
included do
|
|
6
|
-
belongs_to :batch, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# Get the files with a sibling relationship (belongs_to :batch)
|
|
10
|
-
# The batch id is minted when visiting the upload screen and attached
|
|
11
|
-
# to each file when it is done uploading. The Batch object is not created
|
|
12
|
-
# until all objects are done uploading and the user is redirected to
|
|
13
|
-
# BatchController#edit. Therefore, we must handle the case where
|
|
14
|
-
# batch_id is set but batch returns nil.
|
|
15
|
-
def related_files
|
|
16
|
-
return [] unless batch
|
|
17
|
-
batch.generic_files.reject { |sibling| sibling.id == id }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Is this file in the middle of being processed by a batch?
|
|
21
|
-
def processing?
|
|
22
|
-
try(:batch).try(:status) == ['processing'.freeze]
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module GenericFile
|
|
3
|
-
module Characterization
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
included do
|
|
6
|
-
contains "characterization", class_name: 'FitsDatastream'
|
|
7
|
-
has_attributes :mime_type, datastream: :characterization, multiple: false
|
|
8
|
-
has_attributes :format_label, :file_size, :last_modified,
|
|
9
|
-
:filename, :original_checksum, :rights_basis,
|
|
10
|
-
:copyright_basis, :copyright_note,
|
|
11
|
-
:well_formed, :valid, :status_message,
|
|
12
|
-
:file_title, :file_author, :page_count,
|
|
13
|
-
:file_language, :word_count, :character_count,
|
|
14
|
-
:paragraph_count, :line_count, :table_count,
|
|
15
|
-
:graphics_count, :byte_order, :compression,
|
|
16
|
-
:color_space, :profile_name,
|
|
17
|
-
:profile_version, :orientation, :color_map,
|
|
18
|
-
:image_producer, :capture_device,
|
|
19
|
-
:scanning_software, :exif_version,
|
|
20
|
-
:gps_timestamp, :latitude, :longitude,
|
|
21
|
-
:character_set, :markup_basis,
|
|
22
|
-
:markup_language, :bit_depth,
|
|
23
|
-
:channels, :data_format, :offset, :frame_rate, datastream: :characterization, multiple: true
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def width
|
|
28
|
-
characterization.width.blank? ? characterization.video_width : characterization.width
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def height
|
|
32
|
-
characterization.height.blank? ? characterization.video_height : characterization.height
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def duration
|
|
36
|
-
characterization.duration.blank? ? characterization.video_duration : characterization.duration
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def sample_rate
|
|
40
|
-
characterization.sample_rate.blank? ? characterization.video_sample_rate : characterization.sample_rate
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
## Extract the metadata from the content datastream and record it in the characterization datastream
|
|
44
|
-
def characterize
|
|
45
|
-
metadata = content.extract_metadata
|
|
46
|
-
characterization.ng_xml = metadata if metadata.present?
|
|
47
|
-
append_metadata
|
|
48
|
-
self.filename = [content.original_name]
|
|
49
|
-
save
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Populate GenericFile's properties with fields from FITS (e.g. Author from pdfs)
|
|
53
|
-
def append_metadata
|
|
54
|
-
terms = self.characterization_terms
|
|
55
|
-
Sufia.config.fits_to_desc_mapping.each_pair do |k, v|
|
|
56
|
-
if terms.has_key?(k)
|
|
57
|
-
# coerce to array to remove a conditional
|
|
58
|
-
terms[k] = [terms[k]] unless terms[k].is_a? Array
|
|
59
|
-
terms[k].each do |term_value|
|
|
60
|
-
proxy_term = self.send(v)
|
|
61
|
-
if proxy_term.kind_of?(Array)
|
|
62
|
-
proxy_term << term_value unless proxy_term.include?(term_value)
|
|
63
|
-
else
|
|
64
|
-
# these are single-valued terms which cannot be appended to
|
|
65
|
-
self.send("#{v}=", term_value)
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def characterization_terms
|
|
73
|
-
h = {}
|
|
74
|
-
self.characterization.class.terminology.terms.each_pair do |k, v|
|
|
75
|
-
next unless v.respond_to? :proxied_term
|
|
76
|
-
term = v.proxied_term
|
|
77
|
-
begin
|
|
78
|
-
value = self.send(term.name)
|
|
79
|
-
h[term.name] = value unless value.empty?
|
|
80
|
-
rescue NoMethodError
|
|
81
|
-
next
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
h
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module GenericFile
|
|
3
|
-
module Derivatives
|
|
4
|
-
extend ActiveSupport::Concern
|
|
5
|
-
|
|
6
|
-
included do
|
|
7
|
-
include Hydra::Derivatives
|
|
8
|
-
|
|
9
|
-
makes_derivatives do |obj|
|
|
10
|
-
case obj.mime_type
|
|
11
|
-
when *pdf_mime_types
|
|
12
|
-
obj.transform_file :content, { thumbnail: { format: 'jpg', size: '338x493', datastream: 'thumbnail' } }
|
|
13
|
-
when *office_document_mime_types
|
|
14
|
-
obj.transform_file :content, { thumbnail: { format: 'jpg', size: '200x150>', datastream: 'thumbnail' } }, processor: :document
|
|
15
|
-
when *audio_mime_types
|
|
16
|
-
obj.transform_file :content, { mp3: { format: 'mp3', datastream: 'mp3' }, ogg: { format: 'ogg', datastream: 'ogg' } }, processor: :audio
|
|
17
|
-
when *video_mime_types
|
|
18
|
-
obj.transform_file :content, { webm: { format: 'webm', datastream: 'webm' }, mp4: { format: 'mp4', datastream: 'mp4' }, thumbnail: { format: 'jpg', datastream: 'thumbnail' } }, processor: :video
|
|
19
|
-
when *image_mime_types
|
|
20
|
-
obj.transform_file :content, { thumbnail: { format: 'jpg', size: '200x150>', datastream: 'thumbnail' } }
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module GenericFile
|
|
3
|
-
module Export
|
|
4
|
-
# MIME: 'application/x-endnote-refer'
|
|
5
|
-
def export_as_endnote
|
|
6
|
-
end_note_format = {
|
|
7
|
-
'%T' => [:title, lambda { |x| x.first }],
|
|
8
|
-
'%Q' => [:title, lambda { |x| x.drop(1) }],
|
|
9
|
-
'%A' => [:creator],
|
|
10
|
-
'%C' => [:publication_place],
|
|
11
|
-
'%D' => [:date_created],
|
|
12
|
-
'%8' => [:date_uploaded],
|
|
13
|
-
'%E' => [:contributor],
|
|
14
|
-
'%I' => [:publisher],
|
|
15
|
-
'%J' => [:series_title],
|
|
16
|
-
'%@' => [:isbn],
|
|
17
|
-
'%U' => [:related_url],
|
|
18
|
-
'%7' => [:edition_statement],
|
|
19
|
-
'%R' => [:persistent_url],
|
|
20
|
-
'%X' => [:description],
|
|
21
|
-
'%G' => [:language],
|
|
22
|
-
'%[' => [:date_modified],
|
|
23
|
-
'%9' => [:resource_type],
|
|
24
|
-
'%~' => I18n.t('sufia.product_name'),
|
|
25
|
-
'%W' => I18n.t('sufia.institution_name')
|
|
26
|
-
}
|
|
27
|
-
text = []
|
|
28
|
-
text << "%0 GenericFile"
|
|
29
|
-
end_note_format.each do |endnote_key, mapping|
|
|
30
|
-
if mapping.is_a? String
|
|
31
|
-
values = [mapping]
|
|
32
|
-
else
|
|
33
|
-
values = self.send(mapping[0]) if self.respond_to? mapping[0]
|
|
34
|
-
values = mapping[1].call(values) if mapping.length == 2
|
|
35
|
-
values = Array(values)
|
|
36
|
-
end
|
|
37
|
-
next if values.empty? or values.first.nil?
|
|
38
|
-
spaced_values = values.join("; ")
|
|
39
|
-
text << "#{endnote_key} #{spaced_values}"
|
|
40
|
-
end
|
|
41
|
-
return text.join("\n")
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def persistent_url
|
|
45
|
-
"#{Sufia.config.persistent_hostpath}#{id}"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# MIME type: 'application/x-openurl-ctx-kev'
|
|
49
|
-
def export_as_openurl_ctx_kev
|
|
50
|
-
export_text = []
|
|
51
|
-
export_text << "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator"
|
|
52
|
-
field_map = {
|
|
53
|
-
title: 'title',
|
|
54
|
-
creator: 'creator',
|
|
55
|
-
subject: 'subject',
|
|
56
|
-
description: 'description',
|
|
57
|
-
publisher: 'publisher',
|
|
58
|
-
contributor: 'contributor',
|
|
59
|
-
date_created: 'date',
|
|
60
|
-
resource_type: 'format',
|
|
61
|
-
identifier: 'identifier',
|
|
62
|
-
language: 'language',
|
|
63
|
-
tag: 'relation',
|
|
64
|
-
based_near: 'coverage',
|
|
65
|
-
rights: 'rights'
|
|
66
|
-
}
|
|
67
|
-
field_map.each do |element, kev|
|
|
68
|
-
values = self.send(element)
|
|
69
|
-
next if values.empty? or values.first.nil?
|
|
70
|
-
values.each do |value|
|
|
71
|
-
export_text << "rft.#{kev}=#{CGI::escape(value.to_s)}"
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
export_text.join('&') unless export_text.blank?
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def export_as_apa_citation
|
|
78
|
-
text = ''
|
|
79
|
-
authors_list = []
|
|
80
|
-
authors_list_final = []
|
|
81
|
-
|
|
82
|
-
#setup formatted author list
|
|
83
|
-
authors = get_author_list
|
|
84
|
-
authors.each do |author|
|
|
85
|
-
next if author.blank?
|
|
86
|
-
authors_list.push(abbreviate_name(author))
|
|
87
|
-
end
|
|
88
|
-
authors_list.each do |author|
|
|
89
|
-
if author == authors_list.first #first
|
|
90
|
-
authors_list_final.push(author.strip)
|
|
91
|
-
elsif author == authors_list.last #last
|
|
92
|
-
authors_list_final.push(", & " + author.strip)
|
|
93
|
-
else #all others
|
|
94
|
-
authors_list_final.push(", " + author.strip)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
text << authors_list_final.join
|
|
98
|
-
unless text.blank?
|
|
99
|
-
if text[-1,1] != "."
|
|
100
|
-
text << ". "
|
|
101
|
-
else
|
|
102
|
-
text << " "
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
# Get Pub Date
|
|
106
|
-
text << "(" + setup_pub_date + "). " unless setup_pub_date.nil?
|
|
107
|
-
|
|
108
|
-
# setup title info
|
|
109
|
-
title_info = setup_title_info
|
|
110
|
-
text << "<i>" + title_info + "</i> " unless title_info.nil?
|
|
111
|
-
|
|
112
|
-
# Publisher info
|
|
113
|
-
text << setup_pub_info unless setup_pub_info.nil?
|
|
114
|
-
unless text.blank?
|
|
115
|
-
if text[-1,1] != "."
|
|
116
|
-
text += "."
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
text.html_safe
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def export_as_mla_citation
|
|
123
|
-
text = ''
|
|
124
|
-
authors_final = []
|
|
125
|
-
|
|
126
|
-
#setup formatted author list
|
|
127
|
-
authors = get_author_list
|
|
128
|
-
|
|
129
|
-
if authors.length < 4
|
|
130
|
-
authors.each do |author|
|
|
131
|
-
if author == authors.first #first
|
|
132
|
-
authors_final.push(author)
|
|
133
|
-
elsif author == authors.last #last
|
|
134
|
-
authors_final.push(", and " + name_reverse(author) + ".")
|
|
135
|
-
else #all others
|
|
136
|
-
authors_final.push(", " + name_reverse(author))
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
text << authors_final.join
|
|
140
|
-
unless text.blank?
|
|
141
|
-
if text[-1,1] != "."
|
|
142
|
-
text << ". "
|
|
143
|
-
else
|
|
144
|
-
text << " "
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
else
|
|
148
|
-
text << authors.first + ", et al. "
|
|
149
|
-
end
|
|
150
|
-
# setup title
|
|
151
|
-
title_info = setup_title_info
|
|
152
|
-
text << "<i>" + mla_citation_title(title_info) + "</i> " unless title.blank?
|
|
153
|
-
|
|
154
|
-
# Publication
|
|
155
|
-
text << setup_pub_info + ", " unless setup_pub_info.nil?
|
|
156
|
-
|
|
157
|
-
# Get Pub Date
|
|
158
|
-
text << setup_pub_date unless setup_pub_date.nil?
|
|
159
|
-
if text[-1,1] != "."
|
|
160
|
-
text << "." unless text.blank?
|
|
161
|
-
end
|
|
162
|
-
text.html_safe
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
def export_as_chicago_citation
|
|
166
|
-
author_text = ""
|
|
167
|
-
authors = get_all_authors
|
|
168
|
-
unless authors.blank?
|
|
169
|
-
if authors.length > 10
|
|
170
|
-
authors.each_with_index do |author, index|
|
|
171
|
-
if index < 7
|
|
172
|
-
if index == 0
|
|
173
|
-
author_text << "#{author}"
|
|
174
|
-
if author.ends_with?(",")
|
|
175
|
-
author_text << " "
|
|
176
|
-
else
|
|
177
|
-
author_text << ", "
|
|
178
|
-
end
|
|
179
|
-
else
|
|
180
|
-
author_text << "#{name_reverse(author)}, "
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
author_text << " et al."
|
|
185
|
-
elsif authors.length > 1
|
|
186
|
-
authors.each_with_index do |author,index|
|
|
187
|
-
if index == 0
|
|
188
|
-
author_text << "#{author}"
|
|
189
|
-
if author.ends_with?(",")
|
|
190
|
-
author_text << " "
|
|
191
|
-
else
|
|
192
|
-
author_text << ", "
|
|
193
|
-
end
|
|
194
|
-
elsif index + 1 == authors.length
|
|
195
|
-
author_text << "and #{name_reverse(author)}."
|
|
196
|
-
else
|
|
197
|
-
author_text << "#{name_reverse(author)}, "
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
else
|
|
201
|
-
author_text << authors.first
|
|
202
|
-
end
|
|
203
|
-
end
|
|
204
|
-
title_info = ""
|
|
205
|
-
title_info << citation_title(clean_end_punctuation(CGI::escapeHTML(title.first)).strip) unless title.blank?
|
|
206
|
-
|
|
207
|
-
pub_info = ""
|
|
208
|
-
place = self.based_near.first
|
|
209
|
-
publisher = self.publisher.first
|
|
210
|
-
unless place.blank?
|
|
211
|
-
place = CGI::escapeHTML(place)
|
|
212
|
-
pub_info << place
|
|
213
|
-
pub_info << ": " unless publisher.blank?
|
|
214
|
-
end
|
|
215
|
-
unless publisher.blank?
|
|
216
|
-
publisher = CGI::escapeHTML(publisher)
|
|
217
|
-
pub_info << publisher
|
|
218
|
-
pub_info << ", " unless setup_pub_date.nil?
|
|
219
|
-
end
|
|
220
|
-
unless setup_pub_date.nil?
|
|
221
|
-
pub_info << setup_pub_date
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
citation = ""
|
|
225
|
-
citation << "#{author_text} " unless author_text.blank?
|
|
226
|
-
citation << "<i>#{title_info}.</i> " unless title_info.blank?
|
|
227
|
-
citation << "#{pub_info}." unless pub_info.blank?
|
|
228
|
-
citation.html_safe
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
private
|
|
232
|
-
|
|
233
|
-
def setup_pub_date
|
|
234
|
-
first_date = self.date_created.first
|
|
235
|
-
unless first_date.blank?
|
|
236
|
-
first_date = CGI::escapeHTML(first_date)
|
|
237
|
-
date_value = first_date.gsub(/[^0-9|n\.d\.]/, "")[0,4]
|
|
238
|
-
return nil if date_value.nil?
|
|
239
|
-
end
|
|
240
|
-
clean_end_punctuation(date_value) if date_value
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
def setup_pub_info
|
|
244
|
-
text = ''
|
|
245
|
-
place = self.based_near.first
|
|
246
|
-
publisher = self.publisher.first
|
|
247
|
-
unless place.blank?
|
|
248
|
-
place = CGI::escapeHTML(place)
|
|
249
|
-
text << place
|
|
250
|
-
text << ": " unless publisher.blank?
|
|
251
|
-
end
|
|
252
|
-
unless publisher.blank?
|
|
253
|
-
publisher = CGI::escapeHTML(publisher)
|
|
254
|
-
text << publisher
|
|
255
|
-
end
|
|
256
|
-
return nil if text.strip.blank?
|
|
257
|
-
clean_end_punctuation(text.strip)
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
def mla_citation_title(text)
|
|
261
|
-
no_upcase = ["a","an","and","but","by","for","it","of","the","to","with"]
|
|
262
|
-
new_text = []
|
|
263
|
-
word_parts = text.split(" ")
|
|
264
|
-
word_parts.each do |w|
|
|
265
|
-
if !no_upcase.include? w
|
|
266
|
-
new_text.push(w.capitalize)
|
|
267
|
-
else
|
|
268
|
-
new_text.push(w)
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
new_text.join(" ")
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def citation_title(title_text)
|
|
275
|
-
prepositions = ["a","about","across","an","and","before","but","by","for","it","of","the","to","with","without"]
|
|
276
|
-
new_text = []
|
|
277
|
-
title_text.split(" ").each_with_index do |word,index|
|
|
278
|
-
if (index == 0 and word != word.upcase) or (word.length > 1 and word != word.upcase and !prepositions.include?(word))
|
|
279
|
-
# the split("-") will handle the capitalization of hyphenated words
|
|
280
|
-
new_text << word.split("-").map!{|w| w.capitalize }.join("-")
|
|
281
|
-
else
|
|
282
|
-
new_text << word
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
new_text.join(" ")
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
def setup_title_info
|
|
289
|
-
text = ''
|
|
290
|
-
title = self.title.first
|
|
291
|
-
unless title.blank?
|
|
292
|
-
title = CGI::escapeHTML(title)
|
|
293
|
-
title_info = clean_end_punctuation(title.strip)
|
|
294
|
-
text << title_info
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
return nil if text.strip.blank?
|
|
298
|
-
clean_end_punctuation(text.strip) + "."
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
def clean_end_punctuation(text)
|
|
302
|
-
if [".",",",":",";","/"].include? text[-1,1]
|
|
303
|
-
return text[0,text.length-1]
|
|
304
|
-
end
|
|
305
|
-
text
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
def get_author_list
|
|
309
|
-
self.creator.map { |author| clean_end_punctuation(CGI::escapeHTML(author)) }.uniq
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
def get_all_authors
|
|
313
|
-
authors = self.creator
|
|
314
|
-
return authors.empty? ? nil : authors.map { |author| CGI::escapeHTML(author) }
|
|
315
|
-
end
|
|
316
|
-
|
|
317
|
-
def abbreviate_name(name)
|
|
318
|
-
abbreviated_name = ''
|
|
319
|
-
name = name.join('') if name.is_a? Array
|
|
320
|
-
# make sure we handle "Cher" correctly
|
|
321
|
-
return name if !name.include?(' ') and !name.include?(',')
|
|
322
|
-
surnames_first = name.include?(',')
|
|
323
|
-
delimiter = surnames_first ? ', ' : ' '
|
|
324
|
-
name_segments = name.split(delimiter)
|
|
325
|
-
given_names = surnames_first ? name_segments.last.split(' ') : name_segments.first.split(' ')
|
|
326
|
-
surnames = surnames_first ? name_segments.first.split(' ') : name_segments.last.split(' ')
|
|
327
|
-
abbreviated_name << surnames.join(' ')
|
|
328
|
-
abbreviated_name << ', '
|
|
329
|
-
abbreviated_name << given_names.map { |n| "#{n[0]}." }.join if given_names.is_a? Array
|
|
330
|
-
abbreviated_name << "#{given_names[0]}." if given_names.is_a? String
|
|
331
|
-
abbreviated_name
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
def name_reverse(name)
|
|
335
|
-
name = clean_end_punctuation(name)
|
|
336
|
-
return name unless name =~ /,/
|
|
337
|
-
temp_name = name.split(", ")
|
|
338
|
-
return temp_name.last + " " + temp_name.first
|
|
339
|
-
end
|
|
340
|
-
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
|
-
end
|