-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
616 lines (600 loc) · 20.1 KB
/
Copy pathindex.html
File metadata and controls
616 lines (600 loc) · 20.1 KB
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CDI Data Viewer & Editor</title>
<!-- Favicon -->
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<!-- External CSS -->
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="css/cdi-preview.css" />
<!-- External JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- CDI Viewer Application (ES6 modules with SHACL + SPARQL validation) -->
<script src="dist/cdi-viewer.bundle.js"></script>
</head>
<body>
<!-- Toolbar -->
<div
class="toolbar"
style="
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
gap: 0px;
"
>
<!-- Fragment wrapper to group toolbar sections -->
<div style="flex: 1 1 auto; min-width: min(100%, 600px)">
<!-- Controls buttons -->
<div
style="
margin-bottom: 5px;
display: flex;
flex-wrap: wrap;
gap: 5px;
align-items: center;
"
>
<button id="toggle-edit-btn" class="btn btn-primary">
<span class="glyphicon glyphicon-edit"></span> Enable Editing
</button>
<button id="save-btn" class="btn btn-success hidden">
<span class="glyphicon glyphicon-floppy-disk"></span> Save to
Dataverse
</button>
<button id="export-btn" class="btn btn-success">
<span class="glyphicon glyphicon-download-alt"></span> Export
JSON-LD
</button>
<button id="collapse-all-btn" class="btn btn-default">
<span class="glyphicon glyphicon-collapse-up"></span> Collapse All
</button>
<button id="expand-all-btn" class="btn btn-default">
<span class="glyphicon glyphicon-expand"></span> Expand All
</button>
<span id="validation-status"></span>
</div>
<!-- Loading buttons -->
<div
style="
margin-bottom: 5px;
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
"
>
<input
type="file"
id="local-file-input"
accept="application/ld+json,application/json,.json,.jsonld"
style="display: none"
/>
<button
id="load-local-btn"
class="btn btn-primary"
style="display: none"
title="Load a CDI JSON-LD file from your computer"
>
<span class="glyphicon glyphicon-folder-open"></span> Load Local
File
</button>
<button
id="load-dataverse-btn"
class="btn btn-primary"
style="display: none"
title="Load a file from Dataverse using a URL"
>
<span class="glyphicon glyphicon-cloud-download"></span> Load from
Dataverse
</button>
<label for="shape-selector" style="margin: 0; white-space: nowrap"
>SHACL Shape:</label
>
<select id="shape-selector" class="form-control" style="width: 300px">
<option value="" selected>-- Select SHACL shapes --</option>
<option value="ddi-cdi-official">DDI-CDI 1.0 (Official)</option>
<option value="cdif-core">CDIF Discovery Core</option>
<option value="croissant">Croissant 1.0 + CDIF Discovery</option>
<option value="dcat-ap">DCAT-AP 3.0</option>
<option value="datacube">W3C DataCube</option>
<option value="skos">
SKOS (Simple Knowledge Organization System)
</option>
<option value="local-fallback">DDI-CDI Local Built-in</option>
<option value="custom">Custom URL...</option>
</select>
<input
type="text"
id="custom-shape-url"
class="form-control"
placeholder="Enter SHACL shape URL"
style="width: 300px; display: none"
/>
</div>
</div>
<!-- Enhanced Search Controls -->
<div style="flex: 0 1 auto; min-width: min(100%, 450px)">
<div
style="margin-left: auto; display: flex; align-items: left; gap: 5px"
>
<div style="position: relative">
<input
type="text"
id="search-input"
class="form-control"
placeholder="Search nodes and properties..."
style="width: 300px; padding-right: 30px"
/>
<button
id="clear-search-btn"
title="Clear search"
style="
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: #999;
cursor: pointer;
padding: 0;
display: none;
font-size: 16px;
"
>
<span class="glyphicon glyphicon-remove"></span>
</button>
</div>
<button
id="toggle-case-btn"
class="btn btn-default btn-sm"
title="Toggle case-sensitive search"
style="min-width: 40px"
>
<strong>Aa</strong>
</button>
<button
id="toggle-regex-btn"
class="btn btn-default btn-sm"
title="Toggle regex search"
style="min-width: 40px"
>
<strong>.*</strong>
</button>
<button
id="prev-match-btn"
class="btn btn-default btn-sm"
title="Previous match (Shift+F3)"
disabled
>
<span class="glyphicon glyphicon-chevron-up"></span>
</button>
<button
id="next-match-btn"
class="btn btn-default btn-sm"
title="Next match (F3 or Enter)"
disabled
>
<span class="glyphicon glyphicon-chevron-down"></span>
</button>
<span
id="search-counter"
aria-live="polite"
style="
font-size: 12px;
color: #6c757d;
min-width: 80px;
text-align: center;
"
></span>
</div>
<div>
<div
style="
margin-top: 8px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
width: 100%;
"
>
<div
style="
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 5px;
flex: 1;
"
>
<label style="font-size: 12px; color: #6c757d; margin: 0"
>Search in:</label
>
<label style="font-size: 12px; margin: 0; white-space: nowrap">
<input
type="checkbox"
class="search-scope-checkbox"
value="names"
checked
/>
Names
</label>
<label style="font-size: 12px; margin: 0; white-space: nowrap">
<input
type="checkbox"
class="search-scope-checkbox"
value="values"
checked
/>
Values
</label>
<label style="font-size: 12px; margin: 0; white-space: nowrap">
<input
type="checkbox"
class="search-scope-checkbox"
value="ids"
checked
/>
IDs
</label>
<label style="font-size: 12px; margin: 0; white-space: nowrap">
<input
type="checkbox"
class="search-scope-checkbox"
value="types"
checked
/>
Types
</label>
<label style="font-size: 12px; margin: 0; white-space: nowrap">
<input
type="checkbox"
class="search-scope-checkbox"
value="badges"
checked
/>
Badges
</label>
<!-- Auto-jump toggle (off by default) -->
<label
style="
font-size: 12px;
margin: 0;
white-space: nowrap;
margin-left: 45px;
"
>
<input type="checkbox" id="auto-jump-toggle" />
Auto-jump
</label>
</div>
</div>
</div>
</div>
<!-- Validation Details Panel (at bottom of toolbar) -->
<div
id="validation-details"
style="
max-height: 150px;
overflow-y: auto;
flex-basis: 100%;
width: 100%;
"
></div>
</div>
<!-- Namespace Management Section -->
<div id="namespace-section" style="margin-bottom: 20px; display: none">
<div
style="
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 4px;
padding: 15px;
"
>
<div
style="
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
"
>
<h4 style="margin: 0; font-size: 16px">
<span class="glyphicon glyphicon-tag"></span> Namespace Prefixes
</h4>
<div>
<button
id="add-namespace-btn"
class="btn btn-sm btn-success hidden"
>
<span class="glyphicon glyphicon-plus"></span> Add Namespace
</button>
<button id="toggle-namespace-btn" class="btn btn-sm btn-default">
<span class="glyphicon glyphicon-chevron-up"></span> Collapse
</button>
</div>
</div>
<div id="namespace-content">
<table
class="table table-condensed table-bordered"
style="margin-bottom: 0; background: white"
>
<thead>
<tr>
<th style="width: 150px">Prefix</th>
<th>Namespace URI</th>
<th style="width: 80px; text-align: center">Actions</th>
</tr>
</thead>
<tbody id="namespace-table-body">
<tr>
<td colspan="3" style="text-align: center; color: #999">
<em
>No namespaces defined. Load a file or create a new
document.</em
>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Content Area -->
<div id="content"></div>
<!-- Add Root Node Component (at bottom of form) -->
<div
id="add-root-node-container"
style="margin-top: 20px; padding: 15px; border-top: 2px solid #ddd"
class="hidden"
>
<!-- Unified add component will be rendered here -->
</div>
<!-- Load from Dataverse Modal -->
<div class="modal fade" id="loadDataverseModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span class="glyphicon glyphicon-cloud-download"></span>
Load File from Dataverse
</h4>
</div>
<div class="modal-body">
<!-- File URL Input -->
<div class="form-group">
<label for="loadDataverseUrlInput">Dataverse File URL:</label>
<input
type="text"
class="form-control"
id="loadDataverseUrlInput"
placeholder="https://demo.dataverse.org/file.xhtml?fileId=..."
/>
<small class="help-block">
Enter a URL to a file in Dataverse (JSF, SPA, or API format).
The file will be downloaded and loaded into the editor.
</small>
<div id="loadUrlValidationFeedback" style="margin-top: 5px"></div>
</div>
<!-- API Token Input (Optional) -->
<div class="form-group">
<label for="loadApiTokenInput">API Token (Optional):</label>
<input
type="password"
class="form-control"
id="loadApiTokenInput"
placeholder="Only needed for unpublished files"
/>
<small class="help-block">
Leave empty for published files. Required for draft/unpublished
files.
</small>
</div>
<div class="alert alert-info">
<strong>Supported URL formats:</strong>
<ul style="margin-bottom: 0">
<li>JSF: <code>file.xhtml?fileId=...</code></li>
<li>SPA: <code>spa/files?id=...</code></li>
<li>
API: <code>/api/files/123</code> or
<code>/api/access/datafile/123</code>
</li>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
<button
type="button"
class="btn btn-primary"
id="confirmLoadBtn"
disabled
>
<span class="glyphicon glyphicon-download"></span> Load File
</button>
</div>
</div>
</div>
</div>
<!-- Save to Dataverse Modal -->
<div class="modal fade" id="saveModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span class="glyphicon glyphicon-cloud-upload"></span>
Save to Dataverse
</h4>
</div>
<div class="modal-body">
<!-- URL Input (Standalone mode only) -->
<div
class="form-group"
id="dataverseUrlGroup"
style="display: none"
>
<label for="dataverseUrlInput">Dataverse URL:</label>
<input
type="text"
class="form-control"
id="dataverseUrlInput"
placeholder="https://demo.dataverse.org/dataset.xhtml?persistentId=doi:10.../..."
/>
<small class="help-block">
Enter a Dataverse dataset URL (to add new file) or file URL (to
replace existing file)
</small>
<div id="urlValidationFeedback" style="margin-top: 5px"></div>
</div>
<!-- Filename Input -->
<div class="form-group">
<label for="filenameInput">Filename:</label>
<input
type="text"
class="form-control"
id="filenameInput"
placeholder="metadata.jsonld"
/>
<small class="help-block">
The filename for your JSON-LD file in Dataverse
</small>
</div>
<!-- API Token Input -->
<div class="form-group">
<label for="apiTokenInput">Dataverse API Token:</label>
<input
type="password"
class="form-control"
id="apiTokenInput"
placeholder="Enter your API token"
/>
<small class="help-block">
You can create an API token in Dataverse under your account
settings.
<a
href="https://guides.dataverse.org/en/latest/api/auth.html"
target="_blank"
>Learn more</a
>
</small>
</div>
<!-- Info Alert -->
<div class="alert alert-info">
<strong>What will be saved:</strong>
<ul>
<li>All property changes you've made</li>
<li>New properties you've added</li>
<li>Deleted properties (will be removed)</li>
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
<button
type="button"
class="btn btn-primary"
id="confirmSaveBtn"
disabled
>
<span class="glyphicon glyphicon-floppy-disk"></span> Save to
Dataverse
</button>
</div>
</div>
</div>
</div>
<!-- Add/Edit Namespace Modal -->
<div class="modal fade" id="namespaceModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
<span class="glyphicon glyphicon-tag"></span> Add Namespace Prefix
</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="namespacePrefixInput"><strong>Prefix:</strong></label>
<input
type="text"
class="form-control"
id="namespacePrefixInput"
placeholder="e.g., schema, dcat, myorg"
pattern="[a-zA-Z][a-zA-Z0-9_\-]*"
/>
<small class="help-block"
>Letters, numbers, hyphens, and underscores only. Must start
with a letter.</small
>
</div>
<div class="form-group">
<label for="namespaceUriInput"
><strong>Namespace URI:</strong></label
>
<input
type="url"
class="form-control"
id="namespaceUriInput"
placeholder="e.g., http://schema.org/, https://www.w3.org/ns/dcat#"
/>
<small class="help-block"
>Full URI including protocol (http:// or https://)</small
>
</div>
<div id="namespaceValidationFeedback"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
<button
type="button"
class="btn btn-primary"
id="confirmNamespaceBtn"
>
<span class="glyphicon glyphicon-ok"></span> Add Namespace
</button>
</div>
</div>
</div>
</div>
</body>
</html>