forked from OpenLinkSoftware/fct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
facet.vsp
366 lines (308 loc) · 11.8 KB
/
facet.vsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
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
300
301
302
303
304
305
306
307
308
309
310
311
312
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Precision Search & Find</title>
<?vsp
declare main_ss varchar;
declare val_vad_present int;
declare val_serviceId, pageUrl, query_str varchar;
declare val_auth_method integer;
--main_ss := registry_get('css/bootstrap5.css');
main_ss := registry_get ('fct_main_ss');
if (not isstring (main_ss)) main_ss := 'css/default.css';
val_vad_present := 0;
if (VAD_CHECK_VERSION ('VAL') is not null)
val_vad_present := 1;
-- Construct the full request URL for return from a VAL login dialog, noting all the request parameters.
-- http_request_get('QUERY_STRING') isn't used as it doesn't include any params in the body of a POST request.
pageUrl := http_path();
query_str := '';
for (declare i, j, l int, i := 0, j := 1, l := length (params); i < l; i := i + 2)
{
if (params[i] <> 'Content')
{
declare k,v varchar;
if (j > 1)
query_str := query_str || '&';
k := params[i];
v := sprintf ('%U', params[i+1]);
query_str := query_str || k || '=' || v;
j := j + 1;
}
}
if (length (query_str))
pageUrl := pageUrl || '?' || query_str;
if (val_vad_present)
FCT.DBA.check_auth (val_serviceId, val_auth_method);
?>
<link rel="stylesheet" type="text/css" href="<?=main_ss?>" charset="utf-8" />
<?vsp
fct_gen_opensearch_link();
?>
<script type="text/javascript" src="/fct/js/popper.min.js"></script>
<link href="css/bootstrap5.css" rel="stylesheet">
<link href="css/fct-only.css" rel="stylesheet">
<script type="text/javascript" >
var featureList=["map", "combolist", "ajax", "tab", "json", "location"];
</script>
<!--<script type="text/javascript" src="/fct/js/jquery-3.6.3.min.js"></script>-->
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script type="text/javascript" src="/fct/oat/toolkit/loader.js"></script>
<script type="text/javascript" src="/fct/js/facet.js"></script>
<script type="text/javascript" src="/fct/js/jquery-ui-1.13.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="/fct/css/jquery-ui-1.13.2.min.css" />
<link rel="stylesheet" type="text/css" href="fontawesome/css/all.min.css">
<script type="text/javascript" src="js/bootstrap5.min.js"></script>
<script type="text/javascript" src="/fct/js/tooltip.js"></script>
<?vsp
declare sid, _S, ses_parms varchar;
b3s_handle_ses (path, lines, params);
sid := connection_get ('sid');
declare dbg_out any;
declare dbg_mode varchar;
declare dbg_lvl int;
dbg_mode := registry_get ('fct_dbg_mode');
dbg_lvl := registry_get ('fct_dbg_lvl');
if (not isstring (dbg_lvl))
dbg_lvl := http_param ('dbg');
if (not isstring (dbg_lvl))
dbg_lvl := 0;
else
dbg_lvl := atoi (dbg_lvl);
connection_set ('fct_dbg_lvl', dbg_lvl);
if (not isstring(dbg_mode))
dbg_mode := http_param ('dbg_mode');
if (not isstring (dbg_mode))
dbg_mode := 'page';
connection_set ('fct_dbg_mode', dbg_mode);
if (dbg_mode = 'page')
{
dbg_out := string_output();
connection_set ('__fct_dbg_out', dbg_out);
}
-- dbg_obj_print (path);
-- dbg_obj_print (lines);
?>
</head>
<body>
<div id="PG">
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div id="hd-container" class="container">
<div id="HD">
<?vsp fct_page_head (); ?>
<div id="hd_r">
<div id="val_login_status">
<?include rdfdesc/fct_val_login_status.vsp ?>
</div>
</div>
<ul id="main_menu">
<li>
<a id="hd_about" type="button" class="desc_permalink" data-bs-toggle="modal" data-bs-target="#infoModal" style:"color:black !important;">About</a>
</li>
</ul>
</div><!-- #HD -->
</div>
</div>
<img id="qrcode_thumb" alt="QRcode icon" src="/fct/images/qr_thumb.png"/>
<div id="qrcode_popup" title="QRCode" style="display:none">
<div id="qrcode">
<img id="qrcode_img" style="height:120px; width:120px;" alt="" src=""/>
</div>
</div>
<div id="MD" class="fct-md container">
<!-- Modal -->
<div class="modal fade" id="infoModal" tabindex="-1" aria-labelledby="infoModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="infoModalLabel">About This Virtuoso Faceted Browser Instance</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="gen-info">
</div>
Faceted Search & Find service v<?vsp http(DB.DBA.VAD_CHECK_VERSION('fct')); ?> as of <?V fct_build_info () ?><br/><br/>
<?vsp fct_virt_info (); ?><br />
<?vsp
declare license_text varchar;
license_text := registry_get ('fct_license_text');
if (license_text) {
http(license_text);
}
?>
<br/>
Data on this page belongs to its respective rights holders.<br/><br/>
Virtuoso Faceted Browser Copyright © 2009-<?V "LEFT" (datestring (now ()), 4)?> OpenLink Software
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- End Modal -->
<?vsp
--
--
-- $Id$
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2021 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
-- dbg_obj_print (http_param ('cmd'));
-- dbg_obj_print (http_param ('search_for'));
-- dbg_obj_print (http_request_header ());
-- dbg_obj_print (params);
declare cmd varchar;
declare langs any;
cmd := http_param ('cmd');
langs := http_request_header_full (lines, 'Accept-Language', 'en');
connection_set ('langs', langs);
if ('load' = cmd)
{
declare _fsq_id int;
declare _sid int;
_fsq_id := http_param ('fsq_id');
if (_fsq_id)
{
_sid := fct_load (_fsq_id);
if (_sid is not null)
{
http_rewrite ();
http_request_status ('HTTP/1.1 302 Found');
http_header (sprintf ('Location: /fct/facet.vsp?sid=%d&cmd=refresh\r\n', _sid));
goto load_redir;
}
}
}
declare sq varchar;
sq := connection_get ('sparql_query');
declare exit handler for sqlstate '*'
{
commit work;
declare _state, _out any;
declare _xmlser varchar;
if (isstring (http_param ('sid')))
select fct_state into _state from fct_state where fct_sid = http_param ('sid');
else
_state := null;
_out := string_output();
http_value (_state, 0, _out);
_xmlser := string_output_string (_out);
http('<div class="error_msg dlg">\n');
http(' <div class="title"><h2>Error</h2></div>\n');
http(' <div class="body">');
http('<p>Could not process your request because of an unexpected error.</p>');
http(' </div>\n');
http(' <div class="diag">\n');
http(' <h3>Diagnostics</h3>\n');
http(sprintf ('<pre class="sqlstate">SQLSTATE: %s</pre><br/>\n', __SQL_STATE));
http(sprintf ('<pre class="sqlmsg">SQLMSG : %s</pre><br/>\n', __SQL_MESSAGE));
http('<a href="#" id="err_det_toggle" onclick="javascript: OAT.Dom.show (err_details);">More info…</a>');
http(' <div id="err_details" style="display:none">');
if (connection_get ('sparql_query') is not null)
{
http('<pre class="sparqlqry">SPARQL:\n');
http_value(connection_get ('sparql_query'));
http('</pre><br/>\n');
}
http(sprintf ('<p><a href="/fct/facet.vsp?qxml=%U" title="Permalink">Permalink</a></p>', _xmlser));
commit work;
insert into fct_log (fl_sid, fl_cli_ip, fl_state, fl_where, fl_cmd, fl_sqlstate, fl_sqlmsg, fl_parms)
values (http_param('sid'),
http_client_ip (),
_state,
'ERR_HANDLER',
http_param('cmd'),
__SQL_STATE,
__SQL_MESSAGE,
serialize(params));
http(' <pre class="facet_state">STATE:\n');
http_value(_xmlser);
http('</pre><br/>');
http(' </div>\n');
http(' </div>\n');
http(' <div class="btn_bar"><button onclick="document.location=''/fct/facet.vsp''">New Search</button></div>\n');
http('</div>\n');
goto footer;
};
fct_vsp ();
-- val is installed and no user and no result, consider to login first
if (0 and val_vad_present and connection_get ('noresult') = 1 and val_serviceId is null or val_serviceId = 'nobody')
{
http_rewrite ();
http_request_status ('HTTP/1.1 302 Found');
http_header (sprintf ('Location: /fct/login.vsp?returnto=%U\r\n', fct_make_curie (pageUrl, lines)));
return;
}
footer:;
?>
<?vsp if (dbg_lvl) { ?>
<div class="dbg">
<pre><![CDATA[<?vsp if (sq is not null) http(sq); ?>]]></pre>
<?vsp fct_render_dbg_out ();?>
</div>
<?vsp } ?>
<?vsp fct_cctr(); ?>
</div><!-- #MD -->
<div id="FT">
<!--
<div class="fct_debug_info">
Faceted Search & Find service v<?vsp http(DB.DBA.VAD_CHECK_VERSION('fct')); ?> as of <?V fct_build_info () ?><br/>
<?vsp
if (isstring (registry_get ('fst_hosted'))) { http (registry_get ('fst_hosted')); }
?>
<?vsp fct_virt_info (); ?><br />
</div>
-->
<div id="FT_L"></div>
<div id="FT_R"></div>
<!--<span class="copyright">Data on this page is owned by its respective rights holders.<br/>Virtuoso Faceted Browser Copyright © 2009-<?V "LEFT" (datestring (now ()), 4)?> <a href="www.openlinksw.com">OpenLink Software</a></span> -->
</div>
</div>
</div> <!-- #PG -->
<div id="fct_ft_fm" style="display:none">
<input type="text" name="txt"/>
<button>Set</button>
</div>
<?vsp if (isstring (registry_get ('urchinTracker'))) { ?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("<?V registry_get ('urchinTracker') ?>");
pageTracker._trackPageview();
} catch(err) {}</script>
<?vsp } ?>
<script>
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
</script>
</body>
</html>
<?vsp
load_redir:;
?>