Skip to content

Commit 13029fa

Browse files
committed
code and profile updates
1 parent 09da277 commit 13029fa

21 files changed

Lines changed: 870 additions & 766 deletions

builds/bfe.dev.js

Lines changed: 441 additions & 174 deletions
Large diffs are not rendered by default.

static/js/config-dev.js

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646
}
4747

48-
function save(data, csrf, bfelog){
48+
function save(data, csrf, bfelog, callback){
4949
var $messagediv = $('<div>', {id: "bfeditor-messagediv", class:"col-md-10 main"});
5050

5151
var url = "/verso/api/bfs/upsertWithWhere?where=%7B%22name%22%3A%20%22"+data.name+"%22%7D";
@@ -63,17 +63,20 @@
6363
var $messagediv = $('<div>', {id: "bfeditor-messagediv"});
6464
var decimaltranslator = window.ShortUUID("0123456789");
6565
var resourceName = "e" + decimaltranslator.fromUUID(data.name);
66-
$messagediv.append('<div class="alert alert-success"><strong>Record Created:</strong><a href='+data.url+'>'+resourceName+'</a></div>');
66+
$messagediv.append('<div class="alert alert-info"><strong>Description saved:</strong><a href='+data.url+'>'+resourceName+'</a></div>')
6767
$('#bfeditor-formdiv').empty();
6868
$('#save-btn').remove();
69-
$messagediv.insertBefore('#bfeditor-previewPanel');
69+
$messagediv.insertBefore('.nav-tabs');
7070
$('#bfeditor-previewPanel').remove();
71+
$('.nav-tabs a[href="#browse"]').tab('show')
7172
bfeditor.bfestore.store = [];
73+
window.location.hash = "";
74+
callback(true, data.name);
7275
}).fail(function (XMLHttpRequest, textStatus, errorThrown){
7376
bfelog.addMsg(new Error(), "ERROR", "FAILED to save");
7477
bfelog.addMsg(new Error(), "ERROR", "Request status: " + textStatus + "; Error msg: " + errorThrown);
7578
$messagediv.append('<div class="alert alert-danger"><strong>Save Failed:</strong>'+errorThrown+'</span>');
76-
$messagediv.insertBefore('#bfeditor-previewPanel');
79+
$messagediv.insertBefore('.nav-tabs');
7780
}).always(function(){
7881
$('#table_id').DataTable().ajax.reload();
7982
});
@@ -83,7 +86,7 @@
8386
var $messagediv = $('<div>', {id: "bfeditor-messagediv", class:"col-md-10 main"});
8487

8588
//var url = "http://mlvlp04.loc.gov:8201/bibrecs/bfe2mets.xqy";
86-
var url = "http://mlvlp04.loc.gov:3000/profile-edit/server/publish";
89+
var url = config.url + "/profile-edit/server/publish";
8790
var saveurl = "/verso/api/bfs/upsertWithWhere?where=%7B%22name%22%3A%20%22"+savename+"%22%7D";
8891

8992
var savedata = {};
@@ -115,15 +118,15 @@
115118
document.body.scrollTop = document.documentElement.scrollTop = 0;
116119
bfelog.addMsg(new Error(), "INFO", "Published " + publishdata[0].name);
117120
var $messagediv = $('<div>', {id: "bfeditor-messagediv"});
118-
$messagediv.append('<div class="alert alert-info"><strong>Description submitted for posting:</strong><a href=http://mlvlp04.loc.gov:8230/'+publishdata[0].objid+'>'+publishdata[0].id+'</a></div>');
121+
$messagediv.append('<div class="alert alert-info"><strong>Description submitted for posting:</strong><a href=' + config.basedbURI + "/" + publishdata[0].objid+'>'+publishdata[0].lccn+'</a></div>');
119122
$('#bfeditor-formdiv').empty();
120123
$('#save-btn').remove();
121124
$messagediv.insertBefore('.nav-tabs');
122125
$('#bfeditor-previewPanel').remove();
123126
$('.nav-tabs a[href="#browse"]').tab('show')
124127
bfeditor.bfestore.store = [];
125-
callback(true, data.name);
126-
128+
window.location.hash = "";
129+
callback(true, data.name);
127130
}).fail(function (XMLHttpRequest, textStatus, errorThrown){
128131
bfelog.addMsg(new Error(), "ERROR", "FAILED to save");
129132
bfelog.addMsg(new Error(), "ERROR", "Request status: " + textStatus + "; Error msg: " + errorThrown);
@@ -137,7 +140,7 @@
137140

138141
function retrieve(uri, bfestore, loadtemplates, bfelog, callback){
139142

140-
var url = "http://mlvlp04.loc.gov:3000/profile-edit/server/whichrt";
143+
var url = config.url + "/profile-edit/server/whichrt";
141144

142145
$.ajax({
143146
dataType: "json",
@@ -162,6 +165,34 @@
162165
});
163166
}
164167

168+
function retrieveLDS(uri, bfestore, loadtemplates, bfelog, callback){
169+
170+
var url = config.url + "/profile-edit/server/retrieveLDS";
171+
172+
$.ajax({
173+
dataType: "json",
174+
type: "GET",
175+
async: false,
176+
data: { uri: uri},
177+
url: url,
178+
success: function (data) {
179+
bfelog.addMsg(new Error(), "INFO", "Fetched external source baseURI" + url);
180+
bfelog.addMsg(new Error(), "DEBUG", "Source data", data);
181+
bfestore.store = bfestore.jsonldcompacted2store(data, function(expanded) {
182+
bfestore.store = [];
183+
tempstore = bfestore.jsonld2store(expanded);
184+
callback(loadtemplates);
185+
});
186+
//bfestore.n32store(data, url, tempstore, callback);
187+
},
188+
error: function(XMLHttpRequest, textStatus, errorThrown) {
189+
bfelog.addMsg(new Error(), "ERROR", "FAILED to load external source: " + url);
190+
bfelog.addMsg(new Error(), "ERROR", "Request status: " + textStatus + "; Error msg: " + errorThrown);
191+
}
192+
});
193+
}
194+
195+
165196
function deleteId(id, csrf, bfelog){
166197
var url = config.url + "/verso/api/bfs/" + id;
167198

@@ -192,6 +223,7 @@
192223
},*/
193224
"url" : "http://mlvlp04.loc.gov:3000",
194225
"baseURI": "http://id.loc.gov/",
226+
"basedbURI": "http://mlvlp04.loc.gov:8230",
195227
"resourceURI": "http://mlvlp04.loc.gov:8230/resources",
196228
"profiles": [
197229
"static/profiles/bibframe/BIBFRAME 2.0 Agents.json",
@@ -418,6 +450,9 @@
418450
"publish": {
419451
"callback": publish
420452
},
453+
"retrieveLDS": {
454+
"callback":retrieveLDS
455+
},
421456
"retrieve": {
422457
"callback": retrieve
423458
},

static/profiles/bibframe/BIBFRAME 2.0 Agents Contribution.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"profile:bf2:Agent:CorporateBody",
1818
"profile:bf2:Agent:Jurisdiction",
1919
"profile:bf2:Agent:Conference"
20-
]
20+
],
21+
"editable": "true"
2122
},
2223
"propertyURI": "http://id.loc.gov/ontologies/bibframe/agent",
2324
"type": "resource",
@@ -36,7 +37,9 @@
3637
"valueTemplateRefs": [
3738
"profile:bf2:Agent:Role"
3839
],
39-
"useValuesFrom": []
40+
"useValuesFrom": [],
41+
"editable": "true",
42+
"repeatable": "true"
4043
},
4144
"remark": "http://access.rdatoolkit.org/rdaappi_rdai-34.html"
4245
}
@@ -45,7 +48,7 @@
4548
{
4649
"resourceURI": "http://id.loc.gov/ontologies/bibframe/Contribution",
4750
"id": "profile:bf2:Agents:bfContribution",
48-
"resourceLabel": "Contribution",
51+
"resourceLabel": "Contribution (test)",
4952
"propertyTemplates": [
5053
{
5154
"propertyLabel": "Agent",
@@ -83,12 +86,11 @@
8386
}
8487
]
8588
}
86-
8789
],
8890
"id": "profile:bf2:AgentsContribution",
8991
"title": "BIBFRAME 2.0 Agents Contribution",
9092
"date": "2017-05-13",
9193
"description": "Creators and Contributors",
9294
"contact": "NDMSO"
9395
}
94-
}
96+
}

static/profiles/bibframe/BIBFRAME 2.0 Agents Primary Contribution.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"propertyTemplates": [
66
{
77
"mandatory": "false",
8-
"repeatable": "true",
8+
"repeatable": "false",
99
"type": "resource",
1010
"resourceTemplates": [],
1111
"valueConstraint": {
@@ -17,22 +17,24 @@
1717
"profile:bf2:Agent:Conference"
1818
],
1919
"useValuesFrom": [],
20-
"valueDataType": {}
20+
"valueDataType": {},
21+
"repeatable": "false"
2122
},
2223
"propertyURI": "http://id.loc.gov/ontologies/bibframe/agent",
2324
"propertyLabel": "Primary Contributor"
2425
},
2526
{
2627
"mandatory": "false",
27-
"repeatable": "true",
28+
"repeatable": "false",
2829
"type": "resource",
2930
"resourceTemplates": [],
3031
"valueConstraint": {
3132
"valueTemplateRefs": [
3233
"profile:bf2:Agent:Role"
3334
],
3435
"useValuesFrom": [],
35-
"valueDataType": {}
36+
"valueDataType": {},
37+
"repeatable": "false"
3638
},
3739
"propertyURI": "http://id.loc.gov/ontologies/bibframe/role",
3840
"propertyLabel": "Relationship Designator (RDA Appendix I)",
@@ -82,15 +84,14 @@
8284
}
8385
],
8486
"id": "profile:bflc:Agents:bfPrimaryContribution",
85-
"resourceLabel": "Primary Contribution",
87+
"resourceLabel": "Primary Contribution (test)",
8688
"resourceURI": "http://id.loc.gov/ontologies/bflc/PrimaryContribution"
8789
}
88-
8990
],
9091
"contact": "NDMSO",
9192
"id": "profile:bflc:PrimaryContribution",
9293
"title": "BIBFRAME 2.0 Agents Primary Contribution",
9394
"description": "Primary Contribution",
9495
"date": "2017-07-18"
9596
}
96-
}
97+
}

static/profiles/bibframe/BIBFRAME 2.0 Agents.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{
1010
"propertyLabel": "Search LCNAF",
1111
"valueConstraint": {
12-
"repeatable": "false",
12+
"repeatable": "true",
1313
"useValuesFrom": [
1414
"http://id.loc.gov/authorities/names"
1515
],
@@ -199,7 +199,8 @@
199199
],
200200
"valueDataType": {
201201
"dataTypeURI": ""
202-
}
202+
},
203+
"repeatable": "true"
203204
},
204205
"propertyURI": "http://www.loc.gov/mads/rdf/v1#FamilyName",
205206
"type": "lookup",
@@ -427,7 +428,8 @@
427428
],
428429
"valueDataType": {
429430
"dataTypeURI": ""
430-
}
431+
},
432+
"repeatable": "true"
431433
},
432434
"propertyURI": "http://www.loc.gov/mads/rdf/v1#CorporateName",
433435
"type": "lookup",
@@ -508,7 +510,7 @@
508510
"valueDataType": {}
509511
},
510512
"propertyLabel": "Other Designation Associated with Corporate Body (RDA 11.7)",
511-
"propertyURI": "http://www.loc.gov/mads/rdf/v2.html#OtherDesignation",
513+
"propertyURI": "http://www.loc.gov/mads/rdf/v1#entityDescriptor",
512514
"remark": "http://access.rdatoolkit.org/rdachp11_rda11-4726.html"
513515
},
514516
{
@@ -670,7 +672,8 @@
670672
],
671673
"valueDataType": {
672674
"dataTypeURI": ""
673-
}
675+
},
676+
"repeatable": "true"
674677
},
675678
"propertyURI": "http://www.loc.gov/mads/rdf/v1#ConferenceName",
676679
"type": "lookup",
@@ -767,7 +770,7 @@
767770
},
768771
"remark": "http://access.rdatoolkit.org/rdachp11_rda11-4726.html",
769772
"propertyLabel": "Other Designation Associated with Conference (RDA 11.7) CORE IF ...",
770-
"propertyURI": "http://www.loc.gov/mads/rdf/v2.html#OtherDesignation"
773+
"propertyURI": "http://www.loc.gov/mads/rdf/v1#entityDescriptor"
771774
},
772775
{
773776
"mandatory": "false",
@@ -916,7 +919,8 @@
916919
],
917920
"valueDataType": {
918921
"dataTypeURI": ""
919-
}
922+
},
923+
"repeatable": "true"
920924
}
921925
},
922926
{
@@ -1440,7 +1444,7 @@
14401444
"propertyTemplates": [
14411445
{
14421446
"mandatory": "false",
1443-
"repeatable": "true",
1447+
"repeatable": "false",
14441448
"type": "lookup",
14451449
"resourceTemplates": [],
14461450
"valueConstraint": {
@@ -1450,22 +1454,24 @@
14501454
],
14511455
"valueDataType": {
14521456
"dataTypeURI": ""
1453-
}
1457+
},
1458+
"repeatable": "false"
14541459
},
14551460
"propertyLabel": "Search MARC relator term",
14561461
"propertyURI": "http://id.loc.gov/ontologies/bibframe/Role"
14571462
},
14581463
{
14591464
"mandatory": "false",
1460-
"repeatable": "true",
1465+
"repeatable": "false",
14611466
"type": "literal",
14621467
"resourceTemplates": [],
14631468
"valueConstraint": {
14641469
"valueTemplateRefs": [],
14651470
"useValuesFrom": [],
14661471
"valueDataType": {
14671472
"dataTypeURI": ""
1468-
}
1473+
},
1474+
"repeatable": "false"
14691475
},
14701476
"propertyURI": "http://www.w3.org/2000/01/rdf-schema#label",
14711477
"propertyLabel": "Input RDA relationship designator term (if it does not appear above)"

0 commit comments

Comments
 (0)