-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.rb
24 lines (23 loc) · 1023 Bytes
/
search.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module TelnetOPAC
class Search
def Search.title(screen, backend)
inputbox = screen.new_inputbox("TITLE Search", "Enter title of book to search for below.")
search = inputbox.get_entry
waitbox = screen.new_messagebox "Retrieving catalog results, please wait..."
waitbox.show
results = backend.biblio_search search, :title
waitbox.hide
result_list = screen.new_infolist("Your Search: #{search}", 2)
result_list.left_heading = "AUTHOR/TITLE"
result_list.right_heading = "DATE"
results.each do |result|
author = result[:author]
author += ", #{result[:author_dates]}" if result[:author_dates]
publication_date = result[:publication_date] ? result[:publication_date].gsub(/[^0-9]/, "") : ""
result_list.add_item [[result[:author], publication_date], [result[:title], ""]]
end
response = result_list.get_response
Display.holdings(screen, results[response][:title], results[response][:holdings])
end
end
end