@@ -491,39 +491,32 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
491491 }
492492 }
493493 console . log ( full . id ) ;
494-
495- if ( text !== "N/A" && full . status === "published" ) {
494+ if ( text !== "N/A" && full . status === "published" || full . status === "success" ) {
496495 var ldsurl = "http://mlvlp04.loc.gov:8230/loc.natlib.instances.e" + text . trim ( ) + "0001" ;
497496 if ( text . trim ( ) . startsWith ( "n" ) )
498497 ldsurl = "http://mlvlp04.loc.gov:8230/loc.natlib.works." + text . trim ( ) . replace ( / \s + / g, '' ) ;
499498
500499 var lccn = text . trim ( ) ;
501500 var table = new $ . fn . dataTable . Api ( meta . settings ) ;
502501 var cell = table . cell ( meta . row , meta . col ) ;
503-
504- $ . ajax ( {
505- type : "HEAD" ,
506- async : true ,
507- data : { uri : ldsurl } ,
508- url : config . url + "/profile-edit/server/checkuri" ,
509- } ) . done ( function ( data ) {
510- cell . node ( ) . innerHTML = "<a href=\"" + ldsurl + "\">" + lccn + "</a>" ;
502+ if ( full . status === "success" ) {
503+ cell . node ( ) . innerHTML = "<a href=\"" + ldsurl + "\">" + lccn + "</a>" ;
511504 $ ( cell . node ( ) ) . css ( 'background-color' , 'lightgreen' ) ;
512- } ) . fail ( function ( data , text ) {
513- if ( full . status === "published" ) {
514- $ ( cell . node ( ) ) . css ( 'background-color' , 'lightcoral' ) ;
515- }
516- /*else {
517- var resourceuri = "http://mlvlp04.loc.gov:3000/resources/"+table.cell(meta.row,1).node().innerHTML+".rdf";
518- $.ajax({
519- type: "HEAD",
520- async:true,
521- url: resourceuri,
522- }).done( function (data ){
523- $(cell.node()).css('background-color', 'lightcoral');
524- });
525- }*/
526- } ) ;
505+ } else {
506+ $ . ajax ( {
507+ type : "HEAD" ,
508+ async : true ,
509+ data : { uri : ldsurl } ,
510+ url : config . url + "/profile-edit/server/checkuri" ,
511+ } ) . done ( function ( data ) {
512+ cell . node ( ) . innerHTML = "<a href=\"" + ldsurl + "\">" + lccn + "</a>" ;
513+ $ ( cell . node ( ) ) . css ( 'background-color' , 'lightgreen' ) ;
514+ } ) . fail ( function ( data , text ) {
515+ if ( full . status === "published" ) {
516+ $ ( cell . node ( ) ) . css ( 'background-color' , 'lightcoral' ) ;
517+ }
518+ } ) ;
519+ }
527520 }
528521
529522 return text ;
@@ -1024,9 +1017,9 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
10241017 if ( _ . some ( bfeditor . bfestore . store , { "p" :"http://id.loc.gov/ontologies/bibframe/adminMetadata" } ) ) {
10251018
10261019 var modifiedDate = new Date ( save_json . modified ) ;
1027- var modifiedDateString = modifiedDate . getFullYear ( ) ; + '-' + modifiedDate . getMonth ( ) + 1 + '-' + modifiedDate . getDate ( ) ;
1020+ var modifiedDateString = modifiedDate . toJSON ( ) . split ( / \. / ) [ 0 ] ;
10281021
1029- if ( ! _ . has ( bfeditor . bfestore . store , { p : "http://id.loc.gov/ontologies/bibframe/changeDate" } ) ) {
1022+ if ( _ . has ( bfeditor . bfestore . store , { p : "http://id.loc.gov/ontologies/bibframe/changeDate" } ) ) {
10301023 _ . find ( bfeditor . bfestore . store , { p :"http://id.loc.gov/ontologies/bibframe/changeDate" } ) . o = modifiedDateString ;
10311024 } else {
10321025 var adminTriple = { } ;
@@ -1081,6 +1074,24 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
10811074 save_json . url = bfeditor . bfestore . url ;
10821075 save_json . created = bfeditor . bfestore . created ;
10831076 save_json . modified = new Date ( ) . toUTCString ( ) ;
1077+
1078+ if ( _ . some ( bfeditor . bfestore . store , { "p" :"http://id.loc.gov/ontologies/bibframe/adminMetadata" } ) ) {
1079+
1080+ var modifiedDate = new Date ( save_json . modified ) ;
1081+ var modifiedDateString = modifiedDate . toJSON ( ) . split ( / \. / ) [ 0 ] ;
1082+
1083+ if ( _ . has ( bfeditor . bfestore . store , { p : "http://id.loc.gov/ontologies/bibframe/changeDate" } ) ) {
1084+ _ . find ( bfeditor . bfestore . store , { p :"http://id.loc.gov/ontologies/bibframe/changeDate" } ) . o = modifiedDateString ;
1085+ } else {
1086+ var adminTriple = { } ;
1087+ adminTriple . s = _ . find ( bfeditor . bfestore . store , { "p" :"http://id.loc.gov/ontologies/bibframe/adminMetadata" } ) . o ;
1088+ adminTriple . p = "http://id.loc.gov/ontologies/bibframe/changeDate" ;
1089+ adminTriple . o = modifiedDateString ;
1090+ adminTriple . otype = "literal" ;
1091+ bfeditor . bfestore . store . push ( adminTriple )
1092+ }
1093+ }
1094+
10841095 save_json . status = "published" ;
10851096 save_json . objid = "loc.natlib.instances." + save_json . name + "0001" ;
10861097 save_json . id = save_json . name ;
@@ -1215,7 +1226,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
12151226 if ( ! _ . isEmpty ( worklist ) ) {
12161227 //check for type
12171228
1218- var rtType = _ . where ( worklist , { "p" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" } ) ;
1229+ var rtType = _ . where ( worklist , { "p" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" , o : fobject . resourceTemplates [ urt ] . resourceURI } ) ;
12191230
12201231 if ( ! _ . isEmpty ( rtType ) ) {
12211232 fobject . resourceTemplates [ urt ] . defaulturi = rtType [ 0 ] . s
@@ -1860,7 +1871,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
18601871 var $buttongroup = editDeleteButtonGroup ( bgvars ) ;
18611872 $save . append ( $buttongroup ) ;
18621873
1863- if ( property . valueConstraint . repeatable !== undefined && property . valueConstraint . repeatable == "false" ) {
1874+ if ( property . repeatable === "false" || property . valueConstraint . repeatable == "false" ) {
18641875 var $el = $ ( "#" + property . guid , form ) ;
18651876 if ( $el . is ( "input" ) ) {
18661877 $el . prop ( "disabled" , true ) ;
@@ -2087,7 +2098,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
20872098 var $buttongroup = editDeleteButtonGroup ( bgvars ) ;
20882099
20892100 $save . append ( $buttongroup ) ;
2090- if ( property . valueConstraint !== undefined && property . valueConstraint . repeatable !== undefined && property . valueConstraint . repeatable == "false" ) {
2101+ if ( property . repeatable === "false" || property . valueConstraint . repeatable == "false" ) {
20912102 var $el = $ ( "#" + property . guid , form ) ;
20922103 if ( $el . is ( "input" ) ) {
20932104 $el . prop ( "disabled" , true ) ;
@@ -2176,7 +2187,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
21762187 adminTriple . s = resourceURI ;
21772188 adminTriple . p = "http://id.loc.gov/ontologies/bibframe/creationDate" ;
21782189 var d = new Date ( bfeditor . bfestore . created ) ;
2179- adminTriple . o = d . getFullYear ( ) ; + '-' + d . getMonth ( ) + 1 + '-' + d . getDate ( ) ;
2190+ adminTriple . o = d . getFullYear ( ) + '-' + d . getMonth ( ) + 1 + '-' + d . getDate ( ) ;
21802191 adminTriple . otype = "literal" ;
21812192 triplespassed . push ( adminTriple ) ;
21822193 bfeditor . bfestore . store . push ( adminTriple )
@@ -2885,7 +2896,7 @@ bfe.define('src/bfe', ['require', 'exports', 'module', 'src/bfestore', 'src/bfel
28852896 $ ( "#" + pguid , formobject . form ) . typeahead ( 'val' , "" ) ;
28862897 $ ( "#" + pguid , formobject . form ) . typeahead ( 'close' ) ;
28872898
2888- if ( property . valueConstraint !== undefined && property . valueConstraint . repeatable !== undefined && property . valueConstraint . repeatable == "false" ) {
2899+ if ( property . repeatable === "false" || property . valueConstraint . repeatable == "false" ) {
28892900 var $el = $ ( "#" + pguid , formobject . form ) ;
28902901 if ( $el . is ( "input" ) ) {
28912902 $el . prop ( "disabled" , true ) ;
0 commit comments