umlaut 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/app/assets/javascripts/umlaut/ajax_windows.js.coffee +23 -0
- data/app/controllers/export_email_controller.rb +37 -68
- data/app/controllers/search_controller.rb +2 -2
- data/app/helpers/export_email_helper.rb +13 -9
- data/app/models/referent_value.rb +1 -0
- data/app/models/sfx_db/az_title.rb +9 -7
- data/app/models/sfx_db/target.rb +3 -2
- data/app/views/export_email/_email.html.erb +1 -1
- data/app/views/export_email/_txt.html.erb +1 -1
- data/lib/service_adaptors/primo_source.rb +1 -1
- data/lib/umlaut/version.rb +1 -1
- metadata +5 -7
- data/app/assets/javascripts/umlaut/ajax_windows.js +0 -35
- data/test/integration/permalinks_test.rb +0 -19
data/README.md
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# ajax_windows.js. Support for modal popup windows in Umlaut items.
|
2
|
+
$ ->
|
3
|
+
shared_modal_d = $("<div></div>").dialog({autoOpen: false, modal: true, width: "400px"})
|
4
|
+
$("a.ajax_window").live "click", (event)->
|
5
|
+
$(shared_modal_d).load this.href, ->
|
6
|
+
heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
|
7
|
+
$(shared_modal_d).dialog "option", "title", heading.text()
|
8
|
+
$(shared_modal_d).dialog "open"
|
9
|
+
false
|
10
|
+
|
11
|
+
ajax_form_catch = (event) ->
|
12
|
+
$(shared_modal_d).load $(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), ->
|
13
|
+
heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove()
|
14
|
+
$(shared_modal_d).dialog "option", "title", heading.text()
|
15
|
+
$(shared_modal_d).dialog "open"
|
16
|
+
return false;
|
17
|
+
|
18
|
+
# # Trapping two events, click on the submit button or submit on the form
|
19
|
+
# # is strangely needed in IE7 to trap both return-in-field submits
|
20
|
+
# # and click-on-button submits. In FF just the second "submit" version
|
21
|
+
# # is sufficient.
|
22
|
+
$("form.modal_dialog_form input[type=submit]").live "click", ajax_form_catch
|
23
|
+
$("form.modal_dialog_form").live "submit", ajax_form_catch
|
@@ -2,11 +2,10 @@ class ExportEmailController < UmlautController
|
|
2
2
|
|
3
3
|
before_filter :load_objects
|
4
4
|
layout Proc.new { |controller|
|
5
|
-
if (controller.request.xhr? ||
|
6
|
-
controller.params["X-Requested-With"] == "XmlHttpRequest")
|
5
|
+
if (controller.request.xhr? || controller.params["X-Requested-With"] == "XmlHttpRequest")
|
7
6
|
nil
|
8
7
|
else
|
9
|
-
|
8
|
+
umlaut_config.layout
|
10
9
|
end
|
11
10
|
}
|
12
11
|
|
@@ -16,108 +15,78 @@ class ExportEmailController < UmlautController
|
|
16
15
|
end
|
17
16
|
|
18
17
|
def email
|
19
|
-
|
20
18
|
end
|
21
19
|
|
22
20
|
def txt
|
23
|
-
|
24
21
|
end
|
25
22
|
|
26
23
|
def send_email
|
27
24
|
@email = params[:email]
|
28
25
|
@fulltexts = @user_request.get_service_type('fulltext', { :refresh=>true })
|
29
26
|
@holdings = @user_request.get_service_type('holding', { :refresh=>true })
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
format.html { render }
|
35
|
-
end
|
36
|
-
else
|
37
|
-
@partial = "email"
|
38
|
-
flash[:error] = email_validation_error
|
39
|
-
redirect_to params_preserve_xhr(params.merge(:action => "email"))
|
27
|
+
if valid_email?
|
28
|
+
Emailer.citation(@email, @user_request, @fulltexts, @holdings).deliver
|
29
|
+
respond_to do |format|
|
30
|
+
format.html { render }
|
40
31
|
end
|
41
|
-
|
32
|
+
else
|
33
|
+
@partial = "email"
|
34
|
+
flash[:error] = email_validation_error
|
35
|
+
redirect_to params_preserve_xhr(params.merge(:action => "email"))
|
36
|
+
end
|
42
37
|
end
|
43
38
|
|
44
39
|
def send_txt
|
45
40
|
@number = params[:number]
|
46
41
|
# Remove any punctuation or spaces etc
|
47
42
|
@number.gsub!(/[^\d]/, '') if @number
|
48
|
-
|
49
|
-
|
50
43
|
@provider = params[:provider]
|
51
|
-
|
52
44
|
@email = "#{@number}@#{@provider}" unless @number.nil? or @provider.nil?
|
53
|
-
|
54
45
|
@holding_id = params[:holding]
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
redirect_to params_preserve_xhr(params.merge(:action => "txt"))
|
63
|
-
end
|
46
|
+
if valid_txt_number? && valid_txt_holding?
|
47
|
+
Emailer.short_citation(@email, @user_request, holding_location(@holding_id), call_number(@holding_id)).deliver
|
48
|
+
render # send_txt.rhtml
|
49
|
+
else
|
50
|
+
flash[:error] = txt_validation_error
|
51
|
+
redirect_to params_preserve_xhr(params.merge(:action => "txt"))
|
52
|
+
end
|
64
53
|
end
|
65
54
|
|
66
55
|
private
|
67
|
-
|
68
|
-
|
69
|
-
|
56
|
+
def valid_txt_number?
|
57
|
+
return (! @number.blank?) && @number.length == 10
|
58
|
+
end
|
70
59
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
60
|
+
def valid_txt_holding?
|
61
|
+
return ! @holding_id.blank?
|
62
|
+
end
|
63
|
+
|
64
|
+
def valid_email?
|
65
|
+
return @email =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
66
|
+
end
|
79
67
|
|
80
68
|
def txt_validation_error
|
81
|
-
|
82
|
-
unless valid_txt_number?
|
83
|
-
|
84
|
-
|
85
|
-
rv += "<ul>"
|
86
|
-
rv += "<li>a valid number</li>" unless valid_txt_number?
|
87
|
-
rv += "<li>the item you wish to send</li>" unless valid_txt_holding?
|
88
|
-
rv += "</ul>"
|
89
|
-
rv += "</div>"
|
90
|
-
end
|
91
|
-
return rv
|
69
|
+
errors = []
|
70
|
+
errors << "a valid number" unless valid_txt_number?
|
71
|
+
errors << "the item you wish to send" unless valid_txt_holding?
|
72
|
+
errors
|
92
73
|
end
|
93
74
|
|
94
75
|
def email_validation_error
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
rv += "<span>Please provide the following:</span>"
|
99
|
-
rv += "<ul>"
|
100
|
-
rv += "<li>a valid email address</li>"
|
101
|
-
rv += "</ul>"
|
102
|
-
rv += "</div>"
|
103
|
-
end
|
104
|
-
return rv
|
76
|
+
errors = []
|
77
|
+
errors << "a valid email address"
|
78
|
+
errors
|
105
79
|
end
|
106
80
|
|
107
81
|
def holding(id)
|
108
82
|
return ServiceResponse.find(id) unless id.nil?
|
109
83
|
end
|
110
84
|
|
111
|
-
def
|
85
|
+
def holding_location(id)
|
112
86
|
return holding(id).view_data[:collection_str] unless holding(id).nil?
|
113
87
|
end
|
114
88
|
|
115
89
|
def call_number(id)
|
116
90
|
return holding(id).view_data[:call_number] unless holding(id).nil?
|
117
91
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
92
|
+
end
|
@@ -288,13 +288,13 @@ class SearchController < UmlautController
|
|
288
288
|
end
|
289
289
|
|
290
290
|
def search_method_module
|
291
|
-
umlaut_config.lookup!("az_search_method", SearchMethods::Sfx4)
|
291
|
+
umlaut_config.lookup!("search.az_search_method", SearchMethods::Sfx4)
|
292
292
|
end
|
293
293
|
|
294
294
|
# sfx a-z profile as defined in config, used for direct db connections
|
295
295
|
# to sfx.
|
296
296
|
def sfx_az_profile
|
297
|
-
umlaut_config.lookup!("sfx_az_profile", "default")
|
297
|
+
umlaut_config.lookup!("search.sfx_az_profile", "default")
|
298
298
|
end
|
299
299
|
helper_method :sfx_az_profile
|
300
300
|
|
@@ -3,18 +3,14 @@ module ExportEmailHelper
|
|
3
3
|
|
4
4
|
def formatted_txt_holding_status(view_data)
|
5
5
|
output = ""
|
6
|
-
|
7
6
|
output << view_data[:collection_str] if view_data[:collection_str]
|
8
7
|
output << " " + view_data[:call_number] if view_data[:call_number]
|
9
8
|
output << " " + view_data[:status] if view_data[:status]
|
10
|
-
|
11
9
|
return output
|
12
10
|
end
|
13
11
|
|
14
12
|
def formatted_html_holding_status(view_data)
|
15
13
|
output = "".html_safe
|
16
|
-
|
17
|
-
|
18
14
|
if view_data[:collection_str]
|
19
15
|
output << content_tag("span", view_data[:collection_str], :class => "collection")
|
20
16
|
end
|
@@ -24,11 +20,19 @@ module ExportEmailHelper
|
|
24
20
|
if view_data[:status]
|
25
21
|
output << " ".html_safe << content_tag("span", view_data[:status], :class => "status")
|
26
22
|
end
|
27
|
-
|
28
23
|
return output
|
29
24
|
end
|
30
25
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
def validation_error(errors)
|
27
|
+
return content_tag(:div, :class => "validation_errors") do
|
28
|
+
return content_tag(:span, "Please provide the following:") +
|
29
|
+
content_tag(:ul) do
|
30
|
+
e = "".html_safe
|
31
|
+
errors.each do |error|
|
32
|
+
e << content_tag(:li, error)
|
33
|
+
end
|
34
|
+
e
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -3,15 +3,17 @@ module SfxDb
|
|
3
3
|
self.table_name = 'AZ_TITLE_VER3'
|
4
4
|
self.primary_key = 'AZ_TITLE_VER3_ID'
|
5
5
|
|
6
|
-
belongs_to
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
belongs_to :object,
|
7
|
+
:foreign_key => 'OBJECT_ID',
|
8
|
+
:class_name => "SfxDb::Object"
|
9
|
+
|
10
10
|
has_many :az_additional_titles,
|
11
|
-
|
12
|
-
|
13
|
-
:foreign_key => 'AZ_TITLE_VER3_ID'
|
11
|
+
:foreign_key => 'AZ_TITLE_VER3_ID',
|
12
|
+
:class_name => "SfxDb::AzAdditionalTitle"
|
14
13
|
|
14
|
+
has_many :az_letter_groups,
|
15
|
+
:foreign_key => 'AZ_TITLE_VER3_ID',
|
16
|
+
:class_name => "SfxDb::AzLetterGroup"
|
15
17
|
|
16
18
|
def to_context_object
|
17
19
|
#require 'openurl'
|
data/app/models/sfx_db/target.rb
CHANGED
@@ -7,7 +7,7 @@ cite = @user_request.referent.to_citation %>
|
|
7
7
|
<h2>Email the title and locations</h2>
|
8
8
|
|
9
9
|
<div class="formError">
|
10
|
-
<%= @error || flash[:error] %>
|
10
|
+
<%= validation_error( @error || flash[:error]) if ( @error || flash[:error]) %>
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<h3><strong>Title:</strong> <%= h(cite[:title]) %>/<%= h(cite[:author]) %></h3>
|
@@ -7,7 +7,7 @@ unless @user_request.nil?
|
|
7
7
|
<h2>Send the title and location of an item to your mobile phone</h2>
|
8
8
|
|
9
9
|
<div class="formError">
|
10
|
-
<%= @error || flash[:error] %>
|
10
|
+
<%= validation_error( @error || flash[:error]) if ( @error || flash[:error]) %>
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<h3><strong>Title:</strong>
|
@@ -54,7 +54,7 @@ class PrimoSource < PrimoService
|
|
54
54
|
service_data[attr] = holding.method(attr).call
|
55
55
|
end
|
56
56
|
@source_attributes.each do |attr|
|
57
|
-
service_data[attr.to_sym] = holding.method(attr.to_sym).call
|
57
|
+
service_data[attr.to_sym] = holding.method(attr.to_sym).call if holding.respond_to?(attr.to_sym)
|
58
58
|
end
|
59
59
|
service_data.merge!({
|
60
60
|
:call_number => holding.call_number, :collection => holding.collection,
|
data/lib/umlaut/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umlaut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08
|
12
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -304,8 +304,8 @@ files:
|
|
304
304
|
- app/assets/images/error.gif
|
305
305
|
- app/assets/javascripts/umlaut_ui.js
|
306
306
|
- app/assets/javascripts/umlaut.js
|
307
|
+
- app/assets/javascripts/umlaut/ajax_windows.js.coffee
|
307
308
|
- app/assets/javascripts/umlaut/update_html.js
|
308
|
-
- app/assets/javascripts/umlaut/ajax_windows.js
|
309
309
|
- app/assets/javascripts/umlaut/simple_visible_toggle.js
|
310
310
|
- app/assets/javascripts/umlaut/ensure_window_size.js.erb
|
311
311
|
- app/assets/javascripts/umlaut/expand_contract_toggle.js
|
@@ -468,7 +468,6 @@ files:
|
|
468
468
|
- README.md
|
469
469
|
- ./test/integration/request_test.rb
|
470
470
|
- ./test/integration/request_reuse_test.rb
|
471
|
-
- ./test/integration/permalinks_test.rb
|
472
471
|
- ./test/dummy/tmp/cache/assets/D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1
|
473
472
|
- ./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8
|
474
473
|
- ./test/dummy/tmp/cache/assets/CD1/F20/sprockets%2F385e5fb31cf27e262480d1174be1d500
|
@@ -575,7 +574,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
575
574
|
version: '0'
|
576
575
|
segments:
|
577
576
|
- 0
|
578
|
-
hash:
|
577
|
+
hash: 1628836782081809943
|
579
578
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
580
579
|
none: false
|
581
580
|
requirements:
|
@@ -584,7 +583,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
584
583
|
version: '0'
|
585
584
|
segments:
|
586
585
|
- 0
|
587
|
-
hash:
|
586
|
+
hash: 1628836782081809943
|
588
587
|
requirements: []
|
589
588
|
rubyforge_project:
|
590
589
|
rubygems_version: 1.8.24
|
@@ -595,7 +594,6 @@ summary: For Libraries, a just-in-time last-mile service aggregator, taking Open
|
|
595
594
|
test_files:
|
596
595
|
- ./test/integration/request_test.rb
|
597
596
|
- ./test/integration/request_reuse_test.rb
|
598
|
-
- ./test/integration/permalinks_test.rb
|
599
597
|
- ./test/dummy/tmp/cache/assets/D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1
|
600
598
|
- ./test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8
|
601
599
|
- ./test/dummy/tmp/cache/assets/CD1/F20/sprockets%2F385e5fb31cf27e262480d1174be1d500
|
@@ -1,35 +0,0 @@
|
|
1
|
-
/* ajax_windows.js. Support for modal popup windows in Umlaut items. */
|
2
|
-
jQuery(document).ready(function($) {
|
3
|
-
|
4
|
-
var shared_modal_d = $("<div></div>").dialog({autoOpen: false, modal: true, width: "400px"}) ;
|
5
|
-
|
6
|
-
$("a.ajax_window").live("click", function(event) {
|
7
|
-
|
8
|
-
$(shared_modal_d).load( this.href, function() {
|
9
|
-
var heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
|
10
|
-
$(shared_modal_d).dialog("option", "title", heading.text());
|
11
|
-
$(shared_modal_d).dialog("open");
|
12
|
-
});
|
13
|
-
return false;
|
14
|
-
});
|
15
|
-
|
16
|
-
function ajax_form_catch(event) {
|
17
|
-
$(shared_modal_d).load( $(event.target).closest("form").attr("action"), $(event.target).closest("form").serialize(), function() {
|
18
|
-
var heading = shared_modal_d.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
|
19
|
-
$(shared_modal_d).dialog("option", "title", heading.text());
|
20
|
-
$(shared_modal_d).dialog("open");
|
21
|
-
|
22
|
-
});
|
23
|
-
return false;
|
24
|
-
}
|
25
|
-
|
26
|
-
//Trapping two events, click on the submit button or submit on the form
|
27
|
-
//is strangely needed in IE7 to trap both return-in-field submits
|
28
|
-
//and click-on-button submits. In FF just the second "submit" version
|
29
|
-
//is sufficient.
|
30
|
-
$("form.modal_dialog_form input[type=submit]").live("click", ajax_form_catch );
|
31
|
-
$("form.modal_dialog_form").live( "submit", ajax_form_catch);
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
});
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PermalinksTest < ActionDispatch::IntegrationTest
|
4
|
-
|
5
|
-
|
6
|
-
test "missing id" do
|
7
|
-
sess = open_session
|
8
|
-
|
9
|
-
missing_id = 999999999
|
10
|
-
|
11
|
-
sess.get "/go/#{missing_id}"
|
12
|
-
|
13
|
-
assert_response(:missing)
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|