sufia 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -3
- data/Gemfile +1 -0
- data/Releasing_sufia.md +3 -0
- data/SUFIA_VERSION +1 -0
- data/app/assets/javascripts/sufia.js +22 -24
- data/app/assets/javascripts/sufia/batch_select_all.js +2 -0
- data/app/assets/javascripts/sufia/fileupload.js +6 -0
- data/app/assets/javascripts/sufia/uploader.js +165 -0
- data/app/assets/javascripts/terms_of_service.js +36 -30
- data/app/assets/stylesheets/{scholarsphere-bootstrap.css → application-bootstrap.css} +0 -0
- data/app/assets/stylesheets/sufia.css.scss +1 -1
- data/app/controllers/batch_controller.rb +1 -0
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +2 -1
- data/app/helpers/generic_file_helper.rb +17 -0
- data/{lib/sufia → app}/jobs/content_delete_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/content_deposit_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/content_new_version_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/content_restored_version_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/content_update_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/user_edit_profile_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/user_follow_event_job.rb +0 -0
- data/{lib/sufia → app}/jobs/user_unfollow_event_job.rb +0 -0
- data/app/models/contact_form.rb +2 -2
- data/app/views/_ga.html.erb +2 -2
- data/app/views/batch_edits/_batch_edits_actions.html.erb +1 -0
- data/app/views/batch_edits/_check_all.html.erb +1 -2
- data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
- data/app/views/dashboard/_batch_edits_actions.html.erb +2 -0
- data/app/views/dashboard/_sort_and_per_page.html.erb +1 -1
- data/app/views/generic_files/_breadcrumbs.html.erb +5 -1
- data/app/views/generic_files/_descriptions.html.erb +6 -4
- data/app/views/generic_files/_dropbox_import.html.erb +3 -0
- data/app/views/generic_files/_field_display.html.erb +12 -0
- data/app/views/generic_files/_field_form.html.erb +1 -1
- data/app/views/generic_files/_multiple_upload.html.erb +4 -135
- data/app/views/generic_files/_permission_form.html.erb +5 -5
- data/app/views/generic_files/_show_descriptions.html.erb +6 -14
- data/app/views/generic_files/_show_details.html.erb +2 -2
- data/app/views/generic_files/edit_fields/_resource_type.html.erb +9 -0
- data/app/views/generic_files/edit_fields/_rights.html.erb +1 -1
- data/app/views/generic_files/edit_fields/_type.html.erb +4 -1
- data/app/views/generic_files/new.html.erb +18 -1
- data/app/views/generic_files/show_fields/_default.html.erb +12 -0
- data/app/views/generic_files/upload/_agreement.html.erb +5 -0
- data/app/views/generic_files/upload/_alerts.html.erb +19 -0
- data/app/views/generic_files/upload/_dropbox_chooser.html.erb +39 -0
- data/app/views/generic_files/upload/_form.html.erb +6 -0
- data/app/views/generic_files/upload/_form_fields.html.erb +47 -0
- data/app/views/generic_files/upload/_script_templates.html.erb +61 -0
- data/app/views/generic_files/upload/_tos_checkbox.html.erb +3 -0
- data/app/views/layouts/_head-tag-content.html.erb +22 -0
- data/app/views/layouts/{hydra-head.html.erb → homepage.html.erb} +3 -44
- data/app/views/layouts/sufia-one-column.html.erb +43 -0
- data/app/views/layouts/sufia-two-column.html.erb +45 -0
- data/app/views/static/agreement.html.erb +12 -11
- data/app/views/static/mendeley.html.erb +2 -2
- data/app/views/static/terms.html.erb +11 -11
- data/app/views/static/zotero.html.erb +2 -2
- data/config/initializers/sufia_events.rb +3 -0
- data/config/locales/sufia.en.yml +3 -6
- data/features/step_definitions/{scholarsphere.rb → sufia.rb} +0 -0
- data/lib/generators/sufia/sufia_generator.rb +1 -1
- data/lib/generators/sufia/templates/config/resque_config.rb +1 -1
- data/lib/generators/sufia/templates/config/sufia.rb +3 -0
- data/lib/sufia.rb +1 -50
- data/lib/sufia/batch_edits_controller_behavior.rb +4 -0
- data/lib/sufia/controller.rb +13 -0
- data/lib/sufia/dashboard_controller_behavior.rb +3 -2
- data/lib/sufia/files_controller_behavior.rb +35 -12
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +2 -2
- data/spec/controllers/generic_files_controller_spec.rb +37 -1
- data/spec/models/generic_file_spec.rb +6 -6
- data/spec/models/properties_datastream_spec.rb +8 -7
- data/spec/models/transcode_audio_job_spec.rb +1 -1
- data/spec/models/transcode_video_job_spec.rb +1 -1
- data/spec/views/batch_edits/check_all_spec.rb +22 -0
- data/sufia-models/.gitignore +17 -0
- data/sufia-models/Gemfile +4 -0
- data/sufia-models/LICENSE.md +177 -0
- data/sufia-models/README.md +39 -0
- data/sufia-models/Rakefile +1 -0
- data/{app → sufia-models/app}/models/batch.rb +2 -4
- data/{app → sufia-models/app}/models/checksum_audit_log.rb +3 -4
- data/{app → sufia-models/app}/models/datastreams/batch_rdf_datastream.rb +0 -0
- data/{app → sufia-models/app}/models/datastreams/file_content_datastream.rb +0 -0
- data/{app → sufia-models/app}/models/datastreams/fits_datastream.rb +0 -0
- data/{app → sufia-models/app}/models/datastreams/generic_file_rdf_datastream.rb +12 -12
- data/{app → sufia-models/app}/models/datastreams/paranoid_rights_datastream.rb +0 -15
- data/{app → sufia-models/app}/models/datastreams/properties_datastream.rb +1 -2
- data/{app → sufia-models/app}/models/domain_term.rb +0 -0
- data/{app → sufia-models/app}/models/follow.rb +0 -0
- data/{app → sufia-models/app}/models/generic_file.rb +0 -0
- data/{app → sufia-models/app}/models/geo_names_resource.rb +0 -0
- data/{app → sufia-models/app}/models/group.rb +0 -0
- data/{app → sufia-models/app}/models/local_authority.rb +0 -0
- data/{app → sufia-models/app}/models/local_authority_entry.rb +0 -0
- data/{app → sufia-models/app}/models/single_use_link.rb +0 -0
- data/{app → sufia-models/app}/models/subject_local_authority_entry.rb +0 -0
- data/{app → sufia-models/app}/models/trophy.rb +0 -0
- data/{app → sufia-models/app}/models/version_committer.rb +0 -0
- data/sufia-models/config/locales/sufia.en.yml +6 -0
- data/sufia-models/lib/sufia/models.rb +34 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/active_fedora/redis.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/active_record/redis.rb +0 -0
- data/{lib → sufia-models/lib/sufia/models}/active_support/core_ext/marshal.rb +0 -0
- data/sufia-models/lib/sufia/models/engine.rb +61 -0
- data/sufia-models/lib/sufia/models/file_content.rb +9 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/file_content/extract_metadata.rb +2 -2
- data/{lib/sufia → sufia-models/lib/sufia/models}/file_content/versions.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file.rb +3 -34
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/actions.rb +16 -1
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/audit.rb +1 -1
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/characterization.rb +1 -2
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/export.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/permissions.rb +0 -1
- data/{lib/sufia → sufia-models/lib/sufia/models}/generic_file/thumbnail.rb +3 -3
- data/sufia-models/lib/sufia/models/generic_file/web_form.rb +45 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/id_service.rb +11 -7
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/audit_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/batch_update_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/characterize_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/ffmpeg_transcode_job.rb +3 -3
- data/sufia-models/lib/sufia/models/jobs/import_url_job.rb +55 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/resolrize_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/transcode_audio_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/transcode_video_job.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/jobs/unzip_job.rb +16 -4
- data/{lib/sufia → sufia-models/lib/sufia/models}/model_methods.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/noid.rb +1 -1
- data/{lib/sufia/queue → sufia-models/lib/sufia/models}/resque.rb +0 -2
- data/{lib/sufia → sufia-models/lib/sufia/models}/solr_document_behavior.rb +0 -0
- data/{lib/sufia → sufia-models/lib/sufia/models}/user.rb +1 -1
- data/{lib/sufia → sufia-models/lib/sufia/models}/utils.rb +0 -0
- data/sufia-models/lib/sufia/models/version.rb +5 -0
- data/sufia-models/lib/tasks/sufia-models_tasks.rake +7 -0
- data/sufia-models/sufia-models.gemspec +44 -0
- data/sufia.gemspec +2 -12
- data/tasks/release.rake +90 -0
- data/tasks/sufia-dev.rake +1 -1
- data/tasks/sufia.rake +1 -3
- metadata +118 -238
- data/app/views/generic_files/show_fields/_based_near.html.erb +0 -12
- data/app/views/generic_files/show_fields/_contributor.html.erb +0 -12
- data/app/views/generic_files/show_fields/_creator.html.erb +0 -12
- data/app/views/generic_files/show_fields/_date_created.html.erb +0 -12
- data/app/views/generic_files/show_fields/_description.html.erb +0 -12
- data/app/views/generic_files/show_fields/_identifier.html.erb +0 -9
- data/app/views/generic_files/show_fields/_language.html.erb +0 -9
- data/app/views/generic_files/show_fields/_publisher.html.erb +0 -12
- data/app/views/generic_files/show_fields/_related_url.html.erb +0 -11
- data/app/views/generic_files/show_fields/_resource_type.html.erb +0 -9
- data/app/views/generic_files/show_fields/_rights.html.erb +0 -9
- data/app/views/generic_files/show_fields/_subject.html.erb +0 -12
- data/app/views/generic_files/show_fields/_tag.html.erb +0 -9
- data/app/views/generic_files/show_fields/_title.html.erb +0 -12
- data/lib/sufia/file_content.rb +0 -8
- data/lib/sufia/generic_file/web_form.rb +0 -15
- data/vendor/assets/javascripts/fileupload.js +0 -6
- data/vendor/assets/javascripts/fileupload/application.js +0 -185
- data/vendor/assets/javascripts/fileupload/jquery-ui-1.8.14.custom.min.js +0 -76
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
15
15
|
%>
|
16
16
|
|
17
|
-
<h1>Terms of Use for
|
17
|
+
<h1>Terms of Use for <%= t('sufia.product_name') %></h1>
|
18
18
|
|
19
19
|
<p>
|
20
|
-
1. <strong>General:</strong> The Site is maintained by the
|
20
|
+
1. <strong>General:</strong> The Site is maintained by the <%= t('sufia.institution_name_full') %> Libraries and <%= t('sufia.institution_name_full') %> Information Technology Services (ITS), in support of our mission to disseminate information and research to scholars, educators and the public. As used in these Terms of Use, the terms "we, "us," and "our" refer to the Libraries, ITS, and <%= t('sufia.institution_name_full') %> ("<%= t('sufia.institution_name') %>"). Use of <%= t('sufia.product_name') %> (the Site and its contents) is subject to the following terms and conditions and all applicable laws. By using the Site or any of its content, you accept and agree to be bound by these Terms of Use and all applicable laws. If any of these Terms of Use are unacceptable to you, do not use the Site.
|
21
21
|
</p>
|
22
22
|
|
23
23
|
<p>
|
@@ -25,23 +25,23 @@ limitations under the License.
|
|
25
25
|
</p>
|
26
26
|
|
27
27
|
<p>
|
28
|
-
3. <strong>Copyright and Use of
|
28
|
+
3. <strong>Copyright and Use of <%= t('sufia.product_name') %> Content:</strong> The Site includes text, images, graphics, information, articles, multi-media objects, scholarly projects and other works protected by copyright, trademark and other laws ("Content"). Some of the Content on this site may include materials from older published works that have passed into the "public domain" under U.S. copyright law. Where such information is known, it is included specifically in the metadata associated with each item of Content. However, the Site itself and most of the materials held as Content on the Site are protected by copyright and other laws. These materials have been deposited to enable teaching, research, and other non-profit educational activities. Unless otherwise specified in the metadata attached to an item of Content, you may use the Site and the Content only for non-commercial, research, educational, or related academic purposes. Further, you have the responsibility to make your own assessment of the copyright or other legal concerns that might affect your use of <%= t('sufia.product_name') %> content and to assume personal responsibility for your uses of Content.
|
29
29
|
</p>
|
30
30
|
|
31
31
|
<p>
|
32
|
-
4. <strong>Special Permissions:</strong>
|
32
|
+
4. <strong>Special Permissions:</strong> <%= t('sufia.product_name') %> does not have the authority to grant or deny special permissions to use images or other Content found on the site beyond those uses that are specifically described in these Terms of Use or as noted specifically on individual items of Content. <%= t('sufia.product_name') %> staff are not able to undertake copyright investigations on behalf of Site users.
|
33
33
|
</p>
|
34
34
|
|
35
35
|
<p>
|
36
|
-
5. <strong
|
36
|
+
5. <strong><%= t('sufia.product_name') %> Access Levels:</strong> Where possible, <%= t('sufia.product_name') %> makes its Content available to the general public. However, some of the Content on this Site has been made available only to <%= t('sufia.institution_name') %> community users or other user subgroups by the depositor. Such Content cannot be used, downloaded, or distributed outside the <%= t('sufia.institution_name') %> community (or subgroup identified) without the specific permission of the depositor.
|
37
37
|
</p>
|
38
38
|
|
39
39
|
<p>
|
40
|
-
6. <strong>Use of
|
40
|
+
6. <strong>Use of <%= t('sufia.product_name') %> Site and Content:</strong> Unless otherwise specified in the metadata attached to an item, Content that has been made accessible to the general public may be used for non-commercial, research, educational, or related academic purposes only. Such uses include personal study, distribution to students, research and scholarship (including computational research uses such as data and text-mining, citation-extraction, or cross-referencing) as long as you do not sell the Content or sell advertising on any page on which the Content is displayed. If you make an item of Content available to others, you shall do so in accordance with the terms of the rights granted pursuant to the particular item of Content, or at a minimum, you will retain with the Content its title, the name of the author(s), a reference to these Terms of Use, any copyright notice included on the original, and any metadata associated with the original. You may not use a facsimile of the published version of an article that may be posted in <%= t('sufia.product_name') %> under these open access terms, unless the publisher so permits. You will not make any translation, adaptation or other derivative work of an item of Content except as authorized under U.S. law. You may not sublicense or otherwise transfer your rights in an item of Content, unless specifically authorized by the copyright license granted to the item of Content and will only make Content available to others for use by them under these Terms of Use. Links on the Site to third-party web sites are provided solely as a convenience to you. We do not approve or endorse the content of linked third-party sites, and you agree that we will have no responsibility or liability in connection with your use of any linked third-party sites. Nothing in these Terms of Use or on the Site will be construed as granting you any right or license to use any trademarks, service marks or logos displayed on the Site. You agree not to use or register any name, logo or insignia of <%= t('sufia.institution_name_full') %> or any of its subdivisions for any purpose except with our prior written approval and in accordance with any restrictions required by us.
|
41
41
|
</p>
|
42
42
|
|
43
43
|
<p>
|
44
|
-
7. <strong>Fair Use and Other Lawful Uses:</strong> Nothing in these Terms of Use is intended to restrict or limit you from making uses of Content that, in the absence of rights granted hereunder, would not infringe or violate anyone's copyright, trademark or other rights. To the extent permitted by law, adaptation of
|
44
|
+
7. <strong>Fair Use and Other Lawful Uses:</strong> Nothing in these Terms of Use is intended to restrict or limit you from making uses of Content that, in the absence of rights granted hereunder, would not infringe or violate anyone's copyright, trademark or other rights. To the extent permitted by law, adaptation of <%= t('sufia.product_name') %> Content to enable use and access by persons with disabilities is encouraged.
|
45
45
|
</p>
|
46
46
|
|
47
47
|
<p>
|
@@ -49,7 +49,7 @@ limitations under the License.
|
|
49
49
|
</p>
|
50
50
|
|
51
51
|
<p>
|
52
|
-
9. <strong>Disclaimer of Warranties:</strong> THE SITE AND THE CONTENT ARE PROVIDED "AS IS." TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, WE DISCLAIM ALL WARRANTIES OF ANY KIND (EXPRESS, IMPLIED OR OTHERWISE) REGARDING THE SITE OR THE CONTENT, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OWNERSHIP, AND NON-INFRINGEMENT. WE MAKE NO WARRANTY ABOUT THE ACCURACY, RELIABILITY, COMPLETENESS, TIMELINESS, SUFFICIENCY OR QUALITY OF THE SITE OR THE CONTENT, NOR THAT ANY PARTICULAR CONTENT WILL CONTINUE TO BE MADE AVAILABLE. WE DO NOT APPROVE OR ENDORSE ANY POSTED MATERIAL OR CONTENT PROVIDED BY OTHERS, INCLUDING
|
52
|
+
9. <strong>Disclaimer of Warranties:</strong> THE SITE AND THE CONTENT ARE PROVIDED "AS IS." TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, WE DISCLAIM ALL WARRANTIES OF ANY KIND (EXPRESS, IMPLIED OR OTHERWISE) REGARDING THE SITE OR THE CONTENT, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OWNERSHIP, AND NON-INFRINGEMENT. WE MAKE NO WARRANTY ABOUT THE ACCURACY, RELIABILITY, COMPLETENESS, TIMELINESS, SUFFICIENCY OR QUALITY OF THE SITE OR THE CONTENT, NOR THAT ANY PARTICULAR CONTENT WILL CONTINUE TO BE MADE AVAILABLE. WE DO NOT APPROVE OR ENDORSE ANY POSTED MATERIAL OR CONTENT PROVIDED BY OTHERS, INCLUDING <%= t('sufia.institution_name').upcase %> AUTHORS. WE DO NOT WARRANT THAT THE SITE WILL OPERATE WITHOUT ERROR OR INTERRUPTION, OR THAT THE SITE OR ITS SERVER ARE FREE OF COMPUTER VIRUSES OR OTHER HARMFUL MATERIALS.
|
53
53
|
</p>
|
54
54
|
|
55
55
|
<p>
|
@@ -57,14 +57,14 @@ limitations under the License.
|
|
57
57
|
</p>
|
58
58
|
|
59
59
|
<p>
|
60
|
-
11. <strong>Indemnity:</strong> You agree to indemnify and hold harmless
|
60
|
+
11. <strong>Indemnity:</strong> You agree to indemnify and hold harmless <%= t('sufia.institution_name_full') %> and its trustees, officers, fellows, students, employees and agents, from and against all claims, actions, suits, damages, liabilities and costs (including, without limitation, reasonable legal fees) arising from or relating to your use of the Site or any of the Content or your failure to comply with any provision of these Terms of Use.
|
61
61
|
</p>
|
62
62
|
|
63
63
|
<p>
|
64
64
|
12. <strong>Communications:</strong>
|
65
65
|
<ul>
|
66
66
|
<li>
|
67
|
-
A. Copyright Complaints: We respect the intellectual property rights of others. If you believe your copyright has been violated on the Site, please notify us through
|
67
|
+
A. Copyright Complaints: We respect the intellectual property rights of others. If you believe your copyright has been violated on the Site, please notify us through <%= t('sufia.institution_name') %>'s designated agent under the Digital Millennium Copyright Act (see 17 U.S.C. §512(c)(3).</li>
|
68
68
|
<li> B. Other Site Issues: Please direct all other communications to <a href="/contact/">contact form</a>.</ul>
|
69
69
|
</ul>
|
70
70
|
</p>
|
@@ -74,5 +74,5 @@ A. Copyright Complaints: We respect the intellectual property rights of others.
|
|
74
74
|
</p>
|
75
75
|
|
76
76
|
<p>
|
77
|
-
14. <strong>Termination:</strong> The permissions granted to you will terminate automatically upon any breach by you of these Terms of Use. If we take down or otherwise cease to make a work available as an item of Content, the permission granted to you hereunder to use that Content thereafter will terminate at that time.
|
77
|
+
14. <strong>Termination:</strong> The permissions granted to you will terminate automatically upon any breach by you of these Terms of Use. If we take down or otherwise cease to make a work available as an item of Content, the permission granted to you hereunder to use that Content thereafter will terminate at that time. <%= t('sufia.product_name') %> is maintained as a scholarly and educational resource by <%= t('sufia.institution_name') %> which may be modified or terminated by the University in its sole discretion.
|
78
78
|
</p>
|
@@ -17,6 +17,6 @@ limitations under the License.
|
|
17
17
|
<h1>Export to Zotero</h1>
|
18
18
|
<p>
|
19
19
|
Exporting to Zotero is supported via embedded metadata. If Zotero
|
20
|
-
does not automatically pick up metadata for files
|
21
|
-
|
20
|
+
does not automatically pick up metadata for deposited files, please
|
21
|
+
report the issue via the <%= link_to 'Contact Form', contact_form_index_path %>.
|
22
22
|
</p>
|
data/config/locales/sufia.en.yml
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
en:
|
2
2
|
sufia:
|
3
|
-
product_name: "ScholarSphere"
|
4
3
|
account_name: "Penn State Access Account Id"
|
5
|
-
institution_name: "Penn State"
|
6
4
|
deposit_agreement: "ScholarSphere's Deposit Agreement"
|
7
5
|
upload_tooltip: "Please accept Deposit Agreement before you can upload."
|
8
6
|
share_button: "Share Your Work"
|
@@ -21,11 +19,11 @@ en:
|
|
21
19
|
date_created: "Date Created"
|
22
20
|
related_url: "Related URL"
|
23
21
|
|
24
|
-
metadata_help:
|
22
|
+
metadata_help:
|
25
23
|
resource_type: "Pre-defined categories to describe the type of file content being uploaded, such as \"article\" or \"dataset.\" More than one type may be selected."
|
26
24
|
title: "A name for the file to aid in identifying it. Defaults to the file name, though a more descriptive title is encouraged. <em>This is a required field</em>."
|
27
25
|
tag: "Words or phrases you select to describe what the file is about. These are used to search for content. <em>This is a required field</em>."
|
28
|
-
subject: "Headings or index terms describing what the file is about; these <em>do</em> need to conform to an existing vocabulary. Currently
|
26
|
+
subject: "Headings or index terms describing what the file is about; these <em>do</em> need to conform to an existing vocabulary. Currently supports Library of Congress Subject Headings."
|
29
27
|
creator: "The person or group responsible for the file being uploaded. Usually this is the author of the content. Personal names should be entered with the last name first, e.g. \"Smith, John.\" <em>This is a required field</em>."
|
30
28
|
related_url: "A link to a website or other specific content (audio, video, PDF document) related to the file. An example is the URL of a research project from which the file was derived."
|
31
29
|
based_near: "A place name related to the file, such as its site of publication, or the city, state, or country the file's contents are about. Calls upon the GeoNames web service (<a href=\"http://www.geonames.org\">http://www.geonames.org</a>)."
|
@@ -34,7 +32,6 @@ en:
|
|
34
32
|
description: "Free-text notes about the file itself. Examples include abstracts of a paper, citation information for a journal article, or a tag indicating a larger collection to which the file belongs."
|
35
33
|
identifier: "A unique handle describing the file. An example would be a DOI for a journal article, or an ISBN or OCLC number for a book."
|
36
34
|
language: " The language of the file content."
|
37
|
-
publisher: "The person or group making the file available. Generally this is Penn State
|
35
|
+
publisher: "The person or group making the file available. Generally this is Penn State."
|
38
36
|
rights: "Licensing and distribution information governing access to the file. Select from the provided drop-down list. <em>This is a required field</em>."
|
39
37
|
|
40
|
-
|
File without changes
|
@@ -62,7 +62,7 @@ add_groups_to_users.rb create_local_authorities.rb create_trophies.rb}.each do
|
|
62
62
|
" \n# Adds Sufia behaviors into the application controller \n" +
|
63
63
|
" include Sufia::Controller\n"
|
64
64
|
end
|
65
|
-
gsub_file file_path, "layout 'blacklight'", "layout '
|
65
|
+
gsub_file file_path, "layout 'blacklight'", "layout 'sufia-one-column'"
|
66
66
|
else
|
67
67
|
puts " \e[31mFailure\e[0m Could not find #{file_path}. To add Sufia behaviors to your Controllers, you must include the Sufia::Controller module in the Controller class definition."
|
68
68
|
end
|
@@ -19,4 +19,4 @@ config = YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'redis.yml')
|
|
19
19
|
Resque.redis = Redis.new(host: config[:host], port: config[:port], thread_safe: true)
|
20
20
|
|
21
21
|
Resque.inline = rails_env == 'test'
|
22
|
-
Resque.redis.namespace = "
|
22
|
+
Resque.redis.namespace = "#{Sufia::Engine.config.id_namespace}:#{rails_env}"
|
data/lib/sufia.rb
CHANGED
@@ -3,14 +3,8 @@ require 'blacklight'
|
|
3
3
|
require 'blacklight_advanced_search'
|
4
4
|
require 'hydra/head'
|
5
5
|
require 'hydra-batch-edit'
|
6
|
-
require '
|
6
|
+
require 'sufia/models'
|
7
7
|
|
8
|
-
require 'mailboxer'
|
9
|
-
require 'acts_as_follower'
|
10
|
-
require 'paperclip'
|
11
|
-
require 'nest'
|
12
|
-
require 'RMagick'
|
13
|
-
require 'activerecord-import'
|
14
8
|
require 'rails_autolink'
|
15
9
|
require 'sufia/dashboard_controller_behavior'
|
16
10
|
require "sufia/contact_form_controller_behavior"
|
@@ -19,64 +13,21 @@ autoload :Zip, 'zipruby'
|
|
19
13
|
module Sufia
|
20
14
|
extend ActiveSupport::Autoload
|
21
15
|
|
22
|
-
autoload :Resque, 'sufia/queue/resque'
|
23
|
-
|
24
|
-
attr_accessor :queue
|
25
|
-
|
26
16
|
class Engine < ::Rails::Engine
|
27
17
|
engine_name 'sufia'
|
28
|
-
|
29
|
-
# Set some configuration defaults
|
30
|
-
config.queue = Sufia::Resque::Queue
|
31
|
-
config.enable_ffmpeg = false
|
32
|
-
config.ffmpeg_path = 'ffmpeg'
|
33
|
-
config.fits_message_length = 5
|
34
|
-
config.temp_file_base = nil
|
35
|
-
config.id_namespace = "sufia"
|
36
|
-
config.fits_path = "fits.sh"
|
37
|
-
config.enable_contact_form_delivery = false
|
38
18
|
|
39
19
|
config.autoload_paths += %W(
|
40
|
-
#{config.root}/lib/sufia/jobs
|
41
20
|
#{config.root}/app/controllers/concerns
|
42
21
|
#{config.root}/app/models/concerns
|
43
22
|
#{config.root}/app/models/datastreams
|
44
23
|
)
|
45
|
-
|
46
|
-
initializer "Patch active_fedora" do
|
47
|
-
require 'sufia/active_fedora/redis'
|
48
|
-
end
|
49
|
-
|
50
|
-
initializer "Patch active_record" do
|
51
|
-
require 'sufia/active_record/redis'
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.config(&block)
|
57
|
-
@@config ||= Sufia::Engine::Configuration.new
|
58
|
-
|
59
|
-
yield @@config if block
|
60
|
-
|
61
|
-
return @@config
|
62
|
-
end
|
63
24
|
|
64
|
-
def self.queue
|
65
|
-
@queue ||= config.queue.new('sufia')
|
66
25
|
end
|
67
26
|
|
68
|
-
autoload :GenericFile
|
69
27
|
autoload :Controller
|
70
|
-
autoload :Utils
|
71
|
-
autoload :User
|
72
|
-
autoload :ModelMethods
|
73
|
-
autoload :Noid
|
74
|
-
autoload :IdService
|
75
28
|
autoload :HttpHeaderAuth
|
76
|
-
autoload :SolrDocumentBehavior
|
77
29
|
autoload :FilesControllerBehavior
|
78
30
|
autoload :BatchEditsControllerBehavior
|
79
31
|
autoload :DownloadsControllerBehavior
|
80
|
-
autoload :FileContent
|
81
32
|
end
|
82
33
|
|
data/lib/sufia/controller.rb
CHANGED
@@ -56,6 +56,19 @@ module Sufia::Controller
|
|
56
56
|
@batches=current_user.mailbox.inbox.map {|msg| msg.last_message.body[/<a class="batchid ui-helper-hidden">(.*)<\/a>The file(.*)/,1]}.select{|val| !val.blank?}
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
def search_layout
|
61
|
+
if has_search_parameters?
|
62
|
+
"sufia-two-column"
|
63
|
+
else
|
64
|
+
"homepage"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# This repeats has_search_parameters? method from Blacklight::CatalogHelperBehavior
|
69
|
+
def has_search_parameters?
|
70
|
+
!params[:q].blank? or !params[:f].blank? or !params[:search_field].blank?
|
71
|
+
end
|
59
72
|
|
60
73
|
protected
|
61
74
|
|
@@ -25,11 +25,12 @@ module Sufia
|
|
25
25
|
include Blacklight::Catalog
|
26
26
|
include Blacklight::Configurable # comply with BL 3.7
|
27
27
|
include ActionView::Helpers::DateHelper
|
28
|
+
# This is needed as of BL 3.7
|
29
|
+
self.copy_blacklight_config_from(CatalogController)
|
30
|
+
|
28
31
|
include BlacklightAdvancedSearch::ParseBasicQ
|
29
32
|
include BlacklightAdvancedSearch::Controller
|
30
33
|
|
31
|
-
# This is needed as of BL 3.7
|
32
|
-
self.copy_blacklight_config_from(CatalogController)
|
33
34
|
|
34
35
|
before_filter :authenticate_user!
|
35
36
|
before_filter :enforce_show_permissions, :only=>:show
|
@@ -21,7 +21,8 @@ module Sufia
|
|
21
21
|
include Hydra::Controller::ControllerBehavior
|
22
22
|
include Blacklight::Configurable # comply with BL 3.7
|
23
23
|
include Sufia::Noid # for normalize_identifier method
|
24
|
-
|
24
|
+
layout "sufia-one-column"
|
25
|
+
|
25
26
|
# This is needed as of BL 3.7
|
26
27
|
self.copy_blacklight_config_from(CatalogController)
|
27
28
|
|
@@ -67,6 +68,28 @@ module Sufia
|
|
67
68
|
|
68
69
|
# routed to /files (POST)
|
69
70
|
def create
|
71
|
+
case params['file_coming_from']
|
72
|
+
when 'dropbox'
|
73
|
+
create_from_url(params)
|
74
|
+
else
|
75
|
+
create_from_local(params)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_from_url(params)
|
80
|
+
params[:dropbox_urls].each do |db_file|
|
81
|
+
next if db_file.blank?
|
82
|
+
# do not remove ::
|
83
|
+
@generic_file = ::GenericFile.new
|
84
|
+
@generic_file.import_url = db_file
|
85
|
+
@generic_file.label = File.basename(db_file)
|
86
|
+
Sufia::GenericFile::Actions.create_metadata(@generic_file, current_user, params[:batch_id])
|
87
|
+
Sufia.queue.push(ImportUrlJob.new(@generic_file.pid))
|
88
|
+
end
|
89
|
+
redirect_to sufia.batch_edit_path(params[:batch_id])
|
90
|
+
end
|
91
|
+
|
92
|
+
def create_from_local(params)
|
70
93
|
begin
|
71
94
|
# check error condition No files
|
72
95
|
return json_error("Error! No file to save") if !params.has_key?(:files)
|
@@ -157,8 +180,7 @@ module Sufia
|
|
157
180
|
def process_file(file)
|
158
181
|
if virus_check(file) == 0
|
159
182
|
@generic_file = ::GenericFile.new
|
160
|
-
|
161
|
-
@generic_file.relative_path = params[:relative_path] if params[:relative_path]
|
183
|
+
update_metadata_from_upload_screen
|
162
184
|
Sufia::GenericFile::Actions.create_metadata(@generic_file, current_user, params[:batch_id])
|
163
185
|
Sufia::GenericFile::Actions.create_content(@generic_file, file, file.original_filename, datastream_id, current_user)
|
164
186
|
respond_to do |format|
|
@@ -194,6 +216,13 @@ module Sufia
|
|
194
216
|
'content'
|
195
217
|
end
|
196
218
|
|
219
|
+
# this is provided so that implementing application can override this behavior and map params to different attributes
|
220
|
+
def update_metadata_from_upload_screen
|
221
|
+
# Relative path is set by the jquery uploader when uploading a directory
|
222
|
+
@generic_file.relative_path = params[:relative_path] if params[:relative_path]
|
223
|
+
end
|
224
|
+
|
225
|
+
|
197
226
|
# this is provided so that implementing application can override this behavior and map params to different attributes
|
198
227
|
def update_metadata
|
199
228
|
valid_attributes = params[:generic_file].select { |k,v| (@generic_file.terms_for_editing + [:permissions]).include? k.to_sym}
|
@@ -204,15 +233,9 @@ module Sufia
|
|
204
233
|
|
205
234
|
|
206
235
|
def virus_check( file)
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
logger.warn "Virus checking did not pass for #{file.inspect} status = #{stat}" unless stat == 0
|
211
|
-
stat
|
212
|
-
else
|
213
|
-
logger.warn "Virus checking disabled for #{file.inspect}"
|
214
|
-
0
|
215
|
-
end
|
236
|
+
stat = Sufia::GenericFile::Actions.virus_check(file)
|
237
|
+
flash[:error] = "Virus checking did not pass for #{File.basename(file.path)} status = #{stat}" unless stat == 0
|
238
|
+
stat
|
216
239
|
end
|
217
240
|
|
218
241
|
end
|
data/lib/sufia/version.rb
CHANGED
@@ -27,8 +27,8 @@ describe BatchEditsController do
|
|
27
27
|
it "should be successful" do
|
28
28
|
get :edit
|
29
29
|
response.should be_successful
|
30
|
-
assigns[:terms].should == [:
|
31
|
-
|
30
|
+
assigns[:terms].should == [:creator, :contributor, :description, :tag, :rights, :publisher,
|
31
|
+
:date_created, :subject, :language, :identifier, :based_near, :related_url]
|
32
32
|
assigns[:show_file].creator.should == ["Fred", "Wilma"]
|
33
33
|
assigns[:show_file].publisher.should == ["Rand McNally"]
|
34
34
|
assigns[:show_file].language.should == ["en"]
|
@@ -73,6 +73,42 @@ describe GenericFilesController do
|
|
73
73
|
xhr :post, :create, :files=>[file], :Filename=>"The world", :batch_id => "sample:batch_id", :permission=>{"group"=>{"public"=>"read"} }, :terms_of_service => '1'
|
74
74
|
end
|
75
75
|
|
76
|
+
it "should download and import a file from a given url" do
|
77
|
+
date_today = Date.today
|
78
|
+
Date.stub(:today).and_return(date_today)
|
79
|
+
generic_file = GenericFile.new #find(self.pid)
|
80
|
+
Sufia::GenericFile::Actions.create_metadata(generic_file, @user, '1234')
|
81
|
+
#generic_file.import_url = "https://dl.dropboxusercontent.com/1/view/kcb4j1dtkw0td3z/ArticleCritique.doc"
|
82
|
+
generic_file.import_url = "https://dl.dropboxusercontent.com/1/view/m4og1xrgbk3ihw6/Getting%20Started.pdf"
|
83
|
+
generic_file.save
|
84
|
+
f = Tempfile.new(generic_file.pid) #self.pid)
|
85
|
+
f.binmode
|
86
|
+
# download file from url
|
87
|
+
uri = URI(generic_file.import_url)
|
88
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
89
|
+
http.use_ssl = uri.scheme == "https" # enable SSL/TLS
|
90
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
91
|
+
|
92
|
+
http.start do
|
93
|
+
http.request_get(uri.to_s) do |resp|
|
94
|
+
resp.read_body do |segment|
|
95
|
+
f.write(segment)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
job_user = User.batchuser()
|
100
|
+
user = User.find_by_user_key(generic_file.depositor)
|
101
|
+
# check for virus
|
102
|
+
if Sufia::GenericFile::Actions.virus_check(f) != 0
|
103
|
+
message = "The file (#{File.basename(uri.path)}) was unable to be imported because it contained a virus."
|
104
|
+
job_user.send_message(user, message, 'File Import Error')
|
105
|
+
return
|
106
|
+
end
|
107
|
+
f.rewind
|
108
|
+
# attach downloaded file to generic file stubbed out
|
109
|
+
Sufia::GenericFile::Actions.create_content(generic_file, f, File.basename(uri.path), 'content', user)
|
110
|
+
end
|
111
|
+
|
76
112
|
it "should create and save a file asset from the given params" do
|
77
113
|
date_today = Date.today
|
78
114
|
Date.stub(:today).and_return(date_today)
|
@@ -105,7 +141,7 @@ describe GenericFilesController do
|
|
105
141
|
end
|
106
142
|
|
107
143
|
it "should create batch associations from batch_id" do
|
108
|
-
Sufia
|
144
|
+
Sufia.config.stub(:id_namespace).and_return('sample')
|
109
145
|
file = fixture_file_upload('/world.png','image/png')
|
110
146
|
controller.stub(:add_posted_blob_to_asset)
|
111
147
|
xhr :post, :create, :files=>[file], :Filename=>"The world", :batch_id => "sample:batch_id", :permission=>{"group"=>{"public"=>"read"} }, :terms_of_service=>"1"
|
@@ -41,15 +41,15 @@ describe GenericFile do
|
|
41
41
|
|
42
42
|
describe "terms_for_editing" do
|
43
43
|
it "should return a list" do
|
44
|
-
@file.terms_for_editing.should == [ :
|
45
|
-
|
44
|
+
@file.terms_for_editing.should == [:resource_type, :title, :creator, :contributor, :description, :tag,
|
45
|
+
:rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
46
46
|
end
|
47
47
|
end
|
48
48
|
describe "terms_for_display" do
|
49
49
|
it "should return a list" do
|
50
|
-
@file.terms_for_display.should == [
|
51
|
-
:publisher, :date_created, :date_uploaded, :date_modified
|
52
|
-
:
|
50
|
+
@file.terms_for_display.should == [:part_of, :resource_type, :title, :creator, :contributor, :description,
|
51
|
+
:tag, :rights, :publisher, :date_created, :date_uploaded, :date_modified, :subject, :language, :identifier,
|
52
|
+
:based_near, :related_url]
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -335,7 +335,7 @@ describe GenericFile do
|
|
335
335
|
after do
|
336
336
|
@f.delete
|
337
337
|
end
|
338
|
-
describe "with a video", :if => Sufia
|
338
|
+
describe "with a video", :if => Sufia.config.enable_ffmpeg do
|
339
339
|
before do
|
340
340
|
@f.stub(:mime_type=>'video/quicktime') #Would get set by the characterization job
|
341
341
|
@f.add_file_datastream(File.new("#{fixture_path}/countdown.avi", 'rb'), :dsid=>'content')
|