Class: CatalogController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CatalogController
- Includes:
- Blacklight::CatalogHelper, Blacklight::SolrHelper, Hydra::AccessControlsEnforcement, Hydra::AssetsControllerHelper, Hydra::RepositoryController
- Defined in:
- app/controllers/catalog_controller.rb,
vendor/plugins/blacklight/app/controllers/catalog_controller.rb,
vendor/plugins/hydra_repository/app/controllers/catalog_controller.rb
Constant Summary
Constants included from Blacklight::SolrHelper
Instance Method Summary (collapse)
-
- (Object) availability
single document availability info.
-
- (Object) citation
citation action.
- - (Object) edit
-
- (Object) email
Email Action (this will only be accessed when the Email link is clicked by a non javascript browser).
-
- (Object) endnote
grabs a bunch of documents to export to endnote.
-
- (Object) facet
displays values and pagination links for a single facet field.
-
- (Object) image
single document image resource.
-
- (Object) index
get search results from the solr index.
- - (Object) librarian_view
-
- (Object) map
collection/search UI via Google maps.
-
- (Object) opensearch
method to serve up XML OpenSearch description and JSON autocomplete response.
-
- (Object) send_email_record
action for sending email.
- - (Object) show_with_customizations (also: #show)
-
- (Object) sms
SMS action (this will only be accessed when the SMS link is clicked by a non javascript browser).
-
- (Object) status
single document availability status (true/false).
-
- (Object) update
updates the search counter (allows the show view to paginate).
Methods included from Hydra::RepositoryController
#downloadables, included, #solr_name
Methods included from MediaShelf::ActiveFedoraHelper
#load_af_instance_from_solr, #retrieve_af_model
Methods included from Blacklight::SolrHelper
#facet_limit_for, #facet_limit_hash, #get_facet_pagination, #get_opensearch_response, #get_search_results, #get_solr_response_for_doc_id, #get_solr_response_for_field_values, included, #max_per_page, #solr_doc_params, #solr_facet_params, #solr_opensearch_params, #solr_param_quote, #solr_search_params
Methods included from Hydra::AssetsControllerHelper
#apply_depositor_metadata, #prep_updater_method_args, #set_collection_type
Methods inherited from ApplicationController
#current_user, #default_html_head, #error, #extra_head_content, #javascript_includes, #stylesheet_links, #user_class
Methods included from HydraAccessControlsHelper
#editor?, #reader?, #test_permission
Instance Method Details
- (Object) availability
single document availability info
73 74 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 73 def availability end |
- (Object) citation
citation action
93 94 95 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 93 def citation @response, @documents = get_solr_response_for_field_values("id",params[:id]) end |
- (Object) edit
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'vendor/plugins/hydra_repository/app/controllers/catalog_controller.rb', line 9 def edit af_base = ActiveFedora::Base.load_instance(params[:id]) the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first if the_model.nil? the_model = DcDocument end @document_fedora = the_model.load_instance(params[:id]) #fedora_object = ActiveFedora::Base.load_instance(params[:id]) #params[:action] = "edit" #@downloadables = downloadables( @document_fedora ) show_without_customizations end |
- (Object) email
Email Action (this will only be accessed when the Email link is clicked by a non javascript browser)
97 98 99 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 97 def email @response, @documents = get_solr_response_for_field_values("id",params[:id]) end |
- (Object) endnote
grabs a bunch of documents to export to endnote
105 106 107 108 109 110 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 105 def endnote @response, @documents = get_solr_response_for_field_values("id",params[:id]) respond_to do |format| format.endnote end end |
- (Object) facet
displays values and pagination links for a single facet field
60 61 62 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 60 def facet @pagination = get_facet_pagination(params[:id], params) end |
- (Object) image
single document image resource
65 66 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 65 def image end |
- (Object) index
get search results from the solr index
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 22 def index @extra_controller_params ||= {} # The query lucene query builder should take care of the perms now. #if current_user.nil? # enforce_search_permissions #end (@response, @document_list) = get_search_results( @extra_controller_params.merge!(:q=>build_lucene_query(params[:q])) ) @filters = params[:f] || [] respond_to do |format| format.html { save_current_search_params } format.rss { render :layout => false } end rescue RSolr::RequestError logger.error("Unparseable search error: #{params.inspect}" ) flash[:notice] = "Sorry, I don't understand your search." redirect_to :action => 'index', :q => nil , :f => nil rescue logger.error("Unknown error: #{params.inspect}" ) flash[:notice] = "Sorry, you've encountered an error. Try a different search." redirect_to :action => 'index', :q => nil , :f => nil end |
- (Object) librarian_view
112 113 114 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 112 def librarian_view @response, @document = get_solr_response_for_doc_id end |
- (Object) map
collection/search UI via Google maps
77 78 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 77 def map end |
- (Object) opensearch
method to serve up XML OpenSearch description and JSON autocomplete response
81 82 83 84 85 86 87 88 89 90 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 81 def opensearch respond_to do |format| format.xml do render :layout => false end format.json do render :json => get_opensearch_response end end end |
- (Object) send_email_record
action for sending email. This is meant to post from the form and to do processing
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 117 def send_email_record @response, @documents = get_solr_response_for_field_values("id",params[:id]) if params[:to] from = request.host # host w/o port for From address (from address cannot have port#) host = request.host host << ":#{request.port}" unless request.port.nil? # host w/ port for linking case params[:style] when 'sms' if !params[:carrier].blank? if params[:to].length != 10 flash[:error] = "You must enter a valid 10 digit phone number" else email = RecordMailer.create_sms_record(@documents, {:to => params[:to], :carrier => params[:carrier]}, from, host) end else flash[:error] = "You must select a carrier" end when 'email' if params[:to].match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/) email = RecordMailer.create_email_record(@documents, {:to => params[:to], :message => params[:message]}, from, host) else flash[:error] = "You must enter a valid email address" end end RecordMailer.deliver(email) unless flash[:error] if @documents.size == 1 redirect_to catalog_path(@documents.first[:id]) else redirect_to folder_index_path end else flash[:error] = "You must enter a recipient in order to send this message" end end |
- (Object) show_with_customizations Also known as: show
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'vendor/plugins/hydra_repository/app/controllers/catalog_controller.rb', line 47 def show_with_customizations show_without_customizations enforce_viewing_context_for_show_requests af_base = ActiveFedora::Base.load_instance(params[:id]) the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first if the_model.nil? the_model = DcDocument end @document_fedora = the_model.load_instance(params[:id]) params = {:qt=>"dismax",:q=>"*:*",:rows=>"0",:facet=>"true", :facets=>{:fields=>Blacklight.config[:facet][:field_names]}} @facet_lookup = Blacklight.solr.find params end |
- (Object) sms
SMS action (this will only be accessed when the SMS link is clicked by a non javascript browser)
101 102 103 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 101 def sms @response, @documents = get_solr_response_for_field_values("id",params[:id]) end |
- (Object) status
single document availability status (true/false)
69 70 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 69 def status end |
- (Object) update
updates the search counter (allows the show view to paginate)
54 55 56 57 |
# File 'vendor/plugins/blacklight/app/controllers/catalog_controller.rb', line 54 def update session[:search][:counter] = params[:counter] redirect_to :action => "show" end |