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
@@ -8,7 +8,7 @@ module VORuby
|
|
8
8
|
module VOTables
|
9
9
|
module VOTable
|
10
10
|
class GALEXVOTable < VOTable
|
11
|
-
|
11
|
+
|
12
12
|
# Our object's contructor
|
13
13
|
# [_votable:_]
|
14
14
|
# The VOTable object
|
@@ -17,14 +17,38 @@ module VORuby
|
|
17
17
|
votable.definitions, votable.coosys, votable.params,
|
18
18
|
votable.info, votable.resources)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
|
+
# Find the column number(s) associated with a Name.
|
22
|
+
# Returns a list of column positions.
|
23
|
+
# [_res_:]
|
24
|
+
# The resource from which to extract the table in question.
|
25
|
+
# [_tbl_:]
|
26
|
+
# The resource from which to extract the table in question.
|
27
|
+
def find_columns(name, res=0, tbl=0)
|
28
|
+
columns = []
|
29
|
+
|
30
|
+
col_count = 0
|
31
|
+
fields = fields(res, tbl)
|
32
|
+
|
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
|
+
|
42
|
+
return columns
|
43
|
+
end
|
44
|
+
|
21
45
|
# Find a field in GALEX configuration file given a key.
|
22
46
|
# Returns a hash with the field's attributes
|
23
47
|
# [_key_:]
|
24
48
|
# The key indexing on field's attribute
|
25
49
|
def find_field_in_conf_file(key)
|
26
50
|
galex_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
27
|
-
|
51
|
+
|
28
52
|
if key != nil
|
29
53
|
GALEX_ARCHIVE_CONFIG.each do |archive|
|
30
54
|
archive['votable_fields'].each do |field|
|
@@ -44,347 +68,310 @@ module VORuby
|
|
44
68
|
# VOX:imageAccessReference UCD.
|
45
69
|
# Returns a list of column positions.
|
46
70
|
def image_access_reference_columns()
|
47
|
-
ucd_access = find_field_in_conf_file('VOX:Image_AccessReference')['
|
48
|
-
|
71
|
+
ucd_access = find_field_in_conf_file('VOX:Image_AccessReference')['name']
|
72
|
+
|
49
73
|
if find_columns(ucd_access).first != nil
|
50
74
|
find_columns(ucd_access).first
|
51
75
|
end
|
52
76
|
end
|
53
|
-
|
77
|
+
|
54
78
|
def image_ra_columns
|
55
|
-
ucd_ra = find_field_in_conf_file('POS_EQ_RA_MAIN')['
|
56
|
-
|
79
|
+
ucd_ra = find_field_in_conf_file('POS_EQ_RA_MAIN')['name']
|
80
|
+
|
57
81
|
if find_columns(ucd_ra).first != nil
|
58
82
|
find_columns(ucd_ra).first
|
59
83
|
end
|
60
84
|
end
|
61
|
-
|
85
|
+
|
62
86
|
def image_dec_columns
|
63
|
-
ucd_dec = find_field_in_conf_file('POS_EQ_DEC_MAIN')['
|
64
|
-
|
87
|
+
ucd_dec = find_field_in_conf_file('POS_EQ_DEC_MAIN')['name']
|
88
|
+
|
65
89
|
if find_columns(ucd_dec).first != nil
|
66
90
|
find_columns(ucd_dec).first
|
67
91
|
end
|
68
92
|
end
|
69
|
-
|
93
|
+
|
70
94
|
def image_filter_columns
|
71
|
-
ucd_filter = find_field_in_conf_file('VOX:BandPass_ID')['
|
72
|
-
|
95
|
+
ucd_filter = find_field_in_conf_file('VOX:BandPass_ID')['name']
|
96
|
+
|
73
97
|
if find_columns(ucd_filter).first != nil
|
74
98
|
find_columns(ucd_filter).first
|
75
99
|
end
|
76
100
|
end
|
77
|
-
|
101
|
+
|
78
102
|
def image_date_obs_columns
|
79
|
-
#ucd_date_obs = find_field_in_conf_file('')['
|
80
|
-
|
103
|
+
#ucd_date_obs = find_field_in_conf_file('')['name']
|
104
|
+
|
81
105
|
#if find_columns(ucd_date_obs).first != nil
|
82
106
|
# find_columns(ucd_date_obs).first
|
83
107
|
#end
|
84
108
|
end
|
85
|
-
|
109
|
+
|
86
110
|
def image_telescope_columns
|
87
|
-
#ucd_telescope = find_field_in_conf_file('')['
|
88
|
-
|
111
|
+
#ucd_telescope = find_field_in_conf_file('')['name']
|
112
|
+
|
89
113
|
#if find_columns(ucd_telescope).first != nil
|
90
114
|
# find_columns(ucd_telescope).first
|
91
115
|
#end
|
92
116
|
end
|
93
|
-
|
117
|
+
|
94
118
|
def image_survey_columns
|
95
|
-
ucd_survey = find_field_in_conf_file('VOX:Image_Title')['
|
96
|
-
|
119
|
+
ucd_survey = find_field_in_conf_file('VOX:Image_Title')['name']
|
120
|
+
|
97
121
|
if find_columns(ucd_survey).first != nil
|
98
122
|
find_columns(ucd_survey).first
|
99
123
|
end
|
100
124
|
end
|
101
|
-
|
125
|
+
|
102
126
|
def image_instrument_columns
|
103
|
-
ucd_instrument = find_field_in_conf_file('VOX:INST_ID')['
|
104
|
-
|
127
|
+
ucd_instrument = find_field_in_conf_file('VOX:INST_ID')['name']
|
128
|
+
|
105
129
|
if find_columns(ucd_instrument).first != nil
|
106
130
|
find_columns(ucd_instrument).first
|
107
131
|
end
|
108
132
|
end
|
109
|
-
|
133
|
+
|
110
134
|
def image_sky_columns
|
111
|
-
#ucd_sky = find_field_in_conf_file('')['
|
112
|
-
|
135
|
+
#ucd_sky = find_field_in_conf_file('')['name']
|
136
|
+
|
113
137
|
#if find_columns(ucd_sky).first != nil
|
114
138
|
# find_columns(ucd_sky).first
|
115
139
|
#end
|
116
140
|
end
|
117
|
-
|
141
|
+
|
118
142
|
def image_zeropoint_columns
|
119
|
-
#ucd_zeropoint = find_field_in_conf_file('')['
|
120
|
-
|
143
|
+
#ucd_zeropoint = find_field_in_conf_file('')['name']
|
144
|
+
|
121
145
|
#if find_columns(ucd_zeropoint).first != nil
|
122
146
|
# find_columns(ucd_zeropoint).first
|
123
147
|
#end
|
124
148
|
end
|
125
|
-
|
149
|
+
|
126
150
|
def image_seeing_columns
|
127
|
-
#ucd_seeing = find_field_in_conf_file('')['
|
128
|
-
|
151
|
+
#ucd_seeing = find_field_in_conf_file('')['name']
|
152
|
+
|
129
153
|
#if find_columns(ucd_seeing).first != nil
|
130
154
|
# find_columns(ucd_seeing).first
|
131
155
|
#end
|
132
156
|
end
|
133
|
-
|
157
|
+
|
134
158
|
def image_depth_columns
|
135
|
-
#ucd_depth = find_field_in_conf_file('')['
|
136
|
-
|
159
|
+
#ucd_depth = find_field_in_conf_file('')['name']
|
160
|
+
|
137
161
|
#if find_columns(ucd_depth).first != nil
|
138
162
|
# find_columns(ucd_depth).first
|
139
163
|
#end
|
140
164
|
end
|
141
|
-
|
165
|
+
|
142
166
|
def image_exptime_columns
|
143
|
-
#ucd_exptime = find_field_in_conf_file('')['
|
144
|
-
|
167
|
+
#ucd_exptime = find_field_in_conf_file('')['name']
|
168
|
+
|
145
169
|
#if find_columns(ucd_exptime).first != nil
|
146
170
|
# find_columns(ucd_exptime).first
|
147
171
|
#end
|
148
172
|
end
|
149
|
-
|
150
|
-
# Create headers for HTML table
|
151
|
-
# [
|
152
|
-
# The resource from which to extract the table in question.
|
153
|
-
# [_tbl_:]
|
154
|
-
# The table inside the resource from which to extract the rows in question.
|
155
|
-
# [_infer_add_to_cart_ref_:]
|
156
|
-
#
|
157
|
-
# [_add_to_cart_header_value_:]
|
158
|
-
#
|
159
|
-
# [_infer_access_ref_:]
|
160
|
-
# Link the access reference URL associated with a row.
|
161
|
-
# [_access_ref_header_value_:]
|
162
|
-
# For the access reference column, place this value in the header.
|
163
|
-
# [_access_ref_col_:]
|
173
|
+
|
174
|
+
# Create the headers for HTML table
|
175
|
+
# [_access_ref_index_:]
|
164
176
|
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
165
|
-
# [
|
166
|
-
#
|
167
|
-
def create_headers(
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
thead = "<thead class=\"#{header_class}\">\n"
|
174
|
-
|
175
|
-
thead << "<tr>\n"
|
176
|
-
if infer_add_to_cart_ref
|
177
|
-
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
178
|
-
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
179
|
-
end
|
180
|
-
if infer_access_ref
|
181
|
-
thead << "<th>#{access_ref_header_value}</th>\n"
|
182
|
-
headers.push(' ')
|
177
|
+
# [_options_:]
|
178
|
+
#
|
179
|
+
def create_headers(access_ref_index, options)
|
180
|
+
thead, thead_2row = create_header_cart_links(options)
|
181
|
+
|
182
|
+
if options[:infer_access_ref] and access_ref_index
|
183
|
+
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
184
|
+
thead_2row.push(' ')
|
183
185
|
end
|
186
|
+
|
184
187
|
col_count = 0
|
185
|
-
fields(res, tbl).each do |field|
|
188
|
+
fields(options[:res], options[:tbl]).each do |field|
|
186
189
|
field_archive = find_field_in_conf_file(field.ucd.value())
|
187
190
|
field_ucd = field_archive['ucd']
|
188
|
-
if infer_access_ref and col_count ==
|
189
|
-
|
191
|
+
if options[:infer_access_ref] and col_count == access_ref_index
|
192
|
+
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
190
193
|
else
|
191
194
|
thead << "<th>#{field_archive['name']}</th>\n"
|
192
195
|
if field_ucd != 'nil'
|
193
|
-
|
196
|
+
thead_2row.push(field_ucd)
|
194
197
|
else
|
195
|
-
|
198
|
+
thead_2row.push(' ')
|
196
199
|
end
|
197
200
|
end
|
198
201
|
col_count += 1
|
199
202
|
end
|
203
|
+
|
200
204
|
thead << " </tr>\n"
|
201
|
-
|
205
|
+
|
202
206
|
thead << "<tr>\n"
|
203
|
-
|
207
|
+
thead_2row.each do |h|
|
204
208
|
thead << "<th>#{h}</th>\n"
|
205
209
|
end
|
206
210
|
thead << "</tr>\n"
|
207
|
-
|
211
|
+
|
208
212
|
thead << "</thead>"
|
209
|
-
|
213
|
+
|
210
214
|
return thead
|
211
215
|
end
|
212
|
-
|
213
|
-
|
214
|
-
|
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
|
-
|
216
|
+
|
217
|
+
# Creates the cart parameters
|
218
|
+
# [_cart_params:_]
|
219
|
+
#
|
220
|
+
# [_columns:_]
|
221
|
+
#
|
222
|
+
def create_item_cart_params(cart_params, columns)
|
223
|
+
link_ref_array = []
|
224
|
+
|
225
|
+
cart_params.each do |key, value|
|
226
|
+
link_ref_array.push("#{key}=#{value}")
|
227
|
+
end
|
228
|
+
|
229
|
+
access_ref_index = image_access_reference_columns()
|
230
|
+
link_ref_array.push("resource=#{CGI.escape(columns[access_ref_index].value).to_s}") if access_ref_index
|
231
|
+
ra_index = image_ra_columns()
|
232
|
+
link_ref_array.push("rac=#{columns[ra_index].value.to_s}") if ra_index
|
233
|
+
dec_index = image_dec_columns()
|
234
|
+
link_ref_array.push("decc=#{columns[dec_index].value.to_s}") if dec_index
|
235
|
+
filter_index = image_filter_columns()
|
236
|
+
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
237
|
+
date_obs_index = image_date_obs_columns()
|
238
|
+
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
239
|
+
teles_index = image_telescope_columns()
|
240
|
+
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
241
|
+
survey_index = image_survey_columns()
|
242
|
+
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
243
|
+
instrum_index = image_instrument_columns()
|
244
|
+
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
245
|
+
sky_index = image_sky_columns()
|
246
|
+
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
247
|
+
zerop_index = image_zeropoint_columns()
|
248
|
+
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
249
|
+
seeing_index = image_seeing_columns()
|
250
|
+
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
251
|
+
depth_index = image_depth_columns()
|
252
|
+
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
253
|
+
exptime_index = image_exptime_columns()
|
254
|
+
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
255
|
+
|
256
|
+
return link_ref_array.join('&')
|
242
257
|
end
|
243
|
-
|
258
|
+
|
244
259
|
# Create body for HTML table
|
245
|
-
# [
|
246
|
-
# The resource from which to extract the table in question.
|
247
|
-
# [_tbl_:]
|
248
|
-
# The table inside the resource from which to extract the rows in question.
|
249
|
-
# [_infer_add_to_cart_ref_:]
|
250
|
-
#
|
251
|
-
# [_add_to_cart_link_value_:]
|
252
|
-
#
|
253
|
-
# [_add_to_cart_link_ref_:]
|
254
|
-
#
|
255
|
-
# [_infer_access_ref_:]
|
256
|
-
# Link the access reference URL associated with a row.
|
257
|
-
# [_access_ref_link_value_:]
|
258
|
-
# For the access reference column, link this word.
|
259
|
-
# [_access_ref_col_:]
|
260
|
+
# [_access_ref_index_:]
|
260
261
|
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
261
|
-
# [
|
262
|
-
#
|
263
|
-
|
264
|
-
|
265
|
-
def create_body(res, tbl,
|
266
|
-
infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
|
267
|
-
infer_access_ref, access_ref_link_value, access_ref_col,
|
268
|
-
body_class, row_classes)
|
269
|
-
|
270
|
-
tbody = "<tbody class=\"#{body_class}\">\n"
|
262
|
+
# [_options_:]
|
263
|
+
#
|
264
|
+
def create_body(access_ref_index, options)
|
265
|
+
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
271
266
|
row_count = 0
|
272
|
-
rows(res, tbl)
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
267
|
+
rows_data = rows(options[:res], options[:tbl])
|
268
|
+
if rows_data
|
269
|
+
rows_data.each do |tr|
|
270
|
+
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
271
|
+
|
272
|
+
# Specially mark up the first column to link to the image.
|
273
|
+
columns = tr.tds()
|
274
|
+
|
275
|
+
if options[:infer_add_to_cart_ref] and access_ref_index
|
276
|
+
tbody << "<td><input type=\"checkbox\" " +
|
277
|
+
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
278
|
+
"value=\"#{create_item_cart_params(options[:cart_params], columns)}\"/></td>\n"
|
279
|
+
end
|
280
|
+
|
281
|
+
if options[:infer_access_ref] and access_ref_index
|
282
|
+
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
283
|
+
end
|
284
|
+
|
285
|
+
col_count = 0
|
286
|
+
#ra_index = image_ra_columns()
|
287
|
+
#dec_index = image_dec_columns()
|
288
|
+
columns.each do |td|
|
289
|
+
if col_count != access_ref_index
|
290
|
+
#if ra_index and col_count == ra_index
|
291
|
+
# tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
292
|
+
#elsif dec_index and col_count == dec_index
|
293
|
+
# tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
294
|
+
#else
|
295
|
+
tbody << "<td>#{td.value}</td>\n"
|
296
|
+
#end
|
297
|
+
end
|
298
|
+
col_count += 1
|
299
|
+
end
|
300
|
+
|
301
|
+
tbody << "</tr>\n"
|
302
|
+
row_count += 1
|
300
303
|
end
|
301
|
-
tbody << "</tr>\n"
|
302
|
-
row_count += 1
|
303
304
|
end
|
304
305
|
tbody << "</tbody>"
|
305
|
-
|
306
|
+
|
306
307
|
return tbody
|
307
308
|
end
|
308
|
-
|
309
|
+
|
309
310
|
# Convert the specified table in the specified resource into an HTML
|
310
311
|
# table.
|
311
|
-
# [
|
312
|
-
# The
|
313
|
-
|
314
|
-
|
315
|
-
|
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
|
-
|
312
|
+
# [_options_:]
|
313
|
+
# The options for this VOTable.
|
314
|
+
def to_html(options={})
|
315
|
+
# The ID to assign to the HTML table as a whole.
|
316
|
+
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
317
|
+
|
318
|
+
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
319
|
+
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
320
|
+
options[:cart_params] = {} if options[:cart_params] == nil
|
321
|
+
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
322
|
+
|
323
|
+
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
324
|
+
options[:throbber_size] = options[:throbber_size] || '16x16'
|
325
|
+
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
326
|
+
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
327
|
+
|
328
|
+
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
329
|
+
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
330
|
+
|
331
|
+
# Link the access reference URL associated with a row.
|
332
|
+
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
333
|
+
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
334
|
+
# For the access reference column, place this value in the header.
|
335
|
+
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
336
|
+
# For the access reference column, link this word.
|
337
|
+
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
338
|
+
options[:ssl] = false if options[:ssl] == nil
|
339
|
+
#options[:resource_link] = options[:resource_link]
|
340
|
+
|
341
|
+
# The resource from which to extract the table in question.
|
342
|
+
options[:res] = options[:res] || 0
|
343
|
+
# The table inside the resource from which to extract the rows in question.
|
344
|
+
options[:tbl] = options[:tbl] || 0
|
345
|
+
|
346
|
+
# The boolean value to show HTML table border
|
347
|
+
options[:show_border] = false if options[:show_border] == nil
|
348
|
+
# The class to assign the HTML table as a whole.
|
349
|
+
options[:table_class] = options[:table_class] || 'votable'
|
350
|
+
# The class to assign the header of the HTML table.
|
351
|
+
options[:header_class] = options[:header_class] || 'header'
|
352
|
+
# The class to assign the body of the HTML table.
|
353
|
+
options[:body_class] = options[:body_class] || 'body'
|
354
|
+
# The class to assign the HTML table body rows.
|
355
|
+
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
356
|
+
|
353
357
|
begin
|
354
358
|
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
infer_access_ref, access_ref_header_value, access_ref_col,
|
362
|
-
header_class, id)
|
363
|
-
|
364
|
-
# Create body
|
365
|
-
tbody = create_body(res, tbl,
|
366
|
-
infer_add_to_cart_ref, add_to_cart_link_value, add_to_cart_link_ref,
|
367
|
-
infer_access_ref, access_ref_link_value, access_ref_col,
|
368
|
-
body_class, row_classes)
|
369
|
-
|
370
|
-
return create_table(id, show_border, table_class, thead, tbody)
|
371
|
-
else
|
372
|
-
title = 'No Data'
|
373
|
-
message = 'VOTable not contains data.'
|
374
|
-
return create_message_table(table_class, header_class,
|
375
|
-
body_class, row_classes, title, message)
|
376
|
-
end
|
377
|
-
|
359
|
+
access_ref_index = image_access_reference_columns()
|
360
|
+
|
361
|
+
return create_votable(create_headers(access_ref_index, options),
|
362
|
+
create_body(access_ref_index, options),
|
363
|
+
options)
|
364
|
+
|
378
365
|
rescue Exception => e
|
379
|
-
title = 'Error'
|
380
|
-
message =
|
381
|
-
|
382
|
-
|
366
|
+
title = 'Error...'
|
367
|
+
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
368
|
+
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
369
|
+
create_message(title, message, options)
|
383
370
|
end
|
384
371
|
end
|
385
|
-
|
372
|
+
|
386
373
|
end
|
387
374
|
end
|
388
|
-
|
375
|
+
|
389
376
|
end
|
390
377
|
end
|