OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
javascript.h
Go to the documentation of this file.
1
2
// Automatically generated file. DO NOT EDIT!
3
// Edit www.js instead.
4
5
const
string
java_code
=
"\n\
6
// $Id$\n\
7
\n\
8
var reflection_cgi = \"http://unidata.ucar.edu/cgi-bin/dods/posturl.pl\";\n\
9
\n\
10
// Event handlers for the disposition button.\n\
11
\n\
12
// The ascii_button handler sends data to a new window. The user can then \n\
13
// save the data to a file.\n\
14
\n\
15
function ascii_button() {\n\
16
var url = new String(document.forms[0].url.value);\n\
17
\n\
18
var url_parts = url.split(\"?\");\n\
19
/* handle case where constraint is null. */\n\
20
if (url_parts[1] != null) {\n\
21
var ascii_url = url_parts[0] + \".ascii?\" + url_parts[1];\n\
22
}\n\
23
else {\n\
24
var ascii_url = url_parts[0] + \".ascii?\";\n\
25
}\n\
26
\n\
27
window.open(ascii_url, \"ASCII_Data\");\n\
28
}\n\
29
\n\
30
/* The netcdf_button handler loads the data to the current window. Since it \n\
31
is netcdf/binary, Netscape will ask the user for a filename and save the data\n\
32
to that file. The parameter 'ext' should be 'nc'. */\n\
33
\n\
34
function netcdf_button(ext) {\n\
35
var url = new String(document.forms[0].url.value);\n\
36
\n\
37
var url_parts = url.split(\"?\");\n\
38
/* handle case where constraint is null. */\n\
39
if (url_parts[1] != null) {\n\
40
var binary_url = url_parts[0] + \".\" + ext + \"?\" + url_parts[1];\n\
41
}\n\
42
else {\n\
43
var binary_url = url_parts[0] + \".\" + ext + \"?\";\n\
44
}\n\
45
\n\
46
window.location = binary_url;\n\
47
}\n\
48
\n\
49
/* The binary_button handler loads the data to the current window. Since it \n\
50
is binary, Netscape will ask the user for a filename and save the data\n\
51
to that file. */\n\
52
\n\
53
function binary_button(ext) {\n\
54
var url = new String(document.forms[0].url.value);\n\
55
\n\
56
var url_parts = url.split(\"?\");\n\
57
/* handle case where constraint is null. */\n\
58
if (url_parts[1] != null) {\n\
59
var binary_url = url_parts[0] + \".\" + ext + \"?\" + url_parts[1];\n\
60
}\n\
61
else {\n\
62
var binary_url = url_parts[0] + \".\" + ext + \"?\";\n\
63
}\n\
64
\n\
65
window.location = binary_url;\n\
66
}\n\
67
\n\
68
/* Route the URL to Matlab, IDL, .... Users must add an entry into their mime\n\
69
types file (aka list of Netscape helper applications) so that the URL will\n\
70
be fedd into Matlab which must, in addition, be running loaddods.\n\
71
\n\
72
Note that reflection_cgi is a global JavaScript variable set at the \n\
73
begining of this `file'. \n\
74
\n\
75
DEPRECATED */\n\
76
\n\
77
function program_button() {\n\
78
var program_url = new String(document.forms[0].url.value);\n\
79
\n\
80
/* Build a call to the reflector CGI. */\n\
81
var CGI = reflection_cgi + \"?\" + \"url=\" + program_url + \"&disposition=matlab\";\n\
82
\n\
83
window.location = CGI;\n\
84
}\n\
85
\n\
86
var help = 0; // Our friend, the help window.\n\
87
\n\
88
function help_button() {\n\
89
// Check the global to keep from opening the window again if it is\n\
90
// already visible. I think Netscape handles this but I know it will\n\
91
// write the contents over and over again. This preents that, too.\n\
92
// 10/8/99 jhrg\n\
93
if (help && !help.closed)\n\
94
return;\n\
95
\n\
96
// Resize on Netscape 4 is hosed. When enabled, if a user resizes then\n\
97
// the root window's document gets reloaded. This does not happen on IE5.\n\
98
// regardless, with scrollbars we don't absolutely need to be able to\n\
99
// resize. 10/8/99 jhrg\n\
100
help = window.open(\"http://www.opendap.org/online_help_files/opendap_form_help.html\",\n\
101
\"help\", \"scrollbars,dependent,width=600,height=400\");\n\
102
}\n\
103
\n\
104
//function open_dods_home() {\n\
105
// window.open(\"http://www.opendap.org/\", \"DODS_HOME_PAGE\");\n\
106
//}\n\
107
\n\
108
\n\
109
// Helper functions for the form.\n\
110
\n\
111
function describe_index() {\n\
112
window.status = \"Enter start, stride and stop for the array dimension.\";\n\
113
return true;\n\
114
}\n\
115
\n\
116
function describe_selection() {\n\
117
window.status = \"Enter a relational expression (e.g., <20). String variables may need values to be quoted\";\n\
118
return true;\n\
119
}\n\
120
\n\
121
function describe_operator() {\n\
122
window.status = \"Choose a relational operator. Use - to enter a function name).\";\n\
123
return true;\n\
124
}\n\
125
\n\
126
function describe_projection() {\n\
127
window.status = \"Add this variable to the projection.\";\n\
128
return true;\n\
129
}\n\
130
\n\
132
// The dods_url object.\n\
134
\n\
135
// CTOR for dods_url\n\
136
// Create the DODS URL object.\n\
137
function dods_url(base_url) {\n\
138
this.url = base_url;\n\
139
this.projection = \"\";\n\
140
this.selection = \"\";\n\
141
this.num_dods_vars = 0;\n\
142
this.dods_vars = new Array();\n\
143
\n\
144
this.build_constraint = build_constraint;\n\
145
this.add_dods_var = add_dods_var;\n\
146
this.update_url = update_url;\n\
147
}\n\
148
\n\
149
// Method of dods_url\n\
150
// Add the projection and selection to the displayed URL.\n\
151
function update_url() {\n\
152
this.build_constraint();\n\
153
var url_text = this.url;\n\
154
// Only add the projection & selection (and ?) if there really are\n\
155
// constraints! \n\
156
if (this.projection.length + this.selection.length > 0)\n\
157
url_text += \"?\" + this.projection + this.selection;\n\
158
document.forms[0].url.value = url_text;\n\
159
}\n\
160
\n\
161
// Method of dods_url\n\
162
// Scan all the form elements and pick out the various pieces of constraint\n\
163
// information. Add these to the dods_url instance.\n\
164
function build_constraint() {\n\
165
var p = \"\";\n\
166
var s = \"\";\n\
167
for (var i = 0; i < this.num_dods_vars; ++i) {\n\
168
if (this.dods_vars[i].is_projected == 1) {\n\
169
// The comma is a clause separator.\n\
170
if (p.length > 0)\n\
171
p += \",\";\n\
172
p += this.dods_vars[i].get_projection();\n\
173
}\n\
174
var temp_s = this.dods_vars[i].get_selection();\n\
175
if (temp_s.length > 0)\n\
176
s += \"&\" + temp_s; // The ampersand is a prefix to the clause.\n\
177
}\n\
178
\n\
179
this.projection = p;\n\
180
this.selection = s;\n\
181
}\n\
182
\n\
183
// Method of dods_url\n\
184
// Add the variable to the dods_var array of dods_vars. The var_index is the\n\
185
// number of *this particular* variable in the dataset, zero-based.\n\
186
function add_dods_var(dods_var) {\n\
187
this.dods_vars[this.num_dods_vars] = dods_var;\n\
188
this.num_dods_vars++;\n\
189
}\n\
190
\n\
192
// dods_var\n\
194
\n\
195
// CTOR for dods_var\n\
196
// name: the name of the variable from DODS' perspective.\n\
197
// js_var_name: the name of the variable within the form.\n\
198
// is_array: 1 if this is an array, 0 otherwise.\n\
199
function dods_var(name, js_var_name, is_array) {\n\
200
// Common members\n\
201
this.name = name;\n\
202
this.js_var_name = js_var_name;\n\
203
this.is_projected = 0;\n\
204
if (is_array > 0) {\n\
205
this.is_array = 1;\n\
206
this.num_dims = 0; // Holds the number of dimensions\n\
207
this.dims = new Array(); // Holds the length of the dimensions\n\
208
\n\
209
this.add_dim = add_dim;\n\
210
this.display_indices = display_indices;\n\
211
this.erase_indices = erase_indices;\n\
212
}\n\
213
else\n\
214
this.is_array = 0;\n\
215
\n\
216
this.handle_projection_change = handle_projection_change;\n\
217
this.get_projection = get_projection;\n\
218
this.get_selection = get_selection;\n\
219
}\n\
220
\n\
221
// Method of dods_var\n\
222
// Add a dimension to a DODS Array object.\n\
223
function add_dim(dim_size) {\n\
224
this.dims[this.num_dims] = dim_size;\n\
225
this.num_dims++;\n\
226
}\n\
227
\n\
228
// Method of dods_var\n\
229
// Add the array indices to the text widgets associated with this DODS\n\
230
// array object. The text widgets are names <var_name>_0, <var_name>_1, ...\n\
231
// <var_name>_n for an array with size N+1.\n\
232
function display_indices() {\n\
233
for (var i = 0; i < this.num_dims; ++i) {\n\
234
var end_index = this.dims[i]-1;\n\
235
var s = \"0:1:\" + end_index.toString();\n\
236
var text_widget = \"document.forms[0].\" + this.js_var_name + \"_\" + i.toString();\n\
237
eval(text_widget).value = s;\n\
238
}\n\
239
}\n\
240
\n\
241
// Method of dods_var\n\
242
// Use this to remove index information from a DODS array object.\n\
243
function erase_indices() {\n\
244
for (var i = 0; i < this.num_dims; ++i) {\n\
245
var text_widget = \"document.forms[0].\" + this.js_var_name + \"_\" + i.toString();\n\
246
eval(text_widget).value = \"\";\n\
247
}\n\
248
}\n\
249
\n\
250
// Method of dods_var\n\
251
function handle_projection_change(check_box) {\n\
252
if (check_box.checked) {\n\
253
this.is_projected = 1;\n\
254
if (this.is_array == 1)\n\
255
this.display_indices();\n\
256
}\n\
257
else {\n\
258
this.is_projected = 0;\n\
259
if (this.is_array == 1)\n\
260
this.erase_indices();\n\
261
}\n\
262
\n\
263
DODS_URL.update_url();\n\
264
}\n\
265
\n\
266
\n\
267
// Method of dods_var\n\
268
// Get the projection sub-expression for this variable.\n\
269
function get_projection() {\n\
270
var p = \"\";\n\
271
if (this.is_array == 1) {\n\
272
p = this.name; // ***\n\
273
for (var i = 0; i < this.num_dims; ++i) {\n\
274
var text_widget = \"document.forms[0].\" + this.js_var_name + \"_\" + i.toString();\n\
275
p += \"[\" + eval(text_widget).value + \"]\";\n\
276
}\n\
277
}\n\
278
else {\n\
279
p = this.name; // ***\n\
280
}\n\
281
\n\
282
return p;\n\
283
}\n\
284
\n\
285
// Method of dods_var\n\
286
// Get the selection (which is null for arrays).\n\
287
function get_selection() {\n\
288
var s = \"\";\n\
289
if (this.is_array == 1) {\n\
290
return s;\n\
291
}\n\
292
else {\n\
293
var text_widget = \"document.forms[0].\" + this.js_var_name + \"_selection\";\n\
294
if (eval(text_widget).value != \"\") {\n\
295
var oper_widget_name = \"document.forms[0].\" + this.js_var_name + \"_operator\";\n\
296
var oper_widget = eval(oper_widget_name);\n\
297
var operator = oper_widget.options[oper_widget.selectedIndex].value;\n\
298
// If the operator is `-' then don't prepend the variable name!\n\
299
// This provides a way for users to enter function names as\n\
300
// selection clauses. \n\
301
if (operator == \"-\")\n\
302
s = eval(text_widget).value;\n\
303
else\n\
304
s = this.name + operator + eval(text_widget).value; // ***\n\
305
}\n\
306
}\n\
307
\n\
308
return s;\n\
309
} \n\
310
"
;
java_code
const string java_code
Definition:
javascript.h:5
modules
dap-server
www-interface
javascript.h
Generated by
1.8.9.1