umlaut 3.0.5 → 3.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +48 -5
- data/app/assets/images/umlaut_icons.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-book-go.png +0 -0
- data/app/assets/images/{famfamfam/book_open.png → umlaut_icons/famfamfam-book-open.png} +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-book.png +0 -0
- data/app/assets/images/{famfamfam/cross.png → umlaut_icons/famfamfam-cross.png} +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-error.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-help.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-information.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-link.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-sound.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-text.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-up.png +0 -0
- data/app/assets/images/{famfamfam/page_white.png → umlaut_icons/famfamfam-page-white.png} +0 -0
- data/app/assets/images/{famfamfam/readme.html → umlaut_icons/famfamfam-readme.html} +0 -0
- data/app/assets/images/{famfamfam/tiny_cross.png → umlaut_icons/famfamfam-tiny-cross.png} +0 -0
- data/app/assets/images/{list_closed.png → umlaut_icons/list-closed.png} +0 -0
- data/app/assets/images/{list_open.png → umlaut_icons/list-open.png} +0 -0
- data/app/assets/javascripts/umlaut.js +5 -4
- data/app/assets/javascripts/umlaut/ajax_windows.js +41 -23
- data/app/assets/javascripts/umlaut/expand_contract_toggle.js +21 -29
- data/app/assets/javascripts/umlaut/load_permalink.js +26 -0
- data/app/assets/javascripts/umlaut/search_autocomplete.js +103 -44
- data/app/assets/stylesheets/umlaut.css.scss +19 -0
- data/app/assets/stylesheets/umlaut/_admin.scss +14 -0
- data/app/assets/stylesheets/umlaut/_az.scss +29 -0
- data/app/assets/stylesheets/umlaut/_forms.scss +31 -0
- data/app/assets/stylesheets/umlaut/_icons.scss +64 -0
- data/app/assets/stylesheets/umlaut/_layout.scss +52 -0
- data/app/assets/stylesheets/umlaut/_misc.scss +59 -0
- data/app/assets/stylesheets/umlaut/_mixins.scss +65 -0
- data/app/assets/stylesheets/umlaut/_modal.scss +4 -0
- data/app/assets/stylesheets/umlaut/_resolve.scss +308 -0
- data/app/assets/stylesheets/umlaut/_results.scss +34 -0
- data/app/assets/stylesheets/umlaut/_search.scss +14 -0
- data/app/assets/stylesheets/umlaut/_spinner.scss +12 -0
- data/app/assets/stylesheets/umlaut/_variables.scss +72 -0
- data/app/controllers/export_email_controller.rb +22 -39
- data/app/controllers/journal_tocs_controller +90 -0
- data/app/controllers/js_helper_controller.rb +2 -3
- data/app/controllers/link_router_controller.rb +32 -43
- data/app/controllers/open_search_controller.rb +3 -4
- data/app/controllers/resolve_controller.rb +68 -107
- data/app/controllers/resource_controller.rb +14 -20
- data/app/controllers/search_controller.rb +75 -94
- data/app/controllers/search_methods/README.md +28 -0
- data/app/controllers/search_methods/sfx4.rb +50 -119
- data/app/controllers/search_methods/sfx4_solr/README.md +57 -0
- data/app/controllers/search_methods/sfx4_solr/local.rb +40 -0
- data/app/controllers/search_methods/sfx4_solr/searcher.rb +90 -0
- data/app/controllers/store_controller.rb +24 -30
- data/app/controllers/umlaut/controller_behavior.rb +45 -17
- data/app/controllers/umlaut/error_handling.rb +20 -25
- data/{lib → app/controllers}/umlaut_configurable.rb +35 -21
- data/app/controllers/umlaut_controller.rb +43 -46
- data/app/helpers/emailer_helper.rb +9 -16
- data/app/helpers/export_email_helper.rb +8 -8
- data/app/helpers/open_search_helper.rb +2 -3
- data/app/helpers/resolve_helper.rb +130 -100
- data/app/helpers/search_helper.rb +17 -5
- data/app/helpers/umlaut/footer_helper.rb +1 -1
- data/app/helpers/umlaut/helper.rb +34 -0
- data/app/helpers/umlaut/html_head_helper.rb +12 -21
- data/{lib → app/mixin_logic}/marc_helper.rb +1 -1
- data/{lib → app/mixin_logic}/metadata_helper.rb +6 -5
- data/{lib → app/mixin_logic}/umlaut_http.rb +0 -0
- data/{lib → app/mixin_logic}/xml_schema_helper.rb +0 -0
- data/app/models/collection.rb +97 -95
- data/{lib → app/models}/hip3/bib.rb +0 -0
- data/{lib → app/models}/hip3/bib_searcher.rb +0 -0
- data/{lib → app/models}/hip3/custom_field_lookup.rb +0 -0
- data/{lib → app/models}/hip3/holding.rb +0 -0
- data/{lib → app/models}/hip3/item.rb +0 -0
- data/{lib → app/models}/hip3/receipt.rb +0 -0
- data/{lib → app/models}/hip3/serial_copy.rb +0 -0
- data/app/models/permalink.rb +3 -8
- data/app/models/referent.rb +29 -21
- data/app/models/request.rb +19 -8
- data/app/models/service_response.rb +24 -3
- data/app/models/service_store.rb +108 -39
- data/app/models/service_store.rb-NEW +73 -0
- data/app/models/service_wave.rb +2 -0
- data/app/models/sfx4/abstract/README.md +68 -0
- data/app/models/sfx4/abstract/az_extra_info.rb +44 -0
- data/app/models/sfx4/abstract/az_letter_group.rb +24 -0
- data/app/models/sfx4/abstract/az_title.rb +96 -0
- data/app/models/sfx4/abstract/az_title_search.rb +24 -0
- data/app/models/sfx4/abstract/base.rb +77 -0
- data/app/models/sfx4/global/base.rb +24 -0
- data/app/models/sfx4/global/kb_objects.rb +34 -0
- data/app/models/sfx4/local/az_extra_info.rb +7 -0
- data/app/models/sfx4/local/az_letter_group.rb +7 -0
- data/app/models/sfx4/local/az_title.rb +7 -0
- data/app/models/sfx4/local/az_title_search.rb +7 -0
- data/app/models/sfx4/local/base.rb +26 -0
- data/{lib → app/presentation}/section_renderer.rb +0 -12
- data/app/referent_filters/dissertation_catch.rb +67 -0
- data/{lib → app/referent_filters}/referent_filter.rb +0 -0
- data/{lib → app}/service_adaptors/ajax_export.rb +0 -0
- data/{lib → app}/service_adaptors/amazon.rb +2 -0
- data/{lib → app}/service_adaptors/blacklight.rb +22 -10
- data/{lib → app}/service_adaptors/book_finder.rb +0 -0
- data/{lib → app}/service_adaptors/bx.rb +0 -0
- data/{lib → app}/service_adaptors/cover_thing.rb +0 -0
- data/{lib → app}/service_adaptors/dummy_service.rb +0 -0
- data/{lib → app}/service_adaptors/elsevier_cover.rb +0 -0
- data/{lib → app}/service_adaptors/email_export.rb +0 -0
- data/{lib → app}/service_adaptors/ezproxy.rb +0 -0
- data/{lib → app}/service_adaptors/google_book_search.rb +0 -0
- data/app/service_adaptors/google_scholar_link.rb +71 -0
- data/{lib → app}/service_adaptors/gpo.rb +0 -0
- data/{lib → app}/service_adaptors/hathi_trust.rb +0 -0
- data/{lib → app}/service_adaptors/hip3_service.rb +0 -0
- data/{lib → app}/service_adaptors/hip_holding_search.rb +0 -0
- data/{lib → app}/service_adaptors/internet_archive.rb +0 -0
- data/{lib → app}/service_adaptors/isbn_db.rb +0 -0
- data/{lib → app}/service_adaptors/isi.rb +22 -13
- data/{lib → app}/service_adaptors/jcr.rb +0 -0
- data/{lib → app}/service_adaptors/opac.rb +0 -0
- data/{lib → app}/service_adaptors/open_library.rb +0 -0
- data/{lib → app}/service_adaptors/open_library_cover.rb +0 -0
- data/{lib → app}/service_adaptors/pubmed.rb +0 -0
- data/{lib → app}/service_adaptors/request_to_fixture.rb +0 -0
- data/{lib → app}/service_adaptors/scopus.rb +0 -0
- data/{lib → app/service_adaptors}/service.rb +3 -3
- data/{lib → app}/service_adaptors/sfx.rb +154 -11
- data/{lib → app}/service_adaptors/sfx_backchannel_record.rb +0 -0
- data/app/service_adaptors/tr_link.rb +267 -0
- data/app/service_adaptors/tr_links.rb +278 -0
- data/{lib → app}/service_adaptors/txt_holding_export.rb +0 -0
- data/{lib → app}/service_adaptors/ulrichs_cover.rb +0 -0
- data/{lib → app}/service_adaptors/ulrichs_link.rb +0 -0
- data/{lib → app}/service_adaptors/worldcat.rb +0 -0
- data/{lib → app}/service_adaptors/worldcat_identities.rb +0 -0
- data/app/views/admin/service_errors/_dispatched_service.html.erb +13 -13
- data/app/views/admin/service_errors/index.html.erb +11 -21
- data/app/views/export_email/email.html.erb +17 -2
- data/app/views/export_email/send_email.html.erb +2 -1
- data/app/views/export_email/send_txt.html.erb +2 -1
- data/app/views/export_email/txt.html.erb +30 -2
- data/app/views/layouts/umlaut.html.erb +29 -49
- data/app/views/resolve/_background_progress.html.erb +43 -50
- data/app/views/resolve/_background_updater.html.erb +23 -36
- data/app/views/resolve/_citation.html.erb +63 -87
- data/app/views/resolve/_compact_citation.html.erb +15 -33
- data/app/views/resolve/_cover_image.html.erb +34 -43
- data/app/views/resolve/_fulltext.html.erb +29 -50
- data/app/views/resolve/_help.html.erb +17 -14
- data/app/views/resolve/_holding.html.erb +65 -82
- data/app/views/resolve/_manually_entered_warning.html.erb +7 -0
- data/app/views/resolve/_modal.html.erb +19 -0
- data/app/views/resolve/_related_items.html.erb +20 -35
- data/app/views/resolve/_search_inside.html.erb +34 -57
- data/app/views/resolve/_section_display.html.erb +34 -46
- data/app/views/resolve/_section_heading.html.erb +17 -0
- data/app/views/resolve/_service_errors.html.erb +27 -28
- data/app/views/resolve/_standard_response_item.html.erb +42 -72
- data/app/views/resolve/background_status.html.erb +19 -23
- data/app/views/resolve/get_permalink.html.erb +6 -0
- data/app/views/resolve/index.html.erb +47 -73
- data/app/views/search/_a_to_z.html.erb +9 -6
- data/app/views/search/_citation.html.erb +73 -94
- data/app/views/search/_pager.html.erb +6 -6
- data/app/views/search/books.html.erb +34 -102
- data/app/views/search/journal_search.html.erb +53 -90
- data/app/views/search/journals.html.erb +73 -167
- data/app/views/umlaut/_header.html.erb +9 -0
- data/app/views/umlaut/error.html.erb +44 -44
- data/config/locales/en.yml +5 -0
- data/lib/{CronTab.rb → cron_tab.rb} +0 -0
- data/lib/generators/templates/umlaut_services.yml +57 -43
- data/lib/generators/umlaut/install_generator.rb +12 -0
- data/lib/service_adaptors/README.md +0 -0
- data/lib/tasks/umlaut.rake +8 -24
- data/lib/umlaut.rb +1 -21
- data/lib/umlaut/version.rb +1 -1
- data/test/README.md +75 -0
- data/test/dummy/app/controllers/umlaut_controller.rb +3 -3
- data/test/dummy/config/application.rb +3 -0
- data/test/dummy/config/sunspot.yml +20 -0
- data/test/dummy/config/travis_database.yml +96 -0
- data/test/dummy/config/umlaut_services.yml +16 -23
- data/test/dummy/db/migrate/20120927163304_sfx4_global.rb +26 -0
- data/test/dummy/db/migrate/20120927164040_sfx4_local.rb +54 -0
- data/test/dummy/tmp/cache/assets/BBA/6A0/sprockets%2F2a335471966f33256b321f8324041981 +0 -0
- data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
- data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
- data/test/dummy/tmp/cache/assets/C49/730/sprockets%2F212d35831188417b5131e3e693aa69a6 +0 -0
- data/test/dummy/tmp/cache/assets/C55/1D0/sprockets%2F5af2f2a3403040f736981863fd278529 +0 -0
- data/test/dummy/tmp/cache/assets/C5A/A80/sprockets%2F2328c7370b56b4151776981a5f6d394e +0 -0
- data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
- data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
- data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
- data/test/dummy/tmp/cache/assets/C94/E20/sprockets%2F19579abc248373f419b1c3e287d74598 +0 -0
- data/test/dummy/tmp/cache/assets/C98/330/sprockets%2F0c81574ba94abc10657315d4190c201f +0 -0
- data/test/dummy/tmp/cache/assets/CA4/440/sprockets%2F0feb4425db6319d7d0582192a503671b +0 -0
- data/test/dummy/tmp/cache/assets/CA7/E80/sprockets%2F33310f455a870eaedd6d938e30620714 +0 -0
- data/test/dummy/tmp/cache/assets/CB8/3C0/sprockets%2F697cd846490fda9f0e20c558320610f8 +0 -0
- data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
- data/test/dummy/tmp/cache/assets/CC7/F10/sprockets%2F939637f806eef3f0f21584659458ab2e +0 -0
- data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
- data/test/dummy/tmp/cache/assets/CF8/DA0/sprockets%2Ff5b8c8499d3da954d392fa57739503c5 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/590/sprockets%2F096bcc45cd31b3796fa2121cd203215f +0 -0
- data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
- data/test/dummy/tmp/cache/assets/D04/CC0/sprockets%2Fe9c1b92f2e437e1bbbe020d718739220 +0 -0
- data/test/dummy/tmp/cache/assets/D0B/090/sprockets%2F58009091c95e3ac328c91c68fca30e0e +0 -0
- data/test/dummy/tmp/cache/assets/D1A/B50/sprockets%2F2db5892438129fe94da8429b8be114ec +0 -0
- data/test/dummy/tmp/cache/assets/D2D/1A0/sprockets%2F376426b4896a3cff7969ce6c7b387e0e +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
- data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
- data/test/dummy/tmp/cache/assets/D46/F80/sprockets%2Fb15c08e749067d7aad9baf5e9388221c +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
- data/test/dummy/tmp/cache/assets/D6E/CF0/sprockets%2F5661c6e4f0cea86fe4523f27261aade5 +0 -0
- data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
- data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
- data/test/dummy/tmp/cache/assets/D9A/2F0/sprockets%2Fbba0f4b972dc53c15ce6c8c1993b82a4 +0 -0
- data/test/dummy/tmp/cache/assets/D9C/860/sprockets%2Fec2d9f20b270d70e698ff33e53c21fca +0 -0
- data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
- data/test/dummy/tmp/cache/assets/DA8/BB0/sprockets%2F0cf1c7e9f966dce425517c0e2a844efe +0 -0
- data/test/dummy/tmp/cache/assets/DA9/BC0/sprockets%2Fcb9062b73291befe5e5bf2a70978dec8 +0 -0
- data/test/dummy/tmp/cache/assets/DB6/ED0/sprockets%2Ff4482d9b9f76fb65eef16430bde2f8e6 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
- data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
- data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
- data/test/dummy/tmp/cache/assets/E02/C10/sprockets%2F1463cadfce3fc70e61d482f9fcb75ac7 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
- data/test/dummy/tmp/cache/assets/E50/F00/sprockets%2Fec61afdbb1cc4df075e3dad46f0af571 +0 -0
- data/test/dummy/tmp/cache/assets/E5E/5F0/sprockets%2Feffaeb4d7f9bf4c0cc840ff320fde046 +0 -0
- data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_accordion.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_alerts.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_button-groups.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_carousel.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_close.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_code.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_component-animations.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_dropdowns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_hero-unit.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_labels-badges.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_layouts.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_media.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_mixins.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_modals.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_navbar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_navs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_pager.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_popovers.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_progress-bars.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_reset.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-1200px-min.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-767px-max.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-768px-979px.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-navbar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_scaffolding.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_sprites.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_tables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_thumbnails.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_tooltip.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_type.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_variables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_wells.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/bootstrap.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/responsive.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_admin.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_az.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_base.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_icons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_misc.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_mixins.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_modal.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_resolve.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_results.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_search.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_spinner.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_variables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/93d65682d6bddb0b2e6788c1232f4849af20a35e/bootstrap-responsive.scssc +0 -0
- data/test/dummy/tmp/cache/sass/93d65682d6bddb0b2e6788c1232f4849af20a35e/bootstrap.scssc +0 -0
- data/test/dummy/tmp/cache/sass/fb58c04fd15fcc38a8c4d91b7070bcfeaf1c3799/umlaut.css.scssc +0 -0
- data/test/fixtures/dispatched_services.yml +0 -4
- data/test/fixtures/permalinks.yml +23 -4
- data/test/fixtures/referent_values.yml +226 -1493
- data/test/fixtures/referents.yml +14 -137
- data/test/fixtures/requests.yml +22 -260
- data/test/fixtures/service_responses.yml +169 -5
- data/test/fixtures/sfx4/global/KB_OBJECTS.yml +46 -0
- data/test/fixtures/sfx4/local/AZ_EXTRA_INFO.yml +4802 -0
- data/test/fixtures/sfx4/local/AZ_LETTER_GROUP.yml +105 -0
- data/test/fixtures/sfx4/local/AZ_TITLE.yml +165 -0
- data/test/fixtures/sfx4/local/AZ_TITLE_SEARCH.yml +341 -0
- data/test/fixtures/sfx_urls.yml +3 -0
- data/test/functional/export_email_controller_test.rb +43 -0
- data/test/functional/link_router_controller_test.rb +16 -0
- data/test/functional/resolve_controller_test.rb +102 -0
- data/test/functional/search_controller_test.rb +40 -0
- data/test/functional/store_controller_test.rb +29 -0
- data/test/helper/list_with_limit_test.rb +90 -0
- data/test/integration/permalinks_test.rb +14 -0
- data/test/support/search_methods/test_case.rb +0 -0
- data/test/support/service_adaptors/test_case.rb +0 -0
- data/test/support/test_with_cassette.rb +37 -0
- data/test/test_helper.rb +76 -30
- data/test/unit/aws_product_sign_test.rb +2 -0
- data/test/unit/determine_services_test.rb +163 -0
- data/test/unit/google_book_search_test.rb +8 -25
- data/test/unit/google_scholar_link_test.rb +81 -0
- data/test/unit/internet_archive_test.rb +33 -0
- data/test/unit/permalink_test.rb +15 -0
- data/test/unit/service_store_test.rb +47 -0
- data/test/unit/service_test.rb +28 -13
- data/test/unit/sfx/sfx_target_roll_up_test.rb +369 -0
- data/test/unit/sfx4_search_test.rb +102 -0
- data/test/unit/sfx4_solr_search_test.rb +77 -0
- data/test/unit/sfx_test.rb +38 -0
- data/test/unit/worldcat_test.rb +7 -0
- data/test/vcr_cassettes/google_book_search/frankenstein_by_OCLC_number.yml +107 -0
- data/test/vcr_cassettes/internet_archive/momo_by_title_author.yml +116 -0
- data/test/vcr_cassettes/resolve/fulltext_with_edition_warning.yml +44 -0
- data/test/vcr_cassettes/resolve/no_holdings.yml +649 -0
- data/test/vcr_cassettes/resolve/nytimes_by_issn.yml +224 -0
- data/test/vcr_cassettes/sfx/nytimes_by_issn.yml +1395 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_group.yml +109 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_begins_with.yml +33 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_contains.yml +34 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_exact.yml +32 -0
- data/test/view/holding_test.rb +30 -0
- metadata +435 -179
- data/app/assets/images/export_bg_bot.gif +0 -0
- data/app/assets/images/export_bg_mid.gif +0 -0
- data/app/assets/images/export_bg_top.gif +0 -0
- data/app/assets/images/famfamfam/page_sound.gif +0 -0
- data/app/assets/images/famfamfam/page_text.gif +0 -0
- data/app/assets/images/famfamfam/page_up.gif +0 -0
- data/app/assets/images/ico_go.gif +0 -0
- data/app/assets/images/more_info.gif +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/images/request.gif +0 -0
- data/app/assets/javascripts/umlaut/simple_visible_toggle.js +0 -8
- data/app/assets/stylesheets/umlaut.css +0 -900
- data/app/assets/stylesheets/umlaut/_background_progress_spinner.scss +0 -21
- data/app/assets/stylesheets/umlaut/_expand_contract.scss +0 -28
- data/app/controllers/search_methods/sfx3.rb +0 -148
- data/app/models/sfx_db.rb +0 -10
- data/app/models/sfx_db/az_additional_title.rb +0 -11
- data/app/models/sfx_db/az_letter_group.rb +0 -11
- data/app/models/sfx_db/az_title.rb +0 -40
- data/app/models/sfx_db/az_title_v2.rb +0 -34
- data/app/models/sfx_db/isbn.rb +0 -12
- data/app/models/sfx_db/issn.rb +0 -12
- data/app/models/sfx_db/object.rb +0 -35
- data/app/models/sfx_db/object_portfolio.rb +0 -6
- data/app/models/sfx_db/publisher.rb +0 -10
- data/app/models/sfx_db/sfx_db_base.rb +0 -58
- data/app/models/sfx_db/target.rb +0 -10
- data/app/models/sfx_db/target_service.rb +0 -10
- data/app/models/sfx_db/title.rb +0 -10
- data/app/views/export_email/_email.html.erb +0 -25
- data/app/views/export_email/_send_email.html.erb +0 -3
- data/app/views/export_email/_send_txt.html.erb +0 -3
- data/app/views/export_email/_txt.html.erb +0 -62
- data/lib/holding.rb +0 -32
- data/lib/opensearch_feed.rb +0 -398
- data/lib/opensearch_query.rb +0 -98
- data/lib/referent_filters/dissertation_catch.rb +0 -45
- data/lib/service_adaptors/journal_tocs.progress +0 -68
- data/lib/service_adaptors/primo_service.rb +0 -452
- data/lib/service_adaptors/primo_source.rb +0 -82
- data/lib/umlaut/default_configuration.rb +0 -5
- data/test/dummy/config/primo.yml +0 -271
- data/test/unit/primo_service_test.rb +0 -947
@@ -1,53 +1,60 @@
|
|
1
1
|
# Requests to the Resolve controller are OpenURLs.
|
2
2
|
# There is one exception: Instead of an OpenURL, you can include the
|
3
3
|
# parameter umlaut.request_id=[some id] to hook up to a pre-existing
|
4
|
-
# umlaut request (that presumably was an OpenURL).
|
5
|
-
|
4
|
+
# umlaut request (that presumably was an OpenURL).
|
6
5
|
class ResolveController < UmlautController
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
6
|
before_filter :init_processing
|
7
|
+
|
12
8
|
# Init processing will look at this list, and for actions mentioned,
|
13
9
|
# will not create a @user_request if an existing one can't be found.
|
14
|
-
# Used for actions meant only to deal with existing requests.
|
10
|
+
# Used for actions meant only to deal with existing requests.
|
15
11
|
@@no_create_request_actions = ['background_update']
|
16
12
|
after_filter :save_request
|
17
|
-
|
18
|
-
layout :
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
|
14
|
+
layout :resolve_layout, :except => [:partial_html_sections]
|
15
|
+
|
22
16
|
def index
|
23
17
|
self.service_dispatch()
|
24
|
-
|
25
18
|
# check for menu skipping configuration. link is a ServiceResponse
|
26
19
|
link = should_skip_menu
|
27
|
-
if ( ! link.nil? )
|
28
|
-
|
20
|
+
if ( ! link.nil? )
|
29
21
|
redirect_to url_for(:controller => "link_router",
|
30
22
|
:action => "index",
|
31
|
-
:id => link.id )
|
23
|
+
:id => link.id )
|
32
24
|
else
|
33
|
-
# Render configed view, if configed, or default view if not.
|
25
|
+
# Render configed view, if configed, or default view if not.
|
34
26
|
render umlaut_config.resolve_view
|
35
27
|
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Return permalink for request, creating one if it doesn't already exist.
|
31
|
+
# Usually called by AJAX, to create on-demand permalink.
|
32
|
+
def get_permalink
|
33
|
+
unless current_permalink_url
|
34
|
+
permalink = Permalink.new_with_values!(@user_request.referent, @user_request.referrer_id)
|
35
|
+
@user_request.referent.permalinks << permalink
|
36
|
+
end
|
36
37
|
|
38
|
+
respond_to do |format|
|
39
|
+
format.html
|
40
|
+
format.json do
|
41
|
+
render :json => {:permalink => current_permalink_url}
|
42
|
+
end
|
43
|
+
end
|
37
44
|
end
|
38
45
|
|
39
46
|
# inputs an OpenURL request into the system and stores it, but does
|
40
|
-
# NOT actually dispatch services to provide a response. Will usually
|
47
|
+
# NOT actually dispatch services to provide a response. Will usually
|
41
48
|
# be called by software, not a human browser. Sometimes
|
42
49
|
# it's useful to do this as a first step before redirecting the user
|
43
50
|
# to the actual resolve action for the supplied request--for instance,
|
44
|
-
# when the OpenURL metadata comes in a POST and can't be redirected.
|
51
|
+
# when the OpenURL metadata comes in a POST and can't be redirected.
|
45
52
|
def register_request
|
46
53
|
# init before filter already took care of setting up the request.
|
47
54
|
@user_request.save!
|
48
55
|
|
49
56
|
# Return data in headers allowing client to redirect user
|
50
|
-
# to view actual response.
|
57
|
+
# to view actual response.
|
51
58
|
headers["x-umlaut-request_id"] = @user_request.id
|
52
59
|
headers["x-umlaut-resolve_url"] = url_for( :controller => 'resolve', 'umlaut.request_id'.to_sym => @user_request.id )
|
53
60
|
headers["x-umlaut-permalink_url"] = current_permalink_url()
|
@@ -62,26 +69,21 @@ class ResolveController < UmlautController
|
|
62
69
|
# search/journals?umlaut.display_coins=true
|
63
70
|
# or search/books?umlaut.display_coins=true
|
64
71
|
def display_coins
|
65
|
-
|
66
72
|
end
|
67
73
|
|
68
74
|
# Display a non-javascript background service status page--or
|
69
75
|
# redirect back to index if we're done.
|
70
76
|
def background_status
|
71
|
-
|
72
77
|
unless ( @user_request.any_services_in_progress? )
|
73
|
-
|
74
78
|
# Just redirect to ordinary index, no need to show progress status.
|
75
|
-
# Include request.id, but also context object kev.
|
76
|
-
|
77
|
-
params_hash =
|
79
|
+
# Include request.id, but also context object kev.
|
80
|
+
params_hash =
|
78
81
|
{:controller=>"resolve",
|
79
|
-
:action=>'index',
|
82
|
+
:action=>'index',
|
80
83
|
'umlaut.skip_resolve_menu'.to_sym => params['umlaut.skip_resolve_menu'],
|
81
84
|
'umlaut.request_id'.to_sym => @user_request.id }
|
82
|
-
|
85
|
+
|
83
86
|
url = url_for_with_co( params_hash, @user_request.to_context_object )
|
84
|
-
|
85
87
|
redirect_to( url )
|
86
88
|
else
|
87
89
|
# If we fall through, we'll show the background_status view, a non-js
|
@@ -98,127 +100,97 @@ class ResolveController < UmlautController
|
|
98
100
|
# discrete letter packets, a packet of HTML for each ServiceTypeValue?
|
99
101
|
# This does that, and also let's the caller know if background
|
100
102
|
# services are still running and should be refreshed, and gives
|
101
|
-
# the caller a URL to refresh from if neccesary.
|
102
|
-
|
103
|
+
# the caller a URL to refresh from if neccesary.
|
103
104
|
def partial_html_sections
|
104
105
|
# Tell our application_helper#url_for to generate urls with hostname
|
105
106
|
@generate_urls_with_host = true
|
106
|
-
|
107
107
|
# Force background status to be the spinner--default js way of putting
|
108
108
|
# spinner in does not generally work through ajax techniques.
|
109
109
|
@force_bg_progress_spinner = true
|
110
|
-
|
111
110
|
# Mark that we're doing a partial generation, because it might
|
112
|
-
# matter later.
|
111
|
+
# matter later.
|
113
112
|
@generating_embed_partials = true
|
114
|
-
|
115
|
-
# Run the request if neccesary.
|
113
|
+
# Run the request if neccesary.
|
116
114
|
self.service_dispatch()
|
117
115
|
@user_request.save!
|
118
|
-
|
119
116
|
self.api_render()
|
120
|
-
|
121
117
|
end
|
122
|
-
|
123
|
-
def api
|
124
118
|
|
125
|
-
|
119
|
+
def api
|
120
|
+
# Run the request if neccesary.
|
126
121
|
self.service_dispatch()
|
127
122
|
@user_request.save!
|
128
|
-
|
129
123
|
api_render()
|
130
|
-
|
131
|
-
end
|
132
|
-
|
124
|
+
end
|
133
125
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
end
|
126
|
+
def rescue_action_in_public(exception)
|
127
|
+
render(:template => "error/resolve_error", :status => 500 )
|
128
|
+
end
|
138
129
|
|
139
130
|
protected
|
140
|
-
|
141
|
-
|
142
|
-
# We intentionally use a method calculated at request-time for layout,
|
143
|
-
# so it can be changed in config at request-time.
|
144
|
-
def layout_name
|
145
|
-
umlaut_config.resolve_layout
|
146
|
-
end
|
147
131
|
|
148
|
-
|
149
|
-
# Retrives or sets up the relevant Umlaut Request, and returns it.
|
132
|
+
# Retrives or sets up the relevant Umlaut Request, and returns it.
|
150
133
|
def init_processing
|
151
134
|
# intentionally trigger creation of session if it didn't already exist
|
152
135
|
# because we need to track session ID for caching. Can't find any
|
153
136
|
# way to force session creation without setting a value in session,
|
154
|
-
# so we do this weird one.
|
137
|
+
# so we do this weird one.
|
155
138
|
session[nil] = nil
|
156
|
-
|
139
|
+
|
157
140
|
# We have to clean the params of bad char encoding bytes, or it causes
|
158
141
|
# no end of problems later. We can't just refuse to process, sources
|
159
|
-
# do send us bad bytes, I'm afraid.
|
142
|
+
# do send us bad bytes, I'm afraid.
|
160
143
|
params.values.each do |v|
|
161
144
|
EnsureValidEncoding.ensure_valid_encoding!(v, :invalid => :replace)
|
162
145
|
end
|
163
|
-
|
164
|
-
# Create an UmlautRequest object.
|
146
|
+
# Create an UmlautRequest object.
|
165
147
|
options = {}
|
166
148
|
if ( @@no_create_request_actions.include?(params[:action]) )
|
167
149
|
options[:allow_create] = false
|
168
150
|
end
|
169
151
|
@user_request ||= Request.find_or_create(params, session, request, options )
|
170
|
-
|
171
152
|
# If we chose not to create a request and still don't have one, bale out.
|
172
153
|
return unless @user_request
|
173
|
-
|
174
154
|
@user_request.save!
|
175
|
-
|
176
|
-
@collection = create_collection
|
155
|
+
@collection = create_collection
|
177
156
|
end
|
178
157
|
|
179
158
|
def save_request
|
180
159
|
@user_request.save!
|
181
160
|
end
|
182
|
-
|
183
161
|
|
184
162
|
# Based on app config and context, should we skip the resolve
|
185
163
|
# menu and deliver a 'direct' link? Returns nil if menu
|
186
164
|
# should be displayed, or the ServiceType join object
|
187
|
-
# that should be directly linked to.
|
165
|
+
# that should be directly linked to.
|
188
166
|
def should_skip_menu
|
189
167
|
# From usabilty test, do NOT skip if coming from A-Z list/journal lookup.
|
190
168
|
# First, is it over-ridden in url?
|
191
169
|
if ( params['umlaut.skip_resolve_menu'] == 'false')
|
192
170
|
return nil
|
193
|
-
elsif ( params['umlaut.skip_resolve_menu_for_type'] )
|
171
|
+
elsif ( params['umlaut.skip_resolve_menu_for_type'] )
|
194
172
|
skip = {:service_types => params['umlaut.skip_resolve_menu_for_type'].split(",") }
|
195
173
|
end
|
196
|
-
|
197
|
-
# Otherwise if not from url, load from app config
|
198
|
-
skip ||= umlaut_config.skip_resolve_menu if skip.nil?
|
199
174
|
|
175
|
+
# Otherwise if not from url, load from app config
|
176
|
+
skip ||= umlaut_config.skip_resolve_menu if skip.nil?
|
200
177
|
if (skip.kind_of?( FalseClass ))
|
201
178
|
# nope
|
202
179
|
return nil
|
203
180
|
end
|
204
|
-
|
205
181
|
return_value = nil
|
206
182
|
if (skip.kind_of?(Hash) )
|
207
183
|
# excluded rfr_ids?
|
208
184
|
exclude_rfr_ids = skip[:excluded_rfr_ids]
|
209
|
-
rfr_id = @user_request.referrer_id
|
185
|
+
rfr_id = @user_request.referrer_id
|
210
186
|
return nil if exclude_rfr_ids != nil && exclude_rfr_ids.find {|i| i == rfr_id}
|
211
|
-
|
212
187
|
# Services to skip for?
|
213
188
|
skip[:service_types].each do | service |
|
214
|
-
service = ServiceTypeValue[service] unless service.kind_of?(ServiceTypeValue)
|
215
|
-
|
216
|
-
|
217
|
-
@user_request.service_responses.find(:all,
|
189
|
+
service = ServiceTypeValue[service] unless service.kind_of?(ServiceTypeValue)
|
190
|
+
candidates =
|
191
|
+
@user_request.service_responses.find(:all,
|
218
192
|
:conditions => ["service_type_value_name = ?", service.name])
|
219
|
-
|
220
|
-
return_value = candidates.first
|
221
|
-
|
193
|
+
return_value = candidates.first
|
222
194
|
end
|
223
195
|
|
224
196
|
# But wait, make sure it's included in :services if present.
|
@@ -227,40 +199,34 @@ class ResolveController < UmlautController
|
|
227
199
|
end
|
228
200
|
elsif (skip.kind_of?(Proc ))
|
229
201
|
return_value = skip.call( :request => @user_request )
|
230
|
-
|
231
202
|
else
|
232
203
|
logger.error( "Unexpected value in config 'skip_resolve_menu'; assuming false." )
|
233
204
|
end
|
234
|
-
|
235
|
-
return return_value;
|
205
|
+
return return_value;
|
236
206
|
end
|
237
207
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
208
|
# Uses an "umlaut.response_format" param to return either
|
242
209
|
# XML or JSON(p). Is called from an action that has a standardly rendered
|
243
210
|
# Rails template that delivers XML. Will convert that standardly rendered
|
244
|
-
# template output to json using built in converters if needed.
|
245
|
-
def api_render
|
211
|
+
# template output to json using built in converters if needed.
|
212
|
+
def api_render
|
246
213
|
# Format?
|
247
214
|
request.format = "xml" if request.format.html? # weird hack to support legacy behavior, with xml as default
|
248
215
|
if params["umlaut.response_format"] == "jsonp"
|
249
216
|
request.format = "json"
|
250
|
-
params["umlaut.jsonp"] ||= "umlautLoaded"
|
217
|
+
params["umlaut.jsonp"] ||= "umlautLoaded"
|
251
218
|
elsif params["umlaut.response_format"]
|
252
219
|
request.format = params["umlaut.response_format"]
|
253
220
|
end
|
254
|
-
|
255
|
-
|
221
|
+
|
256
222
|
respond_to do |format|
|
257
|
-
format.xml do
|
223
|
+
format.xml do
|
258
224
|
render(:layout => false)
|
259
225
|
end
|
260
|
-
|
261
|
-
format.json do
|
226
|
+
|
227
|
+
format.json do
|
262
228
|
# get the xml in a string
|
263
|
-
xml_str =
|
229
|
+
xml_str =
|
264
230
|
with_format(:xml) do
|
265
231
|
render_to_string(:layout=>false)
|
266
232
|
end
|
@@ -271,19 +237,14 @@ class ResolveController < UmlautController
|
|
271
237
|
data_as_hash = Hash.from_xml( xml_str.to_str )
|
272
238
|
# And conver to json. Ta-da!
|
273
239
|
json_str = data_as_hash.to_json
|
274
|
-
|
275
240
|
# Handle jsonp, deliver JSON inside a javascript function call,
|
276
|
-
# with function name specified in parameters.
|
277
|
-
render(:json => json_str, :callback => params["umlaut.jsonp"] )
|
278
|
-
end
|
241
|
+
# with function name specified in parameters.
|
242
|
+
render(:json => json_str, :callback => params["umlaut.jsonp"] )
|
243
|
+
end
|
279
244
|
end
|
280
245
|
end
|
281
246
|
|
282
247
|
def service_dispatch()
|
283
248
|
@collection.dispatch_services!
|
284
249
|
end
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
end
|
289
|
-
|
250
|
+
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# It does NOT take URL in request parameters, but instead takes a response ID.
|
6
6
|
# it will only proxy urls already stored in umlaut responses, so this is not
|
7
|
-
# an open proxy with the security problems that would cause.
|
7
|
+
# an open proxy with the security problems that would cause.
|
8
8
|
class ResourceController < UmlautController
|
9
9
|
require 'open-uri'
|
10
10
|
|
@@ -13,9 +13,9 @@ class ResourceController < UmlautController
|
|
13
13
|
# render :text=>proc, problem is we needed to know the content-type before
|
14
14
|
# we read any of the response, which we didn't. This implementation holds
|
15
15
|
# the whole image in memory for a second while it delivers it, oh well.
|
16
|
-
# doesn't seem to effect speed much, even though it's not optimal.
|
16
|
+
# doesn't seem to effect speed much, even though it's not optimal.
|
17
17
|
def proxy
|
18
|
-
svc_resp = ServiceResponse.find(params[:id])
|
18
|
+
svc_resp = ServiceResponse.find(params[:id])
|
19
19
|
url_str = svc_resp.view_data[:url]
|
20
20
|
uri = nil
|
21
21
|
begin
|
@@ -27,17 +27,16 @@ class ResourceController < UmlautController
|
|
27
27
|
proxied_headers = proxy_headers( request, uri.host )
|
28
28
|
remote_response = open(uri, 'rb', proxied_headers)
|
29
29
|
|
30
|
-
# copy certain headers to our proxied response
|
30
|
+
# copy certain headers to our proxied response
|
31
31
|
["Content-Type", "Cache-Control", "Expires", "Content-Length", "Last-Modified", "Etag", "Date"].each do |key|
|
32
32
|
value = remote_response.meta[key.downcase] # for some reason open-uri lowercases em
|
33
|
-
# rack doens't like it if we set a nil value here.
|
33
|
+
# rack doens't like it if we set a nil value here.
|
34
34
|
response.headers[key] = value unless value.blank?
|
35
35
|
end
|
36
36
|
response.headers["X-Original-Url"] = url_str
|
37
|
-
|
37
|
+
|
38
38
|
# And send the actual result out
|
39
39
|
render(:text => remote_response.read)
|
40
|
-
|
41
40
|
end
|
42
41
|
|
43
42
|
protected
|
@@ -49,11 +48,8 @@ class ResourceController < UmlautController
|
|
49
48
|
# TODO should refactor to DRY.
|
50
49
|
# Argument here is a Rails Request
|
51
50
|
def proxy_headers( request, host )
|
52
|
-
orig_env = request.headers
|
53
|
-
|
51
|
+
orig_env = request.headers
|
54
52
|
header = {}
|
55
|
-
|
56
|
-
|
57
53
|
header["User-Agent"] = orig_env['HTTP_USER_AGENT'] || 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0'
|
58
54
|
header['Accept'] = orig_env['HTTP_ACCEPT'] || 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
|
59
55
|
header['Accept-Language'] = orig_env['HTTP_ACCEPT_LANGUAGE'] || 'en-us,en;q=0.5'
|
@@ -61,25 +57,23 @@ class ResourceController < UmlautController
|
|
61
57
|
header["Accept-Charset"] = orig_env['HTTP_ACCEPT_CHARSET'] || 'UTF-8,*'
|
62
58
|
|
63
59
|
# Set referrer to be, well, an Umlaut page, like the one we are
|
64
|
-
# currently generating would be best. That is, the resolve link.
|
65
|
-
|
60
|
+
# currently generating would be best. That is, the resolve link.
|
66
61
|
header["Referer"] = "http://#{orig_env['HTTP_HOST']}#{orig_env['REQUEST_URI']}"
|
67
62
|
|
68
|
-
# Proxy X-Forwarded headers.
|
63
|
+
# Proxy X-Forwarded headers.
|
69
64
|
|
70
65
|
# The original Client's ip, most important and honest. Look for
|
71
66
|
# and add on to any existing x-forwarded-for, if neccesary, as per
|
72
|
-
# x-forwarded-for convention.
|
67
|
+
# x-forwarded-for convention.
|
73
68
|
header['X-Forwarded-For'] = (orig_env['HTTP_X_FORWARDED_FOR']) ?
|
74
69
|
(orig_env['HTTP_X_FORWARDED_FOR'].to_s + ', ' + request.remote_ip.to_s) :
|
75
70
|
request.remote_ip.to_s
|
76
|
-
|
77
|
-
#Theoretically the original host requested by the client in the Host HTTP request header. We're disembling a bit.
|
71
|
+
|
72
|
+
#Theoretically the original host requested by the client in the Host HTTP request header. We're disembling a bit.
|
78
73
|
header['X-Forwarded-Host'] = host if host
|
79
|
-
# The proxy server: That is, Umlaut, us.
|
74
|
+
# The proxy server: That is, Umlaut, us.
|
80
75
|
header['X-Forwarded-Server'] = orig_env['SERVER_NAME'] || ''
|
81
76
|
|
82
77
|
return header
|
83
78
|
end
|
84
|
-
|
85
|
-
end
|
79
|
+
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
# The search controller handles searches fo manually entered citations,
|
2
2
|
# or possibly ambiguous citations generally. It also provides an A-Z list.
|
3
3
|
#
|
4
|
-
# As a source of this data, it generally talks to the SFX database directly.
|
4
|
+
# As a source of this data, it generally talks to the SFX database directly.
|
5
5
|
# The particular method it uses to get this data is defined in a SearchMethod
|
6
6
|
# module (app/controllers/search_methods), that gets applied to the controller.
|
7
|
-
# Currently
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
7
|
+
# Currently Sfx4 direct database and Sfx4Solr (SFX indexed in Solr via Sunspot)
|
8
|
+
# are supported.
|
9
|
+
# In either case with database connection info in your database.yml file under
|
10
|
+
# sfx_db.
|
11
|
+
#
|
12
|
+
# Future plans include a local database of titles, perhaps loaded from an
|
12
13
|
# external KB. Not done yet.
|
13
14
|
#
|
14
15
|
# = SearchMethod module implementation
|
@@ -19,64 +20,59 @@
|
|
19
20
|
# #sfx_az_profile, #title_query_param, #search_type_param, #batch_size and
|
20
21
|
# #page to return state. Returns a two-element array pair, first element
|
21
22
|
# is a list of OpenURL::ContextObject for current batch, send element
|
22
|
-
# is int total hit count.
|
23
|
+
# is int total hit count.
|
23
24
|
# [#find_by_group]
|
24
25
|
# Used for clicks on "A", "B" ... "0-9", "Other" links. Find the group
|
25
26
|
# link clicked on in params[:id]. Use #batch_size and #page for paging.
|
26
27
|
# As in #find_by_title, return two element array, first elememt is array
|
27
|
-
# of OpenURL::ContextObject, second element is total hit count.
|
28
|
+
# of OpenURL::ContextObject, second element is total hit count.
|
28
29
|
class SearchController < UmlautController
|
29
30
|
@@search_batch_size = 20
|
30
31
|
@@az_batch_size = 20
|
31
32
|
@@autocomplete_limit = 15
|
32
|
-
|
33
|
+
|
33
34
|
layout :layout_name, :except => [ :opensearch, :opensearch_description ]
|
34
35
|
|
35
36
|
before_filter :normalize_params
|
36
|
-
|
37
|
+
|
37
38
|
def initialize(*params)
|
38
39
|
super(*params)
|
39
|
-
|
40
|
-
self.extend( search_method_module )
|
40
|
+
self.extend( search_method_module )
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def index
|
44
|
-
@page_title = "Journals"
|
45
|
-
journals()
|
46
|
-
end
|
47
|
-
|
44
|
+
@page_title = "Journals"
|
45
|
+
journals()
|
46
|
+
end
|
47
|
+
|
48
48
|
def journals
|
49
49
|
@submit_hash = params["umlaut.display_coins"] ? {:controller=>'resolve', :action=>'display_coins'} : {:controller=>'search', :action=>'journal_search'}
|
50
50
|
|
51
|
-
# Render configed view, if configed, or default
|
51
|
+
# Render configed view, if configed, or default
|
52
52
|
render umlaut_config.lookup!("search_view", "journals")
|
53
53
|
end
|
54
54
|
|
55
|
-
# Not sure if this action actually works or does anything at present.
|
55
|
+
# Not sure if this action actually works or does anything at present.
|
56
56
|
def books
|
57
57
|
@submit_action = params["umlaut.display_coins"] ? "display_coins" : "index"
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
60
|
# @display_results is left as an array of ContextObject objects.
|
62
61
|
# Or, redirect to resolve action for single hit.
|
63
62
|
# O hit also redirects to resolve action, as per SFX behavior--this
|
64
|
-
# gives a catalog lookup and an ILL form for 0-hit.
|
65
|
-
# param umlaut.title_search_type (aka sfx.title_search)
|
63
|
+
# gives a catalog lookup and an ILL form for 0-hit.
|
64
|
+
# param umlaut.title_search_type (aka sfx.title_search)
|
66
65
|
# can be 'begins', 'exact', or 'contains'. Other
|
67
66
|
# form params should be OpenURL, generally
|
68
67
|
def journal_search
|
69
68
|
@batch_size = batch_size
|
70
69
|
@start_result_num = (page * batch_size) - (batch_size - 1)
|
71
|
-
|
72
70
|
@search_context_object = context_object_from_params
|
73
|
-
|
74
71
|
if (! params["rft.object_id"].blank? ||
|
75
72
|
! params["rft.issn"].blank? ||
|
76
73
|
! params["rft_id"].blank? )
|
77
74
|
# If we have an exact-type 'search', just switch to 'resolve' action
|
78
|
-
redirect_to url_for_with_co( {:controller => 'resolve'}, context_object_from_params )
|
79
|
-
|
75
|
+
redirect_to url_for_with_co( {:controller => 'resolve'}, context_object_from_params )
|
80
76
|
# don't do anything else.
|
81
77
|
return
|
82
78
|
elsif (params['rft.jtitle'].blank?)
|
@@ -86,56 +82,50 @@ class SearchController < UmlautController
|
|
86
82
|
redirect_to :controller=>:search, :action=>:index
|
87
83
|
return
|
88
84
|
end
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
|
92
86
|
# Call our particular search method, #find_by_title added by search
|
93
|
-
# method module.
|
87
|
+
# method module.
|
94
88
|
(@display_results, @hits) = self.find_by_title
|
95
89
|
#find_by_title_via_sfx_db
|
96
|
-
|
90
|
+
|
97
91
|
# Calculate end-result number for display
|
98
92
|
@end_result_num = @start_result_num + batch_size - 1
|
99
93
|
if @end_result_num > @hits
|
100
94
|
@end_result_num = @hits
|
101
95
|
end
|
102
|
-
|
96
|
+
|
103
97
|
if (@page == 1) && (@display_results.length == 1)
|
104
98
|
# If we narrowed down to one result redirect
|
105
99
|
# to resolve action.
|
106
|
-
redirect_to( url_for_with_co({:controller => 'resolve'}, @display_results[0]) )
|
100
|
+
redirect_to( url_for_with_co({:controller => 'resolve'}, @display_results[0]) )
|
107
101
|
elsif (@display_results.length == 0)
|
108
102
|
# 0 hits, do it too.
|
109
103
|
redirect_to( url_for_with_co({:controller => 'resolve'}, @search_context_object) )
|
110
104
|
end
|
111
|
-
|
105
|
+
@page_title = 'Journal titles that '
|
106
|
+
@page_title +=
|
107
|
+
(params["umlaut.title_search_type"] == "begins") ?
|
108
|
+
'begin with ' : 'contain '
|
109
|
+
@page_title += "'" + params['rft.jtitle'] + "'"
|
112
110
|
end
|
113
111
|
|
114
|
-
|
115
|
-
# Used for browse-by-letter
|
112
|
+
# Used for browse-by-letter
|
116
113
|
def journal_list
|
117
114
|
@batch_size = batch_size
|
118
|
-
@page = page
|
115
|
+
@page = page
|
119
116
|
@start_result_num = (@page * @batch_size) - (@batch_size - 1)
|
120
|
-
|
121
|
-
|
122
|
-
(@display_results, @hits) = find_by_group
|
123
|
-
|
124
|
-
|
117
|
+
(@display_results, @hits) = find_by_group
|
125
118
|
# Calculate end-result number for display
|
126
119
|
@end_result_num = @start_result_num + @batch_size - 1
|
127
120
|
if @end_result_num > @hits
|
128
121
|
@end_result_num = @hits
|
129
122
|
end
|
130
|
-
|
123
|
+
# TODO: Make page titles configurable
|
124
|
+
@page_title = "Browse by Journal Title: #{params['id']}"
|
131
125
|
# Use our ordinary search displayer to display
|
132
126
|
# It'll notice the action and do just a bit of special stuff.
|
133
127
|
render(:template => "search/journal_search")
|
134
|
-
end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
128
|
+
end
|
139
129
|
|
140
130
|
# Should return an array of hashes, with each has having :title and :object_id
|
141
131
|
# keys. Can come from local journal index or SFX or somewhere else.
|
@@ -145,35 +135,35 @@ class SearchController < UmlautController
|
|
145
135
|
# Don't search on blank query.
|
146
136
|
query = params['rft.jtitle']
|
147
137
|
search_type = params["umlaut.title_search_type"] || "contains"
|
148
|
-
unless ( query.blank? )
|
138
|
+
unless ( query.blank? )
|
149
139
|
(context_objects, total_count) = find_by_title
|
150
|
-
@titles = context_objects.collect do |co|
|
140
|
+
@titles = context_objects.collect do |co|
|
151
141
|
metadata = co.referent.metadata
|
152
142
|
{:object_id => metadata["object_id"], :title => (metadata["jtitle"] || metadata["btitle"] || metadata["title"])}
|
153
143
|
end
|
154
144
|
end
|
155
|
-
render :text => @titles.to_json, :content_type => "application/json"
|
156
|
-
end
|
157
|
-
|
145
|
+
render :text => @titles.to_json, :content_type => "application/json"
|
146
|
+
end
|
147
|
+
|
158
148
|
def opensearch_description
|
159
|
-
@headers['Content-Type'] = 'application/opensearchdescription+xml'
|
149
|
+
@headers['Content-Type'] = 'application/opensearchdescription+xml'
|
160
150
|
end
|
161
151
|
|
162
152
|
protected
|
163
153
|
|
164
154
|
# We intentionally use a method calculated at request-time for layout,
|
165
|
-
# so it can be changed in config at request-time.
|
155
|
+
# so it can be changed in config at request-time.
|
166
156
|
def layout_name
|
167
157
|
umlaut_config.search_layout
|
168
158
|
end
|
169
159
|
|
170
160
|
def normalize_params
|
171
|
-
# citation search params
|
172
|
-
|
161
|
+
# citation search params
|
162
|
+
|
173
163
|
# sfx.title_search and umlaut.title_search_type are synonyms
|
174
164
|
params["sfx.title_search"] = params["umlaut.title_search_type"] if params["sfx.title_search"].blank?
|
175
165
|
params["umlaut.title_search_type"] = params["sfx.title_search"] if params["umlaut.title_search_type"].blank?
|
176
|
-
|
166
|
+
|
177
167
|
# Likewise, params[:journal][:title] is legacy params['rft.jtitle']
|
178
168
|
unless (params[:journal].blank? || params[:journal][:title].blank? ||
|
179
169
|
! params['rft.jtitle'].blank? )
|
@@ -186,11 +176,10 @@ class SearchController < UmlautController
|
|
186
176
|
params[:journal][:title] = params['rft.jtitle']
|
187
177
|
end
|
188
178
|
|
189
|
-
|
190
179
|
# Grab identifiers out of the way we've encoded em
|
191
180
|
# Accept legacy SFX-style encodings too
|
192
181
|
if ( ! params['rft_id_value'].blank? ||
|
193
|
-
! params['pmid_value'].blank? ||
|
182
|
+
! params['pmid_value'].blank? ||
|
194
183
|
! params['doi_value'].blank? )
|
195
184
|
|
196
185
|
if (! params['rft_id_value'].blank?)
|
@@ -203,15 +192,15 @@ class SearchController < UmlautController
|
|
203
192
|
id_type = params['doi_id'] || 'doi'
|
204
193
|
id_value = params['doi_value']
|
205
194
|
end
|
206
|
-
|
195
|
+
|
207
196
|
params['rft_id'] = "info:#{id_type}/#{id_value}"
|
208
197
|
end
|
209
198
|
|
210
199
|
# SFX v2 A-Z list url format---convert to Umlaut
|
211
200
|
if params[:letter_group]
|
212
|
-
params[:id] = case params[:letter_group].to_i
|
201
|
+
params[:id] = case params[:letter_group].to_i
|
213
202
|
when 1 then '0-9'
|
214
|
-
# 2-27 mean A-Z, convert via ASCII value arithmetic.
|
203
|
+
# 2-27 mean A-Z, convert via ASCII value arithmetic.
|
215
204
|
when 2..27 then ((params[:letter_group].to_i) +63 ).chr
|
216
205
|
when 28 then 'Others'
|
217
206
|
end
|
@@ -224,21 +213,21 @@ class SearchController < UmlautController
|
|
224
213
|
when /^0/ then '0-9'
|
225
214
|
when 'Others' then 'Other'
|
226
215
|
else params[:param_letter_group_value]
|
227
|
-
end
|
216
|
+
end
|
228
217
|
end
|
229
218
|
|
230
219
|
# Normalize request for 'Others'
|
231
|
-
if params[:id] =~ /^other/i
|
220
|
+
if params[:id] =~ /^other/i
|
232
221
|
params[:id] = 'Others'
|
233
222
|
end
|
234
|
-
|
223
|
+
|
235
224
|
# for reasons I can't tell, our JS on IE ends up putting some
|
236
225
|
# newlines in the object_id, which messes us all up.
|
237
226
|
params['rft.object_id'].strip! if params['rft.object_id']
|
238
227
|
|
239
228
|
## If needed combine date elements to an OpenURL date
|
240
|
-
unless (params["__year"].blank? &&
|
241
|
-
params["__month"].blank? &&
|
229
|
+
unless (params["__year"].blank? &&
|
230
|
+
params["__month"].blank? &&
|
242
231
|
params["__day"].blank?)
|
243
232
|
isoDate = ""
|
244
233
|
unless ["", "****", "Year"].include?(params["__year"])
|
@@ -254,35 +243,34 @@ class SearchController < UmlautController
|
|
254
243
|
params["date"] = isoDate
|
255
244
|
end
|
256
245
|
end
|
257
|
-
|
258
246
|
end
|
259
247
|
|
260
248
|
def context_object_from_params
|
261
|
-
@context_object_from_params ||=
|
249
|
+
@context_object_from_params ||=
|
262
250
|
begin
|
263
|
-
params_c = params.clone
|
264
|
-
|
251
|
+
params_c = params.clone
|
252
|
+
|
265
253
|
# Take out the weird ones that aren't really part of the OpenURL
|
266
254
|
ignored_keys = [:journal, "utf8", "__year", "__month", "__day", "action", "controller", "Generate_OpenURL2", "rft_id_type", "rft_id_value"]
|
267
255
|
ignored_keys.each { |k| params_c.delete(k) }
|
268
|
-
|
256
|
+
|
269
257
|
# Normalize ISSN to have dash
|
270
258
|
if ( ! params['rft.issn'].blank? && params['rft.issn'][4,1] != '-' && params['rft.issn'].length >= 4)
|
271
259
|
params['rft.issn'].insert(4,'-')
|
272
260
|
end
|
273
|
-
|
261
|
+
|
274
262
|
ctx = OpenURL::ContextObject.new
|
275
263
|
# Make sure it uses a journal type referent please, that's what we've
|
276
264
|
# got here.
|
277
265
|
ctx.referent = OpenURL::ContextObjectEntity.new_from_format( 'info:ofi/fmt:xml:xsd:journal' )
|
278
266
|
ctx.import_hash( params_c )
|
279
|
-
|
267
|
+
|
280
268
|
# Not sure where ":rft_id_value" as opposed to 'rft_id' comes from, but
|
281
269
|
# it was in old code. We do it after CO creation to handle multiple
|
282
270
|
# identifiers
|
283
271
|
if (! params_c[:rft_id_value].blank?)
|
284
272
|
ctx.referent.add_identifier( params_c[:rft_id_value] )
|
285
|
-
end
|
273
|
+
end
|
286
274
|
ctx
|
287
275
|
end
|
288
276
|
end
|
@@ -290,28 +278,28 @@ class SearchController < UmlautController
|
|
290
278
|
def search_method_module
|
291
279
|
umlaut_config.lookup!("search.az_search_method", SearchMethods::Sfx4)
|
292
280
|
end
|
293
|
-
|
281
|
+
|
294
282
|
# sfx a-z profile as defined in config, used for direct db connections
|
295
|
-
# to sfx.
|
283
|
+
# to sfx.
|
296
284
|
def sfx_az_profile
|
297
285
|
umlaut_config.lookup!("search.sfx_az_profile", "default")
|
298
286
|
end
|
299
287
|
helper_method :sfx_az_profile
|
300
|
-
|
301
|
-
def title_query_param
|
288
|
+
|
289
|
+
def title_query_param
|
302
290
|
params['rft.jtitle']
|
303
291
|
end
|
304
292
|
helper_method :title_query_param
|
305
|
-
|
293
|
+
|
306
294
|
def search_type_param
|
307
295
|
params['umlaut.title_search_type'] || 'contains'
|
308
296
|
end
|
309
297
|
helper_method :search_type_param
|
310
|
-
|
298
|
+
|
311
299
|
def batch_size
|
312
300
|
case params[:action]
|
313
301
|
when "journal_list"
|
314
|
-
@@az_batch_size
|
302
|
+
@@az_batch_size
|
315
303
|
when "auto_complete_for_journal_title"
|
316
304
|
@@autocomplete_limit
|
317
305
|
else
|
@@ -319,16 +307,9 @@ class SearchController < UmlautController
|
|
319
307
|
end
|
320
308
|
end
|
321
309
|
helper_method :batch_size
|
322
|
-
|
310
|
+
|
323
311
|
def page
|
324
|
-
@page ||= params['page'].blank? ? 1 : params['page'].to_i
|
312
|
+
@page ||= params['page'].blank? ? 1 : params['page'].to_i
|
325
313
|
end
|
326
|
-
helper_method :page
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
end
|
314
|
+
helper_method :page
|
315
|
+
end
|