voruby 1.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/REQUIREMENTS +3 -3
- data/Rakefile.rb +6 -2
- data/lib/voruby/active_votable/active_votable.rb +61 -6
- data/lib/voruby/adql/adql.rb +64 -12
- data/lib/voruby/adql/ext.rb +2 -3
- data/lib/voruby/adql/loader.rb +1 -0
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +7 -2
- data/lib/voruby/services/gestalt/footprint.rb +2 -2
- data/lib/voruby/services/gestalt/wesix.rb +1 -1
- data/lib/voruby/services/resolver/resolver.rb +1 -1
- data/lib/voruby/services/schema/schema.rb +644 -0
- data/lib/voruby/simple/sap.rb +2 -2
- data/lib/voruby/votables/chandra.rb +194 -231
- data/lib/voruby/votables/galex.rb +229 -242
- data/lib/voruby/votables/int.rb +193 -230
- data/lib/voruby/votables/nsa.rb +299 -282
- data/lib/voruby/votables/rexml_votable.rb +1 -1
- data/lib/voruby/votables/sdss.rb +194 -231
- data/lib/voruby/votables/transforms.rb +3 -3
- data/lib/voruby/votables/votable.rb +338 -281
- data/test/active_votable/unittest.rb +18 -4
- data/test/plastic/test.rb +1 -1
- data/test/resources/voresource/unittest_v1_0.rb +2 -2
- data/test/stc/unittest_v1_20.rb +2 -2
- metadata +52 -54
- data/lib/voruby/votables/cnoc.rb +0 -393
- data/lib/voruby/votables/hst.rb +0 -391
- data/lib/voruby/votables/nsar3.rb +0 -410
- data/lib/voruby/votables/xmm.rb +0 -394
data/lib/voruby/votables/nsa.rb
CHANGED
@@ -6,7 +6,7 @@ require 'voruby/votables/votable'
|
|
6
6
|
|
7
7
|
module VORuby
|
8
8
|
module VOTables
|
9
|
-
|
9
|
+
|
10
10
|
module VOTable
|
11
11
|
class NSAVOTable < VOTable
|
12
12
|
|
@@ -18,18 +18,38 @@ module VORuby
|
|
18
18
|
votable.definitions, votable.coosys, votable.params,
|
19
19
|
votable.info, votable.resources)
|
20
20
|
end
|
21
|
-
|
22
|
-
# Find
|
21
|
+
|
22
|
+
# Find the column number(s) associated with a Name.
|
23
|
+
# Returns a list of column positions.
|
24
|
+
# [_res_:]
|
25
|
+
# The resource from which to extract the table in question.
|
26
|
+
# [_tbl_:]
|
27
|
+
# The resource from which to extract the table in question.
|
28
|
+
def find_columns(name, res=0, tbl=0)
|
29
|
+
columns = []
|
30
|
+
|
31
|
+
col_count = 0
|
32
|
+
fields = fields(res, tbl)
|
33
|
+
if fields
|
34
|
+
fields.each do |field|
|
35
|
+
if field.name() != nil
|
36
|
+
columns.push(col_count) if field.name() == name
|
37
|
+
end
|
38
|
+
col_count += 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
return columns
|
42
|
+
end
|
43
|
+
|
44
|
+
# Find a field in NSA SIAP configuration file given a key.
|
23
45
|
# Returns a hash with the field's attributes
|
24
46
|
# [_key_:]
|
25
|
-
# The key indexing on field's attribute.
|
26
|
-
# UCD, because I guess that NSA always uses the UCDs on its
|
27
|
-
# fields
|
47
|
+
# The key indexing on field's attribute.
|
28
48
|
def find_field_in_conf_file(key)
|
29
49
|
nsa_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
30
|
-
|
50
|
+
|
31
51
|
if key != nil
|
32
|
-
|
52
|
+
NSA_SIAP_CONFIG.each do |archive|
|
33
53
|
archive['votable_fields'].each do |field|
|
34
54
|
if field['key'] == key
|
35
55
|
nsa_field['id'] = field['id'] if field['id'] != 'nil'
|
@@ -42,352 +62,349 @@ module VORuby
|
|
42
62
|
end
|
43
63
|
return nsa_field
|
44
64
|
end
|
45
|
-
|
46
|
-
# Find the column number(s) associated with the
|
47
|
-
# VOX:imageAccessReference UCD.
|
48
|
-
# Returns a list of column positions.
|
65
|
+
|
49
66
|
def image_access_reference_columns()
|
50
|
-
|
51
|
-
|
52
|
-
if find_columns(
|
53
|
-
find_columns(
|
67
|
+
access_key = find_field_in_conf_file('reference')['name']
|
68
|
+
|
69
|
+
if find_columns(access_key).first != nil
|
70
|
+
find_columns(access_key).first
|
54
71
|
end
|
55
72
|
end
|
56
|
-
|
73
|
+
|
57
74
|
def image_ra_columns
|
58
|
-
|
59
|
-
|
60
|
-
if find_columns(
|
61
|
-
find_columns(
|
75
|
+
ra_key = find_field_in_conf_file('ra')['name']
|
76
|
+
|
77
|
+
if find_columns(ra_key).first != nil
|
78
|
+
find_columns(ra_key).first
|
62
79
|
end
|
63
80
|
end
|
64
|
-
|
81
|
+
|
65
82
|
def image_dec_columns
|
66
|
-
|
67
|
-
|
68
|
-
if find_columns(
|
69
|
-
find_columns(
|
83
|
+
dec_key = find_field_in_conf_file('dec')['name']
|
84
|
+
|
85
|
+
if find_columns(dec_key).first != nil
|
86
|
+
find_columns(dec_key).first
|
70
87
|
end
|
71
88
|
end
|
72
|
-
|
89
|
+
|
90
|
+
def image_obstype_columns
|
91
|
+
obstype_key = find_field_in_conf_file('object')['name']
|
92
|
+
|
93
|
+
if find_columns(obstype_key).first != nil
|
94
|
+
find_columns(obstype_key).first
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
73
98
|
def image_filter_columns
|
74
|
-
#
|
75
|
-
|
76
|
-
#if find_columns(
|
77
|
-
# find_columns(
|
99
|
+
#filter_key = find_field_in_conf_file('')['name']
|
100
|
+
|
101
|
+
#if find_columns(filter_key).first != nil
|
102
|
+
# find_columns(filter_key).first
|
78
103
|
#end
|
79
104
|
end
|
80
|
-
|
105
|
+
|
81
106
|
def image_date_obs_columns
|
82
|
-
#
|
83
|
-
|
84
|
-
#if find_columns(
|
85
|
-
# find_columns(
|
107
|
+
#date_obs_key = find_field_in_conf_file('')['name']
|
108
|
+
|
109
|
+
#if find_columns(date_obs_key).first != nil
|
110
|
+
# find_columns(date_obs_key).first
|
86
111
|
#end
|
87
112
|
end
|
88
|
-
|
113
|
+
|
89
114
|
def image_telescope_columns
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
115
|
+
telescope_key = find_field_in_conf_file('telescope')['name']
|
116
|
+
|
117
|
+
if find_columns(telescope_key).first != nil
|
118
|
+
find_columns(telescope_key).first
|
119
|
+
end
|
95
120
|
end
|
96
|
-
|
121
|
+
|
97
122
|
def image_survey_columns
|
98
|
-
|
99
|
-
|
100
|
-
if find_columns(
|
101
|
-
find_columns(
|
123
|
+
survey_key = find_field_in_conf_file('prop_id')['name']
|
124
|
+
|
125
|
+
if find_columns(survey_key).first != nil
|
126
|
+
find_columns(survey_key).first
|
102
127
|
end
|
103
128
|
end
|
104
|
-
|
129
|
+
|
105
130
|
def image_instrument_columns
|
106
|
-
|
107
|
-
|
108
|
-
if find_columns(
|
109
|
-
find_columns(
|
131
|
+
instrument_key = find_field_in_conf_file('instrument')['name']
|
132
|
+
|
133
|
+
if find_columns(instrument_key).first != nil
|
134
|
+
find_columns(instrument_key).first
|
110
135
|
end
|
111
136
|
end
|
112
|
-
|
137
|
+
|
113
138
|
def image_sky_columns
|
114
|
-
#
|
115
|
-
|
116
|
-
#if find_columns(
|
117
|
-
# find_columns(
|
139
|
+
#sky_key = find_field_in_conf_file('')['name']
|
140
|
+
|
141
|
+
#if find_columns(sky_key).first != nil
|
142
|
+
# find_columns(sky_key).first
|
118
143
|
#end
|
119
144
|
end
|
120
|
-
|
145
|
+
|
121
146
|
def image_zeropoint_columns
|
122
|
-
#
|
123
|
-
|
124
|
-
#if find_columns(
|
125
|
-
# find_columns(
|
147
|
+
#zeropoint_key = find_field_in_conf_file('')['name']
|
148
|
+
|
149
|
+
#if find_columns(zeropoint_key).first != nil
|
150
|
+
# find_columns(zeropoint_key).first
|
126
151
|
#end
|
127
152
|
end
|
128
|
-
|
153
|
+
|
129
154
|
def image_seeing_columns
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
155
|
+
seeing_key = find_field_in_conf_file('seeing')['name']
|
156
|
+
|
157
|
+
if find_columns(seeing_key).first != nil
|
158
|
+
find_columns(seeing_key).first
|
159
|
+
end
|
135
160
|
end
|
136
|
-
|
161
|
+
|
137
162
|
def image_depth_columns
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
163
|
+
depth_key = find_field_in_conf_file('depth')['name']
|
164
|
+
|
165
|
+
if find_columns(depth_key).first != nil
|
166
|
+
find_columns(depth_key).first
|
167
|
+
end
|
143
168
|
end
|
144
|
-
|
169
|
+
|
145
170
|
def image_exptime_columns
|
146
|
-
#
|
147
|
-
|
148
|
-
#if find_columns(
|
149
|
-
# find_columns(
|
171
|
+
#exptime_key = find_field_in_conf_file('')['name']
|
172
|
+
|
173
|
+
#if find_columns(exptime_key).first != nil
|
174
|
+
# find_columns(exptime_key).first
|
150
175
|
#end
|
151
176
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
# The class to assign the header of the HTML table.
|
170
|
-
def create_headers(res, tbl,
|
171
|
-
infer_add_to_cart_ref, add_to_cart_header_value,
|
172
|
-
infer_access_ref, access_ref_header_value, access_ref_col,
|
173
|
-
header_class, id=nil)
|
174
|
-
|
175
|
-
headers = Array.new
|
176
|
-
thead = "<thead class=\"#{header_class}\">\n"
|
177
|
-
|
178
|
-
thead << "<tr>\n"
|
179
|
-
if infer_add_to_cart_ref
|
180
|
-
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
181
|
-
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
177
|
+
|
178
|
+
def image_vo_id_columns
|
179
|
+
vo_id_key = find_field_in_conf_file('vo_id')['name']
|
180
|
+
|
181
|
+
if find_columns(vo_id_key).first != nil
|
182
|
+
find_columns(vo_id_key).first
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def show_columns(col_count)
|
187
|
+
case col_count
|
188
|
+
when image_access_reference_columns()
|
189
|
+
return false
|
190
|
+
when image_vo_id_columns()
|
191
|
+
return false
|
192
|
+
else
|
193
|
+
return true
|
182
194
|
end
|
183
|
-
|
184
|
-
|
185
|
-
|
195
|
+
end
|
196
|
+
|
197
|
+
# Create the headers for HTML table
|
198
|
+
# [_access_ref_index_:]
|
199
|
+
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
200
|
+
# [_options_:]
|
201
|
+
#
|
202
|
+
def create_headers(access_ref_index, options)
|
203
|
+
thead, thead_2row = create_header_cart_links(options)
|
204
|
+
|
205
|
+
if options[:infer_access_ref] and access_ref_index
|
206
|
+
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
207
|
+
thead_2row.push(' ')
|
186
208
|
end
|
209
|
+
|
187
210
|
col_count = 0
|
188
|
-
fields(res, tbl).each do |field|
|
189
|
-
field_archive = find_field_in_conf_file(field.
|
211
|
+
fields(options[:res], options[:tbl]).each do |field|
|
212
|
+
field_archive = find_field_in_conf_file(field.name)
|
190
213
|
field_ucd = field_archive['ucd']
|
191
|
-
if infer_access_ref and col_count ==
|
192
|
-
|
193
|
-
|
214
|
+
if options[:infer_access_ref] and access_ref_index and col_count == access_ref_index
|
215
|
+
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
216
|
+
elsif show_columns(col_count)
|
194
217
|
thead << "<th>#{field_archive['name']}</th>\n"
|
195
218
|
if field_ucd != 'nil'
|
196
|
-
|
219
|
+
thead_2row.push(field_ucd)
|
197
220
|
else
|
198
|
-
|
221
|
+
thead_2row.push(' ')
|
199
222
|
end
|
200
223
|
end
|
201
224
|
col_count += 1
|
202
225
|
end
|
226
|
+
|
203
227
|
thead << " </tr>\n"
|
204
|
-
|
228
|
+
|
205
229
|
thead << "<tr>\n"
|
206
|
-
|
230
|
+
thead_2row.each do |h|
|
207
231
|
thead << "<th>#{h}</th>\n"
|
208
232
|
end
|
209
233
|
thead << "</tr>\n"
|
210
|
-
|
234
|
+
|
211
235
|
thead << "</thead>"
|
212
|
-
|
236
|
+
|
213
237
|
return thead
|
214
238
|
end
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
|
240
|
+
# Creates the cart parameters
|
241
|
+
# [_cart_params:_]
|
242
|
+
#
|
243
|
+
# [_columns:_]
|
244
|
+
#
|
245
|
+
def create_item_cart_params(cart_params, columns)
|
246
|
+
link_ref_array = []
|
247
|
+
|
248
|
+
cart_params.each do |key, value|
|
249
|
+
link_ref_array.push("#{key}=#{value}")
|
250
|
+
end
|
251
|
+
|
252
|
+
ra_index = image_ra_columns()
|
253
|
+
link_ref_array.push("rac=#{convert_ra_to_degrees(columns[ra_index].value.to_s).to_s}") if ra_index
|
254
|
+
dec_index = image_dec_columns()
|
255
|
+
link_ref_array.push("decc=#{convert_dec_to_degrees(columns[dec_index].value.to_s).to_s}") if dec_index
|
256
|
+
obstype_index = image_obstype_columns()
|
257
|
+
link_ref_array.push("obstype=#{columns[obstype_index].value.to_s}") if obstype_index
|
258
|
+
filter_index = image_filter_columns()
|
259
|
+
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
260
|
+
date_obs_index = image_date_obs_columns()
|
261
|
+
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
262
|
+
teles_index = image_telescope_columns()
|
263
|
+
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
264
|
+
survey_index = image_survey_columns()
|
265
|
+
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
266
|
+
instrum_index = image_instrument_columns()
|
267
|
+
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
268
|
+
sky_index = image_sky_columns()
|
269
|
+
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
270
|
+
zerop_index = image_zeropoint_columns()
|
271
|
+
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
272
|
+
seeing_index = image_seeing_columns()
|
273
|
+
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
274
|
+
depth_index = image_depth_columns()
|
275
|
+
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
276
|
+
exptime_index = image_exptime_columns()
|
277
|
+
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
278
|
+
|
279
|
+
return link_ref_array.join('&')
|
245
280
|
end
|
246
|
-
|
281
|
+
|
247
282
|
# Create body for HTML table
|
248
|
-
# [
|
249
|
-
# The resource from which to extract the table in question.
|
250
|
-
# [_tbl_:]
|
251
|
-
# The table inside the resource from which to extract the rows in question.
|
252
|
-
# [_infer_add_to_cart_ref_:]
|
253
|
-
#
|
254
|
-
# [_add_to_cart_link_value_:]
|
255
|
-
#
|
256
|
-
# [_add_to_cart_link_ref_:]
|
257
|
-
#
|
258
|
-
# [_infer_access_ref_:]
|
259
|
-
# Link the access reference URL associated with a row.
|
260
|
-
# [_access_ref_link_value_:]
|
261
|
-
# For the access reference column, link this word.
|
262
|
-
# [_access_ref_col_:]
|
283
|
+
# [_access_ref_index_:]
|
263
284
|
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
264
|
-
# [
|
265
|
-
#
|
266
|
-
|
267
|
-
|
268
|
-
def create_body(res, tbl,
|
269
|
-
infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
|
270
|
-
infer_access_ref, access_ref_link_value, access_ref_col,
|
271
|
-
body_class, row_classes)
|
272
|
-
|
273
|
-
tbody = "<tbody class=\"#{body_class}\">\n"
|
285
|
+
# [_options_:]
|
286
|
+
#
|
287
|
+
def create_body(access_ref_index, options)
|
288
|
+
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
274
289
|
row_count = 0
|
275
|
-
rows(res, tbl)
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
"
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
290
|
+
rows_data = rows(options[:res], options[:tbl])
|
291
|
+
if rows_data
|
292
|
+
rows_data.each do |tr|
|
293
|
+
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
294
|
+
|
295
|
+
# Specially mark up the first column to link to the image.
|
296
|
+
columns = tr.tds()
|
297
|
+
|
298
|
+
if options[:infer_add_to_cart_ref] and access_ref_index
|
299
|
+
link_ref = "&resource=#{CGI.escape(columns[access_ref_index].value).to_s}"
|
300
|
+
if options[:ssl]
|
301
|
+
resource = URI.parse(columns[access_ref_index].value)
|
302
|
+
resource.scheme = options[:resource_link][:scheme]
|
303
|
+
resource.port = options[:resource_link][:port]
|
304
|
+
resource_link = resource.scheme.to_s + '://' + resource.host.to_s + ':' +
|
305
|
+
resource.port.to_s + resource.request_uri().to_s
|
306
|
+
link_ref = "&resource=#{CGI.escape(resource_link).to_s}"
|
307
|
+
end
|
308
|
+
|
309
|
+
tbody << "<td><input type=\"checkbox\" " +
|
310
|
+
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
311
|
+
"value=\"#{create_item_cart_params(options[:cart_params], columns)}#{link_ref}\"/></td>\n"
|
312
|
+
end
|
313
|
+
|
314
|
+
if options[:infer_access_ref] and access_ref_index
|
315
|
+
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
316
|
+
end
|
317
|
+
|
318
|
+
col_count = 0
|
319
|
+
ra_index = image_ra_columns()
|
320
|
+
dec_index = image_dec_columns()
|
321
|
+
columns.each do |td|
|
322
|
+
if col_count != access_ref_index
|
323
|
+
if ra_index and col_count == ra_index
|
324
|
+
tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
325
|
+
elsif dec_index and col_count == dec_index
|
326
|
+
tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
327
|
+
else
|
328
|
+
tbody << "<td>#{td.value}</td>\n"
|
329
|
+
end
|
330
|
+
end
|
331
|
+
col_count += 1
|
332
|
+
end
|
333
|
+
|
334
|
+
tbody << "</tr>\n"
|
335
|
+
row_count += 1
|
303
336
|
end
|
304
|
-
tbody << "</tr>\n"
|
305
|
-
row_count += 1
|
306
337
|
end
|
307
338
|
tbody << "</tbody>"
|
308
|
-
|
339
|
+
|
309
340
|
return tbody
|
310
341
|
end
|
311
|
-
|
342
|
+
|
312
343
|
# Convert the specified table in the specified resource into an HTML
|
313
344
|
# table.
|
314
|
-
# [
|
315
|
-
# The
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
345
|
+
# [_options_:]
|
346
|
+
# The options for this VOTable.
|
347
|
+
def to_html(options={})
|
348
|
+
# The ID to assign to the HTML table as a whole.
|
349
|
+
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
350
|
+
|
351
|
+
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
352
|
+
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
353
|
+
options[:cart_params] = {} if options[:cart_params] == nil
|
354
|
+
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
355
|
+
|
356
|
+
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
357
|
+
options[:throbber_size] = options[:throbber_size] || '16x16'
|
358
|
+
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
359
|
+
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
360
|
+
|
361
|
+
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
362
|
+
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
363
|
+
|
364
|
+
# Link the access reference URL associated with a row.
|
365
|
+
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
366
|
+
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
367
|
+
# For the access reference column, place this value in the header.
|
368
|
+
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
369
|
+
# For the access reference column, link this word.
|
370
|
+
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
371
|
+
options[:ssl] = false if options[:ssl] == nil
|
372
|
+
#options[:resource_link] = options[:resource_link]
|
373
|
+
|
374
|
+
# The resource from which to extract the table in question.
|
375
|
+
options[:res] = options[:res] || 0
|
376
|
+
# The table inside the resource from which to extract the rows in question.
|
377
|
+
options[:tbl] = options[:tbl] || 0
|
378
|
+
|
379
|
+
# The boolean value to show HTML table border
|
380
|
+
options[:show_border] = false if options[:show_border] == nil
|
381
|
+
# The class to assign the HTML table as a whole.
|
382
|
+
options[:table_class] = options[:table_class] || 'votable'
|
383
|
+
# The class to assign the header of the HTML table.
|
384
|
+
options[:header_class] = options[:header_class] || 'header'
|
385
|
+
# The class to assign the body of the HTML table.
|
386
|
+
options[:body_class] = options[:body_class] || 'body'
|
387
|
+
# The class to assign the HTML table body rows.
|
388
|
+
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
389
|
+
|
356
390
|
begin
|
357
391
|
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
infer_access_ref, access_ref_header_value, access_ref_col,
|
365
|
-
header_class, id)
|
366
|
-
|
367
|
-
# Create body
|
368
|
-
tbody = create_body(res, tbl,
|
369
|
-
infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
|
370
|
-
infer_access_ref, access_ref_link_value, access_ref_col,
|
371
|
-
body_class, row_classes)
|
372
|
-
|
373
|
-
return create_table(id, show_border, table_class, thead, tbody)
|
374
|
-
else
|
375
|
-
title = 'No Data'
|
376
|
-
message = 'VOTable not contains data.'
|
377
|
-
return create_message_table(table_class, header_class,
|
378
|
-
body_class, row_classes, title, message)
|
379
|
-
end
|
380
|
-
|
392
|
+
access_ref_index = image_access_reference_columns()
|
393
|
+
|
394
|
+
return create_votable(create_headers(access_ref_index, options),
|
395
|
+
create_body(access_ref_index, options),
|
396
|
+
options)
|
397
|
+
|
381
398
|
rescue Exception => e
|
382
|
-
title = 'Error'
|
383
|
-
message =
|
384
|
-
|
385
|
-
|
399
|
+
title = 'Error...'
|
400
|
+
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
401
|
+
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
402
|
+
create_message(title, message, options)
|
386
403
|
end
|
387
404
|
end
|
388
|
-
|
405
|
+
|
389
406
|
end
|
390
407
|
end
|
391
408
|
|
392
409
|
end
|
393
|
-
end
|
410
|
+
end
|